denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.99k stars 5.23k forks source link

Include the label attribute of a WebGPU object in error messages #24675

Open matthew-wong1 opened 1 month ago

matthew-wong1 commented 1 month ago

Hi! I think it would be helpful if the label attribute of a WebGPU object was included in any validation error messages.

For example, if I create the following texture:

const texture = device.createTexture({
    label: "Texture 1",
    dimension: "2d",
    sampleCount: 1,
    format: "rgba8unorm-srgb",
    size: { 
        width: 36,
        height: 145,
        depthOrArrayLayers: 34
    },
    mipLevelCount: 10,
    usage: GPUTextureUsage.RENDER_ATTACHMENT.
    viewFormat: ["rgba8unorm"]
});

I'll get the error message: Device::create_texture error: Texture descriptor mip level count 10 is invalid, maximum allowed is 8.

I think it would be helpful if this error message could include the label e.g. Texture 1 in this case, to make it easier to debug. Thanks!

crowlKats commented 1 month ago

wgpu itself supports this, but not wgpu-core (which is what we use). this will be changed once https://github.com/gfx-rs/wgpu/issues/5121 is completed.