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 <bruce.cherniak@intel.com>
This commit is contained in:
parent
5912552947
commit
cee66dd2aa
3 changed files with 15 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue