r.Vulkan.SubmitOcclusionBatchCmdBuffer
r.Vulkan.SubmitOcclusionBatchCmdBuffer
#Overview
name: r.Vulkan.SubmitOcclusionBatchCmdBuffer
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
1 to submit the cmd buffer after end occlusion query batch (default)
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
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:
- Leave it at the default value (1) unless specific performance issues are encountered.
- If disabling it, thoroughly test the application to ensure no rendering artifacts or synchronization issues occur.
- Consider the impact on different hardware configurations, as the optimal setting may vary.
Regarding the associated variable GSubmitOcclusionBatchCmdBufferCVar:
- Its purpose is to provide a programmatic interface to the r.Vulkan.SubmitOcclusionBatchCmdBuffer setting.
- It’s used within the Vulkan RHI module to check the current setting value.
- The value is accessed using the GetValueOnAnyThread() method, which suggests it’s designed for thread-safe access.
- Developers should use this variable when they need to programmatically check or respond to changes in the r.Vulkan.SubmitOcclusionBatchCmdBuffer setting within C++ code.
- Best practice is to use GSubmitOcclusionBatchCmdBufferCVar.GetValueOnAnyThread() for thread-safe access to the setting value, rather than trying to access the CVar directly.
#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();
}
}