forked from blender/blender
WIP: uv-simple-select #1
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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])
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user