[Mesa-dev] [PATCH 45/59] nir: Add 64-bit integer constant support
Ian Romanick
idr at freedesktop.org
Wed Oct 26 00:59:51 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/glsl/glsl_to_nir.cpp | 10 ++++++++++
src/compiler/nir/nir.c | 4 ++++
src/compiler/nir/nir.h | 2 ++
src/compiler/nir/nir_print.c | 8 ++++++++
4 files changed, 24 insertions(+)
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 18600c4..09fd5aa 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -269,6 +269,16 @@ constant_copy(ir_constant *ir, void *mem_ctx)
ret->value.d[i] = ir->value.d[i];
break;
+ case GLSL_TYPE_UINT64:
+ for (i = 0; i < total_elems; i++)
+ ret->value.u64[i] = ir->value.u64[i];
+ break;
+
+ case GLSL_TYPE_INT64:
+ for (i = 0; i < total_elems; i++)
+ ret->value.i64[i] = ir->value.i64[i];
+ break;
+
case GLSL_TYPE_BOOL:
for (i = 0; i < total_elems; i++)
ret->value.b[i] = ir->value.b[i];
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 098e1b2..3238661 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -845,6 +845,10 @@ nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref)
case GLSL_TYPE_DOUBLE:
load->value.f64[i] = constant->value.d[matrix_offset + i];
break;
+ case GLSL_TYPE_INT64:
+ case GLSL_TYPE_UINT64:
+ load->value.u64[i] = constant->value.u64[matrix_offset + i];
+ break;
case GLSL_TYPE_BOOL:
load->value.u32[i] = constant->value.b[matrix_offset + i] ?
NIR_TRUE : NIR_FALSE;
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index d6c8efa..ed30736 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -105,6 +105,8 @@ union nir_constant_data {
float f[16];
bool b[16];
double d[16];
+ uint64_t u64[16];
+ int64_t i64[16];
};
typedef struct nir_constant {
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 35f6468..84a592e 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -322,6 +322,14 @@ print_constant(nir_constant *c, const struct glsl_type *type, print_state *state
}
break;
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
+ for (i = 0; i < total_elems; i++) {
+ if (i > 0) fprintf(fp, ", ");
+ fprintf(fp, "0x%08" PRIx64, c->value.u64[i]);
+ }
+ break;
+
case GLSL_TYPE_STRUCT:
for (i = 0; i < c->num_elements; i++) {
if (i > 0) fprintf(fp, ", ");
--
2.5.5
More information about the mesa-dev
mailing list