Actually preserve pv/ps if predicate fails

This commit is contained in:
Dr. Chat 2016-02-21 15:38:10 -06:00
parent cda08ff826
commit 633746b5e4
1 changed files with 8 additions and 3 deletions

View File

@ -720,7 +720,7 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
dest, b.createLoad(pv_));
}
b.createStore(dest, pv_);
b.createStore(pv_dest, pv_);
StoreToResult(dest, instr.result, pred_cond);
}
}
@ -970,7 +970,7 @@ void SpirvShaderTranslator::ProcessScalarAluInstruction(
b.createLoad(ps_));
}
b.createStore(dest, ps_);
b.createStore(ps_dest, ps_);
StoreToResult(dest, instr.result, pred_cond);
}
}
@ -1200,7 +1200,12 @@ void SpirvShaderTranslator::StoreToResult(Id source_value_id,
storage_pointer =
b.createAccessChain(storage_class, storage_pointer, storage_offsets);
}
auto storage_value = b.createLoad(storage_pointer);
// Only load from storage if we need it later.
Id storage_value = 0;
if (!result.has_all_writes() || predicate_cond) {
b.createLoad(storage_pointer);
}
// Convert to the appropriate type, if needed.
if (b.getTypeId(source_value_id) != storage_type) {