diff options
author | bunnei <bunneidev@gmail.com> | 2015-10-10 01:32:38 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-10-22 03:54:56 +0200 |
commit | 71edb55114af129d6f580e271ad5196043342abe (patch) | |
tree | 73cd89075909781d728e92cfe121eee92effe84b /src/video_core/renderer_opengl/gl_rasterizer.cpp | |
parent | gl_shader_gen: Rename 'o' to 'attr' in vertex/fragment shaders. (diff) | |
download | yuzu-71edb55114af129d6f580e271ad5196043342abe.tar yuzu-71edb55114af129d6f580e271ad5196043342abe.tar.gz yuzu-71edb55114af129d6f580e271ad5196043342abe.tar.bz2 yuzu-71edb55114af129d6f580e271ad5196043342abe.tar.lz yuzu-71edb55114af129d6f580e271ad5196043342abe.tar.xz yuzu-71edb55114af129d6f580e271ad5196043342abe.tar.zst yuzu-71edb55114af129d6f580e271ad5196043342abe.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 4f9865230..64639ed26 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -476,20 +476,14 @@ void RasterizerOpenGL::SetShader() { std::unique_ptr<TEVShader> shader = Common::make_unique<TEVShader>(); shader->shader.Create(GLShader::GenerateVertexShader().c_str(), GLShader::GenerateFragmentShader(config).c_str()); - shader->uniform_alphatest_ref = glGetUniformLocation(shader->shader.handle, "alphatest_ref"); - shader->uniform_tex = glGetUniformLocation(shader->shader.handle, "tex"); - shader->uniform_tev_combiner_buffer_color = glGetUniformLocation(shader->shader.handle, "tev_combiner_buffer_color"); - shader->uniform_tev_const_colors = glGetUniformLocation(shader->shader.handle, "const_color"); state.draw.shader_program = shader->shader.handle; state.Apply(); // Set the texture samplers to correspond to different texture units - if (shader->uniform_tex != -1) { - glUniform1i(shader->uniform_tex, 0); - glUniform1i(shader->uniform_tex + 1, 1); - glUniform1i(shader->uniform_tex + 2, 2); - } + glUniform1i(PicaShader::Uniform::Texture0, 0); + glUniform1i(PicaShader::Uniform::Texture1, 1); + glUniform1i(PicaShader::Uniform::Texture2, 2); current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); } @@ -622,8 +616,7 @@ void RasterizerOpenGL::SyncBlendColor() { void RasterizerOpenGL::SyncAlphaTest() { const auto& regs = Pica::g_state.regs; - if (current_shader->uniform_alphatest_ref != -1) - glUniform1i(current_shader->uniform_alphatest_ref, regs.output_merger.alpha_test.ref); + glUniform1i(PicaShader::Uniform::AlphaTestRef, regs.output_merger.alpha_test.ref); } void RasterizerOpenGL::SyncLogicOp() { @@ -654,17 +647,13 @@ void RasterizerOpenGL::SyncDepthTest() { } void RasterizerOpenGL::SyncCombinerColor() { - if (current_shader->uniform_tev_combiner_buffer_color != -1) { - auto combiner_color = PicaToGL::ColorRGBA8(Pica::g_state.regs.tev_combiner_buffer_color.raw); - glUniform4fv(current_shader->uniform_tev_combiner_buffer_color, 1, combiner_color.data()); - } + auto combiner_color = PicaToGL::ColorRGBA8(Pica::g_state.regs.tev_combiner_buffer_color.raw); + glUniform4fv(PicaShader::Uniform::TevCombinerBufferColor, 1, combiner_color.data()); } void RasterizerOpenGL::SyncTevConstColor(int stage_index, const Pica::Regs::TevStageConfig& tev_stage) { - if (current_shader->uniform_tev_const_colors != -1) { - auto const_color = PicaToGL::ColorRGBA8(tev_stage.const_color); - glUniform4fv(current_shader->uniform_tev_const_colors + stage_index, 1, const_color.data()); - } + auto const_color = PicaToGL::ColorRGBA8(tev_stage.const_color); + glUniform4fv(PicaShader::Uniform::TevConstColors + stage_index, 1, const_color.data()); } void RasterizerOpenGL::SyncDrawState() { |