[Mesa-dev] [PATCH 15/29] nir: handle doubles in nir_deref_get_const_initializer_load()

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Mar 21 12:05:54 UTC 2016


From: Connor Abbott <connor.w.abbott at intel.com>

---
 src/compiler/nir/nir.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index b114981..e0b3777 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -694,6 +694,8 @@ nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref)
    nir_load_const_instr *load =
       nir_load_const_instr_create(shader, glsl_get_vector_elements(tail->type));
 
+   load->def.bit_size = glsl_get_bit_size(glsl_get_base_type(tail->type));
+
    matrix_offset *= load->def.num_components;
    for (unsigned i = 0; i < load->def.num_components; i++) {
       switch (glsl_get_base_type(tail->type)) {
@@ -702,6 +704,9 @@ nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref)
       case GLSL_TYPE_UINT:
          load->value.u32[i] = constant->value.u[matrix_offset + i];
          break;
+      case GLSL_TYPE_DOUBLE:
+         load->value.f64[i] = constant->value.d[matrix_offset + i];
+         break;
       case GLSL_TYPE_BOOL:
          load->value.u32[i] = constant->value.b[matrix_offset + i] ?
                              NIR_TRUE : NIR_FALSE;
-- 
2.5.0



More information about the mesa-dev mailing list