Vulkan validation layer in UE4 is not enabled by default. We can see the codes in VulkanLayers.cpp around line 300:

1
2
3
4
5
const int32 VulkanValidationOption = GValidationCvar.GetValueOnAnyThread();
if (!bVkTrace && VulkanValidationOption > 0)
{
...
}

The validation layer will be enabled only if VulkanValidationOption has a proper non-zero value when creating VkInstance. The GValidationCvar is defined at the begining of the same file like this:

1
2
3
4
5
6
7
8
9
10
11
TAutoConsoleVariable<int32> GValidationCvar(
TEXT("r.Vulkan.EnableValidation"),
0,
TEXT("0 to disable validation layers (default)\n")
TEXT("1 to enable errors\n")
TEXT("2 to enable errors & warnings\n")
TEXT("3 to enable errors, warnings & performance warnings\n")
TEXT("4 to enable errors, warnings, performance & information messages\n")
TEXT("5 to enable all messages"),
ECVF_ReadOnly | ECVF_RenderThreadSafe
);

We have several options of validation level, and the default value is 0.

Of course we can assign a new value to GValidationCvar. But make sure it is setted before creating ‘VKInstance’.
Another safe way to do this is add startup argument ‘vulkanvalidation=(xxx)’ to your project or UE4 project property. You don’t even need to modify any codes by this way.


For any problems about this article, feel free to rise an issue to me. Issue
If this article is usful for you, welcome to follow my github. Follow @gcmiao

Go back Home