Fix T83625: Shading attribute names cause compilation error.
Some GPU platforms don't support having more than one underscore in sequence in an attribute name. This change will remove the underscore as a possible character when encoding to save names.
This commit is contained in:
parent
96336007e9
commit
2db277092d
Notes:
blender-bot
2023-02-14 07:31:32 +01:00
Referenced by issue #83625, Naming Vertex Color attribute as "snout, Snout" causes shader error.
|
@ -262,13 +262,12 @@ void GPU_vertformat_attr_rename(GPUVertFormat *format, int attr_id, const char *
|
|||
/* Encode 8 original bytes into 11 safe bytes. */
|
||||
static void safe_bytes(char out[11], const char data[8])
|
||||
{
|
||||
char safe_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
||||
char safe_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
uint64_t in = *(uint64_t *)data;
|
||||
for (int i = 0; i < 11; i++) {
|
||||
/* Encoding in base63 */
|
||||
out[i] = safe_chars[in % 63lu];
|
||||
in /= 63lu;
|
||||
out[i] = safe_chars[in % 62lu];
|
||||
in /= 62lu;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue