Commit 0d0ed6fd by Alexis Hetu Committed by Alexis Hétu

Remove unused depth buffer quad layout logic

No depth buffer format uses quad layout currently and stencil quad layout will soon be removed, so the depth buffer quad layout logic can be removed. Bug: b/144353295 Change-Id: I78ab5dbf292af2752ed1c6aea069a8079c21663f Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38472 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 5d1e8540
...@@ -177,7 +177,6 @@ namespace sw ...@@ -177,7 +177,6 @@ namespace sw
{ {
state.depthTestActive = true; state.depthTestActive = true;
state.depthCompareMode = context->depthCompareMode; state.depthCompareMode = context->depthCompareMode;
state.quadLayoutDepthBuffer = context->depthBuffer->getFormat().hasQuadLayout();
state.depthFormat = context->depthBuffer->getFormat(); state.depthFormat = context->depthBuffer->getFormat();
} }
......
...@@ -65,7 +65,6 @@ namespace sw ...@@ -65,7 +65,6 @@ namespace sw
VkCompareOp depthCompareMode; VkCompareOp depthCompareMode;
bool depthWriteEnable; bool depthWriteEnable;
bool quadLayoutDepthBuffer;
bool stencilActive; bool stencilActive;
StencilOpState frontStencil; StencilOpState frontStencil;
......
...@@ -335,18 +335,8 @@ namespace sw ...@@ -335,18 +335,8 @@ namespace sw
Z = oDepth; Z = oDepth;
} }
Pointer<Byte> buffer; Pointer<Byte> buffer = zBuffer + 4 * x;
Int pitch; Int pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
if(!state.quadLayoutDepthBuffer)
{
buffer = zBuffer + 4 * x;
pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
}
else
{
buffer = zBuffer + 8 * x;
}
if(q > 0) if(q > 0)
{ {
...@@ -357,17 +347,10 @@ namespace sw ...@@ -357,17 +347,10 @@ namespace sw
if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable)) if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable))
{ {
if(!state.quadLayoutDepthBuffer)
{
// FIXME: Properly optimizes? // FIXME: Properly optimizes?
zValue.xy = *Pointer<Float4>(buffer); zValue.xy = *Pointer<Float4>(buffer);
zValue.zw = *Pointer<Float4>(buffer + pitch - 8); zValue.zw = *Pointer<Float4>(buffer + pitch - 8);
} }
else
{
zValue = *Pointer<Float4>(buffer, 16);
}
}
Int4 zTest; Int4 zTest;
...@@ -431,18 +414,8 @@ namespace sw ...@@ -431,18 +414,8 @@ namespace sw
Z = convertFixed16(oDepth, true); Z = convertFixed16(oDepth, true);
} }
Pointer<Byte> buffer; Pointer<Byte> buffer = zBuffer + 2 * x;
Int pitch; Int pitch = *Pointer<Int>(data + OFFSET(DrawData, depthPitchB));
if(!state.quadLayoutDepthBuffer)
{
buffer = zBuffer + 2 * x;
pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
}
else
{
buffer = zBuffer + 4 * x;
}
if(q > 0) if(q > 0)
{ {
...@@ -453,17 +426,10 @@ namespace sw ...@@ -453,17 +426,10 @@ namespace sw
if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable)) if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable))
{ {
if(!state.quadLayoutDepthBuffer)
{
// FIXME: Properly optimizes? // FIXME: Properly optimizes?
zValue = *Pointer<Short4>(buffer) & Short4(-1, -1, 0, 0); zValue = *Pointer<Short4>(buffer) & Short4(-1, -1, 0, 0);
zValue = zValue | (*Pointer<Short4>(buffer + pitch - 4) & Short4(0, 0, -1, -1)); zValue = zValue | (*Pointer<Short4>(buffer + pitch - 4) & Short4(0, 0, -1, -1));
} }
else
{
zValue = *Pointer<Short4>(buffer, 8);
}
}
Int4 zTest; Int4 zTest;
...@@ -562,18 +528,8 @@ namespace sw ...@@ -562,18 +528,8 @@ namespace sw
Z = oDepth; Z = oDepth;
} }
Pointer<Byte> buffer; Pointer<Byte> buffer = zBuffer + 4 * x;
Int pitch; Int pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
if(!state.quadLayoutDepthBuffer)
{
buffer = zBuffer + 4 * x;
pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
}
else
{
buffer = zBuffer + 8 * x;
}
if(q > 0) if(q > 0)
{ {
...@@ -584,33 +540,19 @@ namespace sw ...@@ -584,33 +540,19 @@ namespace sw
if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable)) if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable))
{ {
if(!state.quadLayoutDepthBuffer)
{
// FIXME: Properly optimizes? // FIXME: Properly optimizes?
zValue.xy = *Pointer<Float4>(buffer); zValue.xy = *Pointer<Float4>(buffer);
zValue.zw = *Pointer<Float4>(buffer + pitch - 8); zValue.zw = *Pointer<Float4>(buffer + pitch - 8);
} }
else
{
zValue = *Pointer<Float4>(buffer, 16);
}
}
Z = As<Float4>(As<Int4>(Z) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X) + zMask * 16, 16)); Z = As<Float4>(As<Int4>(Z) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X) + zMask * 16, 16));
zValue = As<Float4>(As<Int4>(zValue) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X) + zMask * 16, 16)); zValue = As<Float4>(As<Int4>(zValue) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X) + zMask * 16, 16));
Z = As<Float4>(As<Int4>(Z) | As<Int4>(zValue)); Z = As<Float4>(As<Int4>(Z) | As<Int4>(zValue));
if(!state.quadLayoutDepthBuffer)
{
// FIXME: Properly optimizes? // FIXME: Properly optimizes?
*Pointer<Float2>(buffer) = Float2(Z.xy); *Pointer<Float2>(buffer) = Float2(Z.xy);
*Pointer<Float2>(buffer + pitch) = Float2(Z.zw); *Pointer<Float2>(buffer + pitch) = Float2(Z.zw);
} }
else
{
*Pointer<Float4>(buffer, 16) = Z;
}
}
void PixelRoutine::writeDepth16(Pointer<Byte> &zBuffer, int q, const Int &x, const Float4 &z, const Int &zMask) void PixelRoutine::writeDepth16(Pointer<Byte> &zBuffer, int q, const Int &x, const Float4 &z, const Int &zMask)
{ {
...@@ -621,18 +563,8 @@ namespace sw ...@@ -621,18 +563,8 @@ namespace sw
Z = As<Short4>(convertFixed16(oDepth, true)); Z = As<Short4>(convertFixed16(oDepth, true));
} }
Pointer<Byte> buffer; Pointer<Byte> buffer = zBuffer + 2 * x;
Int pitch; Int pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
if(!state.quadLayoutDepthBuffer)
{
buffer = zBuffer + 2 * x;
pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
}
else
{
buffer = zBuffer + 4 * x;
}
if(q > 0) if(q > 0)
{ {
...@@ -643,35 +575,21 @@ namespace sw ...@@ -643,35 +575,21 @@ namespace sw
if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable)) if(state.depthCompareMode != VK_COMPARE_OP_NEVER || (state.depthCompareMode != VK_COMPARE_OP_ALWAYS && !state.depthWriteEnable))
{ {
if(!state.quadLayoutDepthBuffer)
{
// FIXME: Properly optimizes? // FIXME: Properly optimizes?
zValue = *Pointer<Short4>(buffer) & Short4(-1, -1, 0, 0); zValue = *Pointer<Short4>(buffer) & Short4(-1, -1, 0, 0);
zValue = zValue | (*Pointer<Short4>(buffer + pitch - 4) & Short4(0, 0, -1, -1)); zValue = zValue | (*Pointer<Short4>(buffer + pitch - 4) & Short4(0, 0, -1, -1));
} }
else
{
zValue = *Pointer<Short4>(buffer, 8);
}
}
Z = Z & *Pointer<Short4>(constants + OFFSET(Constants,maskW4Q) + zMask * 8, 8); Z = Z & *Pointer<Short4>(constants + OFFSET(Constants,maskW4Q) + zMask * 8, 8);
zValue = zValue & *Pointer<Short4>(constants + OFFSET(Constants,invMaskW4Q) + zMask * 8, 8); zValue = zValue & *Pointer<Short4>(constants + OFFSET(Constants,invMaskW4Q) + zMask * 8, 8);
Z = Z | zValue; Z = Z | zValue;
if(!state.quadLayoutDepthBuffer)
{
// FIXME: Properly optimizes? // FIXME: Properly optimizes?
*Pointer<Short>(buffer) = Extract(Z, 0); *Pointer<Short>(buffer) = Extract(Z, 0);
*Pointer<Short>(buffer+2) = Extract(Z, 1); *Pointer<Short>(buffer+2) = Extract(Z, 1);
*Pointer<Short>(buffer+pitch) = Extract(Z, 2); *Pointer<Short>(buffer+pitch) = Extract(Z, 2);
*Pointer<Short>(buffer+pitch+2) = Extract(Z, 3); *Pointer<Short>(buffer+pitch+2) = Extract(Z, 3);
} }
else
{
*Pointer<Short4>(buffer, 8) = Z;
}
}
void PixelRoutine::writeDepth(Pointer<Byte> &zBuffer, int q, const Int &x, const Float4 &z, const Int &zMask) void PixelRoutine::writeDepth(Pointer<Byte> &zBuffer, int q, const Int &x, const Float4 &z, const Int &zMask)
{ {
......
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