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/swr/rasterizer/jitter | |
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/swr/rasterizer/jitter')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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 |