Slate.EnableGlobalInvalidation

Slate.EnableGlobalInvalidation

#Overview

name: Slate.EnableGlobalInvalidation

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Slate.EnableGlobalInvalidation is to control the global invalidation system in Unreal Engine’s Slate UI framework. This setting variable is primarily used for optimizing UI rendering and updates.

The Slate subsystem within Unreal Engine relies on this setting variable. It is part of the core Slate module and affects how UI elements are updated and redrawn.

The value of this variable is set through a console variable (CVar) system. It is initialized as a global boolean variable GSlateEnableGlobalInvalidation and linked to the console variable “Slate.EnableGlobalInvalidation” using FAutoConsoleVariableRef.

This variable interacts with other Slate-related variables such as GSlateIsOnFastUpdatePath and GSlateIsOnFastProcessInvalidation, which are likely part of the same optimization system.

Developers must be aware that changing this variable can have significant impacts on UI performance and behavior. It affects how and when UI elements are invalidated and redrawn, which can change the responsiveness and efficiency of the UI system.

Best practices when using this variable include:

  1. Only modifying it if you fully understand the implications on UI performance.
  2. Testing thoroughly after changing its value, as it can affect the entire UI system.
  3. Consider using it in conjunction with profiling tools to measure its impact on performance.
  4. Be cautious when changing it at runtime, as it can cause immediate changes in UI behavior.

It’s also worth noting that this variable has an associated event (OnGlobalInvalidationToggledEvent) that broadcasts when its value changes, allowing other parts of the engine to respond accordingly.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/SlateCoreClasses.cpp:45

Scope: file

Source code excerpt:

bool GSlateEnableGlobalInvalidation = false;
static FAutoConsoleVariableRef CVarSlateNewUpdateMethod(
	TEXT("Slate.EnableGlobalInvalidation"), 
	GSlateEnableGlobalInvalidation, 
	TEXT("")
);

bool GSlateIsOnFastUpdatePath = false;
bool GSlateIsOnFastProcessInvalidation = false;

#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SSlateOptions.cpp:60

Scope (from outer to inner):

file
function     void SSlateOptions::Construct
function     static TSharedRef<SWidget> FillToolbar

Source code excerpt:

			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("EnableFastWidgetPath", "Fast Widget Path"), TEXT("Slate.EnableFastWidgetPath"), false);
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("EnableToolTips", "Enable Tooltips"), TEXT("Slate.EnableTooltips"));
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("GlobalInvalidation", "Global Invalidation"), TEXT("Slate.EnableGlobalInvalidation"));
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("DisabledEffect", "Transparent Disabled Effect"), TEXT("Slate.ApplyDisabledEffectOnWidgets"));

			return MenuBuilder.MakeWidget();
		}
	};

#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:867

Scope (from outer to inner):

file
function     FSlateApplication::FSlateApplication

Source code excerpt:

#endif

	IConsoleVariable* CVarGlobalInvalidation = IConsoleManager::Get().FindConsoleVariable(TEXT("Slate.EnableGlobalInvalidation"));
	if (CVarGlobalInvalidation)
	{
		CVarGlobalInvalidation->SetOnChangedCallback(FConsoleVariableDelegate::CreateLambda([this](IConsoleVariable* Variable)
		{
			UE_TRACE_SLATE_BOOKMARK(TEXT("GlobalInvalidationChanged"));
			OnGlobalInvalidationToggledEvent.Broadcast(GSlateEnableGlobalInvalidation);

#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:887

Scope (from outer to inner):

file
function     FSlateApplication::~FSlateApplication

Source code excerpt:

#endif

	IConsoleVariable* CVarGlobalInvalidation = IConsoleManager::Get().FindConsoleVariable(TEXT("Slate.EnableGlobalInvalidation"));
	if (CVarGlobalInvalidation)
	{
		CVarGlobalInvalidation->SetOnChangedCallback(FConsoleVariableDelegate());
	}

}