Mesa (master): swr: [rasterizer core] viewport transform disabled fix
Tim Rowley
torowley at kemper.freedesktop.org
Wed Aug 17 22:12:46 UTC 2016
Module: Mesa
Branch: master
Commit: d70f96fd674cfb5a1aeedce179c2cc02c38a9fad
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d70f96fd674cfb5a1aeedce179c2cc02c38a9fad
Author: Tim Rowley <timothy.o.rowley at intel.com>
Date: Mon Aug 15 11:58:54 2016 -0600
swr: [rasterizer core] viewport transform disabled fix
When viewport transform is disabled (ie. screen space coords are passed
in directly), the W component should be interpreted as RHW.
Signed-off-by: Tim Rowley <timothy.o.rowley at intel.com>
---
src/gallium/drivers/swr/rasterizer/core/frontend.cpp | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
index 6039be0..2809502 100644
--- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
@@ -1766,9 +1766,16 @@ void BinTriangles(
simdscalar vRecipW1 = _simd_set1_ps(1.0f);
simdscalar vRecipW2 = _simd_set1_ps(1.0f);
- if (!feState.vpTransformDisable)
+ if (feState.vpTransformDisable)
{
- // perspective divide
+ // RHW is passed in directly when VP transform is disabled
+ vRecipW0 = tri[0].v[3];
+ vRecipW1 = tri[1].v[3];
+ vRecipW2 = tri[2].v[3];
+ }
+ else
+ {
+ // Perspective divide
vRecipW0 = _simd_div_ps(_simd_set1_ps(1.0f), tri[0].w);
vRecipW1 = _simd_div_ps(_simd_set1_ps(1.0f), tri[1].w);
vRecipW2 = _simd_div_ps(_simd_set1_ps(1.0f), tri[2].w);
@@ -1785,7 +1792,7 @@ void BinTriangles(
tri[1].v[2] = _simd_mul_ps(tri[1].v[2], vRecipW1);
tri[2].v[2] = _simd_mul_ps(tri[2].v[2], vRecipW2);
- // viewport transform to screen coords
+ // Viewport transform to screen space coords
if (state.gsState.emitsViewportArrayIndex)
{
viewportTransform<3>(tri, state.vpMatrices, viewportIdx);
@@ -1796,7 +1803,7 @@ void BinTriangles(
}
}
- // adjust for pixel center location
+ // Adjust for pixel center location
simdscalar offset = g_pixelOffsets[rastState.pixelLocation];
tri[0].x = _simd_add_ps(tri[0].x, offset);
tri[0].y = _simd_add_ps(tri[0].y, offset);
More information about the mesa-commit
mailing list