Commit eba5eb27 authored by Jinho Bang's avatar Jinho Bang Committed by Commit Bot

WebGPU: Change .getQueue() to .defaultQueue

In an effort to support multi-queue with WebGPU, the shape of the API
has changed in the spec side[1].

[1] https://github.com/gpuweb/gpuweb/pull/490

Bug: 852089
Change-Id: I6971ef859f4af1b94663589039009d416f1bc9a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1919531Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716116}
parent a2a05f68
......@@ -114,6 +114,10 @@ ScriptPromise GPUDevice::lost(ScriptState* script_state) {
return lost_property_->Promise(script_state->World());
}
GPUQueue* GPUDevice::defaultQueue() {
return queue_;
}
GPUBuffer* GPUDevice::createBuffer(const GPUBufferDescriptor* descriptor) {
return GPUBuffer::Create(this, descriptor);
}
......@@ -223,10 +227,6 @@ GPURenderBundleEncoder* GPUDevice::createRenderBundleEncoder(
return GPURenderBundleEncoder::Create(this, descriptor);
}
GPUQueue* GPUDevice::getQueue() {
return queue_;
}
void GPUDevice::pushErrorScope(const WTF::String& filter) {
GetProcs().devicePushErrorScope(GetHandle(),
AsDawnEnum<WGPUErrorFilter>(filter));
......
......@@ -70,6 +70,8 @@ class GPUDevice final : public EventTargetWithInlineData,
GPUAdapter* adapter() const;
ScriptPromise lost(ScriptState* script_state);
GPUQueue* defaultQueue();
GPUBuffer* createBuffer(const GPUBufferDescriptor* descriptor);
HeapVector<ScriptValue> createBufferMapped(
ScriptState* script_state,
......@@ -101,8 +103,6 @@ class GPUDevice final : public EventTargetWithInlineData,
GPURenderBundleEncoder* createRenderBundleEncoder(
const GPURenderBundleEncoderDescriptor* descriptor);
GPUQueue* getQueue();
void pushErrorScope(const WTF::String& filter);
ScriptPromise popErrorScope(ScriptState* script_state);
......
......@@ -10,6 +10,8 @@
readonly attribute GPUAdapter adapter;
[CallWith=ScriptState] readonly attribute Promise<GPUDeviceLostInfo> lost;
[SameObject] readonly attribute GPUQueue defaultQueue;
GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
[CallWith=ScriptState, RaisesException] GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor);
[CallWith=ScriptState, RaisesException] Promise<GPUMappedBuffer> createBufferMappedAsync(GPUBufferDescriptor descriptor);
......@@ -26,7 +28,6 @@
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
GPUQueue getQueue();
void pushErrorScope(GPUErrorFilter filter);
[CallWith=ScriptState] Promise<GPUError?> popErrorScope();
......
......@@ -11,6 +11,6 @@ export const g = new TestGroup(GPUTest);
g.test('empty', async t => {
const encoder = t.device.createCommandEncoder();
const cmd = encoder.finish();
t.device.getQueue().submit([cmd]); // TODO: test that submit() succeeded.
t.device.defaultQueue.submit([cmd]); // TODO: test that submit() succeeded.
});
//# sourceMappingURL=basic.spec.js.map
\ No newline at end of file
......@@ -84,7 +84,7 @@ g.test('memcpy', async t => {
pass.setBindGroup(0, bg);
pass.dispatch(1, 1, 1);
pass.endPass();
t.device.getQueue().submit([encoder.finish()]);
t.device.defaultQueue.submit([encoder.finish()]);
t.expectContents(dst, data);
});
//# sourceMappingURL=basic.spec.js.map
\ No newline at end of file
......@@ -22,7 +22,7 @@ g.test('b2b', async t => {
});
const encoder = t.device.createCommandEncoder();
encoder.copyBufferToBuffer(src, 0, dst, 0, 4);
t.device.getQueue().submit([encoder.finish()]);
t.device.defaultQueue.submit([encoder.finish()]);
t.expectContents(dst, data);
});
g.test('b2t2b', async t => {
......@@ -81,7 +81,7 @@ g.test('b2t2b', async t => {
height: 1,
depth: 1
});
t.device.getQueue().submit([encoder.finish()]);
t.device.defaultQueue.submit([encoder.finish()]);
t.expectContents(dst, data);
});
g.test('b2t2t2b', async t => {
......@@ -163,7 +163,7 @@ g.test('b2t2t2b', async t => {
height: 1,
depth: 1
});
t.device.getQueue().submit([encoder.finish()]);
t.device.defaultQueue.submit([encoder.finish()]);
t.expectContents(dst, data);
});
//# sourceMappingURL=copies.spec.js.map
\ No newline at end of file
......@@ -54,7 +54,7 @@ g.test('clear', async t => {
height: 1,
depth: 1
});
t.device.getQueue().submit([encoder.finish()]);
t.device.defaultQueue.submit([encoder.finish()]);
t.expectContents(dst, new Uint8Array([0x00, 0xff, 0x00, 0xff]));
});
//# sourceMappingURL=basic.spec.js.map
\ No newline at end of file
......@@ -111,7 +111,7 @@ g.test('fullscreen quad', async t => {
height: 1,
depth: 1
});
t.device.getQueue().submit([encoder.finish()]);
t.device.defaultQueue.submit([encoder.finish()]);
t.expectContents(dst, new Uint8Array([0x00, 0xff, 0x00, 0xff]));
});
//# sourceMappingURL=rendering.spec.js.map
\ No newline at end of file
......@@ -98,7 +98,7 @@ g.test('storeOp controls whether 1x1 drawn quad is stored', async t => {
height: 1,
depth: 1
});
t.device.getQueue().submit([encoder.finish()]); // expect the buffer to be clear
t.device.defaultQueue.submit([encoder.finish()]); // expect the buffer to be clear
const expectedContent = new Uint32Array([t.params._expected]);
t.expectContents(dstBuffer, expectedContent);
......
......@@ -25,7 +25,7 @@ export class GPUTest extends Fixture {
const gpu = getGPU();
const adapter = await gpu.requestAdapter();
this.device = await adapter.requestDevice();
this.queue = this.device.getQueue();
this.queue = this.device.defaultQueue;
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
if (isSafari) {
......
......@@ -31,7 +31,7 @@ class F extends Fixture {
}); // TODO: Remove when chrome does it automatically.
this.device.getQueue().submit([]);
this.device.defaultQueue.submit([]);
} // Expect an uncapturederror event to occur. Note: this MUST be awaited, because
// otherwise it could erroneously pass by capturing an error from later in the test.
......
......@@ -51,7 +51,7 @@ g.test('increasing fence value by more than 1 succeeds', async t => {
g.test('signal a fence on a different device than it was created on is invalid', async t => {
const fence = t.queue.createFence();
const anotherDevice = await t.device.adapter.requestDevice();
const anotherQueue = anotherDevice.getQueue();
const anotherQueue = anotherDevice.defaultQueue;
t.expectValidationError(() => {
anotherQueue.signal(fence, 2);
});
......@@ -61,7 +61,7 @@ g.test('signal a fence on a different device does not update fence signaled valu
initialValue: 1
});
const anotherDevice = await t.device.adapter.requestDevice();
const anotherQueue = anotherDevice.getQueue();
const anotherQueue = anotherDevice.defaultQueue;
t.expectValidationError(() => {
anotherQueue.signal(fence, 2);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment