Skip to content

Commit

Permalink
Fix 2.0.0 snapshot of glsl-conformance-test runner. (KhronosGroup#3130)
Browse files Browse the repository at this point in the history
Backport fixes from KhronosGroup#2330 and KhronosGroup#2612 to the 2.0.0 snapshot.
  • Loading branch information
kenrussell authored Jul 27, 2020
1 parent 40a563c commit 8f4230c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions conformance-suites/2.0.0/js/glsl-conformance-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,12 @@ function runOneTest(gl, info) {
if (info.uniforms !== undefined) {
for (var i = 0; i < info.uniforms.length; ++i) {
var uniformLocation = gl.getUniformLocation(program, info.uniforms[i].name);
gl[info.uniforms[i].functionName](uniformLocation, info.uniforms[i].value);
debug(info.uniforms[i].name + ' set to ' + info.uniforms[i].value);
if (uniformLocation !== null) {
gl[info.uniforms[i].functionName](uniformLocation, info.uniforms[i].value);
debug(info.uniforms[i].name + ' set to ' + info.uniforms[i].value);
} else {
debug('uniform ' + info.uniforms[i].name + ' had null location and was not set');
}
}
}

Expand All @@ -288,7 +292,11 @@ function runOneTest(gl, info) {
if (info.renderTolerance !== undefined) {
tolerance = info.renderTolerance;
}
wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green", tolerance);
if (info.renderColor !== undefined) {
wtu.checkCanvas(gl, info.renderColor, "should be expected color " + info.renderColor, tolerance);
} else {
wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green", tolerance);
}
}

function runTests(shaderInfos, opt_contextVersion) {
Expand All @@ -303,17 +311,11 @@ function runTests(shaderInfos, opt_contextVersion) {
return;
}

var testIndex = 0;
var runNextTest = function() {
if (testIndex == shaderInfos.length) {
finishTest();
return;
}

runOneTest(gl, shaderInfos[testIndex++]);
setTimeout(runNextTest, 1);
for (var i = 0; i < shaderInfos.length; i++) {
runOneTest(gl, shaderInfos[i]);
}
runNextTest();

finishTest();
};

function getSource(elem) {
Expand Down

0 comments on commit 8f4230c

Please sign in to comment.