-
Couldn't load subscription status.
- Fork 25
[VK] Surface validation errors as errors #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This will force tests to fail when validation errors occur so that they fail everywhere instead of just on some devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few nitpicks and take-it-or-leave-it comments inline.
| Message = Data->pMessage; | ||
| for (uint32_t I = 0; I < Data->objectCount; I++) | ||
| if (Data->pObjects[I].pObjectName) | ||
| Objects.emplace_back(std::string(Data->pObjects[I].pObjectName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling emplace_back with a temporary is silly - this should just be push_back
| Objects.emplace_back(std::string(Data->pObjects[I].pObjectName)); | |
| Objects.push_back(std::string(Data->pObjects[I].pObjectName)); |
| OS << ": [ " << MessageID << " ]\n"; | ||
| OS << Message; | ||
|
|
||
| for (const auto &S : Objects) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think auto helps here.
| for (const auto &S : Objects) | |
| for (const std::string &S : Objects) |
| VkDebugUtilsMessageSeverityFlagBitsEXT MessageSeverity; | ||
| std::string Message; | ||
| std::string MessageID; | ||
| std::vector<std::string> Objects; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SmallVector would be slightly more efficient here (it doesn't really matter though)
| llvm::Error Err = llvm::make_error<VKValidationError>(MessageSeverity, Data); | ||
|
|
||
| // Return true to turn the validation error or warning into an error in the | ||
| // vulkan API. This should causes tests to fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // vulkan API. This should causes tests to fail. | |
| // vulkan API. This should cause tests to fail. |
| // Log verbose an info messages and continue. | ||
| llvm::logAllUnhandledErrors(std::move(Err), llvm::dbgs()); | ||
|
|
||
| // Continue to run even with VERBOSE and INFO messages. | ||
| return VK_FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second comment here seems a bit redundant, and there's a typo in the first.
| // Log verbose an info messages and continue. | |
| llvm::logAllUnhandledErrors(std::move(Err), llvm::dbgs()); | |
| // Continue to run even with VERBOSE and INFO messages. | |
| return VK_FALSE; | |
| // Log verbose and info messages and continue. | |
| llvm::logAllUnhandledErrors(std::move(Err), llvm::dbgs()); | |
| return VK_FALSE; |
| VkInstance Instance = VK_NULL_HANDLE; | ||
| VkDebugUtilsMessengerEXT DebugMessenger = VK_NULL_HANDLE; | ||
| llvm::SmallVector<std::shared_ptr<VKDevice>> Devices; | ||
| std::optional<llvm::Error> Err = std::nullopt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably just be an llvm::Error that's initialized to Error::success(). If that's more awkward to work with or less clear though this way is totally fine.
This will force tests to fail when validation errors occur so that they fail everywhere instead of just on some devices.