Skip to content

Commit

Permalink
Merge pull request #11712 from hrydgard/gles-detect-vivante-gpu
Browse files Browse the repository at this point in the history
GLES: Detect Vivante GPU, disable vertex range culling
  • Loading branch information
hrydgard authored Jan 3, 2019
2 parents 12e54ba + 12f295c commit 99c8423
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion GPU/GLES/GPU_GLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions ext/native/gfx_es2/gpu_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions ext/native/gfx_es2/gpu_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions ext/native/thin3d/thin3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ enum class GPUVendor {
VENDOR_QUALCOMM,
VENDOR_IMGTEC, // PowerVR
VENDOR_BROADCOM, // Raspberry
VENDOR_VIVANTE,
};

enum class NativeObject {
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions ext/native/thin3d/thin3d_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 99c8423

Please sign in to comment.