gpuweb / cts

WebGPU Conformance Test Suite
https://gpuweb.github.io/cts/
BSD 3-Clause "New" or "Revised" License
129 stars 82 forks source link

val? op? test for unusual objects as descriptors needed? #2205

Open greggman opened 1 year ago

greggman commented 1 year ago

Is a test needed for unusual descriptors? (already tested?)

Examples: All of these work (as expected) but maybe they might not in some browsers?

    const code = `@compute @workgroup_size(64u) fn main() {}`;

    class MyClass {
      constructor() {
        this.code = code;
      }
    };
    device.createShaderModule(new MyClass());

    const f32 = new Float32Array(123);
    f32.code = code;
    device.createShaderModule(f32);

    const num = new Number(123);
    num.code = code;
    device.createShaderModule(num);

    const fn = function() {};
    fn.code = code;
    device.createShaderModule(fn);

    const img = new Image()
    img.code = code;
    device.createShaderModule(img);
kainino0x commented 1 year ago

Wouldn't hurt to have at least one basic test of this, though I wouldn't prioritize it.

Patterns like this should be guaranteed by WebIDL, so should work in conformant WebIDL implementations. Not every implementation uses a bindings generator as holistic as Blink's, but I would still expect this to be testing correctness of the bindings generator, so I don't think we need to test things like this for every single API call in WebGPU.

Some add to this list would be: