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() ...@@ -21,6 +21,11 @@ Resource::Resource()
mUse.init(); mUse.init();
} }
Resource::Resource(Resource &&other) : Resource()
{
mUse = std::move(other.mUse);
}
Resource::~Resource() Resource::~Resource()
{ {
mUse.release(); mUse.release();
......
...@@ -187,6 +187,7 @@ class Resource : angle::NonCopyable ...@@ -187,6 +187,7 @@ class Resource : angle::NonCopyable
protected: protected:
Resource(); Resource();
Resource(Resource &&other);
// Current resource lifetime. // Current resource lifetime.
SharedResourceUse mUse; SharedResourceUse mUse;
......
...@@ -2558,7 +2558,8 @@ ImageHelper::ImageHelper() ...@@ -2558,7 +2558,8 @@ ImageHelper::ImageHelper()
} }
ImageHelper::ImageHelper(ImageHelper &&other) ImageHelper::ImageHelper(ImageHelper &&other)
: mImage(std::move(other.mImage)), : Resource(std::move(other)),
mImage(std::move(other.mImage)),
mDeviceMemory(std::move(other.mDeviceMemory)), mDeviceMemory(std::move(other.mDeviceMemory)),
mImageType(other.mImageType), mImageType(other.mImageType),
mTilingMode(other.mTilingMode), mTilingMode(other.mTilingMode),
...@@ -2577,7 +2578,8 @@ ImageHelper::ImageHelper(ImageHelper &&other) ...@@ -2577,7 +2578,8 @@ ImageHelper::ImageHelper(ImageHelper &&other)
mLayerCount(other.mLayerCount), mLayerCount(other.mLayerCount),
mLevelCount(other.mLevelCount), mLevelCount(other.mLevelCount),
mStagingBuffer(std::move(other.mStagingBuffer)), mStagingBuffer(std::move(other.mStagingBuffer)),
mSubresourceUpdates(std::move(other.mSubresourceUpdates)) mSubresourceUpdates(std::move(other.mSubresourceUpdates)),
mCurrentSingleClearValue(std::move(other.mCurrentSingleClearValue))
{ {
ASSERT(this != &other); ASSERT(this != &other);
other.resetCachedProperties(); other.resetCachedProperties();
......
...@@ -486,8 +486,7 @@ template <typename T> ...@@ -486,8 +486,7 @@ template <typename T>
class BindingPointer final : angle::NonCopyable class BindingPointer final : angle::NonCopyable
{ {
public: public:
BindingPointer() : mRefCounted(nullptr) {} BindingPointer() = default;
~BindingPointer() { reset(); } ~BindingPointer() { reset(); }
BindingPointer(BindingPointer &&other) BindingPointer(BindingPointer &&other)
...@@ -519,7 +518,7 @@ class BindingPointer final : angle::NonCopyable ...@@ -519,7 +518,7 @@ class BindingPointer final : angle::NonCopyable
bool valid() const { return mRefCounted != nullptr; } bool valid() const { return mRefCounted != nullptr; }
private: private:
RefCounted<T> *mRefCounted; RefCounted<T> *mRefCounted = nullptr;
}; };
// Helper class to share ref-counted Vulkan objects. Requires that T have a destroy method // 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