diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-28 23:46:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-29 00:32:25 +0300 |
commit | 68cab3aff63aea95830aa082a160200768d0e826 (patch) | |
tree | 3a042217ce34d84387cdfcca97316597800396db /source/blender/gpu/intern/gpu_attr_binding.c | |
parent | a9c297165878b3c427a20f787cc90a6ada4df253 (diff) |
Cleanup: replace attrib w/ attr
Also rename GPUVertexAttribs to GPUVertAttrLayers,
avoids confusion with GPUVertAttr which isn't closely related.
Diffstat (limited to 'source/blender/gpu/intern/gpu_attr_binding.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_attr_binding.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/gpu/intern/gpu_attr_binding.c b/source/blender/gpu/intern/gpu_attr_binding.c index 398b97c7f9d..2cf6516cd1b 100644 --- a/source/blender/gpu/intern/gpu_attr_binding.c +++ b/source/blender/gpu/intern/gpu_attr_binding.c @@ -35,16 +35,16 @@ #include <stdlib.h> #if GPU_VERT_ATTR_MAX_LEN != 16 -# error "attrib binding code assumes GPU_VERT_ATTR_MAX_LEN = 16" +# error "attribute binding code assumes GPU_VERT_ATTR_MAX_LEN = 16" #endif -void AttribBinding_clear(GPUAttrBinding *binding) +void AttrBinding_clear(GPUAttrBinding *binding) { binding->loc_bits = 0; binding->enabled_bits = 0; } -uint read_attrib_location(const GPUAttrBinding *binding, uint a_idx) +uint read_attr_location(const GPUAttrBinding *binding, uint a_idx) { #if TRUST_NO_ONE assert(a_idx < GPU_VERT_ATTR_MAX_LEN); @@ -53,7 +53,7 @@ uint read_attrib_location(const GPUAttrBinding *binding, uint a_idx) return (binding->loc_bits >> (4 * a_idx)) & 0xF; } -static void write_attrib_location(GPUAttrBinding *binding, uint a_idx, uint location) +static void write_attr_location(GPUAttrBinding *binding, uint a_idx, uint location) { #if TRUST_NO_ONE assert(a_idx < GPU_VERT_ATTR_MAX_LEN); @@ -61,25 +61,25 @@ static void write_attrib_location(GPUAttrBinding *binding, uint a_idx, uint loca #endif const uint shift = 4 * a_idx; const uint64_t mask = ((uint64_t)0xF) << shift; - /* overwrite this attrib's previous location */ + /* overwrite this attr's previous location */ binding->loc_bits = (binding->loc_bits & ~mask) | (location << shift); - /* mark this attrib as enabled */ + /* mark this attr as enabled */ binding->enabled_bits |= 1 << a_idx; } -void get_attrib_locations(const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface) +void get_attr_locations(const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface) { - AttribBinding_clear(binding); + AttrBinding_clear(binding); for (uint a_idx = 0; a_idx < format->attr_len; ++a_idx) { - const GPUVertAttr *a = format->attribs + a_idx; + const GPUVertAttr *a = &format->attrs[a_idx]; for (uint n_idx = 0; n_idx < a->name_len; ++n_idx) { const GPUShaderInput *input = GPU_shaderinterface_attr(shaderface, a->name[n_idx]); #if TRUST_NO_ONE assert(input != NULL); /* TODO: make this a recoverable runtime error? indicates mismatch between vertex format and program */ #endif - write_attrib_location(binding, a_idx, input->location); + write_attr_location(binding, a_idx, input->location); } } } |