Title: [265114] trunk
Revision
265114
Author
[email protected]
Date
2020-07-30 15:27:30 -0700 (Thu, 30 Jul 2020)

Log Message

[WebGL2] Buffer updates
https://bugs.webkit.org/show_bug.cgi?id=209511

Patch by James Darpinian <[email protected]> on 2020-07-30
Reviewed by Dean Jackson.

Various fixes in bufferData, bufferSubData, and getBufferSubData. Passes all WebGL conformance tests in conformance/buffers/* and conformance2/buffers/*.

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::sliceArrayBufferView):
(WebCore::WebGL2RenderingContext::getBufferSubData):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::bufferData):
(WebCore::WebGLRenderingContextBase::bufferSubData):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLRenderingContextBase.idl:

Modified Paths

Diff

Modified: trunk/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer-expected.txt (265113 => 265114)


--- trunk/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer-expected.txt	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer-expected.txt	2020-07-30 22:27:30 UTC (rev 265114)
@@ -13,6 +13,7 @@
 PASS getError was expected value: INVALID_VALUE : 
 PASS getError was expected value: INVALID_VALUE : 
 PASS getError was expected value: NO_ERROR : 
+PASS gl.bufferSubData(gl.ARRAY_BUFFER, 10, null) threw exception TypeError: Type error.
 PASS getError was expected value: NO_ERROR : 
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html (265113 => 265114)


--- trunk/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html	2020-07-30 22:27:30 UTC (rev 265114)
@@ -51,7 +51,7 @@
 gl.bufferSubData(gl.ARRAY_BUFFER, 10, array);
 glErrorShouldBe(gl, gl.NO_ERROR);
 
-gl.bufferSubData(gl.ARRAY_BUFFER, 10, null);
+shouldThrow("gl.bufferSubData(gl.ARRAY_BUFFER, 10, null)");
 glErrorShouldBe(gl, gl.NO_ERROR);
 </script>
 </body>

Modified: trunk/LayoutTests/webgl/2.0.0/conformance/buffers/buffer-data-and-buffer-sub-data-expected.txt (265113 => 265114)


--- trunk/LayoutTests/webgl/2.0.0/conformance/buffers/buffer-data-and-buffer-sub-data-expected.txt	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/LayoutTests/webgl/2.0.0/conformance/buffers/buffer-data-and-buffer-sub-data-expected.txt	2020-07-30 22:27:30 UTC (rev 265114)
@@ -1,64 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance/buffers/buffer-data-and-buffer-sub-data.html
-[ 1: PASS ] WebGL context exists
-[ 2: PASS ] [object WebGLBuffer] is non-null.
-[ 3: PASS ] getError was expected value: INVALID_OPERATION : no buffer bound
-[ 4: PASS ] getError was expected value: NO_ERROR :
-[ 5: PASS ] getError was expected value: INVALID_VALUE : calling bufferData when buffer size is negative should generate INVALID_VALUE
-[ 6: PASS ] getError was expected value: INVALID_VALUE : calling bufferData when BufferDataSource is null should generate INVALID_VALUE
-[ 7: PASS ] getError was expected value: INVALID_VALUE : calling bufferData when BufferDataSource is undefined should generate INVALID_VALUE
-[ 8: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE : Passing 0 to bufferData
-[ 9: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 0
-[ 10: PASS ] getError was expected value: NO_ERROR : Passing 4 to bufferData
-[ 11: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 4
-[ 12: PASS ] getError was expected value: NO_ERROR : Passing 5.1 to bufferData
-[ 13: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 5
-[ 14: PASS ] getError was expected value: NO_ERROR : Passing 5.8 to bufferData
-[ 15: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 5
-[ 16: PASS ] getError was expected value: NO_ERROR : Passing 5.5 to bufferData
-[ 17: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 5
-[ 18: PASS ] getError was expected value: NO_ERROR : Passing 4 to bufferData
-[ 19: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 4
-[ 20: PASS ] getError was expected value: NO_ERROR : Passing 5.1 to bufferData
-[ 21: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 5
-[ 22: PASS ] getError was expected value: NO_ERROR : Passing 5.8 to bufferData
-[ 23: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 5
-[ 24: PASS ] getError was expected value: NO_ERROR : Passing 5.5 to bufferData
-[ 25: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 5
-[ 26: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE : Passing 0 to bufferData
-[ 27: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 0
-[ 28: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE : Passing 42,64 to bufferData
-[ 29: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 0
-[ 30: PASS ] getError was expected value: NO_ERROR : Passing 42 to bufferData
-[ 31: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 42
-[ 32: PASS ] getError was expected value: NO_ERROR : Passing 42 to bufferData
-[ 33: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 42
-[ 34: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE : Passing 42,64 to bufferData
-[ 35: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 0
-[ 36: PASS ] getError was expected value: NO_ERROR : Passing [object ArrayBuffer] to bufferData
-[ 37: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 0
-[ 38: PASS ] getError was expected value: NO_ERROR : Passing [object ArrayBuffer] to bufferData
-[ 39: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 4
-[ 40: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE : Passing WebGL Rocks! to bufferData
-[ 41: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 0
-[ 42: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE : Passing [object Object] to bufferData
-[ 43: PASS ] gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 0
-[ 44: PASS ] getError was expected value: INVALID_VALUE : Calling bufferSubData before bufferData should fail
-[ 45: PASS ] getError was expected value: NO_ERROR :
-[ 46: PASS ] getError was expected value: INVALID_VALUE : calling bufferSubData with ArrayBuffer when offset is negative should INVALID_VALUE
-[ 47: PASS ] getError was expected value: INVALID_VALUE : buffer overflow
-[ 48: PASS ] getError was expected value: INVALID_VALUE : calling bufferSubData with ArrayBufferView when offset is negative should generate INVALID_VALUE
-[ 49: PASS ] getError was expected value: NO_ERROR : calling bufferSubData with ArrayBuffer should succeed
-[ 50: PASS ] getError was expected value: NO_ERROR : calling bufferSubData with zero-sized ArrayBufferView should succeed
-[ 51: PASS ] gl.bufferSubData(gl.ARRAY_BUFFER, 0, 42); threw exception TypeError: Type error.
-[ 52: PASS ] gl.bufferSubData(gl.ARRAY_BUFFER, 0, 5.5); threw exception TypeError: Type error.
-[ 53: PASS ] gl.bufferSubData(gl.ARRAY_BUFFER, 0, "5.5"); threw exception TypeError: Type error.
-[ 54: PASS ] gl.bufferSubData(gl.ARRAY_BUFFER, 0, [4]); threw exception TypeError: Type error.
-[ 55: PASS ] gl.bufferSubData(gl.ARRAY_BUFFER, 0, { mynumber: 42}); threw exception TypeError: Type error.
-[ 56: FAIL ] gl.bufferSubData(gl.ARRAY_BUFFER, 10, null) should throw an exception. Was undefined.
-[ 57: FAIL ] gl.bufferSubData(gl.ARRAY_BUFFER, 10, undefined) should throw an exception. Was undefined.
-[ 58: PASS ] getError was expected value: NO_ERROR : should generate no GL error
-[ 59: PASS ] successfullyParsed is true
-[ FAIL ] 8 failures reported
+[ PASS ] All tests passed
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/buffers/get-buffer-sub-data-expected.txt (265113 => 265114)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/buffers/get-buffer-sub-data-expected.txt	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/buffers/get-buffer-sub-data-expected.txt	2020-07-30 22:27:30 UTC (rev 265114)
@@ -1,39 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/buffers/get-buffer-sub-data.html
-[ 1: PASS ] getError was expected value: NO_ERROR : Should be no errors from setup.
-[ 2: PASS ] getError was expected value: NO_ERROR : Should be no errors from buffer setup.
-[ 3: PASS ] getError was expected value: NO_ERROR : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray)
-[ 4: PASS ] gl.getBufferSubData(gl.ARRAY_BUFFER, 0, new ArrayBuffer(4)) threw exception TypeError: Argument 3 ('dstData') to WebGL2RenderingContext.getBufferSubData must be an instance of ArrayBufferView.
-[ 5: PASS ] getError was expected value: NO_ERROR : Should not generate GL error
-[ 6: PASS ] gl.getBufferSubData(gl.ARRAY_BUFFER, 0, null) threw exception TypeError: Argument 3 ('dstData') to WebGL2RenderingContext.getBufferSubData must be an instance of ArrayBufferView.
-[ 7: PASS ] getError was expected value: NO_ERROR : Should not generate GL error
-[ 8: PASS ] The returned array buffer matches original data
-[ 9: PASS ] getError was expected value: NO_ERROR : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray, 2)
-[ 10: PASS ] areArraysEqual(retArray.slice(0, 2), [0, 0]) is true
-[ 11: PASS ] areArraysEqual(retArray.slice(2), floatArray.slice(0, floatArray.length - 2)) is true
-[ 12: FAIL ] getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray, retArray.length)
-[ 13: PASS ] areArraysEqual(retArray, [0, 0, 0, 0, 0, 0, 0, 0, 0]) is true
-[ 14: FAIL ] getError expected: INVALID_VALUE. Was INVALID_OPERATION : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray, retArray.length + 1)
-[ 15: PASS ] getError was expected value: NO_ERROR : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray, 2, 2)
-[ 16: PASS ] areArraysEqual(retArray.slice(0, 2), [0, 0]) is true
-[ 17: PASS ] areArraysEqual(retArray.slice(2, 4), floatArray.slice(0, 2)) is true
-[ 18: PASS ] areArraysEqual(retArray.slice(4), [0, 0, 0, 0, 0]) is true
-[ 19: PASS ] getError was expected value: NO_ERROR : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray, retArray.length - 1, 1)
-[ 20: PASS ] areArraysEqual(retArray.slice(0, 8), [0, 0, 0, 0, 0, 0, 0, 0]) is true
-[ 21: PASS ] areArraysEqual(retArray.slice(8), floatArray.slice(0, 1)) is true
-[ 22: FAIL ] getError expected: INVALID_VALUE. Was INVALID_OPERATION : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray, retArray.length - 1, 2)
-[ 23: FAIL ] getError expected: INVALID_VALUE. Was INVALID_OPERATION : Extra length should generate INVALID_VALUE.
-[ 24: FAIL ] getError expected: INVALID_VALUE. Was INVALID_OPERATION : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, retArray.byteLength + 1, retArray)
-[ 25: FAIL ] getError expected: INVALID_VALUE. Was INVALID_OPERATION : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 1, retArray)
-[ 26: PASS ] getError was expected value: INVALID_OPERATION : after evaluating: gl.getBufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, retArray)
-[ 27: FAIL ] getError expected: INVALID_VALUE. Was INVALID_OPERATION : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, -1, retArray)
-[ 28: PASS ] getError was expected value: NO_ERROR : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray)
-[ 29: PASS ] areArraysEqual(retArray, [0, 0, 0, 0, 0, 0, 0, 0, 0]) is true
-[ 30: PASS ] getError was expected value: NO_ERROR : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray)
-[ 31: PASS ] areArraysEqual(retArray, floatArray) is true
-[ 32: PASS ] getError was expected value: NO_ERROR : after evaluating: gl.getBufferSubData(gl.ARRAY_BUFFER, 0, retArray)
-[ 33: PASS ] areArraysEqual(retArray, floatArray) is true
-[ 34: PASS ] successfullyParsed is true
-[ FAIL ] 7 failures reported
+[ PASS ] All tests passed
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/misc/views-with-offsets-expected.txt (265113 => 265114)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/misc/views-with-offsets-expected.txt	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/misc/views-with-offsets-expected.txt	2020-07-30 22:27:30 UTC (rev 265114)
@@ -1,245 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/misc/views-with-offsets.html
-[ 1: PASS ] getError was expected value: NO_ERROR :
-[ 2: PASS ] getError was expected value: NO_ERROR :
-[ 3: PASS ] Should be [0, 1, 1, 2], was [0, 1, 1, 2].
-[ 4: PASS ] getError was expected value: NO_ERROR :
-[ 5: PASS ] getError was expected value: NO_ERROR :
-[ 6: PASS ] Should be [1, 1, 2, 3], was [1, 1, 2, 3].
-[ 7: PASS ] getError was expected value: NO_ERROR :
-[ 8: PASS ] getError was expected value: NO_ERROR :
-[ 9: PASS ] Should be [1, 2, 3, 5], was [1, 2, 3, 5].
-[ 10: PASS ] getError was expected value: NO_ERROR :
-[ 11: PASS ] getError was expected value: NO_ERROR :
-[ 12: PASS ] Should be [2, 3, 5, 8], was [2, 3, 5, 8].
-[ 13: PASS ] getError was expected value: NO_ERROR :
-[ 14: PASS ] getError was expected value: NO_ERROR :
-[ 15: PASS ] Should be [3, 5, 8, 13], was [3, 5, 8, 13].
-[ 16: PASS ] getError was expected value: NO_ERROR :
-[ 17: PASS ] getError was expected value: NO_ERROR :
-[ 18: PASS ] Should be [5, 8, 13, 21], was [5, 8, 13, 21].
-[ 19: PASS ] getError was expected value: NO_ERROR :
-[ 20: PASS ] getError was expected value: NO_ERROR :
-[ 21: PASS ] Should be [8, 13, 21, 34], was [8, 13, 21, 34].
-[ 22: PASS ] getError was expected value: NO_ERROR :
-[ 23: PASS ] getError was expected value: NO_ERROR :
-[ 24: PASS ] Should be [13, 21, 34, 55], was [13, 21, 34, 55].
-[ 25: PASS ] getError was expected value: NO_ERROR :
-[ 26: PASS ] getError was expected value: NO_ERROR :
-[ 27: PASS ] Should be [21, 34, 55, 89], was [21, 34, 55, 89].
-[ 28: PASS ] getError was expected value: NO_ERROR :
-[ 29: PASS ] getError was expected value: NO_ERROR :
-[ 30: PASS ] Should be [34, 55, 89, 144], was [34, 55, 89, 144].
-[ 31: PASS ] getError was expected value: NO_ERROR :
-[ 32: PASS ] getError was expected value: NO_ERROR :
-[ 33: PASS ] Should be [55, 89, 144, 233], was [55, 89, 144, 233].
-[ 34: PASS ] getError was expected value: INVALID_OPERATION :
-[ 35: PASS ] getError was expected value: INVALID_OPERATION :
-[ 36: PASS ] getError was expected value: INVALID_OPERATION :
-[ 37: PASS ] getError was expected value: INVALID_OPERATION :
-[ 38: PASS ] getError was expected value: INVALID_OPERATION :
-[ 39: PASS ] getError was expected value: NO_ERROR :
-[ 40: PASS ] getError was expected value: NO_ERROR :
-[ 41: PASS ] Should be 65504, was 65504.
-[ 42: PASS ] getError was expected value: NO_ERROR :
-[ 43: PASS ] getError was expected value: NO_ERROR :
-[ 44: PASS ] Should be 2047, was 2047.
-[ 45: PASS ] getError was expected value: INVALID_OPERATION :
-[ 46: PASS ] getError was expected value: INVALID_OPERATION :
-[ 47: PASS ] getError was expected value: NO_ERROR :
-[ 48: PASS ] getError was expected value: NO_ERROR :
-[ 49: PASS ] Should be [0, 1, 1, 2], was [0, 1, 1, 2].
-[ 50: PASS ] getError was expected value: NO_ERROR :
-[ 51: PASS ] getError was expected value: NO_ERROR :
-[ 52: PASS ] Should be [1, 1, 2, 3], was [1, 1, 2, 3].
-[ 53: PASS ] getError was expected value: NO_ERROR :
-[ 54: PASS ] getError was expected value: NO_ERROR :
-[ 55: PASS ] Should be [1, 2, 3, 5], was [1, 2, 3, 5].
-[ 56: PASS ] getError was expected value: NO_ERROR :
-[ 57: PASS ] getError was expected value: NO_ERROR :
-[ 58: PASS ] Should be [2, 3, 5, 8], was [2, 3, 5, 8].
-[ 59: PASS ] getError was expected value: NO_ERROR :
-[ 60: PASS ] getError was expected value: NO_ERROR :
-[ 61: PASS ] Should be [3, 5, 8, 13], was [3, 5, 8, 13].
-[ 62: PASS ] getError was expected value: NO_ERROR :
-[ 63: PASS ] getError was expected value: NO_ERROR :
-[ 64: PASS ] Should be [5, 8, 13, 21], was [5, 8, 13, 21].
-[ 65: PASS ] getError was expected value: NO_ERROR :
-[ 66: PASS ] getError was expected value: NO_ERROR :
-[ 67: PASS ] Should be [8, 13, 21, 34], was [8, 13, 21, 34].
-[ 68: PASS ] getError was expected value: NO_ERROR :
-[ 69: PASS ] getError was expected value: NO_ERROR :
-[ 70: PASS ] Should be [13, 21, 34, 55], was [13, 21, 34, 55].
-[ 71: PASS ] getError was expected value: NO_ERROR :
-[ 72: PASS ] getError was expected value: NO_ERROR :
-[ 73: PASS ] Should be [21, 34, 55, 89], was [21, 34, 55, 89].
-[ 74: PASS ] getError was expected value: NO_ERROR :
-[ 75: PASS ] getError was expected value: NO_ERROR :
-[ 76: PASS ] Should be [34, 55, 89, 144], was [34, 55, 89, 144].
-[ 77: PASS ] getError was expected value: NO_ERROR :
-[ 78: PASS ] getError was expected value: NO_ERROR :
-[ 79: PASS ] Should be [55, 89, 144, 233], was [55, 89, 144, 233].
-[ 80: PASS ] getError was expected value: INVALID_OPERATION :
-[ 81: PASS ] getError was expected value: INVALID_OPERATION :
-[ 82: PASS ] getError was expected value: INVALID_OPERATION :
-[ 83: PASS ] getError was expected value: INVALID_OPERATION :
-[ 84: PASS ] getError was expected value: INVALID_OPERATION :
-[ 85: PASS ] getError was expected value: NO_ERROR :
-[ 86: PASS ] getError was expected value: NO_ERROR :
-[ 87: PASS ] Should be 65504, was 65504.
-[ 88: PASS ] getError was expected value: NO_ERROR :
-[ 89: PASS ] getError was expected value: NO_ERROR :
-[ 90: PASS ] Should be 2047, was 2047.
-[ 91: PASS ] getError was expected value: INVALID_OPERATION :
-[ 92: PASS ] getError was expected value: INVALID_OPERATION :
-[ 93: PASS ] getError was expected value: NO_ERROR :
-[ 94: PASS ] getError was expected value: NO_ERROR :
-[ 95: PASS ] Should be [0, 1, 1, 2], was [0, 1, 1, 2].
-[ 96: PASS ] getError was expected value: NO_ERROR :
-[ 97: PASS ] getError was expected value: NO_ERROR :
-[ 98: PASS ] Should be [1, 1, 2, 3], was [1, 1, 2, 3].
-[ 99: PASS ] getError was expected value: NO_ERROR :
-[ 100: PASS ] getError was expected value: NO_ERROR :
-[ 101: PASS ] Should be [1, 2, 3, 5], was [1, 2, 3, 5].
-[ 102: PASS ] getError was expected value: NO_ERROR :
-[ 103: PASS ] getError was expected value: NO_ERROR :
-[ 104: PASS ] Should be [2, 3, 5, 8], was [2, 3, 5, 8].
-[ 105: PASS ] getError was expected value: NO_ERROR :
-[ 106: PASS ] getError was expected value: NO_ERROR :
-[ 107: PASS ] Should be [3, 5, 8, 13], was [3, 5, 8, 13].
-[ 108: PASS ] getError was expected value: NO_ERROR :
-[ 109: PASS ] getError was expected value: NO_ERROR :
-[ 110: PASS ] Should be [5, 8, 13, 21], was [5, 8, 13, 21].
-[ 111: PASS ] getError was expected value: NO_ERROR :
-[ 112: PASS ] getError was expected value: NO_ERROR :
-[ 113: PASS ] Should be [8, 13, 21, 34], was [8, 13, 21, 34].
-[ 114: PASS ] getError was expected value: NO_ERROR :
-[ 115: PASS ] getError was expected value: NO_ERROR :
-[ 116: PASS ] Should be [13, 21, 34, 55], was [13, 21, 34, 55].
-[ 117: PASS ] getError was expected value: NO_ERROR :
-[ 118: PASS ] getError was expected value: NO_ERROR :
-[ 119: PASS ] Should be [21, 34, 55, 89], was [21, 34, 55, 89].
-[ 120: PASS ] getError was expected value: NO_ERROR :
-[ 121: PASS ] getError was expected value: NO_ERROR :
-[ 122: PASS ] Should be [34, 55, 89, 144], was [34, 55, 89, 144].
-[ 123: PASS ] getError was expected value: NO_ERROR :
-[ 124: PASS ] getError was expected value: NO_ERROR :
-[ 125: PASS ] Should be [55, 89, 144, 233], was [55, 89, 144, 233].
-[ 126: PASS ] getError was expected value: INVALID_OPERATION :
-[ 127: PASS ] getError was expected value: INVALID_OPERATION :
-[ 128: PASS ] getError was expected value: INVALID_OPERATION :
-[ 129: PASS ] getError was expected value: INVALID_OPERATION :
-[ 130: PASS ] getError was expected value: INVALID_OPERATION :
-[ 131: PASS ] getError was expected value: NO_ERROR :
-[ 132: PASS ] getError was expected value: NO_ERROR :
-[ 133: PASS ] Should be 65504, was 65504.
-[ 134: PASS ] getError was expected value: NO_ERROR :
-[ 135: PASS ] getError was expected value: NO_ERROR :
-[ 136: PASS ] Should be 2047, was 2047.
-[ 137: PASS ] getError was expected value: INVALID_OPERATION :
-[ 138: PASS ] getError was expected value: INVALID_OPERATION :
-[ 139: PASS ] getError was expected value: NO_ERROR :
-[ 140: PASS ] getError was expected value: NO_ERROR :
-[ 141: PASS ] Should be [0, 1, 1, 2], was [0, 1, 1, 2].
-[ 142: PASS ] getError was expected value: NO_ERROR :
-[ 143: PASS ] getError was expected value: NO_ERROR :
-[ 144: PASS ] Should be [1, 1, 2, 3], was [1, 1, 2, 3].
-[ 145: PASS ] getError was expected value: NO_ERROR :
-[ 146: PASS ] getError was expected value: NO_ERROR :
-[ 147: PASS ] Should be [1, 2, 3, 5], was [1, 2, 3, 5].
-[ 148: PASS ] getError was expected value: NO_ERROR :
-[ 149: PASS ] getError was expected value: NO_ERROR :
-[ 150: PASS ] Should be [2, 3, 5, 8], was [2, 3, 5, 8].
-[ 151: PASS ] getError was expected value: NO_ERROR :
-[ 152: PASS ] getError was expected value: NO_ERROR :
-[ 153: PASS ] Should be [3, 5, 8, 13], was [3, 5, 8, 13].
-[ 154: PASS ] getError was expected value: NO_ERROR :
-[ 155: PASS ] getError was expected value: NO_ERROR :
-[ 156: PASS ] Should be [5, 8, 13, 21], was [5, 8, 13, 21].
-[ 157: PASS ] getError was expected value: NO_ERROR :
-[ 158: PASS ] getError was expected value: NO_ERROR :
-[ 159: PASS ] Should be [8, 13, 21, 34], was [8, 13, 21, 34].
-[ 160: PASS ] getError was expected value: NO_ERROR :
-[ 161: PASS ] getError was expected value: NO_ERROR :
-[ 162: PASS ] Should be [13, 21, 34, 55], was [13, 21, 34, 55].
-[ 163: PASS ] getError was expected value: NO_ERROR :
-[ 164: PASS ] getError was expected value: NO_ERROR :
-[ 165: PASS ] Should be [21, 34, 55, 89], was [21, 34, 55, 89].
-[ 166: PASS ] getError was expected value: NO_ERROR :
-[ 167: PASS ] getError was expected value: NO_ERROR :
-[ 168: PASS ] Should be [34, 55, 89, 144], was [34, 55, 89, 144].
-[ 169: PASS ] getError was expected value: NO_ERROR :
-[ 170: PASS ] getError was expected value: NO_ERROR :
-[ 171: PASS ] Should be [55, 89, 144, 233], was [55, 89, 144, 233].
-[ 172: PASS ] getError was expected value: INVALID_OPERATION :
-[ 173: PASS ] getError was expected value: INVALID_OPERATION :
-[ 174: PASS ] getError was expected value: INVALID_OPERATION :
-[ 175: PASS ] getError was expected value: INVALID_OPERATION :
-[ 176: PASS ] getError was expected value: INVALID_OPERATION :
-[ 177: PASS ] getError was expected value: NO_ERROR :
-[ 178: PASS ] getError was expected value: NO_ERROR :
-[ 179: PASS ] Should be 65504, was 65504.
-[ 180: PASS ] getError was expected value: NO_ERROR :
-[ 181: PASS ] getError was expected value: NO_ERROR :
-[ 182: PASS ] Should be 2047, was 2047.
-[ 183: PASS ] getError was expected value: INVALID_OPERATION :
-[ 184: PASS ] getError was expected value: INVALID_OPERATION :
-[ 185: PASS ] getError was expected value: NO_ERROR :
-[ 186: PASS ] getError was expected value: NO_ERROR :
-[ 187: PASS ] getError was expected value: INVALID_VALUE :
-[ 188: PASS ] getError was expected value: INVALID_VALUE :
-[ 189: PASS ] getError was expected value: INVALID_VALUE :
-[ 190: PASS ] getError was expected value: INVALID_VALUE :
-[ 191: PASS ] getError was expected value: INVALID_VALUE :
-[ 192: PASS ] getError was expected value: INVALID_VALUE :
-[ 193: PASS ] getError was expected value: INVALID_VALUE :
-[ 194: PASS ] getError was expected value: INVALID_VALUE :
-[ 195: PASS ] getError was expected value: INVALID_VALUE :
-[ 196: PASS ] getError was expected value: NO_ERROR :
-[ 197: PASS ] getError was expected value: NO_ERROR :
-[ 198: PASS ] getError was expected value: INVALID_VALUE :
-[ 199: PASS ] getError was expected value: INVALID_VALUE :
-[ 200: PASS ] getError was expected value: INVALID_VALUE :
-[ 201: PASS ] getError was expected value: INVALID_VALUE :
-[ 202: PASS ] getError was expected value: INVALID_VALUE :
-[ 203: PASS ] getError was expected value: INVALID_VALUE :
-[ 204: PASS ] getError was expected value: INVALID_VALUE :
-[ 205: PASS ] getError was expected value: INVALID_VALUE :
-[ 206: PASS ] getError was expected value: INVALID_VALUE :
-[ 207: PASS ] getError was expected value: NO_ERROR :
-[ 208: PASS ] getError was expected value: NO_ERROR :
-[ 209: PASS ] getError was expected value: INVALID_VALUE :
-[ 210: PASS ] getError was expected value: INVALID_VALUE :
-[ 211: PASS ] getError was expected value: INVALID_VALUE :
-[ 212: PASS ] getError was expected value: INVALID_VALUE :
-[ 213: PASS ] getError was expected value: INVALID_VALUE :
-[ 214: PASS ] getError was expected value: INVALID_VALUE :
-[ 215: PASS ] getError was expected value: INVALID_VALUE :
-[ 216: PASS ] getError was expected value: INVALID_VALUE :
-[ 217: PASS ] getError was expected value: INVALID_VALUE :
-[ 218: PASS ] getError was expected value: NO_ERROR :
-[ 219: PASS ] getError was expected value: NO_ERROR :
-[ 220: PASS ] getError was expected value: INVALID_VALUE :
-[ 221: PASS ] getError was expected value: INVALID_VALUE :
-[ 222: PASS ] getError was expected value: INVALID_VALUE :
-[ 223: PASS ] getError was expected value: INVALID_VALUE :
-[ 224: PASS ] getError was expected value: INVALID_VALUE :
-[ 225: PASS ] getError was expected value: INVALID_VALUE :
-[ 226: PASS ] getError was expected value: INVALID_VALUE :
-[ 227: PASS ] getError was expected value: INVALID_VALUE :
-[ 228: PASS ] getError was expected value: INVALID_VALUE :
-[ 229: FAIL ] getError expected: NO_ERROR. Was INVALID_OPERATION :
-[ 230: FAIL ] Should be [10, 20, 30, 40], was [0, 0, 0, 0].
-[ 231: FAIL ] getError expected: NO_ERROR. Was INVALID_OPERATION :
-[ 232: FAIL ] Should be [10, 20, 30, 40], was [0, 0, 0, 0].
-[ 233: FAIL ] getError expected: NO_ERROR. Was INVALID_OPERATION :
-[ 234: FAIL ] Should be [10, 20, 30, 40], was [0, 0, 0, 0].
-[ 235: PASS ] getError was expected value: INVALID_OPERATION :
-[ 236: PASS ] getError was expected value: INVALID_OPERATION :
-[ 237: PASS ] getError was expected value: INVALID_OPERATION :
-[ 238: PASS ] getError was expected value: INVALID_OPERATION :
-[ 239: PASS ] getError was expected value: INVALID_VALUE :
-[ 240: PASS ] successfullyParsed is true
-[ FAIL ] 6 failures reported
+[ PASS ] All tests passed
 

Modified: trunk/Source/WebCore/ChangeLog (265113 => 265114)


--- trunk/Source/WebCore/ChangeLog	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/Source/WebCore/ChangeLog	2020-07-30 22:27:30 UTC (rev 265114)
@@ -1,3 +1,21 @@
+2020-07-30  James Darpinian  <[email protected]>
+
+        [WebGL2] Buffer updates
+        https://bugs.webkit.org/show_bug.cgi?id=209511
+
+        Reviewed by Dean Jackson.
+
+        Various fixes in bufferData, bufferSubData, and getBufferSubData. Passes all WebGL conformance tests in conformance/buffers/* and conformance2/buffers/*.
+
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::sliceArrayBufferView):
+        (WebCore::WebGL2RenderingContext::getBufferSubData):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::bufferData):
+        (WebCore::WebGLRenderingContextBase::bufferSubData):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * html/canvas/WebGLRenderingContextBase.idl:
+
 2020-07-30  Jer Noble  <[email protected]>
 
         [Cocoa] Make DecoderTest run against .mp4 files; add rate-limiting.

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (265113 => 265114)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-07-30 22:27:30 UTC (rev 265114)
@@ -507,7 +507,7 @@
     }
     Checked<GCGLuint, RecordOverflow> checkedByteLength = checkedLength * checkedElementSize;
 
-    if (checkedByteSrcOffset.hasOverflowed()
+    if (checkedLength.hasOverflowed() || checkedByteSrcOffset.hasOverflowed()
         || checkedByteLength.hasOverflowed()
         || checkedByteSrcOffset.unsafeGet() > data.byteLength()
         || checkedByteLength.unsafeGet() > data.byteLength() - checkedByteSrcOffset.unsafeGet()) {
@@ -515,7 +515,7 @@
         return nullptr;
     }
 
-    return arrayBufferViewSliceFactory(functionName, data, data.byteOffset() + checkedByteSrcOffset.unsafeGet(), length);
+    return arrayBufferViewSliceFactory(functionName, data, data.byteOffset() + checkedByteSrcOffset.unsafeGet(), checkedLength.unsafeGet());
 }
 
 void WebGL2RenderingContext::pixelStorei(GCGLenum pname, GCGLint param)
@@ -620,7 +620,7 @@
 {
     if (isContextLostOrPending())
         return;
-    RefPtr<WebGLBuffer> buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContextGL::STATIC_DRAW);
+    RefPtr<WebGLBuffer> buffer = validateBufferDataParameters("getBufferSubData", target, GraphicsContextGL::STATIC_DRAW);
     if (!buffer) {
         synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getBufferSubData", "No WebGLBuffer is bound to target");
         return;
@@ -642,7 +642,7 @@
     auto dstDataLength = dstData->byteLength() / elementSize;
 
     if (dstOffset > dstDataLength) {
-        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getBufferSubData", "dstOffset is larger than the length of the destination buffer.");
+        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getBufferSubData", "dstOffset is larger than the length of the destination buffer.");
         return;
     }
 
@@ -652,17 +652,17 @@
     Checked<GCGLuint, RecordOverflow> checkedCopyLength(copyLength);
     auto checkedDestinationEnd = checkedDstOffset + checkedCopyLength;
     if (checkedDestinationEnd.hasOverflowed()) {
-        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getBufferSubData", "dstOffset + copyLength is too high");
+        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getBufferSubData", "dstOffset + copyLength is too high");
         return;
     }
 
     if (checkedDestinationEnd.unsafeGet() > dstDataLength) {
-        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getBufferSubData", "end of written destination is past the end of the buffer");
+        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getBufferSubData", "end of written destination is past the end of the buffer");
         return;
     }
 
     if (srcByteOffset < 0) {
-        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getBufferSubData", "srcByteOffset is less than 0");
+        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getBufferSubData", "srcByteOffset is less than 0");
         return;
     }
 
@@ -671,9 +671,12 @@
     Checked<GCGLintptr, RecordOverflow> checkedElementSize(elementSize);
     auto checkedSourceEnd = checkedSrcByteOffset + checkedCopyLengthPtr * checkedElementSize;
     if (checkedSourceEnd.hasOverflowed() || checkedSourceEnd.unsafeGet() > buffer->byteLength()) {
-        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getBufferSubData", "Parameters would read outside the bounds of the source buffer");
+        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getBufferSubData", "Parameters would read outside the bounds of the source buffer");
         return;
     }
+    
+    if (!copyLength)
+        return;
 
     m_context->moveErrorsToSyntheticErrorList();
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (265113 => 265114)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-07-30 22:27:30 UTC (rev 265114)
@@ -1553,10 +1553,6 @@
         synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "bufferData", "size < 0");
         return;
     }
-    if (!size) {
-        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "bufferData", "size == 0");
-        return;
-    }
     if (!buffer->associateBufferData(static_cast<GCGLsizeiptr>(size))) {
         synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "bufferData", "invalid buffer");
         return;
@@ -1597,7 +1593,7 @@
     }, data.value());
 }
 
-void WebGLRenderingContextBase::bufferSubData(GCGLenum target, long long offset, Optional<BufferDataSource>&& data)
+void WebGLRenderingContextBase::bufferSubData(GCGLenum target, long long offset, BufferDataSource&& data)
 {
     if (isContextLostOrPending())
         return;
@@ -1608,8 +1604,6 @@
         synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "bufferSubData", "offset < 0");
         return;
     }
-    if (!data)
-        return;
 
     WTF::visit([&](auto& data) {
         if (!buffer->associateBufferSubData(static_cast<GCGLintptr>(offset), data.get())) {
@@ -1623,7 +1617,7 @@
             // The bufferSubData function failed. Tell the buffer it doesn't have the data it thinks it does.
             buffer->disassociateBufferData();
         }
-    }, data.value());
+    }, data);
 }
 
 GCGLenum WebGLRenderingContextBase::checkFramebufferStatus(GCGLenum target)

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (265113 => 265114)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-07-30 22:27:30 UTC (rev 265114)
@@ -138,7 +138,7 @@
     using BufferDataSource = WTF::Variant<RefPtr<ArrayBuffer>, RefPtr<ArrayBufferView>>;
     void bufferData(GCGLenum target, long long size, GCGLenum usage);
     void bufferData(GCGLenum target, Optional<BufferDataSource>&&, GCGLenum usage);
-    void bufferSubData(GCGLenum target, long long offset, Optional<BufferDataSource>&&);
+    void bufferSubData(GCGLenum target, long long offset, BufferDataSource&&);
 
     GCGLenum checkFramebufferStatus(GCGLenum target);
     void clear(GCGLbitfield mask);

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl (265113 => 265114)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl	2020-07-30 22:26:01 UTC (rev 265113)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl	2020-07-30 22:27:30 UTC (rev 265114)
@@ -495,7 +495,7 @@
     void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
     void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
     void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
-    void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
+    void bufferSubData(GLenum target, GLintptr offset, BufferDataSource data);
 
     GLenum checkFramebufferStatus(GLenum target);
     void clear(GLbitfield mask);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to