[Mesa-dev] [PATCH 3/5] glsl: Return error_type instead of NULL if element_type() is called on non array type.

Fabian Bieler fabianbieler at fastmail.fm
Mon Jun 3 13:23:26 PDT 2013


This matches the behavior of field_type() and other get_*_type() methods.

I looked through the calls to element_type() and didn't find a caller that
depends on the old behavior.

Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
 src/glsl/glsl_types.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 31e3dd2..362c970 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -213,12 +213,12 @@ struct glsl_type {
     * Query the type of elements in an array
     *
     * \return
-    * Pointer to the type of elements in the array for array types, or \c NULL
-    * for non-array types.
+    * Pointer to the type of elements in the array for array types, or
+    * \c glsl_type::error_type for non-array types.
     */
    const glsl_type *element_type() const
    {
-      return is_array() ? fields.array : NULL;
+      return is_array() ? fields.array : error_type;
    }
 
    /**
-- 
1.8.1.2



More information about the mesa-dev mailing list