From ea1aeb3cdc37df0666e727353f21ec5a5e49672d Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 22 Dec 2016 03:21:56 -0500 Subject: [PATCH] - reversed sub and revsub in LLVM drawers --- src/r_poly_sprite.cpp | 2 +- tools/drawergen/fixedfunction/drawercodegen.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_poly_sprite.cpp b/src/r_poly_sprite.cpp index 2cb285298..182135753 100644 --- a/src/r_poly_sprite.cpp +++ b/src/r_poly_sprite.cpp @@ -185,7 +185,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla { args.uniforms.destalpha = (uint32_t)(1.0 * 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]) { diff --git a/tools/drawergen/fixedfunction/drawercodegen.cpp b/tools/drawergen/fixedfunction/drawercodegen.cpp index ccff40ac0..f7a67e5a6 100644 --- a/tools/drawergen/fixedfunction/drawercodegen.cpp +++ b/tools/drawergen/fixedfunction/drawercodegen.cpp @@ -119,7 +119,7 @@ SSAVec4i DrawerCodegen::blend_sub(SSAVec4i fg, SSAVec4i bg, SSAInt srcalpha, SSA SSAInt alpha = fg[3]; alpha = alpha + (alpha >> 7); // 255 -> 256 srcalpha = (alpha * srcalpha + 128) >> 8; - SSAVec4i color = (bg * destalpha - fg * srcalpha) / 256; + SSAVec4i color = (fg * srcalpha - bg * destalpha) / 256; return color.insert(3, 255); } @@ -128,7 +128,7 @@ SSAVec4i DrawerCodegen::blend_revsub(SSAVec4i fg, SSAVec4i bg, SSAInt srcalpha, SSAInt alpha = fg[3]; alpha = alpha + (alpha >> 7); // 255 -> 256 srcalpha = (alpha * srcalpha + 128) >> 8; - SSAVec4i color = (fg * srcalpha - bg * destalpha) / 256; + SSAVec4i color = (bg * destalpha - fg * srcalpha) / 256; return color.insert(3, 255); }