summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar wwylele2017-07-11 20:15:23 +0300
committerGravatar wwylele2017-07-11 21:35:57 +0300
commitf13cf506e0b0e42e6c9b00b163aaabc3b63fb7ea (patch)
tree66970e5dc2d5bd7de0ea310baa12456ba58f2d6d /src
parentvector_math: remove dead template parameter (diff)
downloadyuzu-f13cf506e0b0e42e6c9b00b163aaabc3b63fb7ea.tar.gz
yuzu-f13cf506e0b0e42e6c9b00b163aaabc3b63fb7ea.tar.xz
yuzu-f13cf506e0b0e42e6c9b00b163aaabc3b63fb7ea.zip
SwRasterizer: only interpolate quat and view when lighting is enabled
Diffstat (limited to 'src')
-rw-r--r--src/video_core/swrasterizer/rasterizer.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp
index b108a0f86..5844c401c 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 Ve
599 255), 599 255),
600 }; 600 };
601 601
602 Math::Quaternion<float> normquat{
603 {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(),
604 GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(),
605 GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()},
606 GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(),
607 };
608
609 Math::Vec3<float> fragment_position{
610 GetInterpolatedAttribute(v0.view.x, v1.view.x, v2.view.x).ToFloat32(),
611 GetInterpolatedAttribute(v0.view.y, v1.view.y, v2.view.y).ToFloat32(),
612 GetInterpolatedAttribute(v0.view.z, v1.view.z, v2.view.z).ToFloat32()};
613
614 Math::Vec2<float24> uv[3]; 602 Math::Vec2<float24> uv[3];
615 uv[0].u() = GetInterpolatedAttribute(v0.tc0.u(), v1.tc0.u(), v2.tc0.u()); 603 uv[0].u() = GetInterpolatedAttribute(v0.tc0.u(), v1.tc0.u(), v2.tc0.u());
616 uv[0].v() = GetInterpolatedAttribute(v0.tc0.v(), v1.tc0.v(), v2.tc0.v()); 604 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 Ve
729 Math::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0}; 717 Math::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0};
730 718
731 if (!g_state.regs.lighting.disable) { 719 if (!g_state.regs.lighting.disable) {
732 std::tie(primary_fragment_color, secondary_fragment_color) = ComputeFragmentsColors( 720 Math::Quaternion<float> normquat{
733 g_state.regs.lighting, g_state.lighting, normquat, fragment_position); 721 {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(),
722 GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(),
723 GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()},
724 GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(),
725 };
726
727 Math::Vec3<float> view{
728 GetInterpolatedAttribute(v0.view.x, v1.view.x, v2.view.x).ToFloat32(),
729 GetInterpolatedAttribute(v0.view.y, v1.view.y, v2.view.y).ToFloat32(),
730 GetInterpolatedAttribute(v0.view.z, v1.view.z, v2.view.z).ToFloat32(),
731 };
732 std::tie(primary_fragment_color, secondary_fragment_color) =
733 ComputeFragmentsColors(g_state.regs.lighting, g_state.lighting, normquat, view);
734 } 734 }
735 735
736 for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); 736 for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size();