Mesa (master): nir: Return nir_type_invalid for non-numeric base types

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 31 23:52:05 UTC 2019


Module: Mesa
Branch: master
Commit: 75590604a96e266c9b466db3250994333ce4dcc8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=75590604a96e266c9b466db3250994333ce4dcc8

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Fri May 31 16:15:02 2019 -0700

nir: Return nir_type_invalid for non-numeric base types

Now that the type gathering function look at instructions that might
have other types, return invalid type instead of crashing.  That
invalid will be properly ignored later.

Fixes: c12750527b7 "nir: add type information to load uniform/input and store output intrinsics"
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/compiler/nir/nir.h | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index ee60f2410a8..a1bd9b954cf 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -848,9 +848,21 @@ nir_get_nir_type_for_glsl_base_type(enum glsl_base_type base_type)
    case GLSL_TYPE_DOUBLE:
       return nir_type_float64;
       break;
-   default:
-      unreachable("unknown type");
+
+   case GLSL_TYPE_SAMPLER:
+   case GLSL_TYPE_IMAGE:
+   case GLSL_TYPE_ATOMIC_UINT:
+   case GLSL_TYPE_STRUCT:
+   case GLSL_TYPE_INTERFACE:
+   case GLSL_TYPE_ARRAY:
+   case GLSL_TYPE_VOID:
+   case GLSL_TYPE_SUBROUTINE:
+   case GLSL_TYPE_FUNCTION:
+   case GLSL_TYPE_ERROR:
+      return nir_type_invalid;
    }
+
+   unreachable("unknown type");
 }
 
 static inline nir_alu_type




More information about the mesa-commit mailing list