mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 13:10:10 +01:00
zink: add is_buffer flag to union zink_descriptor_surface
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com> Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
This commit is contained in:
parent
fd9118a739
commit
b2f4b35d5d
2 changed files with 12 additions and 17 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue