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) {
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) {
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)
{
};
-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 {
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