summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-04-17 06:50:56 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-04-17 19:34:45 +0200
commit52a4489d6508388de50c34b27cd5f646ccd6f24f (patch)
tree32f4900c9f5e14e690cd7683644f51c08275c3d5 /src/video_core
parentOpenGL: Move PicaShaderConfig to gl_shader_gen.h (diff)
downloadyuzu-52a4489d6508388de50c34b27cd5f646ccd6f24f.tar
yuzu-52a4489d6508388de50c34b27cd5f646ccd6f24f.tar.gz
yuzu-52a4489d6508388de50c34b27cd5f646ccd6f24f.tar.bz2
yuzu-52a4489d6508388de50c34b27cd5f646ccd6f24f.tar.lz
yuzu-52a4489d6508388de50c34b27cd5f646ccd6f24f.tar.xz
yuzu-52a4489d6508388de50c34b27cd5f646ccd6f24f.tar.zst
yuzu-52a4489d6508388de50c34b27cd5f646ccd6f24f.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp4
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.h6
3 files changed, 5 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 150bb5e3c..a47307099 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1004,7 +1004,7 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(
}
void RasterizerOpenGL::SetShader() {
- GLShader::PicaShaderConfig config = GLShader::PicaShaderConfig::CurrentConfig();
+ auto config = GLShader::PicaShaderConfig::BuildFromRegs(Pica::g_state.regs);
std::unique_ptr<PicaShader> shader = std::make_unique<PicaShader>();
// Find (or generate) the GLSL shader for the current TEV state
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 3b2a50f02..54a8dde15 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -24,14 +24,12 @@ using TevStageConfig = TexturingRegs::TevStageConfig;
namespace GLShader {
-PicaShaderConfig PicaShaderConfig::CurrentConfig() {
+PicaShaderConfig PicaShaderConfig::BuildFromRegs(const Pica::Regs& regs) {
PicaShaderConfig res;
auto& state = res.state;
std::memset(&state, 0, sizeof(PicaShaderConfig::State));
- const auto& regs = Pica::g_state.regs;
-
state.scissor_test_mode = regs.rasterizer.scissor_test.mode;
state.depthmap_enable = regs.rasterizer.depthmap_enable;
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.h b/src/video_core/renderer_opengl/gl_shader_gen.h
index e01bd34f9..921d976a1 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.h
+++ b/src/video_core/renderer_opengl/gl_shader_gen.h
@@ -39,8 +39,8 @@ enum Attributes {
*/
union PicaShaderConfig {
- /// Construct a PicaShaderConfig with the current Pica register configuration.
- static PicaShaderConfig CurrentConfig();
+ /// Construct a PicaShaderConfig with the given Pica register configuration.
+ static PicaShaderConfig BuildFromRegs(const Pica::Regs& regs);
bool TevStageUpdatesCombinerBufferColor(unsigned stage_index) const {
return (stage_index < 4) && (state.combiner_buffer_input & (1 << stage_index));
@@ -58,7 +58,7 @@ union PicaShaderConfig {
// This makes BitField not TC when used in a union or struct so we have to resort
// to this ugly hack.
// Once that bug is fixed we can use Pica::Regs::TevStageConfig here.
- // Doesn't include const_color because we don't sync it, see comment in CurrentConfig()
+ // Doesn't include const_color because we don't sync it, see comment in BuildFromRegs()
struct TevStageConfigRaw {
u32 sources_raw;
u32 modifiers_raw;