VERY experimental Nintendo Switch 2 emulator
C++
SwRasterizer: only interpolate quat and view when lighting is enabled
wwylelee34dc666cfee
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cppindex b108a0f869..5844c401c9 100644--- a/src/video_core/swrasterizer/rasterizer.cpp+++ b/src/video_core/swrasterizer/rasterizer.cpp@@ -599,18 +599,6 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve255),};- Math::Quaternion<float> normquat{- {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(),- GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(),- GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()},- GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(),- };-- Math::Vec3<float> fragment_position{- GetInterpolatedAttribute(v0.view.x, v1.view.x, v2.view.x).ToFloat32(),- GetInterpolatedAttribute(v0.view.y, v1.view.y, v2.view.y).ToFloat32(),- GetInterpolatedAttribute(v0.view.z, v1.view.z, v2.view.z).ToFloat32()};-Math::Vec2<float24> uv[3];uv[0].u() = GetInterpolatedAttribute(v0.tc0.u(), v1.tc0.u(), v2.tc0.u());uv[0].v() = GetInterpolatedAttribute(v0.tc0.v(), v1.tc0.v(), v2.tc0.v());@@ -729,8 +717,20 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const VeMath::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0};if (!g_state.regs.lighting.disable) {- std::tie(primary_fragment_color, secondary_fragment_color) = ComputeFragmentsColors(- g_state.regs.lighting, g_state.lighting, normquat, fragment_position);+ Math::Quaternion<float> normquat{+ {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(),+ GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(),+ GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()},+ GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(),+ };++ Math::Vec3<float> view{+ GetInterpolatedAttribute(v0.view.x, v1.view.x, v2.view.x).ToFloat32(),+ GetInterpolatedAttribute(v0.view.y, v1.view.y, v2.view.y).ToFloat32(),+ GetInterpolatedAttribute(v0.view.z, v1.view.z, v2.view.z).ToFloat32(),+ };+ std::tie(primary_fragment_color, secondary_fragment_color) =+ ComputeFragmentsColors(g_state.regs.lighting, g_state.lighting, normquat, view);}for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size();