shader_recompiler: Use VM bit for conditional discard (#3306)

This commit is contained in:
TheTurtle 2025-07-23 20:58:09 +03:00 committed by GitHub
parent 8dc50ffc79
commit 19c3d05ac1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1 additions and 13 deletions

View File

@ -319,8 +319,6 @@ void CFG::LinkBlocks() {
// need to link with the next block.
if (!end_inst.IsTerminateInstruction()) {
auto* next_block = get_block(block.end);
++next_block->num_predecessors;
block.branch_true = next_block;
block.end_class = EndClass::Branch;
continue;
@ -343,17 +341,11 @@ void CFG::LinkBlocks() {
if (end_inst.IsUnconditionalBranch()) {
auto* target_block = get_block(target_pc);
++target_block->num_predecessors;
block.branch_true = target_block;
block.end_class = EndClass::Branch;
} else if (end_inst.IsConditionalBranch()) {
auto* target_block = get_block(target_pc);
++target_block->num_predecessors;
auto* end_block = get_block(block.end);
++end_block->num_predecessors;
block.branch_true = target_block;
block.branch_false = end_block;
block.end_class = EndClass::Branch;

View File

@ -38,7 +38,6 @@ struct Block : Hook {
u32 end;
u32 begin_index;
u32 end_index;
u32 num_predecessors{};
IR::Condition cond{};
GcnInst end_inst{};
EndClass end_class{};

View File

@ -635,7 +635,6 @@ private:
case StatementType::Code: {
ensure_block();
if (!stmt.block->is_dummy) {
current_block->has_multiple_predecessors = stmt.block->num_predecessors > 1;
const u32 start = stmt.block->begin_index;
const u32 size = stmt.block->end_index - start + 1;
translator.Translate(current_block, stmt.block->begin,

View File

@ -133,7 +133,7 @@ void Translator::ExportUncompressed(IR::Attribute attribute, u32 comp, const IR:
}
void Translator::EmitExport(const GcnInst& inst) {
if (ir.block->has_multiple_predecessors && info.stage == Stage::Fragment) {
if (info.stage == Stage::Fragment && inst.control.exp.vm) {
ir.Discard(ir.LogicalNot(ir.GetExec()));
}

View File

@ -150,8 +150,6 @@ public:
std::array<Value, NumScalarRegs> ssa_sbit_values;
std::array<Value, NumVectorRegs> ssa_vreg_values;
bool has_multiple_predecessors{false};
private:
/// Memory pool for instruction list
Common::ObjectPool<Inst>* inst_pool;