zink: add generic wrapper for checking whether a resource needs a barrier

handy to not need to check ahead of time

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8945>
This commit is contained in:
Mike Blumenkrantz 2020-08-19 15:41:41 -04:00 committed by Marge Bot
parent 4536607ea0
commit 5d7cb2495a
2 changed files with 11 additions and 0 deletions

View file

@ -1206,6 +1206,14 @@ zink_resource_buffer_barrier(VkCommandBuffer cmdbuf, struct zink_resource *res,
res->access_stage = pipeline;
}
bool
zink_resource_needs_barrier(struct zink_resource *res, unsigned flags, VkPipelineStageFlags pipeline)
{
if (res->base.target == PIPE_BUFFER)
return zink_resource_buffer_needs_barrier(res, flags, pipeline);
return zink_resource_image_needs_barrier(res, flags, pipeline);
}
VkShaderStageFlagBits
zink_shader_stage(enum pipe_shader_type type)
{

View file

@ -223,6 +223,9 @@ void
zink_resource_barrier(VkCommandBuffer cmdbuf, struct zink_resource *res,
VkImageLayout new_layout, VkPipelineStageFlags pipeline);
bool
zink_resource_needs_barrier(struct zink_resource *res, unsigned flags, VkPipelineStageFlags pipeline);
void
zink_begin_render_pass(struct zink_context *ctx,
struct zink_batch *batch);