diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 19d25412a21..1ea2594f994 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -472,11 +472,13 @@ update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader, struct zink_buffer_view *bv = get_bufferview_for_binding(ctx, shader, type, slot); ctx->di.tbos[shader][slot] = bv->buffer_view; ctx->di.sampler_surfaces[shader][slot].bufferview = bv; + ctx->di.sampler_surfaces[shader][slot].is_buffer = true; } else { struct zink_surface *surface = get_imageview_for_binding(ctx, shader, type, slot); ctx->di.textures[shader][slot].imageLayout = get_layout_for_binding(res, type); ctx->di.textures[shader][slot].imageView = surface->image_view; ctx->di.sampler_surfaces[shader][slot].surface = surface; + ctx->di.sampler_surfaces[shader][slot].is_buffer = false; } } else { if (have_null_descriptors) { @@ -497,11 +499,13 @@ update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader, struct zink_buffer_view *bv = get_bufferview_for_binding(ctx, shader, type, slot); ctx->di.texel_images[shader][slot] = bv->buffer_view; ctx->di.image_surfaces[shader][slot].bufferview = bv; + ctx->di.image_surfaces[shader][slot].is_buffer = true; } else { struct zink_surface *surface = get_imageview_for_binding(ctx, shader, type, slot); ctx->di.images[shader][slot].imageLayout = get_layout_for_binding(res, type); ctx->di.images[shader][slot].imageView = surface->image_view; ctx->di.image_surfaces[shader][slot].surface = surface; + ctx->di.image_surfaces[shader][slot].is_buffer = false; } } else { if (have_null_descriptors) { @@ -1723,18 +1727,6 @@ get_access_flags_for_binding(struct zink_context *ctx, enum zink_descriptor_type return 0; } -static inline void -add_surface_ref(struct zink_context *ctx, struct zink_resource *res, union zink_descriptor_surface *surface) -{ - if (!surface) - return; - if (res->obj->is_buffer) { - if (surface->bufferview) - zink_batch_reference_bufferview(&ctx->batch, surface->bufferview); - } else if (surface->surface) - zink_batch_reference_surface(&ctx->batch, surface->surface); -} - static void update_resource_refs_for_stage(struct zink_context *ctx, enum pipe_shader_type stage) { diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 77b65af5301..1de31d7db62 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -125,9 +125,12 @@ struct zink_viewport_state { }; -union zink_descriptor_surface { - struct zink_surface *surface; - struct zink_buffer_view *bufferview; +struct zink_descriptor_surface { + union { + struct zink_surface *surface; + struct zink_buffer_view *bufferview; + }; + bool is_buffer; }; struct zink_context { @@ -257,8 +260,8 @@ struct zink_context { uint8_t num_images[PIPE_SHADER_TYPES]; struct zink_resource *descriptor_res[ZINK_DESCRIPTOR_TYPES][PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; - union zink_descriptor_surface sampler_surfaces[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; - union zink_descriptor_surface image_surfaces[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES]; + struct zink_descriptor_surface sampler_surfaces[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; + struct zink_descriptor_surface image_surfaces[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES]; } di; bool descriptor_refs_dirty[2]; struct set *need_barriers[2]; //gfx, compute