diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-04-16 13:50:18 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-04-19 13:10:49 +0300 |
commit | 852f2da63cb3b501fe52504f67a550329b0bfa7e (patch) | |
tree | 4809981a77410f690817cd9d7a9bd9bd5f4dda97 /spirv_cross.cpp | |
parent | 682a227f4b2e251a5bae89fa76849ace743926ad (diff) |
Check SPIR-V 1.4 rules when reflecting resources.
Diffstat (limited to 'spirv_cross.cpp')
-rw-r--r-- | spirv_cross.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spirv_cross.cpp b/spirv_cross.cpp index f024fa78..3c37cb21 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -859,8 +859,22 @@ ShaderResources Compiler::get_shader_resources(const unordered_set<VariableID> * if (active_variables && active_variables->find(var.self) == end(*active_variables)) return; + // In SPIR-V 1.4 and up, every global must be present in the entry point interface list, + // not just IO variables. + bool active_in_entry_point = true; + if (ir.get_spirv_version() < 0x10400) + { + if (var.storage == StorageClassInput || var.storage == StorageClassOutput) + active_in_entry_point = interface_variable_exists_in_entry_point(var.self); + } + else + active_in_entry_point = interface_variable_exists_in_entry_point(var.self); + + if (!active_in_entry_point) + return; + // Input - if (var.storage == StorageClassInput && interface_variable_exists_in_entry_point(var.self)) + if (var.storage == StorageClassInput) { if (has_decoration(type.self, DecorationBlock)) { @@ -876,7 +890,7 @@ ShaderResources Compiler::get_shader_resources(const unordered_set<VariableID> * res.subpass_inputs.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); } // Outputs - else if (var.storage == StorageClassOutput && interface_variable_exists_in_entry_point(var.self)) + else if (var.storage == StorageClassOutput) { if (has_decoration(type.self, DecorationBlock)) { |