r.Mobile.MobileSupportBloomSetupRareCases

r.Mobile.MobileSupportBloomSetupRareCases

#Overview

name: r.Mobile.MobileSupportBloomSetupRareCases

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

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Mobile.MobileSupportBloomSetupRareCases is to control the generation of shader permutations for rare cases in the mobile bloom setup process for Unreal Engine’s rendering system.

This setting variable is primarily used in the Renderer module, specifically in the post-processing subsystem for mobile platforms. It’s referenced in the PostProcessMobile.cpp file, which handles various post-processing effects for mobile devices.

The value of this variable is set through a console variable (CVarMobileSupportBloomSetupRareCases) with a default value of 0. It can be changed at runtime, but it’s marked as read-only (ECVF_ReadOnly), suggesting that it’s intended to be set at engine startup or through configuration files rather than during gameplay.

The associated variable CVarMobileSupportBloomSetupRareCases directly interacts with r.Mobile.MobileSupportBloomSetupRareCases. They share the same value and purpose.

Developers must be aware that:

  1. When set to 0 (default), it excludes permutations for rare bloom setup cases like Sun+MetalMSAAHDRDecode, Dof+MetalMSAAHDRDecode, EyeAdaptation+MetalMSAAHDRDecode, and their combinations.
  2. When set to 1, it generates permutations for these rare cases.

Best practices when using this variable include:

  1. Keep it at the default value (0) unless you specifically need support for these rare cases, as generating additional permutations can increase shader compilation time and memory usage.
  2. If you’re developing for iOS or other metal-based mobile platforms and need support for these rare cases, consider setting it to 1.
  3. Be aware that changing this value may require recompilation of shaders.

Regarding the associated variable CVarMobileSupportBloomSetupRareCases:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:20

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarMobileSupportBloomSetupRareCases(
	TEXT("r.Mobile.MobileSupportBloomSetupRareCases"),
	0,
	TEXT("0: Don't generate permutations for BloomSetup rare cases. (default, like Sun+MetalMSAAHDRDecode, Dof+MetalMSAAHDRDecode, EyeAdaptaion+MetalMSAAHDRDecode, and any of their combinations)\n")
	TEXT("1: Generate permutations for BloomSetup rare cases. "),
	ECVF_ReadOnly);

static TAutoConsoleVariable<int32> CVarMobileEyeAdaptation(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:19

Scope: file

Source code excerpt:

#include "TextureResource.h"

static TAutoConsoleVariable<int32> CVarMobileSupportBloomSetupRareCases(
	TEXT("r.Mobile.MobileSupportBloomSetupRareCases"),
	0,
	TEXT("0: Don't generate permutations for BloomSetup rare cases. (default, like Sun+MetalMSAAHDRDecode, Dof+MetalMSAAHDRDecode, EyeAdaptaion+MetalMSAAHDRDecode, and any of their combinations)\n")
	TEXT("1: Generate permutations for BloomSetup rare cases. "),
	ECVF_ReadOnly);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:74

Scope: file

Source code excerpt:

// 29 = Bloom + Dof + EyeAdaptation + MetalMSAAHDRDecode

//Following variations are rare cases, depends on CVarMobileSupportBloomSetupRareCases
// 2 = SunShaft
// 4 = Dof
// 6 = SunShaft + Dof

// 10 = SunShaft + EyeAdaptation
// 12 = Dof + EyeAdaptation

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:99

Scope: file

Source code excerpt:



// Remove the variation from this list if it should not be a rare case or enable the CVarMobileSupportBloomSetupRareCases for full cases.
bool IsValidBloomSetupVariation(uint32 Variation)
{
	bool bIsRareCases =
		Variation == 2 ||
		Variation == 4 ||
		Variation == 6 ||

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:115

Scope (from outer to inner):

file
function     bool IsValidBloomSetupVariation

Source code excerpt:

		Variation == 28;

	return !bIsRareCases || CVarMobileSupportBloomSetupRareCases.GetValueOnAnyThread() != 0;
}

bool IsValidBloomSetupVariation(bool bUseBloom, bool bUseSun, bool bUseDof, bool bUseEyeAdaptation)
{
	uint32 Variation = bUseBloom	? 1 << 0 : 0;
	Variation |= bUseSun			? 1 << 1 : 0;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:243

Scope (from outer to inner):

file
class        class FMobileBloomSetupPS : public FGlobalShader
function     BEGIN_SHADER_PARAMETER_STRUCT

Source code excerpt:


		return IsMobilePlatform(Parameters.Platform) && 
			// Exclude rare cases if CVarMobileSupportBloomSetupRareCases is 0
			(bValidVariation) && 
			// IOS should generate all valid variations except SunShaft + MetalMSAAHDRDecode, other mobile platform should exclude MetalMSAAHDRDecode permutation
			(!bUseMetalMSAAHDRDecodeDim || (IsMetalMobilePlatform(Parameters.Platform) && !bUseSunDim));
	}

	static FPermutationDomain RemapPermutationVector(FPermutationDomain PermutationVector, bool bValidVariation)