shader: branch to the pixel kill on the inverted targets instead of negating the condition

This commit is contained in:
nmzik
2026-10-22 00:33:07 +02:00
parent 6ee2ef8715
commit 8177969f33
@@ -16,10 +16,8 @@ namespace {
void EmitKillIfBoolFalse(EmitterState& state, uint32_t active) {
const auto kill_label = state.builder.AllocateId();
const auto merge_label = state.builder.AllocateId();
const auto inactive = state.builder.AllocateId();
state.builder.AddFunction(spv::OpLogicalNot, TypeBool(state), inactive, active);
state.builder.AddFunction(spv::OpSelectionMerge, merge_label, spv::SelectionControlMaskNone);
state.builder.AddFunction(spv::OpBranchConditional, inactive, kill_label, merge_label);
state.builder.AddFunction(spv::OpBranchConditional, active, merge_label, kill_label);
EmitLabel(state, kill_label);
state.builder.AddFunction(spv::OpKill);
EmitLabel(state, merge_label);