[Mesa-dev] [RFC 03/16] mesa: Add half float uniform support

Topi Pohjolainen topi.pohjolainen at intel.com
Fri May 15 02:39:30 PDT 2015


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/main/uniform_query.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 728bd1b..4cdb682 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -448,6 +448,7 @@ log_uniform(const void *values, enum glsl_base_type basicType,
       case GLSL_TYPE_INT:
 	 printf("%d ", v[i].i);
 	 break;
+      case GLSL_TYPE_HALF:
       case GLSL_TYPE_FLOAT:
 	 printf("%g ", v[i].f);
 	 break;
@@ -595,6 +596,8 @@ glsl_type_name(enum glsl_base_type type)
       return "uint";
    case GLSL_TYPE_INT:
       return "int";
+   case GLSL_TYPE_HALF:
+      return "half";
    case GLSL_TYPE_FLOAT:
       return "float";
    case GLSL_TYPE_DOUBLE:
@@ -767,7 +770,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
       const unsigned elems = components * count;
 
       for (unsigned i = 0; i < elems; i++) {
-	 if (basicType == GLSL_TYPE_FLOAT) {
+	 if (basicType == GLSL_TYPE_FLOAT || basicType == GLSL_TYPE_HALF) {
             dst[i].i = src[i].f != 0.0f ? ctx->Const.UniformBooleanTrue : 0;
 	 } else {
             dst[i].i = src[i].i != 0    ? ctx->Const.UniformBooleanTrue : 0;
-- 
1.9.3



More information about the mesa-dev mailing list