summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_clip.h
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2013-08-23 13:19:19 -0700
committerPaul Berry <stereotype441@gmail.com>2013-08-26 10:15:51 -0700
commitcfe39ea14edc8db13c549b853b214e676f8276f1 (patch)
treedb0e10cf39012dc46f5545e8654f935140c9472c /src/mesa/drivers/dri/i965/brw_clip.h
parent612226c43b072eb45dc3ed21484054824e1c863c (diff)
downloadexternal_mesa3d-cfe39ea14edc8db13c549b853b214e676f8276f1.zip
external_mesa3d-cfe39ea14edc8db13c549b853b214e676f8276f1.tar.gz
external_mesa3d-cfe39ea14edc8db13c549b853b214e676f8276f1.tar.bz2
i965: Allow C++ type safety in the use of enum brw_urb_write_flags.
(From a suggestion by Francisco Jerez) If an enum represents a bitfield of flags, e.g.: enum E { A = 1, B = 2, C = 4, D = 8, }; then C++ normally prohibits statements like this: enum E x = A | B; because A and B are implicitly converted to ints before OR-ing them, and an int can't be stored in an enum without a type cast. C, on the other hand, allows an int to be implicitly converted to an enum without casting. In the past we've dealt with this situation by storing flag bitfields as ints. This avoids ugly casting at the expense of some type safety that C++ would normally have offered (e.g. we get no warning if we accidentally use the wrong enum type). However, we can get the best of both worlds if we override the | operator. The ugly casting is confined to the operator overload, and we still get the benefit of C++ making sure we don't use the wrong enum type. v2: Remove unnecessary comment and unnecessary use of "enum" keyword. Use static_cast. Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_clip.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip.h b/src/mesa/drivers/dri/i965/brw_clip.h
index 5af0ad3..41f5c75 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.h
+++ b/src/mesa/drivers/dri/i965/brw_clip.h
@@ -173,7 +173,7 @@ void brw_clip_init_planes( struct brw_clip_compile *c );
void brw_clip_emit_vue(struct brw_clip_compile *c,
struct brw_indirect vert,
- unsigned flags,
+ enum brw_urb_write_flags flags,
GLuint header);
void brw_clip_kill_thread(struct brw_clip_compile *c);