Commit 2543bd73 by Nicolas Capens

Fix overwriting clip flags with varyings.

Previously the 12'th generic varying's w component would overwrite the clipFlags member field. Change-Id: I499979a2bbc653c0d95b35512a7a9e36667c2e4d Reviewed-on: https://swiftshader-review.googlesource.com/5382Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 995ddeae
...@@ -58,21 +58,11 @@ namespace sw ...@@ -58,21 +58,11 @@ namespace sw
{ {
struct // Fixed semantics struct // Fixed semantics
{ {
union // Position // Position
{ float x;
struct float y;
{ float z;
float x; float w;
float y;
float z;
float w;
};
struct
{
float4 P;
};
};
float4 C[2]; // Diffuse and specular color float4 C[2]; // Diffuse and specular color
...@@ -80,21 +70,19 @@ namespace sw ...@@ -80,21 +70,19 @@ namespace sw
float f; // Fog float f; // Fog
float pSize; // Point size float pSize; // Point size
unsigned char padding0[4];
unsigned char clipFlags;
unsigned char padding1[3];
}; };
float4 v[12]; // Generic components using semantic declaration float4 v[12]; // Generic components using semantic declaration
}; };
struct // Projected coordinates // Projected coordinates
{ int X;
int X; int Y;
int Y; float Z;
float Z; float W;
float W;
}; int clipFlags;
int padding[3];
}); });
META_ASSERT((sizeof(Vertex) & 0x0000000F) == 0); META_ASSERT((sizeof(Vertex) & 0x0000000F) == 0);
......
...@@ -639,7 +639,7 @@ namespace sw ...@@ -639,7 +639,7 @@ namespace sw
} }
} }
*Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 0) = (clipFlags >> 0) & 0x0000000FF; // FIXME: unsigned char Vertex::clipFlags *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 0) = (clipFlags >> 0) & 0x0000000FF;
*Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 1) = (clipFlags >> 8) & 0x0000000FF; *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 1) = (clipFlags >> 8) & 0x0000000FF;
*Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 2) = (clipFlags >> 16) & 0x0000000FF; *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 2) = (clipFlags >> 16) & 0x0000000FF;
*Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 3) = (clipFlags >> 24) & 0x0000000FF; *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 3) = (clipFlags >> 24) & 0x0000000FF;
...@@ -673,11 +673,11 @@ namespace sw ...@@ -673,11 +673,11 @@ namespace sw
{ {
if(state.output[i].write) if(state.output[i].write)
{ {
*Pointer<Float4>(vertex + OFFSET(Vertex,v[i])) = *Pointer<Float4>(cache + OFFSET(Vertex,v[i])); *Pointer<Int4>(vertex + OFFSET(Vertex,v[i]), 16) = *Pointer<Int4>(cache + OFFSET(Vertex,v[i]), 16);
} }
} }
*Pointer<Int4>(vertex + OFFSET(Vertex,X)) = *Pointer<Int4>(cache + OFFSET(Vertex,X));
*Pointer<Int>(vertex + OFFSET(Vertex,clipFlags)) = *Pointer<Int>(cache + OFFSET(Vertex,clipFlags)); *Pointer<Int>(vertex + OFFSET(Vertex,clipFlags)) = *Pointer<Int>(cache + OFFSET(Vertex,clipFlags));
*Pointer<Float4>(vertex + OFFSET(Vertex,X)) = *Pointer<Float4>(cache + OFFSET(Vertex,X));
} }
} }
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