mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
Fix palette blending
This commit is contained in:
parent
1def7b3eae
commit
e642ed099a
2 changed files with 31 additions and 12 deletions
|
@ -671,48 +671,67 @@ SSAInt DrawTriangleCodegen::ProcessPixel8(SSAInt bg, SSAInt *varying)
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::AlphaBlend:
|
case TriBlendMode::AlphaBlend:
|
||||||
palindex = Sample8(uvoffset);
|
palindex = Sample8(uvoffset);
|
||||||
output = (palindex == SSAInt(0)).select(bg, Shade8(palindex));
|
output = Shade8(palindex);
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::AddSolid:
|
case TriBlendMode::AddSolid:
|
||||||
fg = ToBgra(Shade8(Sample8(uvoffset)));
|
palindex = Sample8(uvoffset);
|
||||||
|
fg = ToBgra(Shade8(palindex));
|
||||||
output = ToPal8(blend_add(fg, ToBgra(bg), srcalpha, destalpha));
|
output = ToPal8(blend_add(fg, ToBgra(bg), srcalpha, destalpha));
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::Add:
|
case TriBlendMode::Add:
|
||||||
fg = ToBgra(Shade8(Sample8(uvoffset)));
|
palindex = Sample8(uvoffset);
|
||||||
|
fg = ToBgra(Shade8(palindex));
|
||||||
output = ToPal8(blend_add(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
output = ToPal8(blend_add(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::Sub:
|
case TriBlendMode::Sub:
|
||||||
fg = ToBgra(Shade8(Sample8(uvoffset)));
|
palindex = Sample8(uvoffset);
|
||||||
|
fg = ToBgra(Shade8(palindex));
|
||||||
output = ToPal8(blend_sub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
output = ToPal8(blend_sub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::RevSub:
|
case TriBlendMode::RevSub:
|
||||||
fg = ToBgra(Shade8(Sample8(uvoffset)));
|
palindex = Sample8(uvoffset);
|
||||||
|
fg = ToBgra(Shade8(palindex));
|
||||||
output = ToPal8(blend_revsub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
output = ToPal8(blend_revsub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::Stencil:
|
case TriBlendMode::Stencil:
|
||||||
output = ToPal8(blend_stencil(ToBgra(Shade8(color)), (Sample8(uvoffset) == SSAInt(0)).select(SSAInt(0), SSAInt(256)), ToBgra(bg), srcalpha, destalpha));
|
output = ToPal8(blend_stencil(ToBgra(Shade8(color)), (Sample8(uvoffset) == SSAInt(0)).select(SSAInt(0), SSAInt(256)), ToBgra(bg), srcalpha, destalpha));
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::Shaded:
|
case TriBlendMode::Shaded:
|
||||||
output = ToPal8(blend_stencil(ToBgra(Shade8(color)), Sample8(uvoffset), ToBgra(bg), srcalpha, destalpha));
|
palindex = Sample8(uvoffset);
|
||||||
|
output = ToPal8(blend_stencil(ToBgra(Shade8(color)), palindex, ToBgra(bg), srcalpha, destalpha));
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::TranslateCopy:
|
case TriBlendMode::TranslateCopy:
|
||||||
output = Shade8(TranslateSample8(uvoffset));
|
palindex = TranslateSample8(uvoffset);
|
||||||
|
output = Shade8(palindex);
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::TranslateAlphaBlend:
|
case TriBlendMode::TranslateAlphaBlend:
|
||||||
palindex = TranslateSample8(uvoffset);
|
palindex = TranslateSample8(uvoffset);
|
||||||
output = (palindex == SSAInt(0)).select(bg, Shade8(palindex));
|
output = Shade8(palindex);
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::TranslateAdd:
|
case TriBlendMode::TranslateAdd:
|
||||||
fg = ToBgra(Shade8(Sample8(uvoffset)));
|
palindex = TranslateSample8(uvoffset);
|
||||||
|
fg = ToBgra(Shade8(palindex));
|
||||||
output = ToPal8(blend_add(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
output = ToPal8(blend_add(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::TranslateSub:
|
case TriBlendMode::TranslateSub:
|
||||||
fg = ToBgra(Shade8(Sample8(uvoffset)));
|
palindex = TranslateSample8(uvoffset);
|
||||||
|
fg = ToBgra(Shade8(palindex));
|
||||||
output = ToPal8(blend_sub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
output = ToPal8(blend_sub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
case TriBlendMode::TranslateRevSub:
|
case TriBlendMode::TranslateRevSub:
|
||||||
fg = ToBgra(Shade8(Sample8(uvoffset)));
|
palindex = TranslateSample8(uvoffset);
|
||||||
|
fg = ToBgra(Shade8(palindex));
|
||||||
output = ToPal8(blend_revsub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
output = ToPal8(blend_revsub(fg, ToBgra(bg), srcalpha, calc_blend_bgalpha(fg, destalpha)));
|
||||||
|
output = (palindex == SSAInt(0)).select(bg, output);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ LLVMDrawers *LLVMDrawers::Instance()
|
||||||
|
|
||||||
LLVMDrawersImpl::LLVMDrawersImpl()
|
LLVMDrawersImpl::LLVMDrawersImpl()
|
||||||
{
|
{
|
||||||
int version = 6; // Increment this number if the drawer codegen is modified (forces recreation of the module).
|
int version = 7; // Increment this number if the drawer codegen is modified (forces recreation of the module).
|
||||||
std::string targetCPU = mProgram.GetTargetCPU();
|
std::string targetCPU = mProgram.GetTargetCPU();
|
||||||
bool loaded = mProgram.LoadCachedModule(version, targetCPU);
|
bool loaded = mProgram.LoadCachedModule(version, targetCPU);
|
||||||
if (!loaded)
|
if (!loaded)
|
||||||
|
|
Loading…
Reference in a new issue