Diff
Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/unary-minus-operator-in-dynamic-loop-expected.txt (264370 => 264371)
--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/unary-minus-operator-in-dynamic-loop-expected.txt 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/unary-minus-operator-in-dynamic-loop-expected.txt 2020-07-14 19:59:01 UTC (rev 264371)
@@ -1,12 +1,5 @@
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
Test: ../../resources/webgl_test_files/conformance2/glsl3/unary-minus-operator-in-dynamic-loop.html
-[ 1: PASS ] square should be green
-[ 2: FAIL ] square should be green at (138, 0) expected: 0,255,0,255 was 255,0,0,255
-[ 3: PASS ] square should be green
-[ 4: FAIL ] square should be green at (414, 0) expected: 0,255,0,255 was 255,0,0,255
-[ 5: PASS ] square should be green
-[ 6: FAIL ] square should be green at (690, 0) expected: 0,255,0,255 was 255,0,0,255
-[ 7: PASS ] successfullyParsed is true
-[ FAIL ] 3 failures reported
+[ PASS ] All tests passed
Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/programs/gl-get-frag-data-location-expected.txt (264370 => 264371)
--- trunk/LayoutTests/webgl/2.0.0/conformance2/programs/gl-get-frag-data-location-expected.txt 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/programs/gl-get-frag-data-location-expected.txt 2020-07-14 19:59:01 UTC (rev 264371)
@@ -1,11 +1,5 @@
This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
Test: ../../resources/webgl_test_files/conformance2/programs/gl-get-frag-data-location.html
-[ 1: PASS ] WebGL context exists
-[ 2: PASS ] getError was expected value: NO_ERROR : No GL error from set up
-[ 3: FAIL ] Fail to query scalar output variable locations, expected: fragColor0->2, fragColor1->0, got: fragColor0->0, fragColor1->0
-[ 4: FAIL ] Fail to query scalar output variable locations, expected: fragColor->0, fragColor[0]->0, fragColor[1]->1, got: fragColor->0, fragColor[0]->0, fragColor[1]->0
-[ 5: PASS ] getError was expected value: NO_ERROR : No GL error from testing
-[ 6: PASS ] successfullyParsed is true
-[ FAIL ] 2 failures reported
+[ PASS ] All tests passed
Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt (264370 => 264371)
--- trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt 2020-07-14 19:59:01 UTC (rev 264371)
@@ -243,26 +243,26 @@
[ 239: PASS ] getError was expected value: NO_ERROR :
[ 240: PASS ] gl.getProgramParameter(uintProgram, gl.LINK_STATUS) is true
[ 241: PASS ] getError was expected value: NO_ERROR :
-[ 242: FAIL ] gl.getUniform(uintProgram, uvalLoc) should be 1 (of type number). Was null (of type object).
-[ 243: FAIL ] gl.getUniform(uintProgram, uval2Loc) should be 2,3. Was null.
-[ 244: FAIL ] gl.getUniform(uintProgram, uval3Loc) should be 4,5,6. Was null.
-[ 245: FAIL ] gl.getUniform(uintProgram, uval4Loc) should be 7,8,9,10. Was null.
-[ 246: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE :
+[ 242: PASS ] gl.getUniform(uintProgram, uvalLoc) is 1
+[ 243: PASS ] gl.getUniform(uintProgram, uval2Loc) is [2, 3]
+[ 244: PASS ] gl.getUniform(uintProgram, uval3Loc) is [4, 5, 6]
+[ 245: PASS ] gl.getUniform(uintProgram, uval4Loc) is [7, 8, 9, 10]
+[ 246: PASS ] getError was expected value: NO_ERROR :
[ 247: PASS ] getError was expected value: NO_ERROR :
[ 248: PASS ] gl.getProgramParameter(matForWebGL2Program, gl.LINK_STATUS) is true
[ 249: PASS ] getError was expected value: NO_ERROR :
-[ 250: FAIL ] gl.getUniform(matForWebGL2Program, mval2x3Loc) should be 1,2,3,4,5,6. Was null.
-[ 251: FAIL ] gl.getUniform(matForWebGL2Program, mval2x4Loc) should be 7,8,9,10,11,12,13,14. Was null.
-[ 252: FAIL ] gl.getUniform(matForWebGL2Program, mval3x2Loc) should be 15,16,17,18,19,20. Was null.
-[ 253: FAIL ] gl.getUniform(matForWebGL2Program, mval3x4Loc) should be 21,22,23,24,25,26,27,28,29,30,31,32. Was null.
-[ 254: FAIL ] gl.getUniform(matForWebGL2Program, mval4x2Loc) should be 33,34,35,36,37,38,39,40. Was null.
-[ 255: FAIL ] gl.getUniform(matForWebGL2Program, mval4x3Loc) should be 41,42,43,44,45,46,47,48,49,50,51,52. Was null.
-[ 256: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE :
+[ 250: PASS ] gl.getUniform(matForWebGL2Program, mval2x3Loc) is [1, 2, 3, 4, 5, 6]
+[ 251: PASS ] gl.getUniform(matForWebGL2Program, mval2x4Loc) is [7, 8, 9, 10, 11, 12, 13, 14]
+[ 252: PASS ] gl.getUniform(matForWebGL2Program, mval3x2Loc) is [15, 16, 17, 18, 19, 20]
+[ 253: PASS ] gl.getUniform(matForWebGL2Program, mval3x4Loc) is [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
+[ 254: PASS ] gl.getUniform(matForWebGL2Program, mval4x2Loc) is [33, 34, 35, 36, 37, 38, 39, 40]
+[ 255: PASS ] gl.getUniform(matForWebGL2Program, mval4x3Loc) is [41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52]
+[ 256: PASS ] getError was expected value: NO_ERROR :
[ 257: PASS ] gl.getProgramParameter(samplerForWebGL2Program, gl.LINK_STATUS) is true
[ 258: PASS ] getError was expected value: NO_ERROR :
-[ 259: FAIL ] gl.getUniform(samplerForWebGL2Program, s3DValLoc) should be 0 (of type number). Was null (of type object).
-[ 260: FAIL ] gl.getUniform(samplerForWebGL2Program, s2DArrayValLoc) should be 1 (of type number). Was null (of type object).
-[ 261: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE :
+[ 259: PASS ] gl.getUniform(samplerForWebGL2Program, s3DValLoc) is 0
+[ 260: PASS ] gl.getUniform(samplerForWebGL2Program, s2DArrayValLoc) is 1
+[ 261: PASS ] getError was expected value: NO_ERROR :
[ 262: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) is buffer
[ 263: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_ENABLED) is true
[ 264: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_SIZE) is 4
@@ -311,5 +311,5 @@
[ 307: PASS ] getSamplerParameter correctly handled invalid pname enums
[ 308: FAIL ] gl.getSyncParameter(sync, gl.OBJECT_TYPE) should be 37142. Threw exception TypeError: Argument 1 ('sync') to WebGL2RenderingContext.getSyncParameter must be an instance of WebGLSync
[ 309: FAIL ] successfullyParsed should be true (of type boolean). Was undefined (of type undefined).
-[ FAIL ] 54 failures reported
+[ FAIL ] 39 failures reported
Modified: trunk/Source/WebCore/ChangeLog (264370 => 264371)
--- trunk/Source/WebCore/ChangeLog 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/ChangeLog 2020-07-14 19:59:01 UTC (rev 264371)
@@ -1,3 +1,88 @@
+2020-07-14 James Darpinian <jdarpin...@chromium.org>
+
+ Implement uniform* and getUniform for WebGL 2 types
+ https://bugs.webkit.org/show_bug.cgi?id=214116
+
+ Reviewed by Dean Jackson.
+
+ Passes all relevant WebGL conformance tests.
+
+ * html/canvas/WebGL2RenderingContext.cpp:
+ (WebCore::WebGL2RenderingContext::getFragDataLocation):
+ (WebCore::WebGL2RenderingContext::uniform1ui):
+ (WebCore::WebGL2RenderingContext::uniform2ui):
+ (WebCore::WebGL2RenderingContext::uniform3ui):
+ (WebCore::WebGL2RenderingContext::uniform4ui):
+ (WebCore::WebGL2RenderingContext::uniform1uiv):
+ (WebCore::WebGL2RenderingContext::uniform2uiv):
+ (WebCore::WebGL2RenderingContext::uniform3uiv):
+ (WebCore::WebGL2RenderingContext::uniform4uiv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix2x3fv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix3x2fv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix2x4fv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix4x2fv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix3x4fv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix4x3fv):
+ (WebCore::WebGL2RenderingContext::uniform1fv):
+ (WebCore::WebGL2RenderingContext::uniform2fv):
+ (WebCore::WebGL2RenderingContext::uniform3fv):
+ (WebCore::WebGL2RenderingContext::uniform4fv):
+ (WebCore::WebGL2RenderingContext::uniform1iv):
+ (WebCore::WebGL2RenderingContext::uniform2iv):
+ (WebCore::WebGL2RenderingContext::uniform3iv):
+ (WebCore::WebGL2RenderingContext::uniform4iv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix2fv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix3fv):
+ (WebCore::WebGL2RenderingContext::uniformMatrix4fv):
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::getUniform):
+ (WebCore::WebGLRenderingContextBase::uniform1fv):
+ (WebCore::WebGLRenderingContextBase::uniform2fv):
+ (WebCore::WebGLRenderingContextBase::uniform3fv):
+ (WebCore::WebGLRenderingContextBase::uniform4fv):
+ (WebCore::WebGLRenderingContextBase::uniform1iv):
+ (WebCore::WebGLRenderingContextBase::uniform2iv):
+ (WebCore::WebGLRenderingContextBase::uniform3iv):
+ (WebCore::WebGLRenderingContextBase::uniform4iv):
+ (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
+ (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
+ (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
+ (WebCore::WebGLRenderingContextBase::validateUniformParameters):
+ (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
+ * html/canvas/WebGLRenderingContextBase.h:
+ * platform/graphics/GraphicsContextGL.h:
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ (WebCore::GraphicsContextGLOpenGL::getUniformuiv):
+ (WebCore::GraphicsContextGLOpenGL::getFragDataLocation):
+ (WebCore::GraphicsContextGLOpenGL::uniform1ui):
+ (WebCore::GraphicsContextGLOpenGL::uniform2ui):
+ (WebCore::GraphicsContextGLOpenGL::uniform3ui):
+ (WebCore::GraphicsContextGLOpenGL::uniform4ui):
+ (WebCore::GraphicsContextGLOpenGL::uniform1uiv):
+ (WebCore::GraphicsContextGLOpenGL::uniform2uiv):
+ (WebCore::GraphicsContextGLOpenGL::uniform3uiv):
+ (WebCore::GraphicsContextGLOpenGL::uniform4uiv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x3fv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x2fv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x4fv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x2fv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x4fv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x3fv):
+ (WebCore::GraphicsContextGLOpenGL::uniform1fv):
+ (WebCore::GraphicsContextGLOpenGL::uniform2fv):
+ (WebCore::GraphicsContextGLOpenGL::uniform3fv):
+ (WebCore::GraphicsContextGLOpenGL::uniform4fv):
+ (WebCore::GraphicsContextGLOpenGL::uniform1iv):
+ (WebCore::GraphicsContextGLOpenGL::uniform2iv):
+ (WebCore::GraphicsContextGLOpenGL::uniform3iv):
+ (WebCore::GraphicsContextGLOpenGL::uniform4iv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv):
+ (WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv):
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+ * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
+ (WebCore::GraphicsContextGLOpenGL::getUniformuiv):
+
2020-07-14 Per Arne Vollan <pvol...@apple.com>
[iOS] Avoid loading media libraries in Document::visibilityStateChanged() if not needed
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (264370 => 264371)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2020-07-14 19:59:01 UTC (rev 264371)
@@ -1271,80 +1271,109 @@
LOG(WebGL, "[[ NOT IMPLEMENTED ]] compressedTexSubImage3D(ArrayBufferView)");
}
-GCGLint WebGL2RenderingContext::getFragDataLocation(WebGLProgram&, const String&)
+GCGLint WebGL2RenderingContext::getFragDataLocation(WebGLProgram& program, const String& name)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] getFragDataLocation()");
- return 0;
+ if (isContextLostOrPending() || !validateWebGLObject("getFragDataLocation", &program))
+ return -1;
+ return m_context->getFragDataLocation(program.object(), name);
}
-void WebGL2RenderingContext::uniform1ui(WebGLUniformLocation*, GCGLuint)
+void WebGL2RenderingContext::uniform1ui(WebGLUniformLocation* location, GCGLuint v0)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1ui()");
+ if (isContextLostOrPending() || !validateUniformLocation("uniform1ui", location))
+ return;
+ m_context->uniform1ui(location->location(), v0);
}
-void WebGL2RenderingContext::uniform2ui(WebGLUniformLocation*, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniform2ui(WebGLUniformLocation* location, GCGLuint v0, GCGLuint v1)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2ui()");
+ if (isContextLostOrPending() || !validateUniformLocation("uniform2ui", location))
+ return;
+ m_context->uniform2ui(location->location(), v0, v1);
}
-void WebGL2RenderingContext::uniform3ui(WebGLUniformLocation*, GCGLuint, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniform3ui(WebGLUniformLocation* location, GCGLuint v0, GCGLuint v1, GCGLuint v2)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3ui()");
+ if (isContextLostOrPending() || !validateUniformLocation("uniform3ui", location))
+ return;
+ m_context->uniform3ui(location->location(), v0, v1, v2);
}
-void WebGL2RenderingContext::uniform4ui(WebGLUniformLocation*, GCGLuint, GCGLuint, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniform4ui(WebGLUniformLocation* location, GCGLuint v0, GCGLuint v1, GCGLuint v2, GCGLuint v3)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4ui()");
+ if (isContextLostOrPending() || !validateUniformLocation("uniform4ui", location))
+ return;
+ m_context->uniform4ui(location->location(), v0, v1, v2, v3);
}
-void WebGL2RenderingContext::uniform1uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniform1uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1uiv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform1uiv", location, value, 1, srcOffset, srcLength))
+ return;
+ m_context->uniform1uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset));
}
-void WebGL2RenderingContext::uniform2uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniform2uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2uiv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform2uiv", location, value, 2, srcOffset, srcLength))
+ return;
+ m_context->uniform2uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset) / 2);
}
-void WebGL2RenderingContext::uniform3uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniform3uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3uiv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform3uiv", location, value, 3, srcOffset, srcLength))
+ return;
+ m_context->uniform3uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset) / 3);
}
-void WebGL2RenderingContext::uniform4uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniform4uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4uiv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform4uiv", location, value, 4, srcOffset, srcLength))
+ return;
+ m_context->uniform4uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset) / 4);
}
-void WebGL2RenderingContext::uniformMatrix2x3fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniformMatrix2x3fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix2x3fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2x3fv", location, transpose, v, 6, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix2x3fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 6);
}
-void WebGL2RenderingContext::uniformMatrix3x2fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniformMatrix3x2fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix3x2fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3x2fv", location, transpose, v, 6, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix3x2fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 6);
}
-void WebGL2RenderingContext::uniformMatrix2x4fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniformMatrix2x4fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix2x4fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2x4fv", location, transpose, v, 8, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix2x4fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 8);
}
-void WebGL2RenderingContext::uniformMatrix4x2fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniformMatrix4x2fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix4x2fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4x2fv", location, transpose, v, 8, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix4x2fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 8);
}
-void WebGL2RenderingContext::uniformMatrix3x4fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniformMatrix3x4fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix3x4fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3x4fv", location, transpose, v, 12, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix3x4fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 12);
}
-void WebGL2RenderingContext::uniformMatrix4x3fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint)
+void WebGL2RenderingContext::uniformMatrix4x3fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength)
{
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix4x3fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4x3fv", location, transpose, v, 12, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix4x3fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 12);
}
void WebGL2RenderingContext::vertexAttribI4i(GCGLuint, GCGLint, GCGLint, GCGLint, GCGLint)
@@ -2981,115 +3010,79 @@
void WebGL2RenderingContext::uniform1fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1fv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, data, 1, srcOffset, srcLength))
+ return;
+ m_context->uniform1fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset));
}
void WebGL2RenderingContext::uniform2fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2fv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, data, 2, srcOffset, srcLength))
+ return;
+ m_context->uniform2fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 2);
}
void WebGL2RenderingContext::uniform3fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3fv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, data, 3, srcOffset, srcLength))
+ return;
+ m_context->uniform3fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 3);
}
void WebGL2RenderingContext::uniform4fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4fv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, data, 4, srcOffset, srcLength))
+ return;
+ m_context->uniform4fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 4);
}
void WebGL2RenderingContext::uniform1iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1iv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, data, 1, srcOffset, srcLength))
+ return;
+ m_context->uniform1iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset));
}
void WebGL2RenderingContext::uniform2iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2iv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, data, 2, srcOffset, srcLength))
+ return;
+ m_context->uniform2iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 2);
}
void WebGL2RenderingContext::uniform3iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3iv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, data, 3, srcOffset, srcLength))
+ return;
+ m_context->uniform3iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 3);
}
void WebGL2RenderingContext::uniform4iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4iv()");
+ if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, data, 4, srcOffset, srcLength))
+ return;
+ m_context->uniform4iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 4);
}
void WebGL2RenderingContext::uniformMatrix2fv(WebGLUniformLocation* location, GLboolean transpose, Float32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix2fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, data, 2*2, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix2fv(location->location(), transpose, data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / (2*2));
}
void WebGL2RenderingContext::uniformMatrix3fv(WebGLUniformLocation* location, GLboolean transpose, Float32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix3fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, data, 3*3, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix3fv(location->location(), transpose, data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / (3*3));
}
void WebGL2RenderingContext::uniformMatrix4fv(WebGLUniformLocation* location, GLboolean transpose, Float32List data, GLuint srcOffset, GLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
-
- LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix4fv()");
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, data, 4*4, srcOffset, srcLength))
+ return;
+ m_context->uniformMatrix4fv(location->location(), transpose, data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / (4*4));
}
void WebGL2RenderingContext::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLintptr offset)
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (264370 => 264371)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2020-07-14 19:59:01 UTC (rev 264371)
@@ -3405,9 +3405,73 @@
length = 1;
break;
default:
- // Can't handle this type
- synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getUniform", "unhandled type");
- return nullptr;
+ if (!isWebGL2()) {
+ // Can't handle this type.
+ synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getUniform", "unhandled type");
+ return nullptr;
+ }
+ switch (uniformLocation->type()) {
+ case GraphicsContextGL::UNSIGNED_INT:
+ baseType = GraphicsContextGL::UNSIGNED_INT;
+ length = 1;
+ break;
+ case GraphicsContextGL::UNSIGNED_INT_VEC2:
+ baseType = GraphicsContextGL::UNSIGNED_INT;
+ length = 2;
+ break;
+ case GraphicsContextGL::UNSIGNED_INT_VEC3:
+ baseType = GraphicsContextGL::UNSIGNED_INT;
+ length = 3;
+ break;
+ case GraphicsContextGL::UNSIGNED_INT_VEC4:
+ baseType = GraphicsContextGL::UNSIGNED_INT;
+ length = 4;
+ break;
+ case GraphicsContextGL::FLOAT_MAT2x3:
+ baseType = GraphicsContextGL::FLOAT;
+ length = 6;
+ break;
+ case GraphicsContextGL::FLOAT_MAT2x4:
+ baseType = GraphicsContextGL::FLOAT;
+ length = 8;
+ break;
+ case GraphicsContextGL::FLOAT_MAT3x2:
+ baseType = GraphicsContextGL::FLOAT;
+ length = 6;
+ break;
+ case GraphicsContextGL::FLOAT_MAT3x4:
+ baseType = GraphicsContextGL::FLOAT;
+ length = 12;
+ break;
+ case GraphicsContextGL::FLOAT_MAT4x2:
+ baseType = GraphicsContextGL::FLOAT;
+ length = 8;
+ break;
+ case GraphicsContextGL::FLOAT_MAT4x3:
+ baseType = GraphicsContextGL::FLOAT;
+ length = 12;
+ break;
+ case GraphicsContextGL::SAMPLER_3D:
+ case GraphicsContextGL::SAMPLER_2D_ARRAY:
+ case GraphicsContextGL::SAMPLER_2D_SHADOW:
+ case GraphicsContextGL::SAMPLER_CUBE_SHADOW:
+ case GraphicsContextGL::SAMPLER_2D_ARRAY_SHADOW:
+ case GraphicsContextGL::INT_SAMPLER_2D:
+ case GraphicsContextGL::INT_SAMPLER_CUBE:
+ case GraphicsContextGL::INT_SAMPLER_3D:
+ case GraphicsContextGL::INT_SAMPLER_2D_ARRAY:
+ case GraphicsContextGL::UNSIGNED_INT_SAMPLER_2D:
+ case GraphicsContextGL::UNSIGNED_INT_SAMPLER_CUBE:
+ case GraphicsContextGL::UNSIGNED_INT_SAMPLER_3D:
+ case GraphicsContextGL::UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ baseType = GraphicsContextGL::INT;
+ length = 1;
+ break;
+ default:
+ // Can't handle this type.
+ synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getUniform", "unhandled type");
+ return nullptr;
+ }
}
switch (baseType) {
case GraphicsContextGL::FLOAT: {
@@ -3430,6 +3494,13 @@
return value[0];
return Int32Array::tryCreate(value, length);
}
+ case GraphicsContextGL::UNSIGNED_INT: {
+ GCGLuint value[4] = {0};
+ m_context->getUniformuiv(objectOrZero(program), location, value);
+ if (length == 1)
+ return value[0];
+ return Uint32Array::tryCreate(value, length);
+ }
case GraphicsContextGL::BOOL: {
GCGLint value[4] = {0};
if (m_isRobustnessEXTSupported)
@@ -5505,68 +5576,54 @@
texParameter(target, pname, 0, param, false);
}
+bool WebGLRenderingContextBase::validateUniformLocation(const char* functionName, const WebGLUniformLocation* location)
+{
+ if (!location)
+ return false;
+ if (location->program() != m_currentProgram) {
+ synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "location not for current program");
+ return false;
+ }
+ return true;
+}
+
void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, GCGLfloat x)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform1f", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform1f", "location not for current program");
- return;
- }
-
m_context->uniform1f(location->location(), x);
}
void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, GCGLfloat x, GCGLfloat y)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform2f", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform2f", "location not for current program");
- return;
- }
-
m_context->uniform2f(location->location(), x, y);
}
void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, GCGLfloat x, GCGLfloat y, GCGLfloat z)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform3f", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform3f", "location not for current program");
- return;
- }
-
m_context->uniform3f(location->location(), x, y, z);
}
void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GCGLfloat x, GCGLfloat y, GCGLfloat z, GCGLfloat w)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform4f", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform4f", "location not for current program");
- return;
- }
-
m_context->uniform4f(location->location(), x, y, z, w);
}
void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GCGLint x)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform1i", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform1i", "location not for current program");
- return;
- }
-
if ((location->type() == GraphicsContextGL::SAMPLER_2D || location->type() == GraphicsContextGL::SAMPLER_CUBE) && x >= (int)m_textureUnits.size()) {
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "uniform1i", "invalid texture unit");
return;
@@ -5577,46 +5634,31 @@
void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, GCGLint x, GCGLint y)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform2i", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform2i", "location not for current program");
- return;
- }
-
m_context->uniform2i(location->location(), x, y);
}
void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, GCGLint x, GCGLint y, GCGLint z)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform3i", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform3i", "location not for current program");
- return;
- }
-
m_context->uniform3i(location->location(), x, y, z);
}
void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, GCGLint x, GCGLint y, GCGLint z, GCGLint w)
{
- if (isContextLostOrPending() || !location)
+ if (isContextLostOrPending() || !validateUniformLocation("uniform4i", location))
return;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform4i", "location not for current program");
- return;
- }
-
m_context->uniform4i(location->location(), x, y, z, w);
}
void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, Float32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, 1))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, 1, 0, v.length()))
return;
m_context->uniform1fv(location->location(), v.length(), v.data());
@@ -5624,7 +5666,7 @@
void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, Float32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, 2))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, 2, 0, v.length()))
return;
m_context->uniform2fv(location->location(), v.length() / 2, v.data());
@@ -5632,7 +5674,7 @@
void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, Float32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, 3))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, 3, 0, v.length()))
return;
m_context->uniform3fv(location->location(), v.length() / 3, v.data());
@@ -5640,7 +5682,7 @@
void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, Float32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, 4))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, 4, 0, v.length()))
return;
m_context->uniform4fv(location->location(), v.length() / 4, v.data());
@@ -5648,7 +5690,7 @@
void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, Int32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, 1))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, 1, 0, v.length()))
return;
auto data = ""
@@ -5669,7 +5711,7 @@
void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Int32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, 2))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, 2, 0, v.length()))
return;
m_context->uniform2iv(location->location(), v.length() / 2, v.data());
@@ -5677,7 +5719,7 @@
void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Int32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, 3))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, 3, 0, v.length()))
return;
m_context->uniform3iv(location->location(), v.length() / 3, v.data());
@@ -5685,7 +5727,7 @@
void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, Int32List&& v)
{
- if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, 4))
+ if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, 4, 0, v.length()))
return;
m_context->uniform4iv(location->location(), v.length() / 4, v.data());
@@ -5693,7 +5735,7 @@
void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v)
{
- if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4))
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4, 0, v.length()))
return;
m_context->uniformMatrix2fv(location->location(), v.length() / 4, transpose, v.data());
}
@@ -5700,7 +5742,7 @@
void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v)
{
- if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9))
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9, 0, v.length()))
return;
m_context->uniformMatrix3fv(location->location(), v.length() / 9, transpose, v.data());
}
@@ -5707,7 +5749,7 @@
void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v)
{
- if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16))
+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16, 0, v.length()))
return;
m_context->uniformMatrix4fv(location->location(), v.length() / 16, transpose, v.data());
}
@@ -6775,43 +6817,56 @@
return true;
}
-bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Float32List& v, GCGLsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Float32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength)
{
- return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize);
+ return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize, srcOffset, srcLength);
}
-bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Int32List& v, GCGLsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Int32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength)
{
- return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize);
+ return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize, srcOffset, srcLength);
}
-bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, void* v, GCGLsizei size, GCGLsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Uint32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength)
{
- return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize);
+ return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize, srcOffset, srcLength);
}
-bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const Float32List& v, GCGLsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, void* v, GCGLsizei size, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength)
{
- return validateUniformMatrixParameters(functionName, location, transpose, v.data(), v.length(), requiredMinSize);
+ return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize, srcOffset, srcLength);
}
-bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const void* v, GCGLsizei size, GCGLsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const Float32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength)
{
- if (!location)
+ return validateUniformMatrixParameters(functionName, location, transpose, v.data(), v.length(), requiredMinSize, srcOffset, srcLength);
+}
+
+bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const void* v, GCGLsizei size, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength)
+{
+ if (!validateUniformLocation(functionName, location))
return false;
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "location is not from current program");
- return false;
- }
if (!v) {
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "no array");
return false;
}
- if (transpose) {
+ if (transpose && !isWebGL2()) {
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "transpose not FALSE");
return false;
}
- if (size < requiredMinSize || (size % requiredMinSize)) {
+ if (srcOffset >= static_cast<GCGLuint>(size)) {
+ synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid srcOffset");
+ return false;
+ }
+ GCGLsizei actualSize = size - srcOffset;
+ if (srcLength > 0) {
+ if (srcLength > static_cast<GCGLuint>(actualSize)) {
+ synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid srcOffset + srcLength");
+ return false;
+ }
+ actualSize = srcLength;
+ }
+ if (actualSize < requiredMinSize || (actualSize % requiredMinSize)) {
synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid size");
return false;
}
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (264370 => 264371)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2020-07-14 19:59:01 UTC (rev 264371)
@@ -301,6 +301,7 @@
using Float32List = TypedList<Float32Array, float>;
using Int32List = TypedList<Int32Array, int>;
+ using Uint32List = TypedList<Uint32Array, uint32_t>;
void uniform1f(const WebGLUniformLocation*, GCGLfloat x);
void uniform2f(const WebGLUniformLocation*, GCGLfloat x, GCGLfloat y);
@@ -949,11 +950,13 @@
virtual bool validateCapability(const char* functionName, GCGLenum) = 0;
// Helper function to validate input parameters for uniform functions.
- bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Float32List&, GCGLsizei mod);
- bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Int32List&, GCGLsizei mod);
- bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, void*, GCGLsizei, GCGLsizei mod);
- bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const Float32List&, GCGLsizei mod);
- bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const void*, GCGLsizei, GCGLsizei mod);
+ bool validateUniformLocation(const char* functionName, const WebGLUniformLocation*);
+ bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Float32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength);
+ bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Int32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength);
+ bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Uint32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength);
+ bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, void*, GCGLsizei, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength);
+ bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const Float32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength);
+ bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const void*, GCGLsizei, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength);
// Helper function to validate parameters for bufferData.
// Return the current bound buffer to target, or 0 if parameters are invalid.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (264370 => 264371)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2020-07-14 19:59:01 UTC (rev 264371)
@@ -1023,6 +1023,7 @@
// getUniform
virtual void getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value) = 0;
virtual void getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value) = 0;
+ virtual void getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) = 0;
virtual GCGLint getUniformLocation(PlatformGLObject, const String& name) = 0;
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (264370 => 264371)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2020-07-14 19:59:01 UTC (rev 264371)
@@ -1709,6 +1709,12 @@
gl::GetUniformiv(program, location, value);
}
+void GraphicsContextGLOpenGL::getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value)
+{
+ makeContextCurrent();
+ gl::GetUniformuiv(program, location, value);
+}
+
GCGLint GraphicsContextGLOpenGL::getUniformLocation(PlatformGLObject program, const String& name)
{
ASSERT(program);
@@ -2286,126 +2292,92 @@
GCGLint GraphicsContextGLOpenGL::getFragDataLocation(PlatformGLObject program, const String& name)
{
- UNUSED_PARAM(program);
- UNUSED_PARAM(name);
-
- return 0;
+ makeContextCurrent();
+ return gl::GetFragDataLocation(program, name.utf8().data());
}
void GraphicsContextGLOpenGL::uniform1ui(GCGLint location, GCGLuint v0)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(v0);
+ makeContextCurrent();
+ gl::Uniform1ui(location, v0);
}
void GraphicsContextGLOpenGL::uniform2ui(GCGLint location, GCGLuint v0, GCGLuint v1)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(v0);
- UNUSED_PARAM(v1);
+ makeContextCurrent();
+ gl::Uniform2ui(location, v0, v1);
}
void GraphicsContextGLOpenGL::uniform3ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(v0);
- UNUSED_PARAM(v1);
- UNUSED_PARAM(v2);
+ makeContextCurrent();
+ gl::Uniform3ui(location, v0, v1, v2);
}
void GraphicsContextGLOpenGL::uniform4ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2, GCGLuint v3)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(v0);
- UNUSED_PARAM(v1);
- UNUSED_PARAM(v2);
- UNUSED_PARAM(v3);
+ makeContextCurrent();
+ gl::Uniform4ui(location, v0, v1, v2, v3);
}
void GraphicsContextGLOpenGL::uniform1uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform1uiv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform2uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform2uiv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform3uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform3uiv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform4uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform4uiv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix2x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix2x3fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix3x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix3x2fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix2x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix2x4fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix4x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix4x2fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix3x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix3x4fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix4x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix4x3fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::vertexAttribI4i(GCGLuint index, GCGLint x, GCGLint y, GCGLint z, GCGLint w)
@@ -2704,93 +2676,68 @@
void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform1fv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform2fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform2fv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform3fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform3fv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform4fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform4fv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform1iv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform2iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform2iv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform3iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform3iv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniform4iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::Uniform4iv(location, srcLength, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix2fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix3fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::uniformMatrix4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
{
- UNUSED_PARAM(location);
- UNUSED_PARAM(transpose);
- UNUSED_PARAM(data);
- UNUSED_PARAM(srcOffset);
- UNUSED_PARAM(srcLength);
+ makeContextCurrent();
+ gl::UniformMatrix4fv(location, srcLength, transpose, data + srcOffset);
}
void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLintptr offset)
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (264370 => 264371)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2020-07-14 19:59:01 UTC (rev 264371)
@@ -294,6 +294,7 @@
void getTexParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value) final;
void getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value) final;
void getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value) final;
+ void getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) final;
GCGLint getUniformLocation(PlatformGLObject, const String& name) final;
void getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLfloat* value) final;
void getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLint* value) final;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp (264370 => 264371)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp 2020-07-14 19:55:46 UTC (rev 264370)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp 2020-07-14 19:59:01 UTC (rev 264371)
@@ -1822,6 +1822,13 @@
::glGetUniformiv(program, location, value);
}
+void GraphicsContextGLOpenGL::getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value)
+{
+ UNUSED_PARAM(program);
+ UNUSED_PARAM(location);
+ UNUSED_PARAM(value);
+}
+
GCGLint GraphicsContextGLOpenGL::getUniformLocation(PlatformGLObject program, const String& name)
{
ASSERT(program);