aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2017-09-12 14:37:36 -0500
committerTim Rowley <[email protected]>2017-09-25 13:38:57 -0500
commit9c82cf0f1e2b0496d135dc35dbb512e67b4e23f5 (patch)
tree74d254e444e40b439f6d529c70a5b62de568418e /src/gallium
parentefe7fa4384f89ba909c7a5a303658a6442f4f787 (diff)
swr/rast: Move SWR_GS_CONTEXT from thread local storage to stack
Move structure, as the size is significantly reduced due to dynamic allocation of the GS buffers. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/frontend.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
index 26e76a92ef0..15bc93db630 100644
--- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
@@ -708,8 +708,6 @@ void ProcessStreamIdBuffer(uint32_t stream, uint8_t* pStreamIdBase, uint32_t num
}
}
-THREAD SWR_GS_CONTEXT tlsGsContext;
-
// Buffers that are allocated if GS is enabled
struct GsBuffers
{
@@ -798,21 +796,22 @@ static void GeometryShaderStage(
const API_STATE& state = GetApiState(pDC);
const SWR_GS_STATE* pState = &state.gsState;
+ SWR_GS_CONTEXT gsContext;
static uint8_t sNullBuffer[1024] = { 0 };
for (uint32_t i = 0; i < KNOB_SIMD_WIDTH; ++i)
{
- tlsGsContext.pStreams[i] = pGsBuffers->pGsOut[i];
+ gsContext.pStreams[i] = pGsBuffers->pGsOut[i];
}
- tlsGsContext.pVerts = (simdvector*)pGsBuffers->pGsIn;
- tlsGsContext.PrimitiveID = primID;
+ gsContext.pVerts = (simdvector*)pGsBuffers->pGsIn;
+ gsContext.PrimitiveID = primID;
uint32_t numVertsPerPrim = NumVertsPerPrim(pa.binTopology, true);
simdvector attrib[MAX_NUM_VERTS_PER_PRIM];
// assemble all attributes for the input primitive
- tlsGsContext.inputVertStride = pState->inputVertStride;
+ gsContext.inputVertStride = pState->inputVertStride;
for (uint32_t slot = 0; slot < pState->numInputAttribs; ++slot)
{
uint32_t srcAttribSlot = pState->srcVertexAttribOffset + slot;
@@ -821,7 +820,7 @@ static void GeometryShaderStage(
for (uint32_t i = 0; i < numVertsPerPrim; ++i)
{
- tlsGsContext.pVerts[attribSlot + pState->inputVertStride * i] = attrib[i];
+ gsContext.pVerts[attribSlot + pState->inputVertStride * i] = attrib[i];
}
}
@@ -829,7 +828,7 @@ static void GeometryShaderStage(
pa.Assemble(VERTEX_POSITION_SLOT, attrib);
for (uint32_t i = 0; i < numVertsPerPrim; ++i)
{
- tlsGsContext.pVerts[VERTEX_POSITION_SLOT + pState->inputVertStride * i] = attrib[i];
+ gsContext.pVerts[VERTEX_POSITION_SLOT + pState->inputVertStride * i] = attrib[i];
}
// record valid prims from the frontend to avoid over binning the newly generated
@@ -842,15 +841,15 @@ static void GeometryShaderStage(
for (uint32_t instance = 0; instance < pState->instanceCount; ++instance)
{
- tlsGsContext.InstanceID = instance;
- tlsGsContext.mask = GenerateMask(numInputPrims);
+ gsContext.InstanceID = instance;
+ gsContext.mask = GenerateMask(numInputPrims);
// execute the geometry shader
- state.pfnGsFunc(GetPrivateState(pDC), &tlsGsContext);
+ state.pfnGsFunc(GetPrivateState(pDC), &gsContext);
for (uint32_t i = 0; i < KNOB_SIMD_WIDTH; ++i)
{
- tlsGsContext.pStreams[i] += pState->allocationSize;
+ gsContext.pStreams[i] += pState->allocationSize;
}
}