VERY experimental Nintendo Switch 2 emulator
C++
pica: shader_dirty if texture2 coord changed
wwylelecb51c1024f16
diff --git a/src/video_core/regs.h b/src/video_core/regs.hindex 86826088b0..1776dad89b 100644--- a/src/video_core/regs.h+++ b/src/video_core/regs.h@@ -93,7 +93,7 @@ ASSERT_REG_POSITION(rasterizer.viewport_corner, 0x68);ASSERT_REG_POSITION(rasterizer.depthmap_enable, 0x6D);ASSERT_REG_POSITION(texturing, 0x80);-ASSERT_REG_POSITION(texturing.texture0_enable, 0x80);+ASSERT_REG_POSITION(texturing.main_config, 0x80);ASSERT_REG_POSITION(texturing.texture0, 0x81);ASSERT_REG_POSITION(texturing.texture0_format, 0x8e);ASSERT_REG_POSITION(texturing.fragment_lighting_enable, 0x8f);diff --git a/src/video_core/regs_texturing.h b/src/video_core/regs_texturing.hindex 515848bd69..8a7c6efe4e 100644--- a/src/video_core/regs_texturing.h+++ b/src/video_core/regs_texturing.h@@ -126,7 +126,7 @@ struct TexturingRegs {BitField<10, 1, u32> texture3_enable; // TODO: unimplementedBitField<13, 1, u32> texture2_use_coord1;BitField<16, 1, u32> clear_texture_cache; // TODO: unimplemented- };+ } main_config;TextureConfig texture0;INSERT_PADDING_WORDS(0x8);BitField<0, 4, TextureFormat> texture0_format;@@ -146,9 +146,9 @@ struct TexturingRegs {};const std::array<FullTextureConfig, 3> GetTextures() const {return {{- {texture0_enable.ToBool(), texture0, texture0_format},- {texture1_enable.ToBool(), texture1, texture1_format},- {texture2_enable.ToBool(), texture2, texture2_format},+ {main_config.texture0_enable.ToBool(), texture0, texture0_format},+ {main_config.texture1_enable.ToBool(), texture1, texture1_format},+ {main_config.texture2_enable.ToBool(), texture2, texture2_format},}};}diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cppindex a473070991..12ac9bbd97 100644--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp@@ -402,6 +402,10 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {SyncLogicOp();break;+ case PICA_REG_INDEX(texturing.main_config):+ shader_dirty = true;+ break;+// Texture 0 typecase PICA_REG_INDEX(texturing.texture0.type):shader_dirty = true;diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cppindex 5077e38b7e..7b44dade81 100644--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp@@ -40,7 +40,7 @@ PicaShaderConfig PicaShaderConfig::BuildFromRegs(const Pica::Regs& regs) {state.texture0_type = regs.texturing.texture0.type;- state.texture2_use_coord1 = regs.texturing.texture2_use_coord1 != 0;+ state.texture2_use_coord1 = regs.texturing.main_config.texture2_use_coord1 != 0;// Copy relevant tev stages fields.// We don't sync const_color here because of the high variance, it is adiff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cppindex fa8377f80e..20addf0bdb 100644--- a/src/video_core/swrasterizer/rasterizer.cpp+++ b/src/video_core/swrasterizer/rasterizer.cpp@@ -276,7 +276,8 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const VeDEBUG_ASSERT(0 != texture.config.address);- int coordinate_i = (i == 2 && regs.texturing.texture2_use_coord1) ? 1 : i;+ int coordinate_i =+ (i == 2 && regs.texturing.main_config.texture2_use_coord1) ? 1 : i;float24 u = uv[coordinate_i].u();float24 v = uv[coordinate_i].v();