Vulkan: Store ImageHelper as a pointer in TextureVk and RenderbufferVk
Storing ImageHelper as a pointer allows the storage to be swapped or shared
with other objects.
BUG=angleproject:2668
Change-Id: I2e51f24737be59ffe9f472e9b0b592774a792cd1
Reviewed-on: https://chromium-review.googlesource.com/c/1409404
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
index a94943f..83b609a 100644
--- a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
@@ -16,11 +16,8 @@
namespace rx
{
-RenderTargetVk::RenderTargetVk(vk::ImageHelper *image,
- vk::ImageView *imageView,
- size_t layerIndex,
- TextureVk *owner)
- : mImage(image), mImageView(imageView), mLayerIndex(layerIndex), mOwner(owner)
+RenderTargetVk::RenderTargetVk()
+ : mImage(nullptr), mImageView(nullptr), mLayerIndex(0), mOwner(nullptr)
{}
RenderTargetVk::~RenderTargetVk() {}
@@ -32,6 +29,25 @@
mOwner(other.mOwner)
{}
+void RenderTargetVk::init(vk::ImageHelper *image,
+ vk::ImageView *imageView,
+ size_t layerIndex,
+ TextureVk *owner)
+{
+ mImage = image;
+ mImageView = imageView;
+ mLayerIndex = layerIndex;
+ mOwner = owner;
+}
+
+void RenderTargetVk::reset()
+{
+ mImage = nullptr;
+ mImageView = nullptr;
+ mLayerIndex = 0;
+ mOwner = nullptr;
+}
+
void RenderTargetVk::onColorDraw(vk::FramebufferHelper *framebufferVk,
vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc)