OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 <!DOCTYPE html> |
| 7 <html> |
| 8 <head> |
| 9 <meta charset="utf-8"> |
| 10 <title>WebGL GLES2 difference test.</title> |
| 11 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 12 <script src="../../resources/js-test-pre.js"></script> |
| 13 <script src="../resources/webgl-test.js"></script> |
| 14 <script src="../resources/webgl-test-utils.js"></script> |
| 15 </head> |
| 16 <body> |
| 17 <div id="description"></div> |
| 18 <div id="console"></div> |
| 19 |
| 20 <script> |
| 21 var wtu = WebGLTestUtils; |
| 22 description("Tests the a few differences between WebGL and GLES2"); |
| 23 |
| 24 var gl = wtu.create3DContext(); |
| 25 var program = wtu.loadStandardProgram(gl); |
| 26 gl.useProgram(program); |
| 27 var vertexObject = gl.createBuffer(); |
| 28 gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); |
| 29 gl.enableVertexAttribArray(0); |
| 30 glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed"); |
| 31 |
| 32 debug(""); |
| 33 debug("Verify that constant color and constant alpha cannot be used together as
source and destination factors in the blend function"); |
| 34 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_COLOR,
gl.CONSTANT_ALPHA)"); |
| 35 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONST
ANT_COLOR, gl.CONSTANT_ALPHA)"); |
| 36 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_COLOR,
gl.ONE_MINUS_CONSTANT_ALPHA)"); |
| 37 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONST
ANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA)"); |
| 38 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_ALPHA,
gl.CONSTANT_COLOR)"); |
| 39 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_ALPHA,
gl.ONE_MINUS_CONSTANT_COLOR)"); |
| 40 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONST
ANT_ALPHA, gl.CONSTANT_COLOR)"); |
| 41 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONST
ANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR)"); |
| 42 |
| 43 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTAN
T_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); |
| 44 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MIN
US_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); |
| 45 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTAN
T_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); |
| 46 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MIN
US_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); |
| 47 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTAN
T_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO)"); |
| 48 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTAN
T_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO)"); |
| 49 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MIN
US_CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO)"); |
| 50 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MIN
US_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO)"); |
| 51 |
| 52 debug(""); |
| 53 debug("Verify that in depthRange zNear <= zFar"); |
| 54 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.depthRange(20, 10)"); |
| 55 |
| 56 debug(""); |
| 57 debug("Verify that front/back settings should be the same for stenclMask and ste
ncilFunc"); |
| 58 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMask(255)"); |
| 59 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); |
| 60 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMaskSeparate(gl.FRONT, 1)"); |
| 61 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0,
0)"); |
| 62 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMaskSeparate(gl.BACK, 1)"); |
| 63 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); |
| 64 |
| 65 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFunc(gl.ALWAYS, 0, 255)"); |
| 66 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); |
| 67 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.BACK, gl.ALWAY
S, 1, 255)"); |
| 68 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0,
0)"); |
| 69 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.FRONT, gl.ALWA
YS, 1, 255)"); |
| 70 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); |
| 71 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.BACK, gl.ALWAY
S, 1, 1)"); |
| 72 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0,
0)"); |
| 73 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.FRONT, gl.ALWA
YS, 1, 1)"); |
| 74 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); |
| 75 |
| 76 debug(""); |
| 77 debug("Verify that IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_REA
D_TYPE are undefined"); |
| 78 shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_FORMAT); |
| 79 shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_TYPE); |
| 80 |
| 81 debug(""); |
| 82 debug("Verify that *LENGTH are undefined"); |
| 83 shouldBeUndefined(gl.INFO_LOG_LENGTH); |
| 84 shouldBeUndefined(gl.SHADER_SOURCE_LENGTH); |
| 85 shouldBeUndefined(gl.ACTIVE_UNIFORM_MAX_LENGTH); |
| 86 shouldBeUndefined(gl.ACTIVE_ATTRIB_MAX_LENGTH); |
| 87 |
| 88 debug(""); |
| 89 debug("Verify that UNPACK_COLORSPACE_CONVERSION_WEBGL is supported"); |
| 90 shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.BROWSER_D
EFAULT_WEBGL"); |
| 91 gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE); |
| 92 shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.NONE"); |
| 93 glErrorShouldBe(gl, gl.NO_ERROR, "set/get UNPACK_COLORSPACE_CONVERSION_WEBGL sho
uld generate no error"); |
| 94 |
| 95 debug(""); |
| 96 debug("Verify that drawingBufferWidth and drawingBufferHeights are implemented")
; |
| 97 shouldBeTrue("gl.drawingBufferWidth >= 0 && gl.drawingBufferHeight >= 0"); |
| 98 |
| 99 successfullyParsed = true; |
| 100 </script> |
| 101 |
| 102 <script src="../../resources/js-test-post.js"></script> |
| 103 </body> |
| 104 </html> |
OLD | NEW |