Diff
Modified: trunk/LayoutTests/ChangeLog (221666 => 221667)
--- trunk/LayoutTests/ChangeLog 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/LayoutTests/ChangeLog 2017-09-06 08:17:59 UTC (rev 221667)
@@ -1,3 +1,22 @@
+2017-09-06 Zan Dobersek <zdober...@igalia.com>
+
+ [WebGL2] Implement getActiveUniforms()
+ https://bugs.webkit.org/show_bug.cgi?id=175203
+
+ Reviewed by Darin Adler.
+
+ Add a basic gl.getActiveUniforms() test that checks proper return values
+ for a mat4 uniform in the simple vertex shader that's used when creating
+ the 'standard' program through webgl-test.js utilities. The test remains
+ skipped on GTK+ and Windows (WebGL 2.0 disabled). Mac port skips it as
+ well since the shader can't be compiled properly. WPE and iOS run the
+ test and are passing it.
+
+ * fast/canvas/webgl/webgl2-getActiveUniforms-expected.txt: Added.
+ * fast/canvas/webgl/webgl2-getActiveUniforms.html: Added.
+ * platform/gtk/TestExpectations:
+ * platform/mac/TestExpectations:
+
2017-09-05 Chris Dumez <cdu...@apple.com>
Unreviewed, rebaseline test after r221639.
Added: trunk/LayoutTests/fast/canvas/webgl/webgl2-getActiveUniforms-expected.txt (0 => 221667)
--- trunk/LayoutTests/fast/canvas/webgl/webgl2-getActiveUniforms-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl2-getActiveUniforms-expected.txt 2017-09-06 08:17:59 UTC (rev 221667)
@@ -0,0 +1,21 @@
+CONSOLE MESSAGE: line 1: WebGL: INVALID_ENUM: getActiveUniforms: invalid parameter name
+Checks for proper getActiveUniforms() behavior on a simple WebGL 2 program.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS gl.getError() is gl.NO_ERROR
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_TYPE) is [gl.FLOAT_MAT4]
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_SIZE) is [1]
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_BLOCK_INDEX) is [-1]
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_OFFSET) is [-1]
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_ARRAY_STRIDE) is [-1]
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_MATRIX_STRIDE) is [-1]
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_IS_ROW_MAJOR) is [0]
+PASS gl.getError() is gl.NO_ERROR
+PASS gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_NAME_LENGTH) is null
+PASS gl.getError() is gl.INVALID_ENUM
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/webgl/webgl2-getActiveUniforms.html (0 => 221667)
--- trunk/LayoutTests/fast/canvas/webgl/webgl2-getActiveUniforms.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl2-getActiveUniforms.html 2017-09-06 08:17:59 UTC (rev 221667)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<canvas id="c" width="40" height="40"></canvas>
+<script>
+description("Checks for proper getActiveUniforms() behavior on a simple WebGL 2 program.");
+
+if (window.internals)
+ internals.settings.setWebGL2Enabled(true);
+
+var canvas = document.getElementById("c");
+var gl = canvas.getContext("webgl2");
+shouldBe("gl.getError()", "gl.NO_ERROR");
+
+var program = loadStandardProgram(gl);
+var mvpLocation = gl.getUniformLocation(program, "u_modelViewProjMatrix");
+
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_TYPE)", "[gl.FLOAT_MAT4]");
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_SIZE)", "[1]");
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_BLOCK_INDEX)", "[-1]");
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_OFFSET)", "[-1]");
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_ARRAY_STRIDE)", "[-1]");
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_MATRIX_STRIDE)", "[-1]");
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_IS_ROW_MAJOR)", "[0]");
+shouldBe("gl.getError()", "gl.NO_ERROR");
+
+// Invalid parameter for getActiveUniforms() in WebGL2.
+shouldBe("gl.getActiveUniforms(program, [mvpLocation], gl.UNIFORM_NAME_LENGTH)", "null");
+shouldBe("gl.getError()", "gl.INVALID_ENUM");
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (221666 => 221667)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2017-09-06 08:17:59 UTC (rev 221667)
@@ -584,6 +584,7 @@
webkit.org/b/166536 fast/canvas/webgl/webgl2-buffer-targets.html [ Skip ]
webkit.org/b/166536 fast/canvas/webgl/webgl2-buffers.html [ Skip ]
webkit.org/b/166536 fast/canvas/webgl/webgl2-context-creation.html [ Skip ]
+webkit.org/b/166536 fast/canvas/webgl/webgl2-getActiveUniforms.html [ Failure ]
webkit.org/b/166536 fast/canvas/webgl/webgl2-runtime-flag.html [ Skip ]
webkit.org/b/166536 fast/canvas/webgl/webgl2-texStorage.html [ Skip ]
webkit.org/b/166536 fast/canvas/webgl/webgl2-texture-upload-enums.html [ Skip ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (221666 => 221667)
--- trunk/LayoutTests/platform/mac/TestExpectations 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2017-09-06 08:17:59 UTC (rev 221667)
@@ -1630,3 +1630,5 @@
crypto/subtle/ecdsa-import-key-sign-p521.html
crypto/subtle/ecdsa-import-key-verify-p521.html
crypto/subtle/ecdsa-import-pkcs8-key-p521-validate-ecprivatekey-parameters-publickey.html
+
+webkit.org/b/176444 fast/canvas/webgl/webgl2-getActiveUniforms.html [ Failure ]
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (221666 => 221667)
--- trunk/Source/WebCore/ChangeLog 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/ChangeLog 2017-09-06 08:17:59 UTC (rev 221667)
@@ -1,3 +1,33 @@
+2017-09-06 Zan Dobersek <zdober...@igalia.com>
+
+ [WebGL2] Implement getActiveUniforms()
+ https://bugs.webkit.org/show_bug.cgi?id=175203
+
+ Reviewed by Darin Adler.
+
+ Align getActiveUniforms() WebIDL signature with the spec -- making it
+ return a WebGLAny object, making the program parameter non-nullable,
+ and making the uniformIndices parameter a sequence on GLuint values.
+
+ The getActiveUniforms() implementation in WebGL2RenderingContext
+ validates the passed-in program and parameter name and then calls the
+ GraphicsContext3D::getActiveUniforms() method, retrieving an array of
+ integers that represent values of the requested parameter name for
+ each uniform whose index was passed through uniformIndices.
+
+ Test: fast/canvas/webgl/webgl2-getActiveUniforms.html
+
+ * bindings/js/JSDOMConvertWebGL.cpp:
+ (WebCore::convertToJSValue):
+ * html/canvas/WebGL2RenderingContext.cpp:
+ (WebCore::WebGL2RenderingContext::getActiveUniforms):
+ * html/canvas/WebGL2RenderingContext.h:
+ * html/canvas/WebGL2RenderingContext.idl:
+ * html/canvas/WebGLAny.h:
+ * platform/graphics/GraphicsContext3D.h:
+ * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+ (WebCore::GraphicsContext3D::getActiveUniforms):
+
2017-09-05 Zan Dobersek <zdober...@igalia.com>
[WebCrypto] Downcast parameters and keys at the platform operation callsites
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (221666 => 221667)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp 2017-09-06 08:17:59 UTC (rev 221667)
@@ -93,6 +93,12 @@
list.append(jsBoolean(value));
return constructArray(&state, 0, &globalObject, list);
},
+ [&] (const Vector<int>& values) {
+ MarkedArgumentBuffer list;
+ for (auto& value : values)
+ list.append(jsNumber(value));
+ return constructArray(&state, 0, &globalObject, list);
+ },
[&] (const RefPtr<Float32Array>& array) {
return toJS(&state, &globalObject, array.get());
},
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (221666 => 221667)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2017-09-06 08:17:59 UTC (rev 221667)
@@ -920,9 +920,28 @@
return nullptr;
}
-Int32Array* WebGL2RenderingContext::getActiveUniforms(WebGLProgram*, RefPtr<Uint32Array>&&, GC3Denum)
+WebGLAny WebGL2RenderingContext::getActiveUniforms(WebGLProgram& program, const Vector<GC3Duint>& uniformIndices, GC3Denum pname)
{
- return nullptr;
+ if (isContextLostOrPending() || !validateWebGLObject("getActiveUniforms", &program))
+ return nullptr;
+
+ switch (pname) {
+ case GraphicsContext3D::UNIFORM_TYPE:
+ case GraphicsContext3D::UNIFORM_SIZE:
+ case GraphicsContext3D::UNIFORM_BLOCK_INDEX:
+ case GraphicsContext3D::UNIFORM_OFFSET:
+ case GraphicsContext3D::UNIFORM_ARRAY_STRIDE:
+ case GraphicsContext3D::UNIFORM_MATRIX_STRIDE:
+ case GraphicsContext3D::UNIFORM_IS_ROW_MAJOR:
+ {
+ Vector<GC3Dint> params(uniformIndices.size(), 0);
+ m_context->getActiveUniforms(program.object(), uniformIndices, pname, params);
+ return WTFMove(params);
+ }
+ default:
+ synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getActiveUniforms", "invalid parameter name");
+ return nullptr;
+ }
}
GC3Duint WebGL2RenderingContext::getUniformBlockIndex(WebGLProgram*, const String&)
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h (221666 => 221667)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h 2017-09-06 08:17:59 UTC (rev 221667)
@@ -156,7 +156,7 @@
void bindBufferRange(GC3Denum target, GC3Duint index, WebGLBuffer*, GC3Dint64 offset, GC3Dint64 size);
WebGLAny getIndexedParameter(GC3Denum target, GC3Duint index);
Uint32Array* getUniformIndices(WebGLProgram*, const Vector<String>& uniformNames);
- Int32Array* getActiveUniforms(WebGLProgram*, RefPtr<Uint32Array>&& uniformIndices, GC3Denum pname);
+ WebGLAny getActiveUniforms(WebGLProgram&, const Vector<GC3Duint>& uniformIndices, GC3Denum pname);
GC3Duint getUniformBlockIndex(WebGLProgram*, const String& uniformBlockName);
WebGLAny getActiveUniformBlockParameter(WebGLProgram*, GC3Duint uniformBlockIndex, GC3Denum pname);
WebGLAny getActiveUniformBlockName(WebGLProgram*, GC3Duint uniformBlockIndex);
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl (221666 => 221667)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl 2017-09-06 08:17:59 UTC (rev 221667)
@@ -449,7 +449,7 @@
void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size);
[OverrideIDLType=IDLWebGLAny] any getIndexedParameter(GLenum target, GLuint index);
Uint32Array getUniformIndices(WebGLProgram? program, sequence<DOMString> uniformNames);
- Int32Array getActiveUniforms(WebGLProgram? program, Uint32Array? uniformIndices, GLenum pname);
+ [OverrideIDLType=IDLWebGLAny] any getActiveUniforms(WebGLProgram program, sequence<GLuint> uniformIndices, GLenum pname);
GLuint getUniformBlockIndex(WebGLProgram? program, DOMString uniformBlockName);
[OverrideIDLType=IDLWebGLAny] any getActiveUniformBlockParameter(WebGLProgram? program, GLuint uniformBlockIndex, GLenum pname);
[OverrideIDLType=IDLWebGLAny] any getActiveUniformBlockName(WebGLProgram? program, GLuint uniformBlockIndex);
Modified: trunk/Source/WebCore/html/canvas/WebGLAny.h (221666 => 221667)
--- trunk/Source/WebCore/html/canvas/WebGLAny.h 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/html/canvas/WebGLAny.h 2017-09-06 08:17:59 UTC (rev 221667)
@@ -57,6 +57,7 @@
float,
String,
Vector<bool>,
+ Vector<int>,
RefPtr<Float32Array>,
RefPtr<Int32Array>,
RefPtr<Uint32Array>,
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (221666 => 221667)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2017-09-06 08:17:59 UTC (rev 221667)
@@ -972,6 +972,8 @@
void texStorage2D(GC3Denum target, GC3Dsizei levels, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height);
void texStorage3D(GC3Denum target, GC3Dsizei levels, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dsizei depth);
+ void getActiveUniforms(Platform3DObject program, const Vector<GC3Duint>& uniformIndices, GC3Denum pname, Vector<GC3Dint>& params);
+
GC3Denum checkFramebufferStatus(GC3Denum target);
void clear(GC3Dbitfield mask);
void clearColor(GC3Dclampf red, GC3Dclampf green, GC3Dclampf blue, GC3Dclampf alpha);
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (221666 => 221667)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2017-09-06 07:23:38 UTC (rev 221666)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2017-09-06 08:17:59 UTC (rev 221667)
@@ -589,6 +589,14 @@
makeContextCurrent();
::glTexStorage3D(target, levels, internalformat, width, height, depth);
}
+
+void GraphicsContext3D::getActiveUniforms(Platform3DObject program, const Vector<GC3Duint>& uniformIndices, GC3Denum pname, Vector<GC3Dint>& params)
+{
+ ASSERT(program);
+ makeContextCurrent();
+
+ ::glGetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data());
+}
#endif
GC3Denum GraphicsContext3D::checkFramebufferStatus(GC3Denum target)