diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 12:14:29 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 12:14:29 +0200 |
commit | 626eae90f3d468af639ec4fb59cd13d541241d93 (patch) | |
tree | b58e4cf594f04bb80e2019e91a5fff1f460ebb1f | |
parent | 7b46b93c579321a0162457e2dd7ca1be96a0e7ed (diff) | |
download | uxp-626eae90f3d468af639ec4fb59cd13d541241d93.tar.gz |
Adjust ANGLE calls in Goanna for updated API.
-rw-r--r-- | dom/canvas/WebGLContextValidate.cpp | 2 | ||||
-rw-r--r-- | dom/canvas/WebGLShaderValidator.cpp | 50 | ||||
-rw-r--r-- | gfx/gl/GLLibraryEGL.cpp | 7 | ||||
-rw-r--r-- | gfx/gl/GLLibraryEGL.h | 20 |
4 files changed, 28 insertions, 51 deletions
diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp index ebf0aa8c2d..856ad4ee11 100644 --- a/dom/canvas/WebGLContextValidate.cpp +++ b/dom/canvas/WebGLContextValidate.cpp @@ -708,7 +708,7 @@ WebGLContext::InitAndValidateGL(FailureReason* const out_failReason) mBypassShaderValidation = gfxPrefs::WebGLBypassShaderValidator(); // initialize shader translator - if (!ShInitialize()) { + if (!sh::Initialize()) { *out_failReason = { "FEATURE_FAILURE_WEBGL_GLSL", "GLSL translator initialization failed!" }; return false; diff --git a/dom/canvas/WebGLShaderValidator.cpp b/dom/canvas/WebGLShaderValidator.cpp index 80ba359a31..c4854b9fff 100644 --- a/dom/canvas/WebGLShaderValidator.cpp +++ b/dom/canvas/WebGLShaderValidator.cpp @@ -132,7 +132,7 @@ WebGLContext::CreateShaderValidator(GLenum shaderType) const ShBuiltInResources resources; memset(&resources, 0, sizeof(resources)); - ShInitBuiltInResources(&resources); + sh::InitBuiltInResources(&resources); resources.HashFunction = webgl::IdentifierHashFunc; @@ -188,7 +188,7 @@ ShaderValidator::Create(GLenum shaderType, ShShaderSpec spec, const ShBuiltInResources& resources, ShCompileOptions compileOptions) { - ShHandle handle = ShConstructCompiler(shaderType, spec, outputLanguage, &resources); + ShHandle handle = sh::ConstructCompiler(shaderType, spec, outputLanguage, &resources); if (!handle) return nullptr; @@ -197,7 +197,7 @@ ShaderValidator::Create(GLenum shaderType, ShShaderSpec spec, ShaderValidator::~ShaderValidator() { - ShDestruct(mHandle); + sh::Destruct(mHandle); } bool @@ -209,7 +209,7 @@ ShaderValidator::ValidateAndTranslate(const char* source) const char* const parts[] = { source }; - return ShCompile(mHandle, parts, ArrayLength(parts), mCompileOptions); + return sh::Compile(mHandle, parts, ArrayLength(parts), mCompileOptions); } void @@ -217,7 +217,7 @@ ShaderValidator::GetInfoLog(nsACString* out) const { MOZ_ASSERT(mHasRun); - const std::string &log = ShGetInfoLog(mHandle); + const std::string &log = sh::GetInfoLog(mHandle); out->Assign(log.data(), log.length()); } @@ -226,7 +226,7 @@ ShaderValidator::GetOutput(nsACString* out) const { MOZ_ASSERT(mHasRun); - const std::string &output = ShGetObjectCode(mHandle); + const std::string &output = sh::GetObjectCode(mHandle); out->Assign(output.data(), output.length()); } @@ -246,19 +246,19 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log return false; } - const auto shaderVersion = ShGetShaderVersion(mHandle); - if (ShGetShaderVersion(prev->mHandle) != shaderVersion) { + const auto shaderVersion = sh::GetShaderVersion(mHandle); + if (sh::GetShaderVersion(prev->mHandle) != shaderVersion) { nsPrintfCString error("Vertex shader version %d does not match" " fragment shader version %d.", - ShGetShaderVersion(prev->mHandle), - ShGetShaderVersion(mHandle)); + sh::GetShaderVersion(prev->mHandle), + sh::GetShaderVersion(mHandle)); *out_log = error; return false; } { - const std::vector<sh::Uniform>* vertPtr = ShGetUniforms(prev->mHandle); - const std::vector<sh::Uniform>* fragPtr = ShGetUniforms(mHandle); + const std::vector<sh::Uniform>* vertPtr = sh::GetUniforms(prev->mHandle); + const std::vector<sh::Uniform>* fragPtr = sh::GetUniforms(mHandle); if (!vertPtr || !fragPtr) { nsPrintfCString error("Could not create uniform list."); *out_log = error; @@ -309,8 +309,8 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log } } - const auto& vertVaryings = ShGetVaryings(prev->mHandle); - const auto& fragVaryings = ShGetVaryings(mHandle); + const auto& vertVaryings = sh::GetVaryings(prev->mHandle); + const auto& fragVaryings = sh::GetVaryings(mHandle); if (!vertVaryings || !fragVaryings) { nsPrintfCString error("Could not create varying list."); *out_log = error; @@ -362,7 +362,7 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log } } - if (!ShCheckVariablesWithinPackingLimits(mMaxVaryingVectors, + if (!sh::CheckVariablesWithinPackingLimits(mMaxVaryingVectors, staticUseVaryingList)) { *out_log = "Statically used varyings do not fit within packing limits. (see" @@ -424,7 +424,7 @@ ShaderValidator::CalcNumSamplerUniforms() const { size_t accum = 0; - const std::vector<sh::Uniform>& uniforms = *ShGetUniforms(mHandle); + const std::vector<sh::Uniform>& uniforms = *sh::GetUniforms(mHandle); for (auto itr = uniforms.begin(); itr != uniforms.end(); ++itr) { GLenum type = itr->type; @@ -441,7 +441,7 @@ ShaderValidator::CalcNumSamplerUniforms() const size_t ShaderValidator::NumAttributes() const { - return ShGetAttributes(mHandle)->size(); + return sh::GetAttributes(mHandle)->size(); } // Attribs cannot be structs or arrays, and neither can vertex inputs in ES3. @@ -450,7 +450,7 @@ bool ShaderValidator::FindAttribUserNameByMappedName(const std::string& mappedName, const std::string** const out_userName) const { - const std::vector<sh::Attribute>& attribs = *ShGetAttributes(mHandle); + const std::vector<sh::Attribute>& attribs = *sh::GetAttributes(mHandle); for (auto itr = attribs.begin(); itr != attribs.end(); ++itr) { if (itr->mappedName == mappedName) { *out_userName = &(itr->name); @@ -465,7 +465,7 @@ bool ShaderValidator::FindAttribMappedNameByUserName(const std::string& userName, const std::string** const out_mappedName) const { - const std::vector<sh::Attribute>& attribs = *ShGetAttributes(mHandle); + const std::vector<sh::Attribute>& attribs = *sh::GetAttributes(mHandle); for (auto itr = attribs.begin(); itr != attribs.end(); ++itr) { if (itr->name == userName) { *out_mappedName = &(itr->mappedName); @@ -481,7 +481,7 @@ ShaderValidator::FindVaryingByMappedName(const std::string& mappedName, std::string* const out_userName, bool* const out_isArray) const { - const std::vector<sh::Varying>& varyings = *ShGetVaryings(mHandle); + const std::vector<sh::Varying>& varyings = *sh::GetVaryings(mHandle); for (auto itr = varyings.begin(); itr != varyings.end(); ++itr) { const sh::ShaderVariable* found; if (!itr->findInfoByMappedName(mappedName, &found, out_userName)) @@ -498,7 +498,7 @@ bool ShaderValidator::FindVaryingMappedNameByUserName(const std::string& userName, const std::string** const out_mappedName) const { - const std::vector<sh::Varying>& attribs = *ShGetVaryings(mHandle); + const std::vector<sh::Varying>& attribs = *sh::GetVaryings(mHandle); for (auto itr = attribs.begin(); itr != attribs.end(); ++itr) { if (itr->name == userName) { *out_mappedName = &(itr->mappedName); @@ -514,7 +514,7 @@ ShaderValidator::FindUniformByMappedName(const std::string& mappedName, std::string* const out_userName, bool* const out_isArray) const { - const std::vector<sh::Uniform>& uniforms = *ShGetUniforms(mHandle); + const std::vector<sh::Uniform>& uniforms = *sh::GetUniforms(mHandle); for (auto itr = uniforms.begin(); itr != uniforms.end(); ++itr) { const sh::ShaderVariable* found; if (!itr->findInfoByMappedName(mappedName, &found, out_userName)) @@ -526,7 +526,7 @@ ShaderValidator::FindUniformByMappedName(const std::string& mappedName, const size_t dotPos = mappedName.find("."); - const std::vector<sh::InterfaceBlock>& interfaces = *ShGetInterfaceBlocks(mHandle); + const std::vector<sh::InterfaceBlock>& interfaces = *sh::GetInterfaceBlocks(mHandle); for (const auto& interface : interfaces) { std::string mappedFieldName; @@ -574,7 +574,7 @@ bool ShaderValidator::UnmapUniformBlockName(const nsACString& baseMappedName, nsCString* const out_baseUserName) const { - const std::vector<sh::InterfaceBlock>& interfaces = *ShGetInterfaceBlocks(mHandle); + const std::vector<sh::InterfaceBlock>& interfaces = *sh::GetInterfaceBlocks(mHandle); for (const auto& interface : interfaces) { const nsDependentCString interfaceMappedName(interface.mappedName.data(), interface.mappedName.size()); @@ -590,7 +590,7 @@ ShaderValidator::UnmapUniformBlockName(const nsACString& baseMappedName, void ShaderValidator::EnumerateFragOutputs(std::map<nsCString, const nsCString> &out_FragOutputs) const { - const auto* fragOutputs = ShGetOutputVariables(mHandle); + const auto* fragOutputs = sh::GetOutputVariables(mHandle); if (fragOutputs) { for (const auto& fragOutput : *fragOutputs) { diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp index 3d8da30854..d53880f118 100644 --- a/gfx/gl/GLLibraryEGL.cpp +++ b/gfx/gl/GLLibraryEGL.cpp @@ -174,7 +174,7 @@ GetAndInitDisplay(GLLibraryEGL& egl, void* displayType) return display; } -class AngleErrorReporting: public angle::Platform { +class AngleErrorReporting { public: AngleErrorReporting() { @@ -186,7 +186,7 @@ public: mFailureId = aFailureId; } - void logError(const char *errorMessage) override + void logError(const char *errorMessage) { if (!mFailureId) { return; @@ -236,7 +236,6 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl, nsACString* const out_failureI d3d11ANGLE.UserForceEnable("User force-enabled D3D11 ANGLE on disabled hardware"); gAngleErrorReporter.SetFailureId(out_failureId); - egl.fANGLEPlatformInitialize(&gAngleErrorReporter); auto guardShutdown = mozilla::MakeScopeExit([&] { gAngleErrorReporter.SetFailureId(nullptr); @@ -428,8 +427,6 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId // Client exts are ready. (But not display exts!) if (IsExtensionSupported(ANGLE_platform_angle_d3d)) { GLLibraryLoader::SymLoadStruct d3dSymbols[] = { - { (PRFuncPtr*)&mSymbols.fANGLEPlatformInitialize, { "ANGLEPlatformInitialize", nullptr } }, - { (PRFuncPtr*)&mSymbols.fANGLEPlatformShutdown, { "ANGLEPlatformShutdown", nullptr } }, { (PRFuncPtr*)&mSymbols.fGetPlatformDisplayEXT, { "eglGetPlatformDisplayEXT", nullptr } }, { nullptr, { nullptr } } }; diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h index 88fce067ea..f0901f2bea 100644 --- a/gfx/gl/GLLibraryEGL.h +++ b/gfx/gl/GLLibraryEGL.h @@ -504,22 +504,6 @@ public: return ret; } - void fANGLEPlatformInitialize(angle::Platform* platform) - { - MOZ_ASSERT(mSymbols.fANGLEPlatformInitialize); - BEFORE_GL_CALL; - mSymbols.fANGLEPlatformInitialize(platform); - AFTER_GL_CALL; - } - - void fANGLEPlatformShutdown() - { - MOZ_ASSERT(mSymbols.fANGLEPlatformShutdown); - BEFORE_GL_CALL; - mSymbols.fANGLEPlatformShutdown(); - AFTER_GL_CALL; - } - EGLDisplay Display() { MOZ_ASSERT(mInitialized); return mEGLDisplay; @@ -645,10 +629,6 @@ public: typedef EGLint (GLAPIENTRY * pfnDupNativeFenceFDANDROID)(EGLDisplay dpy, EGLSync sync); pfnDupNativeFenceFDANDROID fDupNativeFenceFDANDROID; - typedef void (GLAPIENTRY * pfnANGLEPlatformInitialize)(angle::Platform* platform); - pfnANGLEPlatformInitialize fANGLEPlatformInitialize; - typedef void (GLAPIENTRY * pfnANGLEPlatformShutdown)(); - pfnANGLEPlatformShutdown fANGLEPlatformShutdown; } mSymbols; #ifdef DEBUG |