diff --git a/intern/cycles/blender/display_driver.cpp b/intern/cycles/blender/display_driver.cpp index 8df0061d8ca..e5b496dab87 100644 --- a/intern/cycles/blender/display_driver.cpp +++ b/intern/cycles/blender/display_driver.cpp @@ -105,7 +105,8 @@ GPUShader *BlenderFallbackDisplayShader::bind(int width, int height) /* Bind shader now to enable uniform assignment. */ GPU_shader_bind(shader_program_); - GPU_shader_uniform_int(shader_program_, image_texture_location_, 0); + float slot = 0; + GPU_shader_uniform_vector_int(shader_program_, image_texture_location_, 1, 1, &slot); float size[2]; size[0] = width; size[1] = height; diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 3be04137695..35a83d5635a 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -687,10 +687,12 @@ static void draw_update_uniforms(DRWShadingGroup *shgroup, state->vlattrs_loc = uni->location; GPU_uniformbuf_bind(drw_ensure_layer_attribute_buffer(), uni->location); break; - case DRW_UNIFORM_RESOURCE_CHUNK: + case DRW_UNIFORM_RESOURCE_CHUNK: { state->chunkid_loc = uni->location; - GPU_shader_uniform_int(shgroup->shader, uni->location, 0); + int zero = 0; + GPU_shader_uniform_vector_int(shgroup->shader, uni->location, 1, 1, &zero); break; + } case DRW_UNIFORM_RESOURCE_ID: state->resourceid_loc = uni->location; break; @@ -807,7 +809,7 @@ static void draw_call_resource_bind(DRWCommandsState *state, const DRWResourceHa int chunk = DRW_handle_chunk_get(handle); if (state->resource_chunk != chunk) { if (state->chunkid_loc != -1) { - GPU_shader_uniform_int(DST.shader, state->chunkid_loc, chunk); + GPU_shader_uniform_vector_int(DST.shader, state->chunkid_loc, 1, 1, &chunk); } if (state->obmats_loc != -1) { GPU_uniformbuf_unbind(DST.vmempool->matrices_ubo[state->resource_chunk]); @@ -827,7 +829,7 @@ static void draw_call_resource_bind(DRWCommandsState *state, const DRWResourceHa if (state->resourceid_loc != -1) { int id = DRW_handle_id_get(handle); if (state->resource_id != id) { - GPU_shader_uniform_int(DST.shader, state->resourceid_loc, id); + GPU_shader_uniform_vector_int(DST.shader, state->resourceid_loc, 1, 1, &id); state->resource_id = id; } } diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 84512653a24..931e0c10575 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -34,7 +34,7 @@ typedef struct IMMDrawPixelsTexState { * To be used before calling #immDrawPixelsTex * Default shader is #GPU_SHADER_2D_IMAGE_COLOR * You can still set uniforms with: - * `GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);` + * `GPU_shader_uniform_*(shader, "name", value);` */ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin); diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 6e9998af625..c8a8f817f96 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -273,10 +273,6 @@ int GPU_shader_get_builtin_block(GPUShader *shader, int builtin); /** DEPRECATED: Kept only because of Python GPU API. */ int GPU_shader_get_uniform_block(GPUShader *shader, const char *name); -/** DEPRECATED: To be replaced by GPU_shader_uniform_vector. */ -void GPU_shader_uniform_float(GPUShader *shader, int location, float value); -void GPU_shader_uniform_int(GPUShader *shader, int location, int value); - /** \} */ #ifdef __cplusplus diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 6460e23e373..2875763fb5e 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -630,20 +630,10 @@ void GPU_shader_uniform_vector_int( unwrap(shader)->uniform_int(loc, len, array_size, value); } -void GPU_shader_uniform_int(GPUShader *shader, int location, int value) -{ - GPU_shader_uniform_vector_int(shader, location, 1, 1, &value); -} - -void GPU_shader_uniform_float(GPUShader *shader, int location, float value) -{ - GPU_shader_uniform_vector(shader, location, 1, 1, &value); -} - void GPU_shader_uniform_1i(GPUShader *sh, const char *name, int value) { const int loc = GPU_shader_get_uniform(sh, name); - GPU_shader_uniform_int(sh, loc, value); + GPU_shader_uniform_vector_int(sh, loc, 1, 1, &value); } void GPU_shader_uniform_1b(GPUShader *sh, const char *name, bool value) @@ -672,7 +662,7 @@ void GPU_shader_uniform_4f(GPUShader *sh, const char *name, float x, float y, fl void GPU_shader_uniform_1f(GPUShader *sh, const char *name, float value) { const int loc = GPU_shader_get_uniform(sh, name); - GPU_shader_uniform_float(sh, loc, value); + GPU_shader_uniform_vector(sh, loc, 1, 1, &value); } void GPU_shader_uniform_2fv(GPUShader *sh, const char *name, const float data[2]) diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 6a66445ee4c..5eb00175c33 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -120,10 +120,7 @@ static void engine_bind_display_space_shader(RenderEngine *UNUSED(engine), Scene { GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_IMAGE); GPU_shader_bind(shader); - - int img_loc = GPU_shader_get_uniform(shader, "image"); - - GPU_shader_uniform_int(shader, img_loc, 0); + /** \note "image" binding slot is 0. */ } static void engine_unbind_display_space_shader(RenderEngine *UNUSED(engine))