summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorJannik Vogel <email@jannikvogel.de>2017-02-18 20:46:26 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-18 20:46:26 +0100
commite594e63bb5ba2baefe85c7b92a45ab60472ad445 (patch)
treed565fbf24c01cf8c4492b4c95e3b1171eecba267 /src/video_core
parentdynarmic: Update the submodule. (diff)
downloadyuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar
yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar.gz
yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar.bz2
yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar.lz
yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar.xz
yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.tar.zst
yuzu-e594e63bb5ba2baefe85c7b92a45ab60472ad445.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp59
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() {
current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get();
- unsigned int block_index =
- glGetUniformBlockIndex(current_shader->shader.handle, "shader_data");
- GLint block_size;
- glGetActiveUniformBlockiv(current_shader->shader.handle, block_index,
- GL_UNIFORM_BLOCK_DATA_SIZE, &block_size);
- ASSERT_MSG(block_size == sizeof(UniformData),
- "Uniform block size did not match! Got %d, expected %zu",
- static_cast<int>(block_size), sizeof(UniformData));
- glUniformBlockBinding(current_shader->shader.handle, block_index, 0);
-
- // Update uniforms
- SyncDepthScale();
- SyncDepthOffset();
- SyncAlphaTest();
- SyncCombinerColor();
- auto& tev_stages = Pica::g_state.regs.texturing.GetTevStages();
- for (int index = 0; index < tev_stages.size(); ++index)
- SyncTevConstColor(index, tev_stages[index]);
+ GLuint block_index = glGetUniformBlockIndex(current_shader->shader.handle, "shader_data");
+ if (block_index != GL_INVALID_INDEX) {
+ GLint block_size;
+ glGetActiveUniformBlockiv(current_shader->shader.handle, block_index,
+ GL_UNIFORM_BLOCK_DATA_SIZE, &block_size);
+ ASSERT_MSG(block_size == sizeof(UniformData),
+ "Uniform block size did not match! Got %d, expected %zu",
+ static_cast<int>(block_size), sizeof(UniformData));
+ glUniformBlockBinding(current_shader->shader.handle, block_index, 0);
+
+ // Update uniforms
+ SyncDepthScale();
+ SyncDepthOffset();
+ SyncAlphaTest();
+ SyncCombinerColor();
+ auto& tev_stages = Pica::g_state.regs.texturing.GetTevStages();
+ for (int index = 0; index < tev_stages.size(); ++index)
+ SyncTevConstColor(index, tev_stages[index]);
+
+ SyncGlobalAmbient();
+ for (int light_index = 0; light_index < 8; light_index++) {
+ SyncLightSpecular0(light_index);
+ SyncLightSpecular1(light_index);
+ SyncLightDiffuse(light_index);
+ SyncLightAmbient(light_index);
+ SyncLightPosition(light_index);
+ SyncLightDistanceAttenuationBias(light_index);
+ SyncLightDistanceAttenuationScale(light_index);
+ }
- SyncGlobalAmbient();
- for (int light_index = 0; light_index < 8; light_index++) {
- SyncLightSpecular0(light_index);
- SyncLightSpecular1(light_index);
- SyncLightDiffuse(light_index);
- SyncLightAmbient(light_index);
- SyncLightPosition(light_index);
- SyncLightDistanceAttenuationBias(light_index);
- SyncLightDistanceAttenuationScale(light_index);
+ SyncFogColor();
}
-
- SyncFogColor();
}
}