[Mesa-dev] [PATCH 06/51] glsl: Add support for 16-bit float constants in nir-conversion
Topi Pohjolainen
topi.pohjolainen at gmail.com
Fri Nov 24 12:26:33 UTC 2017
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/compiler/glsl/glsl_to_nir.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 1e636225c1..289f8be031 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -32,6 +32,7 @@
#include "compiler/nir/nir_control_flow.h"
#include "compiler/nir/nir_builder.h"
#include "main/imports.h"
+#include "util/half_float.h"
/*
* pass to lower GLSL IR to NIR
@@ -245,6 +246,14 @@ constant_copy(ir_constant *ir, void *mem_ctx)
break;
+ case GLSL_TYPE_FLOAT16:
+ for (unsigned c = 0; c < cols; c++) {
+ for (unsigned r = 0; r < rows; r++)
+ ret->values[c].u16[r] =
+ _mesa_float_to_half(ir->value.f[c * rows + r]);
+ }
+ break;
+
case GLSL_TYPE_FLOAT:
for (unsigned c = 0; c < cols; c++) {
for (unsigned r = 0; r < rows; r++)
--
2.11.0
More information about the mesa-dev
mailing list