UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LinuxOpenGLPlatform.cpp File Reference

Classes

struct  FPlatformOpenGLContext
 
class  FScopeContext
 
struct  FPlatformOpenGLDevice
 

Macros

#define GET_GL_ENTRYPOINTS(Type, Func)   GLFuncPointers::Func = reinterpret_cast<Type>(SDL_GL_GetProcAddress(#Func));
 
#define CHECK_GL_ENTRYPOINTS(Type, Func)   if (Func == NULL) { bFoundAllEntryPoints = false; UE_LOG(LogRHI, Fatal, TEXT("Failed to find entry point for %s"), TEXT(#Func)); }
 

Typedefs

typedef SDL_WindowSDL_HWindow
 
typedef SDL_GLContext SDL_HGLContext
 

Functions

void Linux_ContextMakeCurrent (SDL_HWindow hWnd, SDL_HGLContext hGLDC)
 
SDL_HGLContext Linux_GetCurrentContext ()
 
void Linux_PlatformCreateDummyGLWindow (FPlatformOpenGLContext *OutContext)
 
bool Linux_PlatformOpenGLDebugCtx ()
 
void Linux_PlatformCreateOpenGLContextCore (FPlatformOpenGLContext *OutContext)
 
void PlatformReleaseOpenGLContext (FPlatformOpenGLDevice *Device, FPlatformOpenGLContext *Context)
 
FPlatformOpenGLDevicePlatformCreateOpenGLDevice ()
 
bool PlatformCanEnableGPUCapture ()
 
void PlatformDestroyOpenGLDevice (FPlatformOpenGLDevice *Device)
 
FPlatformOpenGLContextPlatformCreateOpenGLContext (FPlatformOpenGLDevice *Device, void *InWindowHandle)
 
void PlatformDestroyOpenGLContext (FPlatformOpenGLDevice *Device, FPlatformOpenGLContext *Context)
 
voidPlatformGetWindow (FPlatformOpenGLContext *Context, void **AddParam)
 
const TCHARPlatformDescribeSyncInterval (int32 SyncInterval)
 
bool PlatformBlitToViewport (IRHICommandContext &RHICmdContext, FPlatformOpenGLDevice *Device, const FOpenGLViewport &Viewport, uint32 BackbufferSizeX, uint32 BackbufferSizeY, bool bPresent, bool bLockToVsync)
 
void PlatformFlushIfNeeded ()
 
void PlatformRenderingContextSetup (FPlatformOpenGLDevice *Device)
 
void PlatformNULLContextSetup ()
 
void PlatformResizeGLContext (FPlatformOpenGLDevice *Device, FPlatformOpenGLContext *Context, uint32 SizeX, uint32 SizeY, bool bFullscreen, bool bWasFullscreen, GLenum BackBufferTarget, GLuint BackBufferResource)
 
void PlatformGetSupportedResolution (uint32 &Width, uint32 &Height)
 
bool PlatformGetAvailableResolutions (FScreenResolutionArray &Resolutions, bool bIgnoreRefreshRate)
 
void PlatformRestoreDesktopDisplayMode ()
 
bool PlatformInitOpenGL ()
 
int32 PlatformGlGetError ()
 
bool PlatformOpenGLThreadHasRenderingContext ()
 
FOpenGLTexturePlatformCreateBuiltinBackBuffer (FOpenGLDynamicRHI *OpenGLRHI, uint32 SizeX, uint32 SizeY)
 

Macro Definition Documentation

◆ CHECK_GL_ENTRYPOINTS

#define CHECK_GL_ENTRYPOINTS (   Type,
  Func 
)    if (Func == NULL) { bFoundAllEntryPoints = false; UE_LOG(LogRHI, Fatal, TEXT("Failed to find entry point for %s"), TEXT(#Func)); }

◆ GET_GL_ENTRYPOINTS

#define GET_GL_ENTRYPOINTS (   Type,
  Func 
)    GLFuncPointers::Func = reinterpret_cast<Type>(SDL_GL_GetProcAddress(#Func));

Typedef Documentation

◆ SDL_HGLContext

◆ SDL_HWindow

Function Documentation

◆ Linux_ContextMakeCurrent()

void Linux_ContextMakeCurrent ( SDL_HWindow  hWnd,
SDL_HGLContext  hGLDC 
)

◆ Linux_GetCurrentContext()

SDL_HGLContext Linux_GetCurrentContext ( )

◆ Linux_PlatformCreateDummyGLWindow()

void Linux_PlatformCreateDummyGLWindow ( FPlatformOpenGLContext OutContext)

Create a dummy window used to construct OpenGL contexts.

◆ Linux_PlatformCreateOpenGLContextCore()

void Linux_PlatformCreateOpenGLContextCore ( FPlatformOpenGLContext OutContext)

Create a core profile OpenGL context.

◆ Linux_PlatformOpenGLDebugCtx()

bool Linux_PlatformOpenGLDebugCtx ( )

Enable/Disable debug context from the commandline

◆ PlatformBlitToViewport()

bool PlatformBlitToViewport ( IRHICommandContext RHICmdContext,
FPlatformOpenGLDevice Device,
const FOpenGLViewport Viewport,
uint32  BackbufferSizeX,
uint32  BackbufferSizeY,
bool  bPresent,
bool  bLockToVsync 
)

Main function for transferring data to on-screen buffers. On Windows it temporarily switches OpenGL context, on Mac only context's output view.

◆ PlatformCanEnableGPUCapture()

bool PlatformCanEnableGPUCapture ( )

Returns true if the platform supports a GPU capture tool (eg RenderDoc)

◆ PlatformCreateBuiltinBackBuffer()

FOpenGLTexture * PlatformCreateBuiltinBackBuffer ( FOpenGLDynamicRHI OpenGLRHI,
uint32  SizeX,
uint32  SizeY 
)

◆ PlatformCreateOpenGLContext()

FPlatformOpenGLContext * PlatformCreateOpenGLContext ( FPlatformOpenGLDevice Device,
void InWindowHandle 
)

Create an OpenGL context.

◆ PlatformCreateOpenGLDevice()

FPlatformOpenGLDevice * PlatformCreateOpenGLDevice ( )

Create the OpenGL device, encompassing all data needed to handle set of OpenGL contexts for a single OpenGL RHI. This contains shared context (to be used for resource loading), rendering context (to be used for rendering), and viewport contexts (to be used for blitting for various platform-specific viewports). On different platforms implementation details differ, by a lot. This should be called when creating the OpenGL RHI.

◆ PlatformDescribeSyncInterval()

const TCHAR * PlatformDescribeSyncInterval ( int32  SyncInterval)

◆ PlatformDestroyOpenGLContext()

void PlatformDestroyOpenGLContext ( FPlatformOpenGLDevice Device,
FPlatformOpenGLContext Context 
)

Destroy an OpenGL context.

◆ PlatformDestroyOpenGLDevice()

void PlatformDestroyOpenGLDevice ( FPlatformOpenGLDevice Device)

Destroy the OpenGL device for single OpenGL RHI. This should happen when destroying the RHI.

◆ PlatformFlushIfNeeded()

void PlatformFlushIfNeeded ( )

◆ PlatformGetAvailableResolutions()

bool PlatformGetAvailableResolutions ( FScreenResolutionArray Resolutions,
bool  bIgnoreRefreshRate 
)

Retrieve available screen resolutions.

◆ PlatformGetSupportedResolution()

void PlatformGetSupportedResolution ( uint32 Width,
uint32 Height 
)

Returns a supported screen resolution that most closely matches input.

◆ PlatformGetWindow()

void * PlatformGetWindow ( FPlatformOpenGLContext Context,
void **  AddParam 
)

◆ PlatformGlGetError()

int32 PlatformGlGetError ( )

Just a glGetError() call. Added to make it possible to compile GL_VERIFY macros in other projects than OpenGLDrv.

◆ PlatformInitOpenGL()

bool PlatformInitOpenGL ( )

Initialize OpenGL on this platform. This must be called once before device contexts can be created.

Returns
true if initialization was successful.

◆ PlatformNULLContextSetup()

void PlatformNULLContextSetup ( )

This is used to detach an OpenGL context from current thread.

◆ PlatformOpenGLThreadHasRenderingContext()

bool PlatformOpenGLThreadHasRenderingContext ( )

Returns true when the calling thread owns the OpenGL rendering context.

◆ PlatformReleaseOpenGLContext()

void PlatformReleaseOpenGLContext ( FPlatformOpenGLDevice Device,
FPlatformOpenGLContext Context 
)

Release an OpenGL context.

◆ PlatformRenderingContextSetup()

void PlatformRenderingContextSetup ( FPlatformOpenGLDevice Device)

Set up rendering OpenGL context on current thread. This is the only context that can be used for rendering, and not only loading resources and framebuffer blitting (due to limitations of Windows OpenGL).

◆ PlatformResizeGLContext()

void PlatformResizeGLContext ( FPlatformOpenGLDevice Device,
FPlatformOpenGLContext Context,
uint32  SizeX,
uint32  SizeY,
bool  bFullscreen,
bool  bWasFullscreen,
GLenum  BackBufferTarget,
GLuint  BackBufferResource 
)

Resize the GL context.

◆ PlatformRestoreDesktopDisplayMode()

void PlatformRestoreDesktopDisplayMode ( )

Restore the original display mode