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 <bruce.cherniak@intel.com>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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...
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user