Bug 1621523 - Revendor WebGL CTS with new test.

Also remark failures.

Differential Revision: https://phabricator.services.mozilla.com/D66828

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Gilbert 2020-03-14 08:11:52 +00:00
Родитель f612c0ba89
Коммит a6207b9e02
15 изменённых файлов: 997 добавлений и 139 удалений

Просмотреть файл

@ -1,5 +1,5 @@
<!-- <!--
Copyright (c) 2019 The Khronos Group Inc. Copyright (c) 2020 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file. found in the LICENSE.txt file.
--> -->
@ -14,58 +14,116 @@ found in the LICENSE.txt file.
</head> </head>
<body> <body>
<div id="description"></div> <div id="description"></div>
<canvas style="width: 100px, height: 100px; border: 1px solid blue;" id="c"></canvas> <canvas style="width: 100px; height: 100px; border: 1px solid black;" id="c"></canvas>
<div id="console"></div> <div id="console"></div>
<script> <script>
description("This test ensures WebGL implementations can render correctly after resizing the canvas."); description("This test ensures WebGL implementations can render correctly after resizing the canvas.");
debug(""); debug("");
var wtu = WebGLTestUtils; const wtu = WebGLTestUtils;
var gl = wtu.create3DContext("c"); const gl = wtu.create3DContext("c", {depth: true, stencil: true});
shouldBeTrue("gl != null"); shouldBeTrue("gl != null");
var positionLocation = 0; gl.clearColor(1,0,0,1);
var texcoordLocation = 1;
var program = wtu.setupColorQuad(gl, positionLocation);
var colorLocation = gl.getUniformLocation(program, 'u_color');
gl.uniform4fv(colorLocation, [0.0, 1.0, 0.0, 1.0]);
const smallWidth = 300; const positionLocation = 0;
const smallHeight = 150; const program = wtu.setupColorQuad(gl, positionLocation);
const colorLocation = gl.getUniformLocation(program, 'u_color');
gl.useProgram(program);
const SMALL = 2;
// Changing this size to something smaller produces // Changing this size to something smaller produces
// different results. Sometimes wrong, sometimes correct. // different results. Sometimes wrong, sometimes correct.
const largeWidth = 1200; const LARGE = 1200;
const largeHeight = 672;
function render() { function render() {
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
gl.enable(gl.DEPTH_TEST);
gl.clearColor(1,0,0,1);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.useProgram(program);
wtu.drawUnitQuad(gl);
} }
function checkForQuad(ctx) { gl.uniform4fv(colorLocation, [0.0, 1.0, 0.0, 1.0]);
let w = ctx.drawingBufferWidth;
let h = ctx.drawingBufferHeight;
wtu.checkCanvasRect(gl, 0, 0, w, h, [ 0, 255, 0, 255 ]); // -
}
gl.canvas.width = smallWidth; debug('\nResize then render.');
gl.canvas.height = smallHeight; gl.canvas.width = gl.canvas.height = SMALL;
render(); gl.viewport(0, 0, SMALL, SMALL);
checkForQuad(gl); // passes
gl.canvas.width = largeWidth; gl.clear(gl.COLOR_BUFFER_BIT);
gl.canvas.height = largeHeight; wtu.drawUnitQuad(gl);
gl.canvas.width = smallWidth;
gl.canvas.height = smallHeight; wtu.checkCanvasRect(gl, 0, 0, 1, 1, [ 0, 255, 0, 255 ]);
render();
checkForQuad(gl); // fails (almost all the time) // -
debug('\nResize twice then render.');
gl.canvas.width = gl.canvas.height = LARGE;
gl.canvas.width = gl.canvas.height = SMALL;
gl.clear(gl.COLOR_BUFFER_BIT);
wtu.drawUnitQuad(gl);
wtu.checkCanvasRect(gl, 0, 0, 1, 1, [ 0, 255, 0, 255 ]);
// -
debug('\nRender, no-op resize, then depth-fail render.');
gl.enable(gl.DEPTH_TEST);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
gl.uniform4fv(colorLocation, [0.0, 1.0, 0.0, 1.0]);
wtu.drawUnitQuad(gl);
gl.canvas.width = gl.canvas.width;
gl.uniform4fv(colorLocation, [0.0, 0.0, 1.0, 1.0]);
wtu.drawUnitQuad(gl);
wtu.checkCanvasRect(gl, 0, 0, 1, 1, [ 0, 255, 0, 255 ]);
// Reset
gl.disable(gl.DEPTH_TEST);
// -
debug('\nRender, no-op resize, then stencil-fail render.');
gl.enable(gl.STENCIL_TEST);
gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);
gl.stencilFunc(gl.EQUAL, 0, 0xff);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
gl.uniform4fv(colorLocation, [0.0, 1.0, 0.0, 1.0]);
wtu.drawUnitQuad(gl);
gl.canvas.width = gl.canvas.width;
gl.uniform4fv(colorLocation, [0.0, 0.0, 1.0, 1.0]);
wtu.drawUnitQuad(gl);
wtu.checkCanvasRect(gl, 0, 0, 1, 1, [ 0, 255, 0, 255 ]);
// Reset
gl.disable(gl.STENCIL_TEST);
gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
gl.stencilFunc(gl.ALWAYS, 0, 0xff);
// -
debug('\nRender, no-op resize, then scissor render.');
gl.enable(gl.SCISSOR_TEST);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.uniform4fv(colorLocation, [0.0, 1.0, 0.0, 1.0]);
wtu.drawUnitQuad(gl);
gl.canvas.width = gl.canvas.width;
gl.enable(gl.SCISSOR_TEST);
gl.scissor(0, 0, 1, 1);
gl.uniform4fv(colorLocation, [0.0, 0.0, 1.0, 1.0]);
wtu.drawUnitQuad(gl);
gl.disable(gl.SCISSOR_TEST);
wtu.checkCanvasRect(gl, 1, 0, 1, 1, [ 0, 255, 0, 255 ]);
wtu.checkCanvasRect(gl, 0, 0, 1, 1, [ 0, 0, 255, 255 ]);
// -
finishTest(); finishTest();

Просмотреть файл

@ -22,6 +22,35 @@ found in the LICENSE.txt file.
description(); description();
// Your syntax highlighter may hate this file. // Your syntax highlighter may hate this file.
// Because this stuff is tricky, we collect all tests here, including duplicating from other tests.
// That way, this test file is a one-stop-shop for validation testing.
const nonAscii = [
65533,
65533,
65533,
65533,
834,
96,
65533,
114,
65533,
98,
65533,
104,
65533,
104,
65533,
322,
834,
514,
65533,
65533,
322,
65533,
65533,
66,
].map(x => String.fromCodePoint(x)).join('');
GLSLConformanceTester.runTests([{ GLSLConformanceTester.runTests([{
vShaderSource: `void main() {}`, vShaderSource: `void main() {}`,
@ -43,6 +72,11 @@ GLSLConformanceTester.runTests([{
vShaderSuccess: true, vShaderSuccess: true,
linkSuccess: true, linkSuccess: true,
passMsg: 'Complete block-comment-end' passMsg: 'Complete block-comment-end'
}, {
vShaderSource: `void main() {}/* **/`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: 'Complete block-comment-end with **/'
}, { }, {
vShaderSource: `void main() {}/`, vShaderSource: `void main() {}/`,
vShaderSuccess: false, vShaderSuccess: false,
@ -53,6 +87,26 @@ GLSLConformanceTester.runTests([{
vShaderSuccess: true, vShaderSuccess: true,
linkSuccess: true, linkSuccess: true,
passMsg: 'Complete line-comment-begin at EOF' passMsg: 'Complete line-comment-begin at EOF'
}, {
vShaderSource: `//
void main() {}`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: `Minimal line comment: "//,\\n"`
}, {
vShaderSource: `//\
void main() {}`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: `Minimal continued line comment: "//,\\,\\n,\\n"`
}, {
vShaderSource: `//\
a
void main() {}`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: `Line-comment continuation with content that must be skipped: "//,\\,\\n,a,\\n"`
}, { }, {
vShaderSource: `void main() {} // The quick brown fox jumped\\over the lazy dog`, vShaderSource: `void main() {} // The quick brown fox jumped\\over the lazy dog`,
vShaderSuccess: true, vShaderSuccess: true,
@ -77,8 +131,73 @@ over the lazy dog
vShaderSuccess: true, vShaderSuccess: true,
linkSuccess: true, linkSuccess: true,
passMsg: 'Line-comment with backslash-line-continuation with newline before EOF' passMsg: 'Line-comment with backslash-line-continuation with newline before EOF'
}, }, {
]); vShaderSource: `void main() {}//${String.fromCodePoint(0x8f)}`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: 'upper-ascii in line-comment'
}, {
vShaderSource: `void main() {}/*${String.fromCodePoint(0x8f)}*/`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: 'upper-ascii in block-comment'
// -
// Like comment_frag.frag from conformance/ogles/GL/build/build_049_to_056.html
}, {
vShaderSource: `
void main()
{
/****** // comment not closed
}`,
vShaderSuccess: false,
linkSuccess: false,
passMsg: 'Unclosed block-comment containing line-comment'
// -
// Like conformance/glsl/misc/non-ascii-comments.vert.html
}, {
vShaderSource: `void main() {}/*${String.fromCodePoint(0x8f)}`,
vShaderSuccess: false,
linkSuccess: false,
passMsg: 'upper-ascii in unterminated block-comment'
}, {
vShaderSource: `void main() {}// ${nonAscii}`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: 'More non-ascii in line-comment'
}, {
vShaderSource: `void main() {}/*
* ${nonAscii}
*/`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: 'More non-ascii in block-comment'
}, {
vShaderSource: `void main() {}/*
* ${nonAscii}
*`,
vShaderSuccess: false,
linkSuccess: false,
passMsg: 'More non-ascii in unterminated block-comment'
// -
// Like deqp/data/gles2/shaders/preprocessor.html | preprocessor.comments.comment_trick_2_*
}, {
vShaderSource: `void main() {
float out0;
/**/
out0 = 1.0;
/*/
out0 = 0.0;
/**/
}`,
vShaderSuccess: true,
linkSuccess: true,
passMsg: '/**/ /*/ /**/'
}]);
</script> </script>
</body> </body>
</html> </html>

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -29,6 +29,19 @@ if (!gl) {
// Set the clear color to green. It should never show up. // Set the clear color to green. It should never show up.
gl.clearColor(0, 1, 0, 1); gl.clearColor(0, 1, 0, 1);
debug("Test renderbufferStorageMultisample with webgl1's DEPTH_STENCIL.");
{
const rb = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
wtu.shouldGenerateGLError(gl, 0,
"gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 0, gl.DEPTH_STENCIL, 1, 1)");
wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION,
"gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 1, gl.DEPTH_STENCIL, 1, 1)");
wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION,
"gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 2, gl.DEPTH_STENCIL, 1, 1)");
gl.deleteRenderbuffer(rb);
}
let c = gl.canvas; let c = gl.canvas;
var maxSamples = gl.getInternalformatParameter( var maxSamples = gl.getInternalformatParameter(
gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES)[0]; gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES)[0];
@ -52,6 +65,7 @@ if (!gl) {
} }
function runTest(gl, params) { function runTest(gl, params) {
debug("");
debug("Test for depth buffer: " + JSON.stringify(params)); debug("Test for depth buffer: " + JSON.stringify(params));
let resolve = params.alloc2 ? params.alloc2 : params.alloc1; let resolve = params.alloc2 ? params.alloc2 : params.alloc1;
gl.viewport(0, 0, resolve.w, resolve.h); gl.viewport(0, 0, resolve.w, resolve.h);

Просмотреть файл

@ -24,6 +24,8 @@ draw-buffers.html
element-index-uint.html element-index-uint.html
--min-version 2.0.1 framebuffer-completeness-draw-framebuffer.html --min-version 2.0.1 framebuffer-completeness-draw-framebuffer.html
framebuffer-completeness-unaffected.html framebuffer-completeness-unaffected.html
--min-version 2.0.1 framebuffer-render-to-layer.html
--min-version 2.0.1 framebuffer-render-to-layer-angle-issue.html
--min-version 2.0.1 framebuffer-texture-changing-base-level.html --min-version 2.0.1 framebuffer-texture-changing-base-level.html
--min-version 2.0.1 framebuffer-texture-level1.html --min-version 2.0.1 framebuffer-texture-level1.html
framebuffer-unsupported.html framebuffer-unsupported.html

Просмотреть файл

@ -0,0 +1,90 @@
<!--
Copyright (c) 2020 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL2 can render to layers in 3D texture angle issue check</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
<script id="vshader" type="x-shader/x-vertex">#version 300 es
void main(void) {
gl_Position = vec4(0, 0, 0, 1);
gl_PointSize = 1.0;
}
</script>
<script id="fshader" type="x-shader/x-fragment">#version 300 es
precision mediump float;
out vec4 outColor;
void main() {
outColor = vec4(0, 1, 0, 1);
}
</script>
</head>
<body>
<canvas id="example" width="1", height="1"></canvas>
<div id="description"></div>
<a href='https://bugs.chromium.org/p/angleproject/issues/detail?id=4417'>ANGLE issue #4417</a>
<div id="console"></div>
<script>
"use strict";
debug("");
description("Test that WebGL2 can render to layers in 3D textures");
var wtu = WebGLTestUtils;
var gl = wtu.create3DContext("example", undefined, 2);
if (!gl) {
testFailed("WebGL context creation failed");
} else {
testPassed("WebGL context creation succeeded");
runTest();
}
function runTest() {
const fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
const tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_3D, tex);
gl.texParameteri(gl.TEXTURE_3D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
gl.texParameteri(gl.TEXTURE_3D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA8, gl.canvas.width, gl.canvas.height, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
for (let i = 0; i < 2; i++) {
gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, tex, 0, i);
const rb = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, gl.canvas.width, gl.canvas.height);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, rb);
wtu.framebufferStatusShouldBe(gl, gl.FRAMEBUFFER, gl.FRAMEBUFFER_COMPLETE);
const program = wtu.setupProgram(gl, ['vshader','fshader'], [], console.log.bind(console));
gl.useProgram(program);
gl.drawArrays(gl.POINTS, 0, 1);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors`);
wtu.checkCanvas(gl, [0, 255, 0, 255], `framebuffer layer ${i} should be green`);
}
// make sure we were not rendering to the canvas.
gl.bindFramebuffer(gl.FRAMEBUFFER, null)
wtu.checkCanvas(gl, [0, 0, 0, 0], "canvas should be zero");
}
debug("");
var successfullyParsed = true;
</script>
<script src="../../js/js-test-post.js"></script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,440 @@
<!--
Copyright (c) 2020 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL2 can render to layers in 3D and 2D_ARRAY textures</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
<script id="vshader" type="x-shader/x-vertex">#version 300 es
void main(void) {
gl_Position = vec4(0, 0, 0, 1);
gl_PointSize = 1.0;
}
</script>
</head>
<body>
<canvas id="example" width="100", height="100"></canvas>
<div id="description"></div>
<div id="console"></div>
<script>
"use strict";
debug("");
description("Test that WebGL2 can render to layers in 3D and 2D_ARRAY textures");
var wtu = WebGLTestUtils;
var gl = wtu.create3DContext("example", undefined, 2);
if (!gl) {
testFailed("WebGL context creation failed");
} else {
testPassed("WebGL context creation succeeded");
runTest();
}
function runTest() {
const texWidth = 1;
const texHeight = 1;
const texDepth = 2;
function makeFragmentShader(typeInfo) {
const src = `#version 300 es
precision mediump float;
out ${typeInfo.outType} color;
void main() {
color = ${typeInfo.outValue};
}
`;
return src;
}
const textureInternalFormatInfo = {};
{
const t = textureInternalFormatInfo;
// unsized formats
// If understand correctly these 3 unsized formats are not required to be color renderable
t[gl.ALPHA] = { textureFormat: gl.ALPHA, colorRenderable: false, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [gl.UNSIGNED_BYTE, gl.HALF_FLOAT, gl.HALF_FLOAT_OES, gl.FLOAT], };
t[gl.LUMINANCE] = { textureFormat: gl.LUMINANCE, colorRenderable: false, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [gl.UNSIGNED_BYTE, gl.HALF_FLOAT, gl.HALF_FLOAT_OES, gl.FLOAT], };
t[gl.LUMINANCE_ALPHA] = { textureFormat: gl.LUMINANCE_ALPHA, colorRenderable: false, textureFilterable: true, bytesPerElement: [2, 4, 4, 8], type: [gl.UNSIGNED_BYTE, gl.HALF_FLOAT, gl.HALF_FLOAT_OES, gl.FLOAT], };
t[gl.RGB] = { textureFormat: gl.RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 6, 6, 12, 2], type: [gl.UNSIGNED_BYTE, gl.HALF_FLOAT, gl.HALF_FLOAT_OES, gl.FLOAT, gl.UNSIGNED_SHORT_5_6_5], };
t[gl.RGBA] = { textureFormat: gl.RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 8, 8, 16, 2, 2], type: [gl.UNSIGNED_BYTE, gl.HALF_FLOAT, gl.HALF_FLOAT_OES, gl.FLOAT, gl.UNSIGNED_SHORT_4_4_4_4, gl.UNSIGNED_SHORT_5_5_5_1], };
// sized formats
t[gl.R8] = { textureFormat: gl.RED, colorRenderable: true, textureFilterable: true, bytesPerElement: [1], type: [gl.UNSIGNED_BYTE], };
t[gl.R8_SNORM] = { textureFormat: gl.RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [1], type: [gl.BYTE], };
t[gl.R16F] = { textureFormat: gl.RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [4, 2], type: [gl.FLOAT, gl.HALF_FLOAT], };
t[gl.R32F] = { textureFormat: gl.RED, colorRenderable: false, textureFilterable: false, bytesPerElement: [4], type: [gl.FLOAT], };
t[gl.R8UI] = { textureFormat: gl.RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [gl.UNSIGNED_BYTE], };
t[gl.R8I] = { textureFormat: gl.RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [gl.BYTE], };
t[gl.R16UI] = { textureFormat: gl.RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [gl.UNSIGNED_SHORT], };
t[gl.R16I] = { textureFormat: gl.RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [gl.SHORT], };
t[gl.R32UI] = { textureFormat: gl.RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.UNSIGNED_INT], };
t[gl.R32I] = { textureFormat: gl.RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.INT], };
t[gl.RG8] = { textureFormat: gl.RG, colorRenderable: true, textureFilterable: true, bytesPerElement: [2], type: [gl.UNSIGNED_BYTE], };
t[gl.RG8_SNORM] = { textureFormat: gl.RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [2], type: [gl.BYTE], };
t[gl.RG16F] = { textureFormat: gl.RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [8, 4], type: [gl.FLOAT, gl.HALF_FLOAT], };
t[gl.RG32F] = { textureFormat: gl.RG, colorRenderable: false, textureFilterable: false, bytesPerElement: [8], type: [gl.FLOAT], };
t[gl.RG8UI] = { textureFormat: gl.RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [gl.UNSIGNED_BYTE], };
t[gl.RG8I] = { textureFormat: gl.RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [gl.BYTE], };
t[gl.RG16UI] = { textureFormat: gl.RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.UNSIGNED_SHORT], };
t[gl.RG16I] = { textureFormat: gl.RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.SHORT], };
t[gl.RG32UI] = { textureFormat: gl.RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [gl.UNSIGNED_INT], };
t[gl.RG32I] = { textureFormat: gl.RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [gl.INT], };
t[gl.RGB8] = { textureFormat: gl.RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3], type: [gl.UNSIGNED_BYTE], };
t[gl.SRGB8] = { textureFormat: gl.RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [gl.UNSIGNED_BYTE], };
t[gl.RGB565] = { textureFormat: gl.RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 2], type: [gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT_5_6_5], };
t[gl.RGB8_SNORM] = { textureFormat: gl.RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [gl.BYTE], };
t[gl.R11F_G11F_B10F] = { textureFormat: gl.RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [gl.FLOAT, gl.HALF_FLOAT, gl.UNSIGNED_INT_10F_11F_11F_REV], };
t[gl.RGB9_E5] = { textureFormat: gl.RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [gl.FLOAT, gl.HALF_FLOAT, gl.UNSIGNED_INT_5_9_9_9_REV], };
t[gl.RGB16F] = { textureFormat: gl.RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6], type: [gl.FLOAT, gl.HALF_FLOAT], };
t[gl.RGB32F] = { textureFormat: gl.RGB, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [gl.FLOAT], };
t[gl.RGB8UI] = { textureFormat: gl.RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [gl.UNSIGNED_BYTE], };
t[gl.RGB8I] = { textureFormat: gl.RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [gl.BYTE], };
t[gl.RGB16UI] = { textureFormat: gl.RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [gl.UNSIGNED_SHORT], };
t[gl.RGB16I] = { textureFormat: gl.RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [gl.SHORT], };
t[gl.RGB32UI] = { textureFormat: gl.RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [gl.UNSIGNED_INT], };
t[gl.RGB32I] = { textureFormat: gl.RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [gl.INT], };
t[gl.RGBA8] = { textureFormat: gl.RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [gl.UNSIGNED_BYTE], };
t[gl.SRGB8_ALPHA8] = { textureFormat: gl.RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [gl.UNSIGNED_BYTE], };
t[gl.RGBA8_SNORM] = { textureFormat: gl.RGBA, colorRenderable: false, textureFilterable: true, bytesPerElement: [4], type: [gl.BYTE], };
t[gl.RGB5_A1] = { textureFormat: gl.RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2, 4], type: [gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT_5_5_5_1, gl.UNSIGNED_INT_2_10_10_10_REV], };
t[gl.RGBA4] = { textureFormat: gl.RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2], type: [gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT_4_4_4_4], };
t[gl.RGB10_A2] = { textureFormat: gl.RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [gl.UNSIGNED_INT_2_10_10_10_REV], };
t[gl.RGBA16F] = { textureFormat: gl.RGBA, colorRenderable: false, textureFilterable: true, bytesPerElement: [16, 8], type: [gl.FLOAT, gl.HALF_FLOAT], };
t[gl.RGBA32F] = { textureFormat: gl.RGBA, colorRenderable: false, textureFilterable: false, bytesPerElement: [16], type: [gl.FLOAT], };
t[gl.RGBA8UI] = { textureFormat: gl.RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.UNSIGNED_BYTE], };
t[gl.RGBA8I] = { textureFormat: gl.RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.BYTE], };
t[gl.RGB10_A2UI] = { textureFormat: gl.RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.UNSIGNED_INT_2_10_10_10_REV], };
t[gl.RGBA16UI] = { textureFormat: gl.RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [gl.UNSIGNED_SHORT], };
t[gl.RGBA16I] = { textureFormat: gl.RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [gl.SHORT], };
t[gl.RGBA32I] = { textureFormat: gl.RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [gl.INT], };
t[gl.RGBA32UI] = { textureFormat: gl.RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [gl.UNSIGNED_INT], };
// Sized Internal
t[gl.DEPTH_COMPONENT16] = { textureFormat: gl.DEPTH_COMPONENT, colorRenderable: true, textureFilterable: false, bytesPerElement: [2, 4], type: [gl.UNSIGNED_SHORT, gl.UNSIGNED_INT], };
t[gl.DEPTH_COMPONENT24] = { textureFormat: gl.DEPTH_COMPONENT, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.UNSIGNED_INT], };
t[gl.DEPTH_COMPONENT32F] = { textureFormat: gl.DEPTH_COMPONENT, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.FLOAT], };
t[gl.DEPTH24_STENCIL8] = { textureFormat: gl.DEPTH_STENCIL, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.UNSIGNED_INT_24_8], };
t[gl.DEPTH32F_STENCIL8] = { textureFormat: gl.DEPTH_STENCIL, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [gl.FLOAT_32_UNSIGNED_INT_24_8_REV], };
Object.keys(t).forEach(function(internalFormat) {
const info = t[internalFormat];
info.bytesPerElementMap = {};
info.bytesPerElement.forEach(function(bytesPerElement, ndx) {
const type = info.type[ndx];
info.bytesPerElementMap[type] = bytesPerElement;
});
});
}
const validChannelsByTextureFormat = {};
{
const v = validChannelsByTextureFormat;
v[gl.RED] = [1, 0, 0, 0];
v[gl.RG] = [1, 1, 0, 0];
v[gl.RGB] = [1, 1, 1, 0];
v[gl.RGBA] = [1, 1, 1, 1];
v[gl.RED_INTEGER] = [1, 0, 0, 0];
v[gl.RG_INTEGER] = [1, 1, 0, 0];
v[gl.RGB_INTEGER] = [1, 1, 1, 0];
v[gl.RGBA_INTEGER] = [1, 1, 1, 1];
}
const depthTextureFormats = [
gl.DEPTH_COMPONENT16,
gl.DEPTH_COMPONENT24,
gl.DEPTH_COMPONENT32F,
gl.DEPTH24_STENCIL8,
gl.DEPTH32F_STENCIL8,
];
const intTextureFormats = [
gl.R8I,
gl.R16I,
gl.R32I,
gl.RG8I,
gl.RG16I,
gl.RG32I,
gl.RGB8I,
gl.RGB16I,
gl.RGB32I,
gl.RGBA8I,
gl.RGBA16I,
gl.RGBA32I,
];
const unsignedIntTextureFormats = [
gl.R8UI,
gl.R16UI,
gl.R32UI,
gl.RG8UI,
gl.RG16UI,
gl.RG32UI,
gl.RGB8UI,
gl.RGB16UI,
gl.RGB32UI,
gl.RGBA8UI,
gl.RGB10_A2UI,
gl.RGBA16UI,
gl.RGBA32UI,
];
const floatTextureFormats = Object.keys(textureInternalFormatInfo).map(function(v) {
return parseInt(v);
}).filter(function(format) {
return intTextureFormats.indexOf(format) < 0 &&
unsignedIntTextureFormats.indexOf(format) < 0 &&
depthTextureFormats.indexOf(format);
});
const expectedColorByInternalFormat = {};
expectedColorByInternalFormat[gl.SRGB8_ALPHA8] = [225, 188, 137, 255];
function clearFloat(gl) {
gl.clearBufferfv(gl.COLOR, 0, [0, 0, 0, 0]);
}
function clearInt(gl) {
gl.clearBufferiv(gl.COLOR, 0, [0, 0, 0, 0]);
}
function clearUint(gl) {
gl.clearBufferuiv(gl.COLOR, 0, [0, 0, 0, 0]);
}
function checkData(data, expected, internalFormat, tolerance) {
const internalFormatInfo = textureInternalFormatInfo[internalFormat];
const validChannels = validChannelsByTextureFormat[internalFormatInfo.textureFormat];
if (!validChannels) {
testFailed('oops');
return;
}
for (let y = 0; y < texHeight; ++y) {
for (let x = 0; x < texWidth; ++x) {
for (let c = 0; c < validChannels.length; ++c) {
if (validChannels[c]) {
const offset = (y * texWidth + x) * 4 + c;
const pixel = data[offset];
const diff = Math.abs(pixel - expected[c]);
if (diff > tolerance) {
testFailed(`pixel ${x},${y} channel ${c} was ${pixel} expected ${expected[c]} +/- ${tolerance}`);
return;
}
}
}
}
}
testPassed(`data was ${expected.join(',')}`);
}
function checkFloat(gl, textureInfo, expected) {
const data = new Uint8Array(texWidth * texHeight * 4);
gl.readPixels(0, 0, texWidth, texHeight, gl.RGBA, gl.UNSIGNED_BYTE, data);
const internalFormat = textureInfo.internalFormat;
wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from readPixels with ${wtu.glEnumToString(gl, internalFormat)}`);
checkData(data, expected, internalFormat, 9);
}
function checkInt(gl, textureInfo, expected) {
const data = new Int32Array(texWidth * texHeight * 4);
gl.readPixels(0, 0, texWidth, texHeight, gl.RGBA_INTEGER, gl.INT, data);
const internalFormat = textureInfo.internalFormat;
wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from readPixels with ${wtu.glEnumToString(gl, internalFormat)}`);
checkData(data, expected, internalFormat, 0);
}
function checkUint(gl, textureInfo, expected) {
const data = new Uint32Array(texWidth * texHeight * 4);
gl.readPixels(0, 0, texWidth, texHeight, gl.RGBA_INTEGER, gl.UNSIGNED_INT, data);
const internalFormat = textureInfo.internalFormat;
wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from readPixels with ${wtu.glEnumToString(gl, internalFormat)}`);
checkData(data, expected, internalFormat, 0);
}
const expectedFloatColor = [.75 * 255 | 0, .5 * 255 | 0, .25 * 255 | 0, 1 * 255 | 0];
const floatTypes = [
{ outType: 'vec4', outValue: 'vec4(.75, .5, .25, 1)', expected: expectedFloatColor, clear: clearFloat, check: checkFloat, target: gl.TEXTURE_2D, },
{ outType: 'vec4', outValue: 'vec4(.75, .5, .25, 1)', expected: expectedFloatColor, clear: clearFloat, check: checkFloat, target: gl.TEXTURE_3D, },
{ outType: 'vec4', outValue: 'vec4(.75, .5, .25, 1)', expected: expectedFloatColor, clear: clearFloat, check: checkFloat, target: gl.TEXTURE_2D_ARRAY, },
];
const expectedIntColor = [1, 2, 4, 3];
const signedIntTypes = [
{ outType: 'ivec4', outValue: 'ivec4(1, 2, 4, 3)', expected: expectedIntColor, clear: clearInt, check: checkInt, target: gl.TEXTURE_2D, },
{ outType: 'ivec4', outValue: 'ivec4(1, 2, 4, 3)', expected: expectedIntColor, clear: clearInt, check: checkInt, target: gl.TEXTURE_3D, },
{ outType: 'ivec4', outValue: 'ivec4(1, 2, 4, 3)', expected: expectedIntColor, clear: clearInt, check: checkInt, target: gl.TEXTURE_2D_ARRAY, },
];
const expectedUintColor = [1, 2, 4, 3];
const unsignedIntTypes = [
{ outType: 'uvec4', outValue: 'uvec4(1, 2, 4, 3)', expected: expectedUintColor, clear: clearUint, check: checkUint, target: gl.TEXTURE_2D, },
{ outType: 'uvec4', outValue: 'uvec4(1, 2, 4, 3)', expected: expectedUintColor, clear: clearUint, check: checkUint, target: gl.TEXTURE_3D, },
{ outType: 'uvec4', outValue: 'uvec4(1, 2, 4, 3)', expected: expectedUintColor, clear: clearUint, check: checkUint, target: gl.TEXTURE_2D_ARRAY, },
];
/**
* Gets the number of bytes per element for a given internalFormat / type
* @param {number} internalFormat The internalFormat parameter from texImage2D etc..
* @param {number} type The type parameter for texImage2D etc..
* @return {number} the number of bytes per element for the given internalFormat, type combo
* @memberOf module:twgl/textures
*/
function getBytesPerElementForInternalFormat(internalFormat, type) {
const info = textureInternalFormatInfo[internalFormat];
if (!info) {
throw "unknown internal format";
}
const bytesPerElement = info.bytesPerElementMap[type];
if (bytesPerElement === undefined) {
throw "unknown internal format";
}
return bytesPerElement;
}
function make2DTexture(gl, target, internalFormat, format, type) {
gl.texImage2D(target, 0, internalFormat, texWidth, texHeight, 0, format, type, null);
}
function make3DTexture(gl, target, internalFormat, format, type) {
gl.texImage3D(target, 0, internalFormat, texWidth, texHeight, texDepth, 0, format, type, null);
}
function attach2DTexture(gl, target, texture) {
const level = 0;
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, target, texture, level);
}
function attach3DTexture(gl, target, texture) {
const level = 0;
const slice = texDepth - 1;
gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, texture, level, slice);
}
const targets = {};
targets[gl.TEXTURE_2D] = { make: make2DTexture, attach: attach2DTexture, },
targets[gl.TEXTURE_3D] = { make: make3DTexture, attach: attach3DTexture, },
targets[gl.TEXTURE_2D_ARRAY] = { make: make3DTexture, attach: attach3DTexture, },
debug("create textures");
Object.keys(targets).forEach(function(target) {
debug("");
target = parseInt(target);
debug(wtu.glEnumToString(gl, target))
const targetInfo = targets[target];
targetInfo.textures = [];
Object.keys(textureInternalFormatInfo).forEach(function(internalFormat) {
internalFormat = parseInt(internalFormat);
const isDepthFormat = depthTextureFormats.indexOf(internalFormat) >= 0;
if (isDepthFormat) {
return;
}
const info = textureInternalFormatInfo[internalFormat];
if (!info.colorRenderable) {
return;
}
const texture = gl.createTexture();
gl.bindTexture(target, texture);
targetInfo.make(gl, target, internalFormat, info.textureFormat, info.type[0]);
targetInfo.textures.push({
internalFormat: internalFormat,
texture: texture,
});
gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from setup for ${wtu.glEnumToString(gl, target)} ${wtu.glEnumToString(gl, internalFormat)}`);
});
});
// set the canvas to a known color
const half = 127 / 255;
gl.clearColor(half, half, half, half);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.clearColor(0, 0, 0, 0);
const framebuffer = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
gl.viewport(0, 0, texWidth, texHeight);
const rb = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, texWidth, texHeight);
testTypes('float', floatTypes, floatTextureFormats);
testTypes('int', signedIntTypes, intTextureFormats);
testTypes('unsigned', unsignedIntTypes, unsignedIntTextureFormats);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
wtu.checkCanvas(gl, [127, 127, 127, 127], "canvas should be [127, 127, 127, 127]");
function testTypes(label, types, compatibleFormats) {
debug('');
types.forEach(function(typeInfo) {
debug(`\nchecking ${wtu.glEnumToString(gl, typeInfo.target)} with ${label} texture formats`);
const program = wtu.setupProgram(gl, ['vshader', makeFragmentShader(typeInfo)], [], console.log.bind(console));
if (!program) {
testFailed("Loading program failed");
return;
}
testPassed("Loading program succeeded");
const target = typeInfo.target;
const targetInfo = targets[target];
targetInfo.textures.filter(function(textureInfo) {
return compatibleFormats.indexOf(textureInfo.internalFormat) >= 0;
}).forEach(function(textureInfo) {
const internalFormat = textureInfo.internalFormat;
const desc = `${wtu.glEnumToString(gl, target)} ${wtu.glEnumToString(gl, internalFormat)}`;
const expected = expectedColorByInternalFormat[internalFormat] || typeInfo.expected;
debug('');
debug(desc);
targetInfo.attach(gl, target, textureInfo.texture);
wtu.framebufferStatusShouldBe(gl, gl.FRAMEBUFFER, gl.FRAMEBUFFER_COMPLETE, `for ${desc}`);
typeInfo.clear(gl);
if (wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from clear to ${desc}`)) {
return;
}
typeInfo.check(gl, textureInfo, [0, 0, 0, 0]);
gl.drawArrays(gl.POINTS, 0, 1);
if (wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from render to ${desc}`)) {
return;
}
typeInfo.check(gl, textureInfo, expected);
typeInfo.clear(gl);
if (wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from clear to ${desc}`)) {
return;
}
typeInfo.check(gl, textureInfo, [0, 0, 0, 0]);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, rb);
wtu.framebufferStatusShouldBe(gl, gl.FRAMEBUFFER, gl.FRAMEBUFFER_COMPLETE, `for ${desc} with depth renderbuffer`);
gl.clearBufferfv(gl.DEPTH, 0, [1]);
gl.drawArrays(gl.POINTS, 0, 1);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, `No errors from render to ${desc}`);
typeInfo.check(gl, textureInfo, expected);
});
});
}
}
debug("");
var successfullyParsed = true;
</script>
<script src="../../js/js-test-post.js"></script>
</body>
</html>

Просмотреть файл

@ -1722,7 +1722,32 @@ var glErrorShouldBe = function(gl, glErrors, opt_msg) {
return glErrorShouldBeImpl(gl, glErrors, true, opt_msg); return glErrorShouldBeImpl(gl, glErrors, true, opt_msg);
}; };
/**
* Tests that the given framebuffer has a specific status
* @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use.
* @param {number|Array.<number>} glStatuses The expected gl
* status or an array of expected statuses.
* @param {string} opt_msg Optional additional message.
*/
var framebufferStatusShouldBe = function(gl, target, glStatuses, opt_msg) {
if (!glStatuses.length) {
glStatuses = [glStatuses];
}
opt_msg = opt_msg || "";
const status = gl.checkFramebufferStatus(target);
const ndx = glStatuses.indexOf(status);
const expected = glStatuses.map((status) => {
return glEnumToString(gl, status);
}).join(' or ');
if (ndx < 0) {
var msg = "checkFramebufferStatus expected" + ((glStatuses.length > 1) ? " one of: " : ": ");
testFailed(msg + expected + ". Was " + glEnumToString(gl, status) + " : " + opt_msg);
} else {
var msg = "checkFramebufferStatus was " + ((glStatuses.length > 1) ? "one of: " : "expected value: ");
testPassed(msg + expected + " : " + opt_msg);
}
return status;
}
/** /**
* Tests that the first error GL returns is the specified error. Allows suppression of successes. * Tests that the first error GL returns is the specified error. Allows suppression of successes.
@ -3158,6 +3183,13 @@ var getRelativePath = function(path) {
return relparts.join("/"); return relparts.join("/");
} }
function chooseUrlForCrossOriginImage(imgUrl, localUrl) {
if (runningOnLocalhost())
return getLocalCrossOrigin() + getRelativePath(localUrl);
return img.src = getUrlOptions().imgUrl || imgUrl;
}
var setupImageForCrossOriginTest = function(img, imgUrl, localUrl, callback) { var setupImageForCrossOriginTest = function(img, imgUrl, localUrl, callback) {
window.addEventListener("load", function() { window.addEventListener("load", function() {
if (typeof(img) == "string") if (typeof(img) == "string")
@ -3168,10 +3200,7 @@ var setupImageForCrossOriginTest = function(img, imgUrl, localUrl, callback) {
img.addEventListener("load", callback, false); img.addEventListener("load", callback, false);
img.addEventListener("error", callback, false); img.addEventListener("error", callback, false);
if (runningOnLocalhost()) img.src = chooseUrlForCrossOriginImage(imgUrl, localUrl);
img.src = getLocalCrossOrigin() + getRelativePath(localUrl);
else
img.src = getUrlOptions().imgUrl || imgUrl;
}, false); }, false);
} }
@ -3309,6 +3338,14 @@ function createImageFromPixel(buf, width, height) {
return img; return img;
} }
async function awaitTimeout(ms) {
await new Promise(res => {
setTimeout(() => {
res();
}, ms);
});
}
var API = { var API = {
addShaderSource: addShaderSource, addShaderSource: addShaderSource,
addShaderSources: addShaderSources, addShaderSources: addShaderSources,
@ -3342,6 +3379,7 @@ var API = {
endsWith: endsWith, endsWith: endsWith,
failIfGLError: failIfGLError, failIfGLError: failIfGLError,
fillTexture: fillTexture, fillTexture: fillTexture,
framebufferStatusShouldBe: framebufferStatusShouldBe,
getBytesPerComponent: getBytesPerComponent, getBytesPerComponent: getBytesPerComponent,
getDefault3DContextVersion: getDefault3DContextVersion, getDefault3DContextVersion: getDefault3DContextVersion,
getExtensionPrefixedNames: getExtensionPrefixedNames, getExtensionPrefixedNames: getExtensionPrefixedNames,
@ -3434,7 +3472,9 @@ var API = {
runningOnLocalhost: runningOnLocalhost, runningOnLocalhost: runningOnLocalhost,
getLocalCrossOrigin: getLocalCrossOrigin, getLocalCrossOrigin: getLocalCrossOrigin,
getRelativePath: getRelativePath, getRelativePath: getRelativePath,
chooseUrlForCrossOriginImage: chooseUrlForCrossOriginImage,
setupImageForCrossOriginTest: setupImageForCrossOriginTest, setupImageForCrossOriginTest: setupImageForCrossOriginTest,
awaitTimeout: awaitTimeout,
none: false none: false
}; };

Просмотреть файл

@ -1,19 +1,23 @@
commit 7ff0c2857868fafa202f7b169266dd46250afa20 commit 2217a5170cf68932020867dd40c4137a748dd2e1
Author: Jeff Gilbert <jgilbert@mozilla.com> Author: Jeff Gilbert <jdashg@gmail.com>
Date: Tue Feb 25 10:43:35 2020 -0800 Date: Fri Mar 13 13:10:49 2020 -0700
Add GLSL preprocessor comment behavior tests. (#3028) Add Render();NoOpResize();Render(); tests.
Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1617512 Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1621523
Cherries picked Cherries picked
================================================================================ ================================================================================
Merge base from: ups/master Merge base from: ups/master
commit 37e233058f64357a13599ed5be92b72094ec7fba commit b49347b2c51eba1a60e63046bd8b9db0f2f8efba
Author: Ken Russell <kbrussel@alum.mit.edu> Author: Jeff Gilbert <jdashg@gmail.com>
Date: Thu Feb 20 18:10:31 2020 -0800 Date: Mon Mar 9 11:48:08 2020 -0700
Test Intel driver bug where clear/drawArrays reorder across bindFramebuffer. (#2997) Add testcase for minimal glsl line comment, and related. (#3035)
Regression test for http://crbug.com/1018028 . * Add testcase for minimal glsl line comment, and related.
Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1620876
* Improve testcase description.

Просмотреть файл

@ -7,8 +7,9 @@
# Write a Mochitest manifest for WebGL conformance test files. # Write a Mochitest manifest for WebGL conformance test files.
import os import os
import re
from pathlib import * from pathlib import *
import re
import shutil
# All paths in this file are based where this file is run. # All paths in this file are based where this file is run.
WRAPPER_TEMPLATE_FILE = 'mochi-wrapper.html.template' WRAPPER_TEMPLATE_FILE = 'mochi-wrapper.html.template'
@ -540,6 +541,7 @@ def GetFilePathListForDir(baseDir):
if __name__ == '__main__': if __name__ == '__main__':
file_dir = Path(__file__).parent file_dir = Path(__file__).parent
os.chdir(str(file_dir)) os.chdir(str(file_dir))
shutil.rmtree(file_dir / 'generated', True)
testEntryList = GetTestList() testEntryList = GetTestList()
wrapperPathStrList = WriteWrappers(testEntryList) wrapperPathStrList = WriteWrappers(testEntryList)

Просмотреть файл

@ -2722,6 +2722,8 @@ support-files = always-fail.html
checkout/conformance2/rendering/element-index-uint.html checkout/conformance2/rendering/element-index-uint.html
checkout/conformance2/rendering/framebuffer-completeness-draw-framebuffer.html checkout/conformance2/rendering/framebuffer-completeness-draw-framebuffer.html
checkout/conformance2/rendering/framebuffer-completeness-unaffected.html checkout/conformance2/rendering/framebuffer-completeness-unaffected.html
checkout/conformance2/rendering/framebuffer-render-to-layer-angle-issue.html
checkout/conformance2/rendering/framebuffer-render-to-layer.html
checkout/conformance2/rendering/framebuffer-texture-changing-base-level.html checkout/conformance2/rendering/framebuffer-texture-changing-base-level.html
checkout/conformance2/rendering/framebuffer-texture-level1.html checkout/conformance2/rendering/framebuffer-texture-level1.html
checkout/conformance2/rendering/framebuffer-unsupported.html checkout/conformance2/rendering/framebuffer-unsupported.html
@ -5305,7 +5307,7 @@ subsuite = webgl2-core
subsuite = webgl2-core subsuite = webgl2-core
[generated/test_2_conformance2__renderbuffers__multisampled-depth-renderbuffer-initialization.html] [generated/test_2_conformance2__renderbuffers__multisampled-depth-renderbuffer-initialization.html]
subsuite = webgl2-core subsuite = webgl2-core
fail-if = (os == 'mac') fail-if = 1
[generated/test_2_conformance2__renderbuffers__multisampled-renderbuffer-initialization.html] [generated/test_2_conformance2__renderbuffers__multisampled-renderbuffer-initialization.html]
subsuite = webgl2-core subsuite = webgl2-core
fail-if = (os == 'android') fail-if = (os == 'android')
@ -5371,6 +5373,12 @@ subsuite = webgl2-core
subsuite = webgl2-core subsuite = webgl2-core
[generated/test_2_conformance2__rendering__framebuffer-completeness-unaffected.html] [generated/test_2_conformance2__rendering__framebuffer-completeness-unaffected.html]
subsuite = webgl2-core subsuite = webgl2-core
[generated/test_2_conformance2__rendering__framebuffer-render-to-layer-angle-issue.html]
subsuite = webgl2-core
fail-if = (os == 'win')
[generated/test_2_conformance2__rendering__framebuffer-render-to-layer.html]
subsuite = webgl2-core
fail-if = (os == 'android') || (os == 'mac')
[generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html] [generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html]
subsuite = webgl2-core subsuite = webgl2-core
fail-if = (os == 'win') fail-if = (os == 'win')

Просмотреть файл

@ -0,0 +1,17 @@
<!-- GENERATED FILE, DO NOT EDIT -->
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'/>
<title>
Mochitest wrapper for WebGL Conformance Test Suite tests
</title>
<link rel='stylesheet' type='text/css' href='../iframe-passthrough.css'/>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
</head>
<body>
<iframe src='../mochi-single.html?checkout/conformance2/rendering/framebuffer-render-to-layer-angle-issue.html?webglVersion=2'></iframe>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<!-- GENERATED FILE, DO NOT EDIT -->
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'/>
<title>
Mochitest wrapper for WebGL Conformance Test Suite tests
</title>
<link rel='stylesheet' type='text/css' href='../iframe-passthrough.css'/>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
</head>
<body>
<iframe src='../mochi-single.html?checkout/conformance2/rendering/framebuffer-render-to-layer.html?webglVersion=2'></iframe>
</body>
</html>

Просмотреть файл

@ -246,6 +246,8 @@ fail-if = 1
fail-if = os == 'mac' && os_version == '10.14' # macosx1014 due to 1563418 fail-if = os == 'mac' && os_version == '10.14' # macosx1014 due to 1563418
[generated/test_2_conformance2__textures__misc__tex-unpack-params-with-flip-y-and-premultiply-alpha.html] [generated/test_2_conformance2__textures__misc__tex-unpack-params-with-flip-y-and-premultiply-alpha.html]
fail-if = 1 fail-if = 1
[generated/test_2_conformance2__renderbuffers__multisampled-depth-renderbuffer-initialization.html]
fail-if = 1
#################################################### ####################################################
# Bugs # Bugs
@ -444,6 +446,11 @@ skip-if = (os == 'android') || (os == 'linux')
# application crashed [@ mozilla::WebGLTexture::TexSubImage] # application crashed [@ mozilla::WebGLTexture::TexSubImage]
skip-if = (os == 'win') || (os == 'android') skip-if = (os == 'win') || (os == 'android')
[generated/test_2_conformance2__rendering__framebuffer-render-to-layer.html]
# pixel 0,0 channel 2 was 51 expected 63 +/- 9
fail-if = (os == 'android') || (os == 'mac')
######################################################################## ########################################################################
######################################################################## ########################################################################
# Android # Android
@ -848,8 +855,6 @@ fail-if = (os == 'mac')
#################### ####################
# failure on OSX # failure on OSX
[generated/test_2_conformance2__renderbuffers__multisampled-depth-renderbuffer-initialization.html]
fail-if = (os == 'mac')
[generated/test_2_conformance2__textures__misc__tex-unpack-params.html] [generated/test_2_conformance2__textures__misc__tex-unpack-params.html]
skip-if = (os == 'mac' && debug) skip-if = (os == 'mac' && debug)
fail-if = (os == 'mac') fail-if = (os == 'mac')
@ -1207,6 +1212,10 @@ skip-if = (os == 'win')
skip-if = (os == 'win') skip-if = (os == 'win')
[generated/test_2_conformance__textures__misc__tex-video-using-tex-unit-non-zero.html] [generated/test_2_conformance__textures__misc__tex-video-using-tex-unit-non-zero.html]
skip-if = (os == 'win') skip-if = (os == 'win')
[generated/test_2_conformance2__rendering__framebuffer-render-to-layer-angle-issue.html]
# framebuffer layer 0 should be green
# framebuffer layer 1 should be green
fail-if = (os == 'win')
[generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html] [generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html]
# https://bugzilla.mozilla.org/show_bug.cgi?id=1501868 (ANGLE bug) # https://bugzilla.mozilla.org/show_bug.cgi?id=1501868 (ANGLE bug)
fail-if = (os == 'win') fail-if = (os == 'win')