On 06/03/2013 01:23 PM, Fabian Bieler wrote:
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.

I'm a little be uncomfortable with this change. There are a few places where the behavior could change (src/glsl/ast_to_hir.cpp:780 and src/glsl/ast_function.cpp:658). The bigger issue is that error_type was only ever intend to "exist" in ast_to_hir. The intention was that type checking operations could propagate error_type up the tree. A compilation error would be emitted once, and when another expression saw "<int> + <error_type>" it wouldn't emit another error message. We started off following that idea really well, but we kind of fell of the wagon somewhere along the line.

Once compilation as completely transitioned from AST to GLSL IR, it should be impossible to get error_type. That's the intention, anyway.

Signed-off-by: Fabian Bieler <[email protected]>
---
  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;
     }

     /**


_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to