r.Vulkan.AllowHostQueryReset

r.Vulkan.AllowHostQueryReset

#Overview

name: r.Vulkan.AllowHostQueryReset

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Vulkan.AllowHostQueryReset is to control the support for the Vulkan Host Query Reset extension in the Unreal Engine’s Vulkan RHI (Render Hardware Interface) implementation.

This setting variable is primarily used in the Vulkan RHI subsystem of Unreal Engine 5. It specifically relates to the Vulkan extension VK_EXT_HOST_QUERY_RESET, which allows resetting queries from the host (CPU) side without needing to submit commands to the GPU.

The value of this variable is set through a console variable (CVar) named GVulkanAllowHostQueryResetCVar. It’s defined with a default value of 1, meaning the Host Query Reset feature is enabled by default.

The associated variable GVulkanAllowHostQueryResetCVar interacts directly with r.Vulkan.AllowHostQueryReset. They share the same value and purpose.

Developers should be aware that:

  1. This is a read-only variable (ECVF_ReadOnly), meaning it can’t be changed at runtime.
  2. It’s a boolean-like integer where 0 disables the feature and any non-zero value enables it.
  3. Changing this value affects the Vulkan device extension initialization.

Best practices when using this variable include:

  1. Only disable it if you’re experiencing specific issues related to the Host Query Reset feature.
  2. Be aware that disabling this might impact performance in scenarios where host-side query resets are beneficial.
  3. If modifying, do so before engine initialization as it’s read-only at runtime.

Regarding the associated variable GVulkanAllowHostQueryResetCVar:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanExtensions.cpp:52

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> GVulkanAllowHostQueryResetCVar(
	TEXT("r.Vulkan.AllowHostQueryReset"),
	1,
	TEXT("0: Do not enable support for Host Query Reset extension\n")
	TEXT("1: Enable Host Query Reset (default)"),
	ECVF_ReadOnly
);

#Associated Variable and Callsites

This variable is associated with another variable named GVulkanAllowHostQueryResetCVar. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanExtensions.cpp:51

Scope: file

Source code excerpt:

);

TAutoConsoleVariable<int32> GVulkanAllowHostQueryResetCVar(
	TEXT("r.Vulkan.AllowHostQueryReset"),
	1,
	TEXT("0: Do not enable support for Host Query Reset extension\n")
	TEXT("1: Enable Host Query Reset (default)"),
	ECVF_ReadOnly
);

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanExtensions.cpp:993

Scope (from outer to inner):

file
class        class FVulkanEXTHostQueryResetExtension : public FVulkanDeviceExtension
function     FVulkanEXTHostQueryResetExtension

Source code excerpt:

		: FVulkanDeviceExtension(InDevice, VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME, VULKAN_EXTENSION_ENABLED, VK_API_VERSION_1_2)
	{
		bEnabledInCode = bEnabledInCode && (GVulkanAllowHostQueryResetCVar.GetValueOnAnyThread() != 0);
	}

	virtual void PrePhysicalDeviceFeatures(VkPhysicalDeviceFeatures2KHR& PhysicalDeviceFeatures2) override final
	{
		ZeroVulkanStruct(HostQueryResetFeatures, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES);
		AddToPNext(PhysicalDeviceFeatures2, HostQueryResetFeatures);