From 12f295c4a5cf6aa3667d87d2a637f4499cab41db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 3 Jan 2019 12:43:00 +0100 Subject: [PATCH] GLES: Detect Vivante GPU, disable vertex range culling Should work-around #11703 --- GPU/GLES/GPU_GLES.cpp | 5 ++++- ext/native/gfx_es2/gpu_features.cpp | 2 ++ ext/native/gfx_es2/gpu_features.h | 2 ++ ext/native/thin3d/thin3d.h | 2 ++ ext/native/thin3d/thin3d_gl.cpp | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 3a37ba24d8be..bb54322f7f7a 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -147,7 +147,10 @@ void GPU_GLES::CheckGPUFeatures() { u32 features = 0; features |= GPU_SUPPORTS_16BIT_FORMATS; - features |= GPU_SUPPORTS_VS_RANGE_CULLING; + + if (!draw_->GetBugs().Has(Draw::Bugs::BROKEN_NAN_IN_CONDITIONAL)) { + features |= GPU_SUPPORTS_VS_RANGE_CULLING; + } if (gl_extensions.ARB_blend_func_extended || gl_extensions.EXT_blend_func_extended) { if (!g_Config.bVendorBugChecksEnabled || !draw_->GetBugs().Has(Draw::Bugs::DUAL_SOURCE_BLENDING_BROKEN)) { diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index 3c8fb4666314..3d81f592870a 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -159,6 +159,8 @@ void CheckGLExtensions() { } else if (vendor == "Broadcom") { gl_extensions.gpuVendor = GPU_VENDOR_BROADCOM; // Just for reference: Galaxy Y has renderer == "VideoCore IV HW" + } else if (vendor == "Vivante Corporation") { + gl_extensions.gpuVendor = GPU_VENDOR_VIVANTE; } else { gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN; } diff --git a/ext/native/gfx_es2/gpu_features.h b/ext/native/gfx_es2/gpu_features.h index 80cbc906bd06..94ba18912ae8 100644 --- a/ext/native/gfx_es2/gpu_features.h +++ b/ext/native/gfx_es2/gpu_features.h @@ -15,9 +15,11 @@ enum { GPU_VENDOR_IMGTEC = 5, GPU_VENDOR_QUALCOMM = 6, GPU_VENDOR_BROADCOM = 7, + GPU_VENDOR_VIVANTE = 8, GPU_VENDOR_UNKNOWN = 0, }; +// TODO: Move to Draw::Bugs enum { BUG_FBO_UNUSABLE = 1, BUG_PVR_SHADER_PRECISION_BAD = 2, diff --git a/ext/native/thin3d/thin3d.h b/ext/native/thin3d/thin3d.h index 1d0e28a98389..20b96d5f0b7f 100644 --- a/ext/native/thin3d/thin3d.h +++ b/ext/native/thin3d/thin3d.h @@ -234,6 +234,7 @@ enum class GPUVendor { VENDOR_QUALCOMM, VENDOR_IMGTEC, // PowerVR VENDOR_BROADCOM, // Raspberry + VENDOR_VIVANTE, }; enum class NativeObject { @@ -329,6 +330,7 @@ class Bugs { DUAL_SOURCE_BLENDING_BROKEN = 1, ANY_MAP_BUFFER_RANGE_SLOW = 2, PVR_GENMIPMAP_HEIGHT_GREATER = 3, + BROKEN_NAN_IN_CONDITIONAL = 4, }; protected: diff --git a/ext/native/thin3d/thin3d_gl.cpp b/ext/native/thin3d/thin3d_gl.cpp index 1d812ce4966d..872c169aff78 100644 --- a/ext/native/thin3d/thin3d_gl.cpp +++ b/ext/native/thin3d/thin3d_gl.cpp @@ -453,6 +453,7 @@ class OpenGLContext : public DrawContext { case GPUVendor::VENDOR_QUALCOMM: return "VENDOR_ADRENO"; case GPUVendor::VENDOR_ARM: return "VENDOR_ARM"; case GPUVendor::VENDOR_BROADCOM: return "VENDOR_BROADCOM"; + case GPUVendor::VENDOR_VIVANTE: return "VENDOR_VIVANTE"; case GPUVendor::VENDOR_UNKNOWN: default: return "VENDOR_UNKNOWN"; @@ -545,6 +546,7 @@ OpenGLContext::OpenGLContext() { case GPU_VENDOR_BROADCOM: caps_.vendor = GPUVendor::VENDOR_BROADCOM; break; case GPU_VENDOR_INTEL: caps_.vendor = GPUVendor::VENDOR_INTEL; break; case GPU_VENDOR_IMGTEC: caps_.vendor = GPUVendor::VENDOR_IMGTEC; break; + case GPU_VENDOR_VIVANTE: caps_.vendor = GPUVendor::VENDOR_VIVANTE; break; case GPU_VENDOR_UNKNOWN: default: caps_.vendor = GPUVendor::VENDOR_UNKNOWN; @@ -567,6 +569,8 @@ OpenGLContext::OpenGLContext() { bugs_.Infest(Bugs::DUAL_SOURCE_BLENDING_BROKEN); } } + } else if (caps_.vendor == GPUVendor::VENDOR_VIVANTE) { + bugs_.Infest(Bugs::BROKEN_NAN_IN_CONDITIONAL); } // TODO: Make this check more lenient. Disabled for all right now