implementing opengl binds group

This commit is contained in:
2025-04-06 20:00:20 +02:00
parent fd6bc036b8
commit 849fc458e2
13 changed files with 560 additions and 8 deletions

View File

@@ -6,8 +6,9 @@
#include "../../PulseInternal.h"
#include "OpenGL.h"
#include "OpenGLComputePipeline.h"
#include "OpenGLDevice.h"
#include "OpenGLBindsGroup.h"
#include "OpenGLComputePipeline.h"
PulseComputePipeline OpenGLCreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info)
{
@@ -32,6 +33,33 @@ PulseComputePipeline OpenGLCreateComputePipeline(PulseDevice device, const Pulse
}
opengl_pipeline->program = opengl_device->glCreateShaderProgramv(device, GL_COMPUTE_SHADER, 1, (const GLchar**)(&info->code));
GLint linked = GL_FALSE;
opengl_device->glGetProgramiv(device, opengl_pipeline->program, GL_LINK_STATUS, &linked);
if(linked != GL_TRUE)
{
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
{
GLint len = 0;
opengl_device->glGetProgramiv(device, opengl_pipeline->program, GL_INFO_LOG_LENGTH, &len);
char* log = (char*)malloc(len);
PULSE_CHECK_ALLOCATION_RETVAL(log, PULSE_NULL_HANDLE);
opengl_device->glGetProgramInfoLog(device, opengl_pipeline->program, len, PULSE_NULLPTR, log);
PulseLogErrorFmt(device->backend, "compute pipeline could not be created\n%.*s", len, log);
free(log);
}
opengl_device->glDeleteProgram(device, opengl_pipeline->program);
free(opengl_pipeline);
free(pipeline);
return PULSE_NULL_HANDLE;
}
opengl_pipeline->readonly_group_layout = OpenGLGetBindsGroupLayout(&opengl_device->binds_group_layout_manager, info->num_readonly_storage_images, info->num_readonly_storage_buffers, 0, 0, 0);
opengl_pipeline->readwrite_group_layout = OpenGLGetBindsGroupLayout(&opengl_device->binds_group_layout_manager, 0, 0, info->num_readwrite_storage_images, info->num_readwrite_storage_buffers, 0);
opengl_pipeline->uniform_group_layout = OpenGLGetBindsGroupLayout(&opengl_device->binds_group_layout_manager, 0, 0, 0, 0, info->num_uniform_buffers);
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend))
PulseLogInfoFmt(device->backend, "%s created new compute pipeline %p", device->backend->backend == PULSE_BACKEND_OPENGL ? "(OpenGL)" : "(OpenGL ES)", pipeline);
@@ -47,8 +75,9 @@ void OpenGLDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipel
return;
}
PULSE_UNUSED(device);
OpenGLDevice* opengl_device = OPENGL_RETRIEVE_DRIVER_DATA_AS(device, OpenGLDevice*);
OpenGLComputePipeline* opengl_pipeline = OPENGL_RETRIEVE_DRIVER_DATA_AS(pipeline, OpenGLComputePipeline*);
opengl_device->glDeleteProgram(device, opengl_pipeline->program);
free(opengl_pipeline);
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend))