Title: [270400] trunk/Source/WebCore
Revision
270400
Author
commit-qu...@webkit.org
Date
2020-12-03 11:29:34 -0800 (Thu, 03 Dec 2020)

Log Message

GraphicsContextGL has a couple non-robust getters and other small API problems preventing GPU process implementation
https://bugs.webkit.org/show_bug.cgi?id=219486

Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2020-12-03
Reviewed by Dean Jackson.

Changes GraphicsContextGL and ExtensionsGL to not have duplicate names
and have the correct function signatures.

Changes few remaining GraphicsContextGL getters to use robust GCGLSpan
form.

Changes few robust getters to GCGLSpan form and moves them from
ExtensionsGL to GraphicsContextGL.

Changes GraphicsContextGLOpenGL::getActiveUniforms to return the result
vector instead of taking it as non-const reference. This way the out
vector does not need to be transferred to the GPU process, when the
code is implemented. The call site is also more natural.

Requests GL_EXT_occlusion_query_boolean so that WebGL 2.0 occlusion
queries work when called with gl::GetQueryObjectuivRobustANGLE.

Removes use of mapBufferRange and related functions, changes them to a single
getBufferSubData. If the mapping ever is useful, the more complex
form of API can be added back.

Changes the getInternalformativ call site to check erros similar to other
generic error checking: first clear the errors and then after the call
check if there are new errors. This is slightly less efficient than
using the domain knowledge that the function never returns -1 in the slot.
Current single-value-as-return-value pattern cannot express this. In the
future, GPU process context cannot / will not support passing non-default
in-arrays. In the future, the generic error checking pattern will possibly
be improved, circumventing the need for the -1 domain knowledge case.

Removes getVertexAttrib*v, they are not used.

Removes getAttachedShaders, it is not used.

Removes the vendor-based workarounds from ANGLE ExtensionsGL, it was not
used.

No new tests, a refactor.

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getBufferSubData):
(WebCore::WebGL2RenderingContext::getInternalformatParameter):
(WebCore::WebGL2RenderingContext::vertexAttribI4uiv):
(WebCore::WebGL2RenderingContext::getQueryParameter):
(WebCore::WebGL2RenderingContext::bindSampler):
(WebCore::WebGL2RenderingContext::getSamplerParameter):
(WebCore::WebGL2RenderingContext::clientWaitSync):
(WebCore::WebGL2RenderingContext::deleteTransformFeedback):
(WebCore::WebGL2RenderingContext::beginTransformFeedback):
(WebCore::WebGL2RenderingContext::endTransformFeedback):
(WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
(WebCore::WebGL2RenderingContext::getActiveUniforms):
(WebCore::WebGL2RenderingContext::readPixels):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::readPixels):
* html/canvas/WebGLSync.cpp:
(WebCore::WebGLSync::updateCache):
* platform/graphics/ExtensionsGL.h:
* platform/graphics/GraphicsContextGL.h:
(WebCore::GraphicsContextGL::getInternalformati):
* platform/graphics/GraphicsTypesGL.h:
* platform/graphics/angle/ExtensionsGLANGLE.cpp:
(WebCore::ExtensionsGLANGLE::ExtensionsGLANGLE):
(WebCore::ExtensionsGLANGLE::getGraphicsResetStatusARB):
(WebCore::ExtensionsGLANGLE::getTranslatedShaderSourceANGLE):
(WebCore::ExtensionsGLANGLE::blitFramebufferANGLE):
(WebCore::ExtensionsGLANGLE::renderbufferStorageMultisampleANGLE):
(WebCore::ExtensionsGLANGLE::drawArraysInstancedANGLE):
(WebCore::ExtensionsGLANGLE::drawElementsInstancedANGLE):
(WebCore::ExtensionsGLANGLE::vertexAttribDivisorANGLE):
(WebCore::ExtensionsGLANGLE::getUniformuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformuivRobustANGLE):
* platform/graphics/angle/ExtensionsGLANGLE.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readnPixels):
(WebCore::GraphicsContextGLOpenGL::readnPixelsImpl):
(WebCore::GraphicsContextGLOpenGL::getBufferSubData):
(WebCore::GraphicsContextGLOpenGL::getInternalformativ):
(WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
(WebCore::GraphicsContextGLOpenGL::getQueryObjectui):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameterf):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameteri):
(WebCore::GraphicsContextGLOpenGL::getSynci):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
* platform/graphics/opengl/ExtensionsGLOpenGL.cpp:
(WebCore::ExtensionsGLOpenGL::blitFramebufferANGLE):
(WebCore::ExtensionsGLOpenGL::renderbufferStorageMultisampleANGLE):
(WebCore::ExtensionsGLOpenGL::drawArraysInstancedANGLE):
(WebCore::ExtensionsGLOpenGL::drawElementsInstancedANGLE):
(WebCore::ExtensionsGLOpenGL::vertexAttribDivisorANGLE):
* platform/graphics/opengl/ExtensionsGLOpenGL.h:
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp:
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.h:
* platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:
(WebCore::ExtensionsGLOpenGLES::blitFramebufferANGLE):
(WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisampleANGLE):
(WebCore::ExtensionsGLOpenGLES::drawArraysInstancedANGLE):
(WebCore::ExtensionsGLOpenGLES::drawElementsInstancedANGLE):
(WebCore::ExtensionsGLOpenGLES::vertexAttribDivisorANGLE):
* platform/graphics/opengl/ExtensionsGLOpenGLES.h:
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp:
(WebCore::GraphicsContextGLOpenGL::readnPixels):
* platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
(WebCore::GraphicsContextGLOpenGL::reshape):
(WebCore::GraphicsContextGLOpenGL::blendFunc):
(WebCore::GraphicsContextGLOpenGL::compileShader):
(WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl):
(WebCore::GraphicsContextGLOpenGL::getActiveAttrib):
(WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl):
(WebCore::GraphicsContextGLOpenGL::getActiveUniform):
(WebCore::GraphicsContextGLOpenGL::originalSymbolName):
(WebCore::GraphicsContextGLOpenGL::mappedSymbolName):
(WebCore::GraphicsContextGLOpenGL::deleteVertexArray):
(WebCore::GraphicsContextGLOpenGL::isVertexArray):
(WebCore::GraphicsContextGLOpenGL::getNonBuiltInActiveSymbolCount):
(WebCore::GraphicsContextGLOpenGL::getUnmangledInfoLog):
(WebCore::GraphicsContextGLOpenGL::getProgramInfoLog):
(WebCore::GraphicsContextGLOpenGL::getShaderi):
(WebCore::GraphicsContextGLOpenGL::getShaderInfoLog):
(WebCore::GraphicsContextGLOpenGL::getShaderSource):
(WebCore::GraphicsContextGLOpenGL::drawArraysInstanced):
(WebCore::GraphicsContextGLOpenGL::drawElementsInstanced):
(WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor):
(WebCore::GraphicsContextGLOpenGL::getBufferSubData):
(WebCore::GraphicsContextGLOpenGL::getInternalformativ):
(WebCore::GraphicsContextGLOpenGL::getQueryObjectui):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameterf):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameteri):
(WebCore::GraphicsContextGLOpenGL::getSynci):
(WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
(WebCore::GraphicsContextGLOpenGL::getUniformBlockIndex):
(WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):
(WebCore::GraphicsContextGLOpenGL::uniformBlockBinding):
(WebCore::GraphicsContextGLOpenGL::readnPixels):
* platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
(WebCore::GraphicsContextGLOpenGL::readnPixels):
(WebCore::GraphicsContextGLOpenGL::reshapeFBOs):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270399 => 270400)


--- trunk/Source/WebCore/ChangeLog	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/ChangeLog	2020-12-03 19:29:34 UTC (rev 270400)
@@ -1,3 +1,154 @@
+2020-12-03  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        GraphicsContextGL has a couple non-robust getters and other small API problems preventing GPU process implementation
+        https://bugs.webkit.org/show_bug.cgi?id=219486
+
+        Reviewed by Dean Jackson.
+
+        Changes GraphicsContextGL and ExtensionsGL to not have duplicate names
+        and have the correct function signatures.
+
+        Changes few remaining GraphicsContextGL getters to use robust GCGLSpan
+        form.
+
+        Changes few robust getters to GCGLSpan form and moves them from
+        ExtensionsGL to GraphicsContextGL.
+
+        Changes GraphicsContextGLOpenGL::getActiveUniforms to return the result
+        vector instead of taking it as non-const reference. This way the out
+        vector does not need to be transferred to the GPU process, when the
+        code is implemented. The call site is also more natural.
+
+        Requests GL_EXT_occlusion_query_boolean so that WebGL 2.0 occlusion
+        queries work when called with gl::GetQueryObjectuivRobustANGLE.
+
+        Removes use of mapBufferRange and related functions, changes them to a single
+        getBufferSubData. If the mapping ever is useful, the more complex
+        form of API can be added back.
+
+        Changes the getInternalformativ call site to check erros similar to other
+        generic error checking: first clear the errors and then after the call
+        check if there are new errors. This is slightly less efficient than
+        using the domain knowledge that the function never returns -1 in the slot.
+        Current single-value-as-return-value pattern cannot express this. In the
+        future, GPU process context cannot / will not support passing non-default
+        in-arrays. In the future, the generic error checking pattern will possibly
+        be improved, circumventing the need for the -1 domain knowledge case.
+
+        Removes getVertexAttrib*v, they are not used.
+
+        Removes getAttachedShaders, it is not used.
+
+        Removes the vendor-based workarounds from ANGLE ExtensionsGL, it was not
+        used.
+
+        No new tests, a refactor.
+
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::getBufferSubData):
+        (WebCore::WebGL2RenderingContext::getInternalformatParameter):
+        (WebCore::WebGL2RenderingContext::vertexAttribI4uiv):
+        (WebCore::WebGL2RenderingContext::getQueryParameter):
+        (WebCore::WebGL2RenderingContext::bindSampler):
+        (WebCore::WebGL2RenderingContext::getSamplerParameter):
+        (WebCore::WebGL2RenderingContext::clientWaitSync):
+        (WebCore::WebGL2RenderingContext::deleteTransformFeedback):
+        (WebCore::WebGL2RenderingContext::beginTransformFeedback):
+        (WebCore::WebGL2RenderingContext::endTransformFeedback):
+        (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
+        (WebCore::WebGL2RenderingContext::getActiveUniforms):
+        (WebCore::WebGL2RenderingContext::readPixels):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::readPixels):
+        * html/canvas/WebGLSync.cpp:
+        (WebCore::WebGLSync::updateCache):
+        * platform/graphics/ExtensionsGL.h:
+        * platform/graphics/GraphicsContextGL.h:
+        (WebCore::GraphicsContextGL::getInternalformati):
+        * platform/graphics/GraphicsTypesGL.h:
+        * platform/graphics/angle/ExtensionsGLANGLE.cpp:
+        (WebCore::ExtensionsGLANGLE::ExtensionsGLANGLE):
+        (WebCore::ExtensionsGLANGLE::getGraphicsResetStatusARB):
+        (WebCore::ExtensionsGLANGLE::getTranslatedShaderSourceANGLE):
+        (WebCore::ExtensionsGLANGLE::blitFramebufferANGLE):
+        (WebCore::ExtensionsGLANGLE::renderbufferStorageMultisampleANGLE):
+        (WebCore::ExtensionsGLANGLE::drawArraysInstancedANGLE):
+        (WebCore::ExtensionsGLANGLE::drawElementsInstancedANGLE):
+        (WebCore::ExtensionsGLANGLE::vertexAttribDivisorANGLE):
+        (WebCore::ExtensionsGLANGLE::getUniformuivRobustANGLE):
+        (WebCore::ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE):
+        (WebCore::ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE):
+        (WebCore::ExtensionsGLANGLE::getnUniformfvRobustANGLE):
+        (WebCore::ExtensionsGLANGLE::getnUniformivRobustANGLE):
+        (WebCore::ExtensionsGLANGLE::getnUniformuivRobustANGLE):
+        * platform/graphics/angle/ExtensionsGLANGLE.h:
+        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+        (WebCore::GraphicsContextGLOpenGL::readnPixels):
+        (WebCore::GraphicsContextGLOpenGL::readnPixelsImpl):
+        (WebCore::GraphicsContextGLOpenGL::getBufferSubData):
+        (WebCore::GraphicsContextGLOpenGL::getInternalformativ):
+        (WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
+        (WebCore::GraphicsContextGLOpenGL::getQueryObjectui):
+        (WebCore::GraphicsContextGLOpenGL::getSamplerParameterf):
+        (WebCore::GraphicsContextGLOpenGL::getSamplerParameteri):
+        (WebCore::GraphicsContextGLOpenGL::getSynci):
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+        * platform/graphics/opengl/ExtensionsGLOpenGL.cpp:
+        (WebCore::ExtensionsGLOpenGL::blitFramebufferANGLE):
+        (WebCore::ExtensionsGLOpenGL::renderbufferStorageMultisampleANGLE):
+        (WebCore::ExtensionsGLOpenGL::drawArraysInstancedANGLE):
+        (WebCore::ExtensionsGLOpenGL::drawElementsInstancedANGLE):
+        (WebCore::ExtensionsGLOpenGL::vertexAttribDivisorANGLE):
+        * platform/graphics/opengl/ExtensionsGLOpenGL.h:
+        * platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp:
+        * platform/graphics/opengl/ExtensionsGLOpenGLCommon.h:
+        * platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:
+        (WebCore::ExtensionsGLOpenGLES::blitFramebufferANGLE):
+        (WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisampleANGLE):
+        (WebCore::ExtensionsGLOpenGLES::drawArraysInstancedANGLE):
+        (WebCore::ExtensionsGLOpenGLES::drawElementsInstancedANGLE):
+        (WebCore::ExtensionsGLOpenGLES::vertexAttribDivisorANGLE):
+        * platform/graphics/opengl/ExtensionsGLOpenGLES.h:
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+        * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp:
+        (WebCore::GraphicsContextGLOpenGL::readnPixels):
+        * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
+        (WebCore::GraphicsContextGLOpenGL::reshape):
+        (WebCore::GraphicsContextGLOpenGL::blendFunc):
+        (WebCore::GraphicsContextGLOpenGL::compileShader):
+        (WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl):
+        (WebCore::GraphicsContextGLOpenGL::getActiveAttrib):
+        (WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl):
+        (WebCore::GraphicsContextGLOpenGL::getActiveUniform):
+        (WebCore::GraphicsContextGLOpenGL::originalSymbolName):
+        (WebCore::GraphicsContextGLOpenGL::mappedSymbolName):
+        (WebCore::GraphicsContextGLOpenGL::deleteVertexArray):
+        (WebCore::GraphicsContextGLOpenGL::isVertexArray):
+        (WebCore::GraphicsContextGLOpenGL::getNonBuiltInActiveSymbolCount):
+        (WebCore::GraphicsContextGLOpenGL::getUnmangledInfoLog):
+        (WebCore::GraphicsContextGLOpenGL::getProgramInfoLog):
+        (WebCore::GraphicsContextGLOpenGL::getShaderi):
+        (WebCore::GraphicsContextGLOpenGL::getShaderInfoLog):
+        (WebCore::GraphicsContextGLOpenGL::getShaderSource):
+        (WebCore::GraphicsContextGLOpenGL::drawArraysInstanced):
+        (WebCore::GraphicsContextGLOpenGL::drawElementsInstanced):
+        (WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor):
+        (WebCore::GraphicsContextGLOpenGL::getBufferSubData):
+        (WebCore::GraphicsContextGLOpenGL::getInternalformativ):
+        (WebCore::GraphicsContextGLOpenGL::getQueryObjectui):
+        (WebCore::GraphicsContextGLOpenGL::getSamplerParameterf):
+        (WebCore::GraphicsContextGLOpenGL::getSamplerParameteri):
+        (WebCore::GraphicsContextGLOpenGL::getSynci):
+        (WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
+        (WebCore::GraphicsContextGLOpenGL::getUniformBlockIndex):
+        (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):
+        (WebCore::GraphicsContextGLOpenGL::uniformBlockBinding):
+        (WebCore::GraphicsContextGLOpenGL::readnPixels):
+        * platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
+        (WebCore::GraphicsContextGLOpenGL::readnPixels):
+        (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
+
 2020-12-03  Aditya Keerthi  <akeer...@apple.com>
 
         [iOS][FCR] Add new look for search fields

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (270399 => 270400)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -681,17 +681,8 @@
     if (!copyLength)
         return;
 
-    m_context->moveErrorsToSyntheticErrorList();
-#if PLATFORM(COCOA)
     // FIXME: Coalesce multiple getBufferSubData() calls to use a single map() call
-    void* ptr = m_context->mapBufferRange(target, checkedSrcByteOffset.unsafeGet(), static_cast<GCGLsizeiptr>(checkedCopyLengthPtr.unsafeGet() * checkedElementSize.unsafeGet()), GraphicsContextGL::MAP_READ_BIT);
-    if (ptr)
-        memcpy(static_cast<char*>(dstData->baseAddress()) + dstData->byteOffset() + dstOffset * elementSize, ptr, copyLength * elementSize);
-
-    if (!m_context->unmapBuffer(target))
-        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getBufferSubData", "Failed while unmapping buffer");
-#endif
-    m_context->moveErrorsToSyntheticErrorList();
+    m_context->getBufferSubData(target, srcByteOffset, makeGCGLSpan(static_cast<char*>(dstData->baseAddress()) + dstData->byteOffset() + dstOffset * elementSize, copyLength * elementSize));
 }
 
 void WebGL2RenderingContext::bindFramebuffer(GCGLenum target, WebGLFramebuffer* buffer)
@@ -832,25 +823,19 @@
         return nullptr;
     }
 
-    int numValues = -1;
 #if USE(OPENGL_ES) || USE(ANGLE)
-    m_context->getInternalformativ(target, internalformat, GraphicsContextGL::NUM_SAMPLE_COUNTS, 1, &numValues);
-    if (numValues < 0) {
-        // Assume the getInternalformativ call failed; return null from the SAMPLES query.
+    m_context->moveErrorsToSyntheticErrorList();
+    GCGLint numValues = m_context->getInternalformati(target, internalformat, GraphicsContextGL::NUM_SAMPLE_COUNTS);
+    if (m_context->moveErrorsToSyntheticErrorList() || numValues < 0)
         return nullptr;
-    }
 
     // Integer formats do not support multisampling, so numValues == 0 may occur.
 
     Vector<GCGLint> params(numValues);
     if (numValues > 0) {
-        // Add a sentinel to know whether the call succeeded without additionally checking OpenGL errors.
-        params[0] = -1;
-        m_context->getInternalformativ(target, internalformat, pname, numValues, params.data());
-        if (params[0] == -1) {
-            // The getInternalformativ call failed; return null from the SAMPLES query.
+        m_context->getInternalformativ(target, internalformat, pname, params);
+        if (m_context->moveErrorsToSyntheticErrorList())
             return nullptr;
-        }
     }
 #else
     // On desktop OpenGL 4.1 or below we must emulate glGetInternalformativ.
@@ -879,13 +864,13 @@
 
     // Since multisampling is not supported for signed and unsigned integer internal formats,
     // the value of GL_NUM_SAMPLE_COUNTS will be zero for such formats.
-    numValues = isIntegerFormat(internalformat) ? 0 : samples.size();
+    GCGLint numValues = isIntegerFormat(internalformat) ? 0 : samples.size();
     Vector<GCGLint> params(numValues);
     for (size_t i = 0; i < static_cast<size_t>(numValues); ++i)
         params[i] = samples[i];
 #endif
 
-    return Int32Array::tryCreate(params.data(), numValues);
+    return Int32Array::tryCreate(params.data(), params.size());
 }
 
 void WebGL2RenderingContext::invalidateFramebuffer(GCGLenum target, const Vector<GCGLenum>& attachments)
@@ -1967,9 +1952,7 @@
         return nullptr;
     }
 
-    unsigned result = 0;
-    m_context->getQueryObjectuiv(query.object(), pname, &result);
-    return result;
+    return static_cast<unsigned>(m_context->getQueryObjectui(query.object(), pname));
 }
 
 RefPtr<WebGLSampler> WebGL2RenderingContext::createSampler()
@@ -2059,17 +2042,11 @@
     case GraphicsContextGL::TEXTURE_MIN_FILTER:
     case GraphicsContextGL::TEXTURE_WRAP_R:
     case GraphicsContextGL::TEXTURE_WRAP_S:
-    case GraphicsContextGL::TEXTURE_WRAP_T: {
-        int value = 0;
-        m_context->getSamplerParameteriv(sampler.object(), pname, &value);
-        return value;
-    }
+    case GraphicsContextGL::TEXTURE_WRAP_T:
+        return m_context->getSamplerParameteri(sampler.object(), pname);
     case GraphicsContextGL::TEXTURE_MAX_LOD:
-    case GraphicsContextGL::TEXTURE_MIN_LOD: {
-        float value = 0;
-        m_context->getSamplerParameterfv(sampler.object(), pname, &value);
-        return value;
-    }
+    case GraphicsContextGL::TEXTURE_MIN_LOD:
+        return m_context->getSamplerParameterf(sampler.object(), pname);
     default:
         synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getSamplerParameter", "Invalid pname");
         return nullptr;
@@ -2485,24 +2462,24 @@
     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getActiveUniforms", &program))
         return nullptr;
 
-    Vector<GCGLint> result(uniformIndices.size(), 0);
-    
     switch (pname) {
-    case GraphicsContextGL::UNIFORM_TYPE:
-        m_context->getActiveUniforms(program.object(), uniformIndices, pname, result);
+    case GraphicsContextGL::UNIFORM_TYPE: {
+        auto result = m_context->getActiveUniforms(program.object(), uniformIndices, pname);
         return result.map([](auto x) { return static_cast<GCGLenum>(x); });
-    case GraphicsContextGL::UNIFORM_SIZE:
-        m_context->getActiveUniforms(program.object(), uniformIndices, pname, result);
+    }
+    case GraphicsContextGL::UNIFORM_SIZE: {
+        auto result = m_context->getActiveUniforms(program.object(), uniformIndices, pname);
         return result.map([](auto x) { return static_cast<GCGLuint>(x); });
+    }
     case GraphicsContextGL::UNIFORM_BLOCK_INDEX:
     case GraphicsContextGL::UNIFORM_OFFSET:
     case GraphicsContextGL::UNIFORM_ARRAY_STRIDE:
     case GraphicsContextGL::UNIFORM_MATRIX_STRIDE:
-        m_context->getActiveUniforms(program.object(), uniformIndices, pname, result);
-        return WTFMove(result);
-    case GraphicsContextGL::UNIFORM_IS_ROW_MAJOR:
-        m_context->getActiveUniforms(program.object(), uniformIndices, pname, result);
+        return m_context->getActiveUniforms(program.object(), uniformIndices, pname);
+    case GraphicsContextGL::UNIFORM_IS_ROW_MAJOR: {
+        auto result = m_context->getActiveUniforms(program.object(), uniformIndices, pname);
         return result.map([](auto x) { return static_cast<bool>(x); });
+    }
     default:
         synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getActiveUniforms", "invalid parameter name");
         return nullptr;
@@ -3572,8 +3549,7 @@
 
     clearIfComposited(ClearCallerOther);
 
-    GCGLsizei length, columns, rows;
-    m_context->getExtensions().readnPixelsRobustANGLE(x, y, width, height, format, type, 0, &length, &columns, &rows, reinterpret_cast<uint8_t*>(offset), true);
+    m_context->readnPixels(x, y, width, height, format, type, offset);
 }
 
 void WebGL2RenderingContext::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, ArrayBufferView& dstData, GCGLuint dstOffset)

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (270399 => 270400)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -4395,15 +4395,12 @@
     void* data = ""
 
 #if USE(ANGLE)
-    GCGLsizei length = 0;
-    GCGLsizei columns = 0;
-    GCGLsizei rows = 0;
-    m_context->getExtensions().readnPixelsRobustANGLE(x, y, width, height, format, type, pixels.byteLength(), &length, &columns, &rows, data, false);
+    m_context->readnPixels(x, y, width, height, format, type, makeGCGLSpan(data, pixels.byteLength()));
 #else
     if (m_isRobustnessEXTSupported)
         m_context->getExtensions().readnPixelsEXT(x, y, width, height, format, type, pixels.byteLength(), data);
     else
-        m_context->readPixels(x, y, width, height, format, type, data);
+        m_context->readnPixels(x, y, width, height, format, type, makeGCGLSpan(data, pixels.byteLength()));
 #endif
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGLSync.cpp (270399 => 270400)


--- trunk/Source/WebCore/html/canvas/WebGLSync.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/html/canvas/WebGLSync.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -71,7 +71,7 @@
         return;
 
     m_allowCacheUpdate = false;
-    context.graphicsContextGL()->getSynciv(m_sync, GraphicsContextGL::SYNC_STATUS, sizeof(m_syncStatus), &m_syncStatus);
+    m_syncStatus = context.graphicsContextGL()->getSynci(m_sync, GraphicsContextGL::SYNC_STATUS);
     if (m_syncStatus == GraphicsContextGL::UNSIGNALED)
         scheduleAllowCacheUpdate(context);
 }

Modified: trunk/Source/WebCore/platform/graphics/ExtensionsGL.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/ExtensionsGL.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/ExtensionsGL.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -279,10 +279,10 @@
     virtual GCGLint getGraphicsResetStatusARB() = 0;
 
     // GL_ANGLE_framebuffer_blit
-    virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) = 0;
+    virtual void blitFramebufferANGLE(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter) = 0;
 
     // GL_ANGLE_framebuffer_multisample
-    virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) = 0;
+    virtual void renderbufferStorageMultisampleANGLE(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) = 0;
 
     // GL_OES_vertex_array_object
     virtual PlatformGLObject createVertexArrayOES() = 0;
@@ -296,15 +296,15 @@
     // GL_EXT_debug_marker
     virtual void insertEventMarkerEXT(const String&) = 0;
     virtual void pushGroupMarkerEXT(const String&) = 0;
-    virtual void popGroupMarkerEXT(void) = 0;
+    virtual void popGroupMarkerEXT() = 0;
 
     // GL_ARB_draw_buffers / GL_EXT_draw_buffers
     virtual void drawBuffersEXT(GCGLSpan<const GCGLenum> bufs) = 0;
 
     // GL_ANGLE_instanced_arrays
-    virtual void drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) = 0;
-    virtual void drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount) = 0;
-    virtual void vertexAttribDivisor(GCGLuint index, GCGLuint divisor) = 0;
+    virtual void drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) = 0;
+    virtual void drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount) = 0;
+    virtual void vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor) = 0;
 
     // GL_ANGLE_robust_client_memory
     virtual void readPixelsRobustANGLE(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei* length, GCGLsizei* columns, GCGLsizei* rows, GCGLvoid* pixels) = 0;
@@ -314,7 +314,6 @@
     virtual void getQueryivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLint* params) = 0;
     virtual void getQueryObjectuivRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLuint* params) = 0;
     virtual void getBufferPointervRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLvoid** params) = 0;
-    virtual void getInternalformativRobustANGLE(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLint* params) = 0;
     virtual void getVertexAttribIivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLint* params) = 0;
     virtual void getVertexAttribIuivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLuint* params) = 0;
     virtual void getUniformuivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei* length, GCGLuint* params) = 0;
@@ -332,7 +331,6 @@
     virtual void getTexLevelParameterfvRobustANGLE(GCGLenum target, GCGLint level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLfloat* params) = 0;
 
     virtual void getPointervRobustANGLERobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei* length, GCGLvoid** params) = 0;
-    virtual void readnPixelsRobustANGLE(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei* length, GCGLsizei* columns, GCGLsizei* rows, GCGLvoid* data, bool readingToPixelBufferObject) = 0;
     virtual void getnUniformfvRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei* length, GCGLfloat* params) = 0;
     virtual void getnUniformivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei* length, GCGLint* params) = 0;
     virtual void getnUniformuivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei* length, GCGLuint* params) = 0;
@@ -355,7 +353,6 @@
     virtual void readnPixelsEXT(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLvoid* data) = 0;
     virtual void getnUniformfvEXT(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLfloat* params) = 0;
     virtual void getnUniformivEXT(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLint* params) = 0;
-#endif
 
     virtual bool isNVIDIA() = 0;
     virtual bool isAMD() = 0;
@@ -367,6 +364,7 @@
     // that must be avoided. Ports should implement these flags on such configurations.
     virtual bool requiresBuiltInFunctionEmulation() = 0;
     virtual bool requiresRestrictedMaximumTextureSize() = 0;
+#endif
 
 };
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -978,7 +978,6 @@
 
     virtual bool getActiveAttrib(PlatformGLObject program, GCGLuint index, ActiveInfo&) = 0;
     virtual bool getActiveUniform(PlatformGLObject program, GCGLuint index, ActiveInfo&) = 0;
-    virtual void getAttachedShaders(PlatformGLObject program, GCGLsizei maxCount, GCGLsizei* count, PlatformGLObject* shaders) = 0;
 
     virtual GCGLint getAttribLocation(PlatformGLObject, const String& name) = 0;
 
@@ -1023,10 +1022,6 @@
 
     virtual GCGLint getUniformLocation(PlatformGLObject, const String& name) = 0;
 
-    // getVertexAttrib
-    virtual void getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLfloat> value) = 0;
-    virtual void getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLint> value) = 0;
-
     virtual GCGLsizeiptr getVertexAttribOffset(GCGLuint index, GCGLenum pname) = 0;
 
     virtual void hint(GCGLenum target, GCGLenum mode) = 0;
@@ -1098,7 +1093,8 @@
     virtual void bufferData(GCGLenum target, GCGLSpan<const GCGLvoid> data, GCGLenum usage) = 0;
     virtual void bufferSubData(GCGLenum target, GCGLintptr offset, GCGLSpan<const GCGLvoid> data) = 0;
 
-    virtual void readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLvoid* data) = 0;
+    virtual void readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLSpan<GCGLvoid> data) = 0;
+    virtual void readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLintptr offset) = 0;
 
     virtual void texImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type,  GCGLSpan<const GCGLvoid> pixels) = 0;
     virtual void texImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, GCGLintptr offset) = 0;
@@ -1122,8 +1118,7 @@
     // ========== WebGL 2 entry points.
 
     virtual void copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size) = 0;
-    virtual GCGLvoid* mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access) = 0;
-    virtual GCGLboolean unmapBuffer(GCGLenum target) = 0;
+    virtual void getBufferSubData(GCGLenum target, GCGLintptr offset, GCGLSpan<GCGLvoid> data) = 0;
 
     virtual void blitFramebuffer(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter) = 0;
     virtual void framebufferTextureLayer(GCGLenum target, GCGLenum attachment, PlatformGLObject texture, GCGLint level, GCGLint layer) = 0;
@@ -1132,7 +1127,7 @@
     virtual void readBuffer(GCGLenum src) = 0;
 
     // getInternalFormatParameter
-    virtual void getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLint* params) = 0;
+    virtual void getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> data) = 0;
     virtual void renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) = 0;
 
     virtual void texStorage2D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) = 0;
@@ -1185,7 +1180,7 @@
     virtual void endQuery(GCGLenum target) = 0;
     virtual PlatformGLObject getQuery(GCGLenum target, GCGLenum pname) = 0;
     // getQueryParameter
-    virtual void getQueryObjectuiv(PlatformGLObject query, GCGLenum pname, GCGLuint* value) = 0;
+    virtual GCGLuint getQueryObjectui(PlatformGLObject query, GCGLenum pname) = 0;
 
     virtual PlatformGLObject createSampler() = 0;
     virtual void deleteSampler(PlatformGLObject sampler) = 0;
@@ -1194,8 +1189,8 @@
     virtual void samplerParameteri(PlatformGLObject sampler, GCGLenum pname, GCGLint param) = 0;
     virtual void samplerParameterf(PlatformGLObject sampler, GCGLenum pname, GCGLfloat param) = 0;
     // getSamplerParameter
-    virtual void getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value) = 0;
-    virtual void getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value) = 0;
+    virtual GCGLfloat getSamplerParameterf(PlatformGLObject sampler, GCGLenum pname) = 0;
+    virtual GCGLint getSamplerParameteri(PlatformGLObject sampler, GCGLenum pname) = 0;
 
     virtual GCGLsync fenceSync(GCGLenum condition, GCGLbitfield flags) = 0;
     virtual GCGLboolean isSync(GCGLsync) = 0;
@@ -1203,7 +1198,7 @@
     virtual GCGLenum clientWaitSync(GCGLsync, GCGLbitfield flags, GCGLuint64 timeout) = 0;
     virtual void waitSync(GCGLsync, GCGLbitfield flags, GCGLint64 timeout) = 0;
     // getSyncParameter
-    virtual void getSynciv(GCGLsync, GCGLenum pname, GCGLsizei bufSize, GCGLint* value) = 0;
+    virtual GCGLint getSynci(GCGLsync, GCGLenum pname) = 0;
 
     virtual PlatformGLObject createTransformFeedback() = 0;
     virtual void deleteTransformFeedback(PlatformGLObject id) = 0;
@@ -1220,7 +1215,7 @@
     virtual void bindBufferRange(GCGLenum target, GCGLuint index, PlatformGLObject buffer, GCGLintptr offset, GCGLsizeiptr size) = 0;
     // getIndexedParameter -> use getParameter calls above.
     virtual Vector<GCGLuint> getUniformIndices(PlatformGLObject program, const Vector<String>& uniformNames) = 0;
-    virtual void getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname, Vector<GCGLint>& params) = 0;
+    virtual Vector<GCGLint> getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname) = 0;
 
     virtual GCGLuint getUniformBlockIndex(PlatformGLObject program, const String& uniformBlockName) = 0;
     // getActiveUniformBlockParameter
@@ -1234,6 +1229,7 @@
     GCGLboolean getBoolean(GCGLenum pname);
     GCGLint getInteger(GCGLenum pname);
     GCGLint getActiveUniformBlocki(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname);
+    GCGLint getInternalformati(GCGLenum target, GCGLenum internalformat, GCGLenum pname);
 
     GraphicsContextGLAttributes contextAttributes() const { return m_attrs; }
     void setContextAttributes(const GraphicsContextGLAttributes& attrs) { m_attrs = attrs; }
@@ -1392,7 +1388,14 @@
     return value[0];
 }
 
+inline GCGLint GraphicsContextGL::getInternalformati(GCGLenum target, GCGLenum internalformat, GCGLenum pname)
+{
+    GCGLint value[1] { };
+    getInternalformativ(target, internalformat, pname, value);
+    return value[0];
+}
 
+
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypesGL.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/GraphicsTypesGL.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypesGL.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -51,7 +51,9 @@
 typedef unsigned long long GCGLuint64;
 typedef struct __GLsync* GCGLsync;
 typedef void GCGLvoid;
+typedef intptr_t GCGLvoidptr;
 
+
 typedef GCGLuint PlatformGLObject;
 
 #if !PLATFORM(COCOA)

Modified: trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -46,28 +46,8 @@
 ExtensionsGLANGLE::ExtensionsGLANGLE(GraphicsContextGLOpenGL* context, bool useIndexedGetString)
     : m_initializedAvailableExtensions(false)
     , m_context(context)
-    , m_isNVIDIA(false)
-    , m_isAMD(false)
-    , m_isIntel(false)
-    , m_isImagination(false)
-    , m_requiresBuiltInFunctionEmulation(false)
-    , m_requiresRestrictedMaximumTextureSize(false)
     , m_useIndexedGetString(useIndexedGetString)
 {
-    // FIXME: ideally, remove this initialization altogether. ANGLE
-    // subsumes the responsibility for graphics driver workarounds.
-    m_vendor = String(reinterpret_cast<const char*>(gl::GetString(GL_VENDOR)));
-    m_renderer = String(reinterpret_cast<const char*>(gl::GetString(GL_RENDERER)));
-
-    Vector<String> vendorComponents = m_vendor.convertToASCIILowercase().split(' ');
-    if (vendorComponents.contains("nvidia"))
-        m_isNVIDIA = true;
-    if (vendorComponents.contains("ati") || vendorComponents.contains("amd"))
-        m_isAMD = true;
-    if (vendorComponents.contains("intel"))
-        m_isIntel = true;
-    if (vendorComponents.contains("imagination"))
-        m_isImagination = true;
 }
 
 ExtensionsGLANGLE::~ExtensionsGLANGLE() = default;
@@ -103,7 +83,7 @@
     return m_availableExtensions.contains(name) || m_enabledExtensions.contains(name);
 }
 
-int ExtensionsGLANGLE::getGraphicsResetStatusARB()
+GLint ExtensionsGLANGLE::getGraphicsResetStatusARB()
 {
     return GraphicsContextGL::NO_ERROR;
 }
@@ -114,10 +94,11 @@
         return String();
 
     int sourceLength = m_context->getShaderi(shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE);
+
     if (!sourceLength)
         return emptyString();
     Vector<GLchar> name(sourceLength); // GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE includes null termination.
-    int returnedLength = 0;
+    GCGLint returnedLength = 0;
     gl::GetTranslatedShaderSourceANGLE(shader, sourceLength, &returnedLength, name.data());
     if (!returnedLength)
         return emptyString();
@@ -147,7 +128,7 @@
     m_initializedAvailableExtensions = true;
 }
 
-void ExtensionsGLANGLE::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
+void ExtensionsGLANGLE::blitFramebufferANGLE(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter)
 {
     // FIXME: consider adding support for APPLE_framebuffer_multisample.
     if (!m_context->makeContextCurrent())
@@ -156,7 +137,7 @@
     gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
 }
 
-void ExtensionsGLANGLE::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
+void ExtensionsGLANGLE::renderbufferStorageMultisampleANGLE(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -235,7 +216,7 @@
     gl::DrawBuffersEXT(bufs.bufSize, bufs.data);
 }
 
-void ExtensionsGLANGLE::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
+void ExtensionsGLANGLE::drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -243,15 +224,15 @@
     gl::DrawArraysInstancedANGLE(mode, first, count, primcount);
 }
 
-void ExtensionsGLANGLE::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount)
+void ExtensionsGLANGLE::drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount)
 {
     if (!m_context->makeContextCurrent())
         return;
 
-    gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);
+    gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(offset), primcount);
 }
 
-void ExtensionsGLANGLE::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
+void ExtensionsGLANGLE::vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -326,14 +307,6 @@
     gl::GetBufferPointervRobustANGLE(target, pname, bufSize, length, params);
 }
 
-void ExtensionsGLANGLE::getInternalformativRobustANGLE(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
-{
-    if (!m_context->makeContextCurrent())
-        return;
-
-    gl::GetInternalformativRobustANGLE(target, internalformat, pname, bufSize, length, params);
-}
-
 void ExtensionsGLANGLE::getVertexAttribIivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
 {
     if (!m_context->makeContextCurrent())
@@ -350,7 +323,7 @@
     gl::GetVertexAttribIuivRobustANGLE(index, pname, bufSize, length, params);
 }
 
-void ExtensionsGLANGLE::getUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
+void ExtensionsGLANGLE::getUniformuivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -431,7 +404,7 @@
     gl::GetMultisamplefvRobustANGLE(pname, index, bufSize, length, val);
 }
 
-void ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE(GCGLenum target, int level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
+void ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE(GCGLenum target, GCGLint level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -439,7 +412,7 @@
     gl::GetTexLevelParameterivRobustANGLE(target, level, pname, bufSize, length, params);
 }
 
-void ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE(GCGLenum target, int level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
+void ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE(GCGLenum target, GCGLint level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -456,63 +429,15 @@
     gl::GetPointervRobustANGLERobustANGLE(pname, bufSize, length, params);
 }
 
-#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
-static void wipeAlphaChannelFromPixels(int width, int height, unsigned char* pixels)
+void ExtensionsGLANGLE::getnUniformfvRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
 {
-    // We can assume this doesn't overflow because the calling functions
-    // use checked arithmetic.
-    int totalBytes = width * height * 4;
-    for (int i = 0; i < totalBytes; i += 4)
-        pixels[i + 3] = 255;
-}
-#endif
-
-void ExtensionsGLANGLE::readnPixelsRobustANGLE(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei *length, GCGLsizei *columns, GCGLsizei *rows, void *data, bool readingToPixelBufferObject)
-{
     if (!m_context->makeContextCurrent())
         return;
 
-    // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
-    // all previous rendering calls should be done before reading pixels.
-    gl::Flush();
-    auto attrs = m_context->contextAttributes();
-    GCGLenum framebufferTarget = m_context->m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
-    const GraphicsContextGLOpenGL::GraphicsContextGLState& state = m_context->m_state;
-    if (attrs.antialias && state.boundReadFBO == m_context->m_multisampleFBO) {
-        m_context->resolveMultisamplingIfNecessary(IntRect(x, y, width, height));
-        gl::BindFramebuffer(framebufferTarget, m_context->m_fbo);
-        gl::Flush();
-    }
-    (void) m_context->moveErrorsToSyntheticErrorList();
-    gl::ReadnPixelsRobustANGLE(x, y, width, height, format, type, bufSize, length, columns, rows, data);
-    GLenum error = gl::GetError();
-    if (attrs.antialias && state.boundReadFBO == m_context->m_multisampleFBO)
-        gl::BindFramebuffer(framebufferTarget, m_context->m_multisampleFBO);
-
-    if (error) {
-        // ANGLE detected a failure during the ReadnPixelsRobustANGLE operation. Surface this in the
-        // synthetic error list, and skip the alpha channel fixup below.
-        m_context->synthesizeGLError(error);
-        return;
-    }
-
-#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
-    if (!readingToPixelBufferObject && !attrs.alpha && (format == GraphicsContextGL::RGBA || format == GraphicsContextGL::BGRA) && (type == GraphicsContextGL::UNSIGNED_BYTE) && (state.boundReadFBO == m_context->m_fbo || (attrs.antialias && state.boundReadFBO == m_context->m_multisampleFBO)))
-        wipeAlphaChannelFromPixels(width, height, static_cast<unsigned char*>(data));
-#else
-    UNUSED_PARAM(readingToPixelBufferObject);
-#endif
-}
-
-void ExtensionsGLANGLE::getnUniformfvRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
-{
-    if (!m_context->makeContextCurrent())
-        return;
-
     gl::GetnUniformfvRobustANGLE(program, location, bufSize, length, params);
 }
 
-void ExtensionsGLANGLE::getnUniformivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
+void ExtensionsGLANGLE::getnUniformivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -520,7 +445,7 @@
     gl::GetnUniformivRobustANGLE(program, location, bufSize, length, params);
 }
 
-void ExtensionsGLANGLE::getnUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
+void ExtensionsGLANGLE::getnUniformuivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
 {
     if (!m_context->makeContextCurrent())
         return;

Modified: trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -56,22 +56,13 @@
 
     String getTranslatedShaderSourceANGLE(PlatformGLObject) override;
 
-    void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) override;
-    void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) override;
+    void blitFramebufferANGLE(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter) override;
+    void renderbufferStorageMultisampleANGLE(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) override;
 
-    void drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) override;
-    void drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount) override;
-    void vertexAttribDivisor(GCGLuint index, GCGLuint divisor) override;
+    void drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) override;
+    void drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount) override;
+    void vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor) override;
 
-    bool isNVIDIA() override { return m_isNVIDIA; }
-    bool isAMD() override { return m_isAMD; }
-    bool isIntel() override { return m_isIntel; }
-    bool isImagination() override { return m_isImagination; }
-    String vendor() override { return m_vendor; }
-
-    bool requiresBuiltInFunctionEmulation() override { return m_requiresBuiltInFunctionEmulation; }
-    bool requiresRestrictedMaximumTextureSize() override { return m_requiresRestrictedMaximumTextureSize; }
-
     // GL_ANGLE_robust_client_memory
     void readPixelsRobustANGLE(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei *length, GCGLsizei *columns, GCGLsizei *rows, void *pixels) override;
     void texParameterfvRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLfloat *params) override;
@@ -79,7 +70,6 @@
     void getQueryivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getQueryObjectuivRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;
     void getBufferPointervRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params) override;
-    void getInternalformativRobustANGLE(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getVertexAttribIivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getVertexAttribIuivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;
     void getUniformuivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;
@@ -97,7 +87,6 @@
     void getTexLevelParameterfvRobustANGLE(GCGLenum target, GCGLint level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) override;
 
     void getPointervRobustANGLERobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params) override;
-    void readnPixelsRobustANGLE(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei *length, GCGLsizei *columns, GCGLsizei *rows, void *data, bool readingToPixelBufferObject) override;
     void getnUniformfvRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) override;
     void getnUniformivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getnUniformuivRobustANGLE(GCGLuint program, GCGLint location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;
@@ -130,18 +119,8 @@
     // Weak pointer back to GraphicsContextGLOpenGL.
     GraphicsContextGLOpenGL* m_context;
 
-    bool m_isNVIDIA;
-    bool m_isAMD;
-    bool m_isIntel;
-    bool m_isImagination;
-    bool m_requiresBuiltInFunctionEmulation;
-    bool m_requiresRestrictedMaximumTextureSize;
-
     bool m_useIndexedGetString { false };
 
-    String m_vendor;
-    String m_renderer;
-
     // Whether the WebGL 1.0-related floating-point renderability extensions have been enabled.
     bool m_webglColorBufferFloatRGB { false };
     bool m_webglColorBufferFloatRGBA { false };

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -443,13 +443,23 @@
     return *m_extensions;
 }
 
-void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, void* data)
+void GraphicsContextGLOpenGL::readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLSpan<GCGLvoid> data)
 {
-    // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
-    // all previous rendering calls should be done before reading pixels.
+    readnPixelsImpl(x, y, width, height, format, type, data.bufSize, nullptr, nullptr, nullptr, data.data, false);
+}
+
+void GraphicsContextGLOpenGL::readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLintptr offset)
+{
+    readnPixelsImpl(x, y, width, height, format, type, 0, nullptr, nullptr, nullptr, reinterpret_cast<GCGLvoid*>(offset), true);
+}
+
+void GraphicsContextGLOpenGL::readnPixelsImpl(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei* length, GCGLsizei* columns, GCGLsizei* rows, GCGLvoid* data, bool readingToPixelBufferObject)
+{
     if (!makeContextCurrent())
         return;
 
+    // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
+    // all previous rendering calls should be done before reading pixels.
     gl::Flush();
     auto attrs = contextAttributes();
     GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
@@ -458,17 +468,28 @@
         gl::BindFramebuffer(framebufferTarget, m_fbo);
         gl::Flush();
     }
-    gl::ReadPixels(x, y, width, height, format, type, data);
+    moveErrorsToSyntheticErrorList();
+    gl::ReadnPixelsRobustANGLE(x, y, width, height, format, type, bufSize, length, columns, rows, data);
+    GLenum error = gl::GetError();
     if (attrs.antialias && m_state.boundReadFBO == m_multisampleFBO)
         gl::BindFramebuffer(framebufferTarget, m_multisampleFBO);
 
+    if (error) {
+        // ANGLE detected a failure during the ReadnPixelsRobustANGLE operation. Surface this in the
+        // synthetic error list, and skip the alpha channel fixup below.
+        synthesizeGLError(error);
+        return;
+    }
+
+
 #if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
-    if (!attrs.alpha && (format == GraphicsContextGL::RGBA || format == GraphicsContextGL::BGRA) && (type == GraphicsContextGL::UNSIGNED_BYTE) && (m_state.boundReadFBO == m_fbo || (attrs.antialias && m_state.boundReadFBO == m_multisampleFBO)))
+    if (!readingToPixelBufferObject && !attrs.alpha && (format == GraphicsContextGL::RGBA || format == GraphicsContextGL::BGRA) && (type == GraphicsContextGL::UNSIGNED_BYTE) && (m_state.boundReadFBO == m_fbo || (attrs.antialias && m_state.boundReadFBO == m_multisampleFBO)))
         wipeAlphaChannelFromPixels(width, height, static_cast<unsigned char*>(data));
+#else
+    UNUSED_PARAM(readingToPixelBufferObject);
 #endif
 }
 
-
 // The contents of GraphicsContextGLOpenGLCommon follow, ported to use ANGLE.
 
 void GraphicsContextGLOpenGL::validateDepthStencil(const char* packedDepthStencilExtension)
@@ -898,22 +919,18 @@
     gl::BufferSubData(target, offset, data.bufSize, data.data);
 }
 
-void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access)
+void GraphicsContextGLOpenGL::getBufferSubData(GCGLenum target, GCGLintptr offset, GCGLSpan<GCGLvoid> data)
 {
     if (!makeContextCurrent())
-        return nullptr;
-
-    return gl::MapBufferRange(target, offset, length, access);
+        return;
+    GCGLvoid* ptr = gl::MapBufferRange(target, offset, data.bufSize, GraphicsContextGL::MAP_READ_BIT);
+    if (!ptr)
+        return;
+    memcpy(data.data, ptr, data.bufSize);
+    if (!gl::UnmapBuffer(target))
+        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION);
 }
 
-GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum target)
-{
-    if (!makeContextCurrent())
-        return GL_FALSE;
-
-    return gl::UnmapBuffer(target);
-}
-
 void GraphicsContextGLOpenGL::copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size)
 {
     if (!makeContextCurrent())
@@ -922,12 +939,11 @@
     gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
 }
 
-void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLint* params)
+void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> data)
 {
     if (!makeContextCurrent())
         return;
-
-    gl::GetInternalformativ(target, internalformat, pname, bufSize, params);
+    gl::GetInternalformativRobustANGLE(target, internalformat, pname, data.bufSize, nullptr, data.data);
 }
 
 void GraphicsContextGLOpenGL::renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
@@ -1008,14 +1024,15 @@
     compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, makeGCGLSpan(reinterpret_cast<const GCGLvoid*>(offset), 0));
 }
 
-void GraphicsContextGLOpenGL::getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname, Vector<GCGLint>& params)
+Vector<GCGLint> GraphicsContextGLOpenGL::getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname)
 {
+    Vector<GCGLint> result(uniformIndices.size(), 0);
     ASSERT(program);
     if (!makeContextCurrent())
-        return;
+        return result;
 
-
-    gl::GetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data());
+    gl::GetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, result.data());
+    return result;
 }
 
 GCGLenum GraphicsContextGLOpenGL::checkFramebufferStatus(GCGLenum target)
@@ -2101,22 +2118,6 @@
     return gl::GetUniformLocation(program, name.utf8().data());
 }
 
-void GraphicsContextGLOpenGL::getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLfloat> value)
-{
-    if (!makeContextCurrent())
-        return;
-
-    gl::GetVertexAttribfvRobustANGLE(index, pname, value.bufSize, nullptr, value.data);
-}
-
-void GraphicsContextGLOpenGL::getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLint> value)
-{
-    if (!makeContextCurrent())
-        return;
-
-    gl::GetVertexAttribivRobustANGLE(index, pname, value.bufSize, nullptr, value.data);
-}
-
 GCGLsizeiptr GraphicsContextGLOpenGL::getVertexAttribOffset(GCGLuint index, GCGLenum pname)
 {
     if (!makeContextCurrent())
@@ -2392,12 +2393,13 @@
     gl::EndQuery(target);
 }
 
-void GraphicsContextGLOpenGL::getQueryObjectuiv(GCGLuint id, GCGLenum pname, GCGLuint* params)
+GCGLuint GraphicsContextGLOpenGL::getQueryObjectui(GCGLuint id, GCGLenum pname)
 {
+    GCGLuint value = 0;
     if (!makeContextCurrent())
-        return;
-
-    gl::GetQueryObjectuiv(id, pname, params);
+        return value;
+    gl::GetQueryObjectuivRobustANGLE(id, pname, 1, nullptr, &value);
+    return value;
 }
 
 // Transform Feedback Functions
@@ -2839,20 +2841,24 @@
     gl::SamplerParameterf(sampler, pname, param);
 }
 
-void GraphicsContextGLOpenGL::getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value)
+GCGLfloat GraphicsContextGLOpenGL::getSamplerParameterf(PlatformGLObject sampler, GCGLenum pname)
 {
+    GCGLfloat value = 0.f;
     if (!makeContextCurrent())
-        return;
+        return value;
 
-    gl::GetSamplerParameterfv(sampler, pname, value);
+    gl::GetSamplerParameterfvRobustANGLE(sampler, pname, 1, nullptr, &value);
+    return value;
 }
 
-void GraphicsContextGLOpenGL::getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value)
+GCGLint GraphicsContextGLOpenGL::getSamplerParameteri(PlatformGLObject sampler, GCGLenum pname)
 {
+    GCGLint value = 0;
     if (!makeContextCurrent())
-        return;
+        return value;
 
-    gl::GetSamplerParameteriv(sampler, pname, value);
+    gl::GetSamplerParameterivRobustANGLE(sampler, pname, 1, nullptr, &value);
+    return value;
 }
 
 GCGLsync GraphicsContextGLOpenGL::fenceSync(GCGLenum condition, GCGLbitfield flags)
@@ -2895,12 +2901,14 @@
     gl::WaitSync(sync, flags, timeout);
 }
 
-void GraphicsContextGLOpenGL::getSynciv(GCGLsync sync, GCGLenum pname, GCGLsizei bufSize, GCGLint *value)
+GCGLint GraphicsContextGLOpenGL::getSynci(GCGLsync sync, GCGLenum pname)
 {
+    GCGLint value = 0;
     if (!makeContextCurrent())
-        return;
+        return value;
 
-    gl::GetSynciv(sync, pname, bufSize, nullptr, value);
+    gl::GetSynciv(sync, pname, 1, nullptr, &value);
+    return value;
 }
 
 void GraphicsContextGLOpenGL::pauseTransformFeedback()

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-12-03 19:29:34 UTC (rev 270400)
@@ -293,26 +293,28 @@
     if (m_isForWebGL2)
         gl::Enable(GraphicsContextGL::PRIMITIVE_RESTART_FIXED_INDEX);
 
+    Vector<ASCIILiteral, 4> requiredExtensions;
+    if (m_isForWebGL2) {
+        // For WebGL 2.0 occlusion queries to work.
+        requiredExtensions.append("GL_EXT_occlusion_query_boolean"_s);
+    }
 #if PLATFORM(MAC) || PLATFORM(MACCATALYST)
-    ExtensionsGL& extensions = getExtensions();
-
     if (!needsEAGLOnMac()) {
-        static constexpr const char* requiredExtensions[] = {
-            "GL_ANGLE_texture_rectangle", // For IOSurface-backed textures.
-            "GL_EXT_texture_format_BGRA8888", // For creating the EGL surface from an IOSurface.
-        };
-
-        for (size_t i = 0; i < WTF_ARRAY_LENGTH(requiredExtensions); ++i) {
-            if (!extensions.supports(requiredExtensions[i])) {
-                LOG(WebGL, "Missing required extension. %s", requiredExtensions[i]);
-                return;
+        // For IOSurface-backed textures.
+        requiredExtensions.append("GL_ANGLE_texture_rectangle"_s);
+        // For creating the EGL surface from an IOSurface.
+        requiredExtensions.append("GL_EXT_texture_format_BGRA8888"_s);
             }
 
-            extensions.ensureEnabled(requiredExtensions[i]);
+#endif // PLATFORM(MAC) || PLATFORM(MACCATALYST)
+    ExtensionsGL& extensions = getExtensions();
+    for (auto& extension : requiredExtensions) {
+        if (!extensions.supports(extension)) {
+            LOG(WebGL, "Missing required extension. %s", extension.characters());
+            return;
         }
+        extensions.ensureEnabled(extension);
     }
-#endif // PLATFORM(MAC) || PLATFORM(MACCATALYST)
-
 #if PLATFORM(MAC)
     // FIXME: It's unclear if MACCATALYST should take these steps as well, but that
     // would require the PlatformScreenMac code to be exposed to Catalyst too.

Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -48,7 +48,7 @@
 ExtensionsGLOpenGL::~ExtensionsGLOpenGL() = default;
 
 
-void ExtensionsGLOpenGL::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
+void ExtensionsGLOpenGL::blitFramebufferANGLE(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -56,7 +56,7 @@
     ::glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
 }
 
-void ExtensionsGLOpenGL::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
+void ExtensionsGLOpenGL::renderbufferStorageMultisampleANGLE(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -222,7 +222,7 @@
 #endif
 }
 
-void ExtensionsGLOpenGL::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
+void ExtensionsGLOpenGL::drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -237,7 +237,7 @@
 #endif
 }
 
-void ExtensionsGLOpenGL::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount)
+void ExtensionsGLOpenGL::drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -253,7 +253,7 @@
 #endif
 }
 
-void ExtensionsGLOpenGL::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
+void ExtensionsGLOpenGL::vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor)
 {
     if (!m_context->makeContextCurrent())
         return;

Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -40,8 +40,8 @@
     virtual ~ExtensionsGLOpenGL();
 
     // ExtensionsGL methods.
-    void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) override;
-    void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) override;
+    void blitFramebufferANGLE(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter) override;
+    void renderbufferStorageMultisampleANGLE(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) override;
 
     PlatformGLObject createVertexArrayOES() override;
     void deleteVertexArrayOES(PlatformGLObject) override;
@@ -52,9 +52,9 @@
     void popGroupMarkerEXT(void) override;
     void drawBuffersEXT(GCGLSpan<const GCGLenum>) override;
 
-    void drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) override;
-    void drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount) override;
-    void vertexAttribDivisor(GCGLuint index, GCGLuint divisor) override;
+    void drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) override;
+    void drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount) override;
+    void vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor) override;
 
 protected:
     bool supportsExtension(const WTF::String&) override;

Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -284,11 +284,6 @@
     m_context->synthesizeGLError(GL_INVALID_OPERATION);
 }
 
-void ExtensionsGLOpenGLCommon::getInternalformativRobustANGLE(GCGLenum, GCGLenum, GCGLenum, GCGLsizei, GCGLsizei *, GCGLint *)
-{
-    m_context->synthesizeGLError(GL_INVALID_OPERATION);
-}
-
 void ExtensionsGLOpenGLCommon::getVertexAttribIivRobustANGLE(GCGLuint, GCGLenum, GCGLsizei, GCGLsizei *, GCGLint *)
 {
     m_context->synthesizeGLError(GL_INVALID_OPERATION);
@@ -366,11 +361,6 @@
     m_context->synthesizeGLError(GL_INVALID_OPERATION);
 }
 
-void ExtensionsGLOpenGLCommon::readnPixelsRobustANGLE(int, int, GCGLsizei, GCGLsizei, GCGLenum, GCGLenum, GCGLsizei, GCGLsizei *, GCGLsizei *, GCGLsizei *, void *, bool)
-{
-    m_context->synthesizeGLError(GL_INVALID_OPERATION);
-}
-
 void ExtensionsGLOpenGLCommon::getnUniformfvRobustANGLE(GCGLuint, int, GCGLsizei, GCGLsizei *, GCGLfloat *)
 {
     m_context->synthesizeGLError(GL_INVALID_OPERATION);

Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -75,7 +75,6 @@
     void getQueryivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getQueryObjectuivRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;
     void getBufferPointervRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params) override;
-    void getInternalformativRobustANGLE(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getVertexAttribIivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getVertexAttribIuivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;
     void getUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;
@@ -93,7 +92,6 @@
     void getTexLevelParameterfvRobustANGLE(GCGLenum target, int level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) override;
 
     void getPointervRobustANGLERobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params) override;
-    void readnPixelsRobustANGLE(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei *length, GCGLsizei *columns, GCGLsizei *rows, void *data, bool readingToPixelBufferObject) override;
     void getnUniformfvRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) override;
     void getnUniformivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) override;
     void getnUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) override;

Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -100,12 +100,12 @@
         m_context->synthesizeGLError(GL_INVALID_OPERATION);
 }
 
-void ExtensionsGLOpenGLES::blitFramebuffer(long /* srcX0 */, long /* srcY0 */, long /* srcX1 */, long /* srcY1 */, long /* dstX0 */, long /* dstY0 */, long /* dstX1 */, long /* dstY1 */, unsigned long /* mask */, unsigned long /* filter */)
+void ExtensionsGLOpenGLES::blitFramebufferANGLE(GCGLint, GCGLint, GCGLint, GCGLint, GCGLint, GCGLint, GCGLint, GCGLint, GCGLbitfield, GCGLenum)
 {
     notImplemented();
 }
 
-void ExtensionsGLOpenGLES::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
+void ExtensionsGLOpenGLES::renderbufferStorageMultisampleANGLE(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
 {
     if (!m_context->makeContextCurrent())
         return;
@@ -251,7 +251,7 @@
     m_context->synthesizeGLError(GL_INVALID_OPERATION);
 }
 
-void ExtensionsGLOpenGLES::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
+void ExtensionsGLOpenGLES::drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
 {
     if (!m_glDrawArraysInstancedANGLE) {
         m_context->synthesizeGLError(GL_INVALID_OPERATION);
@@ -264,7 +264,7 @@
     m_glDrawArraysInstancedANGLE(mode, first, count, primcount);
 }
 
-void ExtensionsGLOpenGLES::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount)
+void ExtensionsGLOpenGLES::drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount)
 {
     if (!m_glDrawElementsInstancedANGLE) {
         m_context->synthesizeGLError(GL_INVALID_OPERATION);
@@ -277,7 +277,7 @@
     m_glDrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);
 }
 
-void ExtensionsGLOpenGLES::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
+void ExtensionsGLOpenGLES::vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor)
 {
     if (!m_glVertexAttribDivisorANGLE) {
         m_context->synthesizeGLError(GL_INVALID_OPERATION);

Modified: trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -75,8 +75,8 @@
 
     // Extension3D methods
     bool isEnabled(const String&) override;
-    void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) override;
-    void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) override;
+    void blitFramebufferANGLE(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter) override;
+    void renderbufferStorageMultisampleANGLE(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) override;
     void insertEventMarkerEXT(const String&) override;
     void pushGroupMarkerEXT(const String&) override;
     void popGroupMarkerEXT(void) override;
@@ -87,9 +87,9 @@
     void bindVertexArrayOES(PlatformGLObject) override;
     void drawBuffersEXT(GCGLSpan<const GCGLenum>) override;
 
-    void drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) override;
-    void drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount) override;
-    void vertexAttribDivisor(GCGLuint index, GCGLuint divisor) override;
+    void drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) override;
+    void drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLvoidptr offset, GCGLsizei primcount) override;
+    void vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor) override;
 
     // EXT Robustness - reset
     int getGraphicsResetStatusARB() override;

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2020-12-03 19:29:34 UTC (rev 270400)
@@ -187,7 +187,7 @@
     bool getActiveAttribImpl(PlatformGLObject program, GCGLuint index, ActiveInfo&);
     bool getActiveUniform(PlatformGLObject program, GCGLuint index, ActiveInfo&) final;
     bool getActiveUniformImpl(PlatformGLObject program, GCGLuint index, ActiveInfo&);
-    void getAttachedShaders(PlatformGLObject program, GCGLsizei maxCount, GCGLsizei* count, PlatformGLObject* shaders) final;
+    void getAttachedShaders(PlatformGLObject program, GCGLsizei maxCount, GCGLsizei* count, PlatformGLObject* shaders);
     GCGLint getAttribLocation(PlatformGLObject, const String& name) final;
     void getBooleanv(GCGLenum pname, GCGLSpan<GCGLboolean> value) final;
     GCGLint getBufferParameteri(GCGLenum target, GCGLenum pname) final;
@@ -215,8 +215,6 @@
     void getUniformiv(PlatformGLObject program, GCGLint location, GCGLSpan<GCGLint> value) final;
     void getUniformuiv(PlatformGLObject program, GCGLint location, GCGLSpan<GCGLuint> value) final;
     GCGLint getUniformLocation(PlatformGLObject, const String& name) final;
-    void getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLfloat> value) final;
-    void getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLint> value) final;
     GCGLsizeiptr getVertexAttribOffset(GCGLuint index, GCGLenum pname) final;
 
     void hint(GCGLenum target, GCGLenum mode) final;
@@ -232,7 +230,8 @@
     void pixelStorei(GCGLenum pname, GCGLint param) final;
     void polygonOffset(GCGLfloat factor, GCGLfloat units) final;
 
-    void readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, void* data) final;
+    void readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLSpan<GCGLvoid> data) final;
+    void readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLintptr offset) final;
 
     void renderbufferStorage(GCGLenum target, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) final;
     void sampleCoverage(GCGLclampf value, GCGLboolean invert) final;
@@ -313,12 +312,10 @@
 #if !USE(ANGLE)
     void bufferData(GCGLenum target, const void* data, GCGLenum usage, GCGLuint srcOffset, GCGLuint length);
     void bufferSubData(GCGLenum target, GCGLintptr dstByteOffset, const void* srcData, GCGLuint srcOffset, GCGLuint length);
-    void getBufferSubData(GCGLenum target, GCGLintptr srcByteOffset, const void* dstData, GCGLuint dstOffset, GCGLuint length);
 #endif
     void copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size) final;
 
-    void* mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access) final;
-    GCGLboolean unmapBuffer(GCGLenum target) final;
+    void getBufferSubData(GCGLenum target, GCGLintptr offset, GCGLSpan<GCGLvoid> data) final;
 
     void blitFramebuffer(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter) final;
     void framebufferTextureLayer(GCGLenum target, GCGLenum attachment, PlatformGLObject texture, GCGLint level, GCGLint layer) final;
@@ -327,7 +324,7 @@
     void readBuffer(GCGLenum src) final;
 
     // getInternalFormatParameter
-    void getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLint* params) final;
+    void getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> data) final;
     void renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) final;
 
     void texStorage2D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) final;
@@ -380,7 +377,7 @@
     void endQuery(GCGLenum target) final;
     PlatformGLObject getQuery(GCGLenum target, GCGLenum pname) final;
     // getQueryParameter
-    void getQueryObjectuiv(PlatformGLObject query, GCGLenum pname, GCGLuint* value) final;
+    GCGLuint getQueryObjectui(PlatformGLObject query, GCGLenum pname) final;
 
     PlatformGLObject createSampler() final;
     void deleteSampler(PlatformGLObject sampler) final;
@@ -389,8 +386,8 @@
     void samplerParameteri(PlatformGLObject sampler, GCGLenum pname, GCGLint param) final;
     void samplerParameterf(PlatformGLObject sampler, GCGLenum pname, GCGLfloat param) final;
     // getSamplerParameter
-    void getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value) final;
-    void getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value) final;
+    GCGLfloat getSamplerParameterf(PlatformGLObject sampler, GCGLenum pname) final;
+    GCGLint getSamplerParameteri(PlatformGLObject sampler, GCGLenum pname) final;
 
     GCGLsync fenceSync(GCGLenum condition, GCGLbitfield flags) final;
     GCGLboolean isSync(GCGLsync) final;
@@ -399,7 +396,7 @@
     void waitSync(GCGLsync, GCGLbitfield flags, GCGLint64 timeout) final;
     // getSyncParameter
     // FIXME - this can be implemented at the WebGL level if we signal the WebGLSync object.
-    void getSynciv(GCGLsync, GCGLenum pname, GCGLsizei bufSize, GCGLint *value) final;
+    GCGLint getSynci(GCGLsync, GCGLenum pname) final;
 
     PlatformGLObject createTransformFeedback() final;
     void deleteTransformFeedback(PlatformGLObject id) final;
@@ -416,7 +413,7 @@
     void bindBufferRange(GCGLenum target, GCGLuint index, PlatformGLObject buffer, GCGLintptr offset, GCGLsizeiptr size) final;
     // getIndexedParameter -> use getParameter calls above.
     Vector<GCGLuint> getUniformIndices(PlatformGLObject program, const Vector<String>& uniformNames) final;
-    void getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname, Vector<GCGLint>& params) final;
+    Vector<GCGLint> getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname) final;
 
     GCGLuint getUniformBlockIndex(PlatformGLObject program, const String& uniformBlockName) final;
     // getActiveUniformBlockParameter
@@ -425,11 +422,6 @@
 
     void getActiveUniformBlockiv(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname, GCGLSpan<GCGLint> params) final;
 
-#if !USE(ANGLE)
-    void readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLintptr offset);
-    void readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, const void* dstData, GCGLuint dstOffset);
-#endif
-
     // Helper methods.
 
     void paintToCanvas(const unsigned char* imagePixels, const IntSize& imageSize, const IntSize& canvasSize, GraphicsContext&);
@@ -524,6 +516,8 @@
     void validateDepthStencil(const char* packedDepthStencilExtension);
     void validateAttributes();
     
+    void readnPixelsImpl(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei* length, GCGLsizei* columns, GCGLsizei* rows, GCGLvoid* data, bool readingToPixelBufferObject);
+
     // Did the most recent drawing operation leave the GPU in an acceptable state?
     void checkGPUStatus();
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -425,7 +425,7 @@
 }
 #endif
 
-void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, void* data)
+void GraphicsContextGLOpenGL::readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLSpan<GCGLvoid> data)
 {
     auto attrs = contextAttributes();
 
@@ -441,7 +441,7 @@
         ::glBindFramebufferEXT(GraphicsContextGL::FRAMEBUFFER, m_fbo);
         ::glFlush();
     }
-    ::glReadPixels(x, y, width, height, format, type, data);
+    ::glReadPixels(x, y, width, height, format, type, data.data);
     if (attrs.antialias && m_state.boundDrawFBO == m_multisampleFBO)
         ::glBindFramebufferEXT(GraphicsContextGL::FRAMEBUFFER, m_multisampleFBO);
 }

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -2029,22 +2029,6 @@
     return ::glGetUniformLocation(program, mappedName.utf8().data());
 }
 
-void GraphicsContextGLOpenGL::getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLfloat> value)
-{
-    if (!makeContextCurrent())
-        return;
-
-    ::glGetVertexAttribfv(index, pname, value.data);
-}
-
-void GraphicsContextGLOpenGL::getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLSpan<GCGLint> value)
-{
-    if (!makeContextCurrent())
-        return;
-
-    ::glGetVertexAttribiv(index, pname, value.data);
-}
-
 GCGLsizeiptr GraphicsContextGLOpenGL::getVertexAttribOffset(GCGLuint index, GCGLenum pname)
 {
     if (!makeContextCurrent())
@@ -2278,19 +2262,19 @@
 
 void GraphicsContextGLOpenGL::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
 {
-    getExtensions().drawArraysInstanced(mode, first, count, primcount);
+    getExtensions().drawArraysInstancedANGLE(mode, first, count, primcount);
     checkGPUStatus();
 }
 
 void GraphicsContextGLOpenGL::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset, GCGLsizei primcount)
 {
-    getExtensions().drawElementsInstanced(mode, count, type, offset, primcount);
+    getExtensions().drawElementsInstancedANGLE(mode, count, type, offset, primcount);
     checkGPUStatus();
 }
 
 void GraphicsContextGLOpenGL::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
 {
-    getExtensions().vertexAttribDivisor(index, divisor);
+    getExtensions().vertexAttribDivisorANGLE(index, divisor);
 }
 
 #if HAVE(OPENGL_4) && ENABLE(WEBGL2)
@@ -2335,42 +2319,25 @@
 }
 #endif
 
-void GraphicsContextGLOpenGL::getBufferSubData(GCGLenum target, GCGLintptr srcByteOffset, const void* dstData, GCGLuint dstOffset, GCGLuint length)
+void GraphicsContextGLOpenGL::getBufferSubData(GCGLenum target, GCGLintptr offset, GCGLSpan<GCGLvoid> data)
 {
-    UNUSED_PARAM(target);
-    UNUSED_PARAM(srcByteOffset);
-    UNUSED_PARAM(dstData);
-    UNUSED_PARAM(dstOffset);
-    UNUSED_PARAM(length);
-}
-
 #if HAVE(OPENGL_4) || HAVE(OPENGL_ES_3)
-void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access)
-{
     if (!makeContextCurrent())
-        return nullptr;
-
-    return ::glMapBufferRange(target, offset, length, access);
-}
-
-GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum target)
-{
-    if (!makeContextCurrent())
-        return GL_FALSE;
-
-    return ::glUnmapBuffer(target);
-}
+        return;
+    GCGLvoid* ptr = ::glMapBufferRange(target, offset, data.bufSize, GraphicsContextGL::MAP_READ_BIT);
+    if (!ptr)
+        return;
+    memcpy(data.data, ptr, data.bufSize);
+    if (!::glUnmapBuffer(target))
+        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION);
 #else
-void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum, GCGLintptr, GCGLsizeiptr, GCGLbitfield)
-{
-    return nullptr;
+    UNUSED_PARAM(target);
+    UNUSED_PARAM(offset);
+    UNUSED_PARAM(data);
+    synthesizeGLError(GraphicsContextGL::INVALID_OPERATION);
+#endif
 }
 
-GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum)
-{
-    return false;
-}
-#endif
 
 void GraphicsContextGLOpenGL::blitFramebuffer(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter)
 {
@@ -2417,13 +2384,13 @@
 }
 
 #if HAVE(OPENGL_4) || HAVE(OPENGL_ES_3)
-void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLint* params)
+void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> data)
 {
 #if USE(OPENGL_ES)
     if (!makeContextCurrent())
         return;
 
-    ::glGetInternalformativ(target, internalformat, pname, bufSize, params);
+    ::glGetInternalformativ(target, internalformat, pname, data.bufSize, data.data);
 #else
     UNUSED_PARAM(target);
     UNUSED_PARAM(internalformat);
@@ -2459,7 +2426,7 @@
     m_state.textureSeedCount.add(m_state.currentBoundTexture());
 }
 #else
-void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum, GCGLenum, GCGLenum, GCGLsizei, GCGLint*)
+void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum, GCGLenum, GCGLenum, GCGLSpan<GCGLint>)
 {
 }
 
@@ -2712,11 +2679,11 @@
     return 0;
 }
 
-void GraphicsContextGLOpenGL::getQueryObjectuiv(PlatformGLObject query, GCGLenum pname, GCGLuint* value)
+GCGLuint GraphicsContextGLOpenGL::getQueryObjectui(PlatformGLObject query, GCGLenum pname)
 {
     UNUSED_PARAM(query);
     UNUSED_PARAM(pname);
-    UNUSED_PARAM(value);
+    return 0;
 }
 
 PlatformGLObject GraphicsContextGLOpenGL::createSampler()
@@ -2756,18 +2723,19 @@
     UNUSED_PARAM(param);
 }
 
-void GraphicsContextGLOpenGL::getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value)
+GCGLfloat GraphicsContextGLOpenGL::getSamplerParameterf(PlatformGLObject sampler, GCGLenum pname)
 {
     UNUSED_PARAM(sampler);
     UNUSED_PARAM(pname);
-    UNUSED_PARAM(value);
+    return 0.f;
 }
 
-void GraphicsContextGLOpenGL::getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value)
+GCGLint GraphicsContextGLOpenGL::getSamplerParameteri(PlatformGLObject sampler, GCGLenum pname)
+
 {
     UNUSED_PARAM(sampler);
     UNUSED_PARAM(pname);
-    UNUSED_PARAM(value);
+    return 0;
 }
 
 GCGLsync GraphicsContextGLOpenGL::fenceSync(GCGLenum condition, GCGLbitfield flags)
@@ -2806,12 +2774,11 @@
     UNUSED_PARAM(timeout);
 }
 
-void GraphicsContextGLOpenGL::getSynciv(GCGLsync sync, GCGLenum pname, GCGLsizei bufSize, GCGLint *value)
+GCGLint GraphicsContextGLOpenGL::getSynci(GCGLsync sync, GCGLenum pname)
 {
     UNUSED_PARAM(sync);
     UNUSED_PARAM(pname);
-    UNUSED_PARAM(bufSize);
-    UNUSED_PARAM(value);
+    return 0;
 }
 
 PlatformGLObject GraphicsContextGLOpenGL::createTransformFeedback()
@@ -2891,14 +2858,17 @@
     return { };
 }
 
+Vector<GCGLint> GraphicsContextGLOpenGL::getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname)
+{
+    Vector<GCGLint> result(uniformIndices.size(), 0);
 #if HAVE(OPENGL_4) || HAVE(OPENGL_ES_3)
-void GraphicsContextGLOpenGL::getActiveUniforms(PlatformGLObject program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname, Vector<GCGLint>& params)
-{
     ASSERT(program);
     if (!makeContextCurrent())
-        return;
+        return result;
 
-    ::glGetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data());
+    ::glGetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, result.data());
+#endif
+    return result;
 }
 
 GCGLuint GraphicsContextGLOpenGL::getUniformBlockIndex(PlatformGLObject program, const String& uniformBlockName)
@@ -2905,7 +2875,6 @@
 {
     UNUSED_PARAM(program);
     UNUSED_PARAM(uniformBlockName);
-
     return 0;
 }
 
@@ -2913,7 +2882,6 @@
 {
     UNUSED_PARAM(program);
     UNUSED_PARAM(uniformBlockIndex);
-
     return emptyString();
 }
 
@@ -2923,28 +2891,9 @@
     UNUSED_PARAM(uniformBlockIndex);
     UNUSED_PARAM(uniformBlockBinding);
 }
-#else
-void GraphicsContextGLOpenGL::getActiveUniforms(PlatformGLObject, const Vector<GCGLuint>&, GCGLenum, Vector<GCGLint>&)
-{
-}
 
-GCGLuint GraphicsContextGLOpenGL::getUniformBlockIndex(PlatformGLObject, const String&)
+void GraphicsContextGLOpenGL::readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLintptr offset)
 {
-    return 0;
-}
-
-String GraphicsContextGLOpenGL::getActiveUniformBlockName(PlatformGLObject, GCGLuint)
-{
-    return emptyString();
-}
-
-void GraphicsContextGLOpenGL::uniformBlockBinding(PlatformGLObject, GCGLuint, GCGLuint)
-{
-}
-#endif
-
-void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLintptr offset)
-{
     UNUSED_PARAM(x);
     UNUSED_PARAM(y);
     UNUSED_PARAM(width);
@@ -2954,18 +2903,6 @@
     UNUSED_PARAM(offset);
 }
 
-void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, const void* dstData, GCGLuint dstOffset)
-{
-    UNUSED_PARAM(x);
-    UNUSED_PARAM(y);
-    UNUSED_PARAM(width);
-    UNUSED_PARAM(height);
-    UNUSED_PARAM(format);
-    UNUSED_PARAM(type);
-    UNUSED_PARAM(dstData);
-    UNUSED_PARAM(dstOffset);
-}
-
 void GraphicsContextGLOpenGL::getActiveUniformBlockiv(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname, GCGLSpan<GCGLint> params)
 {
     UNUSED_PARAM(program);

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp (270399 => 270400)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp	2020-12-03 19:07:26 UTC (rev 270399)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp	2020-12-03 19:29:34 UTC (rev 270400)
@@ -40,7 +40,7 @@
 
 namespace WebCore {
 
-void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, void* data)
+void GraphicsContextGLOpenGL::readnPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLSpan<GCGLvoid> data)
 {
     if (!makeContextCurrent())
         return;
@@ -58,7 +58,7 @@
         ::glFlush();
     }
 
-    ::glReadPixels(x, y, width, height, format, type, data);
+    ::glReadPixels(x, y, width, height, format, type, data.data);
 
     if (attributes.antialias && m_state.boundDrawFBO == m_multisampleFBO)
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
@@ -130,7 +130,7 @@
             // Use a 24 bit depth buffer where we know we have it.
             if (supportPackedDepthStencilBuffer) {
                 ::glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
-                extensions.renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, GL_DEPTH24_STENCIL8_OES, width, height);
+                extensions.renderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, GL_DEPTH24_STENCIL8_OES, width, height);
                 if (attributes.stencil)
                     ::glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
                 if (attributes.depth)
@@ -138,12 +138,12 @@
             } else {
                 if (attributes.stencil) {
                     ::glBindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer);
-                    extensions.renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, GL_STENCIL_INDEX8, width, height);
+                    extensions.renderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, GL_STENCIL_INDEX8, width, height);
                     ::glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_stencilBuffer);
                 }
                 if (attributes.depth) {
                     ::glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
-                    extensions.renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, GL_DEPTH_COMPONENT16, width, height);
+                    extensions.renderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, GL_DEPTH_COMPONENT16, width, height);
                     ::glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer);
                 }
             }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to