r.Android.GLESFlipYMethod

r.Android.GLESFlipYMethod

#Overview

name: r.Android.GLESFlipYMethod

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Android.GLESFlipYMethod is to control the method used for flipping the Y-axis in OpenGL ES rendering on Android devices. This setting is specifically related to the rendering system for Android platforms using OpenGL ES.

This setting variable is primarily used in the OpenGL Driver (OpenGLDrv) module of Unreal Engine, specifically in the Android-specific implementation of the EGL (OpenGL ES Native Platform Graphics Interface) functionality.

The value of this variable is set through a console variable (CVarAndroidGLESFlipYMethod) with a default value of 2. It can be modified at runtime or set in configuration files.

The associated variable CVarAndroidGLESFlipYMethod directly interacts with r.Android.GLESFlipYMethod, as they share the same value and purpose.

Developers must be aware of the following when using this variable:

  1. It affects how the Y-axis flipping is performed in OpenGL ES rendering on Android.
  2. The setting has three possible values (0, 1, 2), each corresponding to a different method of Y-axis flipping.
  3. The choice of method can impact performance and compatibility across different Android devices and GPU vendors.

Best practices when using this variable include:

  1. Testing the different methods (0, 1, 2) on various target Android devices to determine the best option for your specific use case.
  2. Being aware that some methods may not work correctly on certain devices or Android versions.
  3. Consider leaving it at the default value (2) unless specific issues are encountered, as it uses BlitFrameBuffer which is generally more compatible across devices.

Regarding the associated variable CVarAndroidGLESFlipYMethod:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:936, section: [Android_Adreno4xx DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:950, section: [Android_Adreno6xx DeviceProfile]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/Android/AndroidEGL.cpp:33

Scope: file

Source code excerpt:

// Use blit by default as setBuffersTransform is broken on random devices
static TAutoConsoleVariable<int32> CVarAndroidGLESFlipYMethod(
	TEXT("r.Android.GLESFlipYMethod"),
	2,
	TEXT(" 0: Flip Y method detected automatically by GPU vendor.\n"
		 " 1: Force flip Y by native window setBuffersTransform.\n"
		 " 2: Force flip Y by BlitFrameBuffer."),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/Android/AndroidEGL.cpp:32

Scope: file

Source code excerpt:


// Use blit by default as setBuffersTransform is broken on random devices
static TAutoConsoleVariable<int32> CVarAndroidGLESFlipYMethod(
	TEXT("r.Android.GLESFlipYMethod"),
	2,
	TEXT(" 0: Flip Y method detected automatically by GPU vendor.\n"
		 " 1: Force flip Y by native window setBuffersTransform.\n"
		 " 2: Force flip Y by BlitFrameBuffer."),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/Android/AndroidEGL.cpp:1252

Scope (from outer to inner):

file
function     bool AndroidEGL::IsOfflineSurfaceRequired

Source code excerpt:

	return FAndroidMisc::SupportsBackbufferSampling()
		// force to use BlitFrameBuffer
		|| CVarAndroidGLESFlipYMethod.GetValueOnAnyThread() == 2
		// setBuffersTransform doesn't work on android 9 and below devices
		|| !(CVarAndroidGLESFlipYMethod.GetValueOnAnyThread() == 1 || FAndroidMisc::GetAndroidMajorVersion() >= 10)
		// setBuffersTransform doesn't work on arm and powerVR GPU devices
		|| (CVarAndroidGLESFlipYMethod.GetValueOnAnyThread() == 0 && (GRHIVendorId == 0x13B5 || GRHIVendorId == 0x1010));
}

///
extern FCriticalSection GAndroidWindowLock;

void BlockOnLostWindowRenderCommand(TSharedPtr<FEvent, ESPMode::ThreadSafe> RTBlockedTrigger)