Closed Bug 1830762 Opened 1 year ago Closed 1 year ago

`GPUTexture` missing `readonly attribute`s

Categories

(Core :: Graphics: WebGPU, defect)

defect

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: ErichDonGubler, Assigned: ErichDonGubler)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

If you navigate to https://webgpufundamentals.org/webgpu/lessons/webgpu-perspective-projection.html, multiple errors of the following form can be observed:

GPUDevice.createTexture: Element of sequence<unsigned long> branch of (sequence<unsigned long> or GPUExtent3DDict) is not a finite value, so is out of range for unsigned long.

It turns out that our implementation of WebGPU doesn't populate the readonly attributes specified to be on GPUTexture at all! We should, according to section 6.1 ("GPUTexture") of the current WebGPU v1 spec. draft (link).

Summary: `GPUTexture` missing `readonly` attributes → `GPUTexture` missing `readonly attribute`s
No longer blocks: webgpu-v1
Assignee: nobody → egubler
Status: NEW → ASSIGNED

This bug breaks things when visiting https://thimbleberry.dev/. The GPUTexture.format attribute of the returned texture isn't being populated, i.e.:

Uncaught (in promise) TypeError: GPUDevice.createRenderPipeline: Missing required 'format' member of GPUColorTargetState.
    createMosaicPipeline MosaicPipeline.ts:86
    memoMemo MemoMemo.ts:44
    memoizeWithDevice CacheKeyWithDevice.ts:33
    get pipeline MosaicShader.ts:101

Just to fill in some details:

Those error messages are from GPUDevice.create... methods, but that's because the caller is passing a descriptor whose fields are initialized with values taken from some other texture. For example, webgpufundamentals.org is saying:

      // Get the current texture from the canvas context and
      // set it as the texture to render to.
      const canvasTexture = context.getCurrentTexture();
      renderPassDescriptor.colorAttachments[0].view = canvasTexture.createView();

      // If we don't have a depth texture OR if its size is different
      // from the canvasTexture when make a new depth texture
      if (!depthTexture ||
          depthTexture.width !== canvasTexture.width ||
          depthTexture.height !== canvasTexture.height) {
        if (depthTexture) {
          depthTexture.destroy();
        }
        depthTexture = device.createTexture({
          size: [canvasTexture.width, canvasTexture.height],
          format: 'depth24plus',
          usage: GPUTextureUsage.RENDER_ATTACHMENT,
        });
      }

Because canvasTexture.width / height / etc. are all undefined, the argument to device.createTexture is bogus. The error messages are the DOM bindings complaining when they try to build a C++ mozilla::dom::GPUTextureDescriptor from the JS object.

Attachment #9331034 - Attachment description: WIP: Bug 1830762: refactor(webgpu): move `ConvertExtent{,3DToFFI}` to new `Util` module r=#webgpu-reviewers → Bug 1830762: refactor(webgpu): move `ConvertExtent{,3DToFFI}` to new `Util` module r=#webgpu-reviewers
Attachment #9331035 - Attachment description: WIP: Bug 1830762: refactor(webgpu): add `Owning*` variant for `ConvertExtent{,3DtoFFI}` r=#webgpu-reviewers → Bug 1830762: refactor(webgpu): add `Owning*` variant for `ConvertExtent{,3DtoFFI}` r=#webgpu-reviewers
Attachment #9331036 - Attachment description: WIP: Bug 1830762: populate standard attributes for `GPUTexture` r=#webgpu-reviewers → Bug 1830762: populate standard attributes for `GPUTexture` r=#webgpu-reviewers
Attachment #9331034 - Attachment description: Bug 1830762: refactor(webgpu): move `ConvertExtent{,3DToFFI}` to new `Util` module r=#webgpu-reviewers → Bug 1830762: refactor(webgpu): move `ConvertExtent{,3DToFFI}` to new `Utility` module r=#webgpu-reviewers
Pushed by egubler@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5e19f3cbd315
refactor(webgpu): move `ConvertExtent{,3DToFFI}` to new `Utility` module r=webgpu-reviewers,jimb
https://hg.mozilla.org/integration/autoland/rev/e7fd9323eaad
refactor(webgpu): add `Owning*` variant for `ConvertExtent{,3DtoFFI}` r=webgpu-reviewers,jimb
https://hg.mozilla.org/integration/autoland/rev/7688e7d3bd4e
populate standard attributes for `GPUTexture` r=webgpu-reviewers,webidl,saschanaz,jimb,jgilbert
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: