diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-09-15 13:57:07 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-09-15 13:57:07 +0300 |
commit | 0d54d32dd608be5d87d3d57131ede33a8f19aa37 (patch) | |
tree | 0238d2335dc23748ebda0a19e20922aa1fabdff5 | |
parent | 2fb5a959e964590d88846b5bdbb845b372a1a86e (diff) |
Gawain: simplify attrib binding API
This API is used internally by the immediate and batch drawing systems.
-rw-r--r-- | source/blender/gpu/gawain/attrib_binding.c | 9 | ||||
-rw-r--r-- | source/blender/gpu/gawain/attrib_binding.h | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/gpu/gawain/attrib_binding.c b/source/blender/gpu/gawain/attrib_binding.c index 05a52326d95..bb42aaf66eb 100644 --- a/source/blender/gpu/gawain/attrib_binding.c +++ b/source/blender/gpu/gawain/attrib_binding.c @@ -11,6 +11,10 @@ #include "attrib_binding.h" +#if MAX_VERTEX_ATTRIBS != 16 + #error "attrib binding code assumes MAX_VERTEX_ATTRIBS = 16" +#endif + void clear_AttribBinding(AttribBinding* binding) { binding->loc_bits = 0; @@ -20,7 +24,6 @@ void clear_AttribBinding(AttribBinding* binding) unsigned read_attrib_location(const AttribBinding* binding, unsigned a_idx) { #if TRUST_NO_ONE - assert(MAX_VERTEX_ATTRIBS == 16); assert(a_idx < MAX_VERTEX_ATTRIBS); assert(binding->enabled_bits & (1 << a_idx)); #endif @@ -28,10 +31,9 @@ unsigned read_attrib_location(const AttribBinding* binding, unsigned a_idx) return (binding->loc_bits >> (4 * a_idx)) & 0xF; } -void write_attrib_location(AttribBinding* binding, unsigned a_idx, unsigned location) +static void write_attrib_location(AttribBinding* binding, unsigned a_idx, unsigned location) { #if TRUST_NO_ONE - assert(MAX_VERTEX_ATTRIBS == 16); assert(a_idx < MAX_VERTEX_ATTRIBS); assert(location < MAX_VERTEX_ATTRIBS); #endif @@ -59,6 +61,7 @@ void get_attrib_locations(const VertexFormat* format, AttribBinding* binding, GL #if TRUST_NO_ONE assert(loc != -1); + // TODO: make this a recoverable runtime error? indicates mismatch between vertex format and program #endif write_attrib_location(binding, a_idx, loc); diff --git a/source/blender/gpu/gawain/attrib_binding.h b/source/blender/gpu/gawain/attrib_binding.h index dfd06ce2926..9e2431ca379 100644 --- a/source/blender/gpu/gawain/attrib_binding.h +++ b/source/blender/gpu/gawain/attrib_binding.h @@ -20,7 +20,5 @@ typedef struct { void clear_AttribBinding(AttribBinding*); -unsigned read_attrib_location(const AttribBinding*, unsigned a_idx); -void write_attrib_location(AttribBinding*, unsigned a_idx, unsigned location); - void get_attrib_locations(const VertexFormat*, AttribBinding*, GLuint program); +unsigned read_attrib_location(const AttribBinding*, unsigned a_idx); |