Skip to content

Commit 90c6d55

Browse files
committed
gl2: disable tex-storage path on Android Adreno 8xx/X1
1 parent a5d1741 commit 90c6d55

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

gfx/drivers/gl2.c

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,48 @@ static void gl2_size_format(GLint* internalFormat)
11701170
#endif
11711171
}
11721172

1173+
static bool gl2_tex_storage_allowed(void)
1174+
{
1175+
#if defined(HAVE_OPENGLES) && defined(ANDROID)
1176+
static int allowed = -1;
1177+
1178+
if (allowed < 0)
1179+
{
1180+
const char *vendor = (const char*)glGetString(GL_VENDOR);
1181+
const char *renderer = (const char*)glGetString(GL_RENDERER);
1182+
const char *model = NULL;
1183+
unsigned long model_id = 0;
1184+
1185+
allowed = 1;
1186+
1187+
if (vendor && renderer
1188+
&& strstr(vendor, "Qualcomm")
1189+
&& strstr(renderer, "Adreno"))
1190+
{
1191+
/* Handle both "Adreno (TM) 830" and "Adreno X1-xx" styles. */
1192+
model = strstr(renderer, "Adreno");
1193+
1194+
while (model && *model && (*model < '0' || *model > '9'))
1195+
model++;
1196+
1197+
if (model && *model)
1198+
model_id = strtoul(model, NULL, 10);
1199+
1200+
if (model_id >= 800 || strstr(renderer, "X1"))
1201+
{
1202+
allowed = 0;
1203+
RARCH_WARN("[GL] Disabling glTexStorage on %s to avoid black-screen regressions on Qualcomm Adreno 8xx/X1 Android drivers.\n",
1204+
renderer);
1205+
}
1206+
}
1207+
}
1208+
1209+
return allowed == 1;
1210+
#else
1211+
return true;
1212+
#endif
1213+
}
1214+
11731215
/* This function should only be used without mipmaps
11741216
and when data == NULL */
11751217
static void gl2_load_texture_image(GLenum target,
@@ -1189,7 +1231,9 @@ static void gl2_load_texture_image(GLenum target,
11891231
enum gl_capability_enum cap = GL_CAPS_TEX_STORAGE;
11901232
#endif
11911233

1192-
if (gl_check_capability(cap) && internalFormat != GL_BGRA_EXT)
1234+
if (gl2_tex_storage_allowed()
1235+
&& gl_check_capability(cap)
1236+
&& internalFormat != GL_BGRA_EXT)
11931237
{
11941238
gl2_size_format(&internalFormat);
11951239
#ifdef HAVE_OPENGLES2

0 commit comments

Comments
 (0)