From 86146ef8194669d1961aff3c241e6fd6fd8dbc77 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 7 Jun 2018 08:33:23 -0500 Subject: GLRenderer: Write the shader stage configuration UBO data *before* copying it to the GPU. This should fix the bug with the vs_config UBO being uninitialized during shader execution. --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index b23b8fb29..e7fbc703a 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -214,13 +214,14 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) { continue; } + GLShader::MaxwellUniformData ubo{}; + ubo.SetFromRegs(gpu.state.shader_stages[stage]); + std::memcpy(buffer_ptr, &ubo, sizeof(ubo)); + // Upload uniform data as one UBO per stage const GLintptr ubo_offset = buffer_offset; copy_buffer(uniform_buffers[stage].handle, ubo_offset, sizeof(GLShader::MaxwellUniformData)); - GLShader::MaxwellUniformData* ub_ptr = - reinterpret_cast(buffer_ptr); - ub_ptr->SetFromRegs(gpu.state.shader_stages[stage]); buffer_ptr += sizeof(GLShader::MaxwellUniformData); buffer_offset += sizeof(GLShader::MaxwellUniformData); -- cgit v1.2.3