diff options
| author | 2017-02-18 20:46:26 +0100 | |
|---|---|---|
| committer | 2017-02-18 11:46:26 -0800 | |
| commit | e594e63bb5ba2baefe85c7b92a45ab60472ad445 (patch) | |
| tree | d565fbf24c01cf8c4492b4c95e3b1171eecba267 /src | |
| parent | dynarmic: Update the submodule. (diff) | |
| download | yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar.gz yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar.xz yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.zip | |
OpenGL: Check if uniform block exists before updating it (#2581)
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 4b1948a71..de1d5eba7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -1071,37 +1071,38 @@ void RasterizerOpenGL::SetShader() { | |||
| 1071 | 1071 | ||
| 1072 | current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); | 1072 | current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); |
| 1073 | 1073 | ||
| 1074 | unsigned int block_index = | 1074 | GLuint block_index = glGetUniformBlockIndex(current_shader->shader.handle, "shader_data"); |
| 1075 | glGetUniformBlockIndex(current_shader->shader.handle, "shader_data"); | 1075 | if (block_index != GL_INVALID_INDEX) { |
| 1076 | GLint block_size; | 1076 | GLint block_size; |
| 1077 | glGetActiveUniformBlockiv(current_shader->shader.handle, block_index, | 1077 | glGetActiveUniformBlockiv(current_shader->shader.handle, block_index, |
| 1078 | GL_UNIFORM_BLOCK_DATA_SIZE, &block_size); | 1078 | GL_UNIFORM_BLOCK_DATA_SIZE, &block_size); |
| 1079 | ASSERT_MSG(block_size == sizeof(UniformData), | 1079 | ASSERT_MSG(block_size == sizeof(UniformData), |
| 1080 | "Uniform block size did not match! Got %d, expected %zu", | 1080 | "Uniform block size did not match! Got %d, expected %zu", |
| 1081 | static_cast<int>(block_size), sizeof(UniformData)); | 1081 | static_cast<int>(block_size), sizeof(UniformData)); |
| 1082 | glUniformBlockBinding(current_shader->shader.handle, block_index, 0); | 1082 | glUniformBlockBinding(current_shader->shader.handle, block_index, 0); |
| 1083 | 1083 | ||
| 1084 | // Update uniforms | 1084 | // Update uniforms |
| 1085 | SyncDepthScale(); | 1085 | SyncDepthScale(); |
| 1086 | SyncDepthOffset(); | 1086 | SyncDepthOffset(); |
| 1087 | SyncAlphaTest(); | 1087 | SyncAlphaTest(); |
| 1088 | SyncCombinerColor(); | 1088 | SyncCombinerColor(); |
| 1089 | auto& tev_stages = Pica::g_state.regs.texturing.GetTevStages(); | 1089 | auto& tev_stages = Pica::g_state.regs.texturing.GetTevStages(); |
| 1090 | for (int index = 0; index < tev_stages.size(); ++index) | 1090 | for (int index = 0; index < tev_stages.size(); ++index) |
| 1091 | SyncTevConstColor(index, tev_stages[index]); | 1091 | SyncTevConstColor(index, tev_stages[index]); |
| 1092 | |||
| 1093 | SyncGlobalAmbient(); | ||
| 1094 | for (int light_index = 0; light_index < 8; light_index++) { | ||
| 1095 | SyncLightSpecular0(light_index); | ||
| 1096 | SyncLightSpecular1(light_index); | ||
| 1097 | SyncLightDiffuse(light_index); | ||
| 1098 | SyncLightAmbient(light_index); | ||
| 1099 | SyncLightPosition(light_index); | ||
| 1100 | SyncLightDistanceAttenuationBias(light_index); | ||
| 1101 | SyncLightDistanceAttenuationScale(light_index); | ||
| 1102 | } | ||
| 1092 | 1103 | ||
| 1093 | SyncGlobalAmbient(); | 1104 | SyncFogColor(); |
| 1094 | for (int light_index = 0; light_index < 8; light_index++) { | ||
| 1095 | SyncLightSpecular0(light_index); | ||
| 1096 | SyncLightSpecular1(light_index); | ||
| 1097 | SyncLightDiffuse(light_index); | ||
| 1098 | SyncLightAmbient(light_index); | ||
| 1099 | SyncLightPosition(light_index); | ||
| 1100 | SyncLightDistanceAttenuationBias(light_index); | ||
| 1101 | SyncLightDistanceAttenuationScale(light_index); | ||
| 1102 | } | 1105 | } |
| 1103 | |||
| 1104 | SyncFogColor(); | ||
| 1105 | } | 1106 | } |
| 1106 | } | 1107 | } |
| 1107 | 1108 | ||