diff options
author | Tim Rowley <[email protected]> | 2016-11-03 13:33:13 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-11-14 09:02:36 -0600 |
commit | cee66dd2aa182ba30130bef3298444667753b051 (patch) | |
tree | 3c9183cde23aebf0a4d63ee2a37140508b22673b /src/gallium/drivers | |
parent | 5912552947cc84e794543589388d18aaf4ff6c86 (diff) |
swr: [rasterizer core/jitter] fix alpha test bug
Alpha from render target 0 should always be used for alpha test for all
render targets, according to GL and DX9 specs. Previously we were using
alpha from the current render target.
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/backend.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/state.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp | 10 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.h b/src/gallium/drivers/swr/rasterizer/core/backend.h index dc0be906357..706b372898d 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend.h +++ b/src/gallium/drivers/swr/rasterizer/core/backend.h @@ -714,6 +714,7 @@ INLINE void OutputMerger(SWR_PS_CONTEXT &psContext, uint8_t* (&pColorBase)[SWR_N pBlendState, psContext.shaded[rt], psContext.shaded[1], + psContext.shaded[0].w, sample, pColorSample, blendOut, @@ -787,6 +788,7 @@ INLINE void OutputMerger(SWR_PS_CONTEXT &psContext, uint8_t* (&pColorBase)[SWR_N pBlendState, psContext.shaded[rt], psContext.shaded[1], + psContext.shaded[0].w, sample, reinterpret_cast<uint8_t *>(&blendSrc), blendOut, diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index 5ee12e8ef79..24927cd20b8 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -805,9 +805,13 @@ typedef void(__cdecl *PFN_CS_FUNC)(HANDLE hPrivateData, SWR_CS_CONTEXT* pCsConte typedef void(__cdecl *PFN_SO_FUNC)(SWR_STREAMOUT_CONTEXT& soContext); typedef void(__cdecl *PFN_PIXEL_KERNEL)(HANDLE hPrivateData, SWR_PS_CONTEXT *pContext); typedef void(__cdecl *PFN_CPIXEL_KERNEL)(HANDLE hPrivateData, SWR_PS_CONTEXT *pContext); -typedef void(__cdecl *PFN_BLEND_JIT_FUNC)(const SWR_BLEND_STATE*, simdvector&, simdvector&, uint32_t, uint8_t*, simdvector&, simdscalari*, simdscalari*); +typedef void(__cdecl *PFN_BLEND_JIT_FUNC)(const SWR_BLEND_STATE*, + simdvector& vSrc, simdvector& vSrc1, simdscalar& vSrc0Alpha, uint32_t sample, + uint8_t* pDst, simdvector& vResult, simdscalari* vOMask, simdscalari* vCoverageMask); typedef simdscalar(*PFN_QUANTIZE_DEPTH)(simdscalar); + + ////////////////////////////////////////////////////////////////////////// /// FRONTEND_STATE ///////////////////////////////////////////////////////////////////////// diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp index 46ea4951e87..b5b21c0d332 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp @@ -443,10 +443,13 @@ struct BlendJit : public Builder } } - void AlphaTest(const BLEND_COMPILE_STATE& state, Value* pBlendState, Value* pAlpha, Value* ppMask) + void AlphaTest(const BLEND_COMPILE_STATE& state, Value* pBlendState, Value* ppAlpha, Value* ppMask) { // load uint32_t reference Value* pRef = VBROADCAST(LOAD(pBlendState, { 0, SWR_BLEND_STATE_alphaTestReference })); + + // load alpha + Value* pAlpha = LOAD(ppAlpha); Value* pTest = nullptr; if (state.alphaTestFormat == ALPHA_TEST_UNORM8) @@ -523,6 +526,7 @@ struct BlendJit : public Builder PointerType::get(Gen_SWR_BLEND_STATE(JM()), 0), // SWR_BLEND_STATE* PointerType::get(mSimdFP32Ty, 0), // simdvector& src PointerType::get(mSimdFP32Ty, 0), // simdvector& src1 + PointerType::get(mSimdFP32Ty, 0), // src0alpha Type::getInt32Ty(JM()->mContext), // sampleNum PointerType::get(mSimdFP32Ty, 0), // uint8_t* pDst PointerType::get(mSimdFP32Ty, 0), // simdvector& result @@ -545,6 +549,8 @@ struct BlendJit : public Builder pSrc->setName("src"); Value* pSrc1 = &*argitr++; pSrc1->setName("src1"); + Value* pSrc0Alpha = &*argitr++; + pSrc0Alpha->setName("src0alpha"); Value* sampleNum = &*argitr++; sampleNum->setName("sampleNum"); Value* pDst = &*argitr++; @@ -588,7 +594,7 @@ struct BlendJit : public Builder // alpha test if (state.desc.alphaTestEnable) { - AlphaTest(state, pBlendState, src[3], ppMask); + AlphaTest(state, pBlendState, pSrc0Alpha, ppMask); } // color blend |