Commit fc4e3cf2 by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: fix ASSERT issue in ResourceSerialFactory

Refactor ResourceSerialFactory::issueSerial so that the ASSERT is valid in a threaded environment. Otherwise it's possible for another thread to increment mCurrentUniqueSerial in the middle of the ASSERT. Bug: b/168744561 Change-Id: I7208e8be91b21c50ad4a260d02d69f5b7dab2efe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2426685Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
parent 7bed2a5b
...@@ -764,8 +764,10 @@ ResourceSerialFactory::~ResourceSerialFactory() {} ...@@ -764,8 +764,10 @@ ResourceSerialFactory::~ResourceSerialFactory() {}
uint32_t ResourceSerialFactory::issueSerial() uint32_t ResourceSerialFactory::issueSerial()
{ {
ASSERT(mCurrentUniqueSerial + 1 > mCurrentUniqueSerial); uint32_t newSerial = ++mCurrentUniqueSerial;
return mCurrentUniqueSerial++; // make sure serial does not wrap
ASSERT(newSerial > 0);
return newSerial;
} }
#define ANGLE_DEFINE_GEN_VK_SERIAL(Type) \ #define ANGLE_DEFINE_GEN_VK_SERIAL(Type) \
......
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