Remove VK support for GL-style symmetric clip space
Change-Id: Idb38063e6d8f7c6345118b2acddba4dcb99d0831
Reviewed-on: https://swiftshader-review.googlesource.com/c/23588
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
diff --git a/src/Device/Clipper.cpp b/src/Device/Clipper.cpp
index e42c12f..029b93b 100644
--- a/src/Device/Clipper.cpp
+++ b/src/Device/Clipper.cpp
@@ -20,15 +20,6 @@
namespace sw
{
- Clipper::Clipper(bool symmetricNormalizedDepth)
- {
- n = symmetricNormalizedDepth ? -1.0f : 0.0f;
- }
-
- Clipper::~Clipper()
- {
- }
-
unsigned int Clipper::computeClipFlags(const float4 &v)
{
return ((v.x > v.w) ? CLIP_RIGHT : 0) |
@@ -36,7 +27,7 @@
((v.z > v.w) ? CLIP_FAR : 0) |
((v.x < -v.w) ? CLIP_LEFT : 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
}
@@ -92,8 +83,8 @@
{
int j = i == polygon.n - 1 ? 0 : i + 1;
- float di = V[i]->z - n * V[i]->w;
- float dj = V[j]->z - n * V[j]->w;
+ float di = V[i]->z;
+ float dj = V[j]->z;
if(di >= 0)
{
diff --git a/src/Device/Clipper.hpp b/src/Device/Clipper.hpp
index 1c181d2..b808c08 100644
--- a/src/Device/Clipper.hpp
+++ b/src/Device/Clipper.hpp
@@ -52,10 +52,6 @@
CLIP_USER = 0x3F00
};
- Clipper(bool symmetricNormalizedDepth);
-
- ~Clipper();
-
unsigned int computeClipFlags(const float4 &v);
bool clip(Polygon &polygon, int clipFlagsOr, const DrawCall &draw);
@@ -69,8 +65,6 @@
void clipPlane(Polygon &polygon, const Plane &plane);
void clipEdge(float4 &Vo, const float4 &Vi, const float4 &Vj, float di, float dj) const;
-
- float n; // Near clip plane distance
};
}
diff --git a/src/Device/Context.cpp b/src/Device/Context.cpp
index 1fb4d53..7ed22b2 100644
--- a/src/Device/Context.cpp
+++ b/src/Device/Context.cpp
@@ -28,7 +28,6 @@
extern bool perspectiveCorrection;
bool halfIntegerCoordinates = false; // Pixel centers are not at integer coordinates
- bool symmetricNormalizedDepth = false; // [-1, 1] instead of [0, 1]
bool booleanFaceRegister = false;
bool fullPixelPositionRegister = false;
bool leadingVertexFirst = false; // Flat shading uses first vertex, else last
diff --git a/src/Device/Renderer.cpp b/src/Device/Renderer.cpp
index 3874889..a6fbaf4 100644
--- a/src/Device/Renderer.cpp
+++ b/src/Device/Renderer.cpp
@@ -43,7 +43,6 @@
namespace sw
{
extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates
- extern bool symmetricNormalizedDepth; // [-1, 1] instead of [0, 1]
extern bool booleanFaceRegister;
extern bool fullPixelPositionRegister;
extern bool leadingVertexFirst; // Flat shading uses first vertex, else last
@@ -79,7 +78,6 @@
if(!initialized)
{
sw::halfIntegerCoordinates = conventions.halfIntegerCoordinates;
- sw::symmetricNormalizedDepth = conventions.symmetricNormalizedDepth;
sw::booleanFaceRegister = conventions.booleanFaceRegister;
sw::fullPixelPositionRegister = conventions.fullPixelPositionRegister;
sw::leadingVertexFirst = conventions.leadingVertexFirst;
@@ -126,7 +124,7 @@
setGlobalRenderingSettings(conventions, exactColorRounding);
setRenderTarget(0, nullptr);
- clipper = new Clipper(symmetricNormalizedDepth);
+ clipper = new Clipper;
blitter = new Blitter;
updateClipPlanes = true;
diff --git a/src/Pipeline/VertexRoutine.cpp b/src/Pipeline/VertexRoutine.cpp
index 592daa0..9a82819 100644
--- a/src/Pipeline/VertexRoutine.cpp
+++ b/src/Pipeline/VertexRoutine.cpp
@@ -115,7 +115,7 @@
Int4 maxZ = CmpLT(o[pos].w, o[pos].z);
Int4 minX = CmpNLE(-o[pos].w, o[pos].x);
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,maxY) + SignMask(maxY) * 4);
@@ -690,11 +690,6 @@
v.z = o[pos].z;
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 rhw = Float4(1.0f) / w;