aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/rasterizer
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2017-08-21 17:11:34 -0500
committerTim Rowley <[email protected]>2017-09-13 10:09:04 -0500
commit966997269278d5eeeb6baf7d70fb99df0038b081 (patch)
tree8af0fcc572c64db60741bbb2d2fbb565b6881f5a /src/gallium/drivers/swr/rasterizer
parentf5031fb9521ecf3be4af8584a80516c7307ad61a (diff)
swr/rast: Move clip/cull enables in API
Moved from from SWR_RASTSTATE to SWR_BACKEND_STATE. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer')
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/backend.cpp4
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/backend_impl.h2
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp4
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp4
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/binner.cpp18
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/clip.h22
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp2
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/state.h8
8 files changed, 32 insertions, 32 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.cpp b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
index 363349f6c83..6282e87f318 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
@@ -272,9 +272,9 @@ void BackendNullPS(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint32_t y,
AR_END(BEBarycentric, 0);
// interpolate user clip distance if available
- if (state.rastState.clipDistanceMask)
+ if (state.backendState.clipDistanceMask)
{
- coverageMask &= ~ComputeUserClipMask(state.rastState.clipDistanceMask, work.pUserClipBuffer, psContext.vI.sample, psContext.vJ.sample);
+ coverageMask &= ~ComputeUserClipMask(state.backendState.clipDistanceMask, work.pUserClipBuffer, psContext.vI.sample, psContext.vJ.sample);
}
simdscalar vCoverageMask = _simd_vmask_ps(coverageMask);
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h
index 0f430ef3abc..593082bd7de 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h
+++ b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h
@@ -886,7 +886,7 @@ void BackendPixelRate(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint32_t
AR_END(BESetup, 0);
- PixelRateZTestLoop<T> PixelRateZTest(pDC, workerId, work, coeffs, state, pDepthBuffer, pStencilBuffer, state.rastState.clipDistanceMask);
+ PixelRateZTestLoop<T> PixelRateZTest(pDC, workerId, work, coeffs, state, pDepthBuffer, pStencilBuffer, state.backendState.clipDistanceMask);
psContext.vY.UL = _simd_add_ps(vULOffsetsY, _simd_set1_ps(static_cast<float>(y)));
psContext.vY.center = _simd_add_ps(vCenterOffsetsY, _simd_set1_ps(static_cast<float>(y)));
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp b/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp
index bb2e9a9f631..04e34aa264f 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp
@@ -128,9 +128,9 @@ void BackendSampleRate(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint32_
AR_END(BEBarycentric, 0);
// interpolate user clip distance if available
- if (state.rastState.clipDistanceMask)
+ if (state.backendState.clipDistanceMask)
{
- coverageMask &= ~ComputeUserClipMask(state.rastState.clipDistanceMask, work.pUserClipBuffer, psContext.vI.sample, psContext.vJ.sample);
+ coverageMask &= ~ComputeUserClipMask(state.backendState.clipDistanceMask, work.pUserClipBuffer, psContext.vI.sample, psContext.vJ.sample);
}
simdscalar vCoverageMask = _simd_vmask_ps(coverageMask);
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp b/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp
index 18f4299f514..686b97912cc 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp
@@ -112,9 +112,9 @@ void BackendSingleSample(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint3
AR_END(BEBarycentric, 1);
// interpolate user clip distance if available
- if (state.rastState.clipDistanceMask)
+ if (state.backendState.clipDistanceMask)
{
- coverageMask &= ~ComputeUserClipMask(state.rastState.clipDistanceMask, work.pUserClipBuffer, psContext.vI.center, psContext.vJ.center);
+ coverageMask &= ~ComputeUserClipMask(state.backendState.clipDistanceMask, work.pUserClipBuffer, psContext.vI.center, psContext.vJ.center);
}
simdscalar vCoverageMask = _simd_vmask_ps(coverageMask);
diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
index 01c2f8f7a33..19afd1f292d 100644
--- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
@@ -868,11 +868,11 @@ endBinTriangles:
SIMD128::store_ps(&desc.pTriBuffer[12], vHorizW[triIndex]);
// store user clip distances
- if (rastState.clipDistanceMask)
+ if (state.backendState.clipDistanceMask)
{
- uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask);
+ uint32_t numClipDist = _mm_popcnt_u32(state.backendState.clipDistanceMask);
desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 3 * sizeof(float));
- ProcessUserClipDist<3>(pa, triIndex, rastState.clipDistanceMask, &desc.pTriBuffer[12], desc.pUserClipBuffer);
+ ProcessUserClipDist<3>(pa, triIndex, state.backendState.clipDistanceMask, &desc.pTriBuffer[12], desc.pUserClipBuffer);
}
for (uint32_t y = aMTTop[triIndex]; y <= aMTBottom[triIndex]; ++y)
@@ -1242,13 +1242,13 @@ void BinPostSetupPointsImpl(
*pTriBuffer = aPrimVertsZ[primIndex];
// store user clip distances
- if (rastState.clipDistanceMask)
+ if (backendState.clipDistanceMask)
{
- uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask);
+ uint32_t numClipDist = _mm_popcnt_u32(backendState.clipDistanceMask);
desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 3 * sizeof(float));
float dists[8];
float one = 1.0f;
- ProcessUserClipDist<1>(pa, primIndex, rastState.clipDistanceMask, &one, dists);
+ ProcessUserClipDist<1>(pa, primIndex, backendState.clipDistanceMask, &one, dists);
for (uint32_t i = 0; i < numClipDist; i++) {
desc.pUserClipBuffer[3 * i + 0] = 0.0f;
desc.pUserClipBuffer[3 * i + 1] = 0.0f;
@@ -1573,11 +1573,11 @@ void BinPostSetupLinesImpl(
_mm_store_ps(&desc.pTriBuffer[12], vHorizW[primIndex]);
// store user clip distances
- if (rastState.clipDistanceMask)
+ if (state.backendState.clipDistanceMask)
{
- uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask);
+ uint32_t numClipDist = _mm_popcnt_u32(state.backendState.clipDistanceMask);
desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 2 * sizeof(float));
- ProcessUserClipDist<2>(pa, primIndex, rastState.clipDistanceMask, &desc.pTriBuffer[12], desc.pUserClipBuffer);
+ ProcessUserClipDist<2>(pa, primIndex, state.backendState.clipDistanceMask, &desc.pTriBuffer[12], desc.pUserClipBuffer);
}
MacroTileMgr *pTileMgr = pDC->pTileMgr;
diff --git a/src/gallium/drivers/swr/rasterizer/core/clip.h b/src/gallium/drivers/swr/rasterizer/core/clip.h
index d7b559bc01c..e0aaf815417 100644
--- a/src/gallium/drivers/swr/rasterizer/core/clip.h
+++ b/src/gallium/drivers/swr/rasterizer/core/clip.h
@@ -371,7 +371,7 @@ public:
int ComputeUserClipCullMask(PA_STATE &pa, typename SIMD_T::Vec4 prim[])
{
- uint8_t cullMask = state.rastState.cullDistanceMask;
+ uint8_t cullMask = state.backendState.cullDistanceMask;
typename SIMD_T::Float vClipCullMask = SIMD_T::setzero_ps();
typename SIMD_T::Vec4 vClipCullDistLo[3];
@@ -408,7 +408,7 @@ public:
}
// clipper should also discard any primitive with NAN clip distance
- uint8_t clipMask = state.rastState.clipDistanceMask;
+ uint8_t clipMask = state.backendState.clipDistanceMask;
while (_BitScanForward(&index, clipMask))
{
clipMask &= ~(1 << index);
@@ -488,7 +488,7 @@ public:
}
// assemble user clip distances if enabled
- if (state.rastState.clipDistanceMask & 0xf)
+ if (state.backendState.clipDistanceMask & 0xf)
{
pa.Assemble(VERTEX_CLIPCULL_DIST_LO_SLOT, tmpVector);
for (uint32_t i = 0; i < NumVertsPerPrim; ++i)
@@ -497,7 +497,7 @@ public:
}
}
- if (state.rastState.clipDistanceMask & 0xf0)
+ if (state.backendState.clipDistanceMask & 0xf0)
{
pa.Assemble(VERTEX_CLIPCULL_DIST_HI_SLOT, tmpVector);
for (uint32_t i = 0; i < NumVertsPerPrim; ++i)
@@ -613,7 +613,7 @@ public:
}
// transpose user clip distances if enabled
- if (state.rastState.clipDistanceMask & 0x0f)
+ if (state.backendState.clipDistanceMask & 0x0f)
{
pBase = reinterpret_cast<uint8_t *>(&vertices[0].attrib[VERTEX_CLIPCULL_DIST_LO_SLOT]) + sizeof(float) * inputPrim;
@@ -625,7 +625,7 @@ public:
}
}
- if (state.rastState.clipDistanceMask & 0xf0)
+ if (state.backendState.clipDistanceMask & 0xf0)
{
pBase = reinterpret_cast<uint8_t *>(&vertices[0].attrib[VERTEX_CLIPCULL_DIST_HI_SLOT]) + sizeof(float) * inputPrim;
@@ -703,7 +703,7 @@ public:
primMask &= ~ComputeNaNMask(prim);
// user cull distance cull
- if (this->state.rastState.cullDistanceMask)
+ if (state.backendState.cullDistanceMask)
{
primMask &= ~ComputeUserClipCullMask(pa, prim);
}
@@ -867,7 +867,7 @@ private:
}
// interpolate clip distance if enabled
- if (this->state.rastState.clipDistanceMask & 0xf)
+ if (this->state.backendState.clipDistanceMask & 0xf)
{
uint32_t attribSlot = VERTEX_CLIPCULL_DIST_LO_SLOT;
for (uint32_t c = 0; c < 4; ++c)
@@ -879,7 +879,7 @@ private:
}
}
- if (this->state.rastState.clipDistanceMask & 0xf0)
+ if (this->state.backendState.clipDistanceMask & 0xf0)
{
uint32_t attribSlot = VERTEX_CLIPCULL_DIST_HI_SLOT;
for (uint32_t c = 0; c < 4; ++c)
@@ -963,7 +963,7 @@ private:
}
// store clip distance if enabled
- if (this->state.rastState.clipDistanceMask & 0xf)
+ if (this->state.backendState.clipDistanceMask & 0xf)
{
uint32_t attribSlot = VERTEX_CLIPCULL_DIST_LO_SLOT;
for (uint32_t c = 0; c < 4; ++c)
@@ -973,7 +973,7 @@ private:
}
}
- if (this->state.rastState.clipDistanceMask & 0xf0)
+ if (this->state.backendState.clipDistanceMask & 0xf0)
{
uint32_t attribSlot = VERTEX_CLIPCULL_DIST_HI_SLOT;
for (uint32_t c = 0; c < 4; ++c)
diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
index a3ff557bd8c..ae1e9c779ba 100644
--- a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
@@ -125,7 +125,7 @@ void RasterizeLine(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, voi
// Store user clip distances for triangle 0
float newClipBuffer[3 * 8];
- uint32_t numClipDist = _mm_popcnt_u32(state.rastState.clipDistanceMask);
+ uint32_t numClipDist = _mm_popcnt_u32(state.backendState.clipDistanceMask);
if (numClipDist)
{
newWorkDesc.pUserClipBuffer = newClipBuffer;
diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h
index ed49134364e..284c523eba8 100644
--- a/src/gallium/drivers/swr/rasterizer/core/state.h
+++ b/src/gallium/drivers/swr/rasterizer/core/state.h
@@ -1035,10 +1035,6 @@ struct SWR_RASTSTATE
uint32_t pixelLocation; // UL or Center
SWR_MULTISAMPLE_POS samplePositions; // @llvm_struct
bool bIsCenterPattern; // @llvm_enum
-
- // user clip/cull distance enables
- uint8_t cullDistanceMask;
- uint8_t clipDistanceMask;
};
@@ -1074,6 +1070,10 @@ struct SWR_BACKEND_STATE
bool readRenderTargetArrayIndex; // Forward render target array index from last FE stage to the backend
bool readViewportArrayIndex; // Read viewport array index from last FE stage during binning
+ // user clip/cull distance enables
+ uint8_t cullDistanceMask;
+ uint8_t clipDistanceMask;
+
// Offset to the start of the attributes of the input vertices, in simdvector units
uint32_t vertexAttribOffset;
};