diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-06-04 15:15:25 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-06-04 15:17:06 +0300 |
commit | 10b34ad69724a0b69c30239abb6cb309bb9c8e66 (patch) | |
tree | 85f377a52901450d7efe5a0baf55138cdb80f1b8 /source/blender/gpu/intern/gpu_immediate.c | |
parent | 5837de6879f424a0a26ad787b89f1ec98c91c3c6 (diff) |
GPUShaderInterface: Change builtin array to array of location/bind
This reduce the base size of the shaderinterface from 400 to 136 bytes.
Improves memory usage and cache coherency when querying a lot of uniforms
at once.
Diffstat (limited to 'source/blender/gpu/intern/gpu_immediate.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c index b4cc432dd36..9ea273f33cf 100644 --- a/source/blender/gpu/intern/gpu_immediate.c +++ b/source/blender/gpu/intern/gpu_immediate.c @@ -857,12 +857,10 @@ void immUniform4iv(const char *name, const int data[4]) void immUniformColor4f(float r, float g, float b, float a) { - const GPUShaderInput *uniform = GPU_shaderinterface_uniform_builtin(imm.shader_interface, - GPU_UNIFORM_COLOR); -#if TRUST_NO_ONE - assert(uniform != NULL); -#endif - glUniform4f(uniform->location, r, g, b, a); + int32_t uniform_loc = GPU_shaderinterface_uniform_builtin(imm.shader_interface, + GPU_UNIFORM_COLOR); + BLI_assert(uniform_loc != -1); + glUniform4f(uniform_loc, r, g, b, a); } void immUniformColor4fv(const float rgba[4]) |