Bug 1301671 - Update affected tests to top-of-tree.

MozReview-Commit-ID: I2xwbEKLRSw
This commit is contained in:
Jeff Gilbert (:jgilbert) 2016-11-16 18:08:06 -08:00
Родитель 042aca2b61
Коммит e9f8d55cb4
3 изменённых файлов: 92 добавлений и 70 удалений

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

@ -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);
@ -859,7 +859,7 @@ if (contextVersion > 1) {
"pname",
validArrayForSamplerParameter,
function(pname) {
return gl.getSamplerParameter(sampler, pname);
return gl.getSamplerParameter(sampler, pname);
});
debug("");
@ -904,16 +904,16 @@ if (contextVersion > 1) {
// Queries' results are tested elsewhere in the conformance suite. It's complicated
// to wait for this query's result to become available and verify it.
var validArrayForPname = new Array(
gl.QUERY_RESULT,
gl.QUERY_RESULT_AVAILABLE
gl.QUERY_RESULT,
gl.QUERY_RESULT_AVAILABLE
);
testInvalidArgument(
"getQueryParameter",
"pname",
validArrayForPname,
function(pname) {
return gl.getQueryParameter(query, pname);
}
"getQueryParameter",
"pname",
validArrayForPname,
function(pname) {
return gl.getQueryParameter(query, pname);
}
);
debug("");
@ -1003,11 +1003,11 @@ if (contextVersion > 1) {
gl.UNIFORM_IS_ROW_MAJOR
);
testInvalidArgument(
"getActiveUniforms",
"pname",
validArrayForPname,
function(pname) {
return gl.getActiveUniforms(program, uniformIndices, pname);
"getActiveUniforms",
"pname",
validArrayForPname,
function(pname) {
return gl.getActiveUniforms(program, uniformIndices, pname);
}
);
@ -1070,20 +1070,20 @@ if (contextVersion > 1) {
testFailed("expected value >= 0" + " actual value for UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES for uniform index[" + i + "]:" + indices[i]);
}
var validArrayForPname = new Array(
gl.UNIFORM_BLOCK_BINDING,
gl.UNIFORM_BLOCK_DATA_SIZE,
gl.UNIFORM_BLOCK_ACTIVE_UNIFORMS,
gl.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES,
gl.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER,
gl.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER
gl.UNIFORM_BLOCK_BINDING,
gl.UNIFORM_BLOCK_DATA_SIZE,
gl.UNIFORM_BLOCK_ACTIVE_UNIFORMS,
gl.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES,
gl.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER,
gl.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER
);
testInvalidArgument(
"getActiveUniformBlockParameter",
"pname",
validArrayForPname,
function(pname) {
return gl.getActiveUniformBlockParameter(program, 0, pname);
}
"getActiveUniformBlockParameter",
"pname",
validArrayForPname,
function(pname) {
return gl.getActiveUniformBlockParameter(program, 0, pname);
}
);
}