-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for GPUDevice.adapterInfo #4023
Conversation
assert(device.adapterInfo instanceof GPUAdapterInfo); | ||
assert(adapter.info instanceof GPUAdapterInfo); | ||
|
||
for (const k of Object.keys(GPUAdapterInfo.prototype)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Landed the spec; didn't make adapter and device use the same object, so we should test that adapter.info !== device.adapterInfo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec doesn't say they have to be different object, so I wouldn't test that adapter.info !== device.adapterInfo
. Note that Chromium experimental implementation actually returns the same object: https://chromium-review.googlesource.com/c/chromium/src/+/5980752/3/third_party/blink/renderer/modules/webgpu/gpu_device.cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does implicitly require them to be different objects, because a new one is created the first time each of them is accessed, there's no opportunity to return the same one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this PR.
Do you know by any chance how to return a copy of adapter_->info()
in Chromium?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should construct the adapterInfo
when we construct GPUDevice
and store it in a field of GPUDevice
, the same way we do for info
when we construct GPUAdapter
. The initialization will be the same so we should take this code, move it into a GPUAdapter
method called something like CreateAdapterInfoForAdapter()
, have it return the GPUAdapterInfo
object, and then call it from both GPUAdapter::GPUAdapter
and GPUDevice::GPUDevice
.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_adapter.cc;l=198-210;drc=0afc9ac9afcaab79fc54299039f4d27abf3a086d
Tested my changes in Canary with --enable-unsafe-webgpu, still works as expected. |
|
This PR adds simple tests for the adapterInfo GPUDevice member. It can be tested in a Chromium build patched with https://chromium-review.googlesource.com/c/chromium/src/+/5980752. It is available behind the "Unsafe WebGPU support" flag at
chrome://flag#enable-unsafe-webgpu
as the spec PR gpuweb/gpuweb#4809 has not landed yet.Requirements for PR author:
.unimplemented()
./** documented */
and new helper files are found inhelper_index.txt
.Requirements for reviewer sign-off:
When landing this PR, be sure to make any necessary issue status updates.