mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-26 05:41:39 +00:00
Improve performance by 30% from using a better stencil block rejection test
This commit is contained in:
parent
e3b3b7a4ce
commit
06362385d6
1 changed files with 16 additions and 16 deletions
|
@ -238,8 +238,22 @@ void DrawTriangleCodegen::LoopBlockX()
|
|||
SSAInt c = (c00.zext_int() << 0) | (c10.zext_int() << 1) | (c01.zext_int() << 2) | (c11.zext_int() << 3);
|
||||
|
||||
// Skip block when outside an edge
|
||||
SSABool process_block = !(a == SSAInt(0) || b == SSAInt(0) || c == SSAInt(0));
|
||||
|
||||
SetStencilBlock(x / 8 + y / 8 * stencilPitch);
|
||||
|
||||
// Stencil test the whole block, if possible
|
||||
if (variant == TriDrawVariant::DrawSubsector || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector || variant == TriDrawVariant::StencilClose)
|
||||
{
|
||||
process_block = process_block && (!StencilIsSingleValue() || SSABool::compare_uge(StencilGetSingle(), stencilTestValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
process_block = process_block && (!StencilIsSingleValue() || StencilGetSingle() == stencilTestValue);
|
||||
}
|
||||
|
||||
SSAIfBlock branch;
|
||||
branch.if_block(!(a == SSAInt(0) || b == SSAInt(0) || c == SSAInt(0)));
|
||||
branch.if_block(process_block);
|
||||
|
||||
// Check if block needs clipping
|
||||
SSABool clipneeded = (x + q) > clipright || (y + q) > clipbottom;
|
||||
|
@ -261,8 +275,6 @@ void DrawTriangleCodegen::LoopBlockX()
|
|||
currentlight = (!is_fixed_light).select(diminishedlight, light);
|
||||
}
|
||||
|
||||
SetStencilBlock(x / 8 + y / 8 * stencilPitch);
|
||||
|
||||
SSABool covered = a == SSAInt(0xF) && b == SSAInt(0xF) && c == SSAInt(0xF) && !clipneeded && StencilIsSingleValue();
|
||||
|
||||
// Accept whole block when totally covered
|
||||
|
@ -304,16 +316,6 @@ void DrawTriangleCodegen::SetupAffineBlock()
|
|||
|
||||
void DrawTriangleCodegen::LoopFullBlock()
|
||||
{
|
||||
SSAIfBlock branch_stenciltest;
|
||||
if (variant == TriDrawVariant::DrawSubsector || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector || variant == TriDrawVariant::StencilClose)
|
||||
{
|
||||
branch_stenciltest.if_block(SSABool::compare_uge(StencilGetSingle(), stencilTestValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
branch_stenciltest.if_block(StencilGetSingle() == stencilTestValue);
|
||||
}
|
||||
|
||||
if (variant == TriDrawVariant::Stencil)
|
||||
{
|
||||
StencilClear(stencilWriteValue);
|
||||
|
@ -418,8 +420,6 @@ void DrawTriangleCodegen::LoopFullBlock()
|
|||
AffineVaryingPosY[i] = AffineVaryingPosY[i] + gradVaryingY[i];
|
||||
}
|
||||
}
|
||||
|
||||
branch_stenciltest.end_block();
|
||||
}
|
||||
|
||||
void DrawTriangleCodegen::LoopPartialBlock()
|
||||
|
|
Loading…
Reference in a new issue