Skip to content

Instantly share code, notes, and snippets.

@greggman
Created February 8, 2024 18:32
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/c3c56b8d53174453df166a5a2383b1c3 to your computer and use it in GitHub Desktop.
Save greggman/c3c56b8d53174453df166a5a2383b1c3 to your computer and use it in GitHub Desktop.
WebGPU CTS Notes

maxBindGroupsPlusVertexBuffers

This test is not testable in Chrome as of v123 because in Chrome maxBindGroupsPlusVertexBuffers is equal to maxBindGroups + maxVertexBuffers which mean you can't generate something large enough to test.

To test the test itself though, you can paste this into the CTS and you'll also need to set the expected value of maxBindGroupsPlusVertexBuffers in capability_info.js to 12

GPU.prototype.requestAdapter = (function (origFn) {
  return async function (this: GPU, desc: GPURequestAdapterOptions = {}) {
    const adapter = await origFn.call(this, desc);
    Object.defineProperty(adapter.limits, 'maxBindGroupsPlusVertexBuffers', { value: 12 });
    return adapter;
  };
})(GPU.prototype.requestAdapter);

GPUAdapter.prototype.requestDevice = (function (origFn) {
  return async function (this: GPUAdapter, desc: GPUDeviceDescriptor = {}) {
    if (desc.requiredLimits?.maxBindGroupsPlusVertexBuffers > 12) {
      throw new DOMException('too many', "OperationError");
    }
    const device = await origFn.call(this, desc);
    Object.defineProperty(device.limits, 'maxBindGroupsPlusVertexBuffers', { value: 12 });
    return device;
  };
})(GPUAdapter.prototype.requestDevice);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment