diff --git a/drivers/glrend/shader_brender.c b/drivers/glrend/shader_brender.c index 38ee24e5..a7875d9e 100644 --- a/drivers/glrend/shader_brender.c +++ b/drivers/glrend/shader_brender.c @@ -6,23 +6,23 @@ static void VIDEOI_GetShaderVariables(HVIDEO hVideo) { glGenBuffers(1, &hVideo->brenderProgram.uboScene); - DeviceGLObjectLabel(GL_BUFFER, hVideo->brenderProgram.uboScene, BR_GLREND_DEBUG_INTERNAL_PREFIX "brender:shader:ubo:scene"); - glBindBuffer(GL_UNIFORM_BUFFER, hVideo->brenderProgram.uboScene); glUniformBlockBinding(hVideo->brenderProgram.program, hVideo->brenderProgram.blockIndexScene, hVideo->brenderProgram.blockBindingScene); glBindBufferBase(GL_UNIFORM_BUFFER, hVideo->brenderProgram.blockBindingScene, hVideo->brenderProgram.uboScene); glBufferData(GL_UNIFORM_BUFFER, sizeof(shader_data_scene), NULL, GL_DYNAMIC_DRAW); - glGenBuffers(1, &hVideo->brenderProgram.uboModel); - DeviceGLObjectLabel(GL_BUFFER, hVideo->brenderProgram.uboModel, BR_GLREND_DEBUG_INTERNAL_PREFIX "brender:shader:ubo:model"); + DeviceGLObjectLabel(GL_BUFFER, hVideo->brenderProgram.uboScene, BR_GLREND_DEBUG_INTERNAL_PREFIX "brender:shader:ubo:scene"); + glGenBuffers(1, &hVideo->brenderProgram.uboModel); glBindBuffer(GL_UNIFORM_BUFFER, hVideo->brenderProgram.uboModel); glUniformBlockBinding(hVideo->brenderProgram.program, hVideo->brenderProgram.blockIndexModel, hVideo->brenderProgram.blockBindingModel); glBindBufferBase(GL_UNIFORM_BUFFER, hVideo->brenderProgram.blockBindingModel, hVideo->brenderProgram.uboModel); glBufferData(GL_UNIFORM_BUFFER, sizeof(shader_data_model), NULL, GL_DYNAMIC_DRAW); + DeviceGLObjectLabel(GL_BUFFER, hVideo->brenderProgram.uboModel, BR_GLREND_DEBUG_INTERNAL_PREFIX "brender:shader:ubo:model"); + hVideo->brenderProgram.attributes.aPosition = glGetAttribLocation(hVideo->brenderProgram.program, "aPosition"); hVideo->brenderProgram.attributes.aUV = glGetAttribLocation(hVideo->brenderProgram.program, "aUV"); hVideo->brenderProgram.attributes.aNormal = glGetAttribLocation(hVideo->brenderProgram.program, "aNormal"); diff --git a/drivers/glrend/shader_rect.c b/drivers/glrend/shader_rect.c index e7e01a2a..cf7725b0 100644 --- a/drivers/glrend/shader_rect.c +++ b/drivers/glrend/shader_rect.c @@ -21,10 +21,10 @@ br_boolean VIDEOI_CompileRectShader(HVIDEO hVideo) DeviceGLObjectLabel(GL_PROGRAM, hVideo->rectProgram.program, BR_GLREND_DEBUG_INTERNAL_PREFIX "rect:program"); glGenVertexArrays(1, &hVideo->rectProgram.vao); - DeviceGLObjectLabel(GL_VERTEX_ARRAY, hVideo->rectProgram.vao, BR_GLREND_DEBUG_INTERNAL_PREFIX "rect:vao"); + glBindVertexArray(hVideo->rectProgram.vao); + glBindVertexArray(0); - glGenBuffers(1, &hVideo->rectProgram.ubo); - DeviceGLObjectLabel(GL_BUFFER, hVideo->rectProgram.ubo, BR_GLREND_DEBUG_INTERNAL_PREFIX "rect:ubo"); + DeviceGLObjectLabel(GL_VERTEX_ARRAY, hVideo->rectProgram.vao, BR_GLREND_DEBUG_INTERNAL_PREFIX "rect:vao"); hVideo->rectProgram.uSampler = glGetUniformLocation(hVideo->rectProgram.program, "uSampler"); hVideo->rectProgram.uIndexTex = glGetUniformLocation(hVideo->rectProgram.program, "uIndexTex"); @@ -34,10 +34,13 @@ br_boolean VIDEOI_CompileRectShader(HVIDEO hVideo) glUniformBlockBinding(hVideo->rectProgram.program, hVideo->rectProgram.block_index_rect_data, hVideo->rectProgram.block_binding_rect_data); + glGenBuffers(1, &hVideo->rectProgram.ubo); glBindBuffer(GL_UNIFORM_BUFFER, hVideo->rectProgram.ubo); glBindBufferBase(GL_UNIFORM_BUFFER, hVideo->rectProgram.block_binding_rect_data, hVideo->rectProgram.ubo); glBindBuffer(GL_UNIFORM_BUFFER, 0); + DeviceGLObjectLabel(GL_BUFFER, hVideo->rectProgram.ubo, BR_GLREND_DEBUG_INTERNAL_PREFIX "rect:ubo"); + glBindFragDataLocation(hVideo->rectProgram.program, 0, "main_colour"); prog_failed: diff --git a/drivers/glrend/shader_text.c b/drivers/glrend/shader_text.c index 97f8028d..30ea009a 100644 --- a/drivers/glrend/shader_text.c +++ b/drivers/glrend/shader_text.c @@ -24,10 +24,10 @@ br_boolean VIDEOI_CompileTextShader(HVIDEO hVideo) DeviceGLObjectLabel(GL_PROGRAM, hVideo->textProgram.program, BR_GLREND_DEBUG_INTERNAL_PREFIX "text:program"); glGenVertexArrays(1, &hVideo->textProgram.vao_glyphs); - DeviceGLObjectLabel(GL_VERTEX_ARRAY, hVideo->textProgram.vao_glyphs, BR_GLREND_DEBUG_INTERNAL_PREFIX "text:vao"); + glBindVertexArray(hVideo->textProgram.vao_glyphs); + glBindVertexArray(0); - glGenBuffers(1, &hVideo->textProgram.ubo_glyphs); - DeviceGLObjectLabel(GL_BUFFER, hVideo->textProgram.ubo_glyphs, BR_GLREND_DEBUG_INTERNAL_PREFIX "text:ubo"); + DeviceGLObjectLabel(GL_VERTEX_ARRAY, hVideo->textProgram.vao_glyphs, BR_GLREND_DEBUG_INTERNAL_PREFIX "text:vao"); hVideo->textProgram.uSampler = glGetUniformLocation(hVideo->textProgram.program, "uSampler"); @@ -41,10 +41,13 @@ br_boolean VIDEOI_CompileTextShader(HVIDEO hVideo) glUniformBlockBinding(hVideo->textProgram.program, hVideo->textProgram.block_index_glyphs, hVideo->textProgram.block_binding_glyphs); + glGenBuffers(1, &hVideo->textProgram.ubo_glyphs); glBindBuffer(GL_UNIFORM_BUFFER, hVideo->textProgram.ubo_glyphs); glBindBufferBase(GL_UNIFORM_BUFFER, hVideo->textProgram.block_binding_glyphs, hVideo->textProgram.ubo_glyphs); glBindBuffer(GL_UNIFORM_BUFFER, 0); + DeviceGLObjectLabel(GL_BUFFER, hVideo->textProgram.ubo_glyphs, BR_GLREND_DEBUG_INTERNAL_PREFIX "text:ubo"); + glBindFragDataLocation(hVideo->textProgram.program, 0, "main_colour"); prog_failed: