mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 09:00:10 +01:00
linker: Fold set_uniform_binding into call site
In the next patch, we'll see that using gl_shader_program::UniformStorage is not correct for uniform blocks. That means we can't use ::UniformStorage to select between the sampler path and the block path. Instead we want to just use the type of the variable. That's never passed to set_uniform_binding, and it's easier to just remove the function (especially for later patches in the series) than to add another parameter. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "10.1" <mesa-stable@lists.freedesktop.org> Cc: github@socker.lepus.uberspace.de
This commit is contained in:
parent
881c52f13f
commit
943b2d52bf
1 changed files with 12 additions and 21 deletions
|
|
@ -150,25 +150,6 @@ set_block_binding(void *mem_ctx, gl_shader_program *prog,
|
||||||
storage->initialized = true;
|
storage->initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
|
|
||||||
const char *name, const glsl_type *type, int binding)
|
|
||||||
{
|
|
||||||
struct gl_uniform_storage *const storage =
|
|
||||||
get_storage(prog->UniformStorage, prog->NumUserUniformStorage, name);
|
|
||||||
|
|
||||||
if (storage == NULL) {
|
|
||||||
assert(storage != NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (storage->type->is_sampler()) {
|
|
||||||
set_sampler_binding(mem_ctx, prog, name, type, binding);
|
|
||||||
} else if (storage->block_index != -1) {
|
|
||||||
set_block_binding(mem_ctx, prog, name, type, binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
|
set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
|
||||||
const char *name, const glsl_type *type,
|
const char *name, const glsl_type *type,
|
||||||
|
|
@ -268,8 +249,18 @@ link_set_uniform_initializers(struct gl_shader_program *prog)
|
||||||
mem_ctx = ralloc_context(NULL);
|
mem_ctx = ralloc_context(NULL);
|
||||||
|
|
||||||
if (var->data.explicit_binding) {
|
if (var->data.explicit_binding) {
|
||||||
linker::set_uniform_binding(mem_ctx, prog, var->name,
|
const glsl_type *const type = var->type;
|
||||||
var->type, var->data.binding);
|
|
||||||
|
if (type->is_sampler()
|
||||||
|
|| (type->is_array() && type->fields.array->is_sampler())) {
|
||||||
|
linker::set_sampler_binding(mem_ctx, prog, var->name,
|
||||||
|
type, var->data.binding);
|
||||||
|
} else if (var->is_in_uniform_block()) {
|
||||||
|
linker::set_block_binding(mem_ctx, prog, var->name,
|
||||||
|
type, var->data.binding);
|
||||||
|
} else {
|
||||||
|
assert(!"Explicit binding not on a sampler or UBO.");
|
||||||
|
}
|
||||||
} else if (var->constant_value) {
|
} else if (var->constant_value) {
|
||||||
linker::set_uniform_initializer(mem_ctx, prog, var->name,
|
linker::set_uniform_initializer(mem_ctx, prog, var->name,
|
||||||
var->type, var->constant_value);
|
var->type, var->constant_value);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue