[Mesa-dev] [PATCH] compiler: int8/uint8 fixes
Rob Clark
robdclark at gmail.com
Sun Apr 15 20:40:43 UTC 2018
A couple spots were missed for handling of the new INT8/UINT8 base type.
Also de-duplicate get_base_type().. get_scalar_type() had nearly the
same switch statement, with the exception that anything with base_type
that was not scalar would return error_type. So just handle that one
special case in get_scalar_type().
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
This was causing problems with cl cts vload_local (and probably others).
Due to cast from <type>N to <type> as parameter to vloadN, the resulting
spv would have OpInBoundsPtrAccessChain that deref'd .x component of the
<type>N. But due to this bug the array_deref type (returned from
glsl_get_array_element()) would have <type>N instead of <type> for
vectors with base type int8/uint8. So address calculation in
get_io_offset() would be off.
src/compiler/glsl_types.cpp | 37 ++++++++++++-------------------------
1 file changed, 12 insertions(+), 25 deletions(-)
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 9d853caf721..11947c917a2 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -344,10 +344,14 @@ const glsl_type *glsl_type::get_base_type() const
return uint_type;
case GLSL_TYPE_UINT16:
return uint16_t_type;
+ case GLSL_TYPE_UINT8:
+ return uint8_t_type;
case GLSL_TYPE_INT:
return int_type;
case GLSL_TYPE_INT16:
return int16_t_type;
+ case GLSL_TYPE_INT8:
+ return int8_t_type;
case GLSL_TYPE_FLOAT:
return float_type;
case GLSL_TYPE_FLOAT16:
@@ -374,32 +378,11 @@ const glsl_type *glsl_type::get_scalar_type() const
while (type->base_type == GLSL_TYPE_ARRAY)
type = type->fields.array;
- /* Handle vectors and matrices */
- switch (type->base_type) {
- case GLSL_TYPE_UINT:
- return uint_type;
- case GLSL_TYPE_UINT16:
- return uint16_t_type;
- case GLSL_TYPE_INT:
- return int_type;
- case GLSL_TYPE_INT16:
- return int16_t_type;
- case GLSL_TYPE_FLOAT:
- return float_type;
- case GLSL_TYPE_FLOAT16:
- return float16_t_type;
- case GLSL_TYPE_DOUBLE:
- return double_type;
- case GLSL_TYPE_BOOL:
- return bool_type;
- case GLSL_TYPE_UINT64:
- return uint64_t_type;
- case GLSL_TYPE_INT64:
- return int64_t_type;
- default:
- /* Handle everything else */
+ const glsl_type *scalar_type = type->get_base_type();
+ if (scalar_type == error_type)
return type;
- }
+
+ return scalar_type;
}
@@ -1366,7 +1349,9 @@ glsl_type::uniform_locations() const
case GLSL_TYPE_FLOAT16:
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_BOOL:
@@ -1400,7 +1385,9 @@ glsl_type::varying_count() const
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_BOOL:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
return 1;
--
2.14.3
More information about the mesa-dev
mailing list