Skip to content
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

vulkaninfo: Call enumerate functions with scratch buffer #1050

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions vulkaninfo/vulkaninfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,14 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL DbgCallback(VkDebugReportFlagsEXT msgFlags
// Helper for robustly executing the two-call pattern
template <typename T, typename F, typename... Ts>
auto GetVectorInit(const char *func_name, F &&f, T init, Ts &&...ts) -> std::vector<T> {
uint32_t count = 0;
uint32_t count = 32; // Preallocate enough so that most calls only happen once
std::vector<T> results;
VkResult err;
uint32_t iteration_count = 0;
uint32_t max_iterations = 3;
uint32_t max_iterations = 5;
do {
err = f(ts..., &count, nullptr);
if (err) THROW_VK_ERR(func_name, err);
results.resize(count, init);
count *= 2;
results.resize(count);
err = f(ts..., &count, results.data());
results.resize(count);
iteration_count++;
Expand Down
Loading