Commit 939adc5b by Chris Forbes

Remove VK support for GL-style symmetric clip space

Change-Id: Idb38063e6d8f7c6345118b2acddba4dcb99d0831 Reviewed-on: https://swiftshader-review.googlesource.com/c/23588Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent f04b56fb
...@@ -20,15 +20,6 @@ ...@@ -20,15 +20,6 @@
namespace sw namespace sw
{ {
Clipper::Clipper(bool symmetricNormalizedDepth)
{
n = symmetricNormalizedDepth ? -1.0f : 0.0f;
}
Clipper::~Clipper()
{
}
unsigned int Clipper::computeClipFlags(const float4 &v) unsigned int Clipper::computeClipFlags(const float4 &v)
{ {
return ((v.x > v.w) ? CLIP_RIGHT : 0) | return ((v.x > v.w) ? CLIP_RIGHT : 0) |
...@@ -36,7 +27,7 @@ namespace sw ...@@ -36,7 +27,7 @@ namespace sw
((v.z > v.w) ? CLIP_FAR : 0) | ((v.z > v.w) ? CLIP_FAR : 0) |
((v.x < -v.w) ? CLIP_LEFT : 0) | ((v.x < -v.w) ? CLIP_LEFT : 0) |
((v.y < -v.w) ? CLIP_BOTTOM : 0) | ((v.y < -v.w) ? CLIP_BOTTOM : 0) |
((v.z < n * v.w) ? CLIP_NEAR : 0) | ((v.z < 0) ? CLIP_NEAR : 0) |
Clipper::CLIP_FINITE; // FIXME: xyz finite Clipper::CLIP_FINITE; // FIXME: xyz finite
} }
...@@ -92,8 +83,8 @@ namespace sw ...@@ -92,8 +83,8 @@ namespace sw
{ {
int j = i == polygon.n - 1 ? 0 : i + 1; int j = i == polygon.n - 1 ? 0 : i + 1;
float di = V[i]->z - n * V[i]->w; float di = V[i]->z;
float dj = V[j]->z - n * V[j]->w; float dj = V[j]->z;
if(di >= 0) if(di >= 0)
{ {
......
...@@ -52,10 +52,6 @@ namespace sw ...@@ -52,10 +52,6 @@ namespace sw
CLIP_USER = 0x3F00 CLIP_USER = 0x3F00
}; };
Clipper(bool symmetricNormalizedDepth);
~Clipper();
unsigned int computeClipFlags(const float4 &v); unsigned int computeClipFlags(const float4 &v);
bool clip(Polygon &polygon, int clipFlagsOr, const DrawCall &draw); bool clip(Polygon &polygon, int clipFlagsOr, const DrawCall &draw);
...@@ -69,8 +65,6 @@ namespace sw ...@@ -69,8 +65,6 @@ namespace sw
void clipPlane(Polygon &polygon, const Plane &plane); void clipPlane(Polygon &polygon, const Plane &plane);
void clipEdge(float4 &Vo, const float4 &Vi, const float4 &Vj, float di, float dj) const; void clipEdge(float4 &Vo, const float4 &Vi, const float4 &Vj, float di, float dj) const;
float n; // Near clip plane distance
}; };
} }
......
...@@ -28,7 +28,6 @@ namespace sw ...@@ -28,7 +28,6 @@ namespace sw
extern bool perspectiveCorrection; extern bool perspectiveCorrection;
bool halfIntegerCoordinates = false; // Pixel centers are not at integer coordinates bool halfIntegerCoordinates = false; // Pixel centers are not at integer coordinates
bool symmetricNormalizedDepth = false; // [-1, 1] instead of [0, 1]
bool booleanFaceRegister = false; bool booleanFaceRegister = false;
bool fullPixelPositionRegister = false; bool fullPixelPositionRegister = false;
bool leadingVertexFirst = false; // Flat shading uses first vertex, else last bool leadingVertexFirst = false; // Flat shading uses first vertex, else last
......
...@@ -43,7 +43,6 @@ unsigned int maxPrimitives = 1 << 21; ...@@ -43,7 +43,6 @@ unsigned int maxPrimitives = 1 << 21;
namespace sw namespace sw
{ {
extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates
extern bool symmetricNormalizedDepth; // [-1, 1] instead of [0, 1]
extern bool booleanFaceRegister; extern bool booleanFaceRegister;
extern bool fullPixelPositionRegister; extern bool fullPixelPositionRegister;
extern bool leadingVertexFirst; // Flat shading uses first vertex, else last extern bool leadingVertexFirst; // Flat shading uses first vertex, else last
...@@ -79,7 +78,6 @@ namespace sw ...@@ -79,7 +78,6 @@ namespace sw
if(!initialized) if(!initialized)
{ {
sw::halfIntegerCoordinates = conventions.halfIntegerCoordinates; sw::halfIntegerCoordinates = conventions.halfIntegerCoordinates;
sw::symmetricNormalizedDepth = conventions.symmetricNormalizedDepth;
sw::booleanFaceRegister = conventions.booleanFaceRegister; sw::booleanFaceRegister = conventions.booleanFaceRegister;
sw::fullPixelPositionRegister = conventions.fullPixelPositionRegister; sw::fullPixelPositionRegister = conventions.fullPixelPositionRegister;
sw::leadingVertexFirst = conventions.leadingVertexFirst; sw::leadingVertexFirst = conventions.leadingVertexFirst;
...@@ -126,7 +124,7 @@ namespace sw ...@@ -126,7 +124,7 @@ namespace sw
setGlobalRenderingSettings(conventions, exactColorRounding); setGlobalRenderingSettings(conventions, exactColorRounding);
setRenderTarget(0, nullptr); setRenderTarget(0, nullptr);
clipper = new Clipper(symmetricNormalizedDepth); clipper = new Clipper;
blitter = new Blitter; blitter = new Blitter;
updateClipPlanes = true; updateClipPlanes = true;
......
...@@ -115,7 +115,7 @@ namespace sw ...@@ -115,7 +115,7 @@ namespace sw
Int4 maxZ = CmpLT(o[pos].w, o[pos].z); Int4 maxZ = CmpLT(o[pos].w, o[pos].z);
Int4 minX = CmpNLE(-o[pos].w, o[pos].x); Int4 minX = CmpNLE(-o[pos].w, o[pos].x);
Int4 minY = CmpNLE(-o[pos].w, o[pos].y); Int4 minY = CmpNLE(-o[pos].w, o[pos].y);
Int4 minZ = symmetricNormalizedDepth ? CmpNLE(-o[pos].w, o[pos].z) : CmpNLE(Float4(0.0f), o[pos].z); Int4 minZ = CmpNLE(Float4(0.0f), o[pos].z);
clipFlags = *Pointer<Int>(constants + OFFSET(Constants,maxX) + SignMask(maxX) * 4); // FIXME: Array indexing clipFlags = *Pointer<Int>(constants + OFFSET(Constants,maxX) + SignMask(maxX) * 4); // FIXME: Array indexing
clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,maxY) + SignMask(maxY) * 4); clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,maxY) + SignMask(maxY) * 4);
...@@ -690,11 +690,6 @@ namespace sw ...@@ -690,11 +690,6 @@ namespace sw
v.z = o[pos].z; v.z = o[pos].z;
v.w = o[pos].w; v.w = o[pos].w;
if(symmetricNormalizedDepth)
{
v.z = (v.z + v.w) * Float4(0.5f); // [-1, 1] -> [0, 1]
}
Float4 w = As<Float4>(As<Int4>(v.w) | (As<Int4>(CmpEQ(v.w, Float4(0.0f))) & As<Int4>(Float4(1.0f)))); Float4 w = As<Float4>(As<Int4>(v.w) | (As<Int4>(CmpEQ(v.w, Float4(0.0f))) & As<Int4>(Float4(1.0f))));
Float4 rhw = Float4(1.0f) / w; Float4 rhw = Float4(1.0f) / w;
......
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