summaryrefslogtreecommitdiff
path: root/dom/canvas
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-04-30 21:22:08 +0000
committerMoonchild <moonchild@palemoon.org>2021-04-30 21:22:08 +0000
commit0dd3424f774954627d6f53df9fb47379d9b5c871 (patch)
treed8c303bac59a5bbbbc6c6f5e541a01dec1a5ae49 /dom/canvas
parent5e705bd5059da5b7a39e3a096b7c7f59cb466730 (diff)
downloaduxp-0dd3424f774954627d6f53df9fb47379d9b5c871.tar.gz
Issue #1751 -- Remove XP_MACOSX conditionals from /dom
Diffstat (limited to 'dom/canvas')
-rw-r--r--dom/canvas/WebGL2Context.cpp7
-rw-r--r--dom/canvas/WebGLBuffer.cpp2
-rw-r--r--dom/canvas/WebGLContext.h13
-rw-r--r--dom/canvas/WebGLContextBuffers.cpp16
-rw-r--r--dom/canvas/WebGLContextDraw.cpp7
-rw-r--r--dom/canvas/WebGLContextValidate.cpp12
-rw-r--r--dom/canvas/WebGLProgram.cpp34
-rw-r--r--dom/canvas/WebGLShaderValidator.cpp37
8 files changed, 2 insertions, 126 deletions
diff --git a/dom/canvas/WebGL2Context.cpp b/dom/canvas/WebGL2Context.cpp
index f9a1eba4bf..e88e22e861 100644
--- a/dom/canvas/WebGL2Context.cpp
+++ b/dom/canvas/WebGL2Context.cpp
@@ -126,13 +126,6 @@ WebGLContext::InitWebGL2(FailureReason* const out_failReason)
fnGatherMissing2(gl::GLFeature::occlusion_query_boolean,
gl::GLFeature::occlusion_query);
-#ifdef XP_MACOSX
- // On OSX, GL core profile is used. This requires texture swizzle
- // support to emulate legacy texture formats: ALPHA, LUMINANCE,
- // and LUMINANCE_ALPHA.
- fnGatherMissing(gl::GLFeature::texture_swizzle);
-#endif
-
fnGatherMissing2(gl::GLFeature::prim_restart_fixed,
gl::GLFeature::prim_restart);
diff --git a/dom/canvas/WebGLBuffer.cpp b/dom/canvas/WebGLBuffer.cpp
index 02a8f649fe..11d956c8a4 100644
--- a/dom/canvas/WebGLBuffer.cpp
+++ b/dom/canvas/WebGLBuffer.cpp
@@ -115,7 +115,7 @@ WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, GLenum usa
const ScopedLazyBind lazyBind(gl, target, this);
mContext->InvalidateBufferFetching();
-#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
+#if defined(MOZ_WIDGET_GTK)
// bug 790879
if (gl->WorkAroundDriverBugs() &&
size > INT32_MAX)
diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h
index 0510e6898a..628d4713ca 100644
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -30,10 +30,6 @@
#include "ScopedGLHelpers.h"
#include "TexUnpackBlob.h"
-#ifdef XP_MACOSX
-#include "ForceDiscreteGPUHelperCGL.h"
-#endif
-
// Local
#include "WebGLContextLossHandler.h"
#include "WebGLContextUnchecked.h"
@@ -2015,15 +2011,6 @@ protected:
JSObject* WebGLObjectAsJSObject(JSContext* cx, const WebGLObjectType*,
ErrorResult& rv) const;
-#ifdef XP_MACOSX
- // see bug 713305. This RAII helper guarantees that we're on the discrete GPU, during its lifetime
- // Debouncing note: we don't want to switch GPUs too frequently, so try to not create and destroy
- // these objects at high frequency. Having WebGLContext's hold one such object seems fine,
- // because WebGLContext objects only go away during GC, which shouldn't happen too frequently.
- // If in the future GC becomes much more frequent, we may have to revisit then (maybe use a timer).
- ForceDiscreteGPUHelperCGL mForceDiscreteGPUHelper;
-#endif
-
public:
// console logging helpers
void GenerateWarning(const char* fmt, ...);
diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp
index e787b99143..6f583c10c6 100644
--- a/dom/canvas/WebGLContextBuffers.cpp
+++ b/dom/canvas/WebGLContextBuffers.cpp
@@ -295,16 +295,6 @@ WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer,
////
-#ifdef XP_MACOSX
- if (buffer && buffer->Content() == WebGLBuffer::Kind::Undefined &&
- gl->WorkAroundDriverBugs())
- {
- // BindBufferRange will fail if the buffer's contents is undefined.
- // Bind so driver initializes the buffer.
- gl->fBindBuffer(target, buffer->mGLName);
- }
-#endif
-
gl->fBindBufferRange(target, index, buffer ? buffer->mGLName : 0, offset, size);
////
@@ -352,12 +342,6 @@ WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage)
if (!checkedSize.isValid())
return ErrorOutOfMemory("%s: Size too large for platform.", funcName);
-#if defined(XP_MACOSX)
- if (gl->WorkAroundDriverBugs() && size > 1200000000) {
- return ErrorOutOfMemory("Allocations larger than 1200000000 fail on MacOS.");
- }
-#endif
-
const UniqueBuffer zeroBuffer(calloc(size, 1));
if (!zeroBuffer)
return ErrorOutOfMemory("%s: Failed to allocate zeros.", funcName);
diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp
index fd9ee49579..8e437a07f3 100644
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -1045,13 +1045,6 @@ WebGLContext::WhatDoesVertexAttrib0Need() const
const auto& isAttribArray0Enabled = mBoundVertexArray->mAttribs[0].mEnabled;
bool legacyAttrib0 = gl->IsCompatibilityProfile();
-#ifdef XP_MACOSX
- if (gl->WorkAroundDriverBugs()) {
- // Failures in conformance/attribs/gl-disabled-vertex-attrib.
- // Even in Core profiles on NV. Sigh.
- legacyAttrib0 |= (gl->Vendor() == gl::GLVendor::NVIDIA);
- }
-#endif
if (!legacyAttrib0)
return WebGLVertexAttrib0Status::Default;
diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp
index 30d4c65221..60bb3a32cc 100644
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -695,18 +695,6 @@ WebGLContext::InitAndValidateGL(FailureReason* const out_failReason)
gl->fEnable(LOCAL_GL_PROGRAM_POINT_SIZE);
}
-#ifdef XP_MACOSX
- if (gl->WorkAroundDriverBugs() &&
- gl->Vendor() == gl::GLVendor::ATI &&
- !nsCocoaFeatures::IsAtLeastVersion(10,9))
- {
- // The Mac ATI driver, in all known OSX version up to and including
- // 10.8, renders points sprites upside-down. (Apple bug 11778921)
- gl->fPointParameterf(LOCAL_GL_POINT_SPRITE_COORD_ORIGIN,
- LOCAL_GL_LOWER_LEFT);
- }
-#endif
-
if (gl->IsSupported(gl::GLFeature::seamless_cube_map_opt_in)) {
gl->fEnable(LOCAL_GL_TEXTURE_CUBE_MAP_SEAMLESS);
}
diff --git a/dom/canvas/WebGLProgram.cpp b/dom/canvas/WebGLProgram.cpp
index 9b204358bb..1ff27e1d2f 100644
--- a/dom/canvas/WebGLProgram.cpp
+++ b/dom/canvas/WebGLProgram.cpp
@@ -689,24 +689,6 @@ WebGLProgram::GetFragDataLocation(const nsAString& userName_wide) const
gl->MakeCurrent();
const NS_LossyConvertUTF16toASCII userName(userName_wide);
-#ifdef XP_MACOSX
- if (gl->WorkAroundDriverBugs()) {
- // OSX doesn't return locs for indexed names, just the base names.
- // Indicated by failure in: conformance2/programs/gl-get-frag-data-location.html
- bool isArray;
- size_t arrayIndex;
- nsCString baseUserName;
- if (!ParseName(userName, &baseUserName, &isArray, &arrayIndex))
- return -1;
-
- if (arrayIndex >= mContext->mImplMaxDrawBuffers)
- return -1;
-
- const auto baseLoc = GetFragDataByUserName(this, baseUserName);
- const auto loc = baseLoc + GLint(arrayIndex);
- return loc;
- }
-#endif
return GetFragDataByUserName(this, userName);
}
@@ -770,11 +752,6 @@ WebGLProgram::GetProgramParameter(GLenum pname) const
return JS::BooleanValue(IsLinked());
case LOCAL_GL_VALIDATE_STATUS:
-#ifdef XP_MACOSX
- // See comment in ValidateProgram.
- if (gl->WorkAroundDriverBugs())
- return JS::BooleanValue(true);
-#endif
// Todo: Implement this in our code.
return JS::BooleanValue(bool(GetProgramiv(gl, mGLName, pname)));
@@ -1377,17 +1354,6 @@ WebGLProgram::ValidateProgram() const
{
mContext->MakeContextCurrent();
gl::GLContext* gl = mContext->gl;
-
-#ifdef XP_MACOSX
- // See bug 593867 for NVIDIA and bug 657201 for ATI. The latter is confirmed
- // with Mac OS 10.6.7.
- if (gl->WorkAroundDriverBugs()) {
- mContext->GenerateWarning("validateProgram: Implemented as a no-op on"
- " Mac to work around crashes.");
- return;
- }
-#endif
-
gl->fValidateProgram(mGLName);
}
diff --git a/dom/canvas/WebGLShaderValidator.cpp b/dom/canvas/WebGLShaderValidator.cpp
index bf2df82f71..eadeeb56b0 100644
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -63,34 +63,8 @@ ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
SH_REGENERATE_STRUCT_NAMES;
}
-#ifndef XP_MACOSX
- // We want to do this everywhere, but to do this on Mac, we need
- // to do it only on Mac OSX > 10.6 as this causes the shader
- // compiler in 10.6 to crash
+ // We want to do this everywhere.
options |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
-#endif
-
-#ifdef XP_MACOSX
- if (gl->WorkAroundDriverBugs()) {
- // Work around https://bugs.webkit.org/show_bug.cgi?id=124684,
- // https://chromium.googlesource.com/angle/angle/+/5e70cf9d0b1bb
- options |= SH_UNFOLD_SHORT_CIRCUIT;
-
- // OS X 10.7/10.8 specific:
-
- // Work around bug 665578 and bug 769810
- if (gl->Vendor() == gl::GLVendor::ATI) {
- options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
- }
- // Work around bug 735560
- if (gl->Vendor() == gl::GLVendor::Intel) {
- options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
- }
-
- // Work around that Mac drivers handle struct scopes incorrectly.
- options |= SH_REGENERATE_STRUCT_NAMES;
- }
-#endif
if (resources.MaxExpressionComplexity > 0) {
options |= SH_LIMIT_EXPRESSION_COMPLEXITY;
@@ -187,15 +161,6 @@ WebGLContext::CreateShaderValidator(GLenum shaderType) const
// If underlying GLES doesn't have highp in frag shaders, it should complain anyways.
resources.FragmentPrecisionHigh = mDisableFragHighP ? 0 : 1;
- if (gl->WorkAroundDriverBugs()) {
-#ifdef XP_MACOSX
- if (gl->Vendor() == gl::GLVendor::NVIDIA) {
- // Work around bug 890432
- resources.MaxExpressionComplexity = 1000;
- }
-#endif
- }
-
int compileOptions = webgl::ChooseValidatorCompileOptions(resources, gl);
return webgl::ShaderValidator::Create(shaderType, spec, outputLanguage, resources,
compileOptions);