Fix : Added prerequisite checks for using VK_Layer_Validation #105922
|
@ -82,6 +82,9 @@ static const char *vulkan_error_as_string(VkResult result)
|
|||
static bool is_vklayer_exist(const char* vk_extension_config)
|
||||
vnapdv marked this conversation as resolved
Outdated
|
||||
{
|
||||
const char *ev_val = getenv("VK_LAYER_PATH");
|
||||
if (ev_val == nullptr) {
|
||||
return false;
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
Best to change this to an early exit. Best to change this to an early exit.
Kazashi Yoshioka
commented
If you return when ev_val is nullptr, you can't print the warnings. It will check if there is no VK_LAYER_PATH and if there is no json file, so it will not return early. If you return when ev_val is nullptr, you can't print the warnings. It will check if there is no VK_LAYER_PATH and if there is no json file, so it will not return early.
|
||||
}
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
The filename should be a parameter. In the future we might want to enable other layers as well. This way it is clear to the developer where to change it. Not sure concatinating strings is the best solution. would rather use a pathseq Variables should not start with an The filename should be a parameter. In the future we might want to enable other layers as well. This way it is clear to the developer where to change it.
Not sure concatinating strings is the best solution. would rather use a pathseq
Variables should not start with an `_`.
|
||||
bool exists = false;
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
Not sure we need to open the file. can we use file stats? Not sure we need to open the file. can we use file stats?
Jeroen Bakker
commented
This section is too C. I would use This section is too C. I would use `std::stringstream`.
|
||||
if (ev_val != nullptr) {
|
||||
const size_t size_max = strlen(ev_val) + strlen(vk_extension_config) + 2;
|
||||
|
@ -94,20 +97,8 @@ static bool is_vklayer_exist(const char* vk_extension_config)
|
|||
exists = (stat(filename, &buffer) == 0);
|
||||
free(filename);
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
Just use #else. Just use #else.
|
||||
}
|
||||
if (exists) {
|
||||
return exists;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
printf("Warning: VK_LAYER_KHRONOS_validation is deactivated.\nSet `..VulkanSDK/1.2.198.1/Bin` of VulkanSDK (version1.2.198.1) to "
|
||||
"VK_LAYER_PATH.");
|
||||
#else
|
||||
printf("Warning: VK_LAYER_KHRONOS_validation is deactivated.\nSet `..vulkan/explicit_layer.d` of VulkanSDK (version1.2.198.1) to "
|
||||
"VK_LAYER_PATH.");
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
||||
return exists;
|
||||
}
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
Seems to be an error. Seems to be an error.
|
||||
#define __STR(A) "" #A
|
||||
#define VK_CHECK(__expression) \
|
||||
|
|
Loading…
Reference in New Issue
vklayer_config_exists
might be a better name.