diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/api.cpp | 19 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/clip.h | 16 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/context.h | 9 |
3 files changed, 26 insertions, 18 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 5369c21..599d1f4 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -639,13 +639,18 @@ void SwrSetBlendFunc( } // update guardband multipliers for the viewport -void updateGuardband(API_STATE *pState) +void updateGuardbands(API_STATE *pState) { - // guardband center is viewport center - pState->gbState.left = KNOB_GUARDBAND_WIDTH / pState->vp[0].width; - pState->gbState.right = KNOB_GUARDBAND_WIDTH / pState->vp[0].width; - pState->gbState.top = KNOB_GUARDBAND_HEIGHT / pState->vp[0].height; - pState->gbState.bottom = KNOB_GUARDBAND_HEIGHT / pState->vp[0].height; + uint32_t numGbs = pState->gsState.emitsRenderTargetArrayIndex ? KNOB_NUM_VIEWPORTS_SCISSORS : 1; + + for(uint32_t i = 0; i < numGbs; ++i) + { + // guardband center is viewport center + pState->gbState.left[i] = KNOB_GUARDBAND_WIDTH / pState->vp[i].width; + pState->gbState.right[i] = KNOB_GUARDBAND_WIDTH / pState->vp[i].width; + pState->gbState.top[i] = KNOB_GUARDBAND_HEIGHT / pState->vp[i].height; + pState->gbState.bottom[i] = KNOB_GUARDBAND_HEIGHT / pState->vp[i].height; + } } void SwrSetRastState( @@ -709,7 +714,7 @@ void SwrSetViewports( } } - updateGuardband(pState); + updateGuardbands(pState); } void SwrSetScissorRects( diff --git a/src/gallium/drivers/swr/rasterizer/core/clip.h b/src/gallium/drivers/swr/rasterizer/core/clip.h index 2736992..2f3ce85 100644 --- a/src/gallium/drivers/swr/rasterizer/core/clip.h +++ b/src/gallium/drivers/swr/rasterizer/core/clip.h @@ -63,7 +63,7 @@ void Clip(const float *pTriangle, const float *pAttribs, int numAttribs, float * int *numVerts, float *pOutAttribs); INLINE -void ComputeClipCodes(DRIVER_TYPE type, const API_STATE& state, const simdvector& vertex, simdscalar& clipCodes) +void ComputeClipCodes(DRIVER_TYPE type, const API_STATE& state, const simdvector& vertex, simdscalar& clipCodes, simdscalari viewportIndexes) { clipCodes = _simd_setzero_ps(); @@ -110,22 +110,22 @@ void ComputeClipCodes(DRIVER_TYPE type, const API_STATE& state, const simdvector clipCodes = _simd_or_ps(clipCodes, _simd_and_ps(vRes, _simd_castsi_ps(_simd_set1_epi32(NEGW)))); // GUARDBAND_LEFT - simdscalar gbMult = _simd_mul_ps(vNegW, _simd_set1_ps(state.gbState.left)); + simdscalar gbMult = _simd_mul_ps(vNegW, _simd_i32gather_ps(&state.gbState.left[0], viewportIndexes, 4)); vRes = _simd_cmplt_ps(vertex.x, gbMult); clipCodes = _simd_or_ps(clipCodes, _simd_and_ps(vRes, _simd_castsi_ps(_simd_set1_epi32(GUARDBAND_LEFT)))); // GUARDBAND_TOP - gbMult = _simd_mul_ps(vNegW, _simd_set1_ps(state.gbState.top)); + gbMult = _simd_mul_ps(vNegW, _simd_i32gather_ps(&state.gbState.top[0], viewportIndexes, 4)); vRes = _simd_cmplt_ps(vertex.y, gbMult); clipCodes = _simd_or_ps(clipCodes, _simd_and_ps(vRes, _simd_castsi_ps(_simd_set1_epi32(GUARDBAND_TOP)))); // GUARDBAND_RIGHT - gbMult = _simd_mul_ps(vertex.w, _simd_set1_ps(state.gbState.right)); + gbMult = _simd_mul_ps(vertex.w, _simd_i32gather_ps(&state.gbState.right[0], viewportIndexes, 4)); vRes = _simd_cmpgt_ps(vertex.x, gbMult); clipCodes = _simd_or_ps(clipCodes, _simd_and_ps(vRes, _simd_castsi_ps(_simd_set1_epi32(GUARDBAND_RIGHT)))); // GUARDBAND_BOTTOM - gbMult = _simd_mul_ps(vertex.w, _simd_set1_ps(state.gbState.bottom)); + gbMult = _simd_mul_ps(vertex.w, _simd_i32gather_ps(&state.gbState.bottom[0], viewportIndexes, 4)); vRes = _simd_cmpgt_ps(vertex.y, gbMult); clipCodes = _simd_or_ps(clipCodes, _simd_and_ps(vRes, _simd_castsi_ps(_simd_set1_epi32(GUARDBAND_BOTTOM)))); } @@ -140,11 +140,11 @@ public: static_assert(NumVertsPerPrim >= 1 && NumVertsPerPrim <= 3, "Invalid NumVertsPerPrim"); } - void ComputeClipCodes(simdvector vertex[]) + void ComputeClipCodes(simdvector vertex[], simdscalari viewportIndexes) { for (uint32_t i = 0; i < NumVertsPerPrim; ++i) { - ::ComputeClipCodes(this->driverType, this->state, vertex[i], this->clipCodes[i]); + ::ComputeClipCodes(this->driverType, this->state, vertex[i], this->clipCodes[i], viewportIndexes); } } @@ -524,7 +524,7 @@ public: uint32_t numInvoc = _mm_popcnt_u32(primMask); UPDATE_STAT_FE(CInvocations, numInvoc); - ComputeClipCodes(prim); + ComputeClipCodes(prim, viewportIdx); // cull prims with NAN coords primMask &= ~ComputeNaNMask(prim); diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h index c311cb8..0848264 100644 --- a/src/gallium/drivers/swr/rasterizer/core/context.h +++ b/src/gallium/drivers/swr/rasterizer/core/context.h @@ -209,9 +209,12 @@ struct FE_WORK } desc; }; -struct GUARDBAND +struct GUARDBANDS { - float left, right, top, bottom; + float left[KNOB_NUM_VIEWPORTS_SCISSORS]; + float right[KNOB_NUM_VIEWPORTS_SCISSORS]; + float top[KNOB_NUM_VIEWPORTS_SCISSORS]; + float bottom[KNOB_NUM_VIEWPORTS_SCISSORS]; }; struct PA_STATE; @@ -269,7 +272,7 @@ OSALIGNLINE(struct) API_STATE // floating point multisample offsets float samplePos[SWR_MAX_NUM_MULTISAMPLES * 2]; - GUARDBAND gbState; + GUARDBANDS gbState; SWR_VIEWPORT vp[KNOB_NUM_VIEWPORTS_SCISSORS]; SWR_VIEWPORT_MATRICES vpMatrices; |