[SPIR-V] Declare DepthReplacing if we replace depth
This commit is contained in:
parent
87bfad1f74
commit
62bee78edd
|
@ -483,8 +483,10 @@ std::vector<uint8_t> SpirvShaderTranslator::CompleteTranslation() {
|
||||||
mainFn, "main");
|
mainFn, "main");
|
||||||
b.addExecutionMode(mainFn, spv::ExecutionModeOriginUpperLeft);
|
b.addExecutionMode(mainFn, spv::ExecutionModeOriginUpperLeft);
|
||||||
|
|
||||||
// FIXME(DrChat): We need to declare the DepthReplacing execution mode if
|
// If we write a new depth value, we must declare this mode!
|
||||||
// we write depth, and we must unconditionally write depth if declared!
|
if (writes_depth_) {
|
||||||
|
b.addExecutionMode(mainFn, spv::ExecutionModeDepthReplacing);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto id : interface_ids_) {
|
for (auto id : interface_ids_) {
|
||||||
entry->addIdOperand(id);
|
entry->addIdOperand(id);
|
||||||
|
@ -3298,6 +3300,7 @@ void SpirvShaderTranslator::StoreToResult(Id source_value_id,
|
||||||
storage_type = float_type_;
|
storage_type = float_type_;
|
||||||
storage_offsets.push_back(0);
|
storage_offsets.push_back(0);
|
||||||
storage_array = false;
|
storage_array = false;
|
||||||
|
writes_depth_ = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case InstructionStorageTarget::kNone:
|
case InstructionStorageTarget::kNone:
|
||||||
|
|
|
@ -163,6 +163,8 @@ class SpirvShaderTranslator : public ShaderTranslator {
|
||||||
spv::Id vtx_ = 0; // Vertex buffer array (32 runtime arrays)
|
spv::Id vtx_ = 0; // Vertex buffer array (32 runtime arrays)
|
||||||
std::unordered_map<uint32_t, uint32_t> vtx_binding_map_;
|
std::unordered_map<uint32_t, uint32_t> vtx_binding_map_;
|
||||||
|
|
||||||
|
bool writes_depth_ = false;
|
||||||
|
|
||||||
// SPIR-V IDs that are part of the in/out interface.
|
// SPIR-V IDs that are part of the in/out interface.
|
||||||
std::vector<spv::Id> interface_ids_;
|
std::vector<spv::Id> interface_ids_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue