Add ability to disable all ANGLE features

Chrome has a --disable-gpu-driver-bug-workarounds flag that needs to be
able to be forwarded to ANGLE

Bug: 1016377
Change-Id: Ied6c8656742e25c32d508b8bfe76a902d82bcf93
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1925249
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Jonah Ryan-Davis 2019-11-19 15:19:04 -05:00 коммит произвёл Commit Bot
Родитель 8392b11814
Коммит f9c3eaf457
9 изменённых файлов: 37 добавлений и 7 удалений

Просмотреть файл

@ -85,15 +85,22 @@ New Tokens
EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
EGL_FEATURE_ALL_DISABLED_ANGLE 0x3469
New Behavior
EGLDisplay eglGetPlatformDisplay(EGLenum platform, void
*native_display, const EGLAttrib *attrib_list);
The attribute following EGL_FEATURE_OVERRIDES_ENABLED_ANGLE or
EGL_FEATURE_OVERRIDES_DISABLED_ANGLE should be of type char**,
which should contain a null-terminated array of C strings naming
the features to be enabled or disabled upon display creation.
Any features unspecified in one of these arrays will be
initialized with an internal heuristic.
The attribute following EGL_FEATURE_ALL_DISABLED_ANGLE should be
either EGL_TRUE to disable all features that are not overridden,
or EGL_FALSE to let ANGLE determine which features to enable.
Add the following to the end of section 3.3 "EGL Queries":

Просмотреть файл

@ -235,6 +235,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
#define EGL_FEATURE_CONDITION_ANGLE 0x3468
#define EGL_FEATURE_ALL_DISABLED_ANGLE 0x3469
typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
#ifdef EGL_EGLEXT_PROTOTYPES

Просмотреть файл

@ -365,7 +365,7 @@ void ANGLESetDefaultDisplayPlatform(angle::EGLDisplayType display)
} // anonymous namespace
DisplayState::DisplayState() : label(nullptr) {}
DisplayState::DisplayState() : label(nullptr), featuresAllDisabled(false) {}
DisplayState::~DisplayState() {}
@ -565,6 +565,8 @@ void Display::setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap
reinterpret_cast<const char **>(mAttributeMap.get(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE, 0));
mState.featureOverridesEnabled = EGLStringArrayToStringVector(featuresForceEnabled);
mState.featureOverridesDisabled = EGLStringArrayToStringVector(featuresForceDisabled);
mState.featuresAllDisabled =
static_cast<bool>(mAttributeMap.get(EGL_FEATURE_ALL_DISABLED_ANGLE, 0));
}
Error Display::initialize()
@ -610,7 +612,10 @@ Error Display::initialize()
config.second.renderableType |= EGL_OPENGL_ES_BIT;
}
initializeFrontendFeatures();
if (!mState.featuresAllDisabled)
{
initializeFrontendFeatures();
}
mFeatures.clear();
mFrontendFeatures.populateFeatureList(&mFeatures);

Просмотреть файл

@ -57,6 +57,7 @@ struct DisplayState final : private angle::NonCopyable
SurfaceSet surfaceSet;
std::vector<std::string> featureOverridesEnabled;
std::vector<std::string> featureOverridesDisabled;
bool featuresAllDisabled;
};
// Constant coded here as a sanity limit.

Просмотреть файл

@ -3840,7 +3840,10 @@ void Renderer11::generateCaps(gl::Caps *outCaps,
void Renderer11::initializeFeatures(angle::FeaturesD3D *features) const
{
d3d11::InitializeFeatures(mRenderer11DeviceCaps, mAdapterDescription, features);
if (!mDisplay->getState().featuresAllDisabled)
{
d3d11::InitializeFeatures(mRenderer11DeviceCaps, mAdapterDescription, features);
}
OverrideFeaturesWithDisplayState(features, mDisplay->getState());
}

Просмотреть файл

@ -3009,7 +3009,10 @@ void Renderer9::generateCaps(gl::Caps *outCaps,
void Renderer9::initializeFeatures(angle::FeaturesD3D *features) const
{
d3d9::InitializeFeatures(features);
if (!mDisplay->getState().featuresAllDisabled)
{
d3d9::InitializeFeatures(features);
}
OverrideFeaturesWithDisplayState(features, mDisplay->getState());
}

Просмотреть файл

@ -219,7 +219,10 @@ RendererGL::RendererGL(std::unique_ptr<FunctionsGL> functions,
mNativeParallelCompileEnabled(false)
{
ASSERT(mFunctions);
nativegl_gl::InitializeFeatures(mFunctions.get(), &mFeatures);
if (!display->getState().featuresAllDisabled)
{
nativegl_gl::InitializeFeatures(mFunctions.get(), &mFeatures);
}
OverrideFeaturesWithDisplayState(&mFeatures, display->getState());
mStateManager =
new StateManagerGL(mFunctions.get(), getNativeCaps(), getNativeExtensions(), mFeatures);

Просмотреть файл

@ -68,7 +68,11 @@ angle::Result DisplayMtl::initializeImpl(egl::Display *display)
mCapsInitialized = false;
GlslangInitialize();
initializeFeatures();
if (!mState.featuresAllDisabled)
{
initializeFeatures();
}
ANGLE_TRY(mFormatTable.initialize(this));

Просмотреть файл

@ -1006,7 +1006,10 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
&mProvokingVertexFeatures);
}
initFeatures(deviceExtensionNames);
if (!displayVk->getState().featuresAllDisabled)
{
initFeatures(deviceExtensionNames);
}
OverrideFeaturesWithDisplayState(&mFeatures, displayVk->getState());
mFeaturesInitialized = true;