mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 11:38:05 +02:00
asahi: unbind samplers and fix sampler_count if state is NULL
When states is NULL, unbind samplers (to avoid dangling pointers) and set sampler_count to the highest non-null samplers[] entry instead of setting it to 0. This is ported from a similar fix in panfrost: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20285 Signed-off-by: Iago López Galeiras <iaguis@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20306>
This commit is contained in:
parent
687a82d2d3
commit
5f2171625b
2 changed files with 11 additions and 3 deletions
|
|
@ -426,11 +426,18 @@ agx_bind_sampler_states(struct pipe_context *pctx,
|
|||
{
|
||||
struct agx_context *ctx = agx_context(pctx);
|
||||
|
||||
ctx->stage[shader].sampler_count = states ? count : 0;
|
||||
ctx->stage[shader].dirty = ~0;
|
||||
|
||||
memcpy(&ctx->stage[shader].samplers[start], states,
|
||||
sizeof(struct agx_sampler_state *) * count);
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
unsigned p = start + i;
|
||||
ctx->stage[shader].samplers[p] = states ? states[i] : NULL;
|
||||
if (ctx->stage[shader].samplers[p])
|
||||
ctx->stage[shader].valid_samplers |= BITFIELD_BIT(p);
|
||||
else
|
||||
ctx->stage[shader].valid_samplers &= ~BITFIELD_BIT(p);
|
||||
}
|
||||
|
||||
ctx->stage[shader].sampler_count = util_last_bit(ctx->stage[shader].valid_samplers);
|
||||
}
|
||||
|
||||
/* Channels agree for RGBA but are weird for force 0/1 */
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ struct agx_stage {
|
|||
struct agx_sampler_view *textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||
|
||||
unsigned sampler_count, texture_count;
|
||||
uint32_t valid_samplers;
|
||||
};
|
||||
|
||||
struct agx_batch {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue