Commit f9c3eaf4 by Jonah Ryan-Davis Committed by Commit Bot

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: 's avatarGeoff Lang <geofflang@chromium.org>
parent 8392b118
...@@ -85,15 +85,22 @@ New Tokens ...@@ -85,15 +85,22 @@ New Tokens
EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466 EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467 EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
EGL_FEATURE_ALL_DISABLED_ANGLE 0x3469
New Behavior New Behavior
EGLDisplay eglGetPlatformDisplay(EGLenum platform, void
*native_display, const EGLAttrib *attrib_list);
The attribute following EGL_FEATURE_OVERRIDES_ENABLED_ANGLE or The attribute following EGL_FEATURE_OVERRIDES_ENABLED_ANGLE or
EGL_FEATURE_OVERRIDES_DISABLED_ANGLE should be of type char**, EGL_FEATURE_OVERRIDES_DISABLED_ANGLE should be of type char**,
which should contain a null-terminated array of C strings naming which should contain a null-terminated array of C strings naming
the features to be enabled or disabled upon display creation. the features to be enabled or disabled upon display creation.
Any features unspecified in one of these arrays will be Any features unspecified in one of these arrays will be
initialized with an internal heuristic. 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": Add the following to the end of section 3.3 "EGL Queries":
......
...@@ -235,6 +235,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy, ...@@ -235,6 +235,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466 #define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467 #define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
#define EGL_FEATURE_CONDITION_ANGLE 0x3468 #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 const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
#ifdef EGL_EGLEXT_PROTOTYPES #ifdef EGL_EGLEXT_PROTOTYPES
......
...@@ -365,7 +365,7 @@ void ANGLESetDefaultDisplayPlatform(angle::EGLDisplayType display) ...@@ -365,7 +365,7 @@ void ANGLESetDefaultDisplayPlatform(angle::EGLDisplayType display)
} // anonymous namespace } // anonymous namespace
DisplayState::DisplayState() : label(nullptr) {} DisplayState::DisplayState() : label(nullptr), featuresAllDisabled(false) {}
DisplayState::~DisplayState() {} DisplayState::~DisplayState() {}
...@@ -565,6 +565,8 @@ void Display::setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap ...@@ -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)); reinterpret_cast<const char **>(mAttributeMap.get(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE, 0));
mState.featureOverridesEnabled = EGLStringArrayToStringVector(featuresForceEnabled); mState.featureOverridesEnabled = EGLStringArrayToStringVector(featuresForceEnabled);
mState.featureOverridesDisabled = EGLStringArrayToStringVector(featuresForceDisabled); mState.featureOverridesDisabled = EGLStringArrayToStringVector(featuresForceDisabled);
mState.featuresAllDisabled =
static_cast<bool>(mAttributeMap.get(EGL_FEATURE_ALL_DISABLED_ANGLE, 0));
} }
Error Display::initialize() Error Display::initialize()
...@@ -610,7 +612,10 @@ Error Display::initialize() ...@@ -610,7 +612,10 @@ Error Display::initialize()
config.second.renderableType |= EGL_OPENGL_ES_BIT; config.second.renderableType |= EGL_OPENGL_ES_BIT;
} }
initializeFrontendFeatures(); if (!mState.featuresAllDisabled)
{
initializeFrontendFeatures();
}
mFeatures.clear(); mFeatures.clear();
mFrontendFeatures.populateFeatureList(&mFeatures); mFrontendFeatures.populateFeatureList(&mFeatures);
......
...@@ -57,6 +57,7 @@ struct DisplayState final : private angle::NonCopyable ...@@ -57,6 +57,7 @@ struct DisplayState final : private angle::NonCopyable
SurfaceSet surfaceSet; SurfaceSet surfaceSet;
std::vector<std::string> featureOverridesEnabled; std::vector<std::string> featureOverridesEnabled;
std::vector<std::string> featureOverridesDisabled; std::vector<std::string> featureOverridesDisabled;
bool featuresAllDisabled;
}; };
// Constant coded here as a sanity limit. // Constant coded here as a sanity limit.
......
...@@ -3840,7 +3840,10 @@ void Renderer11::generateCaps(gl::Caps *outCaps, ...@@ -3840,7 +3840,10 @@ void Renderer11::generateCaps(gl::Caps *outCaps,
void Renderer11::initializeFeatures(angle::FeaturesD3D *features) const 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()); OverrideFeaturesWithDisplayState(features, mDisplay->getState());
} }
......
...@@ -3009,7 +3009,10 @@ void Renderer9::generateCaps(gl::Caps *outCaps, ...@@ -3009,7 +3009,10 @@ void Renderer9::generateCaps(gl::Caps *outCaps,
void Renderer9::initializeFeatures(angle::FeaturesD3D *features) const void Renderer9::initializeFeatures(angle::FeaturesD3D *features) const
{ {
d3d9::InitializeFeatures(features); if (!mDisplay->getState().featuresAllDisabled)
{
d3d9::InitializeFeatures(features);
}
OverrideFeaturesWithDisplayState(features, mDisplay->getState()); OverrideFeaturesWithDisplayState(features, mDisplay->getState());
} }
......
...@@ -219,7 +219,10 @@ RendererGL::RendererGL(std::unique_ptr<FunctionsGL> functions, ...@@ -219,7 +219,10 @@ RendererGL::RendererGL(std::unique_ptr<FunctionsGL> functions,
mNativeParallelCompileEnabled(false) mNativeParallelCompileEnabled(false)
{ {
ASSERT(mFunctions); ASSERT(mFunctions);
nativegl_gl::InitializeFeatures(mFunctions.get(), &mFeatures); if (!display->getState().featuresAllDisabled)
{
nativegl_gl::InitializeFeatures(mFunctions.get(), &mFeatures);
}
OverrideFeaturesWithDisplayState(&mFeatures, display->getState()); OverrideFeaturesWithDisplayState(&mFeatures, display->getState());
mStateManager = mStateManager =
new StateManagerGL(mFunctions.get(), getNativeCaps(), getNativeExtensions(), mFeatures); new StateManagerGL(mFunctions.get(), getNativeCaps(), getNativeExtensions(), mFeatures);
......
...@@ -68,7 +68,11 @@ angle::Result DisplayMtl::initializeImpl(egl::Display *display) ...@@ -68,7 +68,11 @@ angle::Result DisplayMtl::initializeImpl(egl::Display *display)
mCapsInitialized = false; mCapsInitialized = false;
GlslangInitialize(); GlslangInitialize();
initializeFeatures();
if (!mState.featuresAllDisabled)
{
initializeFeatures();
}
ANGLE_TRY(mFormatTable.initialize(this)); ANGLE_TRY(mFormatTable.initialize(this));
......
...@@ -1006,7 +1006,10 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF ...@@ -1006,7 +1006,10 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
&mProvokingVertexFeatures); &mProvokingVertexFeatures);
} }
initFeatures(deviceExtensionNames); if (!displayVk->getState().featuresAllDisabled)
{
initFeatures(deviceExtensionNames);
}
OverrideFeaturesWithDisplayState(&mFeatures, displayVk->getState()); OverrideFeaturesWithDisplayState(&mFeatures, displayVk->getState());
mFeaturesInitialized = true; mFeaturesInitialized = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment