[Mesa-dev] [PATCH 35/50] nir: Add 64-bit integer constant support
Ian Romanick
idr at freedesktop.org
Tue Nov 29 03:25:50 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.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 628f8de..6744615 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -223,6 +223,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 cfb032c..37138f0 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -849,6 +849,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 3e6d168..3e10f8b 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -106,6 +106,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 ed02435..96e3136 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.7.4
More information about the mesa-dev
mailing list