Android: potentially work around a Qualcomm Adreno driver bug which prevented videos from being loaded into vram.

This commit is contained in:
Alex Szpakowski
2018-12-31 21:02:02 -04:00
parent 3af66da51e
commit 364718fa46
5 changed files with 29 additions and 1 deletions
+9
View File
@@ -590,6 +590,15 @@ bool Canvas::isFormatSupported(PixelFormat format, bool readable)
return supported;
}
void Canvas::resetFormatSupport()
{
for (int i = 0; i < (int)PIXELFORMAT_MAX_ENUM; i++)
{
checkedFormats[i].readable = false;
checkedFormats[i].nonreadable = false;
}
}
} // opengl
} // graphics
} // love
+1
View File
@@ -81,6 +81,7 @@ public:
static bool isMultiFormatMultiCanvasSupported();
static bool isFormatSupported(PixelFormat format, bool readable);
static bool isFormatSupported(PixelFormat format);
static void resetFormatSupport();
private:
+1
View File
@@ -59,6 +59,7 @@ Graphics::Graphics()
, mainVAO(0)
{
gl = OpenGL();
Canvas::resetFormatSupport();
auto window = getInstance<love::window::Window>(M_WINDOW);
+10 -1
View File
@@ -23,6 +23,7 @@
#include "OpenGL.h"
#include "Shader.h"
#include "Canvas.h"
#include "common/Exception.h"
#include "graphics/Graphics.h"
@@ -264,6 +265,13 @@ void OpenGL::setupContext()
createDefaultTexture();
contextInitialized = true;
#ifdef LOVE_ANDROID
// This can't be done in initContext with the rest of the bug checks because
// Canvas::isFormatSupported relies on state initialized here / after init.
if (GLAD_ES_VERSION_3_0 && !Canvas::isFormatSupported(PIXELFORMAT_R8))
bugs.brokenR8PixelFormat = true;
#endif
}
void OpenGL::deInitContext()
@@ -1315,7 +1323,8 @@ OpenGL::TextureFormat OpenGL::convertPixelFormat(PixelFormat pixelformat, bool r
switch (pixelformat)
{
case PIXELFORMAT_R8:
if (GLAD_VERSION_3_0 || GLAD_ES_VERSION_3_0 || GLAD_ARB_texture_rg || GLAD_EXT_texture_rg)
if ((GLAD_VERSION_3_0 || GLAD_ES_VERSION_3_0 || GLAD_ARB_texture_rg || GLAD_EXT_texture_rg)
&& !gl.bugs.brokenR8PixelFormat)
{
f.internalformat = GL_R8;
f.externalformat = GL_RED;
+8
View File
@@ -169,6 +169,14 @@ public:
**/
bool texStorageBreaksSubImage;
/**
* An Android device with an Adreno 630 (supposedly GLES3.2-capable)
* fails with GL_INVALID_OPERATION in glTexImage2D if the image is
* GL_R8, despite the GLES 3.0 spec mandating support for that format.
* It's possible more Adreno GPUs / drivers are affected as well.
**/
bool brokenR8PixelFormat;
/**
* Other bugs which have workarounds that don't use conditional code at
* the moment: