зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1301671 - Update affected tests to top-of-tree.
MozReview-Commit-ID: I2xwbEKLRSw
This commit is contained in:
Родитель
042aca2b61
Коммит
e9f8d55cb4
|
@ -39,7 +39,7 @@
|
|||
|
||||
<script>
|
||||
"use strict";
|
||||
description("Tests deletion behavior for texture, renderbuffer, shader, and program");
|
||||
description("Tests deletion behavior for buffer, texture, renderbuffer, shader, and program");
|
||||
|
||||
var wtu = WebGLTestUtils;
|
||||
var gl = wtu.create3DContext();
|
||||
|
@ -103,7 +103,7 @@ if (contextVersion > 1) {
|
|||
}
|
||||
shouldBeFalse("gl.isTexture(tex)");
|
||||
shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_2D)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, tex)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindTexture(gl.TEXTURE_2D, tex)");
|
||||
shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_2D)");
|
||||
|
||||
var texCubeMap = gl.createTexture();
|
||||
|
@ -113,7 +113,7 @@ shouldBe("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)", "texCubeMap");
|
|||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(texCubeMap)");
|
||||
shouldBeFalse("gl.isTexture(texCubeMap)");
|
||||
shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap)");
|
||||
shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)");
|
||||
|
||||
var t = gl.createTexture();
|
||||
|
@ -121,7 +121,7 @@ shouldBeNonNull("t");
|
|||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(t)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindTexture(gl.TEXTURE_2D, t)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)");
|
||||
|
||||
var t2 = gl.createTexture();
|
||||
|
@ -159,7 +159,7 @@ if (contextVersion > 1) {
|
|||
}
|
||||
shouldBeFalse("gl.isRenderbuffer(rbo)");
|
||||
shouldBeNull("gl.getParameter(gl.RENDERBUFFER_BINDING)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
|
||||
shouldBeNull("gl.getParameter(gl.RENDERBUFFER_BINDING)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo2)");
|
||||
shouldBe("gl.getParameter(gl.RENDERBUFFER_BINDING)", "rbo2");
|
||||
|
@ -352,7 +352,7 @@ shouldBe("gl.getParameter(gl.ARRAY_BUFFER_BINDING)", "buffer");
|
|||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(buffer)");
|
||||
shouldBeFalse("gl.isBuffer(buffer)");
|
||||
shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)");
|
||||
shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
|
||||
|
||||
var buffer2 = gl.createBuffer();
|
||||
|
@ -363,7 +363,7 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, null)");
|
|||
shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(buffer2)");
|
||||
shouldBeFalse("gl.isBuffer(buffer2)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer2)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer2)");
|
||||
shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
|
||||
|
||||
var bufferElement = gl.createBuffer();
|
||||
|
@ -373,7 +373,7 @@ shouldBe("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)", "bufferElement");
|
|||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(bufferElement)");
|
||||
shouldBeFalse("gl.isBuffer(bufferElement)");
|
||||
shouldBeNull("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferElement)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferElement)");
|
||||
shouldBeNull("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)");
|
||||
|
||||
var b = gl.createBuffer();
|
||||
|
@ -381,7 +381,7 @@ shouldBeNonNull("b");
|
|||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(b)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindBuffer(gl.ARRAY_BUFFER, b)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW)");
|
||||
|
||||
var b1 = gl.createBuffer();
|
||||
|
@ -414,7 +414,7 @@ shouldBe("gl.getParameter(gl.FRAMEBUFFER_BINDING)", "fbo");
|
|||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteFramebuffer(fbo)");
|
||||
shouldBeFalse("gl.isFramebuffer(fbo)");
|
||||
shouldBeNull("gl.getParameter(gl.FRAMEBUFFER_BINDING)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
|
||||
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
|
||||
shouldBeNull("gl.getParameter(gl.FRAMEBUFFER_BINDING)");
|
||||
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
|
||||
shouldBe("gl.getParameter(gl.FRAMEBUFFER_BINDING)", "fbo2");
|
||||
|
|
|
@ -170,8 +170,8 @@ function runBindingTest() {
|
|||
|
||||
// Shouldn't be able to bind a deleted buffer.
|
||||
gl.bindBuffer(gl.UNIFORM_BUFFER, b2);
|
||||
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "binding a deleted buffer should generate INVALID_OPERATION");
|
||||
shouldBeNull("gl.getParameter(gl.UNIFORM_BUFFER_BINDING)");
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
|
||||
}
|
||||
|
||||
function runDrawTest() {
|
||||
|
@ -193,48 +193,68 @@ function runDrawTest() {
|
|||
return;
|
||||
}
|
||||
|
||||
var blockIndex = gl.getUniformBlockIndex(program, "UBOData");
|
||||
var blockSize = gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_DATA_SIZE);
|
||||
var uniformIndices = gl.getUniformIndices(program, ["UBORed", "UBOGreen", "UBOBlue"]);
|
||||
var uniformOffsets = gl.getActiveUniforms(program, uniformIndices, gl.UNIFORM_OFFSET);
|
||||
var blockIndex_1 = gl.getUniformBlockIndex(program, "UBOData");
|
||||
var blockSize_1 = gl.getActiveUniformBlockParameter(program, blockIndex_1, gl.UNIFORM_BLOCK_DATA_SIZE);
|
||||
var uniformIndices_1 = gl.getUniformIndices(program, ["UBORed", "UBOGreen", "UBOBlue"]);
|
||||
var uniformOffsets_1 = gl.getActiveUniforms(program, uniformIndices_1, gl.UNIFORM_OFFSET);
|
||||
var blockIndex_2 = gl.getUniformBlockIndex(program, "UBOD");
|
||||
var blockSize_2 = gl.getActiveUniformBlockParameter(program, blockIndex_2, gl.UNIFORM_BLOCK_DATA_SIZE);
|
||||
var uniformIndices_2 = gl.getUniformIndices(program, ["UBOR", "UBOG", "UBOB"]);
|
||||
var uniformOffsets_2 = gl.getActiveUniforms(program, uniformIndices_2, gl.UNIFORM_OFFSET);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to query uniform block information without error");
|
||||
|
||||
if (uniformOffsets.length < 3) {
|
||||
if (uniformOffsets_1.length < 3 || uniformOffsets_2.length < 3) {
|
||||
testFailed("Could not query uniform offsets");
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify that the uniform offsets are aligned on 4-byte boundries
|
||||
// While unaligned values are allowed by the ES3 spec it would be *really* weird for anyone to actually do that.
|
||||
if (uniformOffsets[0] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets[0] / Float32Array.BYTES_PER_ELEMENT) ||
|
||||
uniformOffsets[1] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets[1] / Float32Array.BYTES_PER_ELEMENT) ||
|
||||
uniformOffsets[2] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets[2] / Float32Array.BYTES_PER_ELEMENT)) {
|
||||
if (uniformOffsets_1[0] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets_1[0] / Float32Array.BYTES_PER_ELEMENT) ||
|
||||
uniformOffsets_1[1] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets_1[1] / Float32Array.BYTES_PER_ELEMENT) ||
|
||||
uniformOffsets_1[2] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets_1[2] / Float32Array.BYTES_PER_ELEMENT) ||
|
||||
uniformOffsets_2[0] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets_2[0] / Float32Array.BYTES_PER_ELEMENT) ||
|
||||
uniformOffsets_2[1] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets_2[1] / Float32Array.BYTES_PER_ELEMENT) ||
|
||||
uniformOffsets_2[2] / Float32Array.BYTES_PER_ELEMENT != Math.floor(uniformOffsets_2[2] / Float32Array.BYTES_PER_ELEMENT)) {
|
||||
testFailed("Uniform offsets are not well aligned");
|
||||
return;
|
||||
}
|
||||
|
||||
var uboArray = new ArrayBuffer(blockSize);
|
||||
var uboFloatView = new Float32Array(uboArray);
|
||||
uboFloatView[uniformOffsets[0] / Float32Array.BYTES_PER_ELEMENT] = 1.0; // UBORed
|
||||
uboFloatView[uniformOffsets[1] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBOGreen
|
||||
uboFloatView[uniformOffsets[2] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBOBlue
|
||||
var uboArray_1 = new ArrayBuffer(blockSize_1);
|
||||
var uboFloatView_1 = new Float32Array(uboArray_1);
|
||||
uboFloatView_1[uniformOffsets_1[0] / Float32Array.BYTES_PER_ELEMENT] = 1.0; // UBORed
|
||||
uboFloatView_1[uniformOffsets_1[1] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBOGreen
|
||||
uboFloatView_1[uniformOffsets_1[2] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBOBlue
|
||||
var uboArray_2 = new ArrayBuffer(blockSize_2);
|
||||
var uboFloatView_2 = new Float32Array(uboArray_2);
|
||||
uboFloatView_2[uniformOffsets_2[0] / Float32Array.BYTES_PER_ELEMENT] = 1.0; // UBOR
|
||||
uboFloatView_2[uniformOffsets_2[1] / Float32Array.BYTES_PER_ELEMENT] = 1.0; // UBOG
|
||||
uboFloatView_2[uniformOffsets_2[2] / Float32Array.BYTES_PER_ELEMENT] = 1.0; // UBOB
|
||||
|
||||
b1 = gl.createBuffer();
|
||||
gl.bindBuffer(gl.UNIFORM_BUFFER, b1);
|
||||
gl.bufferData(gl.UNIFORM_BUFFER, uboArray, gl.DYNAMIC_DRAW);
|
||||
var b_1 = gl.createBuffer();
|
||||
gl.bindBuffer(gl.UNIFORM_BUFFER, b_1);
|
||||
gl.bufferData(gl.UNIFORM_BUFFER, uboFloatView_1, gl.DYNAMIC_DRAW);
|
||||
var b_2 = gl.createBuffer();
|
||||
gl.bindBuffer(gl.UNIFORM_BUFFER, b_2);
|
||||
gl.bufferData(gl.UNIFORM_BUFFER, uboFloatView_2, gl.DYNAMIC_DRAW);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to set UBO data with no errors");
|
||||
|
||||
gl.bindBufferBase(gl.UNIFORM_BUFFER, blockIndex, b1);
|
||||
var bindings = [1, 2];
|
||||
gl.uniformBlockBinding(program, blockIndex_1, bindings[0]);
|
||||
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindings[0], b_1);
|
||||
gl.uniformBlockBinding(program, blockIndex_2, bindings[1]);
|
||||
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindings[1], b_2);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to call bindBufferBase without errors");
|
||||
|
||||
wtu.clearAndDrawUnitQuad(gl);
|
||||
wtu.checkCanvas(gl, [255, 0, 0, 255], "draw call should set canvas to red", 2);
|
||||
|
||||
debug("Changing the data in the uniform buffer should automatically update the uniforms exposed to the draw call");
|
||||
uboFloatView[uniformOffsets[0] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBORed
|
||||
uboFloatView[uniformOffsets[1] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBOGreen
|
||||
uboFloatView[uniformOffsets[2] / Float32Array.BYTES_PER_ELEMENT] = 1.0; // UBOBlue
|
||||
gl.bufferData(gl.UNIFORM_BUFFER, uboArray, gl.DYNAMIC_DRAW);
|
||||
uboFloatView_1[uniformOffsets_1[0] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBORed
|
||||
uboFloatView_1[uniformOffsets_1[1] / Float32Array.BYTES_PER_ELEMENT] = 0.0; // UBOGreen
|
||||
uboFloatView_1[uniformOffsets_1[2] / Float32Array.BYTES_PER_ELEMENT] = 1.0; // UBOBlue
|
||||
gl.bindBuffer(gl.UNIFORM_BUFFER, b_1);
|
||||
gl.bufferData(gl.UNIFORM_BUFFER, uboFloatView_1, gl.DYNAMIC_DRAW);
|
||||
|
||||
wtu.clearAndDrawUnitQuad(gl);
|
||||
wtu.checkCanvas(gl, [0, 0, 255, 255], "draw call should set canvas to blue", 2);
|
||||
|
@ -283,7 +303,9 @@ function runNamedDrawTest() {
|
|||
gl.bufferData(gl.UNIFORM_BUFFER, uboArray, gl.DYNAMIC_DRAW);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to set UBO data with no errors");
|
||||
|
||||
gl.bindBufferBase(gl.UNIFORM_BUFFER, blockIndex, b1);
|
||||
var binding = 3;
|
||||
gl.uniformBlockBinding(program, blockIndex, binding);
|
||||
gl.bindBufferBase(gl.UNIFORM_BUFFER, binding, b1);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to call bindBufferBase without errors");
|
||||
|
||||
wtu.clearAndDrawUnitQuad(gl);
|
||||
|
@ -369,13 +391,13 @@ function runNamedArrayDrawTest() {
|
|||
gl.bufferData(gl.UNIFORM_BUFFER, uboArray, gl.DYNAMIC_DRAW);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to set UBO data with no errors");
|
||||
|
||||
var binding = [2, 3];
|
||||
gl.uniformBlockBinding(program, blockIndex[0], binding[0]);
|
||||
gl.bindBufferRange(gl.UNIFORM_BUFFER, binding[0], b1, 0, blockSize[0]);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to call bindBufferBase without errors");
|
||||
gl.uniformBlockBinding(program, blockIndex[1], binding[1]);
|
||||
gl.bindBufferRange(gl.UNIFORM_BUFFER, binding[1], b1, offset, blockSize[1]);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to call bindBufferBase without errors");
|
||||
var bindings = [4, 5];
|
||||
gl.uniformBlockBinding(program, blockIndex[0], bindings[0]);
|
||||
gl.bindBufferRange(gl.UNIFORM_BUFFER, bindings[0], b1, 0, blockSize[0]);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to call bindBufferRange without errors");
|
||||
gl.uniformBlockBinding(program, blockIndex[1], bindings[1]);
|
||||
gl.bindBufferRange(gl.UNIFORM_BUFFER, bindings[1], b1, offset, blockSize[1]);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be able to call bindBufferRange without errors");
|
||||
|
||||
wtu.clearAndDrawUnitQuad(gl);
|
||||
wtu.checkCanvas(gl, [127, 0, 127, 255], "draw call should set canvas to (0.5, 0, 0.5)", 2);
|
||||
|
|
|
@ -315,8 +315,8 @@ var shaders = gl.getAttachedShaders(standardProgram);
|
|||
shouldBe('shaders.length', '2');
|
||||
shouldBeTrue('shaders[0] == standardVert && shaders[1] == standardFrag || shaders[1] == standardVert && shaders[0] == standardFrag');
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR);
|
||||
shouldBeNull('gl.getAttachedShaders(null)');
|
||||
wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
|
||||
shouldThrow('gl.getAttachedShaders(null)');
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR);
|
||||
shouldThrow('gl.getAttachedShaders(standardVert)');
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR);
|
||||
|
||||
|
@ -729,6 +729,8 @@ debug("Test cases where name == 0");
|
|||
gl.deleteTexture(texture);
|
||||
shouldBe('gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)', 'gl.NONE');
|
||||
gl.deleteRenderbuffer(renderbuffer);
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
|
||||
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION);
|
||||
shouldBe('gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)', 'gl.NONE');
|
||||
gl.deleteBuffer(buffer);
|
||||
shouldBeNull('gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)');
|
||||
|
@ -738,8 +740,6 @@ if (contextVersion > 1) {
|
|||
debug("");
|
||||
debug("Test getInternalformatParameter")
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR);
|
||||
shouldBeNonNull('gl.getInternalformatParameter(gl.RENDERBUFFER, gl.R32I, gl.SAMPLES)');
|
||||
wtu.glErrorShouldBe(gl, gl.NO_ERROR);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче