diff options
author | Tim Rowley <[email protected]> | 2016-03-23 18:12:11 -0600 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-03-25 14:45:40 -0500 |
commit | 090be2e434d6023428faa9842d38f9d5c3cef67a (patch) | |
tree | f0e8b0c3b9e4c9ac2464044db6015cdec0ef2f06 /src/gallium/drivers/swr/rasterizer/jitter | |
parent | 0767e820fd96e8bac2943fa8942bea3ff81b8bd9 (diff) |
swr: [rasterizer jitter] Fix logic bug for alpha-to-coverage.
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/jitter')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp | 13 |
1 files changed, 11 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 2fed2bf4831..a64f86006f4 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp @@ -576,9 +576,12 @@ struct BlendJit : public Builder src1[i] = LOAD(pSrc1, { i }); } Value* currentMask = VIMMED1(-1); - if(state.desc.alphaToCoverageEnable) + if (state.desc.alphaToCoverageEnable) { - currentMask = FP_TO_SI(FMUL(src[3], VBROADCAST(C((float)state.desc.numSamples))), mSimdInt32Ty); + Value* pClampedSrc = FCLAMP(src[3], 0.0f, 1.0f); + uint32_t bits = (1 << state.desc.numSamples) - 1; + currentMask = FMUL(pClampedSrc, VBROADCAST(C((float)bits))); + currentMask = FP_TO_SI(FADD(currentMask, VIMMED1(0.5f)), mSimdInt32Ty); } // alpha test @@ -702,6 +705,12 @@ struct BlendJit : public Builder currentMask = AND(sampleMask, currentMask); } + if (state.desc.alphaToCoverageEnable) + { + Value* sampleMasked = SHL(C(1), sampleNum); + currentMask = AND(currentMask, VBROADCAST(sampleMasked)); + } + if(state.desc.sampleMaskEnable || state.desc.alphaToCoverageEnable || state.desc.oMaskEnable) { |