diff options
author | Tim Rowley <[email protected]> | 2016-04-18 14:35:21 -0600 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-04-27 10:41:45 -0500 |
commit | 24f23817d2b15941c84f42c202eba5b24599286b (patch) | |
tree | 37b72d9441f8e24e01c3831355a44d7d25017046 /src/gallium/drivers/swr | |
parent | fa36f8ec9ce492d65eab8ad599897b3e3045094a (diff) |
swr: [rasterizer core] implement legacy depth bias enable
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/api.cpp | 4 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp | 8 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/state.h | 32 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_state.cpp | 2 |
4 files changed, 25 insertions, 21 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index e3127923b6f..3c253702ec0 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -767,7 +767,7 @@ void SetupPipeline(DRAW_CONTEXT *pDC) const SWR_RASTSTATE &rastState = pState->state.rastState; const SWR_PS_STATE &psState = pState->state.psState; BACKEND_FUNCS& backendFuncs = pState->backendFuncs; - const uint32_t forcedSampleCount = (rastState.bForcedSampleCount) ? 1 : 0; + const uint32_t forcedSampleCount = (rastState.forcedSampleCount) ? 1 : 0; // setup backend if (psState.pfnPixelShader == nullptr) @@ -776,7 +776,7 @@ void SetupPipeline(DRAW_CONTEXT *pDC) } else { - const bool bMultisampleEnable = ((rastState.sampleCount > SWR_MULTISAMPLE_1X) || rastState.bForcedSampleCount) ? 1 : 0; + const bool bMultisampleEnable = ((rastState.sampleCount > SWR_MULTISAMPLE_1X) || rastState.forcedSampleCount) ? 1 : 0; const uint32_t centroid = ((psState.barycentricsMask & SWR_BARYCENTRIC_CENTROID_MASK) > 0) ? 1 : 0; const uint32_t canEarlyZ = (psState.forceEarlyZ || (!psState.writesODepth && !psState.usesSourceDepth && !psState.usesUAV)) ? 1 : 0; diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp index 3144a901c91..f7a462c3174 100644 --- a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp @@ -363,7 +363,13 @@ INLINE float ComputeDepthBias(const SWR_RASTSTATE* pState, const SWR_TRIANGLE_DE scale *= ComputeMaxDepthSlope(pTri); } - float bias = pState->depthBias * ComputeBiasFactor(pState, pTri, z) + scale; + float bias = pState->depthBias; + if (!pState->depthBiasPreAdjusted) + { + bias *= ComputeBiasFactor(pState, pTri, z); + } + bias += scale; + if (pState->depthBiasClamp > 0.0f) { bias = std::min(bias, pState->depthBiasClamp); diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index 88ec4b02033..f4813e42395 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -495,7 +495,6 @@ struct SWR_SURFACE_STATE uint32_t lod; // for render targets, the lod being rendered to uint32_t arrayIndex; // for render targets, the array index being rendered to for arrayed surfaces SWR_TILE_MODE tileMode; // @llvm_enum - bool bInterleavedSamples; // are MSAA samples stored interleaved or planar uint32_t halign; uint32_t valign; uint32_t xOffset; @@ -504,6 +503,8 @@ struct SWR_SURFACE_STATE uint32_t lodOffsets[2][15]; // lod offsets for sampled surfaces uint8_t *pAuxBaseAddress; // Used for compression, append/consume counter, etc. + + bool bInterleavedSamples; // are MSAA samples stored interleaved or planar }; // vertex fetch state @@ -895,22 +896,22 @@ enum SWR_MSAA_RASTMODE ////////////////////////////////////////////////////////////////////////// struct SWR_RASTSTATE { - uint32_t cullMode : 2; - uint32_t fillMode : 2; - uint32_t frontWinding : 1; - uint32_t scissorEnable : 1; - uint32_t depthClipEnable : 1; + uint32_t cullMode : 2; + uint32_t fillMode : 2; + uint32_t frontWinding : 1; + uint32_t scissorEnable : 1; + uint32_t depthClipEnable : 1; + uint32_t pointParam : 1; + uint32_t pointSpriteEnable : 1; + uint32_t pointSpriteTopOrigin : 1; + uint32_t msaaRastEnable : 1; + uint32_t forcedSampleCount : 1; + uint32_t pixelOffset : 1; + uint32_t depthBiasPreAdjusted : 1; ///< depth bias constant is in float units, not per-format Z units + float pointSize; float lineWidth; - // point size output from the VS - bool pointParam; - - // point sprite - bool pointSpriteEnable; - bool pointSpriteTopOrigin; - - // depth bias float depthBias; float slopeScaledDepthBias; float depthBiasClamp; @@ -918,14 +919,11 @@ struct SWR_RASTSTATE ///@todo: MSAA lines // multisample state for MSAA lines - bool msaaRastEnable; SWR_MSAA_RASTMODE rastMode; // @llvm_enum // sample count the rasterizer is running at SWR_MULTISAMPLE_COUNT sampleCount; // @llvm_enum - bool bForcedSampleCount; uint32_t pixelLocation; // UL or Center - bool pixelOffset; // offset pixel positions by .5 in both the horizontal and vertical direction SWR_MULTISAMPLE_POS iSamplePos[SWR_MAX_NUM_MULTISAMPLES]; SWR_MSAA_SAMPLE_PATTERN samplePattern; // @llvm_enum diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index 18c4fb23c9b..7eb904988bd 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -831,7 +831,7 @@ swr_update_derived(struct pipe_context *pipe, rastState->msaaRastEnable = false; rastState->rastMode = SWR_MSAA_RASTMODE_OFF_PIXEL; rastState->sampleCount = SWR_MULTISAMPLE_1X; - rastState->bForcedSampleCount = false; + rastState->forcedSampleCount = false; bool do_offset = false; switch (rasterizer->fill_front) { |