diff options
author | Tim Rowley <[email protected]> | 2017-06-09 12:57:39 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-06-16 16:20:16 -0500 |
commit | 08a466aec0b1baf54a7ca7b0d7d43bb267e01841 (patch) | |
tree | 7583f904921769685bcc816e1c37e04644f23160 /src/gallium/drivers/swr | |
parent | 17cdd1e7964d87c2918469a5f961500ad2b00581 (diff) |
swr/rast: Fix read-back of render target array index
The last FE stage can emit render target array index. Currently we only
check to see if GS is emitting it. Moved the state to BACKEND_STATE and
plumbed the driver to set it.
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/api.cpp | 2 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/binner.cpp | 16 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/state.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_shader.cpp | 1 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_state.cpp | 7 |
5 files changed, 18 insertions, 13 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 5dd4dc3430c..eacce1cc5e9 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -680,7 +680,7 @@ void SwrSetBlendFunc( // update guardband multipliers for the viewport void updateGuardbands(API_STATE *pState) { - uint32_t numGbs = pState->gsState.emitsRenderTargetArrayIndex ? KNOB_NUM_VIEWPORTS_SCISSORS : 1; + uint32_t numGbs = pState->backendState.readRenderTargetArrayIndex ? KNOB_NUM_VIEWPORTS_SCISSORS : 1; for(uint32_t i = 0; i < numGbs; ++i) { diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp index 4f8498d8b97..a73816b8bce 100644 --- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp @@ -763,7 +763,7 @@ endBinTriangles: // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simdvector vRtai[3]; pa.Assemble(VERTEX_SGV_SLOT, vRtai); @@ -1213,7 +1213,7 @@ endBinTriangles: // store render target array index OSALIGNSIMD16(uint32_t) aRTAI[KNOB_SIMD16_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simd16vector vRtai[3]; pa.Assemble_simd16(VERTEX_SGV_SLOT, vRtai); @@ -1423,7 +1423,7 @@ void BinPostSetupPoints( // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simdvector vRtai; pa.Assemble(VERTEX_SGV_SLOT, &vRtai); @@ -1563,7 +1563,7 @@ void BinPostSetupPoints( // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simdvector vRtai[2]; pa.Assemble(VERTEX_SGV_SLOT, vRtai); @@ -1793,7 +1793,7 @@ void BinPostSetupPoints_simd16( // store render target array index OSALIGNSIMD16(uint32_t) aRTAI[KNOB_SIMD16_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simd16vector vRtai; pa.Assemble_simd16(VERTEX_SGV_SLOT, &vRtai); @@ -1938,7 +1938,7 @@ void BinPostSetupPoints_simd16( // store render target array index OSALIGNSIMD16(uint32_t) aRTAI[KNOB_SIMD16_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simd16vector vRtai[2]; pa.Assemble_simd16(VERTEX_SGV_SLOT, vRtai); @@ -2219,7 +2219,7 @@ void BinPostSetupLines( // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simdvector vRtai[2]; pa.Assemble(VERTEX_SGV_SLOT, vRtai); @@ -2436,7 +2436,7 @@ void BinPostSetupLines_simd16( // store render target array index OSALIGNSIMD16(uint32_t) aRTAI[KNOB_SIMD16_WIDTH]; - if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) + if (state.backendState.readRenderTargetArrayIndex) { simd16vector vRtai[2]; pa.Assemble_simd16(VERTEX_SGV_SLOT, vRtai); diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index 0cf9ad65dbc..7609d51ed49 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -710,9 +710,6 @@ struct SWR_GS_STATE // instance count uint32_t instanceCount; - // geometry shader emits renderTargetArrayIndex - bool emitsRenderTargetArrayIndex; - // geometry shader emits ViewportArrayIndex bool emitsViewportArrayIndex; @@ -1074,6 +1071,8 @@ struct SWR_BACKEND_STATE // setting up attributes for the backend, otherwise // all attributes up to numAttributes will be sent SWR_ATTRIB_SWIZZLE swizzleMap[32]; + + bool readRenderTargetArrayIndex; // Forward render target array index from last FE stage to the backend }; diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp index 2a772939e2d..f4029be89aa 100644 --- a/src/gallium/drivers/swr/swr_shader.cpp +++ b/src/gallium/drivers/swr/swr_shader.cpp @@ -547,7 +547,6 @@ BuilderSWR::CompileGS(struct swr_context *ctx, swr_jit_gs_key &key) pGS->maxNumVerts = info->properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES]; pGS->instanceCount = info->properties[TGSI_PROPERTY_GS_INVOCATIONS]; - pGS->emitsRenderTargetArrayIndex = info->writes_layer; pGS->emitsViewportArrayIndex = info->writes_viewport_index; // XXX: single stream for now... diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index abdcef7b2f3..19d961f05ae 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1755,6 +1755,13 @@ swr_update_derived(struct pipe_context *pipe, (ctx->rasterizer->flatshade ? ctx->fs->flatConstantMask : 0); backendState.pointSpriteTexCoordMask = ctx->fs->pointSpriteMask; + if (ctx->gs) + backendState.readRenderTargetArrayIndex = + ctx->gs->info.base.writes_layer; + else + backendState.readRenderTargetArrayIndex = + ctx->vs->info.base.writes_layer; + SwrSetBackendState(ctx->swrContext, &backendState); /* Ensure that any in-progress attachment change StoreTiles finish */ |