Skip to content

Commit

Permalink
Bug 1847597: build(webgpu): bump wgpu to 7c6b85756237f77bfe8d6231df…
Browse files Browse the repository at this point in the history
…c7a1412ff662b6 r=webgpu-reviewers,supply-chain-reviewers,nical

Differential Revision: https://phabricator.services.mozilla.com/D185580
  • Loading branch information
ErichDonGubler committed Aug 9, 2023
1 parent e58c09a commit 5bde404
Show file tree
Hide file tree
Showing 43 changed files with 910 additions and 104 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ git = "https://github.com/gfx-rs/naga"
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
replace-with = "vendored-sources"

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

[source."git+https://github.com/glandium/prost?rev=95964e9d33df3c2a9c3f14285e262867cab6f96b"]
Expand Down
6 changes: 3 additions & 3 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 = "09b010b26af6876ce84991576a168a572172f08d"
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
#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 = "09b010b26af6876ce84991576a168a572172f08d"
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
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 = "09b010b26af6876ce84991576a168a572172f08d"
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
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 = "09b010b26af6876ce84991576a168a572172f08d"
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
features = ["vulkan"]

[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "09b010b26af6876ce84991576a168a572172f08d"
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[dependencies.wgh]
package = "wgpu-hal"
git = "https://github.com/gfx-rs/wgpu"
rev = "09b010b26af6876ce84991576a168a572172f08d"
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[dependencies]
bincode = "1"
Expand Down
3 changes: 2 additions & 1 deletion gfx/wgpu_bindings/cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef uint64_t WGPUOption_BindGroupLayoutId;
typedef uint64_t WGPUOption_SamplerId;
typedef uint64_t WGPUOption_SurfaceId;
typedef uint64_t WGPUOption_TextureViewId;
typedef uint64_t WGPUOption_QuerySetId;
"""
include_version = true
braces = "SameLine"
Expand All @@ -44,7 +45,7 @@ exclude = [
"Option_AdapterId", "Option_BufferId", "Option_PipelineLayoutId", "Option_BindGroupLayoutId",
"Option_SamplerId", "Option_SurfaceId", "Option_TextureViewId",
"Option_BufferSize", "Option_NonZeroU32", "Option_NonZeroU8",
"ANativeWindow_setBuffersGeometry",
"ANativeWindow_setBuffersGeometry", "Option_QuerySetId",
]
include = ["BufferUsages"]

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 09b010b26af6876ce84991576a168a572172f08d
release: commit 7c6b85756237f77bfe8d6231dfc7a1412ff662b6

# Revision to pull in
# Must be a long or short commit SHA (long preferred)
revision: 09b010b26af6876ce84991576a168a572172f08d
revision: 7c6b85756237f77bfe8d6231dfc7a1412ff662b6

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

Expand Down
100 changes: 84 additions & 16 deletions gfx/wgpu_bindings/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ pub extern "C" fn wgpu_client_create_texture_view(
.alloc(backend);

let wgpu_desc = wgc::resource::TextureViewDescriptor {
label: label,
label,
format: desc.format.cloned(),
dimension: desc.dimension.cloned(),
range: wgt::ImageSubresourceRange {
Expand Down Expand Up @@ -580,7 +580,7 @@ pub extern "C" fn wgpu_client_create_sampler(
.alloc(backend);

let wgpu_desc = wgc::resource::SamplerDescriptor {
label: label,
label,
address_modes: desc.address_modes,
mag_filter: desc.mag_filter,
min_filter: desc.min_filter,
Expand Down Expand Up @@ -645,7 +645,7 @@ pub extern "C" fn wgpu_device_create_render_bundle_encoder(
.map(|format| Some(format.clone()))
.collect();
let descriptor = wgc::command::RenderBundleEncoderDescriptor {
label: label,
label,
color_formats: Cow::Owned(color_formats),
depth_stencil: desc
.depth_stencil_format
Expand Down Expand Up @@ -729,18 +729,50 @@ pub unsafe extern "C" fn wgpu_client_create_render_bundle_error(
#[repr(C)]
pub struct ComputePassDescriptor<'a> {
pub label: Option<&'a nsACString>,
pub timestamp_writes: Option<&'a ComputePassTimestampWrites<'a>>,
}

#[repr(C)]
pub struct ComputePassTimestampWrites<'a> {
pub query_set: id::QuerySetId,
pub beginning_of_pass_write_index: Option<&'a u32>,
pub end_of_pass_write_index: Option<&'a u32>,
}

#[no_mangle]
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
encoder_id: id::CommandEncoderId,
desc: &ComputePassDescriptor,
) -> *mut wgc::command::ComputePass {
let label = wgpu_string(desc.label);
let &ComputePassDescriptor {
label,
timestamp_writes,
} = desc;

let label = wgpu_string(label);

let timestamp_writes = timestamp_writes.map(|tsw| {
let &ComputePassTimestampWrites {
query_set,
beginning_of_pass_write_index,
end_of_pass_write_index,
} = tsw;
let beginning_of_pass_write_index = beginning_of_pass_write_index.cloned();
let end_of_pass_write_index = end_of_pass_write_index.cloned();
wgc::command::ComputePassTimestampWrites {
query_set,
beginning_of_pass_write_index,
end_of_pass_write_index,
}
});
let timestamp_writes = timestamp_writes.as_ref();

let pass = wgc::command::ComputePass::new(
encoder_id,
&wgc::command::ComputePassDescriptor { label: label },
&wgc::command::ComputePassDescriptor {
label,
timestamp_writes,
},
);
Box::into_raw(Box::new(pass))
}
Expand All @@ -765,26 +797,62 @@ pub struct RenderPassDescriptor<'a> {
pub color_attachments: *const wgc::command::RenderPassColorAttachment,
pub color_attachments_length: usize,
pub depth_stencil_attachment: *const wgc::command::RenderPassDepthStencilAttachment,
pub timestamp_writes: Option<&'a RenderPassTimestampWrites<'a>>,
pub occlusion_query_set: Option<wgc::id::QuerySetId>,
}

#[repr(C)]
pub struct RenderPassTimestampWrites<'a> {
pub query_set: wgc::id::QuerySetId,
pub beginning_of_pass_write_index: Option<&'a u32>,
pub end_of_pass_write_index: Option<&'a u32>,
}

#[no_mangle]
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
encoder_id: id::CommandEncoderId,
desc: &RenderPassDescriptor,
) -> *mut wgc::command::RenderPass {
let label = wgpu_string(desc.label);
let &RenderPassDescriptor {
label,
color_attachments,
color_attachments_length,
depth_stencil_attachment,
timestamp_writes,
occlusion_query_set,
} = desc;

let color_attachments: Vec<_> =
make_slice(desc.color_attachments, desc.color_attachments_length)
.iter()
.map(|format| Some(format.clone()))
.collect();
let label = wgpu_string(label);

let timestamp_writes = timestamp_writes.map(|tsw| {
let &RenderPassTimestampWrites {
query_set,
beginning_of_pass_write_index,
end_of_pass_write_index,
} = tsw;
let beginning_of_pass_write_index = beginning_of_pass_write_index.cloned();
let end_of_pass_write_index = end_of_pass_write_index.cloned();
wgc::command::RenderPassTimestampWrites {
query_set,
beginning_of_pass_write_index,
end_of_pass_write_index,
}
});

let timestamp_writes = timestamp_writes.as_ref();

let color_attachments: Vec<_> = make_slice(color_attachments, color_attachments_length)
.iter()
.map(|format| Some(format.clone()))
.collect();
let pass = wgc::command::RenderPass::new(
encoder_id,
&wgc::command::RenderPassDescriptor {
label: label,
label,
color_attachments: Cow::Owned(color_attachments),
depth_stencil_attachment: desc.depth_stencil_attachment.as_ref(),
depth_stencil_attachment: depth_stencil_attachment.as_ref(),
timestamp_writes,
occlusion_query_set,
},
);
Box::into_raw(Box::new(pass))
Expand Down Expand Up @@ -882,7 +950,7 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group_layout(
});
}
let wgpu_desc = wgc::binding_model::BindGroupLayoutDescriptor {
label: label,
label,
entries: Cow::Owned(entries),
};

Expand All @@ -909,7 +977,7 @@ pub unsafe extern "C" fn wgpu_client_create_pipeline_layout(
.alloc(backend);

let wgpu_desc = wgc::binding_model::PipelineLayoutDescriptor {
label: label,
label,
bind_group_layouts: Cow::Borrowed(make_slice(
desc.bind_group_layouts,
desc.bind_group_layouts_length,
Expand Down Expand Up @@ -959,7 +1027,7 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group(
});
}
let wgpu_desc = wgc::binding_model::BindGroupDescriptor {
label: label,
label,
layout: desc.layout,
entries: Cow::Owned(entries),
};
Expand Down
1 change: 1 addition & 0 deletions gfx/wgpu_bindings/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ mod foreign {
DeviceError::Invalid => ErrorBufferType::Validation,
DeviceError::Lost => ErrorBufferType::None,
DeviceError::OutOfMemory => ErrorBufferType::OutOfMemory,
DeviceError::ResourceCreationFailed => ErrorBufferType::Internal,
}
}
}
Expand Down
19 changes: 14 additions & 5 deletions gfx/wgpu_bindings/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::{

use nsstring::{nsACString, nsCString, nsString};

use wgc::{pipeline::CreateShaderModuleError, resource::BufferAccessError};
use wgc::{gfx_select, id};
use wgc::{pipeline::CreateShaderModuleError, resource::BufferAccessError};

use std::borrow::Cow;
use std::slice;
Expand Down Expand Up @@ -565,10 +565,15 @@ impl Global {
error_buf.init(err);
}
}
CommandEncoderAction::RunComputePass { base } => {
if let Err(err) =
self.command_encoder_run_compute_pass_impl::<A>(self_id, base.as_ref())
{
CommandEncoderAction::RunComputePass {
base,
timestamp_writes,
} => {
if let Err(err) = self.command_encoder_run_compute_pass_impl::<A>(
self_id,
base.as_ref(),
timestamp_writes.as_ref(),
) {
error_buf.init(err);
}
}
Expand Down Expand Up @@ -604,12 +609,16 @@ impl Global {
base,
target_colors,
target_depth_stencil,
timestamp_writes,
occlusion_query_set_id,
} => {
if let Err(err) = self.command_encoder_run_render_pass_impl::<A>(
self_id,
base.as_ref(),
&target_colors,
target_depth_stencil.as_ref(),
timestamp_writes.as_ref(),
occlusion_query_set_id,
) {
error_buf.init(err);
}
Expand Down
15 changes: 15 additions & 0 deletions supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3931,6 +3931,11 @@ who = "Teodor Tanasoaia <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.16.0@git:f71a1bc736fde37509262ca03e91d8f56a13aeb5 -> 0.16.0@git:dcad7dfba92dd85c3ca21bb553a61834e01b04f5"

[[audits.wgpu-core]]
who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[[audits.wgpu-hal]]
who = "Dzmitry Malyshau <[email protected]>"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -4029,6 +4034,11 @@ who = "Teodor Tanasoaia <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.16.0@git:f71a1bc736fde37509262ca03e91d8f56a13aeb5 -> 0.16.0@git:dcad7dfba92dd85c3ca21bb553a61834e01b04f5"

[[audits.wgpu-hal]]
who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[[audits.wgpu-types]]
who = "Dzmitry Malyshau <[email protected]>"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -4127,6 +4137,11 @@ who = "Teodor Tanasoaia <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.16.0@git:f71a1bc736fde37509262ca03e91d8f56a13aeb5 -> 0.16.0@git:dcad7dfba92dd85c3ca21bb553a61834e01b04f5"

[[audits.wgpu-types]]
who = "Erich Gubler <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"

[[audits.whatsys]]
who = "Bobby Holley <[email protected]>"
criteria = "safe-to-deploy"
Expand Down
Loading

0 comments on commit 5bde404

Please sign in to comment.