Bug 1562331 - Make webgl.* static prefs follow the naming convention. r=KrisWright
authorNicholas Nethercote <nnethercote@mozilla.com>
Sat, 29 Jun 2019 07:56:43 +1000
changeset 543602 98d86b9328ef5cf0454b98385f056020a4569f72
parent 543601 3780202d7104307ec4c5f4a1dde788e5123c47ac
child 543604 b3eb1ee3b85dfb87789c92d417e20f377ebcfca3
child 543613 e73151bcaff8a776ee5536da1dbe6e6b91799032
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersKrisWright
bugs1562331
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1562331 - Make webgl.* static prefs follow the naming convention. r=KrisWright Also converts webgl.pref-16bpp from a VarCache pref to a normal pref, because it doesn't need to be a VarCache pref. Differential Revision: https://phabricator.services.mozilla.com/D36397
dom/canvas/WebGL2ContextSync.cpp
dom/canvas/WebGLContext.cpp
dom/canvas/WebGLContextExtensions.cpp
dom/canvas/WebGLContextValidate.cpp
dom/canvas/WebGLExtensions.cpp
dom/canvas/WebGLQuery.cpp
dom/canvas/WebGLShaderValidator.cpp
dom/canvas/WebGLTextureUpload.cpp
gfx/gl/GLLibraryEGL.cpp
gfx/gl/GLScreenBuffer.cpp
gfx/gl/SharedSurfaceD3D11Interop.cpp
gfx/src/DriverCrashGuard.cpp
gfx/thebes/gfxPlatform.cpp
modules/libpref/init/StaticPrefList.h
--- a/dom/canvas/WebGL2ContextSync.cpp
+++ b/dom/canvas/WebGL2ContextSync.cpp
@@ -62,17 +62,17 @@ GLenum WebGL2Context::ClientWaitSync(con
 
   if (timeout > kMaxClientWaitSyncTimeoutNS) {
     ErrorInvalidOperation("`timeout` must not exceed %s nanoseconds.",
                           "MAX_CLIENT_WAIT_TIMEOUT_WEBGL");
     return LOCAL_GL_WAIT_FAILED;
   }
 
   const bool canBeAvailable =
-      (sync.mCanBeAvailable || StaticPrefs::WebGLImmediateQueries());
+      (sync.mCanBeAvailable || StaticPrefs::webgl_allow_immediate_queries());
   if (!canBeAvailable) {
     if (timeout) {
       GenerateWarning(
           "Sync object not yet queryable. Please wait for the event"
           " loop.");
     }
     return LOCAL_GL_WAIT_FAILED;
   }
@@ -113,17 +113,17 @@ void WebGL2Context::GetSyncParameter(JSC
   retval.setNull();
   if (IsContextLost()) return;
 
   if (!ValidateObject("sync", sync)) return;
 
   ////
 
   const bool canBeAvailable =
-      (sync.mCanBeAvailable || StaticPrefs::WebGLImmediateQueries());
+      (sync.mCanBeAvailable || StaticPrefs::webgl_allow_immediate_queries());
   if (!canBeAvailable && pname == LOCAL_GL_SYNC_STATUS) {
     retval.set(JS::Int32Value(LOCAL_GL_UNSIGNALED));
     return;
   }
 
   GLint result = 0;
   switch (pname) {
     case LOCAL_GL_OBJECT_TYPE:
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -93,18 +93,18 @@ namespace mozilla {
 
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::gl;
 using namespace mozilla::layers;
 
 WebGLContextOptions::WebGLContextOptions() {
   // Set default alpha state based on preference.
-  alpha = !StaticPrefs::WebGLDefaultNoAlpha();
-  antialias = StaticPrefs::WebGLDefaultAntialias();
+  alpha = !StaticPrefs::webgl_default_no_alpha();
+  antialias = StaticPrefs::webgl_default_antialias();
 }
 
 bool WebGLContextOptions::operator==(const WebGLContextOptions& r) const {
   bool eq = true;
   eq &= (alpha == r.alpha);
   eq &= (depth == r.depth);
   eq &= (stencil == r.stencil);
   eq &= (premultipliedAlpha == r.premultipliedAlpha);
@@ -113,28 +113,28 @@ bool WebGLContextOptions::operator==(con
   eq &= (failIfMajorPerformanceCaveat == r.failIfMajorPerformanceCaveat);
   eq &= (powerPreference == r.powerPreference);
   return eq;
 }
 
 WebGLContext::WebGLContext()
     : gl(mGL_OnlyClearInDestroyResourcesAndContext)  // const reference
       ,
-      mMaxPerfWarnings(StaticPrefs::WebGLMaxPerfWarnings()),
+      mMaxPerfWarnings(StaticPrefs::webgl_perf_max_warnings()),
       mNumPerfWarnings(0),
       mMaxAcceptableFBStatusInvals(
-          StaticPrefs::WebGLMaxAcceptableFBStatusInvals()),
+          StaticPrefs::webgl_perf_max_acceptable_fb_status_invals()),
       mDataAllocGLCallCount(0),
       mEmptyTFO(0),
       mContextLossHandler(this),
       mNeedsFakeNoAlpha(false),
       mNeedsFakeNoDepth(false),
       mNeedsFakeNoStencil(false),
-      mAllowFBInvalidation(StaticPrefs::WebGLFBInvalidation()),
-      mMsaaSamples((uint8_t)StaticPrefs::WebGLMsaaSamples()) {
+      mAllowFBInvalidation(StaticPrefs::webgl_allow_fb_invalidation()),
+      mMsaaSamples((uint8_t)StaticPrefs::webgl_msaa_samples()) {
   mGeneration = 0;
   mInvalidated = false;
   mCapturedFrameInvalidated = false;
   mShouldPresent = true;
   mResetLayer = true;
   mOptionsFrozen = false;
   mDisableExtensions = false;
   mIsMesa = false;
@@ -160,17 +160,17 @@ WebGLContext::WebGLContext()
   mLastLossWasSimulated = false;
   mLoseContextOnMemoryPressure = false;
   mCanLoseContextInForeground = true;
 
   mAlreadyGeneratedWarnings = 0;
   mAlreadyWarnedAboutFakeVertexAttrib0 = false;
   mAlreadyWarnedAboutViewportLargerThanDest = false;
 
-  mMaxWarnings = StaticPrefs::WebGLMaxWarningsPerContext();
+  mMaxWarnings = StaticPrefs::webgl_max_warnings_per_context();
   if (mMaxWarnings < -1) {
     GenerateWarning(
         "webgl.max-warnings-per-context size is too large (seems like a "
         "negative value wrapped)");
     mMaxWarnings = 0;
   }
 
   mLastUseIndex = 0;
@@ -362,17 +362,17 @@ WebGLContext::SetContextOptions(JSContex
     newOpts.antialias = attributes.mAntialias.Value();
   }
 
   // Don't do antialiasing if we've disabled MSAA.
   if (!mMsaaSamples) {
     newOpts.antialias = false;
   }
 
-  if (newOpts.antialias && !StaticPrefs::WebGLForceMSAA()) {
+  if (newOpts.antialias && !StaticPrefs::webgl_msaa_force()) {
     const nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
 
     nsCString blocklistId;
     if (IsFeatureInBlacklist(gfxInfo, nsIGfxInfo::FEATURE_WEBGL_MSAA,
                              &blocklistId)) {
       GenerateWarning(
           "Disallowing antialiased backbuffers due to blacklisting.");
       newOpts.antialias = false;
@@ -474,17 +474,17 @@ bool WebGLContext::CreateAndInitGL(
   bool tryANGLE = false;
 
   if (forceEnabled) {
     flags |= gl::CreateContextFlags::FORCE_ENABLE_HARDWARE;
   }
 
   if (IsWebGL2()) {
     flags |= gl::CreateContextFlags::PREFER_ES3;
-  } else if (!StaticPrefs::WebGL1AllowCoreProfile()) {
+  } else if (!StaticPrefs::webgl_1_allow_core_profiles()) {
     flags |= gl::CreateContextFlags::REQUIRE_COMPAT_PROFILE;
   }
 
   {
     bool highPower = false;
     switch (mOptions.powerPreference) {
       case dom::WebGLPowerPreference::Low_power:
         highPower = false;
@@ -499,17 +499,17 @@ bool WebGLContext::CreateAndInitGL(
         // ForceDiscreteGPUHelperCGL iff we decide it's a high-performance
         // application:
         // - Non-trivial canvas size
         // - Many draw calls
         // - Same origin with root page (try to stem bleeding from WebGL
         // ads/trackers)
       default:
         highPower = true;
-        if (StaticPrefs::WebGLDefaultLowPower()) {
+        if (StaticPrefs::webgl_default_low_power()) {
           highPower = false;
         } else if (mCanvasElement && !mCanvasElement->GetParentNode()) {
           GenerateWarning(
               "WebGLContextAttributes.powerPreference: 'default' when <canvas>"
               " has no parent Element defaults to 'low-power'.");
           highPower = false;
         }
         break;
@@ -554,22 +554,22 @@ bool WebGLContext::CreateAndInitGL(
   // --
 
   const bool useEGL = PR_GetEnv("MOZ_WEBGL_FORCE_EGL");
 
 #ifdef XP_WIN
   tryNativeGL = false;
   tryANGLE = true;
 
-  if (StaticPrefs::WebGLDisableWGL()) {
+  if (StaticPrefs::webgl_disable_wgl()) {
     tryNativeGL = false;
   }
 
-  if (StaticPrefs::WebGLDisableANGLE() || PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL") ||
-      useEGL) {
+  if (StaticPrefs::webgl_disable_angle() ||
+      PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL") || useEGL) {
     tryNativeGL = true;
     tryANGLE = false;
   }
 #endif
 
   if (tryNativeGL && !forceEnabled) {
     const nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
     const auto feature = nsIGfxInfo::FEATURE_WEBGL_OPENGL;
@@ -814,50 +814,50 @@ WebGLContext::SetDimensions(int32_t sign
     return NS_ERROR_FAILURE;
   }
 
   // increment the generation number - Do this early because later
   // in CreateOffscreenGL(), "default" objects are created that will
   // pick up the old generation.
   ++mGeneration;
 
-  bool disabled = StaticPrefs::WebGLDisabled();
+  bool disabled = StaticPrefs::webgl_disabled();
 
   // TODO: When we have software webgl support we should use that instead.
   disabled |= gfxPlatform::InSafeMode();
 
   if (disabled) {
     if (gfxPlatform::InSafeMode()) {
       failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_SAFEMODE");
     } else {
       failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_DISABLED");
     }
     const nsLiteralCString text("WebGL is currently disabled.");
     ThrowEvent_WebGLContextCreationError(text);
     return NS_ERROR_FAILURE;
   }
 
-  if (StaticPrefs::WebGLDisableFailIfMajorPerformanceCaveat()) {
+  if (StaticPrefs::webgl_disable_fail_if_major_performance_caveat()) {
     mOptions.failIfMajorPerformanceCaveat = false;
   }
 
   if (mOptions.failIfMajorPerformanceCaveat) {
     nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
     if (!HasAcceleratedLayers(gfxInfo)) {
       failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_PERF_CAVEAT");
       const nsLiteralCString text(
           "failIfMajorPerformanceCaveat: Compositor is not"
           " hardware-accelerated.");
       ThrowEvent_WebGLContextCreationError(text);
       return NS_ERROR_FAILURE;
     }
   }
 
   // Alright, now let's start trying.
-  bool forceEnabled = StaticPrefs::WebGLForceEnabled();
+  bool forceEnabled = StaticPrefs::webgl_force_enabled();
   ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
 
   MOZ_ASSERT(!gl);
   std::vector<FailureReason> failReasons;
   if (!CreateAndInitGL(forceEnabled, &failReasons)) {
     nsCString text("WebGL creation failed: ");
     for (const auto& cur : failReasons) {
       // Don't try to accumulate using an empty key if |cur.key| is empty.
@@ -979,19 +979,19 @@ WebGLContext::SetDimensions(int32_t sign
 
   failureId = NS_LITERAL_CSTRING("SUCCESS");
 
   gl->ResetSyncCallCount("WebGLContext Initialization");
   return NS_OK;
 }
 
 void WebGLContext::LoseOldestWebGLContextIfLimitExceeded() {
-  const auto maxWebGLContexts = StaticPrefs::WebGLMaxContexts();
+  const auto maxWebGLContexts = StaticPrefs::webgl_max_contexts();
   auto maxWebGLContextsPerPrincipal =
-      StaticPrefs::WebGLMaxContextsPerPrincipal();
+      StaticPrefs::webgl_max_contexts_per_principal();
 
   // maxWebGLContextsPerPrincipal must be less than maxWebGLContexts
   MOZ_ASSERT(maxWebGLContextsPerPrincipal <= maxWebGLContexts);
   maxWebGLContextsPerPrincipal =
       std::min(maxWebGLContextsPerPrincipal, maxWebGLContexts);
 
   if (!NS_IsMainThread()) {
     // XXX mtseng: bug 709490, WebGLMemoryTracker is not thread safe.
@@ -1343,17 +1343,17 @@ ScopedPrepForResourceClear::~ScopedPrepF
   gl->fClearStencil(webgl.mStencilClearValue);
 }
 
 }  // namespace webgl
 
 // -
 
 void WebGLContext::OnEndOfFrame() const {
-  if (StaticPrefs::WebGLSpewFrameAllocs()) {
+  if (StaticPrefs::webgl_perf_spew_frame_allocs()) {
     GeneratePerfWarning("[webgl.perf.spew-frame-allocs] %" PRIu64
                         " data allocations this frame.",
                         mDataAllocGLCallCount);
   }
   mDataAllocGLCallCount = 0;
   gl->ResetSyncCallCount("WebGLContext PresentScreenBuffer");
 }
 
--- a/dom/canvas/WebGLContextExtensions.cpp
+++ b/dom/canvas/WebGLContextExtensions.cpp
@@ -77,17 +77,17 @@ bool WebGLContext::IsExtensionSupported(
 
   // Chrome contexts need access to debug information even when
   // webgl.disable-extensions is set. This is used in the graphics
   // section of about:support
   if (callerType == dom::CallerType::System) {
     allowPrivilegedExts = true;
   }
 
-  if (StaticPrefs::WebGLPrivilegedExtensionsEnabled()) {
+  if (StaticPrefs::webgl_enable_privileged_extensions()) {
     allowPrivilegedExts = true;
   }
 
   if (allowPrivilegedExts) {
     switch (ext) {
       case WebGLExtensionID::EXT_disjoint_timer_query:
         return WebGLExtensionDisjointTimerQuery::IsSupported(this);
       case WebGLExtensionID::MOZ_debug:
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -283,20 +283,21 @@ bool WebGLContext::InitAndValidateGL(Fai
     const nsPrintfCString reason(
         "GL error 0x%x occurred during OpenGL context"
         " initialization, before WebGL initialization!",
         error);
     *out_failReason = {"FEATURE_FAILURE_WEBGL_GLERR_1", reason};
     return false;
   }
 
-  mDisableExtensions = StaticPrefs::WebGLDisableExtensions();
+  mDisableExtensions = StaticPrefs::webgl_disable_extensions();
   mLoseContextOnMemoryPressure =
-      StaticPrefs::WebGLLoseContextOnMemoryPressure();
-  mCanLoseContextInForeground = StaticPrefs::WebGLCanLoseContextInForeground();
+      StaticPrefs::webgl_lose_context_on_memory_pressure();
+  mCanLoseContextInForeground =
+      StaticPrefs::webgl_can_lose_context_in_foreground();
 
   // These are the default values, see 6.2 State tables in the
   // OpenGL ES 2.0.25 spec.
   mColorWriteMask = 0x0f;
   mDriverColorMask = mColorWriteMask;
   mColorClearValue[0] = 0.f;
   mColorClearValue[1] = 0.f;
   mColorClearValue[2] = 0.f;
@@ -471,17 +472,17 @@ bool WebGLContext::InitAndValidateGL(Fai
 
   const GLenum driverPName = gl->IsCoreProfile()
                                  ? LOCAL_GL_POINT_SIZE_RANGE
                                  : LOCAL_GL_ALIASED_POINT_SIZE_RANGE;
   gl->fGetFloatv(driverPName, mGLAliasedPointSizeRange);
 
   ////////////////
 
-  if (StaticPrefs::WebGLMinCapabilityMode()) {
+  if (StaticPrefs::webgl_min_capability_mode()) {
     bool ok = true;
 
     ok &= RestrictCap(&mGLMaxVertexTextureImageUnits,
                       kMinMaxVertexTextureImageUnits);
     ok &= RestrictCap(&mGLMaxFragmentTextureImageUnits,
                       kMinMaxFragmentTextureImageUnits);
     ok &= RestrictCap(&mGLMaxCombinedTextureImageUnits,
                       kMinMaxCombinedTextureImageUnits);
@@ -648,25 +649,25 @@ bool WebGLContext::InitAndValidateGL(Fai
   static const float kDefaultGenericVertexAttribData[4] = {0, 0, 0, 1};
   memcpy(mGenericVertexAttrib0Data, kDefaultGenericVertexAttribData,
          sizeof(mGenericVertexAttrib0Data));
 
   mFakeVertexAttrib0BufferObject = 0;
 
   mNeedsIndexValidation =
       !gl->IsSupported(gl::GLFeature::robust_buffer_access_behavior);
-  switch (StaticPrefs::WebGLForceIndexValidation()) {
+  switch (StaticPrefs::webgl_force_index_validation()) {
     case -1:
       mNeedsIndexValidation = false;
       break;
     case 1:
       mNeedsIndexValidation = true;
       break;
     default:
-      MOZ_ASSERT(StaticPrefs::WebGLForceIndexValidation() == 0);
+      MOZ_ASSERT(StaticPrefs::webgl_force_index_validation() == 0);
       break;
   }
 
   return true;
 }
 
 bool WebGLContext::ValidateFramebufferTarget(GLenum target) const {
   bool isValid = true;
--- a/dom/canvas/WebGLExtensions.cpp
+++ b/dom/canvas/WebGLExtensions.cpp
@@ -31,17 +31,17 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(W
 // -
 
 WebGLExtensionExplicitPresent::WebGLExtensionExplicitPresent(WebGLContext* const webgl)
     : WebGLExtensionBase(webgl) {
   MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
 }
 
 bool WebGLExtensionExplicitPresent::IsSupported(const WebGLContext* const webgl) {
-  return StaticPrefs::WebGLDraftExtensionsEnabled();
+  return StaticPrefs::webgl_enable_draft_extensions();
 }
 
 void WebGLExtensionExplicitPresent::Present() const {
   if (mIsLost || !mContext) return;
   mContext->PresentScreenBuffer();
 }
 
 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionExplicitPresent, WEBGL_explicit_present)
@@ -76,17 +76,19 @@ WebGLExtensionFBORenderMipmap::WebGLExte
   MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
 }
 
 WebGLExtensionFBORenderMipmap::~WebGLExtensionFBORenderMipmap() = default;
 
 bool WebGLExtensionFBORenderMipmap::IsSupported(
     const WebGLContext* const webgl) {
   if (webgl->IsWebGL2()) return false;
-  if (!StaticPrefs::WebGLDraftExtensionsEnabled()) return false;
+  if (!StaticPrefs::webgl_enable_draft_extensions()) {
+    return false;
+  }
 
   const auto& gl = webgl->gl;
   if (!gl->IsGLES()) return true;
   if (gl->Version() >= 300) return true;
   return gl->IsExtensionSupported(gl::GLContext::OES_fbo_render_mipmap);
 }
 
 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionFBORenderMipmap, OES_fbo_render_mipmap)
@@ -97,17 +99,19 @@ WebGLExtensionMultiview::WebGLExtensionM
     : WebGLExtensionBase(webgl) {
   MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
 }
 
 WebGLExtensionMultiview::~WebGLExtensionMultiview() = default;
 
 bool WebGLExtensionMultiview::IsSupported(const WebGLContext* const webgl) {
   if (!webgl->IsWebGL2()) return false;
-  if (!StaticPrefs::WebGLDraftExtensionsEnabled()) return false;
+  if (!StaticPrefs::webgl_enable_draft_extensions()) {
+    return false;
+  }
 
   const auto& gl = webgl->gl;
   return gl->IsSupported(gl::GLFeature::multiview);
 }
 
 void WebGLExtensionMultiview::FramebufferTextureMultiviewOVR(
     const GLenum target, const GLenum attachment, WebGLTexture* const texture,
     const GLint level, const GLint baseViewIndex,
--- a/dom/canvas/WebGLQuery.cpp
+++ b/dom/canvas/WebGLQuery.cpp
@@ -111,17 +111,17 @@ void WebGLQuery::GetQueryParameter(GLenu
   if (mActiveSlot)
     return mContext->ErrorInvalidOperation("Query is still active.");
 
   // End of validation
   ////
 
   // We must usually wait for an event loop before the query can be available.
   const bool canBeAvailable =
-      (mCanBeAvailable || StaticPrefs::WebGLImmediateQueries());
+      (mCanBeAvailable || StaticPrefs::webgl_allow_immediate_queries());
   if (!canBeAvailable) {
     if (pname == LOCAL_GL_QUERY_RESULT_AVAILABLE) {
       retval.set(JS::BooleanValue(false));
     }
     return;
   }
 
   const auto& gl = mContext->gl;
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -62,17 +62,17 @@ static ShCompileOptions ChooseValidatorC
 
     if (!gl->IsANGLE() && gl->Vendor() == gl::GLVendor::Intel) {
       // Failures on at least Windows+Intel+OGL on:
       // conformance/glsl/constructors/glsl-construct-mat2.html
       options |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
     }
   }
 
-  if (StaticPrefs::WebGLAllANGLEOptions()) {
+  if (StaticPrefs::webgl_all_angle_options()) {
     options = -1;
 
     options ^= SH_INTERMEDIATE_TREE;
     options ^= SH_LINE_DIRECTIVES;
     options ^= SH_SOURCE_PATH;
 
     options ^= SH_LIMIT_EXPRESSION_COMPLEXITY;
     options ^= SH_LIMIT_CALL_STACK_DEPTH;
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -323,17 +323,17 @@ UniquePtr<webgl::TexUnpackBlob> WebGLCon
   auto sfer = nsLayoutUtils::SurfaceFromElement(
       const_cast<dom::Element*>(&elem), flags, idealDrawTarget);
 
   //////
 
   uint32_t elemWidth = 0;
   uint32_t elemHeight = 0;
   layers::Image* layersImage = nullptr;
-  if (!StaticPrefs::WebGLDisableDOMBlitUploads() && sfer.mLayersImage) {
+  if (!StaticPrefs::webgl_disable_DOM_blit_uploads() && sfer.mLayersImage) {
     layersImage = sfer.mLayersImage;
     elemWidth = layersImage->GetSize().width;
     elemHeight = layersImage->GetSize().height;
   }
 
   RefPtr<gfx::DataSourceSurface> dataSurf;
   if (!layersImage && sfer.GetSourceSurface()) {
     const auto surf = sfer.GetSourceSurface();
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -284,24 +284,24 @@ static EGLDisplay GetAndInitDisplayForAc
   EGLDisplay ret = 0;
 
   if (wr::RenderThread::IsInRenderThread()) {
     return GetAndInitDisplayForWebRender(egl, EGL_DEFAULT_DISPLAY);
   }
 
   FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
 
-  if (!StaticPrefs::WebGLANGLETryD3D11())
+  if (!StaticPrefs::webgl_angle_try_d3d11()) {
     d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref",
                            NS_LITERAL_CSTRING("FAILURE_ID_ANGLE_PREF"));
-
-  if (StaticPrefs::WebGLANGLEForceD3D11())
+  }
+  if (StaticPrefs::webgl_angle_force_d3d11()) {
     d3d11ANGLE.UserForceEnable(
         "User force-enabled D3D11 ANGLE on disabled hardware");
-
+  }
   gAngleErrorReporter.SetFailureId(out_failureId);
 
   auto guardShutdown = mozilla::MakeScopeExit([&] {
     gAngleErrorReporter.SetFailureId(nullptr);
     // NOTE: Ideally we should be calling ANGLEPlatformShutdown after the
     //       ANGLE display is destroyed. However gAngleErrorReporter
     //       will live longer than the ANGLE display so we're fine.
   });
@@ -736,17 +736,17 @@ EGLDisplay GLLibraryEGL::CreateDisplay(b
   if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
     nsCString accelAngleFailureId;
     bool accelAngleSupport =
         IsAccelAngleSupported(gfxInfo, &accelAngleFailureId);
     bool shouldTryAccel = forceAccel || accelAngleSupport;
     bool shouldTryWARP = !forceAccel;  // Only if ANGLE not supported or fails
 
     // If WARP preferred, will override ANGLE support
-    if (StaticPrefs::WebGLANGLEForceWARP()) {
+    if (StaticPrefs::webgl_angle_force_warp()) {
       shouldTryWARP = true;
       shouldTryAccel = false;
       if (accelAngleFailureId.IsEmpty()) {
         accelAngleFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_FORCE_WARP");
       }
     }
 
     // Hardware accelerated ANGLE path (supported or force accel)
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -61,36 +61,36 @@ UniquePtr<SurfaceFactory> GLScreenBuffer
     GLContext* gl, const SurfaceCaps& caps,
     KnowsCompositor* compositorConnection, const layers::TextureFlags& flags) {
   LayersIPCChannel* ipcChannel = compositorConnection->GetTextureForwarder();
   const layers::LayersBackend backend =
       compositorConnection->GetCompositorBackendType();
   const bool useANGLE = compositorConnection->GetCompositorUseANGLE();
 
   const bool useGl =
-      !StaticPrefs::WebGLForceLayersReadback() &&
+      !StaticPrefs::webgl_force_layers_readback() &&
       (backend == layers::LayersBackend::LAYERS_OPENGL ||
        (backend == layers::LayersBackend::LAYERS_WR && !useANGLE));
   const bool useD3D =
-      !StaticPrefs::WebGLForceLayersReadback() &&
+      !StaticPrefs::webgl_force_layers_readback() &&
       (backend == layers::LayersBackend::LAYERS_D3D11 ||
        (backend == layers::LayersBackend::LAYERS_WR && useANGLE));
 
   UniquePtr<SurfaceFactory> factory = nullptr;
   if (useGl) {
 #if defined(XP_MACOSX)
     factory = SurfaceFactory_IOSurface::Create(gl, caps, ipcChannel, flags);
 #elif defined(MOZ_X11)
     if (sGLXLibrary.UseTextureFromPixmap())
       factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
 #elif defined(MOZ_WIDGET_UIKIT)
     factory = MakeUnique<SurfaceFactory_GLTexture>(mGLContext, caps, ipcChannel,
                                                    mFlags);
 #elif defined(MOZ_WIDGET_ANDROID)
-    if (XRE_IsParentProcess() && !StaticPrefs::WebGLSurfaceTextureEnabled()) {
+    if (XRE_IsParentProcess() && !StaticPrefs::webgl_enable_surface_texture()) {
       factory = SurfaceFactory_EGLImage::Create(gl, caps, ipcChannel, flags);
     } else {
       factory =
           SurfaceFactory_SurfaceTexture::Create(gl, caps, ipcChannel, flags);
     }
 #else
     if (gl->GetContextType() == GLContextType::EGL) {
       if (XRE_IsParentProcess()) {
@@ -109,17 +109,17 @@ UniquePtr<SurfaceFactory> GLScreenBuffer
     // are both WARP or both not WARP
     gfx::DeviceManagerDx* dm = gfx::DeviceManagerDx::Get();
     if (gl->IsANGLE() && (gl->IsWARP() == dm->IsWARP()) &&
         dm->TextureSharingWorks()) {
       factory =
           SurfaceFactory_ANGLEShareHandle::Create(gl, caps, ipcChannel, flags);
     }
 
-    if (!factory && StaticPrefs::WebGLDXGLEnabled()) {
+    if (!factory && StaticPrefs::webgl_dxgl_enabled()) {
       factory =
           SurfaceFactory_D3D11Interop::Create(gl, caps, ipcChannel, flags);
     }
 #endif
   }
 
 #ifdef MOZ_X11
   if (!factory && sGLXLibrary.UseTextureFromPixmap()) {
--- a/gfx/gl/SharedSurfaceD3D11Interop.cpp
+++ b/gfx/gl/SharedSurfaceD3D11Interop.cpp
@@ -409,17 +409,17 @@ SharedSurface_D3D11Interop::SharedSurfac
           gl, size, hasAlpha, true),
       mProdTex(prodTex),
       mInteropFB(interopFB),
       mInteropRB(interopRB),
       mInterop(interop),
       mLockHandle(lockHandle),
       mTexD3D(texD3D),
       mDXGIHandle(dxgiHandle),
-      mNeedsFinish(StaticPrefs::WebGLDXGLNeedsFinish()),
+      mNeedsFinish(StaticPrefs::webgl_dxgl_needs_finish()),
       mLockedForGL(false) {
   MOZ_ASSERT(bool(mProdTex) == bool(mInteropFB));
 }
 
 SharedSurface_D3D11Interop::~SharedSurface_D3D11Interop() {
   MOZ_ASSERT(!IsProducerAcquired());
 
   if (!mGL || !mGL->MakeCurrent()) return;
--- a/gfx/src/DriverCrashGuard.cpp
+++ b/gfx/src/DriverCrashGuard.cpp
@@ -504,21 +504,21 @@ bool GLContextCrashGuard::UpdateEnvironm
   }
 
   checked = true;
 
   bool changed = false;
 
 #if defined(XP_WIN)
   changed |= CheckAndUpdateBoolPref("gfx.driver-init.webgl-angle-force-d3d11",
-                                    StaticPrefs::WebGLANGLEForceD3D11());
+                                    StaticPrefs::webgl_angle_force_d3d11());
   changed |= CheckAndUpdateBoolPref("gfx.driver-init.webgl-angle-try-d3d11",
-                                    StaticPrefs::WebGLANGLETryD3D11());
+                                    StaticPrefs::webgl_angle_try_d3d11());
   changed |= CheckAndUpdateBoolPref("gfx.driver-init.webgl-angle-force-warp",
-                                    StaticPrefs::WebGLANGLEForceWARP());
+                                    StaticPrefs::webgl_angle_force_warp());
   changed |= CheckAndUpdateBoolPref(
       "gfx.driver-init.webgl-angle",
       FeatureEnabled(nsIGfxInfo::FEATURE_WEBGL_ANGLE, false));
   changed |= CheckAndUpdateBoolPref(
       "gfx.driver-init.direct3d11-angle",
       FeatureEnabled(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, false));
 #endif
 
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -917,21 +917,22 @@ void gfxPlatform::Init() {
     // Layers prefs
     forcedPrefs.AppendPrintf(
         "-L%d%d%d%d", StaticPrefs::layers_amd_switchable_gfx_enabled(),
         StaticPrefs::layers_acceleration_disabled_do_not_use_directly(),
         StaticPrefs::layers_acceleration_force_enabled_do_not_use_directly(),
         StaticPrefs::layers_d3d11_force_warp());
     // WebGL prefs
     forcedPrefs.AppendPrintf(
-        "-W%d%d%d%d%d%d%d%d", StaticPrefs::WebGLANGLEForceD3D11(),
-        StaticPrefs::WebGLANGLEForceWARP(), StaticPrefs::WebGLDisabled(),
-        StaticPrefs::WebGLDisableANGLE(), StaticPrefs::WebGLDXGLEnabled(),
-        StaticPrefs::WebGLForceEnabled(),
-        StaticPrefs::WebGLForceLayersReadback(), StaticPrefs::WebGLForceMSAA());
+        "-W%d%d%d%d%d%d%d%d", StaticPrefs::webgl_angle_force_d3d11(),
+        StaticPrefs::webgl_angle_force_warp(), StaticPrefs::webgl_disabled(),
+        StaticPrefs::webgl_disable_angle(), StaticPrefs::webgl_dxgl_enabled(),
+        StaticPrefs::webgl_force_enabled(),
+        StaticPrefs::webgl_force_layers_readback(),
+        StaticPrefs::webgl_msaa_force());
     // Prefs that don't fit into any of the other sections
     forcedPrefs.AppendPrintf("-T%d%d%d) ",
                              StaticPrefs::gfx_android_rgb16_force(),
                              0,  // SkiaGL canvas no longer supported
                              StaticPrefs::layers_force_shmem_tiles());
     ScopedGfxFeatureReporter::AppNote(forcedPrefs);
   }
 
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -7239,278 +7239,273 @@ VARCACHE_PREF(
 
 //---------------------------------------------------------------------------
 // Prefs starting with "webgl." (for pref access from Worker threads)
 //---------------------------------------------------------------------------
 
 VARCACHE_PREF(
   Live,
   "webgl.1.allow-core-profiles",
-  WebGL1AllowCoreProfile,
+   webgl_1_allow_core_profiles,
   RelaxedAtomicBool, false
 )
 
 
 VARCACHE_PREF(
   Live,
   "webgl.all-angle-options",
-  WebGLAllANGLEOptions,
+   webgl_all_angle_options,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.angle.force-d3d11",
-  WebGLANGLEForceD3D11,
+   webgl_angle_force_d3d11,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.angle.try-d3d11",
-  WebGLANGLETryD3D11,
+   webgl_angle_try_d3d11,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.angle.force-warp",
-  WebGLANGLEForceWARP,
+   webgl_angle_force_warp,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.can-lose-context-in-foreground",
-  WebGLCanLoseContextInForeground,
+   webgl_can_lose_context_in_foreground,
   RelaxedAtomicBool, true
 )
 
 #ifdef MOZ_WIDGET_ANDROID
 # define PREF_VALUE false
 #else
 # define PREF_VALUE true
 #endif
 VARCACHE_PREF(
   Live,
   "webgl.default-antialias",
-  WebGLDefaultAntialias,
+   webgl_default_antialias,
   RelaxedAtomicBool, PREF_VALUE
 )
 #undef PREF_VALUE
 
 VARCACHE_PREF(
   Live,
   "webgl.default-low-power",
-  WebGLDefaultLowPower,
+   webgl_default_low_power,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.default-no-alpha",
-  WebGLDefaultNoAlpha,
+   webgl_default_no_alpha,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.disable-angle",
-  WebGLDisableANGLE,
+   webgl_disable_angle,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.disable-wgl",
-  WebGLDisableWGL,
+   webgl_disable_wgl,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.disable-extensions",
-  WebGLDisableExtensions,
+   webgl_disable_extensions,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.dxgl.enabled",
-  WebGLDXGLEnabled,
+   webgl_dxgl_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.dxgl.needs-finish",
-  WebGLDXGLNeedsFinish,
+   webgl_dxgl_needs_finish,
   RelaxedAtomicBool, false
 )
 
 
 VARCACHE_PREF(
   Live,
   "webgl.disable-fail-if-major-performance-caveat",
-  WebGLDisableFailIfMajorPerformanceCaveat,
+   webgl_disable_fail_if_major_performance_caveat,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.disable-DOM-blit-uploads",
-  WebGLDisableDOMBlitUploads,
+   webgl_disable_DOM_blit_uploads,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.disabled",
-  WebGLDisabled,
+   webgl_disabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.enable-draft-extensions",
-  WebGLDraftExtensionsEnabled,
+   webgl_enable_draft_extensions,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.enable-privileged-extensions",
-  WebGLPrivilegedExtensionsEnabled,
+   webgl_enable_privileged_extensions,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.enable-surface-texture",
-  WebGLSurfaceTextureEnabled,
+   webgl_enable_surface_texture,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.enable-webgl2",
   webgl_enable_webgl2,
   RelaxedAtomicBool, true
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.force-enabled",
-  WebGLForceEnabled,
+   webgl_force_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.force-layers-readback",
-  WebGLForceLayersReadback,
+   webgl_force_layers_readback,
   bool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.force-index-validation",
-  WebGLForceIndexValidation,
+   webgl_force_index_validation,
   RelaxedAtomicInt32, 0
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.lose-context-on-memory-pressure",
-  WebGLLoseContextOnMemoryPressure,
+   webgl_lose_context_on_memory_pressure,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.max-contexts",
-  WebGLMaxContexts,
+   webgl_max_contexts,
   RelaxedAtomicUint32, 32
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.max-contexts-per-principal",
-  WebGLMaxContextsPerPrincipal,
+   webgl_max_contexts_per_principal,
   RelaxedAtomicUint32, 16
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.max-warnings-per-context",
-  WebGLMaxWarningsPerContext,
+   webgl_max_warnings_per_context,
   RelaxedAtomicUint32, 32
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.min_capability_mode",
-  WebGLMinCapabilityMode,
+   webgl_min_capability_mode,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.msaa-force",
-  WebGLForceMSAA,
+   webgl_msaa_force,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.msaa-samples",
-  WebGLMsaaSamples,
+   webgl_msaa_samples,
   RelaxedAtomicUint32, 4
 )
 
-VARCACHE_PREF(
-  Live,
-  "webgl.prefer-16bpp",
-  WebGLPrefer16bpp,
-  RelaxedAtomicBool, false
-)
+PREF("webgl.prefer-16bpp", bool, false)
 
 VARCACHE_PREF(
   Live,
   "webgl.allow-immediate-queries",
-  WebGLImmediateQueries,
+   webgl_allow_immediate_queries,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.allow-fb-invalidation",
-  WebGLFBInvalidation,
+   webgl_allow_fb_invalidation,
   RelaxedAtomicBool, false
 )
 
 
 VARCACHE_PREF(
   Live,
   "webgl.perf.max-warnings",
-  WebGLMaxPerfWarnings,
+   webgl_perf_max_warnings,
   RelaxedAtomicInt32, 0
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.perf.max-acceptable-fb-status-invals",
-  WebGLMaxAcceptableFBStatusInvals,
+   webgl_perf_max_acceptable_fb_status_invals,
   RelaxedAtomicInt32, 0
 )
 
 VARCACHE_PREF(
   Live,
   "webgl.perf.spew-frame-allocs",
-  WebGLSpewFrameAllocs,
+   webgl_perf_spew_frame_allocs,
   RelaxedAtomicBool, true
 )
 
 //---------------------------------------------------------------------------
 // Prefs starting with "widget."
 //---------------------------------------------------------------------------
 
 VARCACHE_PREF(