Testing/Conformance: Difference between revisions

From WebGL Public Wiki
Jump to navigation Jump to search
m Fixing stale link.
 
(17 intermediate revisions by 3 users not shown)
Line 5: Line 5:
The biggest issue is that WebGL is based on OpenGL ES 2.0 which has significant differences from desktop OpenGL. Those differences need to be tested against.
The biggest issue is that WebGL is based on OpenGL ES 2.0 which has significant differences from desktop OpenGL. Those differences need to be tested against.


Note: As for this writing the test have not been implemented. If you are interested in implementing them please speak up.
== WebGL Conformance Test Suite ==


== Tests ==
The latest version of the conformance suite can be run by visiting


Below is a non-exhaustive list of tests an implementation must pass.
https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html


* Test that glDrawElements fails if an index is out of range for the currently bound buffers.
Various options may be passed in via the URL. See the [https://www.khronos.org/registry/webgl/sdk/tests/README.md README.md] for details.


* Test that glDrawElements succeeds if asked to draw a subset of some buffer that is in range for the subset of indices but would be out of range if the entire index buffer is used. 
Previous versions can be found at


Example: An index buffer has the following indices [20, 30, 0, 1, 2, 3, 40, 50]. The bound buffers only have 4 vertices. If glDrawElements is called with count = 8, offset = 0 it should fail. If called with count = 4, offset = 2 it should succeed.
https://www.khronos.org/registry/webgl/conformance-suites/


* Test that glDrawElements and glDrawArrays fails if any vertex attributes needed by the current program are enabled but not supplied.
== Source code ==


* Test that glUniformMatrixfv fails if the transpose parameter is not GL_FALSE.
The currently available tests are hosted at


* Test that glTexImage2D fails if any Desktop GL enums are passed in, especially desktop only texture formats and source format enums
    https://www.khronos.org/registry/webgl/sdk/tests/


* Test that trying to set LEVEL > 0 on NPOT textures fails. GLES2 only supports NPOT textures with no mips.
Their source code can be checked out with


* Test that drawing an NPOT with incorrect parameters sends 0,0,0,1 to the fragment shader. GLES2
    git clone https://github.com/KhronosGroup/WebGL.git


* Test that glDrawElements fails with GL_INT
== Submitting new tests ==


* Test that in general, any GLenum that is allowed on Deskop GL but not in GLES2 fails. There are lots of these.  
New submissions to the conformance test suite are welcome. Please see [[Using_Github_To_Contribute|Using Github to Contribute]] for information on adding tests and submitting a pull request on Github.


* Test that calling glVertexAttribPointer when glBindBuffer's bound array buffer is 0 fails.
== Filing bugs ==


* Test that changing the size of the canvas does not change the size of the viewport.
Please file bugs against the conformance suite using [http://www.khronos.org/bugzilla/ Khronos' Bugzilla] against product WebGL, component Conformance Tests.


* Test that shaders that use identifiers allowed in Desktop GL but not in GLES2 fail to compile.
== For Implementers of the WebGL API ==


* Test that in general, any thing allowed in GLSL on Desktop GL but not in GLES2 fails to compile.
If you or your company is implementing the WebGL API in a web browser and you desire to have your implementation certified as compliant, please visit the [http://www.khronos.org/implementers/webgl/ WebGL Implementers' Resources] for information on producing a submission of the conformance suite.
 
* Test that shaders that use the "precision" keyword compile. (That keyword is not supported by desktop GL which means WebGL implementations will have to parse it out)
 
* Test that calling TexImage2D with border != 0 generates INVALID_VALUE
 
* Test that calling TexImage2D with no WebGLArray succeeds
 
* Test that calling TexImage2D with no WebGLArray that created texture's content is is 0,0,0,0. GL does not do this so WebGL implementations will need to otherwise it will be possible for WebGL to get the contents of vram from previously run apps.
 
* Test that shaders with other than "#version 100" fail.
 
* Test that shaders with "#ifdef GL_ES" compile as though GL_ES is true. DesktopGL will not do this meaning conforming WebGL implementation will need to do their own preprocessing.
 
* Test that shaders with "#extension" fail.

Latest revision as of 14:04, 2 August 2013

Conformance tests

In order for an implementation to claim it supports WebGL it must pass a set of conformance tests. Many of the tests are there to hopefully find incompatibilites between implementations. This is to promote the goal that a WebGL program created in a particular browser on a particular OS will run on any browser and any OS without modification.

The biggest issue is that WebGL is based on OpenGL ES 2.0 which has significant differences from desktop OpenGL. Those differences need to be tested against.

WebGL Conformance Test Suite

The latest version of the conformance suite can be run by visiting

https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html

Various options may be passed in via the URL. See the README.md for details.

Previous versions can be found at

https://www.khronos.org/registry/webgl/conformance-suites/

Source code

The currently available tests are hosted at

   https://www.khronos.org/registry/webgl/sdk/tests/

Their source code can be checked out with

   git clone https://github.com/KhronosGroup/WebGL.git

Submitting new tests

New submissions to the conformance test suite are welcome. Please see Using Github to Contribute for information on adding tests and submitting a pull request on Github.

Filing bugs

Please file bugs against the conformance suite using Khronos' Bugzilla against product WebGL, component Conformance Tests.

For Implementers of the WebGL API

If you or your company is implementing the WebGL API in a web browser and you desire to have your implementation certified as compliant, please visit the WebGL Implementers' Resources for information on producing a submission of the conformance suite.