Skip to content

Commit

Permalink
Test parallel compilation of many small programs. (#3597)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrussell authored Oct 10, 2023
1 parent e9f82ac commit b9be8f8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions sdk/tests/conformance/extensions/khr-parallel-shader-compile.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,32 @@
testPassed(`COMPLETION_STATUS_KHR sucessfully transitioned from false to true`);
}

debug("Checking that compiling lots of programs in parallel eventually completes.");
let programs = [];
for (let i = 0; i < 256; ++i) {
gl.shaderSource(vs, vertexSource());
gl.shaderSource(fs, fragmentSource());
gl.compileShader(vs);
gl.compileShader(fs);
let program = gl.createProgram();
gl.attachShader(program, vs);
gl.attachShader(program, fs);
gl.linkProgram(program);
programs.push(program);
}
let allDone = false;
while (!allDone) {
allDone = true;
for (let i = 0; i < programs.length; ++i) {
if (!gl.getProgramParameter(programs[i], COMPLETION_STATUS_KHR)) {
allDone = false;
break;
}
}
if (!allDone) {
await new Promise(requestAnimationFrame);
}
}

debug("Checking that status is true when context is lost.");
if (loseContext) {
Expand Down

0 comments on commit b9be8f8

Please sign in to comment.