Skip to content

Commit

Permalink
merge upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolalysenko committed Mar 11, 2016
2 parents 4f69b0d + ea34ca9 commit 8e871ac
Show file tree
Hide file tree
Showing 4,824 changed files with 541,757 additions and 9,239 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ other/test-runner/output/
extensions/MARK_README.txt
extensions/*/index.html
extensions/proposals/*/index.html
extensions/rejected/*/index.html
extensions/index.atom
extensions/index.html
extensions/registry.xml
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sdk/devtools"]
path = sdk/devtools
url = https://github.com/KhronosGroup/WebGLDeveloperTools.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ npm publish
# License
Conformance tests are (c) Khronos ARB

CommonJS port by Mikola Lysenko
CommonJS port by Mikola Lysenko
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
glErrorShouldBe(gl, gl.NO_ERROR);

gl.bufferSubData(gl.ARRAY_BUFFER, 10, null);
glErrorShouldBe(gl, gl.NO_ERROR);
glErrorShouldBe(gl, [gl.NO_ERROR, gl.INVALID_VALUE]);

successfullyParsed = true;
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
uniform vec2 resolution;

// Saw-tooth function that is synced with the demo music (128bpm)
float gBeat=fract(time*3.2/3.);
float gBeat;

// Calculate the surface color
vec3 surfColor(vec2 p)
Expand All @@ -52,6 +52,7 @@

void main()
{
gBeat=fract(time*3.2/3.);
// Screen setup
vec2 p=(2.*gl_FragCoord.xy-resolution)/resolution.y,
q=2.*gl_FragCoord.xy/resolution-1.;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,13 @@
}

for (var i = 0; i < arguments.length; ++i) {
var func, func2, func3;
var func, func2;
if (arguments[i].throws) {
func = shouldThrow;
func2 = shouldThrow;
func3 = shouldThrow;
} else {
func = shouldBeUndefined;
func2 = shouldBeNull;
func3 = shouldBeEmptyString;
}
argument = arguments[i].value;
func("context.compileShader(argument)");
Expand All @@ -98,15 +96,15 @@
func("context.uniform2iv(argument, new Int32Array([0, 0]))");
func("context.uniformMatrix2fv(argument, false, new Float32Array([0.0, 0.0, 0.0, 0.0]))");

func2("context.getProgramInfoLog(argument)");
func2("context.getProgramParameter(argument, 0)");
func2("context.getShaderInfoLog(argument)");
func2("context.getShaderParameter(argument, 0)");
func2("context.getShaderSource(argument)");
func2("context.getUniform(argument, loc)");
func2("context.getUniform(program, argument)");
func2("context.getUniformLocation(argument, 'u_modelViewProjMatrix')");

func3("context.getProgramInfoLog(argument)");
func3("context.getShaderInfoLog(argument)");
func3("context.getShaderSource(argument)");
}

successfullyParsed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
assertGLError(gl, gl.INVALID_ENUM, "bad target", function(){
gl.texImage2D(gl.FLOAT, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_ENUM, "bad internal format/format", function(){
assertGLErrorIn(gl, [gl.INVALID_ENUM, gl.INVALID_VALUE], "bad internal format/format", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.FLOAT, 1,1,0,gl.FLOAT,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_VALUE, "border > 0", function(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
});
var d = new Uint8Array(4);
gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, d);
assertArrayEquals([1,2,3,8], d);
assertArrayEqualsWithEpsilon([1,2,3,8], d, [1,1,1,1]);
sh.destroy();
}

Expand Down
32 changes: 32 additions & 0 deletions conformance-suites/1.0.1/conformance/more/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,38 @@ function assertArrayEquals(name, v, p) {
return true;
}

function assertArrayEqualsWithEpsilon(name, v, p, l) {
if (l == null) { l = p; p = v; v = name; name = null; }
if (!v) {
testFailed("assertArrayEqualsWithEpsilon: first array undefined", name, v, p);
return false;
}
if (!p) {
testFailed("assertArrayEqualsWithEpsilon: second array undefined", name, v, p);
return false;
}
if (!l) {
testFailed("assertArrayEqualsWithEpsilon: limit array undefined", name, v, p);
return false;
}
if (v.length != p.length) {
testFailed("assertArrayEqualsWithEpsilon", name, v, p, l);
return false;
}
if (v.length != l.length) {
testFailed("assertArrayEqualsWithEpsilon", name, v, p, l);
return false;
}
for (var ii = 0; ii < v.length; ++ii) {
if (Math.abs(v[ii]- p[ii])>l[ii]) {
testFailed("assertArrayEqualsWithEpsilon", name, v, p, l);
return false;
}
}
testPassed("assertArrayEqualsWithEpsilon", name, v, p, l);
return true;
}

function assertNotEquals(name, v, p) {
if (p == null) { p = v; v = name; name = null; }
if (compare(v, p)) {
Expand Down
34 changes: 34 additions & 0 deletions conformance-suites/1.0.1/conformance/more/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,40 @@ function assertGLError(gl, err, name, f) {
return true;
}

// Assert that f generates a GL error from a list.
function assertGLErrorIn(gl, expectedErrorList, name, f) {
if (f == null) { f = name; name = null; }

var actualError = 0;
try {
f();
} catch(e) {
if ('glError' in e) {
actualError = e.glError;
} else {
testFailed("assertGLError: UNEXPCETED EXCEPTION", name, f);
return false;
}
}

var expectedErrorStrList = [];
var expectedErrorSet = {};
for (var i in expectedErrorList) {
var cur = expectedErrorList[i];
expectedErrorSet[cur] = true;
expectedErrorStrList.push(getGLErrorAsString(gl, cur));
}
var expectedErrorListStr = "[" + expectedErrorStrList.join(", ") + "]";

if (actualError in expectedErrorSet) {
return true;
}

testFailed("assertGLError: expected: " + expectedErrorListStr +
" actual: " + getGLErrorAsString(gl, actualError), name, f);
return false;
}

// Assert that f generates some GL error. Used in situations where it's
// ambigious which of multiple possible errors will be generated.
function assertSomeGLError(gl, name, f) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@
checkGetAttachedShaders([fs], [], [fs], "attaching a single shader should give the expected list");
checkGetAttachedShaders([fs, vs], [], [fs, vs],
"attaching some shaders should give the expected list");
checkGetAttachedShaders([fs], [fs], [], "attaching a shader and detaching it shoud leave an empty list");
checkGetAttachedShaders([fs], [fs], [], "attaching a shader and detaching it should leave an empty list");
checkGetAttachedShaders([fs, vs], [fs, vs], [],
"attaching some shaders and detaching them in same order shoud leave an empty list");
"attaching some shaders and detaching them in same order should leave an empty list");
checkGetAttachedShaders([fs, vs], [vs, fs], [],
"attaching some shaders and detaching them in random order shoud leave an empty list");
"attaching some shaders and detaching them in random order should leave an empty list");
checkGetAttachedShaders([fs, vs], [vs], [fs],
"attaching and detaching some shaders should leave the difference list");
checkGetAttachedShaders([fs, vs], [fs], [vs],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ var runFeatureTest = function(params) {
var wtu = WebGLTestUtils;
var gridRes = params.gridRes;
var vertexTolerance = params.tolerance || 0;
var fragmentTolerance = vertexTolerance;
var fragmentTolerance = params.tolerance || 1;
if ('fragmentTolerance' in params)
fragmentTolerance = params.fragmentTolerance || 0;
fragmentTolerance = params.fragmentTolerance;

description("Testing GLSL feature: " + params.feature);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

function setup() {
tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, bug32619_tests.tex);
gl.bindTexture(gl.TEXTURE_2D, tex);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
}

Expand Down Expand Up @@ -54,6 +54,21 @@
}
}

test("Calling texImage2D with no WebGLTexture bound generates INVALID_OPERATION",
function () {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
},
gl.INVALID_OPERATION);

test("Calling texSubImage2D with no WebGLTexture bound generates INVALID_OPERATION",
function () {
var buffer = new Uint8Array(4);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buffer);
},
gl.INVALID_OPERATION);

setup();

test("Passing a buffer not large enough to texImage2D should generate an INVALID_OPERATION",
function () {
var tooSmall = new Uint8Array(64);
Expand Down Expand Up @@ -91,8 +106,10 @@
},
"exception");

teardown();

debug("");
successfullyParsed = true;
var successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
border: 0,
format: 0x1903, // GL_RED
type: gl.UNSIGNED_BYTE,
expectedError: gl.INVALID_ENUM},
expectedError: [gl.INVALID_ENUM, gl.INVALID_VALUE] },
{target: gl.TEXTURE_2D,
internalFormat: gl.RGBA,
border: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
glErrorShouldBe(gl, gl.NO_ERROR);

gl.bufferSubData(gl.ARRAY_BUFFER, 10, null);
glErrorShouldBe(gl, gl.NO_ERROR);
glErrorShouldBe(gl, [gl.NO_ERROR, gl.INVALID_VALUE]);

var successfullyParsed = true;
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,10 @@
for (var ii = 0; ii < colorBuffers.length; ++ii) {
gl.deleteBuffer(colorBuffers[ii]);
gl.deleteBuffer(elementBuffers[ii]);
ext.bindVertexArrayOES(vaos[ii]);
var boundBuffer = gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING);
// The buffers should still be valid at this point, since it was attached to the VAO
if(!gl.isBuffer(colorBuffers[ii])) {
if(boundBuffer != colorBuffers[ii]) {
testFailed("buffer removed too early");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@

var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
shouldGenerateGLError(gl, gl.INVALID_ENUM, 'gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null)');
shouldGenerateGLError(gl, gl.INVALID_ENUM, 'gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null)');
shouldGenerateGLError(gl, [gl.INVALID_ENUM, gl.INVALID_VALUE], 'gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null)');
shouldGenerateGLError(gl, [gl.INVALID_ENUM, gl.INVALID_VALUE], 'gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null)');
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
uniform vec2 resolution;

// Saw-tooth function that is synced with the demo music (128bpm)
float gBeat=fract(time*3.2/3.);
float gBeat;

// Calculate the surface color
vec3 surfColor(vec2 p)
Expand All @@ -74,6 +74,7 @@

void main()
{
gBeat=fract(time*3.2/3.);
// Screen setup
vec2 p=(2.*gl_FragCoord.xy-resolution)/resolution.y,
q=2.*gl_FragCoord.xy/resolution-1.;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ webgl_field.vert.html
webgl_function.vert.html
webgl_struct.vert.html
webgl_variable.vert.html
--min-version 1.0.2 webgl_preprocessor_reserved.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@
}

for (var i = 0; i < testArguments.length; ++i) {
var func, func2, func3;
var func, func2;
if (testArguments[i].throws) {
func = shouldThrow;
func2 = shouldThrow;
func3 = shouldThrow;
} else {
func = shouldBeUndefined;
func2 = shouldBeNull;
func3 = shouldBeEmptyString;
}
argument = testArguments[i].value;
func("context.compileShader(argument)");
Expand All @@ -102,15 +100,15 @@
func("context.uniform2iv(argument, new Int32Array([0, 0]))");
func("context.uniformMatrix2fv(argument, false, new Float32Array([0.0, 0.0, 0.0, 0.0]))");

func2("context.getProgramInfoLog(argument)");
func2("context.getProgramParameter(argument, 0)");
func2("context.getShaderInfoLog(argument)");
func2("context.getShaderParameter(argument, 0)");
func2("context.getShaderSource(argument)");
func2("context.getUniform(argument, loc)");
func2("context.getUniform(program, argument)");
func2("context.getUniformLocation(argument, 'u_modelViewProjMatrix')");

func3("context.getProgramInfoLog(argument)");
func3("context.getShaderInfoLog(argument)");
func3("context.getShaderSource(argument)");
}

var successfullyParsed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
assertGLError(gl, gl.INVALID_ENUM, "bad target", function(){
gl.texImage2D(gl.FLOAT, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_ENUM, "bad internal format/format", function(){
assertGLErrorIn(gl, [gl.INVALID_ENUM, gl.INVALID_VALUE], "bad internal format/format", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.FLOAT, 1,1,0,gl.FLOAT,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_VALUE, "border > 0", function(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
});
var d = new Uint8Array(4);
gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, d);
assertArrayEquals([1,2,3,8], d);
assertArrayEqualsWithEpsilon([1,2,3,8], d, [1,1,1,1]);
sh.destroy();
}

Expand Down
Loading

0 comments on commit 8e871ac

Please sign in to comment.