Detect the terribleness of PowerVR precision issues depending on GPU revision

This commit is contained in:
Henrik Rydgard 2014-12-15 01:12:28 +01:00
parent 7d86cb2c04
commit 277788500e
3 changed files with 25 additions and 2 deletions

View File

@ -127,7 +127,12 @@ void CheckGLExtensions() {
gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN;
}
ILOG("GPU Vendor : %s ; GL version str: %s ; GLSL version str: %s", cvendor, versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");
ILOG("GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor, renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");
if (renderer) {
strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model));
gl_extensions.model[sizeof(gl_extensions.model) - 1] = 0;
}
#ifndef USING_GLES2
char buffer[64] = { 0 };

View File

@ -1,3 +1,4 @@
#include "base/logging.h"
#include "gfx_es2/gpu_features.h"
bool GLExtensions::VersionGEThan(int major, int minor, int sub) {
@ -14,8 +15,22 @@ bool GLExtensions::VersionGEThan(int major, int minor, int sub) {
void ProcessGPUFeatures() {
gl_extensions.bugs = 0;
ILOG("Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model);
// Should be table driven instead, this is a quick hack for Galaxy Y
if (System_GetProperty(SYSPROP_NAME) == "samsung:GT-S5360") {
gl_extensions.bugs |= BUG_FBO_UNUSABLE;
}
if (gl_extensions.gpuVendor == GPU_VENDOR_POWERVR) {
if (!strcmp(gl_extensions.model, "PowerVR SGX 540") ||
!strcmp(gl_extensions.model, "PowerVR SGX 530") ||
!strcmp(gl_extensions.model, "PowerVR SGX 520") ) {
WLOG("GL DRIVER BUG: PVR with bad and terrible precision");
gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_TERRIBLE | BUG_PVR_SHADER_PRECISION_BAD;
} else {
WLOG("GL DRIVER BUG: PVR with bad precision");
gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_BAD;
}
}
}

View File

@ -18,7 +18,9 @@ enum {
};
enum {
BUG_FBO_UNUSABLE=1
BUG_FBO_UNUSABLE = 1,
BUG_PVR_SHADER_PRECISION_BAD = 2,
BUG_PVR_SHADER_PRECISION_TERRIBLE = 4,
};
// Extensions to look at using:
@ -29,6 +31,7 @@ enum {
struct GLExtensions {
int ver[3];
int gpuVendor;
char model[128];
bool GLES3; // true if the full OpenGL ES 3.0 is supported