mesa/src
Kenneth Graunke 4530ed4f26 glsl: Stop being clever with pointer arithmetic when fetching types.
Currently, vector types are linked together closely: the glsl_type
objects for float, vec2, vec3, and vec4 are all elements of the same
array, in that exact order.  This makes it possible to obtain vector
types via pointer arithmetic on the scalar type's convenience pointer.
For example, float_type + (3 - 1) = vec3.

However, relying on this is extremely fragile.  There's no particular
reason the underlying type objects need to be stored in an array.  They
could be individual class members, possibly with padding between them.
Then the pointer arithmetic would break, and we'd get bad pointers to
non-heap allocated data, causing subtle breakage that can't be detected
by valgrind.  Cue insanity.

Or someone could simply reorder the type variables, causing us to get
the wrong type entirely.  Also cue insanity.

Writing this explicitly is much safer.  With the new helper functions,
it's a bit less code even.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-06-26 11:25:12 -07:00
..
egl wayland: Handle global_remove event as well 2013-06-18 17:45:19 -04:00
gallium hud: add float casts to silence MSVC warnings 2013-06-26 10:42:59 -06:00
gbm gbm: Remember to init format on gbm_dri_bo_create. 2013-02-07 20:00:52 -05:00
getopt
glsl glsl: Stop being clever with pointer arithmetic when fetching types. 2013-06-26 11:25:12 -07:00
glx mesa: remove outdated version lines in comments 2013-06-05 08:54:27 -06:00
gtest gtest: Build it only for 'make check'. 2013-01-13 12:38:44 +01:00
mapi mesa: update glext.h to version 20130624 2013-06-26 10:43:27 -06:00
mesa st/mesa: add casts to silence MSVC warnings 2013-06-26 10:42:59 -06:00
Makefile.am build: Remove GALLIUM_DIRS 2013-04-15 12:04:26 -07:00
SConscript Remove libGLU 2012-08-31 10:58:15 -07:00