GPUImmediate: Fix array uniform not working

This commit is contained in:
2020-06-03 10:28:10 +02:00
parent 59bfcd8c5d
commit 55f8758b87

View File

@@ -809,20 +809,9 @@ void immUniform3fv(const char *name, const float data[3])
/* can increase this limit or move to another file */
#define MAX_UNIFORM_NAME_LEN 60
void immUniformArray3fv(const char *bare_name, const float *data, int count)
/* Note array index is not supported for name (i.e: "array[0]"). */
void immUniformArray3fv(const char *name, const float *data, int count)
{
/* look up "name[0]" when given "name" */
const size_t len = strlen(bare_name);
#if TRUST_NO_ONE
assert(len <= MAX_UNIFORM_NAME_LEN);
#endif
char name[MAX_UNIFORM_NAME_LEN];
strcpy(name, bare_name);
name[len + 0] = '[';
name[len + 1] = '0';
name[len + 2] = ']';
name[len + 3] = '\0';
GET_UNIFORM
glUniform3fv(uniform->location, count, data);
}
@@ -839,20 +828,9 @@ void immUniform4fv(const char *name, const float data[4])
glUniform4fv(uniform->location, 1, data);
}
void immUniformArray4fv(const char *bare_name, const float *data, int count)
/* Note array index is not supported for name (i.e: "array[0]"). */
void immUniformArray4fv(const char *name, const float *data, int count)
{
/* look up "name[0]" when given "name" */
const size_t len = strlen(bare_name);
#if TRUST_NO_ONE
assert(len <= MAX_UNIFORM_NAME_LEN);
#endif
char name[MAX_UNIFORM_NAME_LEN];
strcpy(name, bare_name);
name[len + 0] = '[';
name[len + 1] = '0';
name[len + 2] = ']';
name[len + 3] = '\0';
GET_UNIFORM
glUniform4fv(uniform->location, count, data);
}