Changeset 271444 in webkit


Ignore:
Timestamp:
Jan 13, 2021 10:56:35 AM (3 years ago)
Author:
commit-queue@webkit.org
Message:

[WebGL2] fbostatequery, negativebufferapi, negativevertexarrayapi, shaderstatequery conformance failures
https://bugs.webkit.org/show_bug.cgi?id=220372

Patch by Kenneth Russell <kbr@chromium.org> on 2021-01-13
Reviewed by Darin Adler.

Source/ThirdParty/ANGLE:

Add a needed early-out in drawArraysInstanced validation when the
primitive count is zero. This patch will be upstreamed to ANGLE
afterward.

  • src/libANGLE/validationES.h:

(gl::ValidateDrawArraysAttribs):
(gl::ValidateDrawArraysCommon):

Source/WebCore:

Fix validation of program and shader objects to address
conformance test failures. Unify and clean up validation of some
other object types.

Fix bugs in queries of framebuffer attachments and integer vertex
attributes.

Remove an old macOS workaround from GraphicsContextGLANGLE which
was causing test failures of maximum renderbuffer sizes.

Generate tests' expected OpenGL errors for a few APIs.

Covered by existing WebGL 2.0 conformance tests.

  • html/canvas/WebGL2RenderingContext.cpp:

(WebCore::WebGL2RenderingContext::copyBufferSubData):
(WebCore::WebGL2RenderingContext::bindFramebuffer):
(WebCore::WebGL2RenderingContext::getFragDataLocation):
(WebCore::WebGL2RenderingContext::vertexAttribIPointer):
(WebCore::WebGL2RenderingContext::drawBuffers):
(WebCore::WebGL2RenderingContext::isQuery):
(WebCore::WebGL2RenderingContext::beginQuery):
(WebCore::WebGL2RenderingContext::getQueryParameter):
(WebCore::WebGL2RenderingContext::isSampler):
(WebCore::WebGL2RenderingContext::isSync):
(WebCore::WebGL2RenderingContext::deleteSync):
(WebCore::WebGL2RenderingContext::clientWaitSync):
(WebCore::WebGL2RenderingContext::waitSync):
(WebCore::WebGL2RenderingContext::getSyncParameter):
(WebCore::WebGL2RenderingContext::deleteTransformFeedback):
(WebCore::WebGL2RenderingContext::isTransformFeedback):
(WebCore::WebGL2RenderingContext::bindTransformFeedback):
(WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
(WebCore::WebGL2RenderingContext::getTransformFeedbackVarying):
(WebCore::WebGL2RenderingContext::setIndexedBufferBinding):
(WebCore::WebGL2RenderingContext::getUniformIndices):
(WebCore::WebGL2RenderingContext::getActiveUniforms):
(WebCore::WebGL2RenderingContext::getUniformBlockIndex):
(WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter):
(WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
(WebCore::WebGL2RenderingContext::uniformBlockBinding):
(WebCore::WebGL2RenderingContext::deleteVertexArray):
(WebCore::WebGL2RenderingContext::isVertexArray):
(WebCore::WebGL2RenderingContext::bindVertexArray):
(WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):

  • html/canvas/WebGLObject.cpp:

(WebCore::WebGLObject::deleteObject):

  • html/canvas/WebGLObject.h:
  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::attachShader):
(WebCore::WebGLRenderingContextBase::bindAttribLocation):
(WebCore::WebGLRenderingContextBase::validateNullableWebGLObject):
(WebCore::WebGLRenderingContextBase::bindBuffer):
(WebCore::WebGLRenderingContextBase::bindFramebuffer):
(WebCore::WebGLRenderingContextBase::bindRenderbuffer):
(WebCore::WebGLRenderingContextBase::bindTexture):
(WebCore::WebGLRenderingContextBase::compileShader):
(WebCore::WebGLRenderingContextBase::detachShader):
(WebCore::WebGLRenderingContextBase::validateWebGLObject):
(WebCore::WebGLRenderingContextBase::validateWebGLProgramOrShader):
(WebCore::WebGLRenderingContextBase::framebufferRenderbuffer):
(WebCore::WebGLRenderingContextBase::framebufferTexture2D):
(WebCore::WebGLRenderingContextBase::getActiveAttrib):
(WebCore::WebGLRenderingContextBase::getActiveUniform):
(WebCore::WebGLRenderingContextBase::getAttachedShaders):
(WebCore::WebGLRenderingContextBase::getAttribLocation):
(WebCore::WebGLRenderingContextBase::getProgramInfoLog):
(WebCore::WebGLRenderingContextBase::getShaderInfoLog):
(WebCore::WebGLRenderingContextBase::getShaderSource):
(WebCore::WebGLRenderingContextBase::getUniform):
(WebCore::WebGLRenderingContextBase::getUniformLocation):
(WebCore::WebGLRenderingContextBase::getVertexAttrib):
(WebCore::WebGLRenderingContextBase::isBuffer):
(WebCore::WebGLRenderingContextBase::isFramebuffer):
(WebCore::WebGLRenderingContextBase::isProgram):
(WebCore::WebGLRenderingContextBase::isRenderbuffer):
(WebCore::WebGLRenderingContextBase::isShader):
(WebCore::WebGLRenderingContextBase::isTexture):
(WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
(WebCore::WebGLRenderingContextBase::shaderSource):
(WebCore::WebGLRenderingContextBase::useProgram):
(WebCore::WebGLRenderingContextBase::validateProgram):
(WebCore::WebGLRenderingContextBase::vertexAttribPointer):
(WebCore::WebGLRenderingContextBase::drawArraysInstanced):
(WebCore::WebGLRenderingContextBase::drawElementsInstanced):
(WebCore::WebGLRenderingContextBase::checkObjectToBeBound): Deleted.

  • html/canvas/WebGLRenderingContextBase.h:
  • html/canvas/WebGLVertexArrayObjectBase.cpp:

(WebCore::WebGLVertexArrayObjectBase::setVertexAttribState):

  • html/canvas/WebGLVertexArrayObjectBase.h:
  • platform/graphics/angle/GraphicsContextGLANGLE.cpp:

(WebCore::GraphicsContextGLOpenGL::getIntegerv):

LayoutTests:

Rebaseline tests which are either now passing or which have
progressed.

  • webgl/2.0.0/conformance/programs/program-test-expected.txt:
  • webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt:
  • webgl/2.0.0/deqp/functional/gles3/fbostatequery-expected.txt:
  • webgl/2.0.0/deqp/functional/gles3/negativebufferapi-expected.txt:
  • webgl/2.0.0/deqp/functional/gles3/negativevertexarrayapi-expected.txt:
  • webgl/2.0.0/deqp/functional/gles3/shaderstatequery-expected.txt:
Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271442 r271444  
     12021-01-13  Kenneth Russell  <kbr@chromium.org>
     2
     3        [WebGL2] fbostatequery, negativebufferapi, negativevertexarrayapi, shaderstatequery conformance failures
     4        https://bugs.webkit.org/show_bug.cgi?id=220372
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline tests which are either now passing or which have
     9        progressed.
     10
     11        * webgl/2.0.0/conformance/programs/program-test-expected.txt:
     12        * webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt:
     13        * webgl/2.0.0/deqp/functional/gles3/fbostatequery-expected.txt:
     14        * webgl/2.0.0/deqp/functional/gles3/negativebufferapi-expected.txt:
     15        * webgl/2.0.0/deqp/functional/gles3/negativevertexarrayapi-expected.txt:
     16        * webgl/2.0.0/deqp/functional/gles3/shaderstatequery-expected.txt:
     17
    1182021-01-13  Rini Patel  <rini_patel@apple.com>
    219
  • trunk/LayoutTests/webgl/2.0.0/conformance/programs/program-test-expected.txt

    r265534 r271444  
    22
    33Test: ../../resources/webgl_test_files/conformance/programs/program-test.html
    4 
    5 [ 1: PASS ] context exists
    6 [ 2: PASS ] good vertex shader should compile
    7 [ 3: PASS ] getError was expected value: NO_ERROR : should be no errors at this point
    8 [ 4: PASS ] invalid call to getShaderParameter should return null
    9 [ 5: PASS ] getError was expected value: INVALID_ENUM : INFO_LOG_LENGTH is not a valid argument to getShaderParameter in WebGL
    10 [ 6: PASS ] invalid call to getShaderParameter should return null
    11 [ 7: PASS ] getError was expected value: INVALID_ENUM : SHADER_SOURCE_LENGTH is not a valid argument to getShaderParameter in WebGL
    12 [ 8: PASS ] good vertex shader #2 should compile
    13 [ 9: PASS ] good fragment shader should compile
    14 [ 10: PASS ] good fragment shader #2 should compile
    15 [ 11: PASS ] getError was expected value: NO_ERROR : should be no errors at this point
    16 [ 12: PASS ] getError was expected value: NO_ERROR : attaching a vertex shader should succeed
    17 [ 13: PASS ] getError was expected value: INVALID_OPERATION : attaching an already attached vertex shader should generate INVALID_OPERATION
    18 [ 14: PASS ] getError was expected value: NO_ERROR : attaching a fragment shader should succeed
    19 [ 15: PASS ] getError was expected value: INVALID_OPERATION : attaching an already attached fragment shader should generate INVALID_OPERATION
    20 [ 16: PASS ] getError was expected value: INVALID_OPERATION : attaching shaders of the same type to a program should generate INVALID_OPERATION
    21 [ 17: PASS ] getError was expected value: INVALID_OPERATION : attaching shaders of the same type to a program should generate INVALID_OPERATION
    22 [ 18: PASS ] getError was expected value: NO_ERROR : detaching a vertex shader should succeed
    23 [ 19: PASS ] getError was expected value: INVALID_OPERATION : detaching a not already attached vertex shader should generate INVALID_OPERATION
    24 [ 20: PASS ] getError was expected value: NO_ERROR : detaching a fragment shader should succeed
    25 [ 21: PASS ] getError was expected value: INVALID_OPERATION : detaching a not already attached fragment shader should generate INVALID_OPERATION
    26 [ 22: PASS ] getAttachedShaders should return an empty list by default
    27 [ 23: PASS ] attaching a single shader should give the expected list
    28 [ 24: PASS ] attaching some shaders should give the expected list
    29 [ 25: PASS ] attaching a shader and detaching it should leave an empty list
    30 [ 26: PASS ] attaching some shaders and detaching them in same order should leave an empty list
    31 [ 27: PASS ] attaching some shaders and detaching them in random order should leave an empty list
    32 [ 28: PASS ] attaching and detaching some shaders should leave the difference list
    33 [ 29: PASS ] attaching and detaching some shaders should leave the difference list
    34 [ 30: PASS ] attaching a shader that failed to compile should still show it in the list
    35 [ 31: PASS ] attaching shaders, including one that failed to compile, should still show the it in the list
    36 [ 32: PASS ] valid program should link
    37 [ 33: PASS ] invalid call to getProgramParameter should return null
    38 [ 34: PASS ] getError was expected value: INVALID_ENUM : INFO_LOG_LENGTH is not a valid argument to getProgramParameter in WebGL
    39 [ 35: PASS ] invalid call to getProgramParameter should return null
    40 [ 36: PASS ] getError was expected value: INVALID_ENUM : ACTIVE_ATTRIBUTE_MAX_LENGTH is not a valid argument to getProgramParameter in WebGL
    41 [ 37: PASS ] invalid call to getProgramParameter should return null
    42 [ 38: PASS ] getError was expected value: INVALID_ENUM : ACTIVE_UNIFORM_MAX_LENGTH is not a valid argument to getProgramParameter in WebGL
    43 [ 39: PASS ] getError was expected value: NO_ERROR : using a valid program should succeed
    44 [ 40: PASS ] valid program #2 should link
    45 [ 41: PASS ] getError was expected value: NO_ERROR : using a valid program should succeed
    46 [ 42: PASS ] program with no fragment shader should fail to link
    47 [ 43: PASS ] getError was expected value: INVALID_OPERATION : using an invalid program should generate INVALID_OPERATION
    48 [ 44: PASS ] program with no vertex shader should fail to link
    49 [ 45: PASS ] getError was expected value: INVALID_OPERATION : using an invalid program should generate INVALID_OPERATION
    50 [ 46: PASS ] program with bad vertex shader should fail to link
    51 [ 47: PASS ] getError was expected value: INVALID_OPERATION : using an invalid program should generate INVALID_OPERATION
    52 [ 48: PASS ] program with bad fragment shader should fail to link
    53 [ 49: PASS ] getError was expected value: INVALID_OPERATION : using an invalid program should generate INVALID_OPERATION
    54 [ 50: PASS ] program with bad shaders should fail to link
    55 [ 51: PASS ] getError was expected value: INVALID_OPERATION : using an invalid program should generate INVALID_OPERATION
    56 [ 52: PASS ] getError was expected value: NO_ERROR : using a valid program shouldn't generate a GL error
    57 [ 53: PASS ] getError was expected value: NO_ERROR : should be no errors at this point #2
    58 [ 54: PASS ] getError was expected value: INVALID_OPERATION : drawing with a null program should generate INVALID_OPERATION
    59 [ 55: PASS ] getError was expected value: NO_ERROR : drawing with a valid program shouldn't generate a GL error
    60 [ 56: PASS ] getError was expected value: INVALID_OPERATION : using an invalid program should generate INVALID_OPERATION
    61 [ 57: PASS ] getError was expected value: NO_ERROR : Try to use an invalid program should not change the current rendering state
    62 [ 58: PASS ] getError was expected value: NO_ERROR : drawing with a valid program shouldn't generate a GL error
    63 [ 59: PASS ] linking should fail with in-use formerly good program, with new bad shader attached
    64 [ 60: PASS ] getError was expected value: NO_ERROR : drawing with a valid program shouldn't generate a GL error
    65 [ 61: PASS ] getError was expected value: NO_ERROR : drawing with a valid when last used program shouldn't generate a GL error
    66 [ 62: PASS ] delete shaders after attaching them and before linking program should not affect linkProgram
    67 [ 63: PASS ] getError was expected value: NO_ERROR : using a valid program should succeed
    68 [ 64: PASS ] getError was expected value: NO_ERROR : drawing with a valid when last used program shouldn't generate a GL error
    69 [ 65: PASS ] getError was expected value: NO_ERROR : delete the current program shouldn't change the current rendering state
    70 [ 66: PASS ] getError was expected value: NO_ERROR : The current program shouldn't be deleted
    71 [ 67: PASS ] good fragment shader should compile
    72 [ 68: PASS ] getError was expected value: INVALID_VALUE : an unattached shader should be deleted immediately
    73 [ 69: PASS ] good fragment shader should compile
    74 [ 70: FAIL ] an attached shader shouldn't be deleted
    75 [ 71: FAIL ] getError expected: INVALID_VALUE. Was INVALID_OPERATION : a delete-marked program should be deleted once it's no longer the current program
    76 [ 72: PASS ] getError was expected value: INVALID_VALUE : a delete-marked shader should be deleted once all its attachments are removed
    77 [ 73: PASS ] should be red
    78 [ 74: PASS ] should be green
    79 [ 75: PASS ] should be red
    80 [ 76: PASS ] should be tranparent black
    81 [ 77: PASS ] getError was expected value: NO_ERROR : should be no errors
    82 [ 78: PASS ] successfullyParsed is true
    83 [ FAIL ] 2 failures reported
     4[ PASS ] All tests passed
  • trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt

    r265841 r271444  
    4343[ 39: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) is non-zero.
    4444[ 40: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    45 [ 41: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) should be 0 (of type number). Was null (of type object).
     45[ 41: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) is 0
    4646[ 42: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.TEXTURE
    4747[ 43: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is anotherTexture
     
    5454[ 50: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) is non-zero.
    5555[ 51: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    56 [ 52: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) should be 0 (of type number). Was null (of type object).
     56[ 52: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) is 0
    5757[ 53: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.RENDERBUFFER
    5858[ 54: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is renderbuffer
    5959[ 55: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.RENDERBUFFER
    6060[ 56: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is renderbuffer
    61 [ 57: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 36161. Was 0.
    62 [ 58: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLRenderbuffer]. Was null.
     61[ 57: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.RENDERBUFFER
     62[ 58: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is renderbuffer
    6363[ 59: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE) is non-zero.
    6464[ 60: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE) is non-zero.
     
    6767[ 63: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) is non-zero.
    6868[ 64: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    69 [ 65: FAIL ] getError expected: INVALID_OPERATION. Was INVALID_ENUM : after evaluating: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE)
     69[ 65: PASS ] getError was expected value: INVALID_OPERATION : after evaluating: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE)
    7070[ 66: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    71 [ 67: FAIL ] getFramebufferAttachmentParameter did not generate INVALID_ENUM for invalid parameter enum: NO_ERROR
     71[ 67: PASS ] getFramebufferAttachmentParameter correctly handled invalid parameter enums
    7272[ 68: PASS ] getFramebufferAttachmentParameter correctly handled invalid target enums
    7373[ 69: PASS ] getFramebufferAttachmentParameter correctly handled invalid attachment enums
    7474[ 70: PASS ] gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
    75 [ 71: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.BACK, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 33304. Was 5890.
    76 [ 72: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 33304. Was 0.
    77 [ 73: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 33304. Was 0.
     75[ 71: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.BACK, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.FRAMEBUFFER_DEFAULT
     76[ 72: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.FRAMEBUFFER_DEFAULT
     77[ 73: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.FRAMEBUFFER_DEFAULT
    7878[ 74: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.BACK, gl.FRAMEBUFFER_ATTACHMENT_RED_SIZE) is non-zero.
    7979[ 75: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.BACK, gl.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE) is non-zero.
     
    106106[ 102: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) is non-zero.
    107107[ 103: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    108 [ 104: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) should be 0 (of type number). Was null (of type object).
     108[ 104: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 0, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) is 0
    109109[ 105: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.TEXTURE
    110110[ 106: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is anotherTexture
     
    117117[ 113: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) is non-zero.
    118118[ 114: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    119 [ 115: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) should be 0 (of type number). Was null (of type object).
     119[ 115: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + 7, gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) is 0
    120120[ 116: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.RENDERBUFFER
    121121[ 117: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is renderbuffer
    122122[ 118: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.RENDERBUFFER
    123123[ 119: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is renderbuffer
    124 [ 120: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 36161. Was 0.
    125 [ 121: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLRenderbuffer]. Was null.
     124[ 120: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.RENDERBUFFER
     125[ 121: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) is renderbuffer
    126126[ 122: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE) is non-zero.
    127127[ 123: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE) is non-zero.
     
    130130[ 126: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) is non-zero.
    131131[ 127: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    132 [ 128: FAIL ] getError expected: INVALID_OPERATION. Was INVALID_ENUM : after evaluating: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE)
     132[ 128: PASS ] getError was expected value: INVALID_OPERATION : after evaluating: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE)
    133133[ 129: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) is non-zero.
    134 [ 130: FAIL ] getFramebufferAttachmentParameter did not generate INVALID_ENUM for invalid parameter enum: NO_ERROR
     134[ 130: PASS ] getFramebufferAttachmentParameter correctly handled invalid parameter enums
    135135[ 131: PASS ] getFramebufferAttachmentParameter correctly handled invalid target enums
    136136[ 132: PASS ] getFramebufferAttachmentParameter correctly handled invalid attachment enums
    137137[ 133: PASS ] gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
    138 [ 134: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.BACK, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 33304. Was 5890.
    139 [ 135: FAIL ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 33304. Was 0.
     138[ 134: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.BACK, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.FRAMEBUFFER_DEFAULT
     139[ 135: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.FRAMEBUFFER_DEFAULT
    140140[ 136: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) is gl.NONE
    141141[ 137: PASS ] gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.BACK, gl.FRAMEBUFFER_ATTACHMENT_RED_SIZE) is non-zero.
     
    271271[ 267: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_NORMALIZED) is false
    272272[ 268: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_DIVISOR) is 0
    273 [ 269: FAIL ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_INTEGER) should be false (of type boolean). Was null (of type object).
     273[ 269: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_INTEGER) is false
    274274[ 270: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_DIVISOR) is 2
    275275[ 271: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_STRIDE) is 36
     
    277277[ 273: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_ENABLED) is false
    278278[ 274: PASS ] gl.getVertexAttrib(1, gl.CURRENT_VERTEX_ATTRIB) is [5, 6, 7, 8]
    279 [ 275: FAIL ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_TYPE) should be 5124. Was 5126.
    280 [ 276: FAIL ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_INTEGER) should be true (of type boolean). Was null (of type object).
    281 [ 277: FAIL ] getError expected: NO_ERROR. Was INVALID_ENUM :
     279[ 275: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_TYPE) is gl.INT
     280[ 276: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_INTEGER) is true
     281[ 277: PASS ] getError was expected value: NO_ERROR :
    282282[ 278: PASS ] getVertexAttrib correctly handled invalid parameter enums
    283283[ 279: PASS ] getError was expected value: INVALID_VALUE : after evaluating: gl.getVertexAttrib(16, gl.CURRENT_VERTEX_ATTRIB)
     
    366366[ 362: PASS ] getError was expected value: NO_ERROR :
    367367[ 363: PASS ] successfullyParsed is true
    368 [ FAIL ] 35 failures reported
     368[ FAIL ] 14 failures reported
  • trunk/LayoutTests/webgl/2.0.0/deqp/functional/gles3/fbostatequery-expected.txt

    r265534 r271444  
    22
    33Test: ../../../resources/webgl_test_files/deqp/functional/gles3/fbostatequery.html
    4 
    5 [ 1: FAIL ] fbo.draw_framebuffer_default_framebuffer:
    6 [ 2: FAIL ] fbo.read_framebuffer_default_framebuffer:
    7 [ 3: PASS ] fbo.framebuffer_attachment_object: Passed
    8 [ 4: PASS ] fbo.framebuffer_attachment_texture_level: Passed
    9 [ 5: PASS ] fbo.framebuffer_attachment_texture_cube_map_face: Passed
    10 [ 6: FAIL ] fbo.framebuffer_attachment_texture_layer:
    11 [ 7: PASS ] fbo.framebuffer_attachment_color_encoding: Passed
    12 [ 8: PASS ] fbo.framebuffer_attachment_component_type: Passed
    13 [ 9: PASS ] fbo.framebuffer_attachment_x_size_initial: Passed
    14 [ 10: PASS ] fbo.framebuffer_attachment_x_size_rbo: Passed
    15 [ 11: PASS ] fbo.framebuffer_attachment_x_size_texture: Passed
    16 [ 12: PASS ] fbo.framebuffer_unspecified_attachment_color_encoding: Passed
    17 [ 13: PASS ] fbo.framebuffer_unspecified_attachment_component_type: Passed
    18 [ 14: PASS ] fbo.framebuffer_unspecified_attachment_x_size_rbo: Passed
    19 [ 15: PASS ] fbo.framebuffer_unspecified_attachment_x_size_texture: Passed
    20 [ 16: PASS ] fbo.framebuffer_unspecified_attachment_x_size_texture: successfullyParsed is true
    21 [ FAIL ] 3 failures reported
     4[ PASS ] All tests passed
  • trunk/LayoutTests/webgl/2.0.0/deqp/functional/gles3/negativebufferapi-expected.txt

    r265534 r271444  
    22
    33Test: ../../../resources/webgl_test_files/deqp/functional/gles3/negativebufferapi.html
    4 
    5 [ 1: PASS ] negativeBufferApi.bind_buffer: Passed
    6 [ 2: PASS ] negativeBufferApi.buffer_data: Passed
    7 [ 3: PASS ] negativeBufferApi.buffer_sub_data: Passed
    8 [ 4: PASS ] negativeBufferApi.buffer_sub_data_size_offset: Passed
    9 [ 5: PASS ] negativeBufferApi.clear: Passed
    10 [ 6: PASS ] negativeBufferApi.read_pixels: Passed
    11 [ 7: PASS ] negativeBufferApi.read_pixels_format_mismatch: Passed
    12 [ 8: PASS ] negativeBufferApi.read_pixels_fbo_format_mismatch: Passed
    13 [ 9: PASS ] negativeBufferApi.bind_buffer_range: Passed
    14 [ 10: PASS ] negativeBufferApi.bind_buffer_base: Passed
    15 [ 11: PASS ] negativeBufferApi.clear_bufferiv: Passed
    16 [ 12: PASS ] negativeBufferApi.clear_bufferuiv: Passed
    17 [ 13: PASS ] negativeBufferApi.clear_bufferfv: Passed
    18 [ 14: PASS ] negativeBufferApi.clear_bufferfi: Passed
    19 [ 15: FAIL ] negativeBufferApi.copy_buffer_sub_data: Expected gl.INVALID_OPERATION, but got gl.INVALID_VALUE.
    20 [ 16: FAIL ] negativeBufferApi.draw_buffers: Expected gl.NO_ERROR, but got gl.INVALID_OPERATION.
    21 [ 17: PASS ] negativeBufferApi.bind_framebuffer: Passed
    22 [ 18: PASS ] negativeBufferApi.bind_renderbuffer: Passed
    23 [ 19: PASS ] negativeBufferApi.check_framebuffer_status: Passed
    24 [ 20: PASS ] negativeBufferApi.framebuffer_renderbuffer: Passed
    25 [ 21: PASS ] negativeBufferApi.framebuffer_texture2d: Passed
    26 [ 22: FAIL ] negativeBufferApi.renderbuffer_storage: Expected gl.INVALID_VALUE, but got gl.NO_ERROR.
    27 [ 23: PASS ] negativeBufferApi.blit_framebuffer: Passed
    28 [ 24: PASS ] negativeBufferApi.blit_framebuffer_multisample: Passed
    29 [ 25: PASS ] negativeBufferApi.framebuffer_texture_layer: Passed
    30 [ 26: PASS ] negativeBufferApi.invalidate_framebuffer: Passed
    31 [ 27: PASS ] negativeBufferApi.invalidate_sub_framebuffer: Passed
    32 [ 28: FAIL ] negativeBufferApi.renderbuffer_storage_multisample: Expected gl.INVALID_VALUE, but got gl.NO_ERROR.
    33 [ 29: PASS ] successfullyParsed is true
    34 [ FAIL ] 4 failures reported
     4[ PASS ] All tests passed
  • trunk/LayoutTests/webgl/2.0.0/deqp/functional/gles3/negativevertexarrayapi-expected.txt

    r265534 r271444  
    22
    33Test: ../../../resources/webgl_test_files/deqp/functional/gles3/negativevertexarrayapi.html
    4 
    5 [ 1: PASS ] vertex_array.vertex_attribf: Passed
    6 [ 2: PASS ] vertex_array.vertex_attribfv: Passed
    7 [ 3: PASS ] vertex_array.vertex_attribi4: Passed
    8 [ 4: PASS ] vertex_array.vertex_attribi4v: Passed
    9 [ 5: PASS ] vertex_array.vertex_attrib_pointer: Passed
    10 [ 6: PASS ] vertex_array.vertex_attrib_i_pointer: Passed
    11 [ 7: PASS ] vertex_array.enable_vertex_attrib_array: Passed
    12 [ 8: PASS ] vertex_array.disable_vertex_attrib_array: Passed
    13 [ 9: PASS ] vertex_array.vertex_attrib_divisor: Passed
    14 [ 10: PASS ] vertex_array.draw_arrays: Passed
    15 [ 11: PASS ] vertex_array.draw_arrays_invalid_program: Passed
    16 [ 12: PASS ] vertex_array.draw_arrays_incomplete_primitive: Passed
    17 [ 13: PASS ] vertex_array.draw_elements: Passed
    18 [ 14: PASS ] vertex_array.draw_elements_invalid_program: Passed
    19 [ 15: PASS ] vertex_array.draw_elements_incomplete_primitive: Passed
    20 [ 16: PASS ] vertex_array.draw_arrays_instanced: Passed
    21 [ 17: PASS ] vertex_array.draw_arrays_instanced_invalid_program: Passed
    22 [ 18: PASS ] vertex_array.draw_arrays_instanced_incomplete_primitive: Passed
    23 [ 19: FAIL ] vertex_array.draw_elements_instanced: Expected gl.INVALID_VALUE, but got gl.NO_ERROR.
    24 [ 20: PASS ] vertex_array.draw_elements_instanced_invalid_program: Passed
    25 [ 21: FAIL ] vertex_array.draw_elements_instanced_incomplete_primitive: Expected gl.INVALID_VALUE, but got gl.NO_ERROR.
    26 [ 22: PASS ] vertex_array.draw_range_elements: Passed
    27 [ 23: PASS ] vertex_array.draw_range_elements_invalid_program: Passed
    28 [ 24: PASS ] vertex_array.draw_range_elements_incomplete_primitive: Passed
    29 [ 25: PASS ] vertex_array.draw_range_elements_incomplete_primitive: successfullyParsed is true
    30 [ FAIL ] 2 failures reported
     4[ PASS ] All tests passed
  • trunk/LayoutTests/webgl/2.0.0/deqp/functional/gles3/shaderstatequery-expected.txt

    r265534 r271444  
    22
    33Test: ../../../resources/webgl_test_files/deqp/functional/gles3/shaderstatequery.html
    4 
    5 [ 1: PASS ] shader.shader_type: Passed
    6 [ 2: PASS ] shader.shader_compile_status: Passed
    7 [ 3: PASS ] shader.shader_info_log: Passed
    8 [ 4: PASS ] shader.shader_source: Passed
    9 [ 5: FAIL ] shader.delete_status:
    10 [ 6: PASS ] shader.current_vertex_attrib_initial: Passed
    11 [ 7: PASS ] shader.current_vertex_attrib_float: Passed
    12 [ 8: PASS ] shader.current_vertex_attrib_int: Passed
    13 [ 9: PASS ] shader.current_vertex_attrib_uint: Passed
    14 [ 10: PASS ] shader.program_info_log: Passed
    15 [ 11: PASS ] shader.program_validate_status: Passed
    16 [ 12: PASS ] shader.program_attached_shaders: Passed
    17 [ 13: PASS ] shader.program_active_uniform_name: Passed
    18 [ 14: PASS ] shader.program_active_uniform_types: Passed
    19 [ 15: FAIL ] shader.program_active_uniform_blocks: Expected { 1, 2}; got {1, 2}
    20 [ 16: PASS ] shader.transform_feedback: Passed
    21 [ 17: PASS ] shader.active_attributes: Passed
    22 [ 18: PASS ] shader.vertex_attrib_size: Passed
    23 [ 19: FAIL ] shader.vertex_attrib_type:
    24 [ 20: FAIL ] shader.vertex_attrib_stride:
    25 [ 21: FAIL ] shader.vertex_attrib_normalized:
    26 [ 22: FAIL ] shader.vertex_attrib_integer:
    27 [ 23: PASS ] shader.vertex_attrib_array_enabled: Passed
    28 [ 24: PASS ] shader.vertex_attrib_array_divisor: Passed
    29 [ 25: PASS ] shader.vertex_attrib_array_buffer_binding: Passed
    30 [ 26: PASS ] shader.vertex_attrib_offset: Passed
    31 [ 27: PASS ] shader.uniform_value_float: Passed
    32 [ 28: PASS ] shader.uniform_value_int: Passed
    33 [ 29: PASS ] shader.uniform_value_uint: Passed
    34 [ 30: PASS ] shader.uniform_value_boolean: Passed
    35 [ 31: PASS ] shader.uniform_value_sampler: Passed
    36 [ 32: PASS ] shader.uniform_value_array: Passed
    37 [ 33: PASS ] shader.uniform_value_matrix: Passed
    38 [ 34: PASS ] shader.precision_vertex_lowp_float: Passed
    39 [ 35: PASS ] shader.precision_vertex_mediump_float: Passed
    40 [ 36: PASS ] shader.precision_vertex_highp_float: Passed
    41 [ 37: PASS ] shader.precision_vertex_lowp_int: Passed
    42 [ 38: PASS ] shader.precision_vertex_mediump_int: Passed
    43 [ 39: PASS ] shader.precision_vertex_highp_int: Passed
    44 [ 40: PASS ] shader.precision_fragment_lowp_float: Passed
    45 [ 41: PASS ] shader.precision_fragment_mediump_float: Passed
    46 [ 42: PASS ] shader.precision_fragment_highp_float: Passed
    47 [ 43: PASS ] shader.precision_fragment_lowp_int: Passed
    48 [ 44: PASS ] shader.precision_fragment_mediump_int: Passed
    49 [ 45: PASS ] shader.precision_fragment_highp_int: Passed
    50 [ 46: PASS ] shader.precision_fragment_highp_int: successfullyParsed is true
    51 [ FAIL ] 6 failures reported
     4[ PASS ] All tests passed
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r271334 r271444  
     12021-01-13  Kenneth Russell  <kbr@chromium.org>
     2
     3        [WebGL2] fbostatequery, negativebufferapi, negativevertexarrayapi, shaderstatequery conformance failures
     4        https://bugs.webkit.org/show_bug.cgi?id=220372
     5
     6        Reviewed by Darin Adler.
     7
     8        Add a needed early-out in drawArraysInstanced validation when the
     9        primitive count is zero. This patch will be upstreamed to ANGLE
     10        afterward.
     11
     12        * src/libANGLE/validationES.h:
     13        (gl::ValidateDrawArraysAttribs):
     14        (gl::ValidateDrawArraysCommon):
     15
    1162021-01-08  Kyle Piddington  <kpiddington@apple.com>
    217
  • trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.h

    r270351 r271444  
    792792}
    793793
    794 ANGLE_INLINE bool ValidateDrawArraysAttribs(const Context *context, GLint first, GLsizei count)
     794ANGLE_INLINE bool ValidateDrawArraysAttribs(const Context *context, GLint first, GLsizei count, GLsizei primcount)
    795795{
    796796    if (!context->isBufferAccessValidationEnabled())
     
    812812    }
    813813
     814    if (primcount == 0)
     815    {
     816        // Skip the specific validation of the non-instanced vertex element limit.
     817        return true;
     818    }
     819
    814820    return ValidateDrawAttribs(context, maxVertex);
    815821}
     
    871877    }
    872878
    873     return ValidateDrawArraysAttribs(context, first, count);
     879    return ValidateDrawArraysAttribs(context, first, count, primcount);
    874880}
    875881
  • trunk/Source/WebCore/ChangeLog

    r271441 r271444  
     12021-01-13  Kenneth Russell  <kbr@chromium.org>
     2
     3        [WebGL2] fbostatequery, negativebufferapi, negativevertexarrayapi, shaderstatequery conformance failures
     4        https://bugs.webkit.org/show_bug.cgi?id=220372
     5
     6        Reviewed by Darin Adler.
     7
     8        Fix validation of program and shader objects to address
     9        conformance test failures. Unify and clean up validation of some
     10        other object types.
     11
     12        Fix bugs in queries of framebuffer attachments and integer vertex
     13        attributes.
     14
     15        Remove an old macOS workaround from GraphicsContextGLANGLE which
     16        was causing test failures of maximum renderbuffer sizes.
     17
     18        Generate tests' expected OpenGL errors for a few APIs.
     19
     20        Covered by existing WebGL 2.0 conformance tests.
     21
     22        * html/canvas/WebGL2RenderingContext.cpp:
     23        (WebCore::WebGL2RenderingContext::copyBufferSubData):
     24        (WebCore::WebGL2RenderingContext::bindFramebuffer):
     25        (WebCore::WebGL2RenderingContext::getFragDataLocation):
     26        (WebCore::WebGL2RenderingContext::vertexAttribIPointer):
     27        (WebCore::WebGL2RenderingContext::drawBuffers):
     28        (WebCore::WebGL2RenderingContext::isQuery):
     29        (WebCore::WebGL2RenderingContext::beginQuery):
     30        (WebCore::WebGL2RenderingContext::getQueryParameter):
     31        (WebCore::WebGL2RenderingContext::isSampler):
     32        (WebCore::WebGL2RenderingContext::isSync):
     33        (WebCore::WebGL2RenderingContext::deleteSync):
     34        (WebCore::WebGL2RenderingContext::clientWaitSync):
     35        (WebCore::WebGL2RenderingContext::waitSync):
     36        (WebCore::WebGL2RenderingContext::getSyncParameter):
     37        (WebCore::WebGL2RenderingContext::deleteTransformFeedback):
     38        (WebCore::WebGL2RenderingContext::isTransformFeedback):
     39        (WebCore::WebGL2RenderingContext::bindTransformFeedback):
     40        (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
     41        (WebCore::WebGL2RenderingContext::getTransformFeedbackVarying):
     42        (WebCore::WebGL2RenderingContext::setIndexedBufferBinding):
     43        (WebCore::WebGL2RenderingContext::getUniformIndices):
     44        (WebCore::WebGL2RenderingContext::getActiveUniforms):
     45        (WebCore::WebGL2RenderingContext::getUniformBlockIndex):
     46        (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter):
     47        (WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
     48        (WebCore::WebGL2RenderingContext::uniformBlockBinding):
     49        (WebCore::WebGL2RenderingContext::deleteVertexArray):
     50        (WebCore::WebGL2RenderingContext::isVertexArray):
     51        (WebCore::WebGL2RenderingContext::bindVertexArray):
     52        (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
     53        * html/canvas/WebGLObject.cpp:
     54        (WebCore::WebGLObject::deleteObject):
     55        * html/canvas/WebGLObject.h:
     56        * html/canvas/WebGLRenderingContextBase.cpp:
     57        (WebCore::WebGLRenderingContextBase::attachShader):
     58        (WebCore::WebGLRenderingContextBase::bindAttribLocation):
     59        (WebCore::WebGLRenderingContextBase::validateNullableWebGLObject):
     60        (WebCore::WebGLRenderingContextBase::bindBuffer):
     61        (WebCore::WebGLRenderingContextBase::bindFramebuffer):
     62        (WebCore::WebGLRenderingContextBase::bindRenderbuffer):
     63        (WebCore::WebGLRenderingContextBase::bindTexture):
     64        (WebCore::WebGLRenderingContextBase::compileShader):
     65        (WebCore::WebGLRenderingContextBase::detachShader):
     66        (WebCore::WebGLRenderingContextBase::validateWebGLObject):
     67        (WebCore::WebGLRenderingContextBase::validateWebGLProgramOrShader):
     68        (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer):
     69        (WebCore::WebGLRenderingContextBase::framebufferTexture2D):
     70        (WebCore::WebGLRenderingContextBase::getActiveAttrib):
     71        (WebCore::WebGLRenderingContextBase::getActiveUniform):
     72        (WebCore::WebGLRenderingContextBase::getAttachedShaders):
     73        (WebCore::WebGLRenderingContextBase::getAttribLocation):
     74        (WebCore::WebGLRenderingContextBase::getProgramInfoLog):
     75        (WebCore::WebGLRenderingContextBase::getShaderInfoLog):
     76        (WebCore::WebGLRenderingContextBase::getShaderSource):
     77        (WebCore::WebGLRenderingContextBase::getUniform):
     78        (WebCore::WebGLRenderingContextBase::getUniformLocation):
     79        (WebCore::WebGLRenderingContextBase::getVertexAttrib):
     80        (WebCore::WebGLRenderingContextBase::isBuffer):
     81        (WebCore::WebGLRenderingContextBase::isFramebuffer):
     82        (WebCore::WebGLRenderingContextBase::isProgram):
     83        (WebCore::WebGLRenderingContextBase::isRenderbuffer):
     84        (WebCore::WebGLRenderingContextBase::isShader):
     85        (WebCore::WebGLRenderingContextBase::isTexture):
     86        (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
     87        (WebCore::WebGLRenderingContextBase::shaderSource):
     88        (WebCore::WebGLRenderingContextBase::useProgram):
     89        (WebCore::WebGLRenderingContextBase::validateProgram):
     90        (WebCore::WebGLRenderingContextBase::vertexAttribPointer):
     91        (WebCore::WebGLRenderingContextBase::drawArraysInstanced):
     92        (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
     93        (WebCore::WebGLRenderingContextBase::checkObjectToBeBound): Deleted.
     94        * html/canvas/WebGLRenderingContextBase.h:
     95        * html/canvas/WebGLVertexArrayObjectBase.cpp:
     96        (WebCore::WebGLVertexArrayObjectBase::setVertexAttribState):
     97        * html/canvas/WebGLVertexArrayObjectBase.h:
     98        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
     99        (WebCore::GraphicsContextGLOpenGL::getIntegerv):
     100
    11012021-01-13  Rob Buis  <rbuis@igalia.com>
    2102
  • trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp

    r270400 r271444  
    582582    RefPtr<WebGLBuffer> writeBuffer = validateBufferDataParameters("copyBufferSubData", writeTarget, GraphicsContextGL::STATIC_DRAW);
    583583    if (!readBuffer || !writeBuffer) {
    584         synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "copyBufferSubData", "Invalid readTarget or writeTarget");
     584        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "copyBufferSubData", "Invalid readTarget or writeTarget");
    585585        return;
    586586    }
     
    690690    auto locker = holdLock(objectGraphLock());
    691691
    692     if (!checkObjectToBeBound("bindFramebuffer", buffer))
     692    if (!validateNullableWebGLObject("bindFramebuffer", buffer))
    693693        return;
    694694
     
    14941494GCGLint WebGL2RenderingContext::getFragDataLocation(WebGLProgram& program, const String& name)
    14951495{
    1496     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getFragDataLocation", &program))
     1496    if (!validateWebGLProgramOrShader("getFragDataLocation", &program))
    14971497        return -1;
    14981498    return m_context->getFragDataLocation(program.object(), name);
     
    17051705void WebGL2RenderingContext::vertexAttribIPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLsizei stride, GCGLint64 offset)
    17061706{
    1707     if (isContextLostOrPending())
    1708         return;
    1709 
     1707    auto locker = holdLock(objectGraphLock());
     1708
     1709    if (isContextLostOrPending())
     1710        return;
     1711
     1712    switch (type) {
     1713    case GraphicsContextGL::BYTE:
     1714    case GraphicsContextGL::UNSIGNED_BYTE:
     1715    case GraphicsContextGL::SHORT:
     1716    case GraphicsContextGL::UNSIGNED_SHORT:
     1717    case GraphicsContextGL::FLOAT:
     1718    case GraphicsContextGL::INT:
     1719    case GraphicsContextGL::UNSIGNED_INT:
     1720        break;
     1721    default:
     1722        synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "vertexAttribIPointer", "invalid type");
     1723        return;
     1724    }
     1725    if (index >= m_maxVertexAttribs) {
     1726        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "vertexAttribIPointer", "index out of range");
     1727        return;
     1728    }
     1729    if (size < 1 || size > 4) {
     1730        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "vertexAttribIPointer", "bad size");
     1731        return;
     1732    }
     1733    if (stride < 0 || stride > 255) {
     1734        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "vertexAttribIPointer", "bad stride");
     1735        return;
     1736    }
     1737    if (offset < 0 || offset > std::numeric_limits<int32_t>::max()) {
     1738        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "vertexAttribIPointer", "bad offset");
     1739        return;
     1740    }
     1741    if (!m_boundArrayBuffer && offset) {
     1742        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "vertexAttribIPointer", "no bound ARRAY_BUFFER");
     1743        return;
     1744    }
     1745    // Determine the number of elements the bound buffer can hold, given the offset, size, type and stride.
     1746    auto typeSize = sizeInBytes(type);
     1747    if (!typeSize) {
     1748        synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "vertexAttribIPointer", "invalid type");
     1749        return;
     1750    }
     1751    if ((stride % typeSize) || (static_cast<GCGLintptr>(offset) % typeSize)) {
     1752        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "vertexAttribIPointer", "stride or offset not valid for type");
     1753        return;
     1754    }
     1755    GCGLsizei bytesPerElement = size * typeSize;
     1756
     1757    m_boundVertexArrayObject->setVertexAttribState(locker, index, bytesPerElement, size, type, false, stride, static_cast<GCGLintptr>(offset), true, m_boundArrayBuffer.get());
    17101758    m_context->vertexAttribIPointer(index, size, type, stride, offset);
    17111759}
     
    17491797    GCGLsizei n = buffers.size();
    17501798    const GCGLenum* bufs = buffers.data();
     1799    for (GCGLsizei i = 0; i < n; ++i) {
     1800        switch (bufs[i]) {
     1801        case GraphicsContextGL::NONE:
     1802        case GraphicsContextGL::BACK:
     1803        case GraphicsContextGL::COLOR_ATTACHMENT0:
     1804            continue;
     1805        default:
     1806            if (bufs[i] > GraphicsContextGL::COLOR_ATTACHMENT0
     1807                && bufs[i] < GraphicsContextGL::COLOR_ATTACHMENT0 + getMaxColorAttachments()) {
     1808                continue;
     1809            }
     1810            synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "drawBuffers", "invalid buffer");
     1811            return;
     1812        }
     1813    }
    17511814    if (!m_framebufferBinding) {
    17521815        if (n != 1) {
    1753             synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "drawBuffers", "more than one buffer");
     1816            synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "drawBuffers", "more than one buffer");
    17541817            return;
    17551818        }
     
    18541917GCGLboolean WebGL2RenderingContext::isQuery(WebGLQuery* query)
    18551918{
    1856     if (isContextLostOrPending() || !query || !query->object() || !validateWebGLObject("isQuery", query))
     1919    if (isContextLostOrPending() || !query || !query->validate(contextGroup(), *this))
    18571920        return false;
     1921
     1922    if (query->isDeleted())
     1923        return false;
     1924
    18581925    return m_context->isQuery(query->object());
    18591926}
     
    18751942
    18761943    GCGLenum targetKey;
    1877     if (isContextLostOrPending() || !validateWebGLObject("beginQuery", &query) || !validateQueryTarget("beginQuery", target, &targetKey))
     1944    if (!validateWebGLObject("beginQuery", &query) || !validateQueryTarget("beginQuery", target, &targetKey))
    18781945        return;
    18791946
     
    19362003WebGLAny WebGL2RenderingContext::getQueryParameter(WebGLQuery& query, GCGLenum pname)
    19372004{
    1938     if (isContextLostOrPending() || !validateWebGLObject("getQueryParameter", &query))
     2005    if (!validateWebGLObject("getQueryParameter", &query))
    19392006        return nullptr;
    19402007
     
    19862053GCGLboolean WebGL2RenderingContext::isSampler(WebGLSampler* sampler)
    19872054{
    1988     if (isContextLostOrPending() || !sampler || sampler->isDeleted() || !validateWebGLObject("isSampler", sampler))
     2055    if (isContextLostOrPending() || !sampler || !sampler->validate(contextGroup(), *this) || sampler->isDeleted())
    19892056        return false;
    19902057
     
    20752142GCGLboolean WebGL2RenderingContext::isSync(WebGLSync* sync)
    20762143{
    2077     return !isContextLostOrPending() && sync && !sync->isDeleted() && validateWebGLObject("isSync", sync);
     2144    if (isContextLostOrPending() || !sync || !sync->validate(contextGroup(), *this))
     2145        return false;
     2146
     2147    if (sync->isDeleted())
     2148        return false;
     2149
     2150    return !!sync->object();
    20782151}
    20792152
     
    20822155    auto locker = holdLock(objectGraphLock());
    20832156
    2084     if (isContextLostOrPending() || !sync || sync->isDeleted() || !validateWebGLObject("deleteSync", sync))
    2085         return;
    20862157    deleteObject(locker, sync);
    20872158}
     
    20892160GCGLenum WebGL2RenderingContext::clientWaitSync(WebGLSync& sync, GCGLbitfield flags, GCGLuint64 timeout)
    20902161{
    2091     if (isContextLostOrPending() || !validateWebGLObject("clientWaitSync", &sync))
     2162    if (!validateWebGLObject("clientWaitSync", &sync))
    20922163        return GraphicsContextGL::WAIT_FAILED_WEBGL;
    20932164
     
    21122183void WebGL2RenderingContext::waitSync(WebGLSync& sync, GCGLbitfield flags, GCGLint64 timeout)
    21132184{
    2114     if (isContextLostOrPending() || !validateWebGLObject("waitSync", &sync))
     2185    if (!validateWebGLObject("waitSync", &sync))
    21152186        return;
    21162187
     
    21252196WebGLAny WebGL2RenderingContext::getSyncParameter(WebGLSync& sync, GCGLenum pname)
    21262197{
    2127     if (isContextLostOrPending() || !validateWebGLObject("getSyncParameter", &sync))
     2198    if (!validateWebGLObject("getSyncParameter", &sync))
    21282199        return nullptr;
    21292200
     
    21552226    auto locker = holdLock(objectGraphLock());
    21562227
    2157     if (isContextLostOrPending() || !feedbackObject || feedbackObject->isDeleted() || !validateWebGLObject("deleteTransformFeedback", feedbackObject))
    2158         return;
    2159    
     2228    // We have to short-circuit the deletion process if the transform feedback is
     2229    // active. This requires duplication of some validation logic.
     2230    if (isContextLostOrPending() && feedbackObject && feedbackObject->validate(contextGroup(), *this)) {
     2231        if (feedbackObject->isActive()) {
     2232            synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "deleteTransformFeedback", "attempt to delete an active transform feedback object");
     2233            return;
     2234        }
     2235    }
     2236
    21602237    ASSERT(feedbackObject != m_defaultTransformFeedback);
    2161    
    2162     if (feedbackObject->isActive()) {
    2163         synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "deleteTransformFeedback", "attempt to delete an active transform feedback object");
    2164         return;
    2165     }
     2238
     2239    if (!deleteObject(locker, feedbackObject))
     2240        return;
    21662241
    21672242    if (m_boundTransformFeedback == feedbackObject)
    21682243        m_boundTransformFeedback = m_defaultTransformFeedback;
    2169 
    2170     deleteObject(locker, feedbackObject);
    21712244}
    21722245
    21732246GCGLboolean WebGL2RenderingContext::isTransformFeedback(WebGLTransformFeedback* feedbackObject)
    21742247{
    2175     if (isContextLostOrPending() || !feedbackObject || feedbackObject->isDeleted() || !validateWebGLObject("isTransformFeedback", feedbackObject))
     2248    if (isContextLostOrPending() || !feedbackObject || !feedbackObject->validate(contextGroup(), *this))
    21762249        return false;
    21772250
     2251    if (!feedbackObject->hasEverBeenBound())
     2252        return false;
     2253    if (feedbackObject->isDeleted())
     2254        return false;
     2255
    21782256    return m_context->isTransformFeedback(feedbackObject->object());
    21792257}
     
    21832261    auto locker = holdLock(objectGraphLock());
    21842262
    2185     if (isContextLostOrPending())
    2186         return;
    2187 
    2188     if (feedbackObject) {
    2189         if (feedbackObject->isDeleted()) {
    2190             synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "bindTransformFeedback", "cannot bind a deleted Transform Feedback object");
    2191             return;
    2192         }
    2193 
    2194         if (!validateWebGLObject("bindTransformFeedback", feedbackObject))
    2195             return;
    2196     }
     2263    if (!validateNullableWebGLObject("bindTransformFeedback", feedbackObject))
     2264        return;
    21972265
    21982266    if (target != GraphicsContextGL::TRANSFORM_FEEDBACK) {
     
    22062274
    22072275    auto toBeBound = feedbackObject ? feedbackObject : m_defaultTransformFeedback.get();
     2276    toBeBound->setHasEverBeenBound();
    22082277    m_context->bindTransformFeedback(target, toBeBound->object());
    22092278    m_boundTransformFeedback = toBeBound;
     
    22752344void WebGL2RenderingContext::transformFeedbackVaryings(WebGLProgram& program, const Vector<String>& varyings, GCGLenum bufferMode)
    22762345{
    2277     if (isContextLostOrPending() || !validateWebGLProgramOrShader("transformFeedbackVaryings", &program))
     2346    if (!validateWebGLProgramOrShader("transformFeedbackVaryings", &program))
    22782347        return;
    22792348   
     
    22982367RefPtr<WebGLActiveInfo> WebGL2RenderingContext::getTransformFeedbackVarying(WebGLProgram& program, GCGLuint index)
    22992368{
    2300     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getTransformFeedbackVarying", &program))
     2369    if (!validateWebGLProgramOrShader("getTransformFeedbackVarying", &program))
    23012370        return nullptr;
    23022371
     
    23512420    auto locker = holdLock(objectGraphLock());
    23522421
    2353     if (isContextLostOrPending())
    2354         return false;
    2355 
    2356     if (!checkObjectToBeBound(functionName, buffer))
     2422    if (!validateNullableWebGLObject(functionName, buffer))
    23572423        return false;
    23582424
     
    24462512Optional<Vector<GCGLuint>> WebGL2RenderingContext::getUniformIndices(WebGLProgram& program, const Vector<String>& names)
    24472513{
    2448 #if USE(ANGLE)
    2449     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getUniformIndices", &program))
     2514    if (!validateWebGLProgramOrShader("getUniformIndices", &program))
    24502515        return WTF::nullopt;
    24512516    return m_context->getUniformIndices(program.object(), names);
    2452 #else
    2453     LOG(WebGL, "[[ NOT IMPLEMENTED ]] getUniformIndices()");
    2454     UNUSED_PARAM(program);
    2455     UNUSED_PARAM(names);
    2456     return WTF::nullopt;
    2457 #endif
    24582517}
    24592518
    24602519WebGLAny WebGL2RenderingContext::getActiveUniforms(WebGLProgram& program, const Vector<GCGLuint>& uniformIndices, GCGLenum pname)
    24612520{
    2462     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getActiveUniforms", &program))
     2521    if (!validateWebGLProgramOrShader("getActiveUniforms", &program))
    24632522        return nullptr;
    24642523
     
    24892548GCGLuint WebGL2RenderingContext::getUniformBlockIndex(WebGLProgram& program, const String& uniformBlockName)
    24902549{
    2491 #if USE(ANGLE)
    2492     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getUniformBlockIndex", &program))
     2550    if (!validateWebGLProgramOrShader("getUniformBlockIndex", &program))
    24932551        return 0;
    24942552    return m_context->getUniformBlockIndex(program.object(), uniformBlockName);
    2495 #else
    2496     UNUSED_PARAM(program);
    2497     UNUSED_PARAM(uniformBlockName);
    2498     LOG(WebGL, "[[ NOT IMPLEMENTED ]] getUniformBlockIndex()");
    2499     return 0;
    2500 #endif
    25012553}
    25022554
    25032555WebGLAny WebGL2RenderingContext::getActiveUniformBlockParameter(WebGLProgram& program, GCGLuint uniformBlockIndex, GCGLenum pname)
    25042556{
    2505 #if USE(ANGLE)
    2506     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getActiveUniformBlockParameter", &program))
     2557    if (!validateWebGLProgramOrShader("getActiveUniformBlockParameter", &program))
    25072558        return nullptr;
    25082559    switch (pname) {
     
    25152566        Vector<GCGLint> params(size, 0);
    25162567        m_context->getActiveUniformBlockiv(program.object(), uniformBlockIndex, pname, params);
    2517         return params.map([](auto x) { return static_cast<GCGLuint>(x); });
     2568        return Uint32Array::tryCreate(reinterpret_cast<GCGLuint*>(params.data()), params.size());
    25182569    }
    25192570    case GraphicsContextGL::UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
     
    25242575        return nullptr;
    25252576    }
    2526 #else
    2527     UNUSED_PARAM(program);
    2528     UNUSED_PARAM(uniformBlockIndex);
    2529     UNUSED_PARAM(pname);
    2530     LOG(WebGL, "[[ NOT IMPLEMENTED ]] getActiveUniformBlockParameter()");
    2531     return nullptr;
    2532 #endif
    25332577}
    25342578
    25352579WebGLAny WebGL2RenderingContext::getActiveUniformBlockName(WebGLProgram& program, GCGLuint index)
    25362580{
    2537 #if USE(ANGLE)
    2538     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getActiveUniformBlockName", &program))
     2581    if (!validateWebGLProgramOrShader("getActiveUniformBlockName", &program))
    25392582        return String();
    25402583    if (!program.getLinkStatus()) {
     
    25462589        return nullptr;
    25472590    return name;
    2548 #else
    2549     UNUSED_PARAM(program);
    2550     UNUSED_PARAM(index);
    2551     LOG(WebGL, "[[ NOT IMPLEMENTED ]] getActiveUniformBlockName()");
    2552     return nullptr;
    2553 #endif
    25542591}
    25552592
    25562593void WebGL2RenderingContext::uniformBlockBinding(WebGLProgram& program, GCGLuint uniformBlockIndex, GCGLuint uniformBlockBinding)
    25572594{
    2558 #if USE(ANGLE)
    2559     if (isContextLostOrPending() || !validateWebGLProgramOrShader("uniformBlockBinding", &program))
     2595    if (!validateWebGLProgramOrShader("uniformBlockBinding", &program))
    25602596        return;
    25612597    m_context->uniformBlockBinding(program.object(), uniformBlockIndex, uniformBlockBinding);
    2562 #else
    2563     UNUSED_PARAM(program);
    2564     UNUSED_PARAM(uniformBlockIndex);
    2565     UNUSED_PARAM(uniformBlockBinding);
    2566     LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformBlockBinding()");
    2567 #endif
    25682598}
    25692599
     
    25822612    auto locker = holdLock(objectGraphLock());
    25832613
     2614    // validateWebGLObject generates an error if the object has already been
     2615    // deleted, so we must replicate most of its checks here.
    25842616    if (!arrayObject || isContextLost())
    25852617        return;
    25862618
     2619    if (!arrayObject->validate(contextGroup(), *this)) {
     2620        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "deleteVertexArray", "object does not belong to this context");
     2621        return;
     2622    }
     2623
    25872624    if (arrayObject->isDeleted())
    25882625        return;
    25892626
    25902627    if (!arrayObject->isDefaultObject() && arrayObject == m_boundVertexArrayObject) {
    2591 #if USE(OPENGL_ES)
    2592         setBoundVertexArrayObject(locker, nullptr);
    2593 #else
    25942628        // bindVertexArray grabs the lock internally.
    25952629        locker.unlockEarly();
    25962630        bindVertexArray(nullptr); // The default VAO was removed in OpenGL 3.3 but not from WebGL 2; bind the default for WebGL to use.
    25972631        locker = holdLock(objectGraphLock());
    2598 #endif
    25992632    }
    26002633
     
    26042637GCGLboolean WebGL2RenderingContext::isVertexArray(WebGLVertexArrayObject* arrayObject)
    26052638{
    2606     if (!arrayObject || isContextLost())
     2639    if (!arrayObject || isContextLost() || !arrayObject->validate(0, *this))
    26072640        return false;
    26082641
    2609     if (!arrayObject->hasEverBeenBound() || !arrayObject->validate(0, *this))
     2642    if (!arrayObject->hasEverBeenBound())
    26102643        return false;
     2644    if (arrayObject->isDeleted())
     2645        return false;
    26112646
    26122647    return m_context->isVertexArray(arrayObject->object());
     
    26172652    auto locker = holdLock(objectGraphLock());
    26182653
    2619     if (isContextLost())
    2620         return;
    2621 
    2622     if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, *this) || !m_contextObjects.contains(arrayObject))) {
    2623         m_context->synthesizeGLError(GraphicsContextGL::INVALID_OPERATION);
    2624         return;
    2625     }
     2654    if (!validateNullableWebGLObject("bindVertexArray", arrayObject))
     2655        return;
     2656
    26262657    if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) {
    26272658        m_context->bindVertexArray(arrayObject->object());
     
    27482779
    27492780    if (!targetFramebuffer) {
    2750         // OpenGL ES 3: Default framebuffer is bound.
    27512781        if (!validateDefaultFramebufferAttachment(attachment)) {
    27522782            synthesizeGLError(GraphicsContextGL::INVALID_ENUM, functionName, "invalid attachment");
    27532783            return nullptr;
    27542784        }
    2755         return m_context->getFramebufferAttachmentParameteri(target, attachment, pname);
     2785
     2786        // We can look directly at m_attributes because in WebGL 2,
     2787        // they are required to be honored.
     2788        bool hasDepth = m_attributes.depth;
     2789        bool hasStencil = m_attributes.stencil;
     2790        bool missingImage = (attachment == GraphicsContextGL::DEPTH && !hasDepth) || (attachment == GraphicsContextGL::STENCIL && !hasStencil);
     2791        if (missingImage) {
     2792            switch (pname) {
     2793            case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
     2794                return static_cast<unsigned>(GraphicsContextGL::NONE);
     2795            default:
     2796                synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "invalid parameter name");
     2797                return nullptr;
     2798            }
     2799        }
     2800
     2801        switch (pname) {
     2802        case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
     2803            return GraphicsContextGL::FRAMEBUFFER_DEFAULT;
     2804        default:
     2805            return m_context->getFramebufferAttachmentParameteri(target, attachment, pname);
     2806        }
    27562807    }
    27572808    if (!validateNonDefaultFramebufferAttachment(functionName, attachment))
    27582809        return nullptr;
    27592810
    2760     auto object = makeRefPtr(targetFramebuffer->getAttachmentObject(attachment));
    2761     if (!object) {
     2811    RefPtr<WebGLSharedObject> attachmentObject;
     2812    if (attachment == GraphicsContextGL::DEPTH_STENCIL_ATTACHMENT) {
     2813        attachmentObject = makeRefPtr(targetFramebuffer->getAttachmentObject(GraphicsContextGL::DEPTH_ATTACHMENT));
     2814        auto stencilAttachment = makeRefPtr(targetFramebuffer->getAttachmentObject(GraphicsContextGL::STENCIL_ATTACHMENT));
     2815        if (attachmentObject != stencilAttachment) {
     2816            synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "different objects bound to DEPTH_ATTACHMENT and STENCIL_ATTACHMENT");
     2817            return nullptr;
     2818        }
     2819    } else
     2820        attachmentObject = makeRefPtr(targetFramebuffer->getAttachmentObject(attachment));
     2821
     2822    if (!attachmentObject) {
    27622823        if (pname == GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
    27632824            return static_cast<unsigned>(GraphicsContextGL::NONE);
     
    27692830
    27702831    switch (pname) {
     2832    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
     2833        if (attachmentObject->isTexture())
     2834            return static_cast<unsigned>(GraphicsContextGL::TEXTURE);
     2835        return static_cast<unsigned>(GraphicsContextGL::RENDERBUFFER);
     2836    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
     2837        if (attachmentObject->isTexture())
     2838            return makeRefPtr(reinterpret_cast<WebGLTexture&>(*attachmentObject));
     2839        return makeRefPtr(reinterpret_cast<WebGLRenderbuffer&>(*attachmentObject));
     2840    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
     2841    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
     2842    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
     2843        if (!attachmentObject->isTexture())
     2844            break;
     2845        FALLTHROUGH;
    27712846    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_RED_SIZE:
    27722847    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
     
    27752850    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
    27762851    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
     2852    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
     2853        return m_context->getFramebufferAttachmentParameteri(target, attachment, pname);
    27772854    case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
    2778         return m_context->getFramebufferAttachmentParameteri(target, attachment, pname);
    2779     }
    2780 
    2781     if (object->isTexture()) {
    2782         switch (pname) {
    2783         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
    2784             return static_cast<unsigned>(GraphicsContextGL::TEXTURE);
    2785         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
    2786             return makeRefPtr(reinterpret_cast<WebGLTexture&>(*object));
    2787         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
    2788         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
    2789         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
    2790             return m_context->getFramebufferAttachmentParameteri(target, attachment, pname);
    2791         default:
    2792             synthesizeGLError(GraphicsContextGL::INVALID_ENUM, functionName, "invalid parameter name for texture attachment");
     2855        if (attachment == GraphicsContextGL::DEPTH_STENCIL_ATTACHMENT) {
     2856            synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "COMPONENT_TYPE can't be queried for DEPTH_STENCIL_ATTACHMENT");
    27932857            return nullptr;
    27942858        }
    2795     } else {
    2796         ASSERT(object->isRenderbuffer());
    2797         switch (pname) {
    2798         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
    2799             return static_cast<unsigned>(GraphicsContextGL::RENDERBUFFER);
    2800         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
    2801             return makeRefPtr(reinterpret_cast<WebGLRenderbuffer&>(*object));
    2802         case GraphicsContextGL::FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING : {
    2803             auto& renderBuffer = reinterpret_cast<WebGLRenderbuffer&>(*object);
    2804             auto format = renderBuffer.getInternalFormat();
    2805             if (format == GraphicsContextGL::SRGB8_ALPHA8
    2806                 || format == GraphicsContextGL::COMPRESSED_SRGB8_ETC2
    2807                 || format == GraphicsContextGL::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
    2808                 || format == GraphicsContextGL::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) {
    2809                 return static_cast<unsigned>(GraphicsContextGL::SRGB);
    2810             }
    2811             return static_cast<unsigned>(GraphicsContextGL::LINEAR);
    2812         }
    2813         default:
    2814             synthesizeGLError(GraphicsContextGL::INVALID_ENUM, functionName, "invalid parameter name for renderbuffer attachment");
    2815             return nullptr;
    2816         }
    2817     }
     2859        return m_context->getFramebufferAttachmentParameteri(target, attachment, pname);
     2860    }
     2861
     2862    synthesizeGLError(GraphicsContextGL::INVALID_ENUM, functionName, "invalid parameter name for attachment");
     2863    return nullptr;
    28182864}
    28192865
  • trunk/Source/WebCore/html/canvas/WebGLObject.cpp

    r269850 r271444  
    6868        return;
    6969
    70     // ANGLE correctly handles object deletion with WebGL semantics.
    71     // For other GL implementations, delay deletion until we know
    72     // the object is not attached anywhere.
    73 #if USE(ANGLE)
    74     if (!m_calledDelete) {
    75         m_calledDelete = true;
    76 #else
    7770    if (!m_attachmentCount) {
    78 #endif
    7971        if (!context3d)
    8072            context3d = getAGraphicsContextGL();
  • trunk/Source/WebCore/html/canvas/WebGLObject.h

    r269850 r271444  
    9595    unsigned m_attachmentCount { 0 };
    9696    bool m_deleted { false };
    97 #if USE(ANGLE)
    98     bool m_calledDelete { false };
    99 #endif
    10097};
    10198
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r271065 r271444  
    13431343    auto locker = holdLock(objectGraphLock());
    13441344
    1345     if (isContextLostOrPending() || !validateWebGLProgramOrShader("attachShader", &program) || !validateWebGLProgramOrShader("attachShader", &shader))
     1345    if (!validateWebGLProgramOrShader("attachShader", &program) || !validateWebGLProgramOrShader("attachShader", &shader))
    13461346        return;
    13471347    if (!program.attachShader(locker, &shader)) {
     
    13551355void WebGLRenderingContextBase::bindAttribLocation(WebGLProgram& program, GCGLuint index, const String& name)
    13561356{
    1357     if (isContextLostOrPending() || !validateWebGLProgramOrShader("bindAttribLocation", &program))
     1357    if (!validateWebGLProgramOrShader("bindAttribLocation", &program))
    13581358        return;
    13591359    if (!validateLocationLength("bindAttribLocation", name))
     
    13721372}
    13731373
    1374 bool WebGLRenderingContextBase::checkObjectToBeBound(const char* functionName, WebGLObject* object)
    1375 {
    1376     if (isContextLostOrPending())
    1377         return false;
    1378     if (object) {
    1379         if (!object->validate(contextGroup(), *this)) {
    1380             synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "object not from this context");
    1381             return false;
    1382         }
    1383         if (!object->object()) {
    1384             synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "deleted objects cannot be bound");
    1385             return false;
    1386         }
    1387     }
    1388     return true;
     1374bool WebGLRenderingContextBase::validateNullableWebGLObject(const char* functionName, WebGLObject* object)
     1375{
     1376    if (isContextLostOrPending())
     1377        return false;
     1378    if (!object) {
     1379        // This differs in behavior to ValidateWebGLObject; null objects are allowed
     1380        // in these entry points.
     1381        return true;
     1382    }
     1383    return validateWebGLObject(functionName, object);
    13891384}
    13901385
     
    14481443    auto locker = holdLock(objectGraphLock());
    14491444
    1450     if (!checkObjectToBeBound("bindBuffer", buffer))
     1445    if (!validateNullableWebGLObject("bindBuffer", buffer))
    14511446        return;
    14521447
     
    14611456    auto locker = holdLock(objectGraphLock());
    14621457
    1463     if (!checkObjectToBeBound("bindFramebuffer", buffer))
     1458    if (!validateNullableWebGLObject("bindFramebuffer", buffer))
    14641459        return;
    14651460
     
    14761471    auto locker = holdLock(objectGraphLock());
    14771472
    1478     if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer))
     1473    if (!validateNullableWebGLObject("bindRenderbuffer", renderBuffer))
    14791474        return;
    14801475    if (target != GraphicsContextGL::RENDERBUFFER) {
     
    14921487    auto locker = holdLock(objectGraphLock());
    14931488
    1494     if (!checkObjectToBeBound("bindTexture", texture))
     1489    if (!validateNullableWebGLObject("bindTexture", texture))
    14951490        return;
    14961491    if (texture && texture->getTarget() && texture->getTarget() != target) {
     
    17521747void WebGLRenderingContextBase::compileShader(WebGLShader& shader)
    17531748{
    1754     if (isContextLostOrPending() || !validateWebGLProgramOrShader("compileShader", &shader))
     1749    if (!validateWebGLProgramOrShader("compileShader", &shader))
    17551750        return;
    17561751    m_context->compileShader(shader.object());
     
    21672162    auto locker = holdLock(objectGraphLock());
    21682163
    2169     if (isContextLostOrPending() || !validateWebGLProgramOrShader("detachShader", &program) || !validateWebGLProgramOrShader("detachShader", &shader))
     2164    if (!validateWebGLProgramOrShader("detachShader", &program) || !validateWebGLProgramOrShader("detachShader", &shader))
    21702165        return;
    21712166    if (!program.detachShader(locker, &shader)) {
     
    23822377bool WebGLRenderingContextBase::validateWebGLObject(const char* functionName, WebGLObject* object)
    23832378{
     2379    if (isContextLostOrPending())
     2380        return false;
    23842381    if (!object) {
    23852382        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "object is null");
    23862383        return false;
    23872384    }
    2388     if (!object->object()) {
     2385    if (object->isDeleted()) {
    23892386        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "attempt to use a deleted object");
    23902387        return false;
     
    23992396bool WebGLRenderingContextBase::validateWebGLProgramOrShader(const char* functionName, WebGLObject* object)
    24002397{
     2398    if (isContextLostOrPending())
     2399        return false;
    24012400    if (!object) {
    24022401        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "program or shader is null");
    24032402        return false;
    24042403    }
    2405     // Using a deleted program or shader is INVALID_VALUE instead of INVALID_OPERATION as for
    2406     // other WebGL objects.
     2404    // OpenGL ES 3.0.5 p. 45:
     2405    // "Commands that accept shader or program object names will generate the
     2406    // error INVALID_VALUE if the provided name is not the name of either a shader
     2407    // or program object and INVALID_OPERATION if the provided name identifies an
     2408    // object that is not the expected type."
     2409    //
     2410    // Programs and shaders also have slightly different lifetime rules than other
     2411    // objects in the API; they continue to be usable after being marked for
     2412    // deletion.
    24072413    if (!object->object()) {
    24082414        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "attempt to use a deleted program or shader");
     
    27132719        return;
    27142720    }
    2715     if (buffer && !buffer->validate(contextGroup(), *this)) {
    2716         synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "framebufferRenderbuffer", "no buffer or buffer not from this context");
    2717         return;
    2718     }
     2721    if (!validateNullableWebGLObject("framebufferRenderbuffer", buffer))
     2722        return;
    27192723    if (buffer && !buffer->hasEverBeenBound()) {
    27202724        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "framebufferRenderbuffer", "buffer has never been bound");
     
    27422746        return;
    27432747    }
    2744     if (texture && !texture->validate(contextGroup(), *this)) {
    2745         synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "framebufferTexture2D", "no texture or texture not from this context");
    2746         return;
    2747     }
    2748 
    2749     WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
     2748    if (!validateNullableWebGLObject("framebufferTexture2D", texture))
     2749        return;
    27502750
    27512751    // Don't allow the default framebuffer to be mutated; all current
    27522752    // implementations use an FBO internally in place of the default
    27532753    // FBO.
     2754    WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
    27542755    if (!framebufferBinding || !framebufferBinding->object()) {
    27552756        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "framebufferTexture2D", "no framebuffer bound");
     
    28112812RefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProgram& program, GCGLuint index)
    28122813{
    2813     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getActiveAttrib", &program))
     2814    if (!validateWebGLProgramOrShader("getActiveAttrib", &program))
    28142815        return nullptr;
    28152816    GraphicsContextGL::ActiveInfo info;
     
    28242825RefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLProgram& program, GCGLuint index)
    28252826{
    2826     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getActiveUniform", &program))
     2827    if (!validateWebGLProgramOrShader("getActiveUniform", &program))
    28272828        return nullptr;
    28282829    GraphicsContextGL::ActiveInfo info;
     
    28412842Optional<Vector<RefPtr<WebGLShader>>> WebGLRenderingContextBase::getAttachedShaders(WebGLProgram& program)
    28422843{
    2843     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getAttachedShaders", &program))
     2844    if (!validateWebGLProgramOrShader("getAttachedShaders", &program))
    28442845        return WTF::nullopt;
    28452846
     
    28592860GCGLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram& program, const String& name)
    28602861{
    2861     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getAttribLocation", &program))
     2862    if (!validateWebGLProgramOrShader("getAttribLocation", &program))
    28622863        return -1;
    28632864    if (!validateLocationLength("getAttribLocation", name))
     
    32573258String WebGLRenderingContextBase::getProgramInfoLog(WebGLProgram& program)
    32583259{
    3259     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getProgramInfoLog", &program))
     3260    if (!validateWebGLProgramOrShader("getProgramInfoLog", &program))
    32603261        return String();
    32613262    return ensureNotNull(m_context->getProgramInfoLog(program.object()));
     
    33633364String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader& shader)
    33643365{
    3365     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getShaderInfoLog", &shader))
     3366    if (!validateWebGLProgramOrShader("getShaderInfoLog", &shader))
    33663367        return String();
    33673368    return ensureNotNull(m_context->getShaderInfoLog(shader.object()));
     
    34013402String WebGLRenderingContextBase::getShaderSource(WebGLShader& shader)
    34023403{
    3403     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getShaderSource", &shader))
     3404    if (!validateWebGLProgramOrShader("getShaderSource", &shader))
    34043405        return String();
    34053406    return ensureNotNull(shader.getSource());
     
    34323433WebGLAny WebGLRenderingContextBase::getUniform(WebGLProgram& program, const WebGLUniformLocation& uniformLocation)
    34333434{
    3434     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getUniform", &program))
     3435    if (!validateWebGLProgramOrShader("getUniform", &program))
    34353436        return nullptr;
    34363437    if (uniformLocation.program() != &program) {
     
    36363637RefPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(WebGLProgram& program, const String& name)
    36373638{
    3638     if (isContextLostOrPending() || !validateWebGLProgramOrShader("getUniformLocation", &program))
     3639    if (!validateWebGLProgramOrShader("getUniformLocation", &program))
    36393640        return nullptr;
    36403641    if (!validateLocationLength("getUniformLocation", name))
     
    36903691    if ((isWebGL2() || m_angleInstancedArrays) && pname == GraphicsContextGL::VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
    36913692        return state.divisor;
     3693
     3694    if (isWebGL2() && pname == GraphicsContextGL::VERTEX_ATTRIB_ARRAY_INTEGER)
     3695        return state.isInteger;
    36923696
    36933697    switch (pname) {
     
    38103814GCGLboolean WebGLRenderingContextBase::isBuffer(WebGLBuffer* buffer)
    38113815{
    3812     if (!buffer || isContextLostOrPending())
     3816    if (!buffer || isContextLostOrPending() || !buffer->validate(contextGroup(), *this))
    38133817        return 0;
    38143818
    38153819    if (!buffer->hasEverBeenBound())
     3820        return 0;
     3821    if (buffer->isDeleted())
    38163822        return 0;
    38173823
     
    38563862GCGLboolean WebGLRenderingContextBase::isFramebuffer(WebGLFramebuffer* framebuffer)
    38573863{
    3858     if (!framebuffer || isContextLostOrPending())
     3864    if (!framebuffer || isContextLostOrPending() || !framebuffer->validate(contextGroup(), *this))
    38593865        return 0;
    38603866
    38613867    if (!framebuffer->hasEverBeenBound())
    38623868        return 0;
     3869    if (framebuffer->isDeleted())
     3870        return 0;
    38633871
    38643872    return m_context->isFramebuffer(framebuffer->object());
     
    38673875GCGLboolean WebGLRenderingContextBase::isProgram(WebGLProgram* program)
    38683876{
    3869     if (!program || isContextLostOrPending())
     3877    if (!program || isContextLostOrPending() || !program->validate(contextGroup(), *this))
    38703878        return 0;
    38713879
     3880    // OpenGL ES special-cases the behavior of program objects; if they're deleted
     3881    // while attached to the current context state, glIsProgram is supposed to
     3882    // still return true. For this reason, isDeleted is not checked here.
     3883
    38723884    return m_context->isProgram(program->object());
    38733885}
     
    38753887GCGLboolean WebGLRenderingContextBase::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
    38763888{
    3877     if (!renderbuffer || isContextLostOrPending())
     3889    if (!renderbuffer || isContextLostOrPending() || !renderbuffer->validate(contextGroup(), *this))
    38783890        return 0;
    38793891
    38803892    if (!renderbuffer->hasEverBeenBound())
    38813893        return 0;
     3894    if (renderbuffer->isDeleted())
     3895        return 0;
    38823896
    38833897    return m_context->isRenderbuffer(renderbuffer->object());
     
    38863900GCGLboolean WebGLRenderingContextBase::isShader(WebGLShader* shader)
    38873901{
    3888     if (!shader || isContextLostOrPending())
     3902    if (!shader || isContextLostOrPending() || !shader->validate(contextGroup(), *this))
    38893903        return 0;
    38903904
     3905    // OpenGL ES special-cases the behavior of shader objects; if they're deleted
     3906    // while attached to a program, glIsShader is supposed to still return true.
     3907    // For this reason, isDeleted is not checked here.
     3908
    38913909    return m_context->isShader(shader->object());
    38923910}
     
    38943912GCGLboolean WebGLRenderingContextBase::isTexture(WebGLTexture* texture)
    38953913{
    3896     if (!texture || isContextLostOrPending())
     3914    if (!texture || isContextLostOrPending() || !texture->validate(contextGroup(), *this))
    38973915        return 0;
    38983916
    38993917    if (!texture->hasEverBeenBound())
    39003918        return 0;
     3919    if (texture->isDeleted())
     3920        return 0;
    39013921
    39023922    return m_context->isTexture(texture->object());
     
    39203940bool WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations(WebGLProgram* program)
    39213941{
    3922     if (isContextLostOrPending() || !validateWebGLProgramOrShader("linkProgram", program))
     3942    if (!validateWebGLProgramOrShader("linkProgram", program))
    39233943        return false;
    39243944
     
    44724492void WebGLRenderingContextBase::shaderSource(WebGLShader& shader, const String& string)
    44734493{
    4474     if (isContextLostOrPending() || !validateWebGLProgramOrShader("shaderSource", &shader))
     4494    if (!validateWebGLProgramOrShader("shaderSource", &shader))
    44754495        return;
    44764496#if USE(ANGLE)
     
    59976017    auto locker = holdLock(objectGraphLock());
    59986018
    5999     if (!checkObjectToBeBound("useProgram", program))
     6019    if (!validateNullableWebGLObject("useProgram", program))
    60006020        return;
    60016021    if (program && !program->getLinkStatus()) {
     
    60156035void WebGLRenderingContextBase::validateProgram(WebGLProgram& program)
    60166036{
    6017     if (isContextLostOrPending() || !validateWebGLProgramOrShader("validateProgram", &program))
     6037    if (!validateWebGLProgramOrShader("validateProgram", &program))
    60186038        return;
    60196039    m_context->validateProgram(program.object());
     
    61276147    GCGLsizei bytesPerElement = size * typeSize;
    61286148
    6129     m_boundVertexArrayObject->setVertexAttribState(locker, index, bytesPerElement, size, type, normalized, stride, static_cast<GCGLintptr>(offset), m_boundArrayBuffer.get());
     6149    m_boundVertexArrayObject->setVertexAttribState(locker, index, bytesPerElement, size, type, normalized, stride, static_cast<GCGLintptr>(offset), false, m_boundArrayBuffer.get());
    61306150    m_context->vertexAttribPointer(index, size, type, normalized, stride, static_cast<GCGLintptr>(offset));
    61316151}
     
    77197739    if (isContextLostOrPending())
    77207740        return;
    7721 #endif // USE(ANGLE)
    7722 
    7723     if (!primcount) {
    7724         markContextChanged();
    7725         return;
    7726     }
    7727 
    7728 #if !USE(ANGLE)
     7741#else
    77297742    if (!validateDrawArrays("drawArraysInstanced", mode, first, count, primcount))
    77307743        return;
     
    77647777    if (isContextLostOrPending())
    77657778        return;
    7766 #endif
    7767 
    7768     if (!primcount) {
    7769         markContextChanged();
    7770         return;
    7771     }
    7772 
    7773 #if !USE(ANGLE)
     7779#else
    77747780    unsigned numElements = 0;
    77757781    if (!validateDrawElements("drawElementsInstanced", mode, count, type, offset, numElements, primcount))
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h

    r271065 r271444  
    496496    bool validateVertexAttributes(unsigned elementCount, unsigned primitiveCount = 0);
    497497
     498    // Validates the incoming WebGL object, which is assumed to be non-null.
     499    // Checks that the object belongs to this context and that it's not marked for
     500    // deletion. Performs a context lost check internally.
    498501    bool validateWebGLObject(const char*, WebGLObject*);
     502
     503    // Validates the incoming WebGL program or shader, which is assumed to be
     504    // non-null. OpenGL ES's validation rules differ for these types of objects
     505    // compared to others. Performs a context lost check internally.
    499506    bool validateWebGLProgramOrShader(const char*, WebGLObject*);
    500507
     
    10471054    bool deleteObject(const WTF::AbstractLocker&, WebGLObject*);
    10481055
    1049     // Helper function for bind* (bindBuffer, bindTexture, etc) and useProgram.
    1050     // Return false if caller should return without further processing.
    1051     bool checkObjectToBeBound(const char* functionName, WebGLObject*);
     1056    // Helper function for APIs which can legally receive null objects, including
     1057    // the bind* calls (bindBuffer, bindTexture, etc.) and useProgram. Checks that
     1058    // the object belongs to this context and that it's not marked for deletion.
     1059    // Returns false if the caller should return without further processing.
     1060    // Performs a context lost check internally.
     1061    // This returns true for null WebGLObject arguments!
     1062    bool validateNullableWebGLObject(const char* functionName, WebGLObject*);
    10521063
    10531064    // Helper function to validate the target for bufferData and
  • trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp

    r265708 r271444  
    5353}
    5454
    55 void WebGLVertexArrayObjectBase::setVertexAttribState(const AbstractLocker& locker, GCGLuint index, GCGLsizei bytesPerElement, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset, WebGLBuffer* buffer)
     55void WebGLVertexArrayObjectBase::setVertexAttribState(const AbstractLocker& locker, GCGLuint index, GCGLsizei bytesPerElement, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset, bool isInteger, WebGLBuffer* buffer)
    5656{
    5757    GCGLsizei validatedStride = stride ? stride : bytesPerElement;
     
    7272    state.originalStride = stride;
    7373    state.offset = offset;
     74    state.isInteger = isInteger;
    7475}
    7576
  • trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.h

    r269850 r271444  
    6161        GCGLintptr offset { 0 };
    6262        GCGLuint divisor { 0 };
     63        bool isInteger { false };
    6364    };
    6465
     
    7273
    7374    VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribState[index]; }
    74     void setVertexAttribState(const WTF::AbstractLocker&, GCGLuint, GCGLsizei, GCGLint, GCGLenum, GCGLboolean, GCGLsizei, GCGLintptr, WebGLBuffer*);
     75    void setVertexAttribState(const WTF::AbstractLocker&, GCGLuint, GCGLsizei, GCGLint, GCGLenum, GCGLboolean, GCGLsizei, GCGLintptr, bool, WebGLBuffer*);
    7576    void unbindBuffer(const WTF::AbstractLocker&, WebGLBuffer&);
    7677
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp

    r270964 r271444  
    293293        return;
    294294    gl::GetIntegervRobustANGLE(pname, value.bufSize, nullptr, value.data);
    295 
    296     switch (pname) {
    297 #if PLATFORM(MAC)
    298     // Some older hardware advertises a larger maximum than they
    299     // can actually handle. Rather than detecting such devices, simply
    300     // clamp the maximum to 8192, which is big enough for a 5K display.
    301     case MAX_RENDERBUFFER_SIZE:
    302         *value = std::min(8192, *value);
    303         break;
    304     case MAX_VIEWPORT_DIMS:
    305         value[0] = std::min(8192, value[0]);
    306         value[1] = std::min(8192, value[1]);
    307         break;
    308 #endif
    309     default:
    310         break;
    311     }
    312295}
    313296
Note: See TracChangeset for help on using the changeset viewer.