spirv: add support for loading DF constants
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Mon, 21 Nov 2016 15:30:47 +0000 (16:30 +0100)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Mon, 9 Jan 2017 08:10:13 +0000 (09:10 +0100)
v2 (Jason):
- Add assert.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/spirv_to_nir.c

index 46e0c386eedcafca81ccfc14c955a64133aa7cbf..27995ba0d2603f265c2e95cc267839a291b87d79 100644 (file)
@@ -1003,10 +1003,18 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
       break;
    }
 
-   case SpvOpConstant:
+   case SpvOpConstant: {
       assert(glsl_type_is_scalar(val->const_type));
-      val->constant->values[0].u32[0] = w[3];
+      int bit_size = glsl_get_bit_size(val->const_type);
+      if (bit_size == 64) {
+         val->constant->values->u32[0] = w[3];
+         val->constant->values->u32[1] = w[4];
+      } else {
+         assert(bit_size == 32);
+         val->constant->values->u32[0] = w[3];
+      }
       break;
+   }
    case SpvOpSpecConstant:
       assert(glsl_type_is_scalar(val->const_type));
       val->constant->values[0].u32[0] = get_specialization(b, val, w[3]);