summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-11-26 02:50:29 +0100
committerbunnei <bunneidev@gmail.com>2015-11-26 02:50:29 +0100
commitff502a51c58f9cad98a67cc86f2cfec2a5c1988a (patch)
tree035af9b541e6de8437a76fa18842aa26f30d4001
parentMerge pull request #1248 from polaris-/add-ssl-stubs (diff)
parentUse regular uniform location (diff)
downloadyuzu-ff502a51c58f9cad98a67cc86f2cfec2a5c1988a.tar
yuzu-ff502a51c58f9cad98a67cc86f2cfec2a5c1988a.tar.gz
yuzu-ff502a51c58f9cad98a67cc86f2cfec2a5c1988a.tar.bz2
yuzu-ff502a51c58f9cad98a67cc86f2cfec2a5c1988a.tar.lz
yuzu-ff502a51c58f9cad98a67cc86f2cfec2a5c1988a.tar.xz
yuzu-ff502a51c58f9cad98a67cc86f2cfec2a5c1988a.tar.zst
yuzu-ff502a51c58f9cad98a67cc86f2cfec2a5c1988a.zip
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h7
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp6
3 files changed, 5 insertions, 15 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 9b4bddabd..2a8949198 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -492,9 +492,10 @@ void RasterizerOpenGL::SetShader() {
state.Apply();
// Set the texture samplers to correspond to different texture units
- glUniform1i(PicaShader::Uniform::Texture0, 0);
- glUniform1i(PicaShader::Uniform::Texture1, 1);
- glUniform1i(PicaShader::Uniform::Texture2, 2);
+ GLuint uniform_tex = glGetUniformLocation(shader->shader.handle, "tex");
+ glUniform1i(uniform_tex, 0);
+ glUniform1i(uniform_tex + 1, 1);
+ glUniform1i(uniform_tex + 2, 2);
current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get();
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 071051dbc..5ba898189 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -138,13 +138,6 @@ public:
struct PicaShader {
/// OpenGL shader resource
OGLShader shader;
-
- /// Fragment shader uniforms
- enum Uniform : GLuint {
- Texture0 = 0,
- Texture1 = 1,
- Texture2 = 2,
- };
};
private:
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 3f1cf7a6f..0f781805c 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -321,8 +321,6 @@ static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsi
std::string GenerateFragmentShader(const PicaShaderConfig& config) {
std::string out = R"(
#version 330
-#extension GL_ARB_explicit_uniform_location : require
-
#define NUM_TEV_STAGES 6
in vec4 primary_color;
@@ -338,9 +336,7 @@ layout (std140) uniform shader_data {
)";
- using Uniform = RasterizerOpenGL::PicaShader::Uniform;
- out += "layout(location = " + std::to_string((int)Uniform::Texture0) + ") uniform sampler2D tex[3];\n";
-
+ out += "uniform sampler2D tex[3];\n";
out += "void main() {\n";
out += "vec4 combiner_buffer = tev_combiner_buffer_color;\n";
out += "vec4 last_tex_env_out = vec4(0.0);\n";