Changeset 254869 in webkit


Ignore:
Timestamp:
Jan 21, 2020 11:48:05 AM (4 years ago)
Author:
Justin Fan
Message:

[WebGL2] Sampler objects
https://bugs.webkit.org/show_bug.cgi?id=126941
<rdar://problem/15002402>

Source/WebCore:

Implement enough of Samplers to pass the "samplers" conformance tests with ANGLE enabled.

Reviewed by Dean Jackson.

Covered by webgl/2.0.0/conformance2/samplers directory of tests.

  • bindings/js/JSDOMConvertWebGL.cpp:

(WebCore::convertToJSValue):

  • html/canvas/WebGL2RenderingContext.cpp:

(WebCore::WebGL2RenderingContext::WebGL2RenderingContext):
(WebCore::WebGL2RenderingContext::initializeSamplerCache):
(WebCore::WebGL2RenderingContext::createSampler):
(WebCore::WebGL2RenderingContext::deleteSampler):
(WebCore::WebGL2RenderingContext::isSampler):
(WebCore::WebGL2RenderingContext::bindSampler):
(WebCore::WebGL2RenderingContext::samplerParameteri):
(WebCore::WebGL2RenderingContext::samplerParameterf):
(WebCore::WebGL2RenderingContext::getSamplerParameter):
(WebCore::WebGL2RenderingContext::bindTransformFeedback):
(WebCore::WebGL2RenderingContext::getParameter):

  • html/canvas/WebGL2RenderingContext.h:
  • html/canvas/WebGLAny.h:
  • html/canvas/WebGLSampler.cpp:

(WebCore::WebGLSampler::WebGLSampler):
(WebCore::WebGLSampler::deleteObjectImpl):

  • platform/graphics/angle/GraphicsContextGLANGLE.cpp:

(WebCore::GraphicsContextGLOpenGL::createSampler):
(WebCore::GraphicsContextGLOpenGL::deleteSampler):
(WebCore::GraphicsContextGLOpenGL::isSampler):
(WebCore::GraphicsContextGLOpenGL::bindSampler):
(WebCore::GraphicsContextGLOpenGL::samplerParameteri):
(WebCore::GraphicsContextGLOpenGL::samplerParameterf):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameterfv):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameteriv):

LayoutTests:

Reviewed by Dean Jackson.

Update to passing expectations, though these tests remain skipped until ANGLE backend is enabled.

  • webgl/2.0.0/conformance2/samplers/sampler-drawing-test-expected.txt:
  • webgl/2.0.0/conformance2/samplers/samplers-expected.txt:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r254863 r254869  
     12020-01-21  Justin Fan  <justin_fan@apple.com>
     2
     3        [WebGL2] Sampler objects
     4        https://bugs.webkit.org/show_bug.cgi?id=126941
     5        <rdar://problem/15002402>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Update to passing expectations, though these tests remain skipped until ANGLE backend is enabled.
     10
     11        * webgl/2.0.0/conformance2/samplers/sampler-drawing-test-expected.txt:
     12        * webgl/2.0.0/conformance2/samplers/samplers-expected.txt:
     13
    1142020-01-21  Sunny He  <sunny_he@apple.com>
    215
  • trunk/LayoutTests/webgl/2.0.0/conformance2/samplers/sampler-drawing-test-expected.txt

    r236236 r254869  
    1 CONSOLE MESSAGE: line 85: TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    21This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
    32
    43Test: ../../resources/webgl_test_files/conformance2/samplers/sampler-drawing-test.html
    5 [ 1: PASS ] WebGL context exists
    6 [ 2: FAIL ] successfullyParsed should be true (of type boolean). Was undefined (of type undefined).
    7 [ FAIL ] 1 failures reported
     4[ PASS ] All tests passed
    85
  • trunk/LayoutTests/webgl/2.0.0/conformance2/samplers/samplers-expected.txt

    r236236 r254869  
    22
    33Test: ../../resources/webgl_test_files/conformance2/samplers/samplers.html
    4 [ 1: PASS ] WebGL context exists
    5 [ 2: PASS ] gl.SAMPLER_BINDING is 0x8919
    6 [ 3: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is null
    7 [ 4: FAIL ] getError expected: NO_ERROR. Was INVALID_ENUM : SAMPLER_BINDING query should succeed
    8 [ 5: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is s1
    9 [ 6: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is s2
    10 [ 7: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is s2
    11 [ 8: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is s1
    12 [ 9: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is s1
    13 [ 10: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is null
    14 [ 11: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is null
    15 [ 12: FAIL ] getError expected: INVALID_OPERATION. Was INVALID_ENUM : binding a deleted Sampler object
    16 [ 13: PASS ] gl.getParameter(gl.SAMPLER_BINDING) is null
    17 [ 14: FAIL ] getError expected: NO_ERROR. Was INVALID_ENUM : there should be no errors
    18 [ 15: PASS ] getError was expected value: NO_ERROR : createSampler should not set an error
    19 [ 16: FAIL ] s1 should be non-null. Was null
    20 [ 17: FAIL ] gl.isSampler(s1) should be true. Was false.
    21 [ 18: FAIL ] gl.isSampler(s1) should be true. Was false.
    22 [ 19: FAIL ] gl.isSampler(s1) should be true. Was false.
    23 [ 20: PASS ] gl.isSampler(s1) is false
    24 [ 21: PASS ] gl.isSampler(null) is false
    25 [ 22: FAIL ] gl.getSamplerParameter(s, 10242) should be 10497. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    26 [ 23: PASS ] getError was expected value: NO_ERROR :
    27 [ 24: FAIL ] gl.getSamplerParameter(s, 10243) should be 10497. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    28 [ 25: PASS ] getError was expected value: NO_ERROR :
    29 [ 26: FAIL ] gl.getSamplerParameter(s, 32882) should be 10497. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    30 [ 27: PASS ] getError was expected value: NO_ERROR :
    31 [ 28: FAIL ] gl.getSamplerParameter(s, 10241) should be 9986. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    32 [ 29: PASS ] getError was expected value: NO_ERROR :
    33 [ 30: FAIL ] gl.getSamplerParameter(s, 10240) should be 9729. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    34 [ 31: PASS ] getError was expected value: NO_ERROR :
    35 [ 32: FAIL ] gl.getSamplerParameter(s, 34892) should be 0. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    36 [ 33: PASS ] getError was expected value: NO_ERROR :
    37 [ 34: FAIL ] gl.getSamplerParameter(s, 34893) should be 515. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    38 [ 35: PASS ] getError was expected value: NO_ERROR :
    39 [ 36: FAIL ] gl.getSamplerParameter(s, 33082) should be -1000. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    40 [ 37: PASS ] getError was expected value: NO_ERROR :
    41 [ 38: FAIL ] gl.getSamplerParameter(s, 33083) should be 1000. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    42 [ 39: PASS ] getError was expected value: NO_ERROR :
    43 [ 40: FAIL ] gl.samplerParameteri(s, 10242, 10497) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    44 [ 41: FAIL ] gl.getSamplerParameter(s, 10242) should be 10497. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    45 [ 42: PASS ] getError was expected value: NO_ERROR :
    46 [ 43: FAIL ] gl.samplerParameteri(s, 10242, 33648) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    47 [ 44: FAIL ] gl.getSamplerParameter(s, 10242) should be 33648. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    48 [ 45: PASS ] getError was expected value: NO_ERROR :
    49 [ 46: FAIL ] gl.samplerParameteri(s, 10242, 33071) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    50 [ 47: FAIL ] gl.getSamplerParameter(s, 10242) should be 33071. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    51 [ 48: PASS ] getError was expected value: NO_ERROR :
    52 [ 49: FAIL ] gl.samplerParameteri(s, 10243, 10497) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    53 [ 50: FAIL ] gl.getSamplerParameter(s, 10243) should be 10497. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    54 [ 51: PASS ] getError was expected value: NO_ERROR :
    55 [ 52: FAIL ] gl.samplerParameteri(s, 10243, 33648) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    56 [ 53: FAIL ] gl.getSamplerParameter(s, 10243) should be 33648. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    57 [ 54: PASS ] getError was expected value: NO_ERROR :
    58 [ 55: FAIL ] gl.samplerParameteri(s, 10243, 33071) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    59 [ 56: FAIL ] gl.getSamplerParameter(s, 10243) should be 33071. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    60 [ 57: PASS ] getError was expected value: NO_ERROR :
    61 [ 58: FAIL ] gl.samplerParameteri(s, 32882, 10497) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    62 [ 59: FAIL ] gl.getSamplerParameter(s, 32882) should be 10497. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    63 [ 60: PASS ] getError was expected value: NO_ERROR :
    64 [ 61: FAIL ] gl.samplerParameteri(s, 32882, 33648) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    65 [ 62: FAIL ] gl.getSamplerParameter(s, 32882) should be 33648. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    66 [ 63: PASS ] getError was expected value: NO_ERROR :
    67 [ 64: FAIL ] gl.samplerParameteri(s, 32882, 33071) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    68 [ 65: FAIL ] gl.getSamplerParameter(s, 32882) should be 33071. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    69 [ 66: PASS ] getError was expected value: NO_ERROR :
    70 [ 67: FAIL ] gl.samplerParameteri(s, 10241, 9728) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    71 [ 68: FAIL ] gl.getSamplerParameter(s, 10241) should be 9728. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    72 [ 69: PASS ] getError was expected value: NO_ERROR :
    73 [ 70: FAIL ] gl.samplerParameteri(s, 10241, 9729) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    74 [ 71: FAIL ] gl.getSamplerParameter(s, 10241) should be 9729. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    75 [ 72: PASS ] getError was expected value: NO_ERROR :
    76 [ 73: FAIL ] gl.samplerParameteri(s, 10241, 9984) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    77 [ 74: FAIL ] gl.getSamplerParameter(s, 10241) should be 9984. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    78 [ 75: PASS ] getError was expected value: NO_ERROR :
    79 [ 76: FAIL ] gl.samplerParameteri(s, 10241, 9986) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    80 [ 77: FAIL ] gl.getSamplerParameter(s, 10241) should be 9986. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    81 [ 78: PASS ] getError was expected value: NO_ERROR :
    82 [ 79: FAIL ] gl.samplerParameteri(s, 10241, 9985) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    83 [ 80: FAIL ] gl.getSamplerParameter(s, 10241) should be 9985. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    84 [ 81: PASS ] getError was expected value: NO_ERROR :
    85 [ 82: FAIL ] gl.samplerParameteri(s, 10241, 9987) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    86 [ 83: FAIL ] gl.getSamplerParameter(s, 10241) should be 9987. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    87 [ 84: PASS ] getError was expected value: NO_ERROR :
    88 [ 85: FAIL ] gl.samplerParameteri(s, 10240, 9728) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    89 [ 86: FAIL ] gl.getSamplerParameter(s, 10240) should be 9728. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    90 [ 87: PASS ] getError was expected value: NO_ERROR :
    91 [ 88: FAIL ] gl.samplerParameteri(s, 10240, 9729) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    92 [ 89: FAIL ] gl.getSamplerParameter(s, 10240) should be 9729. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    93 [ 90: PASS ] getError was expected value: NO_ERROR :
    94 [ 91: FAIL ] gl.samplerParameteri(s, 34892, 0) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    95 [ 92: FAIL ] gl.getSamplerParameter(s, 34892) should be 0. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    96 [ 93: PASS ] getError was expected value: NO_ERROR :
    97 [ 94: FAIL ] gl.samplerParameteri(s, 34892, 34894) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    98 [ 95: FAIL ] gl.getSamplerParameter(s, 34892) should be 34894. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    99 [ 96: PASS ] getError was expected value: NO_ERROR :
    100 [ 97: FAIL ] gl.samplerParameteri(s, 34893, 515) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    101 [ 98: FAIL ] gl.getSamplerParameter(s, 34893) should be 515. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    102 [ 99: PASS ] getError was expected value: NO_ERROR :
    103 [ 100: FAIL ] gl.samplerParameteri(s, 34893, 518) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    104 [ 101: FAIL ] gl.getSamplerParameter(s, 34893) should be 518. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    105 [ 102: PASS ] getError was expected value: NO_ERROR :
    106 [ 103: FAIL ] gl.samplerParameteri(s, 34893, 513) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    107 [ 104: FAIL ] gl.getSamplerParameter(s, 34893) should be 513. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    108 [ 105: PASS ] getError was expected value: NO_ERROR :
    109 [ 106: FAIL ] gl.samplerParameteri(s, 34893, 516) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    110 [ 107: FAIL ] gl.getSamplerParameter(s, 34893) should be 516. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    111 [ 108: PASS ] getError was expected value: NO_ERROR :
    112 [ 109: FAIL ] gl.samplerParameteri(s, 34893, 514) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    113 [ 110: FAIL ] gl.getSamplerParameter(s, 34893) should be 514. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    114 [ 111: PASS ] getError was expected value: NO_ERROR :
    115 [ 112: FAIL ] gl.samplerParameteri(s, 34893, 517) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    116 [ 113: FAIL ] gl.getSamplerParameter(s, 34893) should be 517. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    117 [ 114: PASS ] getError was expected value: NO_ERROR :
    118 [ 115: FAIL ] gl.samplerParameteri(s, 34893, 519) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    119 [ 116: FAIL ] gl.getSamplerParameter(s, 34893) should be 519. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    120 [ 117: PASS ] getError was expected value: NO_ERROR :
    121 [ 118: FAIL ] gl.samplerParameteri(s, 34893, 512) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    122 [ 119: FAIL ] gl.getSamplerParameter(s, 34893) should be 512. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    123 [ 120: PASS ] getError was expected value: NO_ERROR :
    124 [ 121: FAIL ] gl.samplerParameterf(s, 33082, -500) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    125 [ 122: FAIL ] gl.getSamplerParameter(s, 33082) should be -500. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    126 [ 123: PASS ] getError was expected value: NO_ERROR :
    127 [ 124: FAIL ] gl.samplerParameterf(s, 33082, 0) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    128 [ 125: FAIL ] gl.getSamplerParameter(s, 33082) should be 0. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    129 [ 126: PASS ] getError was expected value: NO_ERROR :
    130 [ 127: FAIL ] gl.samplerParameterf(s, 33082, 10) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    131 [ 128: FAIL ] gl.getSamplerParameter(s, 33082) should be 10. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    132 [ 129: PASS ] getError was expected value: NO_ERROR :
    133 [ 130: FAIL ] gl.samplerParameterf(s, 33083, 500) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    134 [ 131: FAIL ] gl.getSamplerParameter(s, 33083) should be 500. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    135 [ 132: PASS ] getError was expected value: NO_ERROR :
    136 [ 133: FAIL ] gl.samplerParameterf(s, 33083, 0) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    137 [ 134: FAIL ] gl.getSamplerParameter(s, 33083) should be 0. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    138 [ 135: PASS ] getError was expected value: NO_ERROR :
    139 [ 136: FAIL ] gl.samplerParameterf(s, 33083, 10) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    140 [ 137: FAIL ] gl.getSamplerParameter(s, 33083) should be 10. Threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    141 [ 138: PASS ] getError was expected value: NO_ERROR :
    142 [ 139: FAIL ] gl.getSamplerParameter(s, 37167) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    143 [ 140: FAIL ] gl.samplerParameteri(s, 37167, null) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    144 [ 141: FAIL ] gl.samplerParameterf(s, 37167, null) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    145 [ 142: FAIL ] gl.getSamplerParameter(s, 33084) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    146 [ 143: FAIL ] gl.samplerParameteri(s, 33084, null) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    147 [ 144: FAIL ] gl.samplerParameterf(s, 33084, null) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    148 [ 145: FAIL ] gl.getSamplerParameter(s, 33085) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    149 [ 146: FAIL ] gl.samplerParameteri(s, 33085, null) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    150 [ 147: FAIL ] gl.samplerParameterf(s, 33085, null) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    151 [ 148: FAIL ] gl.getSamplerParameter(s, 10242) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    152 [ 149: FAIL ] gl.samplerParameteri(s, 10242, 33069) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    153 [ 150: FAIL ] gl.samplerParameterf(s, 10242, 33069) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    154 [ 151: FAIL ] gl.getSamplerParameter(s, 10243) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    155 [ 152: FAIL ] gl.samplerParameteri(s, 10243, 33069) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    156 [ 153: FAIL ] gl.samplerParameterf(s, 10243, 33069) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    157 [ 154: FAIL ] gl.getSamplerParameter(s, 10240) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.getSamplerParameter must be an instance of WebGLSampler
    158 [ 155: FAIL ] gl.samplerParameteri(s, 10240, 9985) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
    159 [ 156: FAIL ] gl.samplerParameterf(s, 10240, 9985) threw exception TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameterf must be an instance of WebGLSampler
    160 [ 157: PASS ] getError was expected value: NO_ERROR : there should be no errors
    161 [ 158: PASS ] successfullyParsed is true
    162 [ FAIL ] 100 failures reported
     4[ PASS ] All tests passed
    1635
  • trunk/Source/WebCore/ChangeLog

    r254863 r254869  
     12020-01-21  Justin Fan  <justin_fan@apple.com>
     2
     3        [WebGL2] Sampler objects
     4        https://bugs.webkit.org/show_bug.cgi?id=126941
     5        <rdar://problem/15002402>
     6
     7        Implement enough of Samplers to pass the "samplers" conformance tests with ANGLE enabled.
     8
     9        Reviewed by Dean Jackson.
     10
     11        Covered by webgl/2.0.0/conformance2/samplers directory of tests.
     12
     13        * bindings/js/JSDOMConvertWebGL.cpp:
     14        (WebCore::convertToJSValue):
     15        * html/canvas/WebGL2RenderingContext.cpp:
     16        (WebCore::WebGL2RenderingContext::WebGL2RenderingContext):
     17        (WebCore::WebGL2RenderingContext::initializeSamplerCache):
     18        (WebCore::WebGL2RenderingContext::createSampler):
     19        (WebCore::WebGL2RenderingContext::deleteSampler):
     20        (WebCore::WebGL2RenderingContext::isSampler):
     21        (WebCore::WebGL2RenderingContext::bindSampler):
     22        (WebCore::WebGL2RenderingContext::samplerParameteri):
     23        (WebCore::WebGL2RenderingContext::samplerParameterf):
     24        (WebCore::WebGL2RenderingContext::getSamplerParameter):
     25        (WebCore::WebGL2RenderingContext::bindTransformFeedback):
     26        (WebCore::WebGL2RenderingContext::getParameter):
     27        * html/canvas/WebGL2RenderingContext.h:
     28        * html/canvas/WebGLAny.h:
     29        * html/canvas/WebGLSampler.cpp:
     30        (WebCore::WebGLSampler::WebGLSampler):
     31        (WebCore::WebGLSampler::deleteObjectImpl):
     32        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
     33        (WebCore::GraphicsContextGLOpenGL::createSampler):
     34        (WebCore::GraphicsContextGLOpenGL::deleteSampler):
     35        (WebCore::GraphicsContextGLOpenGL::isSampler):
     36        (WebCore::GraphicsContextGLOpenGL::bindSampler):
     37        (WebCore::GraphicsContextGLOpenGL::samplerParameteri):
     38        (WebCore::GraphicsContextGLOpenGL::samplerParameterf):
     39        (WebCore::GraphicsContextGLOpenGL::getSamplerParameterfv):
     40        (WebCore::GraphicsContextGLOpenGL::getSamplerParameteriv):
     41
    1422020-01-21  Sunny He  <sunny_he@apple.com>
    243
  • trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp

    r254481 r254869  
    5858#include "JSWebGLProgram.h"
    5959#include "JSWebGLRenderbuffer.h"
     60#include "JSWebGLSampler.h"
    6061#include "JSWebGLTexture.h"
    6162#include "JSWebGLTransformFeedback.h"
     
    138139#if ENABLE(WEBGL2)
    139140        ,
    140         [&] (const RefPtr<WebGLVertexArrayObject>& array) {
    141             return toJS(&lexicalGlobalObject, &globalObject, array.get());
     141        [&] (const RefPtr<WebGLSampler>& sampler) {
     142            return toJS(&lexicalGlobalObject, &globalObject, sampler.get());
    142143        },
    143144        [&] (const RefPtr<WebGLTransformFeedback>& transformFeedback) {
    144145            return toJS(&lexicalGlobalObject, &globalObject, transformFeedback.get());
     146        },
     147        [&] (const RefPtr<WebGLVertexArrayObject>& array) {
     148            return toJS(&lexicalGlobalObject, &globalObject, array.get());
    145149        }
    146150#endif
  • trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp

    r254481 r254869  
    9898    initializeVertexArrayObjects();
    9999    initializeTransformFeedbackBufferCache();
     100    initializeSamplerCache();
    100101}
    101102
     
    136137
    137138    m_boundTransformFeedbackBuffers.resize(maxTransformFeedbackAttribs);
     139}
     140
     141void WebGL2RenderingContext::initializeSamplerCache()
     142{
     143    ASSERT(m_textureUnits.size() >= 8);
     144    m_boundSamplers.resize(m_textureUnits.size());
    138145}
    139146
     
    11561163RefPtr<WebGLSampler> WebGL2RenderingContext::createSampler()
    11571164{
    1158     LOG(WebGL, "[[ NOT IMPLEMENTED ]] createSampler()");
    1159     return nullptr;
    1160 }
    1161 
    1162 void WebGL2RenderingContext::deleteSampler(WebGLSampler*)
    1163 {
    1164     LOG(WebGL, "[[ NOT IMPLEMENTED ]] deleteSampler()");
    1165 }
    1166 
    1167 GCGLboolean WebGL2RenderingContext::isSampler(WebGLSampler*)
    1168 {
    1169     LOG(WebGL, "[[ NOT IMPLEMENTED ]] isSampler()");
    1170     return false;
    1171 }
    1172 
    1173 void WebGL2RenderingContext::bindSampler(GCGLuint, WebGLSampler*)
    1174 {
    1175     LOG(WebGL, "[[ NOT IMPLEMENTED ]] bindSampler()");
    1176 }
    1177 
    1178 void WebGL2RenderingContext::samplerParameteri(WebGLSampler&, GCGLenum, GCGLint)
    1179 {
    1180     LOG(WebGL, "[[ NOT IMPLEMENTED ]] samplerParameteri()");
    1181 }
    1182 
    1183 void WebGL2RenderingContext::samplerParameterf(WebGLSampler&, GCGLenum, GCGLfloat)
    1184 {
    1185     LOG(WebGL, "[[ NOT IMPLEMENTED ]] samplerParameterf()");
    1186 }
    1187 
    1188 WebGLAny WebGL2RenderingContext::getSamplerParameter(WebGLSampler&, GCGLenum)
    1189 {
    1190     LOG(WebGL, "[[ NOT IMPLEMENTED ]] getSamplerParameter()");
    1191     return nullptr;
     1165    if (isContextLostOrPending())
     1166        return nullptr;
     1167
     1168    auto sampler = WebGLSampler::create(*this);
     1169    addSharedObject(sampler.get());
     1170    return sampler;
     1171}
     1172
     1173void WebGL2RenderingContext::deleteSampler(WebGLSampler* sampler)
     1174{
     1175    if (isContextLostOrPending())
     1176        return;
     1177
     1178    // One sampler can be bound to multiple texture units.
     1179    if (sampler) {
     1180        for (auto& samplerSlot : m_boundSamplers) {
     1181            if (samplerSlot == sampler)
     1182                samplerSlot = nullptr;
     1183        }
     1184    }
     1185
     1186    deleteObject(sampler);
     1187}
     1188
     1189GCGLboolean WebGL2RenderingContext::isSampler(WebGLSampler* sampler)
     1190{
     1191    if (isContextLostOrPending() || !sampler || sampler->isDeleted() || !validateWebGLObject("isSampler", sampler))
     1192        return false;
     1193
     1194    return m_context->isSampler(sampler->object());
     1195}
     1196
     1197void WebGL2RenderingContext::bindSampler(GCGLuint unit, WebGLSampler* sampler)
     1198{
     1199    if (isContextLostOrPending() || m_boundSamplers[unit] == sampler)
     1200        return;
     1201
     1202    if (sampler && sampler->isDeleted()) {
     1203        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "bindSampler", "cannot bind a deleted Sampler object");
     1204        return;
     1205    }
     1206
     1207    m_context->bindSampler(unit, objectOrZero(sampler));
     1208    m_boundSamplers[unit] = sampler;
     1209}
     1210
     1211void WebGL2RenderingContext::samplerParameteri(WebGLSampler& sampler, GCGLenum pname, GCGLint value)
     1212{
     1213    if (isContextLostOrPending())
     1214        return;
     1215
     1216    m_context->samplerParameteri(sampler.object(), pname, value);
     1217}
     1218
     1219void WebGL2RenderingContext::samplerParameterf(WebGLSampler& sampler, GCGLenum pname, GCGLfloat value)
     1220{
     1221    if (isContextLostOrPending())
     1222        return;
     1223
     1224    m_context->samplerParameterf(sampler.object(), pname, value);
     1225}
     1226
     1227WebGLAny WebGL2RenderingContext::getSamplerParameter(WebGLSampler& sampler, GCGLenum pname)
     1228{
     1229    if (isContextLostOrPending())
     1230        return nullptr;
     1231
     1232    switch (pname) {
     1233    case GraphicsContextGL::TEXTURE_COMPARE_FUNC:
     1234    case GraphicsContextGL::TEXTURE_COMPARE_MODE:
     1235    case GraphicsContextGL::TEXTURE_MAG_FILTER:
     1236    case GraphicsContextGL::TEXTURE_MIN_FILTER:
     1237    case GraphicsContextGL::TEXTURE_WRAP_R:
     1238    case GraphicsContextGL::TEXTURE_WRAP_S:
     1239    case GraphicsContextGL::TEXTURE_WRAP_T: {
     1240        int value = 0;
     1241        m_context->getSamplerParameteriv(sampler.object(), pname, &value);
     1242        return value;
     1243    }
     1244    case GraphicsContextGL::TEXTURE_MAX_LOD:
     1245    case GraphicsContextGL::TEXTURE_MIN_LOD: {
     1246        float value = 0;
     1247        m_context->getSamplerParameterfv(sampler.object(), pname, &value);
     1248        return value;
     1249    }
     1250    default:
     1251        synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getSamplerParameter", "Invalid pname");
     1252        return nullptr;
     1253    }
    11921254}
    11931255
     
    12701332        }
    12711333
    1272         if (!validateWebGLObject("isTransformFeedback", feedbackObject))
     1334        if (!validateWebGLObject("bindTransformFeedback", feedbackObject))
    12731335            return;
    12741336    }
     
    22252287    case GraphicsContextGL::TRANSFORM_FEEDBACK_BUFFER_BINDING:
    22262288        return m_boundTransformFeedbackBuffer;
     2289    case GraphicsContextGL::SAMPLER_BINDING:
     2290        return m_boundSamplers[m_activeTextureUnit];
    22272291    case GraphicsContextGL::COPY_READ_BUFFER:
    22282292    case GraphicsContextGL::COPY_WRITE_BUFFER:
     
    22302294    case GraphicsContextGL::PIXEL_UNPACK_BUFFER_BINDING:
    22312295    case GraphicsContextGL::READ_BUFFER:
    2232     case GraphicsContextGL::SAMPLER_BINDING:
    22332296    case GraphicsContextGL::TEXTURE_BINDING_2D_ARRAY:
    22342297    case GraphicsContextGL::TEXTURE_BINDING_3D:
  • trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h

    r254481 r254869  
    262262    void initializeShaderExtensions();
    263263    void initializeTransformFeedbackBufferCache();
     264    void initializeSamplerCache();
    264265
    265266    bool validateTexStorageFuncParameters(GCGLenum target, GCGLsizei levels, GCGLenum internalFormat, GCGLsizei width, GCGLsizei height, const char* functionName);
     
    270271    Vector<RefPtr<WebGLBuffer>> m_boundTransformFeedbackBuffers;
    271272
    272     // Queries
    273273    HashMap<GCGLenum, RefPtr<WebGLQuery>> m_activeQueries;
     274
     275    Vector<RefPtr<WebGLSampler>> m_boundSamplers;
    274276};
    275277
  • trunk/Source/WebCore/html/canvas/WebGLAny.h

    r254481 r254869  
    4545class WebGLProgram;
    4646class WebGLRenderbuffer;
     47class WebGLSampler;
    4748class WebGLTexture;
    4849class WebGLTransformFeedback;
     
    7172    RefPtr<WebGLVertexArrayObjectOES>
    7273#if ENABLE(WEBGL2)
     74    , RefPtr<WebGLSampler>
     75    , RefPtr<WebGLTransformFeedback>
    7376    , RefPtr<WebGLVertexArrayObject>
    74     , RefPtr<WebGLTransformFeedback>
    7577#endif
    7678>;
  • trunk/Source/WebCore/html/canvas/WebGLSampler.cpp

    r254214 r254869  
    4747    : WebGLSharedObject(ctx)
    4848{
    49     // FIXME: Call createSampler from GraphicsContextGLOpenGL.
     49    setObject(ctx.graphicsContextGL()->createSampler());
    5050}
    5151
    5252void WebGLSampler::deleteObjectImpl(GraphicsContextGLOpenGL* context3d, PlatformGLObject object)
    5353{
    54     UNUSED_PARAM(context3d);
    55     UNUSED_PARAM(object);
    56     // FIXME: Call deleteSampler from GraphicsContextGLOpenGL.
     54    context3d->deleteSampler(object);
    5755}
    5856
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp

    r254481 r254869  
    24142414PlatformGLObject GraphicsContextGLOpenGL::createSampler()
    24152415{
    2416 
    2417     return 0;
     2416    makeContextCurrent();
     2417    GLuint name = 0;
     2418    gl::GenSamplers(1, &name);
     2419    return name;
    24182420}
    24192421
    24202422void GraphicsContextGLOpenGL::deleteSampler(PlatformGLObject sampler)
    24212423{
    2422     UNUSED_PARAM(sampler);
     2424    makeContextCurrent();
     2425    gl::DeleteSamplers(1, &sampler);
    24232426}
    24242427
    24252428GCGLboolean GraphicsContextGLOpenGL::isSampler(PlatformGLObject sampler)
    24262429{
    2427     UNUSED_PARAM(sampler);
    2428 
    2429     return false;
     2430    makeContextCurrent();
     2431    return gl::IsSampler(sampler);
    24302432}
    24312433
    24322434void GraphicsContextGLOpenGL::bindSampler(GCGLuint unit, PlatformGLObject sampler)
    24332435{
    2434     UNUSED_PARAM(unit);
    2435     UNUSED_PARAM(sampler);
     2436    makeContextCurrent();
     2437    gl::BindSampler(unit, sampler);
    24362438}
    24372439
    24382440void GraphicsContextGLOpenGL::samplerParameteri(PlatformGLObject sampler, GCGLenum pname, GCGLint param)
    24392441{
    2440     UNUSED_PARAM(sampler);
    2441     UNUSED_PARAM(pname);
    2442     UNUSED_PARAM(param);
     2442    makeContextCurrent();
     2443    gl::SamplerParameteri(sampler, pname, param);
    24432444}
    24442445
    24452446void GraphicsContextGLOpenGL::samplerParameterf(PlatformGLObject sampler, GCGLenum pname, GCGLfloat param)
    24462447{
    2447     UNUSED_PARAM(sampler);
    2448     UNUSED_PARAM(pname);
    2449     UNUSED_PARAM(param);
     2448    makeContextCurrent();
     2449    gl::SamplerParameterf(sampler, pname, param);
    24502450}
    24512451
    24522452void GraphicsContextGLOpenGL::getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value)
    24532453{
    2454     UNUSED_PARAM(sampler);
    2455     UNUSED_PARAM(pname);
    2456     UNUSED_PARAM(value);
     2454    makeContextCurrent();
     2455    gl::GetSamplerParameterfv(sampler, pname, value);
    24572456}
    24582457
    24592458void GraphicsContextGLOpenGL::getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value)
    24602459{
    2461     UNUSED_PARAM(sampler);
    2462     UNUSED_PARAM(pname);
    2463     UNUSED_PARAM(value);
     2460    makeContextCurrent();
     2461    gl::GetSamplerParameteriv(sampler, pname, value);
    24642462}
    24652463
Note: See TracChangeset for help on using the changeset viewer.