r.Vulkan.SubmitOcclusionBatchCmdBuffer

r.Vulkan.SubmitOcclusionBatchCmdBuffer

#Overview

name: r.Vulkan.SubmitOcclusionBatchCmdBuffer

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.SubmitOcclusionBatchCmdBuffer is to control whether the command buffer should be submitted after ending an occlusion query batch in the Vulkan rendering system.

This setting variable is primarily used by the Vulkan RHI (Runtime Hardware Interface) module of Unreal Engine 5. It specifically affects the rendering process when using Vulkan as the graphics API.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning it’s enabled by default.

The associated variable GSubmitOcclusionBatchCmdBufferCVar interacts directly with r.Vulkan.SubmitOcclusionBatchCmdBuffer. This is an instance of TAutoConsoleVariable that wraps the console variable and provides thread-safe access to its value.

Developers must be aware that this variable affects performance and rendering behavior in Vulkan-based applications. When enabled (set to 1), it causes the command buffer to be submitted after ending an occlusion query batch, which can impact rendering performance and synchronization.

Best practices when using this variable include:

  1. Leave it at the default value (1) unless specific performance issues are encountered.
  2. If disabling it, thoroughly test the application to ensure no rendering artifacts or synchronization issues occur.
  3. Consider the impact on different hardware configurations, as the optimal setting may vary.

Regarding the associated variable GSubmitOcclusionBatchCmdBufferCVar:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp:36

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> GSubmitOcclusionBatchCmdBufferCVar(
	TEXT("r.Vulkan.SubmitOcclusionBatchCmdBuffer"),
	1,
	TEXT("1 to submit the cmd buffer after end occlusion query batch (default)"),
	ECVF_RenderThreadSafe
);

static FCriticalSection GStagingMapLock;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp:35

Scope: file

Source code excerpt:

	);

TAutoConsoleVariable<int32> GSubmitOcclusionBatchCmdBufferCVar(
	TEXT("r.Vulkan.SubmitOcclusionBatchCmdBuffer"),
	1,
	TEXT("1 to submit the cmd buffer after end occlusion query batch (default)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp:711

Scope (from outer to inner):

file
function     void FVulkanCommandListContext::RHIEndRenderPass

Source code excerpt:


	// Sync point for passes with occlusion queries
	if (bHasOcclusionQueries && GSubmitOcclusionBatchCmdBufferCVar.GetValueOnAnyThread())
	{
		RequestSubmitCurrentCommands();
		SafePointSubmit();
	}
}