Skip to content

Commit

Permalink
Bug 1622846 - Update WebGPU API to latest and wgpu-core to 0.9 r=webi…
Browse files Browse the repository at this point in the history
…dl,jgilbert,jimb,emilio

This *mostly* gets us the latest WebIDL API of WebGPU. There is a few limits we are missing, and maybe some things I didn't notice.
But it gets us the new `GPUCanvasContext`, `GPUSupportedLimits`, and `GPUVertexStepMode`.

Differential Revision: https://phabricator.services.mozilla.com/D120764
  • Loading branch information
kvark committed Aug 17, 2021
1 parent 699162f commit 6d7cfc6
Show file tree
Hide file tree
Showing 286 changed files with 38,510 additions and 36,803 deletions.
10 changes: 0 additions & 10 deletions .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ git = "https://github.com/hsivonen/chardetng"
replace-with = "vendored-sources"
rev = "302c995f91f44cf26e77dc4758ad56c3ff0153ad"

[source."https://github.com/gfx-rs/naga"]
git = "https://github.com/gfx-rs/naga"
replace-with = "vendored-sources"
tag = "gfx-25"

[source."https://github.com/gfx-rs/gfx"]
git = "https://github.com/gfx-rs/gfx"
replace-with = "vendored-sources"
rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521"

[source."https://github.com/bytecodealliance/wasmtime"]
git = "https://github.com/bytecodealliance/wasmtime"
replace-with = "vendored-sources"
Expand Down
109 changes: 85 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions dom/bindings/Bindings.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1347,9 +1347,6 @@ DOMInterfaces = {
'GPUAdapterFeatures': {
'nativeType': 'mozilla::webgpu::AdapterFeatures',
},
'GPUAdapterLimits': {
'nativeType': 'mozilla::webgpu::AdapterLimits',
},
'GPUBindGroup': {
'nativeType': 'mozilla::webgpu::BindGroup',
},
Expand Down Expand Up @@ -1417,8 +1414,8 @@ DOMInterfaces = {
'GPUShaderModule': {
'nativeType': 'mozilla::webgpu::ShaderModule',
},
'GPUSwapChain': {
'nativeType': 'mozilla::webgpu::SwapChain',
'GPUSupportedLimits': {
'nativeType': 'mozilla::webgpu::SupportedLimits',
},
'GPUTexture': {
'nativeType': 'mozilla::webgpu::Texture',
Expand Down
8 changes: 5 additions & 3 deletions dom/webgpu/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include "Adapter.h"

#include "AdapterFeatures.h"
#include "AdapterLimits.h"
#include "Device.h"
#include "Instance.h"
#include "SupportedLimits.h"
#include "ipc/WebGPUChild.h"
#include "mozilla/dom/Promise.h"

Expand All @@ -25,7 +25,8 @@ Adapter::Adapter(Instance* const aParent,
mBridge(aParent->mBridge),
mId(aInfo.id),
mFeatures(new AdapterFeatures(this)),
mLimits(new AdapterLimits(this, aInfo.limits)) {}
mLimits(new SupportedLimits(this, aInfo.limits)),
mIsSoftware(aInfo.ty == ffi::WGPUDeviceType_Cpu) {}

Adapter::~Adapter() { Cleanup(); }

Expand All @@ -37,7 +38,8 @@ void Adapter::Cleanup() {
}

const RefPtr<AdapterFeatures>& Adapter::Features() const { return mFeatures; }
const RefPtr<AdapterLimits>& Adapter::Limits() const { return mLimits; }
const RefPtr<SupportedLimits>& Adapter::Limits() const { return mLimits; }
bool Adapter::IsSoftware() const { return mIsSoftware; }

already_AddRefed<dom::Promise> Adapter::RequestDevice(
const dom::GPUDeviceDescriptor& aDesc, ErrorResult& aRv) {
Expand Down
8 changes: 5 additions & 3 deletions dom/webgpu/Adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ struct GPUFeatures;

namespace webgpu {
class AdapterFeatures;
class AdapterLimits;
class Device;
class Instance;
class SupportedLimits;
class WebGPUChild;
namespace ffi {
struct WGPUAdapterInformation;
Expand All @@ -46,13 +46,15 @@ class Adapter final : public ObjectBase, public ChildOf<Instance> {
// Cant have them as `const` right now, since we wouldn't be able
// to unlink them in CC unlink.
RefPtr<AdapterFeatures> mFeatures;
RefPtr<AdapterLimits> mLimits;
RefPtr<SupportedLimits> mLimits;
const bool mIsSoftware = false;

public:
Adapter(Instance* const aParent, const ffi::WGPUAdapterInformation& aInfo);
void GetName(nsString& out) const { out = mName; }
const RefPtr<AdapterFeatures>& Features() const;
const RefPtr<AdapterLimits>& Limits() const;
const RefPtr<SupportedLimits>& Limits() const;
bool IsSoftware() const;

already_AddRefed<dom::Promise> RequestDevice(
const dom::GPUDeviceDescriptor& aDesc, ErrorResult& aRv);
Expand Down
Loading

0 comments on commit 6d7cfc6

Please sign in to comment.