Use clear-as-draw workaround on Ivy Bridge/ANGLE D3D11.

Bug: chromium:755871
Change-Id: Id2538406c75d86de994ff88cc0bfc17d2cb45394
Reviewed-on: https://skia-review.googlesource.com/50040
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Salomon 2017-09-22 11:27:42 -04:00 committed by Skia Commit-Bot
parent c49d11e065
commit 266ef6d720
5 changed files with 69 additions and 3 deletions

View File

@ -530,6 +530,12 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
ctxInfo.driver() != kChromium_GrGLDriver)) {
fUseDrawInsteadOfClear = true;
}
// See crbug.com/755871. This could probably be narrowed to just partial clears as the driver
// bugs seems to involve clearing too much and not skipping the clear.
if (GrGLANGLEBackend::kD3D11 == ctxInfo.angleBackend() &&
GrGLANGLERenderer::kIvyBridge == ctxInfo.angleRenderer()) {
fUseDrawInsteadOfClear = true;
}
if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer()) {
// This is known to be fixed sometime between driver 145.0 and 219.0

View File

@ -44,6 +44,8 @@ GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext
args.fRenderer = GrGLGetRendererFromString(renderer);
GrGLGetANGLEInfoFromString(renderer, &args.fANGLEBackend, &args.fANGLEVendor,
&args.fANGLERenderer);
/*
* Qualcomm drivers for the 3xx series have a horrendous bug with some drivers. Though they
* claim to support GLES 3.00, some perfectly valid GLSL300 shaders will only compile with
@ -83,6 +85,9 @@ GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) {
fRenderer = args.fRenderer;
fDriver = args.fDriver;
fDriverVersion = args.fDriverVersion;
fANGLEBackend = args.fANGLEBackend;
fANGLEVendor = args.fANGLEVendor;
fANGLERenderer = args.fANGLERenderer;
fGLCaps = sk_make_sp<GrGLCaps>(*args.fContextOptions, *this, fInterface.get());
}

View File

@ -30,6 +30,9 @@ public:
GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; }
GrGLVendor vendor() const { return fVendor; }
GrGLRenderer renderer() const { return fRenderer; }
GrGLANGLEBackend angleBackend() const { return fANGLEBackend; }
GrGLANGLEVendor angleVendor() const { return fANGLEVendor; }
GrGLANGLERenderer angleRenderer() const { return fANGLERenderer; }
/** What driver is running our GL implementation? This is not necessarily related to the vendor.
(e.g. Intel GPU being driven by Mesa) */
GrGLDriver driver() const { return fDriver; }
@ -53,6 +56,9 @@ protected:
GrGLRenderer fRenderer;
GrGLDriver fDriver;
GrGLDriverVersion fDriverVersion;
GrGLANGLEBackend fANGLEBackend;
GrGLANGLEVendor fANGLEVendor;
GrGLANGLERenderer fANGLERenderer;
const GrContextOptions* fContextOptions;
};
@ -65,6 +71,9 @@ protected:
GrGLRenderer fRenderer;
GrGLDriver fDriver;
GrGLDriverVersion fDriverVersion;
GrGLANGLEBackend fANGLEBackend;
GrGLANGLEVendor fANGLEVendor;
GrGLANGLERenderer fANGLERenderer;
sk_sp<GrGLCaps> fGLCaps;
};

View File

@ -273,6 +273,12 @@ GrGLVendor GrGLGetVendorFromString(const char* vendorString) {
return kOther_GrGLVendor;
}
static bool is_renderer_angle(const char* rendererString) {
static constexpr char kHeader[] = "ANGLE ";
static constexpr size_t kHeaderLength = SK_ARRAY_COUNT(kHeader) - 1;
return 0 == strncmp(rendererString, kHeader, kHeaderLength);
}
GrGLRenderer GrGLGetRendererFromString(const char* rendererString) {
if (rendererString) {
if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) {
@ -340,14 +346,36 @@ GrGLRenderer GrGLGetRendererFromString(const char* rendererString) {
if (0 == strncmp(rendererString, kMaliTStr, SK_ARRAY_COUNT(kMaliTStr) - 1)) {
return kMaliT_GrGLRenderer;
}
static const char kANGLEStr[] = "ANGLE";
if (0 == strncmp(rendererString, kANGLEStr, SK_ARRAY_COUNT(kANGLEStr) - 1)) {
if (is_renderer_angle(rendererString)) {
return kANGLE_GrGLRenderer;
}
}
return kOther_GrGLRenderer;
}
void GrGLGetANGLEInfoFromString(const char* rendererString, GrGLANGLEBackend* backend,
GrGLANGLEVendor* vendor, GrGLANGLERenderer* renderer) {
*backend = GrGLANGLEBackend::kUnknown;
*vendor = GrGLANGLEVendor::kUnknown;
*renderer = GrGLANGLERenderer::kUnknown;
if (!is_renderer_angle(rendererString)) {
return;
}
if (strstr(rendererString, "Intel")) {
*vendor = GrGLANGLEVendor::kIntel;
}
if (strstr(rendererString, "HD Graphics 4000") || strstr(rendererString, "HD Graphics 2500")) {
*renderer = GrGLANGLERenderer::kIvyBridge;
}
if (strstr(rendererString, "Direct3D11")) {
*backend = GrGLANGLEBackend::kD3D11;
} else if (strstr(rendererString, "Direct3D9")) {
*backend = GrGLANGLEBackend::kD3D9;
} else if (strstr(rendererString, "OpenGL")) {
*backend = GrGLANGLEBackend::kOpenGL;
}
}
GrGLVersion GrGLGetVersion(const GrGLInterface* gl) {
const GrGLubyte* v;
GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION));

View File

@ -72,6 +72,23 @@ enum GrGLDriver {
kUnknown_GrGLDriver
};
enum class GrGLANGLEBackend {
kUnknown,
kD3D9,
kD3D11,
kOpenGL
};
enum class GrGLANGLEVendor {
kUnknown,
kIntel
};
enum class GrGLANGLERenderer{
kUnknown,
kIvyBridge
};
////////////////////////////////////////////////////////////////////////////////
/**
@ -134,6 +151,8 @@ GrGLStandard GrGLGetStandardInUseFromString(const char* versionString);
GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString);
GrGLVendor GrGLGetVendorFromString(const char* vendorString);
GrGLRenderer GrGLGetRendererFromString(const char* rendererString);
void GrGLGetANGLEInfoFromString(const char* rendererString, GrGLANGLEBackend*,
GrGLANGLEVendor*, GrGLANGLERenderer*);
void GrGLGetDriverInfo(GrGLStandard standard,
GrGLVendor vendor,
@ -148,7 +167,6 @@ GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*);
GrGLVendor GrGLGetVendor(const GrGLInterface*);
GrGLRenderer GrGLGetRenderer(const GrGLInterface*);
/**
* Helpers for glGetError()
*/