Skip to content

Commit

Permalink
Bug 1853105 - Update wgpu to revision 7fea9e934efd8d5dc03b9aa3e06b7…
Browse files Browse the repository at this point in the history
…75c1ac4a23e. r=webgpu-reviewers,supply-chain-reviewers,ErichDonGubler

Differential Revision: https://phabricator.services.mozilla.com/D188214
  • Loading branch information
nical committed Sep 20, 2023
1 parent 9aba49c commit d135870
Show file tree
Hide file tree
Showing 60 changed files with 2,152 additions and 1,455 deletions.
8 changes: 4 additions & 4 deletions .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ git = "https://github.com/franziskuskiefer/cose-rust"
rev = "43c22248d136c8b38fe42ea709d08da6355cf04b"
replace-with = "vendored-sources"

[source."git+https://github.com/gfx-rs/naga?rev=7a19f3af909202c7eafd36633b5584bfbb353ecb"]
[source."git+https://github.com/gfx-rs/naga?rev=cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"]
git = "https://github.com/gfx-rs/naga"
rev = "7a19f3af909202c7eafd36633b5584bfbb353ecb"
rev = "cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"
replace-with = "vendored-sources"

[source."git+https://github.com/gfx-rs/wgpu?rev=332cd0325da52675432830870584ec9766679c34"]
[source."git+https://github.com/gfx-rs/wgpu?rev=7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"]
git = "https://github.com/gfx-rs/wgpu"
rev = "332cd0325da52675432830870584ec9766679c34"
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
replace-with = "vendored-sources"

[source."git+https://github.com/glandium/prost?rev=95964e9d33df3c2a9c3f14285e262867cab6f96b"]
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions gfx/wgpu_bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ default = []
[dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "332cd0325da52675432830870584ec9766679c34"
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
#Note: "replay" shouldn't ideally be needed,
# but it allows us to serialize everything across IPC.
features = ["replay", "trace", "serial-pass", "strict_asserts", "wgsl"]
Expand All @@ -27,32 +27,32 @@ features = ["replay", "trace", "serial-pass", "strict_asserts", "wgsl"]
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "332cd0325da52675432830870584ec9766679c34"
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
features = ["metal"]

# We want the wgpu-core Direct3D backends on Windows.
[target.'cfg(windows)'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "332cd0325da52675432830870584ec9766679c34"
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
features = ["dx11", "dx12"]

# We want the wgpu-core Vulkan backend on Linux and Windows.
[target.'cfg(any(windows, all(unix, not(any(target_os = "macos", target_os = "ios")))))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "332cd0325da52675432830870584ec9766679c34"
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
features = ["vulkan"]

[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "332cd0325da52675432830870584ec9766679c34"
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"

[dependencies.wgh]
package = "wgpu-hal"
git = "https://github.com/gfx-rs/wgpu"
rev = "332cd0325da52675432830870584ec9766679c34"
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"

[target.'cfg(windows)'.dependencies]
d3d12 = "0.7.0"
Expand Down
4 changes: 2 additions & 2 deletions gfx/wgpu_bindings/moz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ origin:

# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: commit 332cd0325da52675432830870584ec9766679c34
release: commit 7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e

# Revision to pull in
# Must be a long or short commit SHA (long preferred)
revision: 332cd0325da52675432830870584ec9766679c34
revision: 7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e

license: ['MIT', 'Apache-2.0']

Expand Down
20 changes: 20 additions & 0 deletions supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2283,6 +2283,11 @@ who = "Teodor Tanasoaia <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.12.0@git:b99d58ea435090e561377949f428bce2c18451bb -> 0.12.0@git:76003dc0035d53a474d366dcdf49d2e4d12e921f"

[[audits.naga]]
who = "Nicolas Silva <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.13.0@git:7a19f3af909202c7eafd36633b5584bfbb353ecb -> 0.13.0@git:cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"

[[audits.naga]]
who = "Erich Gubler <[email protected]"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -3992,6 +3997,11 @@ who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[[audits.wgpu-core]]
who = "Nicolas Silva <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:332cd0325da52675432830870584ec9766679c34 -> 0.17.0@git:7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"

[[audits.wgpu-core]]
who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -4100,6 +4110,11 @@ who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[[audits.wgpu-hal]]
who = "Nicolas Silva <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:332cd0325da52675432830870584ec9766679c34 -> 0.17.0@git:7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"

[[audits.wgpu-hal]]
who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -4208,6 +4223,11 @@ who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[[audits.wgpu-types]]
who = "Nicolas Silva <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:332cd0325da52675432830870584ec9766679c34 -> 0.17.0@git:7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"

[[audits.wgpu-types]]
who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
Expand Down
2 changes: 1 addition & 1 deletion third_party/rust/naga/.cargo-checksum.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions third_party/rust/naga/src/back/glsl/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ bitflags::bitflags! {
const TEXTURE_LEVELS = 1 << 19;
/// Image size query
const IMAGE_SIZE = 1 << 20;
/// Dual source blending
const DUAL_SOURCE_BLENDING = 1 << 21;
}
}

Expand Down Expand Up @@ -104,6 +106,7 @@ impl FeaturesManager {
check_feature!(CULL_DISTANCE, 450, 300 /* with extension */);
check_feature!(SAMPLE_VARIABLES, 400, 300);
check_feature!(DYNAMIC_ARRAY_SIZE, 430, 310);
check_feature!(DUAL_SOURCE_BLENDING, 330, 300 /* with extension */);
match version {
Version::Embedded { is_webgl: true, .. } => check_feature!(MULTI_VIEW, 140, 300),
_ => check_feature!(MULTI_VIEW, 140, 310),
Expand Down Expand Up @@ -233,6 +236,10 @@ impl FeaturesManager {
// https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_texture_query_levels.txt
writeln!(out, "#extension GL_ARB_texture_query_levels : require")?;
}
if self.0.contains(Features::DUAL_SOURCE_BLENDING) && version.is_es() {
// https://registry.khronos.org/OpenGL/extensions/EXT/EXT_blend_func_extended.txt
writeln!(out, "#extension GL_EXT_blend_func_extended : require")?;
}

Ok(())
}
Expand Down Expand Up @@ -497,13 +504,17 @@ impl<'a, W> Writer<'a, W> {
location: _,
interpolation,
sampling,
second_blend_source,
} => {
if interpolation == Some(Interpolation::Linear) {
self.features.request(Features::NOPERSPECTIVE_QUALIFIER);
}
if sampling == Some(Sampling::Sample) {
self.features.request(Features::SAMPLE_QUALIFIER);
}
if second_blend_source {
self.features.request(Features::DUAL_SOURCE_BLENDING);
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions third_party/rust/naga/src/back/glsl/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,7 @@ pub const RESERVED_KEYWORDS: &[&str] = &[
// entry point name (should not be shadowed)
//
"main",
// Naga utilities:
super::MODF_FUNCTION,
super::FREXP_FUNCTION,
];
72 changes: 67 additions & 5 deletions third_party/rust/naga/src/back/glsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ pub const SUPPORTED_ES_VERSIONS: &[u16] = &[300, 310, 320];
/// of detail for bounds checking in `ImageLoad`
const CLAMPED_LOD_SUFFIX: &str = "_clamped_lod";

pub(crate) const MODF_FUNCTION: &str = "naga_modf";
pub(crate) const FREXP_FUNCTION: &str = "naga_frexp";

/// Mapping between resources and bindings.
pub type BindingMap = std::collections::BTreeMap<crate::ResourceBinding, u8>;

Expand Down Expand Up @@ -333,6 +336,12 @@ struct VaryingName<'a> {
impl fmt::Display for VaryingName<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self.binding {
crate::Binding::Location {
second_blend_source: true,
..
} => {
write!(f, "_fs2p_location1",)
}
crate::Binding::Location { location, .. } => {
let prefix = match (self.stage, self.output) {
(ShaderStage::Compute, _) => unreachable!(),
Expand Down Expand Up @@ -625,6 +634,53 @@ impl<'a, W: Write> Writer<'a, W> {
}
}

// Write functions to create special types.
for (type_key, struct_ty) in self.module.special_types.predeclared_types.iter() {
match type_key {
&crate::PredeclaredType::ModfResult { size, width }
| &crate::PredeclaredType::FrexpResult { size, width } => {
let arg_type_name_owner;
let arg_type_name = if let Some(size) = size {
arg_type_name_owner =
format!("{}vec{}", if width == 8 { "d" } else { "" }, size as u8);
&arg_type_name_owner
} else if width == 8 {
"double"
} else {
"float"
};

let other_type_name_owner;
let (defined_func_name, called_func_name, other_type_name) =
if matches!(type_key, &crate::PredeclaredType::ModfResult { .. }) {
(MODF_FUNCTION, "modf", arg_type_name)
} else {
let other_type_name = if let Some(size) = size {
other_type_name_owner = format!("ivec{}", size as u8);
&other_type_name_owner
} else {
"int"
};
(FREXP_FUNCTION, "frexp", other_type_name)
};

let struct_name = &self.names[&NameKey::Type(*struct_ty)];

writeln!(self.out)?;
writeln!(
self.out,
"{} {defined_func_name}({arg_type_name} arg) {{
{other_type_name} other;
{arg_type_name} fract = {called_func_name}(arg, other);
return {}(fract, other);
}}",
struct_name, struct_name
)?;
}
&crate::PredeclaredType::AtomicCompareExchangeWeakResult { .. } => {}
}
}

// Write all named constants
let mut constants = self
.module
Expand Down Expand Up @@ -1235,12 +1291,13 @@ impl<'a, W: Write> Writer<'a, W> {
Some(binding) => binding,
};

let (location, interpolation, sampling) = match *binding {
let (location, interpolation, sampling, second_blend_source) = match *binding {
crate::Binding::Location {
location,
interpolation,
sampling,
} => (location, interpolation, sampling),
second_blend_source,
} => (location, interpolation, sampling, second_blend_source),
crate::Binding::BuiltIn(built_in) => {
if let crate::BuiltIn::Position { invariant: true } = built_in {
match (self.options.version, self.entry_point.stage) {
Expand Down Expand Up @@ -1281,7 +1338,11 @@ impl<'a, W: Write> Writer<'a, W> {

// Write the I/O locations, if allowed
if self.options.version.supports_explicit_locations() || !emit_interpolation_and_auxiliary {
write!(self.out, "layout(location = {location}) ")?;
if second_blend_source {
write!(self.out, "layout(location = {location}, index = 1) ")?;
} else {
write!(self.out, "layout(location = {location}) ")?;
}
}

// Write the interpolation qualifier.
Expand Down Expand Up @@ -1318,6 +1379,7 @@ impl<'a, W: Write> Writer<'a, W> {
location,
interpolation: None,
sampling: None,
second_blend_source,
},
stage: self.entry_point.stage,
output,
Expand Down Expand Up @@ -2985,8 +3047,8 @@ impl<'a, W: Write> Writer<'a, W> {
Mf::Round => "roundEven",
Mf::Fract => "fract",
Mf::Trunc => "trunc",
Mf::Modf => "modf",
Mf::Frexp => "frexp",
Mf::Modf => MODF_FUNCTION,
Mf::Frexp => FREXP_FUNCTION,
Mf::Ldexp => "ldexp",
// exponent
Mf::Exp => "exp",
Expand Down
Loading

0 comments on commit d135870

Please sign in to comment.