nir/spirv: Add defaults for GS input/output primitive types
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 22 Oct 2015 04:45:12 +0000 (21:45 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 22 Oct 2015 04:46:22 +0000 (21:46 -0700)
These are supposed to be specified in the SPIR-V source as SpvExecutionMode
enums but glslang isn't giving them to us.  A bug has been filed:

https://github.com/KhronosGroup/glslang/issues/84

src/glsl/nir/spirv_to_nir.c

index ce19151476395c9d7494a063b5c9d8aa62a922cf..3d23f7ca1fd2f7c4a4699728cb44ffb41da85836 100644 (file)
@@ -3160,6 +3160,12 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
    b->values = rzalloc_array(b, struct vtn_value, value_id_bound);
    exec_list_make_empty(&b->functions);
 
+   /* XXX: We shouldn't need these defaults */
+   if (b->shader->stage == MESA_SHADER_GEOMETRY) {
+      b->shader->info.gs.vertices_in = 3;
+      b->shader->info.gs.output_primitive = 4; /* GL_TRIANGLES */
+   }
+
    /* Handle all the preamble instructions */
    words = vtn_foreach_instruction(b, words, word_end,
                                    vtn_handle_preamble_instruction);