Skip to content

Commit

Permalink
Vulkan: Make image{Read,Write} helper interface api agnostic
Browse files Browse the repository at this point in the history
Removing ContextVk dependency on the imageRead/imageWrite helper utility
functions.

Bug: angleproject:42266971
Change-Id: I493e1fb11e8ae192f766c822cbee278c49c23bfe
Signed-off-by: Gowtham Tammana <[email protected]>
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5845197
Reviewed-by: Charlie Lao <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
Commit-Queue: Shahbaz Youssefi <[email protected]>
  • Loading branch information
gowtham-sarc authored and Angle LUCI CQ committed Sep 16, 2024
1 parent f6d9b17 commit 937c5dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/libANGLE/renderer/vulkan/vk_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1880,39 +1880,39 @@ angle::Result OutsideRenderPassCommandBufferHelper::reset(
return initializeCommandBuffer(context);
}

void OutsideRenderPassCommandBufferHelper::imageRead(ContextVk *contextVk,
void OutsideRenderPassCommandBufferHelper::imageRead(Context *context,
VkImageAspectFlags aspectFlags,
ImageLayout imageLayout,
ImageHelper *image)
{
if (contextVk->isRenderPassStartedAndUsesImage(*image))
if (image->getResourceUse() >= mQueueSerial)
{
// If image is already used by renderPass, it may already set the event to renderPass's
// event. In this case we already lost the previous event to wait for, thus use pipeline
// barrier instead of event
imageReadImpl(contextVk, aspectFlags, imageLayout, BarrierType::Pipeline, image);
imageReadImpl(context, aspectFlags, imageLayout, BarrierType::Pipeline, image);
}
else
{
imageReadImpl(contextVk, aspectFlags, imageLayout, BarrierType::Event, image);
imageReadImpl(context, aspectFlags, imageLayout, BarrierType::Event, image);
// Usually an image can only used by a RenderPassCommands or OutsideRenderPassCommands
// because the layout will be different, except with image sampled from compute shader. In
// this case, the renderPassCommands' read will override the outsideRenderPassCommands'
retainImageWithEvent(contextVk, image);
retainImageWithEvent(context, image);
}
}

void OutsideRenderPassCommandBufferHelper::imageWrite(ContextVk *contextVk,
void OutsideRenderPassCommandBufferHelper::imageWrite(Context *context,
gl::LevelIndex level,
uint32_t layerStart,
uint32_t layerCount,
VkImageAspectFlags aspectFlags,
ImageLayout imageLayout,
ImageHelper *image)
{
imageWriteImpl(contextVk, level, layerStart, layerCount, aspectFlags, imageLayout,
imageWriteImpl(context, level, layerStart, layerCount, aspectFlags, imageLayout,
BarrierType::Event, image);
retainImageWithEvent(contextVk, image);
retainImageWithEvent(context, image);
}

void OutsideRenderPassCommandBufferHelper::retainImage(ImageHelper *image)
Expand Down
4 changes: 2 additions & 2 deletions src/libANGLE/renderer/vulkan/vk_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1535,11 +1535,11 @@ class OutsideRenderPassCommandBufferHelper final : public CommandBufferHelperCom
void markClosed() { mCommandBuffer.close(); }
#endif

void imageRead(ContextVk *contextVk,
void imageRead(Context *context,
VkImageAspectFlags aspectFlags,
ImageLayout imageLayout,
ImageHelper *image);
void imageWrite(ContextVk *contextVk,
void imageWrite(Context *context,
gl::LevelIndex level,
uint32_t layerStart,
uint32_t layerCount,
Expand Down

0 comments on commit 937c5dc

Please sign in to comment.