Title: [254869] trunk
Revision
254869
Author
[email protected]
Date
2020-01-21 11:48:05 -0800 (Tue, 21 Jan 2020)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (254868 => 254869)


--- trunk/LayoutTests/ChangeLog	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/LayoutTests/ChangeLog	2020-01-21 19:48:05 UTC (rev 254869)
@@ -1,3 +1,16 @@
+2020-01-21  Justin Fan  <[email protected]>
+
+        [WebGL2] Sampler objects
+        https://bugs.webkit.org/show_bug.cgi?id=126941
+        <rdar://problem/15002402>
+
+        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:
+
 2020-01-21  Sunny He  <[email protected]>
 
         Disallow setting SVGElement currentScale to non-finite values

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/samplers/sampler-drawing-test-expected.txt (254868 => 254869)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/samplers/sampler-drawing-test-expected.txt	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/samplers/sampler-drawing-test-expected.txt	2020-01-21 19:48:05 UTC (rev 254869)
@@ -1,8 +1,5 @@
-CONSOLE MESSAGE: line 85: TypeError: Argument 1 ('sampler') to WebGL2RenderingContext.samplerParameteri must be an instance of WebGLSampler
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/samplers/sampler-drawing-test.html
-[ 1: PASS ] WebGL context exists
-[ 2: FAIL ] successfullyParsed should be true (of type boolean). Was undefined (of type undefined).
-[ FAIL ] 1 failures reported
+[ PASS ] All tests passed
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/samplers/samplers-expected.txt (254868 => 254869)


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

Modified: trunk/Source/WebCore/ChangeLog (254868 => 254869)


--- trunk/Source/WebCore/ChangeLog	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/Source/WebCore/ChangeLog	2020-01-21 19:48:05 UTC (rev 254869)
@@ -1,3 +1,44 @@
+2020-01-21  Justin Fan  <[email protected]>
+
+        [WebGL2] Sampler objects
+        https://bugs.webkit.org/show_bug.cgi?id=126941
+        <rdar://problem/15002402>
+
+        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):
+
 2020-01-21  Sunny He  <[email protected]>
 
         Disallow setting SVGElement currentScale to non-finite values

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (254868 => 254869)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2020-01-21 19:48:05 UTC (rev 254869)
@@ -57,6 +57,7 @@
 #include "JSWebGLLoseContext.h"
 #include "JSWebGLProgram.h"
 #include "JSWebGLRenderbuffer.h"
+#include "JSWebGLSampler.h"
 #include "JSWebGLTexture.h"
 #include "JSWebGLTransformFeedback.h"
 #include "JSWebGLVertexArrayObject.h"
@@ -137,11 +138,14 @@
         }
 #if ENABLE(WEBGL2)
         ,
-        [&] (const RefPtr<WebGLVertexArrayObject>& array) {
-            return toJS(&lexicalGlobalObject, &globalObject, array.get());
+        [&] (const RefPtr<WebGLSampler>& sampler) {
+            return toJS(&lexicalGlobalObject, &globalObject, sampler.get());
         },
         [&] (const RefPtr<WebGLTransformFeedback>& transformFeedback) {
             return toJS(&lexicalGlobalObject, &globalObject, transformFeedback.get());
+        },
+        [&] (const RefPtr<WebGLVertexArrayObject>& array) {
+            return toJS(&lexicalGlobalObject, &globalObject, array.get());
         }
 #endif
     );

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (254868 => 254869)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-01-21 19:48:05 UTC (rev 254869)
@@ -97,6 +97,7 @@
     initializeShaderExtensions();
     initializeVertexArrayObjects();
     initializeTransformFeedbackBufferCache();
+    initializeSamplerCache();
 }
 
 WebGL2RenderingContext::~WebGL2RenderingContext()
@@ -137,6 +138,12 @@
     m_boundTransformFeedbackBuffers.resize(maxTransformFeedbackAttribs);
 }
 
+void WebGL2RenderingContext::initializeSamplerCache()
+{
+    ASSERT(m_textureUnits.size() >= 8);
+    m_boundSamplers.resize(m_textureUnits.size());
+}
+
 inline static Optional<unsigned> arrayBufferViewElementSize(const ArrayBufferView& data)
 {
     switch (data.getType()) {
@@ -1155,40 +1162,95 @@
 
 RefPtr<WebGLSampler> WebGL2RenderingContext::createSampler()
 {
-    LOG(WebGL, "[[ NOT IMPLEMENTED ]] createSampler()");
-    return nullptr;
+    if (isContextLostOrPending())
+        return nullptr;
+
+    auto sampler = WebGLSampler::create(*this);
+    addSharedObject(sampler.get());
+    return sampler;
 }
 
-void WebGL2RenderingContext::deleteSampler(WebGLSampler*)
+void WebGL2RenderingContext::deleteSampler(WebGLSampler* sampler)
 {
-    LOG(WebGL, "[[ NOT IMPLEMENTED ]] deleteSampler()");
+    if (isContextLostOrPending())
+        return;
+
+    // One sampler can be bound to multiple texture units.
+    if (sampler) {
+        for (auto& samplerSlot : m_boundSamplers) {
+            if (samplerSlot == sampler)
+                samplerSlot = nullptr;
+        }
+    }
+
+    deleteObject(sampler);
 }
 
-GCGLboolean WebGL2RenderingContext::isSampler(WebGLSampler*)
+GCGLboolean WebGL2RenderingContext::isSampler(WebGLSampler* sampler)
 {
-    LOG(WebGL, "[[ NOT IMPLEMENTED ]] isSampler()");
-    return false;
+    if (isContextLostOrPending() || !sampler || sampler->isDeleted() || !validateWebGLObject("isSampler", sampler))
+        return false;
+
+    return m_context->isSampler(sampler->object());
 }
 
-void WebGL2RenderingContext::bindSampler(GCGLuint, WebGLSampler*)
+void WebGL2RenderingContext::bindSampler(GCGLuint unit, WebGLSampler* sampler)
 {
-    LOG(WebGL, "[[ NOT IMPLEMENTED ]] bindSampler()");
+    if (isContextLostOrPending() || m_boundSamplers[unit] == sampler)
+        return;
+
+    if (sampler && sampler->isDeleted()) {
+        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "bindSampler", "cannot bind a deleted Sampler object");
+        return;
+    }
+
+    m_context->bindSampler(unit, objectOrZero(sampler));
+    m_boundSamplers[unit] = sampler;
 }
 
-void WebGL2RenderingContext::samplerParameteri(WebGLSampler&, GCGLenum, GCGLint)
+void WebGL2RenderingContext::samplerParameteri(WebGLSampler& sampler, GCGLenum pname, GCGLint value)
 {
-    LOG(WebGL, "[[ NOT IMPLEMENTED ]] samplerParameteri()");
+    if (isContextLostOrPending())
+        return;
+
+    m_context->samplerParameteri(sampler.object(), pname, value);
 }
 
-void WebGL2RenderingContext::samplerParameterf(WebGLSampler&, GCGLenum, GCGLfloat)
+void WebGL2RenderingContext::samplerParameterf(WebGLSampler& sampler, GCGLenum pname, GCGLfloat value)
 {
-    LOG(WebGL, "[[ NOT IMPLEMENTED ]] samplerParameterf()");
+    if (isContextLostOrPending())
+        return;
+
+    m_context->samplerParameterf(sampler.object(), pname, value);
 }
 
-WebGLAny WebGL2RenderingContext::getSamplerParameter(WebGLSampler&, GCGLenum)
+WebGLAny WebGL2RenderingContext::getSamplerParameter(WebGLSampler& sampler, GCGLenum pname)
 {
-    LOG(WebGL, "[[ NOT IMPLEMENTED ]] getSamplerParameter()");
-    return nullptr;
+    if (isContextLostOrPending())
+        return nullptr;
+
+    switch (pname) {
+    case GraphicsContextGL::TEXTURE_COMPARE_FUNC:
+    case GraphicsContextGL::TEXTURE_COMPARE_MODE:
+    case GraphicsContextGL::TEXTURE_MAG_FILTER:
+    case GraphicsContextGL::TEXTURE_MIN_FILTER:
+    case GraphicsContextGL::TEXTURE_WRAP_R:
+    case GraphicsContextGL::TEXTURE_WRAP_S:
+    case GraphicsContextGL::TEXTURE_WRAP_T: {
+        int value = 0;
+        m_context->getSamplerParameteriv(sampler.object(), pname, &value);
+        return value;
+    }
+    case GraphicsContextGL::TEXTURE_MAX_LOD:
+    case GraphicsContextGL::TEXTURE_MIN_LOD: {
+        float value = 0;
+        m_context->getSamplerParameterfv(sampler.object(), pname, &value);
+        return value;
+    }
+    default:
+        synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getSamplerParameter", "Invalid pname");
+        return nullptr;
+    }
 }
 
 RefPtr<WebGLSync> WebGL2RenderingContext::fenceSync(GCGLenum, GCGLbitfield)
@@ -1269,7 +1331,7 @@
             return;
         }
 
-        if (!validateWebGLObject("isTransformFeedback", feedbackObject))
+        if (!validateWebGLObject("bindTransformFeedback", feedbackObject))
             return;
     }
 
@@ -2224,12 +2286,13 @@
         return m_boundTransformFeedback;
     case GraphicsContextGL::TRANSFORM_FEEDBACK_BUFFER_BINDING:
         return m_boundTransformFeedbackBuffer;
+    case GraphicsContextGL::SAMPLER_BINDING:
+        return m_boundSamplers[m_activeTextureUnit];
     case GraphicsContextGL::COPY_READ_BUFFER:
     case GraphicsContextGL::COPY_WRITE_BUFFER:
     case GraphicsContextGL::PIXEL_PACK_BUFFER_BINDING:   
     case GraphicsContextGL::PIXEL_UNPACK_BUFFER_BINDING:
     case GraphicsContextGL::READ_BUFFER:
-    case GraphicsContextGL::SAMPLER_BINDING:
     case GraphicsContextGL::TEXTURE_BINDING_2D_ARRAY:
     case GraphicsContextGL::TEXTURE_BINDING_3D:
     case GraphicsContextGL::UNIFORM_BUFFER_BINDING:

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h (254868 => 254869)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h	2020-01-21 19:48:05 UTC (rev 254869)
@@ -261,6 +261,7 @@
     bool isIntegerFormat(GCGLenum internalformat);
     void initializeShaderExtensions();
     void initializeTransformFeedbackBufferCache();
+    void initializeSamplerCache();
 
     bool validateTexStorageFuncParameters(GCGLenum target, GCGLsizei levels, GCGLenum internalFormat, GCGLsizei width, GCGLsizei height, const char* functionName);
 
@@ -269,8 +270,9 @@
     RefPtr<WebGLTransformFeedback> m_boundTransformFeedback;
     Vector<RefPtr<WebGLBuffer>> m_boundTransformFeedbackBuffers;
 
-    // Queries
     HashMap<GCGLenum, RefPtr<WebGLQuery>> m_activeQueries;
+
+    Vector<RefPtr<WebGLSampler>> m_boundSamplers;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/canvas/WebGLAny.h (254868 => 254869)


--- trunk/Source/WebCore/html/canvas/WebGLAny.h	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/Source/WebCore/html/canvas/WebGLAny.h	2020-01-21 19:48:05 UTC (rev 254869)
@@ -44,6 +44,7 @@
 class WebGLFramebuffer;
 class WebGLProgram;
 class WebGLRenderbuffer;
+class WebGLSampler;
 class WebGLTexture;
 class WebGLTransformFeedback;
 class WebGLVertexArrayObject;
@@ -70,8 +71,9 @@
     RefPtr<WebGLTexture>,
     RefPtr<WebGLVertexArrayObjectOES>
 #if ENABLE(WEBGL2)
+    , RefPtr<WebGLSampler>
+    , RefPtr<WebGLTransformFeedback>
     , RefPtr<WebGLVertexArrayObject>
-    , RefPtr<WebGLTransformFeedback>
 #endif
 >;
 

Modified: trunk/Source/WebCore/html/canvas/WebGLSampler.cpp (254868 => 254869)


--- trunk/Source/WebCore/html/canvas/WebGLSampler.cpp	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/Source/WebCore/html/canvas/WebGLSampler.cpp	2020-01-21 19:48:05 UTC (rev 254869)
@@ -46,14 +46,12 @@
 WebGLSampler::WebGLSampler(WebGLRenderingContextBase& ctx)
     : WebGLSharedObject(ctx)
 {
-    // FIXME: Call createSampler from GraphicsContextGLOpenGL.
+    setObject(ctx.graphicsContextGL()->createSampler());
 }
 
 void WebGLSampler::deleteObjectImpl(GraphicsContextGLOpenGL* context3d, PlatformGLObject object)
 {
-    UNUSED_PARAM(context3d);
-    UNUSED_PARAM(object);
-    // FIXME: Call deleteSampler from GraphicsContextGLOpenGL.
+    context3d->deleteSampler(object);
 }
 
 }

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


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-01-21 19:40:47 UTC (rev 254868)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-01-21 19:48:05 UTC (rev 254869)
@@ -2413,54 +2413,52 @@
 
 PlatformGLObject GraphicsContextGLOpenGL::createSampler()
 {
-
-    return 0;
+    makeContextCurrent();
+    GLuint name = 0;
+    gl::GenSamplers(1, &name);
+    return name;
 }
 
 void GraphicsContextGLOpenGL::deleteSampler(PlatformGLObject sampler)
 {
-    UNUSED_PARAM(sampler);
+    makeContextCurrent();
+    gl::DeleteSamplers(1, &sampler);
 }
 
 GCGLboolean GraphicsContextGLOpenGL::isSampler(PlatformGLObject sampler)
 {
-    UNUSED_PARAM(sampler);
-
-    return false;
+    makeContextCurrent();
+    return gl::IsSampler(sampler);
 }
 
 void GraphicsContextGLOpenGL::bindSampler(GCGLuint unit, PlatformGLObject sampler)
 {
-    UNUSED_PARAM(unit);
-    UNUSED_PARAM(sampler);
+    makeContextCurrent();
+    gl::BindSampler(unit, sampler);
 }
 
 void GraphicsContextGLOpenGL::samplerParameteri(PlatformGLObject sampler, GCGLenum pname, GCGLint param)
 {
-    UNUSED_PARAM(sampler);
-    UNUSED_PARAM(pname);
-    UNUSED_PARAM(param);
+    makeContextCurrent();
+    gl::SamplerParameteri(sampler, pname, param);
 }
 
 void GraphicsContextGLOpenGL::samplerParameterf(PlatformGLObject sampler, GCGLenum pname, GCGLfloat param)
 {
-    UNUSED_PARAM(sampler);
-    UNUSED_PARAM(pname);
-    UNUSED_PARAM(param);
+    makeContextCurrent();
+    gl::SamplerParameterf(sampler, pname, param);
 }
 
 void GraphicsContextGLOpenGL::getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value)
 {
-    UNUSED_PARAM(sampler);
-    UNUSED_PARAM(pname);
-    UNUSED_PARAM(value);
+    makeContextCurrent();
+    gl::GetSamplerParameterfv(sampler, pname, value);
 }
 
 void GraphicsContextGLOpenGL::getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value)
 {
-    UNUSED_PARAM(sampler);
-    UNUSED_PARAM(pname);
-    UNUSED_PARAM(value);
+    makeContextCurrent();
+    gl::GetSamplerParameteriv(sampler, pname, value);
 }
 
 PlatformGLObject GraphicsContextGLOpenGL::fenceSync(GCGLenum condition, GCGLbitfield flags)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to