From f9a31ba044d3abf07359e66a833eaf1292668c3d Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 29 Apr 2015 14:32:55 -0700 Subject: [PATCH] nir/spirv: Add stub support for extension instructions --- src/glsl/nir/spirv_to_nir.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index 02b99db17ae..76ddce62c1c 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -64,6 +64,9 @@ struct vtn_builder { unsigned value_id_bound; struct vtn_value *values; + + SpvExecutionModel execution_model; + struct vtn_value *entry_point; }; static void @@ -91,6 +94,21 @@ vtn_string_literal(struct vtn_builder *b, const uint32_t *words, return ralloc_strndup(b, (char *)words, (word_count - 2) * sizeof(*words)); } +static void +vtn_handle_extension(struct vtn_builder *b, SpvOp opcode, + const uint32_t *w, unsigned count) +{ + switch (opcode) { + case SpvOpExtInstImport: + /* Do nothing for the moment */ + break; + + case SpvOpExtInst: + default: + unreachable("Unhandled opcode"); + } +} + typedef void (*decoration_foreach_cb)(struct vtn_builder *, struct vtn_value *, const struct vtn_decoration *, @@ -216,6 +234,7 @@ vtn_handle_instruction(struct vtn_builder *b, SpvOp opcode, case SpvOpSourceExtension: case SpvOpMemberName: case SpvOpLine: + case SpvOpExtension: /* Unhandled, but these are for debug so that's ok. */ break; @@ -232,6 +251,22 @@ vtn_handle_instruction(struct vtn_builder *b, SpvOp opcode, vtn_push_token(b, w[2], vtn_value_type_undef); break; + case SpvOpMemoryModel: + assert(w[1] == SpvAddressingModelLogical); + assert(w[2] == SpvMemoryModelGLSL450); + break; + + case SpvOpEntryPoint: + assert(b->entry_point == NULL); + b->entry_point = &b->values[w[2]]; + b->execution_model = w[1]; + break; + + case SpvOpExtInstImport: + case SpvOpExtInst: + vtn_handle_extension(b, opcode, w, count); + break; + case SpvOpTypeVoid: case SpvOpTypeBool: case SpvOpTypeInt: -- 2.30.2