mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 07:10:15 +01:00
mesa: associate uniform storage to bindless samplers/images
When a bindless sampler/image is bound to a texture/image unit, we have to overwrite the constant value by the resident handle directly in the constant buffer before the next draw. One solution is to keep track of a pointer to the data. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
878a6e6eed
commit
804e6f2b76
1 changed files with 25 additions and 0 deletions
|
|
@ -2533,6 +2533,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
|
|||
bool propagate_to_storage)
|
||||
{
|
||||
struct gl_program_parameter_list *params = prog->Parameters;
|
||||
gl_shader_stage shader_type = prog->info.stage;
|
||||
|
||||
/* After adding each uniform to the parameter list, connect the storage for
|
||||
* the parameter with the tracking structure used by the API for the
|
||||
|
|
@ -2615,6 +2616,30 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
|
|||
format,
|
||||
¶ms->ParameterValues[i]);
|
||||
|
||||
/* When a bindless sampler/image is bound to a texture/image unit, we
|
||||
* have to overwrite the constant value by the resident handle
|
||||
* directly in the constant buffer before the next draw. One solution
|
||||
* is to keep track a pointer to the base of the data.
|
||||
*/
|
||||
if (storage->is_bindless && (prog->sh.NumBindlessSamplers ||
|
||||
prog->sh.NumBindlessImages)) {
|
||||
unsigned array_elements = MAX2(1, storage->array_elements);
|
||||
|
||||
for (unsigned j = 0; j < array_elements; ++j) {
|
||||
unsigned unit = storage->opaque[shader_type].index + j;
|
||||
|
||||
if (storage->type->without_array()->is_sampler()) {
|
||||
assert(unit >= 0 && unit < prog->sh.NumBindlessSamplers);
|
||||
prog->sh.BindlessSamplers[unit].data =
|
||||
¶ms->ParameterValues[i] + j;
|
||||
} else if (storage->type->without_array()->is_image()) {
|
||||
assert(unit >= 0 && unit < prog->sh.NumBindlessImages);
|
||||
prog->sh.BindlessImages[unit].data =
|
||||
¶ms->ParameterValues[i] + j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* After attaching the driver's storage to the uniform, propagate any
|
||||
* data from the linker's backing store. This will cause values from
|
||||
* initializers in the source code to be copied over.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue