spirv/nir: Fix the stream ID when emitting a primitive or vertex
authorNeil Roberts <nroberts@igalia.com>
Tue, 16 Jan 2018 18:47:07 +0000 (19:47 +0100)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Tue, 31 Jul 2018 11:18:28 +0000 (13:18 +0200)
It looks like it was previously taking the SPIR-V instruction number
directly instead of looking up the constant value.

v2: use vtn_constant_value helper (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/spirv_to_nir.c

index 7e3a6d6e88224577717df9409ca404cdbff76053..f0a5fae4a645108804f1f8484dc56964268034eb 100644 (file)
@@ -3218,9 +3218,12 @@ vtn_handle_barrier(struct vtn_builder *b, SpvOp opcode,
 
       switch (opcode) {
       case SpvOpEmitStreamVertex:
-      case SpvOpEndStreamPrimitive:
-         nir_intrinsic_set_stream_id(intrin, w[1]);
+      case SpvOpEndStreamPrimitive: {
+         unsigned stream = vtn_constant_value(b, w[1])->values[0].u32[0];
+         nir_intrinsic_set_stream_id(intrin, stream);
          break;
+      }
+
       default:
          break;
       }