Skip to content

Instantly share code, notes, and snippets.

@greggman
Last active April 18, 2024 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greggman/81f9f3e6c9ec92b158d697e50f4241cb to your computer and use it in GitHub Desktop.
Save greggman/81f9f3e6c9ec92b158d697e50f4241cb to your computer and use it in GitHub Desktop.
2d-array render target - should fail
/*bug-in-github-api-content-can-not-be-empty*/
/*bug-in-github-api-content-can-not-be-empty*/
async function main() {
const adapter = await navigator.gpu?.requestAdapter();
const device = await adapter?.requestDevice();
const tex = device.createTexture({
size: [2, 2, 2],
format: 'rgba8unorm',
usage:
GPUTextureUsage.RENDER_ATTACHMENT
});
device.pushErrorScope('validation');
const commandEncoder = device.createCommandEncoder();
const passEncoder = commandEncoder.beginRenderPass({
colorAttachments: [
{
view: tex.createView({
dimension: '2d-array',
arrayLayerCount: 1,
}),
clearValue: [0, 0, 0, 0],
loadOp: 'clear',
storeOp: 'store',
},
],
});
passEncoder.end();
device.queue.submit([commandEncoder.finish()]);
const err = await device.popErrorScope();
log(err ? 'pass' : 'fail', ': expected error, got:', err);
}
main();
function log(...args) {
const elem = document.createElement('pre');
elem.textContent = args.join(' ');
document.body.appendChild(elem);
}
{"name":"2d-array render target - should fail","settings":{},"filenames":["index.html","index.css","index.js"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment