Vulkan: Make Buffer/Image be CommandGraphResources.
Don't make TextureVk/RenderbufferVk/SurfaceVk/BufferVk own the
manipulation of the command graph. Instead put the operations close to
the buffers and images used to render.
This will lead towards implementing implicit barriers on the command
graph resources.
Bug: angleproject:2828
Change-Id: I07b742b6792c60285b280d6454f90e963d667e0e
Reviewed-on: https://chromium-review.googlesource.com/1246983
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
index 18dd86d..af826c4 100644
--- a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
@@ -15,11 +15,8 @@
namespace rx
{
-RenderTargetVk::RenderTargetVk(vk::ImageHelper *image,
- vk::ImageView *imageView,
- vk::CommandGraphResource *resource,
- size_t layerIndex)
- : mImage(image), mImageView(imageView), mResource(resource), mLayerIndex(layerIndex)
+RenderTargetVk::RenderTargetVk(vk::ImageHelper *image, vk::ImageView *imageView, size_t layerIndex)
+ : mImage(image), mImageView(imageView), mLayerIndex(layerIndex)
{
}
@@ -30,7 +27,6 @@
RenderTargetVk::RenderTargetVk(RenderTargetVk &&other)
: mImage(other.mImage),
mImageView(other.mImageView),
- mResource(other.mResource),
mLayerIndex(other.mLayerIndex)
{
}
@@ -52,7 +48,7 @@
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, commandBuffer);
// Set up dependencies between the RT resource and the Framebuffer.
- mResource->addWriteDependency(framebufferVk);
+ mImage->addWriteDependency(framebufferVk);
}
void RenderTargetVk::onDepthStencilDraw(vk::CommandGraphResource *framebufferVk,
@@ -74,7 +70,7 @@
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, commandBuffer);
// Set up dependencies between the RT resource and the Framebuffer.
- mResource->addWriteDependency(framebufferVk);
+ mImage->addWriteDependency(framebufferVk);
}
const vk::ImageHelper &RenderTargetVk::getImage() const
@@ -89,11 +85,6 @@
return mImageView;
}
-vk::CommandGraphResource *RenderTargetVk::getResource() const
-{
- return mResource;
-}
-
const vk::Format &RenderTargetVk::getImageFormat() const
{
ASSERT(mImage && mImage->valid());
@@ -120,7 +111,7 @@
ASSERT(mImage && mImage->valid());
// TODO(jmadill): Better simultaneous resource access. http://anglebug.com/2679
- mResource->addWriteDependency(readingResource);
+ mImage->addWriteDependency(readingResource);
mImage->changeLayoutWithStages(mImage->getAspectFlags(), layout,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
@@ -132,7 +123,7 @@
vk::ImageHelper *RenderTargetVk::getImageForWrite(vk::CommandGraphResource *writingResource) const
{
ASSERT(mImage && mImage->valid());
- mResource->addWriteDependency(writingResource);
+ mImage->addWriteDependency(writingResource);
return mImage;
}