Skip to content

Commit

Permalink
Bug 1622846 - Update wgpu to 5f6c067 r=jimb,emilio
Browse files Browse the repository at this point in the history
Update GPUTextureUsage bit names to match upstream.

Differential Revision: https://phabricator.services.mozilla.com/D132058
  • Loading branch information
kvark committed Nov 29, 2021
1 parent 52a6f31 commit e366d37
Show file tree
Hide file tree
Showing 347 changed files with 26,854 additions and 45,004 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ rev = "302c995f91f44cf26e77dc4758ad56c3ff0153ad"
[source."https://github.com/gfx-rs/wgpu"]
git = "https://github.com/gfx-rs/wgpu"
replace-with = "vendored-sources"
rev = "37288a6"
rev = "5f6c067"

[source."https://github.com/gfx-rs/naga"]
git = "https://github.com/gfx-rs/naga"
replace-with = "vendored-sources"
rev = "e226cf3"
rev = "29571cc"

[source."https://github.com/bytecodealliance/wasmtime"]
git = "https://github.com/bytecodealliance/wasmtime"
Expand Down
57 changes: 29 additions & 28 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions dom/webgpu/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ already_AddRefed<Texture> Device::InitSwapChain(
return CreateTexture(desc);
}

bool Device::CheckNewWarning(const nsACString& aMessage) {
return mKnownWarnings.EnsureInserted(aMessage);
}

void Device::Destroy() {
// TODO
}
Expand Down
3 changes: 3 additions & 0 deletions dom/webgpu/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define GPU_DEVICE_H_

#include "ObjectModel.h"
#include "nsTHashSet.h"
#include "mozilla/MozPromise.h"
#include "mozilla/RefPtr.h"
#include "mozilla/webgpu/WebGPUTypes.h"
Expand Down Expand Up @@ -93,6 +94,7 @@ class Device final : public DOMEventTargetHelper {
const dom::GPUCanvasConfiguration& aDesc,
wr::ExternalImageId aExternalImageId, gfx::SurfaceFormat aFormat,
gfx::IntSize* aDefaultSize);
bool CheckNewWarning(const nsACString& aMessage);

private:
~Device();
Expand All @@ -102,6 +104,7 @@ class Device final : public DOMEventTargetHelper {
bool mValid = true;
nsString mLabel;
RefPtr<Queue> mQueue;
nsTHashSet<nsCString> mKnownWarnings;

public:
void GetLabel(nsAString& aValue) const;
Expand Down
23 changes: 14 additions & 9 deletions dom/webgpu/ipc/WebGPUChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "mozilla/webgpu/ffi/wgpu.h"
#include "Sampler.h"

const int MAX_KNOWN_WARNINGS = 10;

namespace mozilla {
namespace webgpu {

Expand Down Expand Up @@ -830,15 +832,18 @@ ipc::IPCResult WebGPUChild::RecvDeviceUncapturedError(
} else {
auto* target = targetIter->second;
MOZ_ASSERT(target);
JsWarning(target->GetOwnerGlobal(), aMessage);

dom::GPUUncapturedErrorEventInit init;
init.mError.SetAsGPUValidationError() =
new ValidationError(target, aMessage);
RefPtr<mozilla::dom::GPUUncapturedErrorEvent> event =
dom::GPUUncapturedErrorEvent::Constructor(target, u"uncapturederror"_ns,
init);
target->DispatchEvent(*event);
// We don't want to spam the errors to the console indefinitely
if (target->CheckNewWarning(aMessage)) {
JsWarning(target->GetOwnerGlobal(), aMessage);

dom::GPUUncapturedErrorEventInit init;
init.mError.SetAsGPUValidationError() =
new ValidationError(target, aMessage);
RefPtr<mozilla::dom::GPUUncapturedErrorEvent> event =
dom::GPUUncapturedErrorEvent::Constructor(
target, u"uncapturederror"_ns, init);
target->DispatchEvent(*event);
}
}
return IPC_OK();
}
Expand Down
4 changes: 2 additions & 2 deletions dom/webidl/WebGPU.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
interface GPUTextureUsage {
const GPUTextureUsageFlags COPY_SRC = 0x01;
const GPUTextureUsageFlags COPY_DST = 0x02;
const GPUTextureUsageFlags SAMPLED = 0x04;
const GPUTextureUsageFlags STORAGE = 0x08;
const GPUTextureUsageFlags TEXTURE_BINDING = 0x04;
const GPUTextureUsageFlags STORAGE_BINDING = 0x08;
const GPUTextureUsageFlags RENDER_ATTACHMENT = 0x10;
};

Expand Down
8 changes: 5 additions & 3 deletions gfx/wgpu_bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ default = []
[dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "37288a6"
rev = "5f6c067"
#Note: "replay" shouldn't ideally be needed,
# but it allows us to serialize everything across IPC.
features = ["replay", "trace", "serial-pass"]

[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "37288a6"
rev = "5f6c067"

[dependencies.wgh]
package = "wgpu-hal"
git = "https://github.com/gfx-rs/wgpu"
rev = "37288a6"
rev = "5f6c067"

[dependencies]
bincode = "1"
Expand Down
20 changes: 14 additions & 6 deletions gfx/wgpu_bindings/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub struct PrimitiveState<'a> {
front_face: wgt::FrontFace,
cull_mode: Option<&'a wgt::Face>,
polygon_mode: wgt::PolygonMode,
clamp_depth: bool,
unclipped_depth: bool,
}

impl PrimitiveState<'_> {
Expand All @@ -145,7 +145,7 @@ impl PrimitiveState<'_> {
front_face: self.front_face.clone(),
cull_mode: self.cull_mode.cloned(),
polygon_mode: self.polygon_mode,
clamp_depth: self.clamp_depth,
unclipped_depth: self.unclipped_depth,
conservative: false,
}
}
Expand Down Expand Up @@ -628,6 +628,7 @@ pub extern "C" fn wgpu_device_create_render_bundle_encoder(
stencil_read_only: false,
}),
sample_count: desc.sample_count,
multiview: None,
};
match wgc::command::RenderBundleEncoder::new(&descriptor, device_id, None) {
Ok(encoder) => Box::into_raw(Box::new(encoder)),
Expand Down Expand Up @@ -777,10 +778,15 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group_layout(
has_dynamic_offset: entry.has_dynamic_offset,
min_binding_size: entry.min_binding_size,
},
RawBindingType::Sampler => wgt::BindingType::Sampler {
comparison: entry.sampler_compare,
filtering: entry.sampler_filter,
},
RawBindingType::Sampler => wgt::BindingType::Sampler(
if entry.sampler_compare {
wgt::SamplerBindingType::Comparison
} else if entry.sampler_filter {
wgt::SamplerBindingType::Filtering
} else {
wgt::SamplerBindingType::NonFiltering
}
),
RawBindingType::SampledTexture => wgt::BindingType::Texture {
//TODO: the spec has a bug here
view_dimension: *entry
Expand Down Expand Up @@ -915,6 +921,7 @@ pub unsafe extern "C" fn wgpu_client_create_shader_module(
std::str::from_utf8_unchecked(std::slice::from_raw_parts(desc.code, desc.code_length));
let desc = wgc::pipeline::ShaderModuleDescriptor {
label: cow_label(&desc.label),
shader_bound_checks: wgt::ShaderBoundChecks::new(),
};

let action = DeviceAction::CreateShaderModule(id, desc, Cow::Borrowed(code));
Expand Down Expand Up @@ -979,6 +986,7 @@ pub unsafe extern "C" fn wgpu_client_create_render_pipeline(
primitive: desc.primitive.to_wgpu(),
depth_stencil: desc.depth_stencil.cloned(),
multisample: desc.multisample.clone(),
multiview: None,
};

let implicit = match desc.layout {
Expand Down
4 changes: 2 additions & 2 deletions gfx/wgpu_bindings/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ impl GlobalExt for Global {
error_buf.init(err);
}
}
CommandEncoderAction::ClearBuffer { dst, offset, size } => {
if let Err(err) = self.command_encoder_clear_buffer::<A>(self_id, dst, offset, size)
CommandEncoderAction::FillBuffer { dst, offset, size } => {
if let Err(err) = self.command_encoder_fill_buffer::<A>(self_id, dst, offset, size)
{
error_buf.init(err);
}
Expand Down
1 change: 0 additions & 1 deletion third_party/rust/fixedbitset/.cargo-checksum.json

This file was deleted.

35 changes: 0 additions & 35 deletions third_party/rust/fixedbitset/Cargo.toml

This file was deleted.

Loading

0 comments on commit e366d37

Please sign in to comment.