Skip to content

Commit

Permalink
WebGPU: temporarily only create dawn_device_ once
Browse files Browse the repository at this point in the history
We create new server Dawn Device for every requestAdapter()
but don't create an analogous client Device. The result is that there
are multiple dawn_wire::Servers and only one dawn_wire::Client which
have completely different namespaces for ObjectIds. Multiple calls to
requestAdapter(...) replace the Server device and messes up object
lookup.

This problem was discovered when rolling tests in the WebGPU CTS into
Chromium. Currently we only have very basic tests. This is a temporary fix
so that so we can roll a more complete test suite before making further
changes.

BUG=chromium:996713
TBR=kbr@chromium.org

Change-Id: I172bf948a8e61bd7149ac2e5bf6d528db53dd7a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832777
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701570}
  • Loading branch information
Jiawei-Shao authored and Commit Bot committed Oct 1, 2019
1 parent 8f80402 commit 9ea9d6d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gpu/command_buffer/service/webgpu_decoder_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@ error::Error WebGPUDecoderImpl::InitDawnDeviceAndSetWireServer(
dawn_native::Adapter* adapter) {
DCHECK(adapter != nullptr && (*adapter));

// TODO(jiawei.shao@intel.com): support multiple Dawn devices.
if (dawn_device_ != nullptr) {
DCHECK(wire_server_);
return error::kNoError;
}

dawn_device_ = adapter->CreateDevice();
if (dawn_device_ == nullptr) {
return error::kLostContext;
Expand Down

0 comments on commit 9ea9d6d

Please sign in to comment.