summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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() {
492 state.Apply(); 492 state.Apply();
493 493
494 // Set the texture samplers to correspond to different texture units 494 // Set the texture samplers to correspond to different texture units
495 GLuint uniform_tex = glGetUniformLocation(shader->shader.handle, "tex"); 495 GLuint uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[0]");
496 glUniform1i(uniform_tex, 0); 496 if (uniform_tex != -1) { glUniform1i(uniform_tex, 0); }
497 glUniform1i(uniform_tex + 1, 1); 497 uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[1]");
498 glUniform1i(uniform_tex + 2, 2); 498 if (uniform_tex != -1) { glUniform1i(uniform_tex, 1); }
499 uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[2]");
500 if (uniform_tex != -1) { glUniform1i(uniform_tex, 2); }
499 501
500 current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); 502 current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get();
501 503
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
320 320
321std::string GenerateFragmentShader(const PicaShaderConfig& config) { 321std::string GenerateFragmentShader(const PicaShaderConfig& config) {
322 std::string out = R"( 322 std::string out = R"(
323#version 330 323#version 330 core
324#define NUM_TEV_STAGES 6 324#define NUM_TEV_STAGES 6
325 325
326in vec4 primary_color; 326in vec4 primary_color;
@@ -362,7 +362,7 @@ layout (std140) uniform shader_data {
362} 362}
363 363
364std::string GenerateVertexShader() { 364std::string GenerateVertexShader() {
365 std::string out = "#version 330\n"; 365 std::string out = "#version 330 core\n";
366 out += "layout(location = " + std::to_string((int)ATTRIBUTE_POSITION) + ") in vec4 vert_position;\n"; 366 out += "layout(location = " + std::to_string((int)ATTRIBUTE_POSITION) + ") in vec4 vert_position;\n";
367 out += "layout(location = " + std::to_string((int)ATTRIBUTE_COLOR) + ") in vec4 vert_color;\n"; 367 out += "layout(location = " + std::to_string((int)ATTRIBUTE_COLOR) + ") in vec4 vert_color;\n";
368 out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD0) + ") in vec2 vert_texcoord0;\n"; 368 out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD0) + ") in vec2 vert_texcoord0;\n";