From 973e1f9d9a967132cc76fbbcd485979ac27e10c5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Apr 2020 16:59:34 +1100 Subject: Cleanup: use term 'attr' instead of 'attrib' This was already the case in most parts of the GPU API. Use full name for descriptive-comments. --- source/blender/gpu/intern/gpu_vertex_format.c | 36 +++++++++++++-------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'source/blender/gpu/intern/gpu_vertex_format.c') diff --git a/source/blender/gpu/intern/gpu_vertex_format.c b/source/blender/gpu/intern/gpu_vertex_format.c index 8370bcf4beb..e6a9cb8f2f2 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.c +++ b/source/blender/gpu/intern/gpu_vertex_format.c @@ -207,15 +207,15 @@ void GPU_vertformat_alias_add(GPUVertFormat *format, const char *alias) } /** - * Makes vertex attrib from the next vertices to be accessible in the vertex shader. - * For an attrib named "attr" you can access the next nth vertex using "attrn". - * Use this function after specifying all the attribs in the format. + * Makes vertex attribute from the next vertices to be accessible in the vertex shader. + * For an attribute named "attr" you can access the next nth vertex using "attr{number}". + * Use this function after specifying all the attributes in the format. * * NOTE: This does NOT work when using indexed rendering. - * NOTE: Only works for first attrib name. (this limitation can be changed if needed) + * NOTE: Only works for first attribute name. (this limitation can be changed if needed) * - * WARNING: this function creates a lot of aliases/attribs, make sure to keep the attrib name - * short to avoid overflowing the namebuffer. + * WARNING: this function creates a lot of aliases/attributes, make sure to keep the attribute + * name short to avoid overflowing the name-buffer. * */ void GPU_vertformat_multiload_enable(GPUVertFormat *format, int load_count) { @@ -276,28 +276,26 @@ static void safe_bytes(char out[11], const char data[8]) /* Warning: Always add a prefix to the result of this function as * the generated string can start with a number and not be a valid attribute name. */ -void GPU_vertformat_safe_attrib_name(const char *attrib_name, - char *r_safe_name, - uint UNUSED(max_len)) +void GPU_vertformat_safe_attr_name(const char *attr_name, char *r_safe_name, uint UNUSED(max_len)) { char data[8] = {0}; - uint len = strlen(attrib_name); + uint len = strlen(attr_name); if (len > 8) { /* Start with the first 4 chars of the name; */ for (int i = 0; i < 4; i++) { - data[i] = attrib_name[i]; + data[i] = attr_name[i]; } /* We use a hash to identify each data layer based on its name. * NOTE: This is still prone to hash collision but the risks are very low.*/ /* Start hashing after the first 2 chars. */ - *(uint *)&data[4] = BLI_ghashutil_strhash_p_murmur(attrib_name + 4); + *(uint *)&data[4] = BLI_ghashutil_strhash_p_murmur(attr_name + 4); } else { /* Copy the whole name. Collision is barely possible * (hash would have to be equal to the last 4 bytes). */ - for (int i = 0; i < 8 && attrib_name[i] != '\0'; i++) { - data[i] = attrib_name[i]; + for (int i = 0; i < 8 && attr_name[i] != '\0'; i++) { + data[i] = attr_name[i]; } } /* Convert to safe bytes characters. */ @@ -305,9 +303,9 @@ void GPU_vertformat_safe_attrib_name(const char *attrib_name, /* End the string */ r_safe_name[11] = '\0'; - BLI_assert(GPU_MAX_SAFE_ATTRIB_NAME >= 12); + BLI_assert(GPU_MAX_SAFE_ATTR_NAME >= 12); #if 0 /* For debugging */ - printf("%s > %lx > %s\n", attrib_name, *(uint64_t *)data, r_safe_name); + printf("%s > %lx > %s\n", attr_name, *(uint64_t *)data, r_safe_name); #endif } @@ -316,13 +314,13 @@ void GPU_vertformat_safe_attrib_name(const char *attrib_name, * Use direct buffer access to fill the data. * This is for advanced usage. * - * Deinterleaved data means all attrib data for each attrib - * is stored continuously like this : + * De-interleaved data means all attribute data for each attribute + * is stored continuously like this: * 000011112222 * instead of : * 012012012012 * - * Note this is per attrib deinterleaving, NOT per component. + * Note this is per attribute de-interleaving, NOT per component. * */ void GPU_vertformat_deinterleave(GPUVertFormat *format) { -- cgit v1.2.3