Skip to content

Conversation

@llvm-beanz
Copy link
Collaborator

This will force tests to fail when validation errors occur so that they fail everywhere instead of just on some devices.

This will force tests to fail when validation errors occur so that they
fail everywhere instead of just on some devices.
Copy link
Collaborator

@bogner bogner left a 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));
Copy link
Collaborator

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

Suggested change
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)
Copy link
Collaborator

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.

Suggested change
for (const auto &S : Objects)
for (const std::string &S : Objects)

VkDebugUtilsMessageSeverityFlagBitsEXT MessageSeverity;
std::string Message;
std::string MessageID;
std::vector<std::string> Objects;
Copy link
Collaborator

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// vulkan API. This should causes tests to fail.
// vulkan API. This should cause tests to fail.

Comment on lines +1333 to +1337
// 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;
Copy link
Collaborator

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.

Suggested change
// 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;
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants