You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2868448 on 2016/02/16 by Mark.Satterthwaite
Bring MetalRHI & MetalShaderFormat mostly up to Dev-Platform CL #2867146 to address JIRA UE-26181 and as the first part of addressing JIRA UE-23208. Only CL #2854142 has been omitted for compatibility with the 4.11 branch.
#jira UE-26181
Change 2868454 on 2016/02/16 by Mark.Satterthwaite
Shader changes necessary to properly fix Mobile Preview under Mac Metal (JIRA UE-23208) - Mac ES 3.1 doesn't support framebuffer fetch & is in fact a Mobile Emulation shader platform.
#jira UE-23208
Change 2868650 on 2016/02/16 by Matthew.Griffin
Allow Developer modules to be pre-compiled when the target is editor.
#jira UE-26802
Change 2868859 on 2016/02/16 by Nick.Whiting
Merging StereoPanorama fixes from Main to Release-4.11 (CL 2811839)
#jira UE-25066
Change 2868927 on 2016/02/16 by Mieszko.Zielinski
Fixed some regular-use crashes in LogVisualizer #UE4
#rb Lukasz.Furman
#jira UE-27003
Change 2868994 on 2016/02/16 by Lina.Halper
Fix refresh UI issue with remove joint
#jira : UE-26529
#rb: Martin.Wilson
Change 2868996 on 2016/02/16 by Lina.Halper
Fix node stop working when negative value of LODThreshold
#jira: UE-26828
#rb:Martin.Wilson
Change 2868998 on 2016/02/16 by Lina.Halper
Fix with crash when invalid index has entered
#jira : UE-26715
#rb : Martin.Wilson
Change 2869003 on 2016/02/16 by Ori.Cohen
- Fix thread safety issue when cloth child collision or environment collision is used.
- Fix cloth bounds growing when stale transform data is used.
#JIRA OR-14990
#rb James.Golding
Change 2869109 on 2016/02/16 by mason.seay
Updated test assets for Restitution testing
#jira UE-24473
Change 2869223 on 2016/02/16 by Taizyd.Korambayil
#jira UE-19083 Disabled LOD on SkySphere BP
Change 2869558 on 2016/02/16 by Dan.Oconnor
Conservative fix for crash that occurs when adding a weak object ptr to an array of object ptrs in a blueprint
#jira UE-25893
Change 2869891 on 2016/02/17 by Thomas.Sarkanen
Fix crash when re-compiling anim BPs that are dependencies of 'parent' Blueprints
Force a re-initialzation of nodes when initializing the whole anim instance. The bInitialized flag was intended as a runtime optimization - we assume our function will not change for the lifetime of the UAnimInstance. While parts of the graph will be re-initialized we dont need to re-acquire our UFunction ptrs (etc.) unless the whole instance is getting re-initialized.
#rb Martin.Wilson
#jira UE-26642 - Switch Skeletal Mesh node crashes the editor if the blueprint is compiled.
Change 2869956 on 2016/02/17 by Tim.Hobson
#Jira UE-26550 - Added three new icons for Arrow, Locked, and Unlocked per request from IanS.
Change 2869965 on 2016/02/17 by Gareth.Martin
Fix check() being hit when loading KiteDemo x1_y1 (and other old foliage maps)
#jira UE-26930
Change 2870007 on 2016/02/17 by Richard.TalbotWatkin
Merging from //UE4/Dev-Editor CL 2867609
Fixed auto-generation of unique object/package names when duplicating, so they generate the same names if they the source object was named the same as its package.
#jira UE-25769 - Crash when Copy+Pasting numbered umaps in the content browser
#RB Bob.Tellez
Change 2870072 on 2016/02/17 by Michael.Schoell
Level Blueprints will no longer preload newly created Blueprints that they reference when they are reloaded.
#jira UE-23637 - Use of Blueprint delegate in sub-level script causes errors on startup
Change 2870087 on 2016/02/17 by Matthew.Griffin
Removed Android and IOS from list of platforms to build only for UnrealMatch3, so that they can be cooked and packaged correctly.
Change 2870141 on 2016/02/17 by mason.seay
Test content for Copy Pose From Mesh
#jira UE-24473
Change 2870195 on 2016/02/17 by Mieszko.Zielinski
PR #2052: Added missing Super::BeginPlay() (Contributed by Skylonxe)
#jira UE-26915
Change 2870325 on 2016/02/17 by Steve.Robb
[CL 2882948 by Matthew Griffin in Main branch]
478 lines
16 KiB
C++
478 lines
16 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#if !PLATFORM_ANDROIDGL4 && !PLATFORM_ANDROIDES31
|
|
|
|
#include "OpenGLDrvPrivate.h"
|
|
#include "OpenGLES2.h"
|
|
#include "AndroidWindow.h"
|
|
#include "AndroidOpenGLPrivate.h"
|
|
|
|
PFNEGLGETSYSTEMTIMENVPROC eglGetSystemTimeNV;
|
|
PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR = NULL;
|
|
PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = NULL;
|
|
PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR = NULL;
|
|
|
|
// Occlusion Queries
|
|
PFNGLGENQUERIESEXTPROC glGenQueriesEXT = NULL;
|
|
PFNGLDELETEQUERIESEXTPROC glDeleteQueriesEXT = NULL;
|
|
PFNGLISQUERYEXTPROC glIsQueryEXT = NULL;
|
|
PFNGLBEGINQUERYEXTPROC glBeginQueryEXT = NULL;
|
|
PFNGLENDQUERYEXTPROC glEndQueryEXT = NULL;
|
|
PFNGLGETQUERYIVEXTPROC glGetQueryivEXT = NULL;
|
|
PFNGLGETQUERYOBJECTIVEXTPROC glGetQueryObjectivEXT = NULL;
|
|
PFNGLGETQUERYOBJECTUIVEXTPROC glGetQueryObjectuivEXT = NULL;
|
|
|
|
PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT = NULL;
|
|
PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64vEXT = NULL;
|
|
|
|
// Offscreen MSAA rendering
|
|
PFNBLITFRAMEBUFFERNVPROC glBlitFramebufferNV = NULL;
|
|
PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT = NULL;
|
|
PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT = NULL;
|
|
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT = NULL;
|
|
|
|
PFNGLPUSHGROUPMARKEREXTPROC glPushGroupMarkerEXT = NULL;
|
|
PFNGLPOPGROUPMARKEREXTPROC glPopGroupMarkerEXT = NULL;
|
|
PFNGLLABELOBJECTEXTPROC glLabelObjectEXT = NULL;
|
|
PFNGLGETOBJECTLABELEXTPROC glGetObjectLabelEXT = NULL;
|
|
|
|
PFNGLMAPBUFFEROESPROC glMapBufferOES = NULL;
|
|
PFNGLUNMAPBUFFEROESPROC glUnmapBufferOES = NULL;
|
|
|
|
PFNGLTEXSTORAGE2DPROC glTexStorage2D = NULL;
|
|
|
|
// KHR_debug
|
|
PFNGLDEBUGMESSAGECONTROLKHRPROC glDebugMessageControlKHR = NULL;
|
|
PFNGLDEBUGMESSAGEINSERTKHRPROC glDebugMessageInsertKHR = NULL;
|
|
PFNGLDEBUGMESSAGECALLBACKKHRPROC glDebugMessageCallbackKHR = NULL;
|
|
PFNGLGETDEBUGMESSAGELOGKHRPROC glDebugMessageLogKHR = NULL;
|
|
PFNGLGETPOINTERVKHRPROC glGetPointervKHR = NULL;
|
|
PFNGLPUSHDEBUGGROUPKHRPROC glPushDebugGroupKHR = NULL;
|
|
PFNGLPOPDEBUGGROUPKHRPROC glPopDebugGroupKHR = NULL;
|
|
PFNGLOBJECTLABELKHRPROC glObjectLabelKHR = NULL;
|
|
PFNGLGETOBJECTLABELKHRPROC glGetObjectLabelKHR = NULL;
|
|
PFNGLOBJECTPTRLABELKHRPROC glObjectPtrLabelKHR = NULL;
|
|
PFNGLGETOBJECTPTRLABELKHRPROC glGetObjectPtrLabelKHR = NULL;
|
|
|
|
PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced = NULL;
|
|
PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced = NULL;
|
|
PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor = NULL;
|
|
|
|
struct FPlatformOpenGLDevice
|
|
{
|
|
|
|
void SetCurrentSharedContext();
|
|
void SetCurrentRenderingContext();
|
|
void SetCurrentNULLContext();
|
|
|
|
FPlatformOpenGLDevice();
|
|
~FPlatformOpenGLDevice();
|
|
void Init();
|
|
void LoadEXT();
|
|
void Terminate();
|
|
void ReInit();
|
|
};
|
|
|
|
|
|
FPlatformOpenGLDevice::~FPlatformOpenGLDevice()
|
|
{
|
|
AndroidEGL::GetInstance()->DestroyBackBuffer();
|
|
AndroidEGL::GetInstance()->Terminate();
|
|
}
|
|
|
|
FPlatformOpenGLDevice::FPlatformOpenGLDevice()
|
|
{
|
|
}
|
|
|
|
void FPlatformOpenGLDevice::Init()
|
|
{
|
|
extern void InitDebugContext();
|
|
|
|
AndroidEGL::GetInstance()->InitSurface(false);
|
|
PlatformRenderingContextSetup(this);
|
|
|
|
LoadEXT();
|
|
|
|
InitDefaultGLContextState();
|
|
InitDebugContext();
|
|
|
|
PlatformSharedContextSetup(this);
|
|
InitDefaultGLContextState();
|
|
InitDebugContext();
|
|
|
|
AndroidEGL::GetInstance()->InitBackBuffer(); //can be done only after context is made current.
|
|
}
|
|
|
|
FPlatformOpenGLDevice* PlatformCreateOpenGLDevice()
|
|
{
|
|
FPlatformOpenGLDevice* Device = new FPlatformOpenGLDevice();
|
|
Device->Init();
|
|
return Device;
|
|
}
|
|
|
|
void PlatformReleaseOpenGLContext(FPlatformOpenGLDevice* Device, FPlatformOpenGLContext* Context)
|
|
{
|
|
}
|
|
|
|
void* PlatformGetWindow(FPlatformOpenGLContext* Context, void** AddParam)
|
|
{
|
|
check(Context);
|
|
|
|
return (void*)&Context->eglContext;
|
|
}
|
|
|
|
bool PlatformBlitToViewport( FPlatformOpenGLDevice* Device, const FOpenGLViewport& Viewport, uint32 BackbufferSizeX, uint32 BackbufferSizeY, bool bPresent,bool bLockToVsync, int32 SyncInterval )
|
|
{
|
|
if (bPresent && Viewport.GetCustomPresent())
|
|
{
|
|
bPresent = Viewport.GetCustomPresent()->Present(SyncInterval);
|
|
}
|
|
if (bPresent)
|
|
{
|
|
AndroidEGL::GetInstance()->SwapBuffers();
|
|
}
|
|
return bPresent;
|
|
}
|
|
|
|
void PlatformRenderingContextSetup(FPlatformOpenGLDevice* Device)
|
|
{
|
|
Device->SetCurrentRenderingContext();
|
|
}
|
|
|
|
void PlatformFlushIfNeeded()
|
|
{
|
|
}
|
|
|
|
void PlatformRebindResources(FPlatformOpenGLDevice* Device)
|
|
{
|
|
}
|
|
|
|
void PlatformSharedContextSetup(FPlatformOpenGLDevice* Device)
|
|
{
|
|
Device->SetCurrentSharedContext();
|
|
}
|
|
|
|
void PlatformNULLContextSetup()
|
|
{
|
|
AndroidEGL::GetInstance()->SetCurrentContext(EGL_NO_CONTEXT, EGL_NO_SURFACE);
|
|
}
|
|
|
|
EOpenGLCurrentContext PlatformOpenGLCurrentContext(FPlatformOpenGLDevice* Device)
|
|
{
|
|
return (EOpenGLCurrentContext)AndroidEGL::GetInstance()->GetCurrentContextType();
|
|
}
|
|
|
|
void PlatformRestoreDesktopDisplayMode()
|
|
{
|
|
}
|
|
|
|
bool PlatformInitOpenGL()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool PlatformOpenGLContextValid()
|
|
{
|
|
return AndroidEGL::GetInstance()->IsCurrentContextValid();
|
|
}
|
|
|
|
void PlatformGetBackbufferDimensions( uint32& OutWidth, uint32& OutHeight )
|
|
{
|
|
AndroidEGL::GetInstance()->GetDimensions(OutWidth, OutHeight);
|
|
}
|
|
|
|
// =============================================================
|
|
|
|
void PlatformGetNewOcclusionQuery( GLuint* OutQuery, uint64* OutQueryContext )
|
|
{
|
|
}
|
|
|
|
bool PlatformContextIsCurrent( uint64 QueryContext )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void FPlatformOpenGLDevice::LoadEXT()
|
|
{
|
|
eglGetSystemTimeNV = (PFNEGLGETSYSTEMTIMENVPROC)((void*)eglGetProcAddress("eglGetSystemTimeNV"));
|
|
eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC)((void*)eglGetProcAddress("eglCreateSyncKHR"));
|
|
eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)((void*)eglGetProcAddress("eglDestroySyncKHR"));
|
|
eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)((void*)eglGetProcAddress("eglClientWaitSyncKHR"));
|
|
|
|
glDebugMessageControlKHR = (PFNGLDEBUGMESSAGECONTROLKHRPROC)((void*)eglGetProcAddress("glDebugMessageControlKHR"));
|
|
|
|
// Some PowerVR drivers (Rogue Han and Intel-based devices) are crashing using glDebugMessageControlKHR (causes signal 11 crash)
|
|
if (glDebugMessageControlKHR != NULL && FAndroidMisc::GetGPUFamily().Contains(TEXT("PowerVR")))
|
|
{
|
|
glDebugMessageControlKHR = NULL;
|
|
}
|
|
|
|
glDebugMessageInsertKHR = (PFNGLDEBUGMESSAGEINSERTKHRPROC)((void*)eglGetProcAddress("glDebugMessageInsertKHR"));
|
|
glDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)((void*)eglGetProcAddress("glDebugMessageCallbackKHR"));
|
|
glDebugMessageLogKHR = (PFNGLGETDEBUGMESSAGELOGKHRPROC)((void*)eglGetProcAddress("glDebugMessageLogKHR"));
|
|
glGetPointervKHR = (PFNGLGETPOINTERVKHRPROC)((void*)eglGetProcAddress("glGetPointervKHR"));
|
|
glPushDebugGroupKHR = (PFNGLPUSHDEBUGGROUPKHRPROC)((void*)eglGetProcAddress("glPushDebugGroupKHR"));
|
|
glPopDebugGroupKHR = (PFNGLPOPDEBUGGROUPKHRPROC)((void*)eglGetProcAddress("glPopDebugGroupKHR"));
|
|
glObjectLabelKHR = (PFNGLOBJECTLABELKHRPROC)((void*)eglGetProcAddress("glObjectLabelKHR"));
|
|
glGetObjectLabelKHR = (PFNGLGETOBJECTLABELKHRPROC)((void*)eglGetProcAddress("glGetObjectLabelKHR"));
|
|
glObjectPtrLabelKHR = (PFNGLOBJECTPTRLABELKHRPROC)((void*)eglGetProcAddress("glObjectPtrLabelKHR"));
|
|
glGetObjectPtrLabelKHR = (PFNGLGETOBJECTPTRLABELKHRPROC)((void*)eglGetProcAddress("glGetObjectPtrLabelKHR"));
|
|
}
|
|
|
|
FPlatformOpenGLContext* PlatformCreateOpenGLContext(FPlatformOpenGLDevice* Device, void* InWindowHandle)
|
|
{
|
|
//Assumes Device is already initialized and context already created.
|
|
return AndroidEGL::GetInstance()->GetRenderingContext();
|
|
}
|
|
|
|
void PlatformDestroyOpenGLContext(FPlatformOpenGLDevice* Device, FPlatformOpenGLContext* Context)
|
|
{
|
|
delete Device; //created here, destroyed here, but held by RHI.
|
|
}
|
|
|
|
FRHITexture* PlatformCreateBuiltinBackBuffer(FOpenGLDynamicRHI* OpenGLRHI, uint32 SizeX, uint32 SizeY)
|
|
{
|
|
uint32 Flags = TexCreate_RenderTargetable;
|
|
FOpenGLTexture2D* Texture2D = new FOpenGLTexture2D(OpenGLRHI, AndroidEGL::GetInstance()->GetOnScreenColorRenderBuffer(), GL_RENDERBUFFER, GL_COLOR_ATTACHMENT0, SizeX, SizeY, 0, 1, 1, 1, PF_B8G8R8A8, false, false, Flags, nullptr, FClearValueBinding::Transparent);
|
|
OpenGLTextureAllocated(Texture2D, Flags);
|
|
|
|
return Texture2D;
|
|
}
|
|
|
|
void PlatformResizeGLContext( FPlatformOpenGLDevice* Device, FPlatformOpenGLContext* Context, uint32 SizeX, uint32 SizeY, bool bFullscreen, bool bWasFullscreen, GLenum BackBufferTarget, GLuint BackBufferResource)
|
|
{
|
|
check(Context);
|
|
|
|
glViewport(0, 0, SizeX, SizeY);
|
|
VERIFY_GL(glViewport);
|
|
}
|
|
|
|
void PlatformGetSupportedResolution(uint32 &Width, uint32 &Height)
|
|
{
|
|
}
|
|
|
|
bool PlatformGetAvailableResolutions(FScreenResolutionArray& Resolutions, bool bIgnoreRefreshRate)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
int32 PlatformGlGetError()
|
|
{
|
|
return glGetError();
|
|
}
|
|
|
|
// =============================================================
|
|
|
|
void PlatformReleaseOcclusionQuery( GLuint Query, uint64 QueryContext )
|
|
{
|
|
}
|
|
|
|
void FPlatformOpenGLDevice::SetCurrentSharedContext()
|
|
{
|
|
AndroidEGL::GetInstance()->SetCurrentSharedContext();
|
|
}
|
|
|
|
void PlatformDestroyOpenGLDevice(FPlatformOpenGLDevice* Device)
|
|
{
|
|
delete Device;
|
|
}
|
|
|
|
void FPlatformOpenGLDevice::SetCurrentRenderingContext()
|
|
{
|
|
AndroidEGL::GetInstance()->SetCurrentRenderingContext();
|
|
}
|
|
|
|
void PlatformLabelObjects()
|
|
{
|
|
// @todo: Check that there is a valid id (non-zero) as LabelObject will fail otherwise
|
|
GLuint RenderBuffer = AndroidEGL::GetInstance()->GetOnScreenColorRenderBuffer();
|
|
if (RenderBuffer != 0)
|
|
{
|
|
FOpenGL::LabelObject(GL_RENDERBUFFER, RenderBuffer, "OnScreenColorRB");
|
|
}
|
|
|
|
GLuint FrameBuffer = AndroidEGL::GetInstance()->GetResolveFrameBuffer();
|
|
if (FrameBuffer != 0)
|
|
{
|
|
FOpenGL::LabelObject(GL_FRAMEBUFFER, FrameBuffer, "ResolveFB");
|
|
}
|
|
}
|
|
|
|
//--------------------------------
|
|
|
|
void PlatformGetNewRenderQuery( GLuint* OutQuery, uint64* OutQueryContext )
|
|
{
|
|
GLuint NewQuery = 0;
|
|
FOpenGL::GenQueries( 1, &NewQuery );
|
|
*OutQuery = NewQuery;
|
|
*OutQueryContext = 0;
|
|
}
|
|
|
|
void PlatformReleaseRenderQuery( GLuint Query, uint64 QueryContext )
|
|
{
|
|
FOpenGL::DeleteQueries(1, &Query );
|
|
}
|
|
|
|
|
|
bool FAndroidOpenGL::bUseHalfFloatTexStorage = false;
|
|
bool FAndroidOpenGL::bUseES30ShadingLanguage = false;
|
|
bool FAndroidOpenGL::bES30Support = false;
|
|
bool FAndroidOpenGL::bSupportsInstancing = false;
|
|
|
|
void FAndroidOpenGL::ProcessExtensions(const FString& ExtensionsString)
|
|
{
|
|
FOpenGLES2::ProcessExtensions(ExtensionsString);
|
|
|
|
FString VersionString = FString(ANSI_TO_TCHAR((const ANSICHAR*)glGetString(GL_VERSION)));
|
|
|
|
bES30Support = VersionString.Contains(TEXT("OpenGL ES 3."));
|
|
|
|
// Get procedures
|
|
if (bSupportsOcclusionQueries || bSupportsDisjointTimeQueries)
|
|
{
|
|
glGenQueriesEXT = (PFNGLGENQUERIESEXTPROC) ((void*)eglGetProcAddress("glGenQueriesEXT"));
|
|
glDeleteQueriesEXT = (PFNGLDELETEQUERIESEXTPROC) ((void*)eglGetProcAddress("glDeleteQueriesEXT"));
|
|
glIsQueryEXT = (PFNGLISQUERYEXTPROC) ((void*)eglGetProcAddress("glIsQueryEXT"));
|
|
glBeginQueryEXT = (PFNGLBEGINQUERYEXTPROC) ((void*)eglGetProcAddress("glBeginQueryEXT"));
|
|
glEndQueryEXT = (PFNGLENDQUERYEXTPROC) ((void*)eglGetProcAddress("glEndQueryEXT"));
|
|
glGetQueryivEXT = (PFNGLGETQUERYIVEXTPROC) ((void*)eglGetProcAddress("glGetQueryivEXT"));
|
|
glGetQueryObjectivEXT = (PFNGLGETQUERYOBJECTIVEXTPROC) ((void*)eglGetProcAddress("glGetQueryObjectivEXT"));
|
|
glGetQueryObjectuivEXT = (PFNGLGETQUERYOBJECTUIVEXTPROC)((void*)eglGetProcAddress("glGetQueryObjectuivEXT"));
|
|
}
|
|
|
|
if (bSupportsDisjointTimeQueries)
|
|
{
|
|
glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC) ((void*)eglGetProcAddress("glQueryCounterEXT"));
|
|
glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC) ((void*)eglGetProcAddress("glGetQueryObjectui64vEXT"));
|
|
|
|
// If EXT_disjoint_timer_query wasn't found, NV_timer_query might be available
|
|
if (glQueryCounterEXT == NULL)
|
|
{
|
|
glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC)eglGetProcAddress("glQueryCounterNV");
|
|
}
|
|
if (glGetQueryObjectui64vEXT == NULL)
|
|
{
|
|
glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)eglGetProcAddress("glGetQueryObjectui64vNV");
|
|
}
|
|
}
|
|
|
|
glDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)((void*)eglGetProcAddress("glDiscardFramebufferEXT"));
|
|
glFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)((void*)eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"));
|
|
glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)((void*)eglGetProcAddress("glRenderbufferStorageMultisampleEXT"));
|
|
glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)((void*)eglGetProcAddress("glPushGroupMarkerEXT"));
|
|
glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)((void*)eglGetProcAddress("glPopGroupMarkerEXT"));
|
|
glLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC)((void*)eglGetProcAddress("glLabelObjectEXT"));
|
|
glGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC)((void*)eglGetProcAddress("glGetObjectLabelEXT"));
|
|
|
|
bSupportsETC2 = bES30Support;
|
|
bUseES30ShadingLanguage = bES30Support;
|
|
|
|
FString RendererString = FString(ANSI_TO_TCHAR((const ANSICHAR*)glGetString(GL_RENDERER)));
|
|
|
|
if (RendererString.Contains(TEXT("SGX 540")))
|
|
{
|
|
UE_LOG(LogRHI, Warning, TEXT("Disabling support for GL_OES_packed_depth_stencil on SGX 540"));
|
|
bSupportsPackedDepthStencil = false;
|
|
bRequiresTexture2DPrecisionHack = true;
|
|
}
|
|
|
|
const bool bIsAdrenoBased = RendererString.Contains(TEXT("Adreno"));
|
|
if (bIsAdrenoBased)
|
|
{
|
|
// This is to avoid a bug in Adreno drivers that define GL_EXT_shader_framebuffer_fetch even when device does not support this extension
|
|
// OpenGL ES 3.1 V@127.0 (GIT@I1af360237c)
|
|
bRequiresShaderFramebufferFetchUndef = !bSupportsShaderFramebufferFetch;
|
|
|
|
// Adreno 2xx doesn't work with packed depth stencil enabled
|
|
if (RendererString.Contains(TEXT("Adreno (TM) 2")))
|
|
{
|
|
UE_LOG(LogRHI, Warning, TEXT("Disabling support for GL_OES_packed_depth_stencil on Adreno 2xx"));
|
|
bSupportsPackedDepthStencil = false;
|
|
}
|
|
}
|
|
|
|
if (bES30Support)
|
|
{
|
|
glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)((void*)eglGetProcAddress("glDrawElementsInstanced"));
|
|
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)((void*)eglGetProcAddress("glDrawArraysInstanced"));
|
|
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)((void*)eglGetProcAddress("glVertexAttribDivisor"));
|
|
|
|
bSupportsInstancing = true;
|
|
}
|
|
|
|
if (bES30Support || bIsAdrenoBased)
|
|
{
|
|
// Attempt to find ES 3.0 glTexStorage2D if we're on an ES 3.0 device
|
|
glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)((void*)eglGetProcAddress("glTexStorage2D"));
|
|
if( glTexStorage2D != NULL )
|
|
{
|
|
bUseHalfFloatTexStorage = true;
|
|
}
|
|
else
|
|
{
|
|
// need to disable GL_EXT_color_buffer_half_float support because we have no way to allocate the storage and the driver doesn't work without it.
|
|
UE_LOG(LogRHI,Warning,TEXT("Disabling support for GL_EXT_color_buffer_half_float as we cannot bind glTexStorage2D"));
|
|
bSupportsColorBufferHalfFloat = false;
|
|
}
|
|
}
|
|
|
|
//@todo android: need GMSAAAllowed ?
|
|
if (bSupportsNVFrameBufferBlit)
|
|
{
|
|
glBlitFramebufferNV = (PFNBLITFRAMEBUFFERNVPROC)((void*)eglGetProcAddress("glBlitFramebufferNV"));
|
|
}
|
|
|
|
glMapBufferOES = (PFNGLMAPBUFFEROESPROC)((void*)eglGetProcAddress("glMapBufferOES"));
|
|
glUnmapBufferOES = (PFNGLUNMAPBUFFEROESPROC)((void*)eglGetProcAddress("glUnmapBufferOES"));
|
|
|
|
//On Android, there are problems compiling shaders with textureCubeLodEXT calls in the glsl code,
|
|
// so we set this to false to modify the glsl manually at compile-time.
|
|
bSupportsTextureCubeLodEXT = false;
|
|
|
|
// On some Android devices with Mali GPUs textureCubeLod is not available.
|
|
if (RendererString.Contains(TEXT("Mali-400")))
|
|
{
|
|
bSupportsShaderTextureCubeLod = false;
|
|
}
|
|
|
|
// Nexus 5 (Android 4.4.2) doesn't like glVertexAttribDivisor(index, 0) called when not using a glDrawElementsInstanced
|
|
if (bIsAdrenoBased && VersionString.Contains(TEXT("OpenGL ES 3.0 V@66.0 AU@ (CL@)")))
|
|
{
|
|
UE_LOG(LogRHI, Warning, TEXT("Disabling support for hardware instancing on Adreno 330 OpenGL ES 3.0 V@66.0 AU@ (CL@)"));
|
|
bSupportsInstancing = false;
|
|
}
|
|
}
|
|
|
|
|
|
FString FAndroidMisc::GetGPUFamily()
|
|
{
|
|
return FAndroidGPUInfo::Get().GPUFamily;
|
|
}
|
|
|
|
FString FAndroidMisc::GetGLVersion()
|
|
{
|
|
return FAndroidGPUInfo::Get().GLVersion;
|
|
}
|
|
|
|
bool FAndroidMisc::SupportsFloatingPointRenderTargets()
|
|
{
|
|
return FAndroidGPUInfo::Get().bSupportsFloatingPointRenderTargets;
|
|
}
|
|
|
|
bool FAndroidMisc::SupportsShaderFramebufferFetch()
|
|
{
|
|
return FAndroidGPUInfo::Get().bSupportsFrameBufferFetch;
|
|
}
|
|
|
|
void FAndroidMisc::GetValidTargetPlatforms(TArray<FString>& TargetPlatformNames)
|
|
{
|
|
TargetPlatformNames = FAndroidGPUInfo::Get().TargetPlatformNames;
|
|
}
|
|
|
|
void FAndroidAppEntry::PlatformInit()
|
|
{
|
|
AndroidEGL::GetInstance()->Init(AndroidEGL::AV_OpenGLES, 2, 0, false);
|
|
}
|
|
|
|
#endif
|