diff options
| author | Mike Stroyan <stroyan@google.com> | 2016-02-05 09:11:32 -0700 |
|---|---|---|
| committer | Mike Stroyan <stroyan@google.com> | 2016-02-05 11:05:27 -0700 |
| commit | 7cd6b280269ba815edd743b44feece5205fbe13d (patch) | |
| tree | 18f45f8b892e0aef2651444fa65c35cfd68c1c15 | |
| parent | d8381303679454ffe52bcc6096baafd60bcf118a (diff) | |
| download | usermoji-7cd6b280269ba815edd743b44feece5205fbe13d.tar.xz | |
layers: allow one thread multiple uses of object
A single call in a thread may use an object more than once.
This first appeared with vkCmdExecuteCommands and buffer pools.
That is not distinguishable from recursive vulkan calls.
The error that this was looking for only happens if calling vulkan
while within another vulkan call. Such calls from signal handlers
or callbacks should be very rare errors. So just allow one thread
to have multiple uses of an object and keep accurate counters.
| -rw-r--r-- | layers/threading.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/layers/threading.h b/layers/threading.h index a45069fa..23d44c2d 100644 --- a/layers/threading.h +++ b/layers/threading.h @@ -98,13 +98,11 @@ template <typename T> class counter { use_data->writer_count = 1; } else { // Continue with an unsafe use of the object. + use_data->thread = tid ; use_data->writer_count += 1; } } else { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, objectType, reinterpret_cast<uint64_t>(object), - /*location*/ 0, THREADING_CHECKER_MULTIPLE_THREADS, "THREADING", - "THREADING ERROR : object of type %s is recursively used in thread %ld", - typeName, tid); + // This is either safe multiple use in one call, or recursive use. // There is no way to make recursion safe. Just forge ahead. use_data->writer_count += 1; } @@ -127,13 +125,11 @@ template <typename T> class counter { use_data->writer_count = 1; } else { // Continue with an unsafe use of the object. + use_data->thread = tid ; use_data->writer_count += 1; } } else { - skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, objectType, reinterpret_cast<uint64_t>(object), - /*location*/ 0, THREADING_CHECKER_MULTIPLE_THREADS, "THREADING", - "THREADING ERROR : object of type %s is recursively used in thread %ld", - typeName, tid); + // This is either safe multiple use in one call, or recursive use. // There is no way to make recursion safe. Just forge ahead. use_data->writer_count += 1; } @@ -165,7 +161,7 @@ template <typename T> class counter { use_data->reader_count = 1; use_data->writer_count = 0; use_data->thread = tid; - } else if (uses[object].writer_count > 0) { + } else if (uses[object].writer_count > 0 && uses[object].thread != tid) { // There is a writer of the object. skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, objectType, reinterpret_cast<uint64_t>(object), /*location*/ 0, THREADING_CHECKER_MULTIPLE_THREADS, "THREADING", |
