- reversed sub and revsub in LLVM drawers

This commit is contained in:
Rachael Alexanderson 2016-12-22 03:21:56 -05:00
parent 62724c2161
commit ea1aeb3cdc
2 changed files with 3 additions and 3 deletions

View file

@ -185,7 +185,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
{ {
args.uniforms.destalpha = (uint32_t)(1.0 * 256); args.uniforms.destalpha = (uint32_t)(1.0 * 256);
args.uniforms.srcalpha = (uint32_t)(thing->Alpha * 256); args.uniforms.srcalpha = (uint32_t)(thing->Alpha * 256);
blendmode = args.translation ? TriBlendMode::TranslateSub : TriBlendMode::Sub; blendmode = args.translation ? TriBlendMode::TranslateRevSub : TriBlendMode::RevSub;
} }
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_SoulTrans]) else if (thing->RenderStyle == LegacyRenderStyles[STYLE_SoulTrans])
{ {

View file

@ -119,7 +119,7 @@ SSAVec4i DrawerCodegen::blend_sub(SSAVec4i fg, SSAVec4i bg, SSAInt srcalpha, SSA
SSAInt alpha = fg[3]; SSAInt alpha = fg[3];
alpha = alpha + (alpha >> 7); // 255 -> 256 alpha = alpha + (alpha >> 7); // 255 -> 256
srcalpha = (alpha * srcalpha + 128) >> 8; srcalpha = (alpha * srcalpha + 128) >> 8;
SSAVec4i color = (bg * destalpha - fg * srcalpha) / 256; SSAVec4i color = (fg * srcalpha - bg * destalpha) / 256;
return color.insert(3, 255); return color.insert(3, 255);
} }
@ -128,7 +128,7 @@ SSAVec4i DrawerCodegen::blend_revsub(SSAVec4i fg, SSAVec4i bg, SSAInt srcalpha,
SSAInt alpha = fg[3]; SSAInt alpha = fg[3];
alpha = alpha + (alpha >> 7); // 255 -> 256 alpha = alpha + (alpha >> 7); // 255 -> 256
srcalpha = (alpha * srcalpha + 128) >> 8; srcalpha = (alpha * srcalpha + 128) >> 8;
SSAVec4i color = (fg * srcalpha - bg * destalpha) / 256; SSAVec4i color = (bg * destalpha - fg * srcalpha) / 256;
return color.insert(3, 255); return color.insert(3, 255);
} }