summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-11-26 04:43:28 +0100
committerbunnei <bunneidev@gmail.com>2015-11-26 04:43:28 +0100
commit913be807828f27647db6ed99602fb1acf5b5b451 (patch)
tree79ae175c9c92eb477f34cbe1c1e72ee6ad6085e5
parentMerge pull request #1253 from kemenaran/avoid-explicit-uniform-location (diff)
parentrenderer_opengl: Fix uniform issues introduced with kemenaran/avoid-explicit-uniform-location. (diff)
downloadyuzu-913be807828f27647db6ed99602fb1acf5b5b451.tar
yuzu-913be807828f27647db6ed99602fb1acf5b5b451.tar.gz
yuzu-913be807828f27647db6ed99602fb1acf5b5b451.tar.bz2
yuzu-913be807828f27647db6ed99602fb1acf5b5b451.tar.lz
yuzu-913be807828f27647db6ed99602fb1acf5b5b451.tar.xz
yuzu-913be807828f27647db6ed99602fb1acf5b5b451.tar.zst
yuzu-913be807828f27647db6ed99602fb1acf5b5b451.zip
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 2a8949198..822739088 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -492,10 +492,12 @@ void RasterizerOpenGL::SetShader() {
state.Apply();
// Set the texture samplers to correspond to different texture units
- GLuint uniform_tex = glGetUniformLocation(shader->shader.handle, "tex");
- glUniform1i(uniform_tex, 0);
- glUniform1i(uniform_tex + 1, 1);
- glUniform1i(uniform_tex + 2, 2);
+ GLuint uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[0]");
+ if (uniform_tex != -1) { glUniform1i(uniform_tex, 0); }
+ uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[1]");
+ if (uniform_tex != -1) { glUniform1i(uniform_tex, 1); }
+ uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[2]");
+ if (uniform_tex != -1) { glUniform1i(uniform_tex, 2); }
current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get();
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 0f781805c..5268340cf 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -320,7 +320,7 @@ static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsi
std::string GenerateFragmentShader(const PicaShaderConfig& config) {
std::string out = R"(
-#version 330
+#version 330 core
#define NUM_TEV_STAGES 6
in vec4 primary_color;
@@ -362,7 +362,7 @@ layout (std140) uniform shader_data {
}
std::string GenerateVertexShader() {
- std::string out = "#version 330\n";
+ std::string out = "#version 330 core\n";
out += "layout(location = " + std::to_string((int)ATTRIBUTE_POSITION) + ") in vec4 vert_position;\n";
out += "layout(location = " + std::to_string((int)ATTRIBUTE_COLOR) + ") in vec4 vert_color;\n";
out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD0) + ") in vec2 vert_texcoord0;\n";