Commit 50442fac by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Fix ImageHelper's move constructor

Bug: angleproject:4913 Change-Id: Ic78a26be4c2f3fa96ef77deffc239dbb7310065e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2339543Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent bedac4f0
......@@ -21,6 +21,11 @@ Resource::Resource()
mUse.init();
}
Resource::Resource(Resource &&other) : Resource()
{
mUse = std::move(other.mUse);
}
Resource::~Resource()
{
mUse.release();
......
......@@ -187,6 +187,7 @@ class Resource : angle::NonCopyable
protected:
Resource();
Resource(Resource &&other);
// Current resource lifetime.
SharedResourceUse mUse;
......
......@@ -2558,7 +2558,8 @@ ImageHelper::ImageHelper()
}
ImageHelper::ImageHelper(ImageHelper &&other)
: mImage(std::move(other.mImage)),
: Resource(std::move(other)),
mImage(std::move(other.mImage)),
mDeviceMemory(std::move(other.mDeviceMemory)),
mImageType(other.mImageType),
mTilingMode(other.mTilingMode),
......@@ -2577,7 +2578,8 @@ ImageHelper::ImageHelper(ImageHelper &&other)
mLayerCount(other.mLayerCount),
mLevelCount(other.mLevelCount),
mStagingBuffer(std::move(other.mStagingBuffer)),
mSubresourceUpdates(std::move(other.mSubresourceUpdates))
mSubresourceUpdates(std::move(other.mSubresourceUpdates)),
mCurrentSingleClearValue(std::move(other.mCurrentSingleClearValue))
{
ASSERT(this != &other);
other.resetCachedProperties();
......
......@@ -486,8 +486,7 @@ template <typename T>
class BindingPointer final : angle::NonCopyable
{
public:
BindingPointer() : mRefCounted(nullptr) {}
BindingPointer() = default;
~BindingPointer() { reset(); }
BindingPointer(BindingPointer &&other)
......@@ -519,7 +518,7 @@ class BindingPointer final : angle::NonCopyable
bool valid() const { return mRefCounted != nullptr; }
private:
RefCounted<T> *mRefCounted;
RefCounted<T> *mRefCounted = nullptr;
};
// Helper class to share ref-counted Vulkan objects. Requires that T have a destroy method
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment