r.HeterogeneousVolumes.Tessellation.TopLevelBitmask

r.HeterogeneousVolumes.Tessellation.TopLevelBitmask

#Overview

name: r.HeterogeneousVolumes.Tessellation.TopLevelBitmask

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.HeterogeneousVolumes.Tessellation.TopLevelBitmask is to enable a top-level bitmask for accelerating grid traversal in heterogeneous volume rendering. This setting is specifically related to the rendering system, particularly for optimizing the performance of heterogeneous volume rendering.

This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the HeterogeneousVolumes subsystem. It is directly referenced in the HeterogeneousVolumesVoxelGridPipeline.cpp file, which suggests it plays a role in the voxel grid pipeline for heterogeneous volumes.

The value of this variable is set through a console variable (CVarHeterogeneousVolumesEnableTopLevelBitmask) with a default value of 0, meaning it is disabled by default. It can be changed at runtime through console commands or programmatically.

The associated variable CVarHeterogeneousVolumesEnableTopLevelBitmask interacts directly with this setting. It is used to retrieve the current value of the setting on the render thread through the GetValueOnRenderThread() function.

Developers should be aware that this setting is render thread safe, as indicated by the ECVF_RenderThreadSafe flag. This means it can be safely modified from any thread, but the changes will only take effect on the render thread.

Best practices when using this variable include:

  1. Only enable it when performance improvements for heterogeneous volume rendering are needed.
  2. Test thoroughly to ensure it doesn’t introduce any visual artifacts or unexpected behavior.
  3. Consider the potential memory overhead of enabling the top-level bitmask.

Regarding the associated variable CVarHeterogeneousVolumesEnableTopLevelBitmask:

The purpose of this variable is to provide a programmatic way to access and modify the r.HeterogeneousVolumes.Tessellation.TopLevelBitmask setting.

It is used within the HeterogeneousVolumes namespace in the EnableTopLevelBitmask() function, which returns a boolean value indicating whether the top-level bitmask is enabled or not.

The value of this variable is set when the console variable is created and can be modified through console commands or programmatically.

Developers should be aware that this variable is accessed on the render thread, as evidenced by the use of GetValueOnRenderThread(). This means any changes to the variable will only take effect on the next frame render.

Best practices for using this variable include:

  1. Access it through the provided EnableTopLevelBitmask() function rather than directly.
  2. Be mindful of the performance implications when enabling or disabling this feature.
  3. Use it in conjunction with other heterogeneous volume rendering settings for optimal results.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:177

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableTopLevelBitmask(
	TEXT("r.HeterogeneousVolumes.Tessellation.TopLevelBitmask"),
	0,
	TEXT("Enables top-level bitmask to accelerate grid traversal (Default = 0)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableMajorantGrid(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:176

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableTopLevelBitmask(
	TEXT("r.HeterogeneousVolumes.Tessellation.TopLevelBitmask"),
	0,
	TEXT("Enables top-level bitmask to accelerate grid traversal (Default = 0)\n"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:398

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     bool EnableTopLevelBitmask

Source code excerpt:

	bool EnableTopLevelBitmask()
	{
		return CVarHeterogeneousVolumesEnableTopLevelBitmask.GetValueOnRenderThread() != 0;
	}

	bool EnableMajorantGrid()
	{
		return CVarHeterogeneousVolumesEnableMajorantGrid.GetValueOnRenderThread() != 0;
	}