[Bf-blender-cvs] [55f8758b875] master: GPUImmediate: Fix array uniform not working

Clément Foucault noreply at git.blender.org
Wed Jun 3 11:03:15 CEST 2020


Commit: 55f8758b8757bc5af7d3aaae0436d8730e0342ba
Author: Clément Foucault
Date:   Wed Jun 3 10:28:10 2020 +0200
Branches: master
https://developer.blender.org/rB55f8758b8757bc5af7d3aaae0436d8730e0342ba

GPUImmediate: Fix array uniform not working

===================================================================

M	source/blender/gpu/intern/gpu_immediate.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index a26b315e7e5..b4cc432dd36 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -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);
 }



More information about the Bf-blender-cvs mailing list