Commit 35227c81 by Nicolas Capens

Move back-tranform of pre-transformed vertices to postTransform.

Bug 22624951 Change-Id: Ib8dfda6ed983f385a236b014d9b635a0c343071f Reviewed-on: https://swiftshader-review.googlesource.com/3741Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 00555c47
...@@ -112,28 +112,6 @@ namespace sw ...@@ -112,28 +112,6 @@ namespace sw
{ {
int pos = state.positionRegister; int pos = state.positionRegister;
// Backtransform
if(state.preTransformed)
{
Float4 rhw = Float4(1.0f) / r.o[pos].w;
Float4 W = *Pointer<Float4>(r.data + OFFSET(DrawData,Wx16)) * Float4(1.0f / 16.0f);
Float4 H = *Pointer<Float4>(r.data + OFFSET(DrawData,Hx16)) * Float4(1.0f / 16.0f);
Float4 L = *Pointer<Float4>(r.data + OFFSET(DrawData,X0x16)) * Float4(1.0f / 16.0f);
Float4 T = *Pointer<Float4>(r.data + OFFSET(DrawData,Y0x16)) * Float4(1.0f / 16.0f);
r.o[pos].x = (r.o[pos].x - L) / W * rhw;
r.o[pos].y = (r.o[pos].y - T) / H * rhw;
r.o[pos].z = r.o[pos].z * rhw;
r.o[pos].w = rhw;
}
if(state.superSampling)
{
r.o[pos].x = r.o[pos].x + *Pointer<Float4>(r.data + OFFSET(DrawData,XXXX)) * r.o[pos].w;
r.o[pos].y = r.o[pos].y + *Pointer<Float4>(r.data + OFFSET(DrawData,YYYY)) * r.o[pos].w;
}
Int4 maxX = CmpLT(r.o[pos].w, r.o[pos].x); Int4 maxX = CmpLT(r.o[pos].w, r.o[pos].x);
Int4 maxY = CmpLT(r.o[pos].w, r.o[pos].y); Int4 maxY = CmpLT(r.o[pos].w, r.o[pos].y);
Int4 maxZ = CmpLT(r.o[pos].w, r.o[pos].z); Int4 maxZ = CmpLT(r.o[pos].w, r.o[pos].z);
...@@ -482,12 +460,34 @@ namespace sw ...@@ -482,12 +460,34 @@ namespace sw
{ {
int pos = state.positionRegister; int pos = state.positionRegister;
// Backtransform
if(state.preTransformed)
{
Float4 rhw = Float4(1.0f) / r.o[pos].w;
Float4 W = *Pointer<Float4>(r.data + OFFSET(DrawData,Wx16)) * Float4(1.0f / 16.0f);
Float4 H = *Pointer<Float4>(r.data + OFFSET(DrawData,Hx16)) * Float4(1.0f / 16.0f);
Float4 L = *Pointer<Float4>(r.data + OFFSET(DrawData,X0x16)) * Float4(1.0f / 16.0f);
Float4 T = *Pointer<Float4>(r.data + OFFSET(DrawData,Y0x16)) * Float4(1.0f / 16.0f);
r.o[pos].x = (r.o[pos].x - L) / W * rhw;
r.o[pos].y = (r.o[pos].y - T) / H * rhw;
r.o[pos].z = r.o[pos].z * rhw;
r.o[pos].w = rhw;
}
if(!halfIntegerCoordinates) if(!halfIntegerCoordinates)
{ {
r.o[pos].x = r.o[pos].x + *Pointer<Float4>(r.data + OFFSET(DrawData,halfPixelX)) * r.o[pos].w; r.o[pos].x = r.o[pos].x + *Pointer<Float4>(r.data + OFFSET(DrawData,halfPixelX)) * r.o[pos].w;
r.o[pos].y = r.o[pos].y + *Pointer<Float4>(r.data + OFFSET(DrawData,halfPixelY)) * r.o[pos].w; r.o[pos].y = r.o[pos].y + *Pointer<Float4>(r.data + OFFSET(DrawData,halfPixelY)) * r.o[pos].w;
} }
if(state.superSampling)
{
r.o[pos].x = r.o[pos].x + *Pointer<Float4>(r.data + OFFSET(DrawData,XXXX)) * r.o[pos].w;
r.o[pos].y = r.o[pos].y + *Pointer<Float4>(r.data + OFFSET(DrawData,YYYY)) * r.o[pos].w;
}
if(symmetricNormalizedDepth && !state.fixedFunction) if(symmetricNormalizedDepth && !state.fixedFunction)
{ {
r.o[pos].z = (r.o[pos].z + r.o[pos].w) * Float4(0.5f); r.o[pos].z = (r.o[pos].z + r.o[pos].w) * Float4(0.5f);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment