diff options
author | Jason Ekstrand <[email protected]> | 2015-12-30 16:35:34 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-12-30 17:45:43 -0800 |
commit | 2b6bcaf91ab4f3dd7b9a31013725078a38db966d (patch) | |
tree | 740dbd6f98e73c97c12f2adcdce4ba002615908a /src | |
parent | 96d1baa88d37c51c94579f650cfd9465d28634f4 (diff) |
nir/spirv: Separate handling of preamble from type/var/const instructions
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/nir/spirv/spirv_to_nir.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/glsl/nir/spirv/spirv_to_nir.c b/src/glsl/nir/spirv/spirv_to_nir.c index b6f5dd761bb..fd7e9e8dbc1 100644 --- a/src/glsl/nir/spirv/spirv_to_nir.c +++ b/src/glsl/nir/spirv/spirv_to_nir.c @@ -3319,6 +3319,38 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, vtn_handle_decoration(b, opcode, w, count); break; + default: + return false; /* End of preamble */ + } + + return true; +} + +static bool +vtn_handle_variable_or_type_instruction(struct vtn_builder *b, SpvOp opcode, + const uint32_t *w, unsigned count) +{ + switch (opcode) { + case SpvOpSource: + case SpvOpSourceExtension: + case SpvOpExtension: + case SpvOpCapability: + case SpvOpExtInstImport: + case SpvOpMemoryModel: + case SpvOpEntryPoint: + case SpvOpExecutionMode: + case SpvOpString: + case SpvOpName: + case SpvOpMemberName: + case SpvOpLine: + case SpvOpDecorationGroup: + case SpvOpDecorate: + case SpvOpMemberDecorate: + case SpvOpGroupDecorate: + case SpvOpGroupMemberDecorate: + assert(!"Invalid opcode types and variables section"); + break; + case SpvOpTypeVoid: case SpvOpTypeBool: case SpvOpTypeInt: @@ -3617,6 +3649,10 @@ spirv_to_nir(const uint32_t *words, size_t word_count, words = vtn_foreach_instruction(b, words, word_end, vtn_handle_preamble_instruction); + /* Handle all variable, type, and constant instructions */ + words = vtn_foreach_instruction(b, words, word_end, + vtn_handle_variable_or_type_instruction); + vtn_build_cfg(b, words, word_end); foreach_list_typed(struct vtn_function, func, node, &b->functions) { |