mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1854615 - Update wgpu
to revision 7e0d6c971f900f6a8f01a9de9c41f7894164a82c. r=webgpu-reviewers,supply-chain-reviewers,teoxoy
Differential Revision: https://phabricator.services.mozilla.com/D188978
This commit is contained in:
parent
ecec2b59ac
commit
5a050d7c41
@ -25,14 +25,19 @@ git = "https://github.com/franziskuskiefer/cose-rust"
|
||||
rev = "43c22248d136c8b38fe42ea709d08da6355cf04b"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/gfx-rs/naga?rev=cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"
|
||||
[source."git+https://github.com/gfx-rs/metal-rs/?rev=d24f1a4"]
|
||||
git = "https://github.com/gfx-rs/metal-rs/"
|
||||
rev = "d24f1a4"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/gfx-rs/wgpu?rev=7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"]
|
||||
[source."git+https://github.com/gfx-rs/naga?rev=df8107b7"]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "df8107b7"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/gfx-rs/wgpu?rev=7e0d6c971f900f6a8f01a9de9c41f7894164a82c"]
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
rev = "7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/glandium/prost?rev=95964e9d33df3c2a9c3f14285e262867cab6f96b"]
|
||||
|
11
Cargo.lock
generated
11
Cargo.lock
generated
@ -3348,8 +3348,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "metal"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "623b5e6cefd76e58f774bd3cc0c6f5c7615c58c03a97815245a25c3c9bdee318"
|
||||
source = "git+https://github.com/gfx-rs/metal-rs/?rev=d24f1a4#d24f1a4ae92470bf87a0c65ecfe78c9299835505"
|
||||
dependencies = [
|
||||
"bitflags 2.999.999",
|
||||
"block",
|
||||
@ -3725,7 +3724,7 @@ checksum = "a2983372caf4480544083767bf2d27defafe32af49ab4df3a0b7fc90793a3664"
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gfx-rs/naga?rev=cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c#cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"
|
||||
source = "git+https://github.com/gfx-rs/naga?rev=df8107b7#df8107b78812cc2b1e3d5de35279cedc1f0da3fb"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bitflags 2.999.999",
|
||||
@ -6302,7 +6301,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.17.0"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e#7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7e0d6c971f900f6a8f01a9de9c41f7894164a82c#7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
@ -6325,7 +6324,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "0.17.0"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e#7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7e0d6c971f900f6a8f01a9de9c41f7894164a82c#7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
@ -6361,7 +6360,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "wgpu-types"
|
||||
version = "0.17.0"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e#7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7e0d6c971f900f6a8f01a9de9c41f7894164a82c#7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
dependencies = [
|
||||
"bitflags 2.999.999",
|
||||
"js-sys",
|
||||
|
@ -17,7 +17,7 @@ default = []
|
||||
[dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
rev = "7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
#Note: "replay" shouldn't ideally be needed,
|
||||
# but it allows us to serialize everything across IPC.
|
||||
features = ["replay", "trace", "serial-pass", "strict_asserts", "wgsl"]
|
||||
@ -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 = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
rev = "7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
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 = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
rev = "7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
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 = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
rev = "7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
features = ["vulkan"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
rev = "7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
|
||||
[dependencies.wgh]
|
||||
package = "wgpu-hal"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e"
|
||||
rev = "7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
d3d12 = "0.7.0"
|
||||
|
@ -20,11 +20,11 @@ origin:
|
||||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: commit 7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e
|
||||
release: commit 7e0d6c971f900f6a8f01a9de9c41f7894164a82c
|
||||
|
||||
# Revision to pull in
|
||||
# Must be a long or short commit SHA (long preferred)
|
||||
revision: 7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e
|
||||
revision: 7e0d6c971f900f6a8f01a9de9c41f7894164a82c
|
||||
|
||||
license: ['MIT', 'Apache-2.0']
|
||||
|
||||
|
@ -2147,6 +2147,11 @@ who = "Erich Gubler <egubler@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.25.0 -> 0.26.0"
|
||||
|
||||
[[audits.metal]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.26.0 -> 0.26.0@git:d24f1a4ae92470bf87a0c65ecfe78c9299835505"
|
||||
|
||||
[[audits.midir]]
|
||||
who = "Bobby Holley <bobbyholley@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -2298,6 +2303,11 @@ who = "Erich Gubler <egubler@mozilla.com"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.13.0@git:bac2d82a430fbfcf100ee22b7c3bc12f3d593079 -> 0.13.0@git:7a19f3af909202c7eafd36633b5584bfbb353ecb"
|
||||
|
||||
[[audits.naga]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.13.0@git:cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c -> 0.13.0@git:df8107b78812cc2b1e3d5de35279cedc1f0da3fb"
|
||||
|
||||
[[audits.net2]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-run"
|
||||
@ -4012,6 +4022,11 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6 -> 0.17.0@git:332cd0325da52675432830870584ec9766679c34"
|
||||
|
||||
[[audits.wgpu-core]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e -> 0.17.0@git:7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
|
||||
[[audits.wgpu-hal]]
|
||||
who = "Dzmitry Malyshau <kvark@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -4125,6 +4140,11 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6 -> 0.17.0@git:332cd0325da52675432830870584ec9766679c34"
|
||||
|
||||
[[audits.wgpu-hal]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e -> 0.17.0@git:7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
|
||||
[[audits.wgpu-types]]
|
||||
who = "Dzmitry Malyshau <kvark@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -4238,6 +4258,11 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6 -> 0.17.0@git:332cd0325da52675432830870584ec9766679c34"
|
||||
|
||||
[[audits.wgpu-types]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7fea9e934efd8d5dc03b9aa3e06b775c1ac4a23e -> 0.17.0@git:7e0d6c971f900f6a8f01a9de9c41f7894164a82c"
|
||||
|
||||
[[audits.whatsys]]
|
||||
who = "Bobby Holley <bobbyholley@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
|
@ -100,6 +100,10 @@ notes = "This was originally servo code which Bobby Holley put on crates.io some
|
||||
audit-as-crates-io = false
|
||||
notes = "This is a first-party crate which is also published to crates.io. We certify audits for this crate as part of the documented release process, but that step happens after the version bump lands on central so we don't enforce it here."
|
||||
|
||||
[policy.metal]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream project which we pin."
|
||||
|
||||
[policy.midir]
|
||||
audit-as-crates-io = true
|
||||
notes = "This is a pinned version of the upstream code, presumably to get a fix that hadn't been released yet. We should consider switching to the latest official release."
|
||||
|
2
third_party/rust/metal/.cargo-checksum.json
vendored
2
third_party/rust/metal/.cargo-checksum.json
vendored
File diff suppressed because one or more lines are too long
51
third_party/rust/metal/.github/workflows/ci.yml
vendored
Normal file
51
third_party/rust/metal/.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: ci
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUSTFLAGS: "-Cdebuginfo=0 --deny=warnings"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
channel: [stable, nightly]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: ${{ matrix.channel }}
|
||||
|
||||
- name: Rust Version Info
|
||||
run: rustc --version && cargo --version
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-${{ matrix.channel }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-${{ matrix.channel }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo build
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-${{ matrix.channel }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: cargo check
|
||||
run: cargo check --all-features
|
||||
|
||||
- name: Run all tests
|
||||
run: cargo test --all-features
|
1516
third_party/rust/metal/Cargo.lock
generated
vendored
1516
third_party/rust/metal/Cargo.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
55
third_party/rust/metal/Cargo.toml
vendored
55
third_party/rust/metal/Cargo.toml
vendored
@ -90,55 +90,36 @@ required-features = ["dispatch"]
|
||||
[[example]]
|
||||
name = "fence"
|
||||
|
||||
[dependencies.bitflags]
|
||||
version = "2"
|
||||
|
||||
[dependencies.block]
|
||||
version = "0.1.6"
|
||||
|
||||
[dependencies.core-graphics-types]
|
||||
version = "0.1"
|
||||
[dependencies]
|
||||
bitflags = "2"
|
||||
block = "0.1.6"
|
||||
core-graphics-types = "0.1"
|
||||
foreign-types = "0.5"
|
||||
log = "0.4"
|
||||
paste = "1"
|
||||
|
||||
[dependencies.dispatch]
|
||||
version = "0.2"
|
||||
optional = true
|
||||
|
||||
[dependencies.foreign-types]
|
||||
version = "0.5"
|
||||
|
||||
[dependencies.log]
|
||||
version = "0.4"
|
||||
|
||||
[dependencies.objc]
|
||||
version = "0.2.4"
|
||||
features = ["objc_exception"]
|
||||
|
||||
[dependencies.paste]
|
||||
version = "1"
|
||||
|
||||
[dev-dependencies.cocoa]
|
||||
version = "0.24.0"
|
||||
|
||||
[dev-dependencies.cty]
|
||||
version = "0.2.1"
|
||||
|
||||
[dev-dependencies.glam]
|
||||
version = "0.22"
|
||||
|
||||
[dev-dependencies.png]
|
||||
version = "0.17"
|
||||
|
||||
[dev-dependencies.rand]
|
||||
version = "0.8"
|
||||
|
||||
[dev-dependencies.sema]
|
||||
version = "0.1.4"
|
||||
|
||||
[dev-dependencies.winit]
|
||||
version = "0.27"
|
||||
[dev-dependencies]
|
||||
cocoa = "0.24.0"
|
||||
cty = "0.2.1"
|
||||
glam = "0.22"
|
||||
png = "0.17"
|
||||
rand = "0.8"
|
||||
sema = "0.1.4"
|
||||
winit = "0.27"
|
||||
|
||||
[features]
|
||||
default = ["link"]
|
||||
link = []
|
||||
mps = []
|
||||
private = []
|
||||
|
||||
[workspace]
|
||||
members = ["examples/texture"]
|
||||
|
1
third_party/rust/metal/examples/headless-render/.gitignore
vendored
Normal file
1
third_party/rust/metal/examples/headless-render/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
out.png
|
102
third_party/rust/metal/src/blitpass.rs
vendored
Normal file
102
third_party/rust/metal/src/blitpass.rs
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
use super::*;
|
||||
|
||||
/// See <https://developer.apple.com/documentation/metal/mtlblitpassdescriptor>
|
||||
pub enum MTLBlitPassDescriptor {}
|
||||
|
||||
foreign_obj_type! {
|
||||
type CType = MTLBlitPassDescriptor;
|
||||
pub struct BlitPassDescriptor;
|
||||
}
|
||||
|
||||
impl BlitPassDescriptor {
|
||||
/// Creates a default blit command pass descriptor with no attachments.
|
||||
pub fn new<'a>() -> &'a BlitPassDescriptorRef {
|
||||
unsafe { msg_send![class!(MTLBlitPassDescriptor), blitPassDescriptor] }
|
||||
}
|
||||
}
|
||||
|
||||
impl BlitPassDescriptorRef {
|
||||
// See <https://developer.apple.com/documentation/metal/mtlblitpassdescriptor>
|
||||
pub fn sample_buffer_attachments(&self) -> &BlitPassSampleBufferAttachmentDescriptorArrayRef {
|
||||
unsafe { msg_send![self, sampleBufferAttachments] }
|
||||
}
|
||||
}
|
||||
|
||||
/// See <https://developer.apple.com/documentation/metal/mtlblitpasssamplebufferattachmentdescriptorarray>
|
||||
pub enum MTLBlitPassSampleBufferAttachmentDescriptorArray {}
|
||||
|
||||
foreign_obj_type! {
|
||||
type CType = MTLBlitPassSampleBufferAttachmentDescriptorArray;
|
||||
pub struct BlitPassSampleBufferAttachmentDescriptorArray;
|
||||
}
|
||||
|
||||
impl BlitPassSampleBufferAttachmentDescriptorArrayRef {
|
||||
pub fn object_at(
|
||||
&self,
|
||||
index: NSUInteger,
|
||||
) -> Option<&BlitPassSampleBufferAttachmentDescriptorRef> {
|
||||
unsafe { msg_send![self, objectAtIndexedSubscript: index] }
|
||||
}
|
||||
|
||||
pub fn set_object_at(
|
||||
&self,
|
||||
index: NSUInteger,
|
||||
attachment: Option<&BlitPassSampleBufferAttachmentDescriptorRef>,
|
||||
) {
|
||||
unsafe {
|
||||
msg_send![self, setObject:attachment
|
||||
atIndexedSubscript:index]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// See <https://developer.apple.com/documentation/metal/mtlblitpasssamplebufferattachmentdescriptor>
|
||||
pub enum MTLBlitPassSampleBufferAttachmentDescriptor {}
|
||||
|
||||
foreign_obj_type! {
|
||||
type CType = MTLBlitPassSampleBufferAttachmentDescriptor;
|
||||
pub struct BlitPassSampleBufferAttachmentDescriptor;
|
||||
}
|
||||
|
||||
impl BlitPassSampleBufferAttachmentDescriptor {
|
||||
pub fn new() -> Self {
|
||||
let class = class!(MTLBlitPassSampleBufferAttachmentDescriptor);
|
||||
unsafe { msg_send![class, new] }
|
||||
}
|
||||
}
|
||||
|
||||
impl BlitPassSampleBufferAttachmentDescriptorRef {
|
||||
pub fn sample_buffer(&self) -> &CounterSampleBufferRef {
|
||||
unsafe { msg_send![self, sampleBuffer] }
|
||||
}
|
||||
|
||||
pub fn set_sample_buffer(&self, sample_buffer: &CounterSampleBufferRef) {
|
||||
unsafe { msg_send![self, setSampleBuffer: sample_buffer] }
|
||||
}
|
||||
|
||||
pub fn start_of_encoder_sample_index(&self) -> NSUInteger {
|
||||
unsafe { msg_send![self, startOfEncoderSampleIndex] }
|
||||
}
|
||||
|
||||
pub fn set_start_of_encoder_sample_index(&self, start_of_encoder_sample_index: NSUInteger) {
|
||||
unsafe {
|
||||
msg_send![
|
||||
self,
|
||||
setStartOfEncoderSampleIndex: start_of_encoder_sample_index
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn end_of_encoder_sample_index(&self) -> NSUInteger {
|
||||
unsafe { msg_send![self, endOfEncoderSampleIndex] }
|
||||
}
|
||||
|
||||
pub fn set_end_of_encoder_sample_index(&self, end_of_encoder_sample_index: NSUInteger) {
|
||||
unsafe {
|
||||
msg_send![
|
||||
self,
|
||||
setEndOfEncoderSampleIndex: end_of_encoder_sample_index
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
35
third_party/rust/metal/src/commandbuffer.rs
vendored
35
third_party/rust/metal/src/commandbuffer.rs
vendored
@ -109,10 +109,31 @@ impl CommandBufferRef {
|
||||
unsafe { msg_send![self, blitCommandEncoder] }
|
||||
}
|
||||
|
||||
pub fn blit_command_encoder_with_descriptor(
|
||||
&self,
|
||||
descriptor: &BlitPassDescriptorRef,
|
||||
) -> &BlitCommandEncoderRef {
|
||||
unsafe { msg_send![self, blitCommandEncoderWithDescriptor: descriptor] }
|
||||
}
|
||||
|
||||
pub fn new_compute_command_encoder(&self) -> &ComputeCommandEncoderRef {
|
||||
unsafe { msg_send![self, computeCommandEncoder] }
|
||||
}
|
||||
|
||||
pub fn compute_command_encoder_with_dispatch_type(
|
||||
&self,
|
||||
ty: MTLDispatchType,
|
||||
) -> &ComputeCommandEncoderRef {
|
||||
unsafe { msg_send![self, computeCommandEncoderWithDispatchType: ty] }
|
||||
}
|
||||
|
||||
pub fn compute_command_encoder_with_descriptor(
|
||||
&self,
|
||||
descriptor: &ComputePassDescriptorRef,
|
||||
) -> &ComputeCommandEncoderRef {
|
||||
unsafe { msg_send![self, computeCommandEncoderWithDescriptor: descriptor] }
|
||||
}
|
||||
|
||||
pub fn new_render_command_encoder(
|
||||
&self,
|
||||
descriptor: &RenderPassDescriptorRef,
|
||||
@ -133,20 +154,6 @@ impl CommandBufferRef {
|
||||
unsafe { msg_send![self, accelerationStructureCommandEncoder] }
|
||||
}
|
||||
|
||||
pub fn compute_command_encoder_with_dispatch_type(
|
||||
&self,
|
||||
ty: MTLDispatchType,
|
||||
) -> &ComputeCommandEncoderRef {
|
||||
unsafe { msg_send![self, computeCommandEncoderWithDispatchType: ty] }
|
||||
}
|
||||
|
||||
pub fn compute_command_encoder_with_descriptor(
|
||||
&self,
|
||||
descriptor: &ComputePassDescriptorRef,
|
||||
) -> &ComputeCommandEncoderRef {
|
||||
unsafe { msg_send![self, computeCommandEncoderWithDescriptor: descriptor] }
|
||||
}
|
||||
|
||||
pub fn encode_signal_event(&self, event: &EventRef, new_value: u64) {
|
||||
unsafe {
|
||||
msg_send![self,
|
||||
|
13
third_party/rust/metal/src/device.rs
vendored
13
third_party/rust/metal/src/device.rs
vendored
@ -1958,6 +1958,19 @@ impl DeviceRef {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_indirect_command_buffer_with_descriptor(
|
||||
&self,
|
||||
descriptor: &IndirectCommandBufferDescriptorRef,
|
||||
max_command_count: NSUInteger,
|
||||
options: MTLResourceOptions,
|
||||
) -> IndirectCommandBuffer {
|
||||
unsafe {
|
||||
msg_send![self, newIndirectCommandBufferWithDescriptor:descriptor
|
||||
maxCommandCount:max_command_count
|
||||
options:options]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_texture(&self, descriptor: &TextureDescriptorRef) -> Texture {
|
||||
unsafe { msg_send![self, newTextureWithDescriptor: descriptor] }
|
||||
}
|
||||
|
87
third_party/rust/metal/src/encoder.rs
vendored
87
third_party/rust/metal/src/encoder.rs
vendored
@ -9,6 +9,9 @@ use super::*;
|
||||
|
||||
use std::ops::Range;
|
||||
|
||||
/// See <https://developer.apple.com/documentation/metal/mtlcounterdontsample>
|
||||
pub const COUNTER_DONT_SAMPLE: NSUInteger = NSUInteger::MAX; // #define MTLCounterDontSample ((NSUInteger)-1)
|
||||
|
||||
/// See <https://developer.apple.com/documentation/metal/mtlprimitivetype>
|
||||
#[repr(u64)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
@ -1215,6 +1218,22 @@ impl RenderCommandEncoderRef {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/// See: <https://developer.apple.com/documentation/metal/mtlrendercommandencoder/3194379-samplecountersinbuffer>
|
||||
pub fn sample_counters_in_buffer(
|
||||
&self,
|
||||
sample_buffer: &CounterSampleBufferRef,
|
||||
sample_index: NSUInteger,
|
||||
with_barrier: bool,
|
||||
) {
|
||||
unsafe {
|
||||
msg_send![self,
|
||||
sampleCountersInBuffer: sample_buffer
|
||||
atSampleIndex: sample_index
|
||||
withBarrier: with_barrier
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// See <https://developer.apple.com/documentation/metal/mtlblitcommandencoder/>
|
||||
@ -1396,6 +1415,45 @@ impl BlitCommandEncoderRef {
|
||||
unsafe { msg_send![self, waitForFence: fence] }
|
||||
}
|
||||
|
||||
pub fn copy_indirect_command_buffer(
|
||||
&self,
|
||||
source: &IndirectCommandBufferRef,
|
||||
source_range: NSRange,
|
||||
destination: &IndirectCommandBufferRef,
|
||||
destination_index: NSUInteger,
|
||||
) {
|
||||
unsafe {
|
||||
msg_send![self,
|
||||
copyIndirectCommandBuffer: source
|
||||
sourceRange: source_range
|
||||
destination: destination
|
||||
destinationIndex: destination_index
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset_commands_in_buffer(&self, buffer: &IndirectCommandBufferRef, range: NSRange) {
|
||||
unsafe {
|
||||
msg_send![self,
|
||||
resetCommandsInBuffer: buffer
|
||||
withRange: range
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn optimize_indirect_command_buffer(
|
||||
&self,
|
||||
buffer: &IndirectCommandBufferRef,
|
||||
range: NSRange,
|
||||
) {
|
||||
unsafe {
|
||||
msg_send![self,
|
||||
optimizeIndirectCommandBuffer: buffer
|
||||
withRange: range
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/// See: <https://developer.apple.com/documentation/metal/mtlblitcommandencoder/3194348-samplecountersinbuffer>
|
||||
pub fn sample_counters_in_buffer(
|
||||
&self,
|
||||
@ -1861,6 +1919,35 @@ impl ArgumentEncoderRef {
|
||||
unsafe { msg_send![self, constantDataAtIndex: at_index] }
|
||||
}
|
||||
|
||||
pub fn set_indirect_command_buffer(
|
||||
&self,
|
||||
at_index: NSUInteger,
|
||||
buffer: &IndirectCommandBufferRef,
|
||||
) {
|
||||
unsafe {
|
||||
msg_send![self,
|
||||
setIndirectCommandBuffer: buffer
|
||||
atIndex: at_index
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_indirect_command_buffers(
|
||||
&self,
|
||||
start_index: NSUInteger,
|
||||
data: &[&IndirectCommandBufferRef],
|
||||
) {
|
||||
unsafe {
|
||||
msg_send![self,
|
||||
setIndirectCommandBuffers: data.as_ptr()
|
||||
withRange: NSRange {
|
||||
location: start_index,
|
||||
length: data.len() as _,
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_argument_encoder_for_buffer(&self, index: NSUInteger) -> ArgumentEncoder {
|
||||
unsafe {
|
||||
let ptr = msg_send![self, newArgumentEncoderForBufferAtIndex: index];
|
||||
|
@ -22,6 +22,13 @@ foreign_obj_type! {
|
||||
pub struct IndirectCommandBufferDescriptor;
|
||||
}
|
||||
|
||||
impl IndirectCommandBufferDescriptor {
|
||||
pub fn new() -> Self {
|
||||
let class = class!(MTLIndirectCommandBufferDescriptor);
|
||||
unsafe { msg_send![class, new] }
|
||||
}
|
||||
}
|
||||
|
||||
impl IndirectCommandBufferDescriptorRef {
|
||||
pub fn command_types(&self) -> MTLIndirectCommandType {
|
||||
unsafe { msg_send![self, commandTypes] }
|
||||
|
2
third_party/rust/metal/src/lib.rs
vendored
2
third_party/rust/metal/src/lib.rs
vendored
@ -548,6 +548,7 @@ impl MetalLayerRef {
|
||||
|
||||
mod accelerator_structure;
|
||||
mod argument;
|
||||
mod blitpass;
|
||||
mod buffer;
|
||||
mod capturedescriptor;
|
||||
mod capturemanager;
|
||||
@ -578,6 +579,7 @@ mod vertexdescriptor;
|
||||
pub use {
|
||||
accelerator_structure::*,
|
||||
argument::*,
|
||||
blitpass::*,
|
||||
buffer::*,
|
||||
counters::*,
|
||||
computepass::*,
|
||||
|
2
third_party/rust/naga/.cargo-checksum.json
vendored
2
third_party/rust/naga/.cargo-checksum.json
vendored
File diff suppressed because one or more lines are too long
29
third_party/rust/naga/src/back/spv/writer.rs
vendored
29
third_party/rust/naga/src/back/spv/writer.rs
vendored
@ -1016,12 +1016,27 @@ impl Writer {
|
||||
ref members,
|
||||
span: _,
|
||||
} => {
|
||||
let mut has_runtime_array = false;
|
||||
let mut member_ids = Vec::with_capacity(members.len());
|
||||
for (index, member) in members.iter().enumerate() {
|
||||
let member_ty = &arena[member.ty];
|
||||
match member_ty.inner {
|
||||
crate::TypeInner::Array {
|
||||
base: _,
|
||||
size: crate::ArraySize::Dynamic,
|
||||
stride: _,
|
||||
} => {
|
||||
has_runtime_array = true;
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
self.decorate_struct_member(id, index, member, arena)?;
|
||||
let member_id = self.get_type_id(LookupType::Handle(member.ty));
|
||||
member_ids.push(member_id);
|
||||
}
|
||||
if has_runtime_array {
|
||||
self.decorate(id, Decoration::Block, &[]);
|
||||
}
|
||||
Instruction::type_struct(id, member_ids.as_slice())
|
||||
}
|
||||
|
||||
@ -1621,7 +1636,6 @@ impl Writer {
|
||||
space: global_variable.space,
|
||||
}))
|
||||
}
|
||||
} else {
|
||||
}
|
||||
};
|
||||
|
||||
@ -1656,16 +1670,17 @@ impl Writer {
|
||||
} else {
|
||||
// This is a global variable in the Storage address space. The only
|
||||
// way it could have `global_needs_wrapper() == false` is if it has
|
||||
// a runtime-sized array. In this case, we need to decorate it with
|
||||
// Block.
|
||||
// a runtime-sized or binding array.
|
||||
// Runtime-sized arrays were decorated when iterating through struct content.
|
||||
// Now binding arrays require Block decorating.
|
||||
if let crate::AddressSpace::Storage { .. } = global_variable.space {
|
||||
let decorated_id = match ir_module.types[global_variable.ty].inner {
|
||||
match ir_module.types[global_variable.ty].inner {
|
||||
crate::TypeInner::BindingArray { base, .. } => {
|
||||
self.get_type_id(LookupType::Handle(base))
|
||||
let decorated_id = self.get_type_id(LookupType::Handle(base));
|
||||
self.decorate(decorated_id, Decoration::Block, &[]);
|
||||
}
|
||||
_ => inner_type_id,
|
||||
_ => (),
|
||||
};
|
||||
self.decorate(decorated_id, Decoration::Block, &[]);
|
||||
}
|
||||
if substitute_inner_type_lookup.is_some() {
|
||||
inner_type_id
|
||||
|
26
third_party/rust/naga/src/back/wgsl/writer.rs
vendored
26
third_party/rust/naga/src/back/wgsl/writer.rs
vendored
@ -1132,6 +1132,12 @@ impl<W: Write> Writer<W> {
|
||||
}
|
||||
write!(self.out, ")")?
|
||||
}
|
||||
Expression::Splat { size, value } => {
|
||||
let size = back::vector_size_str(size);
|
||||
write!(self.out, "vec{size}(")?;
|
||||
write_expression(self, value)?;
|
||||
write!(self.out, ")")?;
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
@ -1173,7 +1179,8 @@ impl<W: Write> Writer<W> {
|
||||
Expression::Literal(_)
|
||||
| Expression::Constant(_)
|
||||
| Expression::ZeroValue(_)
|
||||
| Expression::Compose { .. } => {
|
||||
| Expression::Compose { .. }
|
||||
| Expression::Splat { .. } => {
|
||||
self.write_possibly_const_expression(
|
||||
module,
|
||||
expr,
|
||||
@ -1450,23 +1457,6 @@ impl<W: Write> Writer<W> {
|
||||
self.write_expr(module, expr, func_ctx)?;
|
||||
write!(self.out, ")")?;
|
||||
}
|
||||
Expression::Splat { size, value } => {
|
||||
let inner = func_ctx.resolve_type(value, &module.types);
|
||||
let (scalar_kind, scalar_width) = match *inner {
|
||||
crate::TypeInner::Scalar { kind, width } => (kind, width),
|
||||
_ => {
|
||||
return Err(Error::Unimplemented(format!(
|
||||
"write_expr expression::splat {inner:?}"
|
||||
)));
|
||||
}
|
||||
};
|
||||
let scalar = scalar_kind_str(scalar_kind, scalar_width);
|
||||
let size = back::vector_size_str(size);
|
||||
|
||||
write!(self.out, "vec{size}<{scalar}>(")?;
|
||||
self.write_expr(module, value, func_ctx)?;
|
||||
write!(self.out, ")")?;
|
||||
}
|
||||
Expression::Load { pointer } => {
|
||||
let is_atomic_pointer = func_ctx
|
||||
.resolve_type(pointer, &module.types)
|
||||
|
5
third_party/rust/naga/src/block.rs
vendored
5
third_party/rust/naga/src/block.rs
vendored
@ -75,9 +75,8 @@ impl Block {
|
||||
|
||||
pub fn splice<R: RangeBounds<usize> + Clone>(&mut self, range: R, other: Self) {
|
||||
#[cfg(feature = "span")]
|
||||
self.span_info
|
||||
.splice(range.clone(), other.span_info.into_iter());
|
||||
self.body.splice(range, other.body.into_iter());
|
||||
self.span_info.splice(range.clone(), other.span_info);
|
||||
self.body.splice(range, other.body);
|
||||
}
|
||||
pub fn span_iter(&self) -> impl Iterator<Item = (&Statement, &Span)> {
|
||||
#[cfg(feature = "span")]
|
||||
|
@ -17,7 +17,7 @@ pub struct ParseError {
|
||||
}
|
||||
|
||||
impl ParseError {
|
||||
pub fn labels(&self) -> impl Iterator<Item = (Span, &str)> + ExactSizeIterator + '_ {
|
||||
pub fn labels(&self) -> impl ExactSizeIterator<Item = (Span, &str)> + '_ {
|
||||
self.labels
|
||||
.iter()
|
||||
.map(|&(span, ref msg)| (span, msg.as_ref()))
|
||||
|
6
third_party/rust/naga/src/proc/layouter.rs
vendored
6
third_party/rust/naga/src/proc/layouter.rs
vendored
@ -151,10 +151,10 @@ impl Layouter {
|
||||
self.layouts.clear();
|
||||
}
|
||||
|
||||
/// Extend this `Layouter` with layouts for any new entries in `types`.
|
||||
/// Extend this `Layouter` with layouts for any new entries in `gctx.types`.
|
||||
///
|
||||
/// Ensure that every type in `types` has a corresponding [TypeLayout] in
|
||||
/// [`self.layouts`].
|
||||
/// Ensure that every type in `gctx.types` has a corresponding [TypeLayout]
|
||||
/// in [`self.layouts`].
|
||||
///
|
||||
/// Some front ends need to be able to compute layouts for existing types
|
||||
/// while module construction is still in progress and new types are still
|
||||
|
2
third_party/rust/naga/src/span.rs
vendored
2
third_party/rust/naga/src/span.rs
vendored
@ -181,7 +181,7 @@ impl<E> WithSpan<E> {
|
||||
}
|
||||
|
||||
/// Iterator over stored [`SpanContext`]s.
|
||||
pub fn spans(&self) -> impl Iterator<Item = &SpanContext> + ExactSizeIterator {
|
||||
pub fn spans(&self) -> impl ExactSizeIterator<Item = &SpanContext> {
|
||||
#[cfg(feature = "span")]
|
||||
return self.spans.iter();
|
||||
#[cfg(not(feature = "span"))]
|
||||
|
@ -157,7 +157,7 @@ impl super::Validator {
|
||||
&self,
|
||||
handle: Handle<crate::Expression>,
|
||||
gctx: crate::proc::GlobalCtx,
|
||||
mod_info: &mut ModuleInfo,
|
||||
mod_info: &ModuleInfo,
|
||||
) -> Result<(), super::ConstExpressionError> {
|
||||
use crate::Expression as E;
|
||||
|
||||
|
2
third_party/rust/naga/src/valid/mod.rs
vendored
2
third_party/rust/naga/src/valid/mod.rs
vendored
@ -400,7 +400,7 @@ impl Validator {
|
||||
#[cfg(feature = "validate")]
|
||||
if self.flags.contains(ValidationFlags::CONSTANTS) {
|
||||
for (handle, _) in module.const_expressions.iter() {
|
||||
self.validate_const_expression(handle, module.to_ctx(), &mut mod_info)
|
||||
self.validate_const_expression(handle, module.to_ctx(), &mod_info)
|
||||
.map_err(|source| {
|
||||
ValidationError::ConstExpression { handle, source }
|
||||
.with_span_handle(handle, &module.const_expressions)
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"7e5c00225497db0d65e2d91d19645c708402165126f655d26b77375ed70077af","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/binding_model.rs":"3322f03854b92abeb4aeb65dda4ef776094713bce1277047fe85be73a9bc7b4e","src/command/bind.rs":"c243a4448b87e9b7274b10873b7091b385413ec0a4ea93cccd6d612214ec9abb","src/command/bundle.rs":"b26eb6cb877a19d203e9d2b8ac3b10e81f6a94b8b68617eac97a3b861cbe102b","src/command/clear.rs":"418ac36738d782ab72e8700aabef802638cdef1c873f4b036aa8a4c521cb9caf","src/command/compute.rs":"0f8492bdfddb58c413282b2640b1f2a2b934ee256106f661241ac144bfd63d28","src/command/draw.rs":"92facdd0e3fd553af590ecbc0de3491f212e237ea66494ff99f67dbf090d10df","src/command/memory_init.rs":"b50d3d20dbf659052f19da2e79469ba6435e06370f19d6ef45e1b1128d9900b7","src/command/mod.rs":"a63937a5b8a441b714329a5e1b0b4dd4b70ae2f39b52da633fd79edbe183edc6","src/command/query.rs":"d39e1b8cb6a054fd31333a916da5d79a6671a724212c90c490c13e55043a1685","src/command/render.rs":"e98d109e2fe3651a96f74cf1c40a2cc9c752bcf9ea8e893285d7fcad634724dc","src/command/transfer.rs":"c777c6e51afb459d2b5416e31071f24e4215c66f456fee3bd8f7395f9d1c5db1","src/conv.rs":"da95b36b7680ae74ebf810ad8f1decf01bd3eeaff44b3c5af1d4b3c3f0e2059a","src/device/global.rs":"84ca385802eba1c119b571a30885c59ae1a4056438d6f69b13a837e06b2cd584","src/device/life.rs":"4afecaf3602e23a4d8c795c29b9e5e148866e728b008884d55f658de29af4fe9","src/device/mod.rs":"5ac7886bc8b2054c52dfb5955fe7b72fc9bf725b08b5e39121d6a952aa4f8f2b","src/device/queue.rs":"d2692b5c12d05dfaf325d437b5bffe069cfff43228ce40f25147cec2cda428ba","src/device/resource.rs":"ef5ef881a2cf1037d6f5b6bf3b497a9826707ceee00421873c4cf32f0e5c4510","src/device/trace.rs":"21408dfd2c99e3ce36a77d08ba86cf52f32bb376ed82690bbbf74937bfd42cbe","src/error.rs":"ca37282283985e2b7d184b2ab7ca6f53f726432d920f8d8477bfff6fab9b34e2","src/global.rs":"cf551de97c3eb5acd0c2710da09ebd92cc863ad0bb0f53c0fd4911bf8cd3ad97","src/hal_api.rs":"92a2f0cb80f192693530ed61048919bbad446742c2370bf0944c44b1c5df8362","src/hub.rs":"48ccada54672a88169c23975ddc3758cd32ed5de577c55ca4f665d0ed17d3233","src/id.rs":"f6245d024586c7fe63ded13b3cb926b940c191bbee56aedc655e8cef74bdd66b","src/identity.rs":"3ce6a3b57c7c4fc0808d13cd342d928c214f32368e45c79d8e2bbf8df887f97f","src/init_tracker/buffer.rs":"a0ebf54a1e6d269c7b4aa0ac7bb8b04fd2cea3221a1d058ff33cb683b2aea3e9","src/init_tracker/mod.rs":"0867f79f83555390d0982d1dc6dcf0d4340e10cb89aa633d3c3ecc45deb3c78c","src/init_tracker/texture.rs":"37b6584aaca11c407d91f77002dcbb48d8a4876e27edd1b71b7929ef966f901d","src/instance.rs":"2798b83772dd82a5461901cfca0b91c8b101bfcdf96095091dc59d1bd4b69cc1","src/lib.rs":"27ff8dd787d41cf412e90d0c4674aa70db59e608f9eb3be485c0bd18e9f13369","src/pipeline.rs":"669219add15448fdf5fe8bc5e03fd6fd1ada2b45b07047fd8c0a9bbbcdecad8b","src/present.rs":"b17400ba823e2fce9438947d3dfbfd34045f959666c6718286112a3f3925e387","src/registry.rs":"4098413de7f48e9ff15d0246793be47a0d54c95b4c8594baf9fafd222a90ba84","src/resource.rs":"7d1d841dd185a1a857814cab424a8b892aa8731dddf3373ea9436fa619d655b7","src/storage.rs":"bc70689ba299e9b4d9f4992c4d3f4dd36b1d8e71327595094981fdfd624f811a","src/track/buffer.rs":"dd6f632c6f31b15807148d705c516a8a1a8d72d02b137dd3b9d7c939447917cb","src/track/metadata.rs":"a80bd086ce825f7484ce6318a586c482d06fea0efc9c76bfa0124e480cc8b75e","src/track/mod.rs":"42b791d9a41eb6e62f6d79cae7abb5ab523eeb9e6030b0f95bbb0e26d56ad0ec","src/track/range.rs":"5bbfed6e103b3234d9de8e42057022da6d628c2cc1db6bb51b88f87f2d8adf8b","src/track/stateless.rs":"1d786b5e9558672243ba7d913736561065ef2bd5c6105c935e982486d10841f0","src/track/texture.rs":"7d60dc81ba7f7e2c2819525b90e6e6c7760cb0920e36aeefe98e76cedd49d26e","src/validation.rs":"66ee194d095b7fc54e0545f8b848120eb42d458a50beea67301ff3e5c88a4b3c"},"package":null}
|
||||
{"files":{"Cargo.toml":"34e400c82ab56ff7ed3b3e7fcd3d96246d68d6a246c7f12b3403465af1006772","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/binding_model.rs":"3322f03854b92abeb4aeb65dda4ef776094713bce1277047fe85be73a9bc7b4e","src/command/bind.rs":"c243a4448b87e9b7274b10873b7091b385413ec0a4ea93cccd6d612214ec9abb","src/command/bundle.rs":"b26eb6cb877a19d203e9d2b8ac3b10e81f6a94b8b68617eac97a3b861cbe102b","src/command/clear.rs":"418ac36738d782ab72e8700aabef802638cdef1c873f4b036aa8a4c521cb9caf","src/command/compute.rs":"0f8492bdfddb58c413282b2640b1f2a2b934ee256106f661241ac144bfd63d28","src/command/draw.rs":"92facdd0e3fd553af590ecbc0de3491f212e237ea66494ff99f67dbf090d10df","src/command/memory_init.rs":"b50d3d20dbf659052f19da2e79469ba6435e06370f19d6ef45e1b1128d9900b7","src/command/mod.rs":"a63937a5b8a441b714329a5e1b0b4dd4b70ae2f39b52da633fd79edbe183edc6","src/command/query.rs":"d39e1b8cb6a054fd31333a916da5d79a6671a724212c90c490c13e55043a1685","src/command/render.rs":"e98d109e2fe3651a96f74cf1c40a2cc9c752bcf9ea8e893285d7fcad634724dc","src/command/transfer.rs":"c777c6e51afb459d2b5416e31071f24e4215c66f456fee3bd8f7395f9d1c5db1","src/conv.rs":"da95b36b7680ae74ebf810ad8f1decf01bd3eeaff44b3c5af1d4b3c3f0e2059a","src/device/global.rs":"84ca385802eba1c119b571a30885c59ae1a4056438d6f69b13a837e06b2cd584","src/device/life.rs":"4afecaf3602e23a4d8c795c29b9e5e148866e728b008884d55f658de29af4fe9","src/device/mod.rs":"5ac7886bc8b2054c52dfb5955fe7b72fc9bf725b08b5e39121d6a952aa4f8f2b","src/device/queue.rs":"d2692b5c12d05dfaf325d437b5bffe069cfff43228ce40f25147cec2cda428ba","src/device/resource.rs":"0a3a9a83f65873819142c80e90043fa01bce87d4b8f27aef9646ed6c84c90929","src/device/trace.rs":"21408dfd2c99e3ce36a77d08ba86cf52f32bb376ed82690bbbf74937bfd42cbe","src/error.rs":"ca37282283985e2b7d184b2ab7ca6f53f726432d920f8d8477bfff6fab9b34e2","src/global.rs":"cf551de97c3eb5acd0c2710da09ebd92cc863ad0bb0f53c0fd4911bf8cd3ad97","src/hal_api.rs":"92a2f0cb80f192693530ed61048919bbad446742c2370bf0944c44b1c5df8362","src/hub.rs":"48ccada54672a88169c23975ddc3758cd32ed5de577c55ca4f665d0ed17d3233","src/id.rs":"f6245d024586c7fe63ded13b3cb926b940c191bbee56aedc655e8cef74bdd66b","src/identity.rs":"3ce6a3b57c7c4fc0808d13cd342d928c214f32368e45c79d8e2bbf8df887f97f","src/init_tracker/buffer.rs":"a0ebf54a1e6d269c7b4aa0ac7bb8b04fd2cea3221a1d058ff33cb683b2aea3e9","src/init_tracker/mod.rs":"0867f79f83555390d0982d1dc6dcf0d4340e10cb89aa633d3c3ecc45deb3c78c","src/init_tracker/texture.rs":"37b6584aaca11c407d91f77002dcbb48d8a4876e27edd1b71b7929ef966f901d","src/instance.rs":"2798b83772dd82a5461901cfca0b91c8b101bfcdf96095091dc59d1bd4b69cc1","src/lib.rs":"27ff8dd787d41cf412e90d0c4674aa70db59e608f9eb3be485c0bd18e9f13369","src/pipeline.rs":"212d469bc1a2256871f64b3f666f05995a92ce39391c32de3856ef2e11c08e16","src/present.rs":"b17400ba823e2fce9438947d3dfbfd34045f959666c6718286112a3f3925e387","src/registry.rs":"4098413de7f48e9ff15d0246793be47a0d54c95b4c8594baf9fafd222a90ba84","src/resource.rs":"7d1d841dd185a1a857814cab424a8b892aa8731dddf3373ea9436fa619d655b7","src/storage.rs":"bc70689ba299e9b4d9f4992c4d3f4dd36b1d8e71327595094981fdfd624f811a","src/track/buffer.rs":"dd6f632c6f31b15807148d705c516a8a1a8d72d02b137dd3b9d7c939447917cb","src/track/metadata.rs":"a80bd086ce825f7484ce6318a586c482d06fea0efc9c76bfa0124e480cc8b75e","src/track/mod.rs":"42b791d9a41eb6e62f6d79cae7abb5ab523eeb9e6030b0f95bbb0e26d56ad0ec","src/track/range.rs":"5bbfed6e103b3234d9de8e42057022da6d628c2cc1db6bb51b88f87f2d8adf8b","src/track/stateless.rs":"1d786b5e9558672243ba7d913736561065ef2bd5c6105c935e982486d10841f0","src/track/texture.rs":"7d60dc81ba7f7e2c2819525b90e6e6c7760cb0920e36aeefe98e76cedd49d26e","src/validation.rs":"fa84594ad2804684d298adf540b07723dd744bb5d6b19f1e85e00cbe86337f54"},"package":null}
|
2
third_party/rust/wgpu-core/Cargo.toml
vendored
2
third_party/rust/wgpu-core/Cargo.toml
vendored
@ -55,7 +55,7 @@ package = "wgpu-hal"
|
||||
[dependencies.naga]
|
||||
version = "0.13.0"
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"
|
||||
rev = "df8107b7"
|
||||
features = [
|
||||
"clone",
|
||||
"span",
|
||||
|
@ -1276,6 +1276,10 @@ impl<A: HalApi> Device<A> {
|
||||
.flags
|
||||
.contains(wgt::DownlevelFlags::MULTISAMPLED_SHADING),
|
||||
);
|
||||
caps.set(
|
||||
Caps::DUAL_SOURCE_BLENDING,
|
||||
self.features.contains(wgt::Features::DUAL_SOURCE_BLENDING),
|
||||
);
|
||||
|
||||
let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all(), caps)
|
||||
.validate(&module)
|
||||
@ -1286,7 +1290,8 @@ impl<A: HalApi> Device<A> {
|
||||
inner: Box::new(inner),
|
||||
})
|
||||
})?;
|
||||
let interface = validation::Interface::new(&module, &info, self.limits.clone());
|
||||
let interface =
|
||||
validation::Interface::new(&module, &info, self.limits.clone(), self.features);
|
||||
let hal_shader = hal::ShaderInput::Naga(hal::NagaShader { module, info });
|
||||
|
||||
let hal_desc = hal::ShaderModuleDescriptor {
|
||||
@ -2560,6 +2565,8 @@ impl<A: HalApi> Device<A> {
|
||||
let mut vertex_steps = Vec::with_capacity(desc.vertex.buffers.len());
|
||||
let mut vertex_buffers = Vec::with_capacity(desc.vertex.buffers.len());
|
||||
let mut total_attributes = 0;
|
||||
let mut shader_expects_dual_source_blending = false;
|
||||
let mut pipeline_expects_dual_source_blending = false;
|
||||
for (i, vb_state) in desc.vertex.buffers.iter().enumerate() {
|
||||
vertex_steps.push(pipeline::VertexStep {
|
||||
stride: vb_state.array_stride,
|
||||
@ -2700,7 +2707,25 @@ impl<A: HalApi> Device<A> {
|
||||
{
|
||||
break Some(pipeline::ColorStateError::FormatNotMultisampled(cs.format));
|
||||
}
|
||||
|
||||
if let Some(blend_mode) = cs.blend {
|
||||
for factor in [
|
||||
blend_mode.color.src_factor,
|
||||
blend_mode.color.dst_factor,
|
||||
blend_mode.alpha.src_factor,
|
||||
blend_mode.alpha.dst_factor,
|
||||
] {
|
||||
if factor.ref_second_blend_source() {
|
||||
self.require_features(wgt::Features::DUAL_SOURCE_BLENDING)?;
|
||||
if i == 0 {
|
||||
pipeline_expects_dual_source_blending = true;
|
||||
break;
|
||||
} else {
|
||||
return Err(crate::pipeline::CreateRenderPipelineError
|
||||
::BlendFactorOnUnsupportedTarget { factor, target: i as u32 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break None;
|
||||
};
|
||||
if let Some(e) = error {
|
||||
@ -2857,6 +2882,15 @@ impl<A: HalApi> Device<A> {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(ref interface) = shader_module.interface {
|
||||
shader_expects_dual_source_blending = interface
|
||||
.fragment_uses_dual_source_blending(&fragment.stage.entry_point)
|
||||
.map_err(|error| pipeline::CreateRenderPipelineError::Stage {
|
||||
stage: flag,
|
||||
error,
|
||||
})?;
|
||||
}
|
||||
|
||||
Some(hal::ProgrammableStage {
|
||||
module: &shader_module.raw,
|
||||
entry_point: fragment.stage.entry_point.as_ref(),
|
||||
@ -2865,6 +2899,17 @@ impl<A: HalApi> Device<A> {
|
||||
None => None,
|
||||
};
|
||||
|
||||
if !pipeline_expects_dual_source_blending && shader_expects_dual_source_blending {
|
||||
return Err(
|
||||
pipeline::CreateRenderPipelineError::ShaderExpectsPipelineToUseDualSourceBlending,
|
||||
);
|
||||
}
|
||||
if pipeline_expects_dual_source_blending && !shader_expects_dual_source_blending {
|
||||
return Err(
|
||||
pipeline::CreateRenderPipelineError::PipelineExpectsShaderToUseDualSourceBlending,
|
||||
);
|
||||
}
|
||||
|
||||
if validated_stages.contains(wgt::ShaderStages::FRAGMENT) {
|
||||
for (i, output) in io.iter() {
|
||||
match color_targets.get(*i as usize) {
|
||||
|
9
third_party/rust/wgpu-core/src/pipeline.rs
vendored
9
third_party/rust/wgpu-core/src/pipeline.rs
vendored
@ -384,6 +384,15 @@ pub enum CreateRenderPipelineError {
|
||||
},
|
||||
#[error("In the provided shader, the type given for group {group} binding {binding} has a size of {size}. As the device does not support `DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED`, the type must have a size that is a multiple of 16 bytes.")]
|
||||
UnalignedShader { group: u32, binding: u32, size: u64 },
|
||||
#[error("Using the blend factor {factor:?} for render target {target} is not possible. Only the first render target may be used when dual-source blending.")]
|
||||
BlendFactorOnUnsupportedTarget {
|
||||
factor: wgt::BlendFactor,
|
||||
target: u32,
|
||||
},
|
||||
#[error("Pipeline expects the shader entry point to make use of dual-source blending.")]
|
||||
PipelineExpectsShaderToUseDualSourceBlending,
|
||||
#[error("Shader entry point expects the pipeline to make use of dual-source blending.")]
|
||||
ShaderExpectsPipelineToUseDualSourceBlending,
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
|
30
third_party/rust/wgpu-core/src/validation.rs
vendored
30
third_party/rust/wgpu-core/src/validation.rs
vendored
@ -116,11 +116,13 @@ struct EntryPoint {
|
||||
spec_constants: Vec<SpecializationConstant>,
|
||||
sampling_pairs: FastHashSet<(naga::Handle<Resource>, naga::Handle<Resource>)>,
|
||||
workgroup_size: [u32; 3],
|
||||
dual_source_blending: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Interface {
|
||||
limits: wgt::Limits,
|
||||
features: wgt::Features,
|
||||
resources: naga::Arena<Resource>,
|
||||
entry_points: FastHashMap<(naga::ShaderStage, String), EntryPoint>,
|
||||
}
|
||||
@ -830,7 +832,12 @@ impl Interface {
|
||||
list.push(varying);
|
||||
}
|
||||
|
||||
pub fn new(module: &naga::Module, info: &naga::valid::ModuleInfo, limits: wgt::Limits) -> Self {
|
||||
pub fn new(
|
||||
module: &naga::Module,
|
||||
info: &naga::valid::ModuleInfo,
|
||||
limits: wgt::Limits,
|
||||
features: wgt::Features,
|
||||
) -> Self {
|
||||
let mut resources = naga::Arena::new();
|
||||
let mut resource_mapping = FastHashMap::default();
|
||||
for (var_handle, var) in module.global_variables.iter() {
|
||||
@ -903,7 +910,7 @@ impl Interface {
|
||||
ep.sampling_pairs
|
||||
.insert((resource_mapping[&key.image], resource_mapping[&key.sampler]));
|
||||
}
|
||||
|
||||
ep.dual_source_blending = info.dual_source_blending;
|
||||
ep.workgroup_size = entry_point.workgroup_size;
|
||||
|
||||
entry_points.insert((entry_point.stage, entry_point.name.clone()), ep);
|
||||
@ -911,6 +918,7 @@ impl Interface {
|
||||
|
||||
Self {
|
||||
limits,
|
||||
features,
|
||||
resources,
|
||||
entry_points,
|
||||
}
|
||||
@ -1120,7 +1128,12 @@ impl Interface {
|
||||
}
|
||||
|
||||
// Check all vertex outputs and make sure the fragment shader consumes them.
|
||||
if shader_stage == naga::ShaderStage::Fragment {
|
||||
// This requirement is removed if the `SHADER_UNUSED_VERTEX_OUTPUT` feature is enabled.
|
||||
if shader_stage == naga::ShaderStage::Fragment
|
||||
&& !self
|
||||
.features
|
||||
.contains(wgt::Features::SHADER_UNUSED_VERTEX_OUTPUT)
|
||||
{
|
||||
for &index in inputs.keys() {
|
||||
// This is a linear scan, but the count should be low enough
|
||||
// that this should be fine.
|
||||
@ -1177,4 +1190,15 @@ impl Interface {
|
||||
.collect();
|
||||
Ok(outputs)
|
||||
}
|
||||
|
||||
pub fn fragment_uses_dual_source_blending(
|
||||
&self,
|
||||
entry_point_name: &str,
|
||||
) -> Result<bool, StageError> {
|
||||
let pair = (naga::ShaderStage::Fragment, entry_point_name.to_string());
|
||||
self.entry_points
|
||||
.get(&pair)
|
||||
.ok_or(StageError::MissingEntryPoint(pair.1))
|
||||
.map(|ep| ep.dual_source_blending)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
9
third_party/rust/wgpu-hal/Cargo.toml
vendored
9
third_party/rust/wgpu-hal/Cargo.toml
vendored
@ -64,7 +64,7 @@ optional = true
|
||||
[dependencies.naga]
|
||||
version = "0.13.0"
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"
|
||||
rev = "df8107b7"
|
||||
features = ["clone"]
|
||||
|
||||
[dependencies.profiling]
|
||||
@ -83,7 +83,7 @@ env_logger = "0.10"
|
||||
[dev-dependencies.naga]
|
||||
version = "0.13.0"
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "cc87b8f9eb30bb55d0735b89d3df3e099e1a6e7c"
|
||||
rev = "df8107b7"
|
||||
features = ["wgsl-in"]
|
||||
|
||||
[dev-dependencies.winit]
|
||||
@ -158,13 +158,16 @@ features = [
|
||||
|
||||
[target."cfg(any(target_os=\"macos\", target_os=\"ios\"))".dependencies]
|
||||
core-graphics-types = "0.1"
|
||||
metal = "0.26.0"
|
||||
objc = "0.2.5"
|
||||
|
||||
[target."cfg(any(target_os=\"macos\", target_os=\"ios\"))".dependencies.block]
|
||||
version = "0.1"
|
||||
optional = true
|
||||
|
||||
[target."cfg(any(target_os=\"macos\", target_os=\"ios\"))".dependencies.metal]
|
||||
git = "https://github.com/gfx-rs/metal-rs/"
|
||||
rev = "d24f1a4"
|
||||
|
||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.ash]
|
||||
version = "0.37.3"
|
||||
optional = true
|
||||
|
@ -250,7 +250,9 @@ impl super::Adapter {
|
||||
| wgt::Features::TEXTURE_FORMAT_16BIT_NORM
|
||||
| wgt::Features::PUSH_CONSTANTS
|
||||
| wgt::Features::SHADER_PRIMITIVE_INDEX
|
||||
| wgt::Features::RG11B10UFLOAT_RENDERABLE;
|
||||
| wgt::Features::RG11B10UFLOAT_RENDERABLE
|
||||
| wgt::Features::DUAL_SOURCE_BLENDING;
|
||||
|
||||
//TODO: in order to expose this, we need to run a compute shader
|
||||
// that extract the necessary statistics out of the D3D12 result.
|
||||
// Alternatively, we could allocate a buffer for the query set,
|
||||
|
16
third_party/rust/wgpu-hal/src/dx12/conv.rs
vendored
16
third_party/rust/wgpu-hal/src/dx12/conv.rs
vendored
@ -222,6 +222,10 @@ pub fn map_polygon_mode(mode: wgt::PolygonMode) -> d3d12_ty::D3D12_FILL_MODE {
|
||||
}
|
||||
}
|
||||
|
||||
/// D3D12 doesn't support passing factors ending in `_COLOR` for alpha blending
|
||||
/// (see https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_render_target_blend_desc).
|
||||
/// Therefore this function takes an additional `is_alpha` argument
|
||||
/// which if set will return an equivalent `_ALPHA` factor.
|
||||
fn map_blend_factor(factor: wgt::BlendFactor, is_alpha: bool) -> d3d12_ty::D3D12_BLEND {
|
||||
use wgt::BlendFactor as Bf;
|
||||
match factor {
|
||||
@ -242,12 +246,12 @@ fn map_blend_factor(factor: wgt::BlendFactor, is_alpha: bool) -> d3d12_ty::D3D12
|
||||
Bf::Constant => d3d12_ty::D3D12_BLEND_BLEND_FACTOR,
|
||||
Bf::OneMinusConstant => d3d12_ty::D3D12_BLEND_INV_BLEND_FACTOR,
|
||||
Bf::SrcAlphaSaturated => d3d12_ty::D3D12_BLEND_SRC_ALPHA_SAT,
|
||||
//Bf::Src1Color if is_alpha => d3d12_ty::D3D12_BLEND_SRC1_ALPHA,
|
||||
//Bf::Src1Color => d3d12_ty::D3D12_BLEND_SRC1_COLOR,
|
||||
//Bf::OneMinusSrc1Color if is_alpha => d3d12_ty::D3D12_BLEND_INV_SRC1_ALPHA,
|
||||
//Bf::OneMinusSrc1Color => d3d12_ty::D3D12_BLEND_INV_SRC1_COLOR,
|
||||
//Bf::Src1Alpha => d3d12_ty::D3D12_BLEND_SRC1_ALPHA,
|
||||
//Bf::OneMinusSrc1Alpha => d3d12_ty::D3D12_BLEND_INV_SRC1_ALPHA,
|
||||
Bf::Src1 if is_alpha => d3d12_ty::D3D12_BLEND_SRC1_ALPHA,
|
||||
Bf::Src1 => d3d12_ty::D3D12_BLEND_SRC1_COLOR,
|
||||
Bf::OneMinusSrc1 if is_alpha => d3d12_ty::D3D12_BLEND_INV_SRC1_ALPHA,
|
||||
Bf::OneMinusSrc1 => d3d12_ty::D3D12_BLEND_INV_SRC1_COLOR,
|
||||
Bf::Src1Alpha => d3d12_ty::D3D12_BLEND_SRC1_ALPHA,
|
||||
Bf::OneMinusSrc1Alpha => d3d12_ty::D3D12_BLEND_INV_SRC1_ALPHA,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,11 +363,16 @@ impl super::Adapter {
|
||||
wgt::Features::MULTIVIEW,
|
||||
extensions.contains("OVR_multiview2"),
|
||||
);
|
||||
features.set(
|
||||
wgt::Features::DUAL_SOURCE_BLENDING,
|
||||
extensions.contains("GL_EXT_blend_func_extended"),
|
||||
);
|
||||
features.set(
|
||||
wgt::Features::SHADER_PRIMITIVE_INDEX,
|
||||
ver >= (3, 2) || extensions.contains("OES_geometry_shader"),
|
||||
);
|
||||
features.set(wgt::Features::SHADER_EARLY_DEPTH_TEST, ver >= (3, 1));
|
||||
features.set(wgt::Features::SHADER_UNUSED_VERTEX_OUTPUT, true);
|
||||
let gles_bcn_exts = [
|
||||
"GL_EXT_texture_compression_s3tc_srgb",
|
||||
"GL_EXT_texture_compression_rgtc",
|
||||
|
4
third_party/rust/wgpu-hal/src/gles/conv.rs
vendored
4
third_party/rust/wgpu-hal/src/gles/conv.rs
vendored
@ -376,6 +376,10 @@ fn map_blend_factor(factor: wgt::BlendFactor) -> u32 {
|
||||
Bf::Constant => glow::CONSTANT_COLOR,
|
||||
Bf::OneMinusConstant => glow::ONE_MINUS_CONSTANT_COLOR,
|
||||
Bf::SrcAlphaSaturated => glow::SRC_ALPHA_SATURATE,
|
||||
Bf::Src1 => glow::SRC1_COLOR,
|
||||
Bf::OneMinusSrc1 => glow::ONE_MINUS_SRC1_COLOR,
|
||||
Bf::Src1Alpha => glow::SRC1_ALPHA,
|
||||
Bf::OneMinusSrc1Alpha => glow::ONE_MINUS_SRC1_ALPHA,
|
||||
}
|
||||
}
|
||||
|
||||
|
51
third_party/rust/wgpu-hal/src/metal/adapter.rs
vendored
51
third_party/rust/wgpu-hal/src/metal/adapter.rs
vendored
@ -5,6 +5,8 @@ use wgt::{AstcBlock, AstcChannel};
|
||||
|
||||
use std::{sync::Arc, thread};
|
||||
|
||||
use super::TimestampQuerySupport;
|
||||
|
||||
const MAX_COMMAND_BUFFERS: u64 = 2048;
|
||||
|
||||
unsafe impl Send for super::Adapter {}
|
||||
@ -536,6 +538,26 @@ impl super::PrivateCapabilities {
|
||||
MTLReadWriteTextureTier::TierNone
|
||||
};
|
||||
|
||||
let mut timestamp_query_support = TimestampQuerySupport::empty();
|
||||
if version.at_least((11, 0), (14, 0), os_is_mac)
|
||||
&& device.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtStageBoundary)
|
||||
{
|
||||
// If we don't support at stage boundary, don't support anything else.
|
||||
timestamp_query_support.insert(TimestampQuerySupport::STAGE_BOUNDARIES);
|
||||
|
||||
if device.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtDrawBoundary) {
|
||||
timestamp_query_support.insert(TimestampQuerySupport::ON_RENDER_ENCODER);
|
||||
}
|
||||
if device.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtDispatchBoundary)
|
||||
{
|
||||
timestamp_query_support.insert(TimestampQuerySupport::ON_COMPUTE_ENCODER);
|
||||
}
|
||||
if device.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtBlitBoundary) {
|
||||
timestamp_query_support.insert(TimestampQuerySupport::ON_BLIT_ENCODER);
|
||||
}
|
||||
// `TimestampQuerySupport::INSIDE_WGPU_PASSES` emerges from the other flags.
|
||||
}
|
||||
|
||||
Self {
|
||||
family_check,
|
||||
msl_version: if os_is_xr || version.at_least((12, 0), (15, 0), os_is_mac) {
|
||||
@ -773,13 +795,7 @@ impl super::PrivateCapabilities {
|
||||
} else {
|
||||
None
|
||||
},
|
||||
support_timestamp_query: version.at_least((11, 0), (14, 0), os_is_mac)
|
||||
&& device
|
||||
.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtStageBoundary),
|
||||
support_timestamp_query_in_passes: version.at_least((11, 0), (14, 0), os_is_mac)
|
||||
&& device.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtDrawBoundary)
|
||||
&& device
|
||||
.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtDispatchBoundary),
|
||||
timestamp_query_support,
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,12 +823,20 @@ impl super::PrivateCapabilities {
|
||||
| F::DEPTH32FLOAT_STENCIL8
|
||||
| F::MULTI_DRAW_INDIRECT;
|
||||
|
||||
features.set(F::TIMESTAMP_QUERY, self.support_timestamp_query);
|
||||
// TODO: Not yet implemented.
|
||||
// features.set(
|
||||
// F::TIMESTAMP_QUERY_INSIDE_PASSES,
|
||||
// self.support_timestamp_query_in_passes,
|
||||
// );
|
||||
features.set(
|
||||
F::TIMESTAMP_QUERY,
|
||||
self.timestamp_query_support
|
||||
.contains(TimestampQuerySupport::STAGE_BOUNDARIES),
|
||||
);
|
||||
features.set(
|
||||
F::TIMESTAMP_QUERY_INSIDE_PASSES,
|
||||
self.timestamp_query_support
|
||||
.contains(TimestampQuerySupport::INSIDE_WGPU_PASSES),
|
||||
);
|
||||
features.set(
|
||||
F::DUAL_SOURCE_BLENDING,
|
||||
self.msl_version >= MTLLanguageVersion::V1_2 && self.dual_source_blending,
|
||||
);
|
||||
features.set(F::TEXTURE_COMPRESSION_ASTC, self.format_astc);
|
||||
features.set(F::TEXTURE_COMPRESSION_ASTC_HDR, self.format_astc_hdr);
|
||||
features.set(F::TEXTURE_COMPRESSION_BC, self.format_bc);
|
||||
@ -847,6 +871,7 @@ impl super::PrivateCapabilities {
|
||||
features.set(F::ADDRESS_MODE_CLAMP_TO_ZERO, true);
|
||||
|
||||
features.set(F::RG11B10UFLOAT_RENDERABLE, self.format_rg11b10_all);
|
||||
features.set(F::SHADER_UNUSED_VERTEX_OUTPUT, true);
|
||||
|
||||
features
|
||||
}
|
||||
|
213
third_party/rust/wgpu-hal/src/metal/command.rs
vendored
213
third_party/rust/wgpu-hal/src/metal/command.rs
vendored
@ -1,4 +1,4 @@
|
||||
use super::{conv, AsNative};
|
||||
use super::{conv, AsNative, TimestampQuerySupport};
|
||||
use crate::CommandEncoder as _;
|
||||
use std::{borrow::Cow, mem, ops::Range};
|
||||
|
||||
@ -18,6 +18,7 @@ impl Default for super::CommandState {
|
||||
storage_buffer_length_map: Default::default(),
|
||||
work_group_memory_sizes: Vec::new(),
|
||||
push_constants: Vec::new(),
|
||||
pending_timer_queries: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,10 +27,85 @@ impl super::CommandEncoder {
|
||||
fn enter_blit(&mut self) -> &metal::BlitCommandEncoderRef {
|
||||
if self.state.blit.is_none() {
|
||||
debug_assert!(self.state.render.is_none() && self.state.compute.is_none());
|
||||
let cmd_buf = self.raw_cmd_buf.as_ref().unwrap();
|
||||
|
||||
// Take care of pending timer queries.
|
||||
// If we can't use `sample_counters_in_buffer` we have to create a dummy blit encoder!
|
||||
//
|
||||
// There is a known bug in Metal where blit encoders won't write timestamps if they don't have a blit operation.
|
||||
// See https://github.com/gpuweb/gpuweb/issues/2046#issuecomment-1205793680 & https://source.chromium.org/chromium/chromium/src/+/006c4eb70c96229834bbaf271290f40418144cd3:third_party/dawn/src/dawn/native/metal/BackendMTL.mm;l=350
|
||||
//
|
||||
// To make things worse:
|
||||
// * what counts as a blit operation is a bit unclear, experimenting seemed to indicate that resolve_counters doesn't count.
|
||||
// * in some cases (when?) using `set_start_of_encoder_sample_index` doesn't work, so we have to use `set_end_of_encoder_sample_index` instead
|
||||
//
|
||||
// All this means that pretty much the only *reliable* thing as of writing is to:
|
||||
// * create a dummy blit encoder using set_end_of_encoder_sample_index
|
||||
// * do a dummy write that is known to be not optimized out.
|
||||
// * close the encoder since we used set_end_of_encoder_sample_index and don't want to get any extra stuff in there.
|
||||
// * create another encoder for whatever we actually had in mind.
|
||||
let supports_sample_counters_in_buffer = self
|
||||
.shared
|
||||
.private_caps
|
||||
.timestamp_query_support
|
||||
.contains(TimestampQuerySupport::ON_BLIT_ENCODER);
|
||||
|
||||
if !self.state.pending_timer_queries.is_empty() && !supports_sample_counters_in_buffer {
|
||||
objc::rc::autoreleasepool(|| {
|
||||
let descriptor = metal::BlitPassDescriptor::new();
|
||||
let mut last_query = None;
|
||||
for (i, (set, index)) in self.state.pending_timer_queries.drain(..).enumerate()
|
||||
{
|
||||
let sba_descriptor = descriptor
|
||||
.sample_buffer_attachments()
|
||||
.object_at(i as _)
|
||||
.unwrap();
|
||||
sba_descriptor
|
||||
.set_sample_buffer(set.counter_sample_buffer.as_ref().unwrap());
|
||||
|
||||
// Here be dragons:
|
||||
// As mentioned above, for some reasons using the start of the encoder won't yield any results sometimes!
|
||||
sba_descriptor
|
||||
.set_start_of_encoder_sample_index(metal::COUNTER_DONT_SAMPLE);
|
||||
sba_descriptor.set_end_of_encoder_sample_index(index as _);
|
||||
|
||||
last_query = Some((set, index));
|
||||
}
|
||||
let encoder = cmd_buf.blit_command_encoder_with_descriptor(descriptor);
|
||||
|
||||
// As explained above, we need to do some write:
|
||||
// Conveniently, we have a buffer with every query set, that we can use for this for a dummy write,
|
||||
// since we know that it is going to be overwritten again on timer resolve and HAL doesn't define its state before that.
|
||||
let raw_range = metal::NSRange {
|
||||
location: last_query.as_ref().unwrap().1 as u64 * crate::QUERY_SIZE,
|
||||
length: 1,
|
||||
};
|
||||
encoder.fill_buffer(
|
||||
&last_query.as_ref().unwrap().0.raw_buffer,
|
||||
raw_range,
|
||||
255, // Don't write 0, so it's easier to identify if something went wrong.
|
||||
);
|
||||
|
||||
encoder.end_encoding();
|
||||
});
|
||||
}
|
||||
|
||||
objc::rc::autoreleasepool(|| {
|
||||
let cmd_buf = self.raw_cmd_buf.as_ref().unwrap();
|
||||
self.state.blit = Some(cmd_buf.new_blit_command_encoder().to_owned());
|
||||
});
|
||||
|
||||
let encoder = self.state.blit.as_ref().unwrap();
|
||||
|
||||
// UNTESTED:
|
||||
// If the above described issue with empty blit encoder applies to `sample_counters_in_buffer` as well, we should use the same workaround instead!
|
||||
for (set, index) in self.state.pending_timer_queries.drain(..) {
|
||||
debug_assert!(supports_sample_counters_in_buffer);
|
||||
encoder.sample_counters_in_buffer(
|
||||
set.counter_sample_buffer.as_ref().unwrap(),
|
||||
index as _,
|
||||
true,
|
||||
)
|
||||
}
|
||||
}
|
||||
self.state.blit.as_ref().unwrap()
|
||||
}
|
||||
@ -40,7 +116,7 @@ impl super::CommandEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
fn enter_any(&mut self) -> Option<&metal::CommandEncoderRef> {
|
||||
fn active_encoder(&mut self) -> Option<&metal::CommandEncoderRef> {
|
||||
if let Some(ref encoder) = self.state.render {
|
||||
Some(encoder)
|
||||
} else if let Some(ref encoder) = self.state.compute {
|
||||
@ -127,9 +203,17 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
}
|
||||
|
||||
unsafe fn end_encoding(&mut self) -> Result<super::CommandBuffer, crate::DeviceError> {
|
||||
// Handle pending timer query if any.
|
||||
if !self.state.pending_timer_queries.is_empty() {
|
||||
self.leave_blit();
|
||||
self.enter_blit();
|
||||
}
|
||||
|
||||
self.leave_blit();
|
||||
debug_assert!(self.state.render.is_none());
|
||||
debug_assert!(self.state.compute.is_none());
|
||||
debug_assert!(self.state.pending_timer_queries.is_empty());
|
||||
|
||||
Ok(super::CommandBuffer {
|
||||
raw: self.raw_cmd_buf.take().unwrap(),
|
||||
})
|
||||
@ -322,16 +406,43 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
unsafe fn write_timestamp(&mut self, _set: &super::QuerySet, _index: u32) {
|
||||
// TODO: If MTLCounterSamplingPoint::AtDrawBoundary/AtBlitBoundary/AtDispatchBoundary is supported,
|
||||
// we don't need to insert a new encoder, but can instead use respective current one.
|
||||
//let encoder = self.enter_any().unwrap_or_else(|| self.enter_blit());
|
||||
unsafe fn write_timestamp(&mut self, set: &super::QuerySet, index: u32) {
|
||||
let support = self.shared.private_caps.timestamp_query_support;
|
||||
debug_assert!(
|
||||
support.contains(TimestampQuerySupport::STAGE_BOUNDARIES),
|
||||
"Timestamp queries are not supported"
|
||||
);
|
||||
let sample_buffer = set.counter_sample_buffer.as_ref().unwrap();
|
||||
let with_barrier = true;
|
||||
|
||||
// TODO: Otherwise, we need to create a new blit command encoder with a descriptor that inserts the timestamps.
|
||||
// Note that as of writing creating a new encoder is not exposed by the metal crate.
|
||||
// https://developer.apple.com/documentation/metal/mtlcommandbuffer/3564431-makeblitcommandencoder
|
||||
// Try to use an existing encoder for timestamp query if possible.
|
||||
// This works only if it's supported for the active encoder.
|
||||
if let (true, Some(encoder)) = (
|
||||
support.contains(TimestampQuerySupport::ON_BLIT_ENCODER),
|
||||
self.state.blit.as_ref(),
|
||||
) {
|
||||
encoder.sample_counters_in_buffer(sample_buffer, index as _, with_barrier);
|
||||
} else if let (true, Some(encoder)) = (
|
||||
support.contains(TimestampQuerySupport::ON_RENDER_ENCODER),
|
||||
self.state.render.as_ref(),
|
||||
) {
|
||||
encoder.sample_counters_in_buffer(sample_buffer, index as _, with_barrier);
|
||||
} else if let (true, Some(encoder)) = (
|
||||
support.contains(TimestampQuerySupport::ON_COMPUTE_ENCODER),
|
||||
self.state.compute.as_ref(),
|
||||
) {
|
||||
encoder.sample_counters_in_buffer(sample_buffer, index as _, with_barrier);
|
||||
} else {
|
||||
// If we're here it means we either have no encoder open, or it's not supported to sample within them.
|
||||
// If this happens with render/compute open, this is an invalid usage!
|
||||
debug_assert!(self.state.render.is_none() && self.state.compute.is_none());
|
||||
|
||||
// TODO: Enable respective test in `examples/timestamp-queries/src/tests.rs`.
|
||||
// But otherwise it means we'll put defer this to the next created encoder.
|
||||
self.state.pending_timer_queries.push((set.clone(), index));
|
||||
|
||||
// Ensure we didn't already have a blit open.
|
||||
self.leave_blit();
|
||||
};
|
||||
}
|
||||
|
||||
unsafe fn reset_queries(&mut self, set: &super::QuerySet, range: Range<u32>) {
|
||||
@ -342,6 +453,7 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
};
|
||||
encoder.fill_buffer(&set.raw_buffer, raw_range, 0);
|
||||
}
|
||||
|
||||
unsafe fn copy_query_results(
|
||||
&mut self,
|
||||
set: &super::QuerySet,
|
||||
@ -454,8 +566,29 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
let mut sba_index = 0;
|
||||
let mut next_sba_descriptor = || {
|
||||
let sba_descriptor = descriptor
|
||||
.sample_buffer_attachments()
|
||||
.object_at(sba_index)
|
||||
.unwrap();
|
||||
|
||||
sba_descriptor.set_end_of_vertex_sample_index(metal::COUNTER_DONT_SAMPLE);
|
||||
sba_descriptor.set_start_of_fragment_sample_index(metal::COUNTER_DONT_SAMPLE);
|
||||
|
||||
sba_index += 1;
|
||||
sba_descriptor
|
||||
};
|
||||
|
||||
for (set, index) in self.state.pending_timer_queries.drain(..) {
|
||||
let sba_descriptor = next_sba_descriptor();
|
||||
sba_descriptor.set_sample_buffer(set.counter_sample_buffer.as_ref().unwrap());
|
||||
sba_descriptor.set_start_of_vertex_sample_index(index as _);
|
||||
sba_descriptor.set_end_of_fragment_sample_index(metal::COUNTER_DONT_SAMPLE);
|
||||
}
|
||||
|
||||
if let Some(ref timestamp_writes) = desc.timestamp_writes {
|
||||
let sba_descriptor = descriptor.sample_buffer_attachments().object_at(0).unwrap();
|
||||
let sba_descriptor = next_sba_descriptor();
|
||||
sba_descriptor.set_sample_buffer(
|
||||
timestamp_writes
|
||||
.query_set
|
||||
@ -464,12 +597,16 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
if let Some(start_index) = timestamp_writes.beginning_of_pass_write_index {
|
||||
sba_descriptor.set_start_of_vertex_sample_index(start_index as _);
|
||||
}
|
||||
if let Some(end_index) = timestamp_writes.end_of_pass_write_index {
|
||||
sba_descriptor.set_end_of_fragment_sample_index(end_index as _);
|
||||
}
|
||||
sba_descriptor.set_start_of_vertex_sample_index(
|
||||
timestamp_writes
|
||||
.beginning_of_pass_write_index
|
||||
.map_or(metal::COUNTER_DONT_SAMPLE, |i| i as _),
|
||||
);
|
||||
sba_descriptor.set_end_of_fragment_sample_index(
|
||||
timestamp_writes
|
||||
.end_of_pass_write_index
|
||||
.map_or(metal::COUNTER_DONT_SAMPLE, |i| i as _),
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(occlusion_query_set) = desc.occlusion_query_set {
|
||||
@ -697,19 +834,19 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
}
|
||||
|
||||
unsafe fn insert_debug_marker(&mut self, label: &str) {
|
||||
if let Some(encoder) = self.enter_any() {
|
||||
if let Some(encoder) = self.active_encoder() {
|
||||
encoder.insert_debug_signpost(label);
|
||||
}
|
||||
}
|
||||
unsafe fn begin_debug_marker(&mut self, group_label: &str) {
|
||||
if let Some(encoder) = self.enter_any() {
|
||||
if let Some(encoder) = self.active_encoder() {
|
||||
encoder.push_debug_group(group_label);
|
||||
} else if let Some(ref buf) = self.raw_cmd_buf {
|
||||
buf.push_debug_group(group_label);
|
||||
}
|
||||
}
|
||||
unsafe fn end_debug_marker(&mut self) {
|
||||
if let Some(encoder) = self.enter_any() {
|
||||
if let Some(encoder) = self.active_encoder() {
|
||||
encoder.pop_debug_group();
|
||||
} else if let Some(ref buf) = self.raw_cmd_buf {
|
||||
buf.pop_debug_group();
|
||||
@ -969,11 +1106,25 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
objc::rc::autoreleasepool(|| {
|
||||
let descriptor = metal::ComputePassDescriptor::new();
|
||||
|
||||
if let Some(timestamp_writes) = desc.timestamp_writes.as_ref() {
|
||||
let mut sba_index = 0;
|
||||
let mut next_sba_descriptor = || {
|
||||
let sba_descriptor = descriptor
|
||||
.sample_buffer_attachments()
|
||||
.object_at(0 as _)
|
||||
.object_at(sba_index)
|
||||
.unwrap();
|
||||
sba_index += 1;
|
||||
sba_descriptor
|
||||
};
|
||||
|
||||
for (set, index) in self.state.pending_timer_queries.drain(..) {
|
||||
let sba_descriptor = next_sba_descriptor();
|
||||
sba_descriptor.set_sample_buffer(set.counter_sample_buffer.as_ref().unwrap());
|
||||
sba_descriptor.set_start_of_encoder_sample_index(index as _);
|
||||
sba_descriptor.set_end_of_encoder_sample_index(metal::COUNTER_DONT_SAMPLE);
|
||||
}
|
||||
|
||||
if let Some(timestamp_writes) = desc.timestamp_writes.as_ref() {
|
||||
let sba_descriptor = next_sba_descriptor();
|
||||
sba_descriptor.set_sample_buffer(
|
||||
timestamp_writes
|
||||
.query_set
|
||||
@ -982,12 +1133,16 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
if let Some(start_index) = timestamp_writes.beginning_of_pass_write_index {
|
||||
sba_descriptor.set_start_of_encoder_sample_index(start_index as _);
|
||||
}
|
||||
if let Some(end_index) = timestamp_writes.end_of_pass_write_index {
|
||||
sba_descriptor.set_end_of_encoder_sample_index(end_index as _);
|
||||
}
|
||||
sba_descriptor.set_start_of_encoder_sample_index(
|
||||
timestamp_writes
|
||||
.beginning_of_pass_write_index
|
||||
.map_or(metal::COUNTER_DONT_SAMPLE, |i| i as _),
|
||||
);
|
||||
sba_descriptor.set_end_of_encoder_sample_index(
|
||||
timestamp_writes
|
||||
.end_of_pass_write_index
|
||||
.map_or(metal::COUNTER_DONT_SAMPLE, |i| i as _),
|
||||
);
|
||||
}
|
||||
|
||||
let encoder = raw.compute_command_encoder_with_descriptor(descriptor);
|
||||
|
10
third_party/rust/wgpu-hal/src/metal/conv.rs
vendored
10
third_party/rust/wgpu-hal/src/metal/conv.rs
vendored
@ -152,13 +152,11 @@ pub fn map_blend_factor(factor: wgt::BlendFactor) -> metal::MTLBlendFactor {
|
||||
Bf::OneMinusDstAlpha => OneMinusDestinationAlpha,
|
||||
Bf::Constant => BlendColor,
|
||||
Bf::OneMinusConstant => OneMinusBlendColor,
|
||||
//Bf::ConstantAlpha => BlendAlpha,
|
||||
//Bf::OneMinusConstantAlpha => OneMinusBlendAlpha,
|
||||
Bf::SrcAlphaSaturated => SourceAlphaSaturated,
|
||||
//Bf::Src1 => Source1Color,
|
||||
//Bf::OneMinusSrc1 => OneMinusSource1Color,
|
||||
//Bf::Src1Alpha => Source1Alpha,
|
||||
//Bf::OneMinusSrc1Alpha => OneMinusSource1Alpha,
|
||||
Bf::Src1 => Source1Color,
|
||||
Bf::OneMinusSrc1 => OneMinusSource1Color,
|
||||
Bf::Src1Alpha => Source1Alpha,
|
||||
Bf::OneMinusSrc1Alpha => OneMinusSource1Alpha,
|
||||
}
|
||||
}
|
||||
|
||||
|
27
third_party/rust/wgpu-hal/src/metal/mod.rs
vendored
27
third_party/rust/wgpu-hal/src/metal/mod.rs
vendored
@ -33,6 +33,7 @@ use std::{
|
||||
};
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use bitflags::bitflags;
|
||||
use metal::foreign_types::ForeignTypeRef as _;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@ -143,6 +144,24 @@ impl crate::Instance<Api> for Instance {
|
||||
}
|
||||
}
|
||||
|
||||
bitflags!(
|
||||
/// Similar to `MTLCounterSamplingPoint`, but a bit higher abstracted for our purposes.
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct TimestampQuerySupport: u32 {
|
||||
/// On creating Metal encoders.
|
||||
const STAGE_BOUNDARIES = 1 << 1;
|
||||
/// Within existing draw encoders.
|
||||
const ON_RENDER_ENCODER = Self::STAGE_BOUNDARIES.bits() | (1 << 2);
|
||||
/// Within existing dispatch encoders.
|
||||
const ON_COMPUTE_ENCODER = Self::STAGE_BOUNDARIES.bits() | (1 << 3);
|
||||
/// Within existing blit encoders.
|
||||
const ON_BLIT_ENCODER = Self::STAGE_BOUNDARIES.bits() | (1 << 4);
|
||||
|
||||
/// Within any wgpu render/compute pass.
|
||||
const INSIDE_WGPU_PASSES = Self::ON_RENDER_ENCODER.bits() | Self::ON_COMPUTE_ENCODER.bits();
|
||||
}
|
||||
);
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Debug)]
|
||||
struct PrivateCapabilities {
|
||||
@ -239,8 +258,7 @@ struct PrivateCapabilities {
|
||||
supports_preserve_invariance: bool,
|
||||
supports_shader_primitive_index: bool,
|
||||
has_unified_memory: Option<bool>,
|
||||
support_timestamp_query: bool,
|
||||
support_timestamp_query_in_passes: bool,
|
||||
timestamp_query_support: TimestampQuerySupport,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@ -704,7 +722,7 @@ pub struct ComputePipeline {
|
||||
unsafe impl Send for ComputePipeline {}
|
||||
unsafe impl Sync for ComputePipeline {}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct QuerySet {
|
||||
raw_buffer: metal::Buffer,
|
||||
//Metal has a custom buffer for counters.
|
||||
@ -787,6 +805,9 @@ struct CommandState {
|
||||
|
||||
work_group_memory_sizes: Vec<u32>,
|
||||
push_constants: Vec<u32>,
|
||||
|
||||
/// Timer query that should be executed when the next pass starts.
|
||||
pending_timer_queries: Vec<(QuerySet, u32)>,
|
||||
}
|
||||
|
||||
pub struct CommandEncoder {
|
||||
|
@ -177,6 +177,7 @@ impl PhysicalDeviceFeatures {
|
||||
//.shader_resource_residency(requested_features.contains(wgt::Features::SHADER_RESOURCE_RESIDENCY))
|
||||
.geometry_shader(requested_features.contains(wgt::Features::SHADER_PRIMITIVE_INDEX))
|
||||
.depth_clamp(requested_features.contains(wgt::Features::DEPTH_CLIP_CONTROL))
|
||||
.dual_src_blend(requested_features.contains(wgt::Features::DUAL_SOURCE_BLENDING))
|
||||
.build(),
|
||||
descriptor_indexing: if requested_features.intersects(indexing_features()) {
|
||||
Some(
|
||||
@ -460,6 +461,7 @@ impl PhysicalDeviceFeatures {
|
||||
}
|
||||
|
||||
features.set(F::DEPTH_CLIP_CONTROL, self.core.depth_clamp != 0);
|
||||
features.set(F::DUAL_SOURCE_BLENDING, self.core.dual_src_blend != 0);
|
||||
|
||||
if let Some(ref multiview) = self.multiview {
|
||||
features.set(F::MULTIVIEW, multiview.multiview != 0);
|
||||
@ -520,6 +522,7 @@ impl PhysicalDeviceFeatures {
|
||||
| vk::FormatFeatureFlags::COLOR_ATTACHMENT_BLEND,
|
||||
);
|
||||
features.set(F::RG11B10UFLOAT_RENDERABLE, rg11b10ufloat_renderable);
|
||||
features.set(F::SHADER_UNUSED_VERTEX_OUTPUT, true);
|
||||
|
||||
(features, dl_flags)
|
||||
}
|
||||
@ -984,6 +987,10 @@ impl super::Instance {
|
||||
super::Workarounds::EMPTY_RESOLVE_ATTACHMENT_LISTS,
|
||||
phd_capabilities.properties.vendor_id == db::qualcomm::VENDOR,
|
||||
);
|
||||
workarounds.set(
|
||||
super::Workarounds::FORCE_FILL_BUFFER_WITH_SIZE_GREATER_4096_ALIGNED_OFFSET_16,
|
||||
phd_capabilities.properties.vendor_id == db::nvidia::VENDOR,
|
||||
);
|
||||
};
|
||||
|
||||
if phd_capabilities.effective_api_version == vk::API_VERSION_1_0
|
||||
|
47
third_party/rust/wgpu-hal/src/vulkan/command.rs
vendored
47
third_party/rust/wgpu-hal/src/vulkan/command.rs
vendored
@ -212,15 +212,44 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
}
|
||||
|
||||
unsafe fn clear_buffer(&mut self, buffer: &super::Buffer, range: crate::MemoryRange) {
|
||||
unsafe {
|
||||
self.device.raw.cmd_fill_buffer(
|
||||
self.active,
|
||||
buffer.raw,
|
||||
range.start,
|
||||
range.end - range.start,
|
||||
0,
|
||||
)
|
||||
};
|
||||
let range_size = range.end - range.start;
|
||||
if self.device.workarounds.contains(
|
||||
super::Workarounds::FORCE_FILL_BUFFER_WITH_SIZE_GREATER_4096_ALIGNED_OFFSET_16,
|
||||
) && range_size >= 4096
|
||||
&& range.start % 16 != 0
|
||||
{
|
||||
let rounded_start = wgt::math::align_to(range.start, 16);
|
||||
let prefix_size = rounded_start - range.start;
|
||||
|
||||
unsafe {
|
||||
self.device.raw.cmd_fill_buffer(
|
||||
self.active,
|
||||
buffer.raw,
|
||||
range.start,
|
||||
prefix_size,
|
||||
0,
|
||||
)
|
||||
};
|
||||
|
||||
// This will never be zero, as rounding can only add up to 12 bytes, and the total size is 4096.
|
||||
let suffix_size = range.end - rounded_start;
|
||||
|
||||
unsafe {
|
||||
self.device.raw.cmd_fill_buffer(
|
||||
self.active,
|
||||
buffer.raw,
|
||||
rounded_start,
|
||||
suffix_size,
|
||||
0,
|
||||
)
|
||||
};
|
||||
} else {
|
||||
unsafe {
|
||||
self.device
|
||||
.raw
|
||||
.cmd_fill_buffer(self.active, buffer.raw, range.start, range_size, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn copy_buffer_to_buffer<T>(
|
||||
|
4
third_party/rust/wgpu-hal/src/vulkan/conv.rs
vendored
4
third_party/rust/wgpu-hal/src/vulkan/conv.rs
vendored
@ -792,6 +792,10 @@ fn map_blend_factor(factor: wgt::BlendFactor) -> vk::BlendFactor {
|
||||
Bf::SrcAlphaSaturated => vk::BlendFactor::SRC_ALPHA_SATURATE,
|
||||
Bf::Constant => vk::BlendFactor::CONSTANT_COLOR,
|
||||
Bf::OneMinusConstant => vk::BlendFactor::ONE_MINUS_CONSTANT_COLOR,
|
||||
Bf::Src1 => vk::BlendFactor::SRC1_COLOR,
|
||||
Bf::OneMinusSrc1 => vk::BlendFactor::ONE_MINUS_SRC1_COLOR,
|
||||
Bf::Src1Alpha => vk::BlendFactor::SRC1_ALPHA,
|
||||
Bf::OneMinusSrc1Alpha => vk::BlendFactor::ONE_MINUS_SRC1_ALPHA,
|
||||
}
|
||||
}
|
||||
|
||||
|
22
third_party/rust/wgpu-hal/src/vulkan/mod.rs
vendored
22
third_party/rust/wgpu-hal/src/vulkan/mod.rs
vendored
@ -207,6 +207,28 @@ bitflags::bitflags!(
|
||||
/// Qualcomm OOMs when there are zero color attachments but a non-null pointer
|
||||
/// to a subpass resolve attachment array. This nulls out that pointer in that case.
|
||||
const EMPTY_RESOLVE_ATTACHMENT_LISTS = 0x2;
|
||||
/// If the following code returns false, then nvidia will end up filling the wrong range.
|
||||
///
|
||||
/// ```skip
|
||||
/// fn nvidia_succeeds() -> bool {
|
||||
/// # let (copy_length, start_offset) = (0, 0);
|
||||
/// if copy_length >= 4096 {
|
||||
/// if start_offset % 16 != 0 {
|
||||
/// if copy_length == 4096 {
|
||||
/// return true;
|
||||
/// }
|
||||
/// if copy_length % 16 == 0 {
|
||||
/// return false;
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// true
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// As such, we need to make sure all calls to vkCmdFillBuffer are aligned to 16 bytes
|
||||
/// if they cover a range of 4096 bytes or more.
|
||||
const FORCE_FILL_BUFFER_WITH_SIZE_GREATER_4096_ALIGNED_OFFSET_16 = 0x4;
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"9f4a8846579ca480d493e80ad1488dcd18feb08c79aa833e2733808f0473d79b","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/assertions.rs":"3fe98027aa73970c8ab7874a3e13dbfd6faa87df2081beb5c83aeec4c60f372f","src/lib.rs":"d65636e17a80dd44eb06b7bee735020869a7165b63505f11b126ab1eb76a5107","src/math.rs":"4d03039736dd6926feb139bc68734cb59df34ede310427bbf059e5c925e0af3b"},"package":null}
|
||||
{"files":{"Cargo.toml":"468c2c0c8fc2f2105248e445cb029a11338f8bde5e0444db5a362ad08c0b68aa","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/assertions.rs":"3fe98027aa73970c8ab7874a3e13dbfd6faa87df2081beb5c83aeec4c60f372f","src/lib.rs":"b4a6796691445880ffd9473769db832197f7fc626ccd2c5602a11abddfc7e6d0","src/math.rs":"4d03039736dd6926feb139bc68734cb59df34ede310427bbf059e5c925e0af3b"},"package":null}
|
2
third_party/rust/wgpu-types/Cargo.toml
vendored
2
third_party/rust/wgpu-types/Cargo.toml
vendored
@ -44,7 +44,7 @@ features = ["serde_derive"]
|
||||
optional = true
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0.106"
|
||||
serde_json = "1.0.107"
|
||||
|
||||
[dev-dependencies.serde]
|
||||
version = "1"
|
||||
|
58
third_party/rust/wgpu-types/src/lib.rs
vendored
58
third_party/rust/wgpu-types/src/lib.rs
vendored
@ -270,7 +270,7 @@ bitflags::bitflags! {
|
||||
/// Supported Platforms:
|
||||
/// - Vulkan
|
||||
/// - DX12
|
||||
/// - Metal - TODO: Not yet supported on command encoder.
|
||||
/// - Metal
|
||||
///
|
||||
/// This is a web and native feature.
|
||||
const TIMESTAMP_QUERY = 1 << 1;
|
||||
@ -371,7 +371,7 @@ bitflags::bitflags! {
|
||||
/// Compressed textures sacrifice some quality in exchange for significantly reduced
|
||||
/// bandwidth usage.
|
||||
///
|
||||
/// Support for this feature guarantees availability of [`TextureUsages::COPY_SRC | TextureUsages::COPY_DST | TextureUsages::TEXTURE_BINDING`] for ASTC formats.
|
||||
/// Support for this feature guarantees availability of [`TextureUsages::COPY_SRC | TextureUsages::COPY_DST | TextureUsages::TEXTURE_BINDING`] for ASTC formats with Unorm/UnormSrgb channel type.
|
||||
/// [`Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES`] may enable additional usages.
|
||||
///
|
||||
/// Supported Platforms:
|
||||
@ -409,7 +409,7 @@ bitflags::bitflags! {
|
||||
/// Compressed textures sacrifice some quality in exchange for significantly reduced
|
||||
/// bandwidth usage.
|
||||
///
|
||||
/// Support for this feature guarantees availability of [`TextureUsages::COPY_SRC | TextureUsages::COPY_DST | TextureUsages::TEXTURE_BINDING`] for BCn formats.
|
||||
/// Support for this feature guarantees availability of [`TextureUsages::COPY_SRC | TextureUsages::COPY_DST | TextureUsages::TEXTURE_BINDING`] for ASTC formats with the HDR channel type.
|
||||
/// [`Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES`] may enable additional usages.
|
||||
///
|
||||
/// Supported Platforms:
|
||||
@ -458,10 +458,9 @@ bitflags::bitflags! {
|
||||
/// Supported platforms:
|
||||
/// - Vulkan
|
||||
/// - DX12
|
||||
/// - Metal (AMD & Intel, not Apple GPUs)
|
||||
///
|
||||
/// This is currently unimplemented on Metal.
|
||||
/// When implemented, it will be supported on Metal on AMD and Intel GPUs, but not Apple GPUs.
|
||||
/// (This is a common limitation of tile-based rasterization GPUs)
|
||||
/// This is generally not available on tile-based rasterization GPUs.
|
||||
///
|
||||
/// This is a native only feature with a [proposal](https://github.com/gpuweb/gpuweb/blob/0008bd30da2366af88180b511a5d0d0c1dffbc36/proposals/timestamp-query-inside-passes.md) for the web.
|
||||
const TIMESTAMP_QUERY_INSIDE_PASSES = 1 << 33;
|
||||
@ -738,6 +737,15 @@ bitflags::bitflags! {
|
||||
/// This is a native only feature.
|
||||
const VERTEX_ATTRIBUTE_64BIT = 1 << 53;
|
||||
|
||||
/// Allows vertex shaders to have outputs which are not consumed
|
||||
/// by the fragment shader.
|
||||
///
|
||||
/// Supported platforms:
|
||||
/// - Vulkan
|
||||
/// - Metal
|
||||
/// - OpenGL
|
||||
const SHADER_UNUSED_VERTEX_OUTPUT = 1 << 54;
|
||||
|
||||
// 54..59 available
|
||||
|
||||
// Shader:
|
||||
@ -782,7 +790,17 @@ bitflags::bitflags! {
|
||||
/// This is a native only feature.
|
||||
const SHADER_EARLY_DEPTH_TEST = 1 << 62;
|
||||
|
||||
// 62..64 available
|
||||
/// Allows two outputs from a shader to be used for blending.
|
||||
/// Note that dual-source blending doesn't support multiple render targets.
|
||||
///
|
||||
/// For more info see the OpenGL ES extension GL_EXT_blend_func_extended.
|
||||
///
|
||||
/// Supported platforms:
|
||||
/// - OpenGL ES (with GL_EXT_blend_func_extended)
|
||||
/// - Metal (with MSL 1.2+)
|
||||
/// - Vulkan (with dualSrcBlend)
|
||||
/// - DX12
|
||||
const DUAL_SOURCE_BLENDING = 1 << 63;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1550,6 +1568,8 @@ impl TextureViewDimension {
|
||||
///
|
||||
/// Corresponds to [WebGPU `GPUBlendFactor`](
|
||||
/// https://gpuweb.github.io/gpuweb/#enumdef-gpublendfactor).
|
||||
/// Values using S1 requires [`Features::DUAL_SOURCE_BLENDING`] and can only be
|
||||
/// used with the first render target.
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "trace", derive(Serialize))]
|
||||
@ -1582,6 +1602,29 @@ pub enum BlendFactor {
|
||||
Constant = 11,
|
||||
/// 1.0 - Constant
|
||||
OneMinusConstant = 12,
|
||||
/// S1.component
|
||||
Src1 = 13,
|
||||
/// 1.0 - S1.component
|
||||
OneMinusSrc1 = 14,
|
||||
/// S1.alpha
|
||||
Src1Alpha = 15,
|
||||
/// 1.0 - S1.alpha
|
||||
OneMinusSrc1Alpha = 16,
|
||||
}
|
||||
|
||||
impl BlendFactor {
|
||||
/// Returns `true` if the blend factor references the second blend source.
|
||||
///
|
||||
/// Note that the usage of those blend factors require [`Features::DUAL_SOURCE_BLENDING`].
|
||||
pub fn ref_second_blend_source(&self) -> bool {
|
||||
match self {
|
||||
BlendFactor::Src1
|
||||
| BlendFactor::OneMinusSrc1
|
||||
| BlendFactor::Src1Alpha
|
||||
| BlendFactor::OneMinusSrc1Alpha => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Alpha blend operation.
|
||||
@ -6430,6 +6473,7 @@ pub enum Gles3MinorVersion {
|
||||
}
|
||||
|
||||
/// Options for creating an instance.
|
||||
#[derive(Debug)]
|
||||
pub struct InstanceDescriptor {
|
||||
/// Which `Backends` to enable.
|
||||
pub backends: Backends,
|
||||
|
Loading…
Reference in New Issue
Block a user