From 4c9589909807f346e23966379f240dd57d057a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 16 Jan 2019 04:41:27 +0100 Subject: GPU: Rename GPU_shader_get_uniform to GPU_shader_get_uniform_ensure This is in order to make the API more multithread friendly inside the draw manager. GPU_shader_get_uniform will only serve to query the shader interface and not do any GL call, making it threadsafe. For now it only print a warning if the uniform was not queried before. --- source/blender/gpu/intern/gpu_immediate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '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 a71ba68821b..3e13b52e1a5 100644 --- a/source/blender/gpu/intern/gpu_immediate.c +++ b/source/blender/gpu/intern/gpu_immediate.c @@ -703,16 +703,16 @@ void immVertex2iv(uint attrib_id, const int data[2]) #if 0 # if TRUST_NO_ONE -# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); assert(uniform); +# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform_ensure(imm.shader_interface, name); assert(uniform); # else -# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); +# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform_ensure(imm.shader_interface, name); # endif #else /* NOTE: It is possible to have uniform fully optimized out from the shader. * In this case we can't assert failure or allow NULL-pointer dereference. * TODO(sergey): How can we detect existing-but-optimized-out uniform but still * catch typos in uniform names passed to immUniform*() functions? */ -# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); if (uniform == NULL) return; +# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform_ensure(imm.shader_interface, name); if (uniform == NULL) return; #endif void immUniform1f(const char *name, float x) -- cgit v1.2.3