Backed out changeset 472a419a8d65 (bug 1371190) for build bustage, at least on Windows Static. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 06 Oct 2017 15:30:44 +0200
changeset 427351 cf27d9749603dd9c8344ccb50dad0e40ba4dc8f8
parent 427350 108ee2f14c2f13e1ce31a69df858ee450a1fe0ea
child 427352 fd91c0f96f1717734215d9a0f1751e3ac920518f
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersbackout
bugs1371190
milestone58.0a1
backs out472a419a8d65f888ebc5d64ae90c59881cef4d73
Backed out changeset 472a419a8d65 (bug 1371190) for build bustage, at least on Windows Static. r=backout on a CLOSED TREE
dom/canvas/WebGLContextValidate.cpp
dom/canvas/WebGLShaderValidator.cpp
gfx/gl/GLLibraryEGL.cpp
gfx/gl/GLLibraryEGL.h
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -686,17 +686,17 @@ WebGLContext::InitAndValidateGL(FailureR
     if (gl->IsSupported(gl::GLFeature::seamless_cube_map_opt_in)) {
         gl->fEnable(LOCAL_GL_TEXTURE_CUBE_MAP_SEAMLESS);
     }
 
     // Check the shader validator pref
     mBypassShaderValidation = gfxPrefs::WebGLBypassShaderValidator();
 
     // initialize shader translator
-    if (!sh::Initialize()) {
+    if (!ShInitialize()) {
         *out_failReason = { "FEATURE_FAILURE_WEBGL_GLSL",
                             "GLSL translator initialization failed!" };
         return false;
     }
 
     // Mesa can only be detected with the GL_VERSION string, of the form
     // "2.1 Mesa 7.11.0"
     const char* versionStr = (const char*)(gl->fGetString(LOCAL_GL_VERSION));
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -132,17 +132,17 @@ WebGLContext::CreateShaderValidator(GLen
     if (mBypassShaderValidation)
         return nullptr;
 
     const auto spec = (IsWebGL2() ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC);
     const auto outputLanguage = ShaderOutput(gl);
 
     ShBuiltInResources resources;
     memset(&resources, 0, sizeof(resources));
-    sh::InitBuiltInResources(&resources);
+    ShInitBuiltInResources(&resources);
 
     resources.HashFunction = webgl::IdentifierHashFunc;
 
     resources.MaxVertexAttribs = mGLMaxVertexAttribs;
     resources.MaxVertexUniformVectors = mGLMaxVertexUniformVectors;
     resources.MaxVaryingVectors = mGLMaxVaryingVectors;
     resources.MaxVertexTextureImageUnits = mGLMaxVertexTextureImageUnits;
     resources.MaxCombinedTextureImageUnits = mGLMaxCombinedTextureImageUnits;
@@ -188,55 +188,55 @@ WebGLContext::CreateShaderValidator(GLen
 namespace webgl {
 
 /*static*/ ShaderValidator*
 ShaderValidator::Create(GLenum shaderType, ShShaderSpec spec,
                         ShShaderOutput outputLanguage,
                         const ShBuiltInResources& resources,
                         ShCompileOptions compileOptions)
 {
-    ShHandle handle = sh::ConstructCompiler(shaderType, spec, outputLanguage, &resources);
+    ShHandle handle = ShConstructCompiler(shaderType, spec, outputLanguage, &resources);
     if (!handle)
         return nullptr;
 
     return new ShaderValidator(handle, compileOptions, resources.MaxVaryingVectors);
 }
 
 ShaderValidator::~ShaderValidator()
 {
-    sh::Destruct(mHandle);
+    ShDestruct(mHandle);
 }
 
 bool
 ShaderValidator::ValidateAndTranslate(const char* source)
 {
     MOZ_ASSERT(!mHasRun);
     mHasRun = true;
 
     const char* const parts[] = {
         source
     };
-    return sh::Compile(mHandle, parts, ArrayLength(parts), mCompileOptions);
+    return ShCompile(mHandle, parts, ArrayLength(parts), mCompileOptions);
 }
 
 void
 ShaderValidator::GetInfoLog(nsACString* out) const
 {
     MOZ_ASSERT(mHasRun);
 
-    const std::string &log = sh::GetInfoLog(mHandle);
+    const std::string &log = ShGetInfoLog(mHandle);
     out->Assign(log.data(), log.length());
 }
 
 void
 ShaderValidator::GetOutput(nsACString* out) const
 {
     MOZ_ASSERT(mHasRun);
 
-    const std::string &output = sh::GetObjectCode(mHandle);
+    const std::string &output = ShGetObjectCode(mHandle);
     out->Assign(output.data(), output.length());
 }
 
 template<size_t N>
 static bool
 StartsWith(const std::string& haystack, const char (&needle)[N])
 {
     return haystack.compare(0, N - 1, needle) == 0;
@@ -246,29 +246,29 @@ bool
 ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log) const
 {
     if (!prev) {
         nsPrintfCString error("Passed in NULL prev ShaderValidator.");
         *out_log = error;
         return false;
     }
 
-    const auto shaderVersion = sh::GetShaderVersion(mHandle);
-    if (sh::GetShaderVersion(prev->mHandle) != shaderVersion) {
+    const auto shaderVersion = ShGetShaderVersion(mHandle);
+    if (ShGetShaderVersion(prev->mHandle) != shaderVersion) {
         nsPrintfCString error("Vertex shader version %d does not match"
                               " fragment shader version %d.",
-                              sh::GetShaderVersion(prev->mHandle),
-                              sh::GetShaderVersion(mHandle));
+                              ShGetShaderVersion(prev->mHandle),
+                              ShGetShaderVersion(mHandle));
         *out_log = error;
         return false;
     }
 
     {
-        const std::vector<sh::Uniform>* vertPtr = sh::GetUniforms(prev->mHandle);
-        const std::vector<sh::Uniform>* fragPtr = sh::GetUniforms(mHandle);
+        const std::vector<sh::Uniform>* vertPtr = ShGetUniforms(prev->mHandle);
+        const std::vector<sh::Uniform>* fragPtr = ShGetUniforms(mHandle);
         if (!vertPtr || !fragPtr) {
             nsPrintfCString error("Could not create uniform list.");
             *out_log = error;
             return false;
         }
 
         for (auto itrFrag = fragPtr->begin(); itrFrag != fragPtr->end(); ++itrFrag) {
             for (auto itrVert = vertPtr->begin(); itrVert != vertPtr->end(); ++itrVert) {
@@ -309,18 +309,18 @@ ShaderValidator::CanLinkTo(const ShaderV
                     return false;
                 }
 
                 break;
             }
         }
     }
 
-    const auto& vertVaryings = sh::GetVaryings(prev->mHandle);
-    const auto& fragVaryings = sh::GetVaryings(mHandle);
+    const auto& vertVaryings = ShGetVaryings(prev->mHandle);
+    const auto& fragVaryings = ShGetVaryings(mHandle);
     if (!vertVaryings || !fragVaryings) {
         nsPrintfCString error("Could not create varying list.");
         *out_log = error;
         return false;
     }
 
     {
         std::vector<sh::ShaderVariable> staticUseVaryingList;
@@ -362,17 +362,17 @@ ShaderValidator::CanLinkTo(const ShaderV
                 return false;
             }
 
             if (staticVertUse && fragVarying.staticUse) {
                 staticUseVaryingList.push_back(fragVarying);
             }
         }
 
-        if (!sh::CheckVariablesWithinPackingLimits(mMaxVaryingVectors,
+        if (!ShCheckVariablesWithinPackingLimits(mMaxVaryingVectors,
                                                  staticUseVaryingList))
         {
             *out_log = "Statically used varyings do not fit within packing limits. (see"
                        " GLSL ES Specification 1.0.17, p111)";
             return false;
         }
     }
 
@@ -424,119 +424,119 @@ ShaderValidator::CanLinkTo(const ShaderV
     return true;
 }
 
 size_t
 ShaderValidator::CalcNumSamplerUniforms() const
 {
     size_t accum = 0;
 
-    const std::vector<sh::Uniform>& uniforms = *sh::GetUniforms(mHandle);
+    const std::vector<sh::Uniform>& uniforms = *ShGetUniforms(mHandle);
 
     for (auto itr = uniforms.begin(); itr != uniforms.end(); ++itr) {
         GLenum type = itr->type;
         if (type == LOCAL_GL_SAMPLER_2D ||
             type == LOCAL_GL_SAMPLER_CUBE)
         {
             accum += itr->arraySize;
         }
     }
 
     return accum;
 }
 
 size_t
 ShaderValidator::NumAttributes() const
 {
-  return sh::GetAttributes(mHandle)->size();
+  return ShGetAttributes(mHandle)->size();
 }
 
 // Attribs cannot be structs or arrays, and neither can vertex inputs in ES3.
 // Therefore, attrib names are always simple.
 bool
 ShaderValidator::FindAttribUserNameByMappedName(const std::string& mappedName,
                                                 const std::string** const out_userName) const
 {
-    const std::vector<sh::Attribute>& attribs = *sh::GetAttributes(mHandle);
+    const std::vector<sh::Attribute>& attribs = *ShGetAttributes(mHandle);
     for (auto itr = attribs.begin(); itr != attribs.end(); ++itr) {
         if (itr->mappedName == mappedName) {
             *out_userName = &(itr->name);
             return true;
         }
     }
 
     return false;
 }
 
 bool
 ShaderValidator::FindAttribMappedNameByUserName(const std::string& userName,
                                                 const std::string** const out_mappedName) const
 {
-    const std::vector<sh::Attribute>& attribs = *sh::GetAttributes(mHandle);
+    const std::vector<sh::Attribute>& attribs = *ShGetAttributes(mHandle);
     for (auto itr = attribs.begin(); itr != attribs.end(); ++itr) {
         if (itr->name == userName) {
             *out_mappedName = &(itr->mappedName);
             return true;
         }
     }
 
     return false;
 }
 
 bool
 ShaderValidator::FindVaryingByMappedName(const std::string& mappedName,
                                          std::string* const out_userName,
                                          bool* const out_isArray) const
 {
-    const std::vector<sh::Varying>& varyings = *sh::GetVaryings(mHandle);
+    const std::vector<sh::Varying>& varyings = *ShGetVaryings(mHandle);
     for (auto itr = varyings.begin(); itr != varyings.end(); ++itr) {
         const sh::ShaderVariable* found;
         if (!itr->findInfoByMappedName(mappedName, &found, out_userName))
             continue;
 
         *out_isArray = found->isArray();
         return true;
     }
 
     return false;
 }
 
 bool
 ShaderValidator::FindVaryingMappedNameByUserName(const std::string& userName,
                                                  const std::string** const out_mappedName) const
 {
-    const std::vector<sh::Varying>& attribs = *sh::GetVaryings(mHandle);
+    const std::vector<sh::Varying>& attribs = *ShGetVaryings(mHandle);
     for (auto itr = attribs.begin(); itr != attribs.end(); ++itr) {
         if (itr->name == userName) {
             *out_mappedName = &(itr->mappedName);
             return true;
         }
     }
 
     return false;
 }
 // This must handle names like "foo.bar[0]".
 bool
 ShaderValidator::FindUniformByMappedName(const std::string& mappedName,
                                          std::string* const out_userName,
                                          bool* const out_isArray) const
 {
-    const std::vector<sh::Uniform>& uniforms = *sh::GetUniforms(mHandle);
+    const std::vector<sh::Uniform>& uniforms = *ShGetUniforms(mHandle);
     for (auto itr = uniforms.begin(); itr != uniforms.end(); ++itr) {
         const sh::ShaderVariable* found;
         if (!itr->findInfoByMappedName(mappedName, &found, out_userName))
             continue;
 
         *out_isArray = found->isArray();
         return true;
     }
 
     const size_t dotPos = mappedName.find(".");
 
-    const std::vector<sh::InterfaceBlock>& interfaces = *sh::GetInterfaceBlocks(mHandle);
+    const std::vector<sh::InterfaceBlock>& interfaces = *ShGetInterfaceBlocks(mHandle);
     for (const auto& interface : interfaces) {
 
         std::string mappedFieldName;
         const bool hasInstanceName = !interface.instanceName.empty();
 
         // If the InterfaceBlock has an instanceName, all variables defined
         // within the block are qualified with the block name, as opposed
         // to being placed in the global scope.
@@ -574,33 +574,33 @@ ShaderValidator::FindUniformByMappedName
 
     return false;
 }
 
 bool
 ShaderValidator::UnmapUniformBlockName(const nsACString& baseMappedName,
                                        nsCString* const out_baseUserName) const
 {
-    const std::vector<sh::InterfaceBlock>& interfaces = *sh::GetInterfaceBlocks(mHandle);
+    const std::vector<sh::InterfaceBlock>& interfaces = *ShGetInterfaceBlocks(mHandle);
     for (const auto& interface : interfaces) {
         const nsDependentCString interfaceMappedName(interface.mappedName.data(),
                                                      interface.mappedName.size());
         if (baseMappedName == interfaceMappedName) {
             *out_baseUserName = interface.name.data();
             return true;
         }
     }
 
     return false;
 }
 
 void
 ShaderValidator::EnumerateFragOutputs(std::map<nsCString, const nsCString> &out_FragOutputs) const
 {
-    const auto* fragOutputs = sh::GetOutputVariables(mHandle);
+    const auto* fragOutputs = ShGetOutputVariables(mHandle);
 
     if (fragOutputs) {
         for (const auto& fragOutput : *fragOutputs) {
             out_FragOutputs.insert({nsCString(fragOutput.name.c_str()),
                                     nsCString(fragOutput.mappedName.c_str())});
         }
     }
 }
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -183,29 +183,29 @@ GetAndInitDisplay(GLLibraryEGL& egl, voi
         return EGL_NO_DISPLAY;
 
     if (!egl.fInitialize(display, nullptr, nullptr))
         return EGL_NO_DISPLAY;
 
     return display;
 }
 
-class AngleErrorReporting {
+class AngleErrorReporting: public angle::Platform {
 public:
     AngleErrorReporting()
     {
       // No static constructor
     }
 
     void SetFailureId(nsACString* const aFailureId)
     {
       mFailureId = aFailureId;
     }
 
-    void logError(const char *errorMessage)
+    void logError(const char *errorMessage) override
     {
         if (!mFailureId) {
             return;
         }
 
         nsCString str(errorMessage);
         Tokenizer tokenizer(str);
 
@@ -249,16 +249,17 @@ GetAndInitDisplayForAccelANGLE(GLLibrary
     if (!gfxPrefs::WebGLANGLETryD3D11())
         d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref",
                                NS_LITERAL_CSTRING("FAILURE_ID_ANGLE_PREF"));
 
     if (gfxPrefs::WebGLANGLEForceD3D11())
         d3d11ANGLE.UserForceEnable("User force-enabled D3D11 ANGLE on disabled hardware");
 
     gAngleErrorReporter.SetFailureId(out_failureId);
+    egl.fANGLEPlatformInitialize(&gAngleErrorReporter);
 
     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.
     });
 
@@ -450,16 +451,18 @@ GLLibraryEGL::EnsureInitialized(bool for
 
     EGLDisplay chosenDisplay = nullptr;
 
     // Client exts are ready. (But not display exts!)
 
     if (mIsANGLE) {
         MOZ_ASSERT(IsExtensionSupported(ANGLE_platform_angle_d3d));
         const GLLibraryLoader::SymLoadStruct angleSymbols[] = {
+            { (PRFuncPtr*)&mSymbols.fANGLEPlatformInitialize, { "ANGLEPlatformInitialize", nullptr } },
+            { (PRFuncPtr*)&mSymbols.fANGLEPlatformShutdown, { "ANGLEPlatformShutdown", nullptr } },
             SYMBOL(GetPlatformDisplayEXT),
             END_OF_SYMBOLS
         };
         if (!fnLoadSymbols(angleSymbols)) {
             gfxCriticalError() << "Failed to load ANGLE symbols!";
             return false;
         }
     }
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -329,16 +329,22 @@ public:
 
     // ANGLE_device_creation
     EGLDeviceEXT fCreateDeviceANGLE(EGLint device_type, void* native_device, const EGLAttrib* attrib_list) const
         WRAP(   fCreateDeviceANGLE(device_type, native_device, attrib_list) )
 
     EGLBoolean fReleaseDeviceANGLE(EGLDeviceEXT device)
         WRAP(   fReleaseDeviceANGLE(device) )
 
+    void           fANGLEPlatformInitialize(angle::Platform* platform) const
+        VOID_WRAP( fANGLEPlatformInitialize(platform) )
+
+    void fANGLEPlatformShutdown() const
+        VOID_WRAP( fANGLEPlatformShutdown() )
+
 #undef WRAP
 #undef VOID_WRAP
 #undef PROFILE_CALL
 #undef BEFORE_CALL
 #undef AFTER_CALL
 #undef MOZ_FUNCTION_NAME
 
     ////
@@ -490,16 +496,18 @@ private:
                                                                  void* texture,
                                                                  const EGLAttrib* attrib_list);
         // ANGLE_device_creation
         EGLDeviceEXT (GLAPIENTRY * fCreateDeviceANGLE) (EGLint device_type,
                                                         void* native_device,
                                                         const EGLAttrib* attrib_list);
         EGLBoolean (GLAPIENTRY * fReleaseDeviceANGLE) (EGLDeviceEXT device);
 
+        void       (GLAPIENTRY * fANGLEPlatformInitialize)(angle::Platform* platform);
+        void       (GLAPIENTRY * fANGLEPlatformShutdown)();
     } mSymbols;
 
 private:
     bool mInitialized;
     PRLibrary* mEGLLibrary;
     EGLDisplay mEGLDisplay;
     RefPtr<GLContext> mReadbackGL;