Closed Bug 1877114 Opened 2 years ago Closed 2 years ago

Codepen webgpu demo (https://codepen.io/liumingxun/pen/RweXYKq) doesnt render with Nightly

Categories

(Core :: Graphics: WebGPU, defect)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: mayankleoboy1, Unassigned)

References

()

Details

Attachments

(3 files)

Go to https://codepen.io/liumingxun/pen/RweXYKq

AR: Only the blue background is seen. Chrome renders the colorful triangle too.
ER: Not so

Severity: -- → S3

I suspect that we have a Firefox-specific problem in this issue, rather than a WGPU backend problem. With the attached Rust crate source bug-1877114-translated-to-rust.zip, I have translated the JS usage of the WebGPU API to the Rust API of wgpu. Things seem to work more or less as expected. More investigation to do, I guess!

:nical suggested that the next step be to record a WGPU trace from the Firefox execution and the translated Rust code, seeing if there are any different WGPU API calls being made.

AHA! I noticed in comparing a trace (attached as trace-native.zip) from my native Rust port (bug-1877114-translated-to-rust.zip from before) to a trace of Firefox while running the offending CodePen (generated with WGPU_TRACE=… firefox …, attached as trace-ff.zip) that Firefox is specifying a data range of 0...24 (a byte size) for the 24 floats that it uses, while my native code is (correctly) using the byte length, which would write the index range of 0..96 (viz., 24 32-bit floats = 96 bytes in length).

After diving into Firefox source, I have identified that we have a bug where we incorrectly forward the passed size argument of GPUQueue.writeBuffer (an element count). If you remove the size argument for writeBuffer in the offending CodePen (i.e., change device.queue.writeBuffer(vertexBuffer, 0, vertices, 0, vertices.length) to device.queue.writeBuffer(vertexBuffer, 0, vertices, 0), then things render as expected.

I will write a patch for this soon.

No longer blocks: 1882442

This is working now that bug 1879988 is fixed.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: