forked from mirrors/gecko-dev
Bug 1636068 - Update spirv-cross to 0.20.0 r=groves
This change updates spirv-cross to a new version. Unlike the previous one, it now points to a SPIRV-Cross submodule in https://github.com/kvark/SPIRV-Cross behind "gecko3" branch, which will guarantee the rev to be accessible. Differential Revision: https://phabricator.services.mozilla.com/D75648
This commit is contained in:
parent
56e61eda29
commit
6c3a233284
70 changed files with 3017 additions and 354 deletions
|
|
@ -33,7 +33,7 @@ replace-with = "vendored-sources"
|
|||
rev = "9871d65530f5fc0e3d953efbf40b51e9c56c6d2a"
|
||||
|
||||
[source."https://github.com/kvark/spirv_cross"]
|
||||
branch = "wgpu2"
|
||||
branch = "wgpu3"
|
||||
git = "https://github.com/kvark/spirv_cross"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
|
|
|
|||
40
Cargo.lock
generated
40
Cargo.lock
generated
|
|
@ -517,6 +517,10 @@ name = "cc"
|
|||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cert_storage"
|
||||
|
|
@ -1720,9 +1724,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gfx-auxil"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b46e6f0031330a0be08d17820f2dcaaa91cb36710a97a9500cb4f1c36e785c8"
|
||||
checksum = "67bdbf8e8d6883c70e5a0d7379ad8ab3ac95127a3761306b36122d8f1c177a8e"
|
||||
dependencies = [
|
||||
"fxhash",
|
||||
"gfx-hal",
|
||||
|
|
@ -1731,9 +1735,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gfx-backend-dx11"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b148219292624126f78245e50a9720d95ea149a415ce8ce73ab7014205301b88"
|
||||
checksum = "92de0ddc0fde1a89b2a0e92dcc6bbb554bd34af0135e53a28d5ef064611094a4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"gfx-auxil",
|
||||
|
|
@ -1751,9 +1755,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gfx-backend-dx12"
|
||||
version = "0.5.1"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6facbfcdbb383b3cb7ea0709932ad1273e600a31a242255e80597297ce803dca"
|
||||
checksum = "37365e2927d55cefac0d3f78dfd1d3119fbb13a8bd7afe2409d729961fee22fc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"d3d12",
|
||||
|
|
@ -1779,9 +1783,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gfx-backend-metal"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfe128c29675b5afc8acdda1dfe096d6abd5e3528059ab0b98bda8215d8beed9"
|
||||
checksum = "205f3ca8e74ed814ea2c0206d47d8925077673cab2e21f9b12d48ff781cf87ee"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
|
|
@ -2143,6 +2147,15 @@ version = "0.4.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hibitset"
|
||||
version = "0.6.2"
|
||||
|
|
@ -3313,10 +3326,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.7.0"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d"
|
||||
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
|
|
@ -4422,15 +4436,15 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "spirv-cross-internal"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/kvark/spirv_cross?branch=wgpu2#f252537beb139a818b4a8c854e501690c9ade20e"
|
||||
source = "git+https://github.com/kvark/spirv_cross?branch=wgpu3#20191ad2f370afd6d247edcb9ff9da32d3bedb9c"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spirv_cross"
|
||||
version = "0.18.0"
|
||||
source = "git+https://github.com/kvark/spirv_cross?branch=wgpu2#f252537beb139a818b4a8c854e501690c9ade20e"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/kvark/spirv_cross?branch=wgpu3#20191ad2f370afd6d247edcb9ff9da32d3bedb9c"
|
||||
dependencies = [
|
||||
"spirv-cross-internal",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ libudev-sys = { path = "dom/webauthn/libudev-sys" }
|
|||
packed_simd = { git = "https://github.com/hsivonen/packed_simd", rev="3541e3818fdc7c2a24f87e3459151a4ce955a67a" }
|
||||
rlbox_lucet_sandbox = { git = "https://github.com/PLSysSec/rlbox_lucet_sandbox/", rev="d510da5999a744c563b0acd18056069d1698273f" }
|
||||
nix = { git = "https://github.com/shravanrn/nix/", branch = "r0.13.1", rev="4af6c367603869a30fddb5ffb0aba2b9477ba92e" }
|
||||
spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu2", rev = "f252537beb139a818b4a8c854e501690c9ade20e" }
|
||||
spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu3", rev = "20191ad2f370afd6d247edcb9ff9da32d3bedb9c" }
|
||||
# failure's backtrace feature might break our builds, see bug 1608157.
|
||||
failure = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }
|
||||
failure_derive = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"d9bacdc7fb6c94a0f98f766118b320b037be66cf28896b1edd348f900006ff49","src/lib.rs":"090ca4b005fe34762215078e30b7bca58f47fd6c43267a29d032ebe806428df9"},"package":"3b46e6f0031330a0be08d17820f2dcaaa91cb36710a97a9500cb4f1c36e785c8"}
|
||||
{"files":{"Cargo.toml":"9b0e5678bb84bb4544d0345516441de3000d56fdeba645b279d067c957bea539","src/lib.rs":"40fd89d510b2d69b6c6eaa3e6d902a4fb6225ed1ebadd798893b55cf2f5972bd"},"package":"67bdbf8e8d6883c70e5a0d7379ad8ab3ac95127a3761306b36122d8f1c177a8e"}
|
||||
4
third_party/rust/gfx-auxil/Cargo.toml
vendored
4
third_party/rust/gfx-auxil/Cargo.toml
vendored
|
|
@ -13,7 +13,7 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "gfx-auxil"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
authors = ["The Gfx-rs Developers"]
|
||||
description = "Implementation details shared between gfx-rs backends"
|
||||
homepage = "https://github.com/gfx-rs/gfx"
|
||||
|
|
@ -32,5 +32,5 @@ version = "0.5"
|
|||
package = "gfx-hal"
|
||||
|
||||
[dependencies.spirv_cross]
|
||||
version = "0.18"
|
||||
version = "0.20"
|
||||
optional = true
|
||||
|
|
|
|||
110
third_party/rust/gfx-auxil/src/lib.rs
vendored
110
third_party/rust/gfx-auxil/src/lib.rs
vendored
|
|
@ -1,55 +1,55 @@
|
|||
#[cfg(feature = "spirv_cross")]
|
||||
use {
|
||||
hal::{device::ShaderError, pso},
|
||||
spirv_cross::spirv,
|
||||
};
|
||||
|
||||
/// Fast hash map used internally.
|
||||
pub type FastHashMap<K, V> =
|
||||
std::collections::HashMap<K, V, std::hash::BuildHasherDefault<fxhash::FxHasher>>;
|
||||
pub type FastHashSet<K> =
|
||||
std::collections::HashSet<K, std::hash::BuildHasherDefault<fxhash::FxHasher>>;
|
||||
|
||||
#[cfg(feature = "spirv_cross")]
|
||||
pub fn spirv_cross_specialize_ast<T>(
|
||||
ast: &mut spirv::Ast<T>,
|
||||
specialization: &pso::Specialization,
|
||||
) -> Result<(), ShaderError>
|
||||
where
|
||||
T: spirv::Target,
|
||||
spirv::Ast<T>: spirv::Compile<T> + spirv::Parse<T>,
|
||||
{
|
||||
let spec_constants = ast.get_specialization_constants().map_err(|err| {
|
||||
ShaderError::CompilationFailed(match err {
|
||||
spirv_cross::ErrorCode::CompilationError(msg) => msg,
|
||||
spirv_cross::ErrorCode::Unhandled => "Unexpected specialization constant error".into(),
|
||||
})
|
||||
})?;
|
||||
|
||||
for spec_constant in spec_constants {
|
||||
if let Some(constant) = specialization
|
||||
.constants
|
||||
.iter()
|
||||
.find(|c| c.id == spec_constant.constant_id)
|
||||
{
|
||||
// Override specialization constant values
|
||||
let value = specialization.data
|
||||
[constant.range.start as usize .. constant.range.end as usize]
|
||||
.iter()
|
||||
.rev()
|
||||
.fold(0u64, |u, &b| (u << 8) + b as u64);
|
||||
|
||||
ast.set_scalar_constant(spec_constant.id, value)
|
||||
.map_err(|err| {
|
||||
ShaderError::CompilationFailed(match err {
|
||||
spirv_cross::ErrorCode::CompilationError(msg) => msg,
|
||||
spirv_cross::ErrorCode::Unhandled => {
|
||||
"Unexpected specialization constant error".into()
|
||||
}
|
||||
})
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(feature = "spirv_cross")]
|
||||
use {
|
||||
hal::{device::ShaderError, pso},
|
||||
spirv_cross::spirv,
|
||||
};
|
||||
|
||||
/// Fast hash map used internally.
|
||||
pub type FastHashMap<K, V> =
|
||||
std::collections::HashMap<K, V, std::hash::BuildHasherDefault<fxhash::FxHasher>>;
|
||||
pub type FastHashSet<K> =
|
||||
std::collections::HashSet<K, std::hash::BuildHasherDefault<fxhash::FxHasher>>;
|
||||
|
||||
#[cfg(feature = "spirv_cross")]
|
||||
pub fn spirv_cross_specialize_ast<T>(
|
||||
ast: &mut spirv::Ast<T>,
|
||||
specialization: &pso::Specialization,
|
||||
) -> Result<(), ShaderError>
|
||||
where
|
||||
T: spirv::Target,
|
||||
spirv::Ast<T>: spirv::Compile<T> + spirv::Parse<T>,
|
||||
{
|
||||
let spec_constants = ast.get_specialization_constants().map_err(|err| {
|
||||
ShaderError::CompilationFailed(match err {
|
||||
spirv_cross::ErrorCode::CompilationError(msg) => msg,
|
||||
spirv_cross::ErrorCode::Unhandled => "Unexpected specialization constant error".into(),
|
||||
})
|
||||
})?;
|
||||
|
||||
for spec_constant in spec_constants {
|
||||
if let Some(constant) = specialization
|
||||
.constants
|
||||
.iter()
|
||||
.find(|c| c.id == spec_constant.constant_id)
|
||||
{
|
||||
// Override specialization constant values
|
||||
let value = specialization.data
|
||||
[constant.range.start as usize .. constant.range.end as usize]
|
||||
.iter()
|
||||
.rev()
|
||||
.fold(0u64, |u, &b| (u << 8) + b as u64);
|
||||
|
||||
ast.set_scalar_constant(spec_constant.id, value)
|
||||
.map_err(|err| {
|
||||
ShaderError::CompilationFailed(match err {
|
||||
spirv_cross::ErrorCode::CompilationError(msg) => msg,
|
||||
spirv_cross::ErrorCode::Unhandled => {
|
||||
"Unexpected specialization constant error".into()
|
||||
}
|
||||
})
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"a7e447d8532e3ad094eada6105bdcc305ff62e4f4861b381e4ab182023a13cae","README.md":"aa7ff84146655d3957c043b5f71dc439712392c3a18c8c397d8c179bc43f75c0","shaders/blit.hlsl":"a00c57d25b6704a57cd17923c5b7a47608b3ab17b96e7e2ab1172283dc841194","shaders/clear.hlsl":"9b6747a76dabe37ff8e069cdbb8a9c22f6cf71a6d3041d358cd1569d1bb8e10f","shaders/copy.hlsl":"0a164e64b28e62e1d8895159c13e5aa9c74891f61d54939c0f79b08a2a5223c9","src/conv.rs":"1e6ccaa053c4b6d64c861b794364b3043b04b2506e214f854b15d5f055d98f36","src/debug.rs":"d0047b032491e190a939a6fb8920f7ce7c22dcec12449f16061537f65e5ef81f","src/device.rs":"d02f5efccd66563e0b1c1565e39178f2e9605070ffc2f65b45c19b6029b5b711","src/dxgi.rs":"1f3db576380f824682f7c1a8fc55ce0df277f3201e97dcf59e6d8dbe8ec4f851","src/internal.rs":"eb45d808dda1d94974e45377c0cd84d79b33fb4dd3ef1f83ed647b73908a6613","src/lib.rs":"a2039cb3390079901c2ec391cc47d2b113ad247a9532c579a39053eec6608d25","src/shader.rs":"a6ce3acf4731e99b48209afcc2a5136ce937f967bf5decad0903282e69215594"},"package":"b148219292624126f78245e50a9720d95ea149a415ce8ce73ab7014205301b88"}
|
||||
{"files":{"Cargo.toml":"91d3d17db1c6ac30c07d0d432a140b93a2c5a9e0396a8a95840f5630f1ea6b0f","README.md":"aa7ff84146655d3957c043b5f71dc439712392c3a18c8c397d8c179bc43f75c0","shaders/blit.hlsl":"a00c57d25b6704a57cd17923c5b7a47608b3ab17b96e7e2ab1172283dc841194","shaders/clear.hlsl":"9b6747a76dabe37ff8e069cdbb8a9c22f6cf71a6d3041d358cd1569d1bb8e10f","shaders/copy.hlsl":"0a164e64b28e62e1d8895159c13e5aa9c74891f61d54939c0f79b08a2a5223c9","src/conv.rs":"1e6ccaa053c4b6d64c861b794364b3043b04b2506e214f854b15d5f055d98f36","src/debug.rs":"d0047b032491e190a939a6fb8920f7ce7c22dcec12449f16061537f65e5ef81f","src/device.rs":"d02f5efccd66563e0b1c1565e39178f2e9605070ffc2f65b45c19b6029b5b711","src/dxgi.rs":"1f3db576380f824682f7c1a8fc55ce0df277f3201e97dcf59e6d8dbe8ec4f851","src/internal.rs":"eb45d808dda1d94974e45377c0cd84d79b33fb4dd3ef1f83ed647b73908a6613","src/lib.rs":"a2039cb3390079901c2ec391cc47d2b113ad247a9532c579a39053eec6608d25","src/shader.rs":"a6ce3acf4731e99b48209afcc2a5136ce937f967bf5decad0903282e69215594"},"package":"92de0ddc0fde1a89b2a0e92dcc6bbb554bd34af0135e53a28d5ef064611094a4"}
|
||||
6
third_party/rust/gfx-backend-dx11/Cargo.toml
vendored
6
third_party/rust/gfx-backend-dx11/Cargo.toml
vendored
|
|
@ -13,7 +13,7 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "gfx-backend-dx11"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
authors = ["The Gfx-rs Developers"]
|
||||
description = "DirectX-11 API backend for gfx-rs"
|
||||
homepage = "https://github.com/gfx-rs/gfx"
|
||||
|
|
@ -28,7 +28,7 @@ default-target = "x86_64-pc-windows-msvc"
|
|||
[lib]
|
||||
name = "gfx_backend_dx11"
|
||||
[dependencies.auxil]
|
||||
version = "0.3"
|
||||
version = "0.4"
|
||||
features = ["spirv_cross"]
|
||||
package = "gfx-auxil"
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ version = "0.3"
|
|||
version = "1.0"
|
||||
|
||||
[dependencies.spirv_cross]
|
||||
version = "0.18"
|
||||
version = "0.20"
|
||||
features = ["hlsl"]
|
||||
|
||||
[dependencies.winapi]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"6772efaec8db675d9ecee0acd47547898229fa7ed617f58ba1bbb318062f64c7","README.md":"53ad6efa9975b59f9ab830c26c940e18c3e41efd107cd34d670771a8ba53ae1a","shaders/blit.hlsl":"1f8819f3a91acf71a69bfd14ccd245180a92a9efb0ab76bf6b2e89aae10f3952","src/command.rs":"d00f66380601409595e85c5d2ad5e610a1c28067b5b1308b994d1bd7f9f08ad3","src/conv.rs":"157753744baa9fc74e2d185d0595bb23fbfbff702b8e04caaec4dfd45ec58d34","src/descriptors_cpu.rs":"2d8434fa23b71db6e51f4b6e68a63c4ce46159d74f027da2a309c4c0323956a7","src/device.rs":"9ceec25a68fadf1773f52688905cdc17e448e19cadcd5a874b4416c2a3b0d9c5","src/internal.rs":"374bf4f7fa58e687a29e3e3a5d78aa8965e39b8a89b49d591b827894f735b386","src/lib.rs":"2c8360f85165c8fe5a847ae4157554d7ebd6f91a34518b43541d88035f9bc419","src/pool.rs":"cc370b53a6843bcdbc507af013650505a60ab8b617747a3cb38c773e4ec1c6d7","src/resource.rs":"043b12a1cebdd87707815c4e6a1d42877ea5cbfc2f7d2e0458bf8e20970a86b4","src/root_constants.rs":"fce7f096f6a06c6796c937be0e1e9ae12c8183177a69be3387b33e33cf1d1b67","src/window.rs":"2dd210b0de1fb0ea1748110a5df35135c5231748a0d865b928ec7471bf0eaf9e"},"package":"6facbfcdbb383b3cb7ea0709932ad1273e600a31a242255e80597297ce803dca"}
|
||||
{"files":{"Cargo.toml":"b8f48d969b060df6ec59623515b15e37c368cd3eb3db6c8e7c9a21711a02569b","README.md":"53ad6efa9975b59f9ab830c26c940e18c3e41efd107cd34d670771a8ba53ae1a","shaders/blit.hlsl":"1f8819f3a91acf71a69bfd14ccd245180a92a9efb0ab76bf6b2e89aae10f3952","src/command.rs":"608edf7c3d4dd2ced812bbb44513c0e38ae7274d516645d17296ac8a5a32f1a6","src/conv.rs":"157753744baa9fc74e2d185d0595bb23fbfbff702b8e04caaec4dfd45ec58d34","src/descriptors_cpu.rs":"2d8434fa23b71db6e51f4b6e68a63c4ce46159d74f027da2a309c4c0323956a7","src/device.rs":"800ae8823c20544007d7ed64d6018ba542c6efc93cc0bede7f689d9ef77e11d0","src/internal.rs":"374bf4f7fa58e687a29e3e3a5d78aa8965e39b8a89b49d591b827894f735b386","src/lib.rs":"2c8360f85165c8fe5a847ae4157554d7ebd6f91a34518b43541d88035f9bc419","src/pool.rs":"cc370b53a6843bcdbc507af013650505a60ab8b617747a3cb38c773e4ec1c6d7","src/resource.rs":"043b12a1cebdd87707815c4e6a1d42877ea5cbfc2f7d2e0458bf8e20970a86b4","src/root_constants.rs":"fce7f096f6a06c6796c937be0e1e9ae12c8183177a69be3387b33e33cf1d1b67","src/window.rs":"2dd210b0de1fb0ea1748110a5df35135c5231748a0d865b928ec7471bf0eaf9e"},"package":"37365e2927d55cefac0d3f78dfd1d3119fbb13a8bd7afe2409d729961fee22fc"}
|
||||
6
third_party/rust/gfx-backend-dx12/Cargo.toml
vendored
6
third_party/rust/gfx-backend-dx12/Cargo.toml
vendored
|
|
@ -13,7 +13,7 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "gfx-backend-dx12"
|
||||
version = "0.5.1"
|
||||
version = "0.5.3"
|
||||
authors = ["The Gfx-rs Developers"]
|
||||
description = "DirectX-12 API backend for gfx-rs"
|
||||
homepage = "https://github.com/gfx-rs/gfx"
|
||||
|
|
@ -28,7 +28,7 @@ default-target = "x86_64-pc-windows-msvc"
|
|||
[lib]
|
||||
name = "gfx_backend_dx12"
|
||||
[dependencies.auxil]
|
||||
version = "0.3"
|
||||
version = "0.4"
|
||||
features = ["spirv_cross"]
|
||||
package = "gfx-auxil"
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ version = "0.3"
|
|||
version = "1"
|
||||
|
||||
[dependencies.spirv_cross]
|
||||
version = "0.18"
|
||||
version = "0.20"
|
||||
features = ["hlsl"]
|
||||
|
||||
[dependencies.winapi]
|
||||
|
|
|
|||
17
third_party/rust/gfx-backend-dx12/src/command.rs
vendored
17
third_party/rust/gfx-backend-dx12/src/command.rs
vendored
|
|
@ -143,7 +143,8 @@ impl UserData {
|
|||
}
|
||||
}
|
||||
|
||||
/// Update root constant values. Changes are marked as dirty.
|
||||
/// Write root constant values into the user data, overwriting virtual memory
|
||||
/// range [offset..offset + data.len()]. Changes are marked as dirty.
|
||||
fn set_constants(&mut self, offset: usize, data: &[u32]) {
|
||||
assert!(offset + data.len() <= ROOT_SIGNATURE_SIZE);
|
||||
// Each root constant occupies one DWORD
|
||||
|
|
@ -153,7 +154,8 @@ impl UserData {
|
|||
}
|
||||
}
|
||||
|
||||
/// Update descriptor table. Changes are marked as dirty.
|
||||
/// Write a SRV/CBV/UAV descriptor table into the user data, overwriting virtual
|
||||
/// memory range [offset..offset + 1]. Changes are marked as dirty.
|
||||
fn set_srv_cbv_uav_table(&mut self, offset: usize, table_start: u32) {
|
||||
assert!(offset < ROOT_SIGNATURE_SIZE);
|
||||
// A descriptor table occupies one DWORD
|
||||
|
|
@ -161,7 +163,8 @@ impl UserData {
|
|||
self.dirty_mask |= 1u64 << offset;
|
||||
}
|
||||
|
||||
/// Update descriptor table. Changes are marked as dirty.
|
||||
/// Write a sampler descriptor table into the user data, overwriting virtual
|
||||
/// memory range [offset..offset + 1]. Changes are marked as dirty.
|
||||
fn set_sampler_table(&mut self, offset: usize, table_start: u32) {
|
||||
assert!(offset < ROOT_SIGNATURE_SIZE);
|
||||
// A descriptor table occupies one DWORD
|
||||
|
|
@ -169,13 +172,15 @@ impl UserData {
|
|||
self.dirty_mask |= 1u64 << offset;
|
||||
}
|
||||
|
||||
///
|
||||
/// Write a CBV root descriptor into the user data, overwriting virtual
|
||||
/// memory range [offset..offset + 2]. Changes are marked as dirty.
|
||||
fn set_descriptor_cbv(&mut self, offset: usize, buffer: u64) {
|
||||
assert!(offset + 1 < ROOT_SIGNATURE_SIZE);
|
||||
// A root descriptor occupies two DWORDs
|
||||
self.data[offset] = RootElement::DescriptorCbv { buffer };
|
||||
self.data[offset + 1] = RootElement::DescriptorPlaceholder;
|
||||
self.dirty_mask |= 0b1u64 << offset;
|
||||
self.dirty_mask |= 0b1u64 << offset + 1;
|
||||
self.dirty_mask |= 1u64 << offset;
|
||||
self.dirty_mask |= 1u64 << offset + 1;
|
||||
}
|
||||
|
||||
fn is_dirty(&self) -> bool {
|
||||
|
|
|
|||
58
third_party/rust/gfx-backend-dx12/src/device.rs
vendored
58
third_party/rust/gfx-backend-dx12/src/device.rs
vendored
|
|
@ -1518,6 +1518,8 @@ impl d::Device<B> for Device {
|
|||
// Each descriptor set layout will be one table entry of the root signature.
|
||||
// We have the additional restriction that SRV/CBV/UAV and samplers need to be
|
||||
// separated, so each set layout will actually occupy up to 2 entries!
|
||||
// SRV/CBV/UAV tables are added to the signature first, then Sampler tables,
|
||||
// and finally dynamic uniform descriptors.
|
||||
//
|
||||
// Dynamic uniform buffers are implemented as root descriptors.
|
||||
// This allows to handle the dynamic offsets properly, which would not be feasible
|
||||
|
|
@ -1526,10 +1528,11 @@ impl d::Device<B> for Device {
|
|||
// Root signature layout:
|
||||
// Root Constants: Register: Offest/4, Space: 0
|
||||
// ...
|
||||
// DescriptorTable0: Space: 1 (+1) (SrvCbvUav)
|
||||
// Root Descriptors
|
||||
// DescriptorTable0: Space: 2 (+1) (Sampler)
|
||||
// DescriptorTable1: Space: 3 (+1) (SrvCbvUav)
|
||||
// DescriptorTable0: Space: 1 (SrvCbvUav)
|
||||
// DescriptorTable0: Space: 1 (Sampler)
|
||||
// Root Descriptors 0
|
||||
// DescriptorTable1: Space: 2 (SrvCbvUav)
|
||||
// Root Descriptors 1
|
||||
// ...
|
||||
|
||||
let sets = sets.into_iter().collect::<Vec<_>>();
|
||||
|
|
@ -1633,29 +1636,12 @@ impl d::Device<B> for Device {
|
|||
|
||||
let mut descriptors = Vec::new();
|
||||
let mut mutable_bindings = auxil::FastHashSet::default();
|
||||
|
||||
// SRV/CBV/UAV descriptor tables
|
||||
let mut range_base = ranges.len();
|
||||
for bind in set.bindings.iter() {
|
||||
let content = r::DescriptorContent::from(bind.ty);
|
||||
|
||||
if content.is_dynamic() {
|
||||
// Root Descriptor
|
||||
let binding = native::Binding {
|
||||
register: bind.binding as _,
|
||||
space,
|
||||
};
|
||||
|
||||
if content.contains(r::DescriptorContent::CBV) {
|
||||
descriptors.push(r::RootDescriptor {
|
||||
offset: root_offset,
|
||||
});
|
||||
parameters
|
||||
.push(native::RootParameter::cbv_descriptor(visibility, binding));
|
||||
root_offset += 2;
|
||||
} else {
|
||||
// SRV and UAV not implemented so far
|
||||
unimplemented!()
|
||||
}
|
||||
} else {
|
||||
if !content.is_dynamic() {
|
||||
// Descriptor table ranges
|
||||
if content.contains(r::DescriptorContent::CBV) {
|
||||
ranges.push(describe(bind, native::DescriptorRangeType::CBV));
|
||||
|
|
@ -1678,6 +1664,7 @@ impl d::Device<B> for Device {
|
|||
root_offset += 1;
|
||||
}
|
||||
|
||||
// Sampler descriptor tables
|
||||
range_base = ranges.len();
|
||||
for bind in set.bindings.iter() {
|
||||
let content = r::DescriptorContent::from(bind.ty);
|
||||
|
|
@ -1694,6 +1681,29 @@ impl d::Device<B> for Device {
|
|||
root_offset += 1;
|
||||
}
|
||||
|
||||
// Root (dynamic) descriptor tables
|
||||
for bind in set.bindings.iter() {
|
||||
let content = r::DescriptorContent::from(bind.ty);
|
||||
if content.is_dynamic() {
|
||||
let binding = native::Binding {
|
||||
register: bind.binding as _,
|
||||
space,
|
||||
};
|
||||
|
||||
if content.contains(r::DescriptorContent::CBV) {
|
||||
descriptors.push(r::RootDescriptor {
|
||||
offset: root_offset,
|
||||
});
|
||||
parameters
|
||||
.push(native::RootParameter::cbv_descriptor(visibility, binding));
|
||||
root_offset += 2;
|
||||
} else {
|
||||
// SRV and UAV not implemented so far
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
r::RootElement {
|
||||
table: r::RootTable {
|
||||
ty: table_type,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"126d7c0db193cdab96124382b4e801e093d0228ff896212c6df83886b9eed2ba","README.md":"0b5008f38b9cf1bda9de72f8ca467c399404df0e75daf3b1e5796f4d1fd7568f","shaders/blit.metal":"b243873ac0d7ded37b199d17d1a7b53d5332b4a57bfa22f99dcf60273730be45","shaders/clear.metal":"796a612c1cb48e46fc94b7227feaab993d7ddeed293b69e9f09b2dd88e6a1189","shaders/fill.metal":"2642b5df62f8eb2246a442137d083010d2a3132110d9be4eb25b479123098d25","shaders/gfx-shaders-ios.metallib":"b93c70027cf196548eac31a3cf5f37947ee2b13655445bc03c68c8224dad9613","shaders/gfx-shaders-macos.metallib":"cc7e8a6ad0a0d99197bdd9c65939e3a4d9960fa8aa181467363aa3578d68af54","shaders/macros.h":"a4550ac7c180935c2edb57aa7a5f8442b53f1f3dc65df8cc800d0afb8289cdeb","src/command.rs":"58be3498f916beca1cb5811ce589f30d31d72d2d35b1b494811edff0f3de9c3e","src/conversions.rs":"68fc4f31ad6c207b0b300c93fc711432ad2597b07dc865b537226ee4689b3846","src/device.rs":"f005f44c41548cc6637e5bae715913b7ab5c22554f8444c6a1e3e79dde794683","src/internal.rs":"5654ee0fc5acd5dab8def2724045dcba656c75c7ce5160765eb17da85f32020a","src/lib.rs":"9a2bb79c6a62e93c360f5f8dc8940793f7fb59827afce3c218357e1a0563f3c5","src/native.rs":"aed343d9a74b7f4fd81141c21d9daf578d3e91710e320a58690e65bb97180e51","src/soft.rs":"e7cc07ed5ebfcccaec8bf4529d6914647aa505dbc1f19da16493c69a64d1660d","src/window.rs":"b8ab41db35cd91cba8e24c532d0f3e643ccea78629ae3a5fdad8e36f8a200b24"},"package":"cfe128c29675b5afc8acdda1dfe096d6abd5e3528059ab0b98bda8215d8beed9"}
|
||||
{"files":{"Cargo.toml":"e65664b93b406b4049ac57d0008d188e51b82d812c6d9516d7ea67ebc78fcd09","README.md":"0b5008f38b9cf1bda9de72f8ca467c399404df0e75daf3b1e5796f4d1fd7568f","shaders/blit.metal":"b243873ac0d7ded37b199d17d1a7b53d5332b4a57bfa22f99dcf60273730be45","shaders/clear.metal":"796a612c1cb48e46fc94b7227feaab993d7ddeed293b69e9f09b2dd88e6a1189","shaders/fill.metal":"2642b5df62f8eb2246a442137d083010d2a3132110d9be4eb25b479123098d25","shaders/gfx-shaders-ios.metallib":"b93c70027cf196548eac31a3cf5f37947ee2b13655445bc03c68c8224dad9613","shaders/gfx-shaders-macos.metallib":"cc7e8a6ad0a0d99197bdd9c65939e3a4d9960fa8aa181467363aa3578d68af54","shaders/macros.h":"a4550ac7c180935c2edb57aa7a5f8442b53f1f3dc65df8cc800d0afb8289cdeb","src/command.rs":"fa57070ac5099cfb3b019597cd1a918feb3a0758bf66fa6390736cbe8c6f84f9","src/conversions.rs":"68fc4f31ad6c207b0b300c93fc711432ad2597b07dc865b537226ee4689b3846","src/device.rs":"f005f44c41548cc6637e5bae715913b7ab5c22554f8444c6a1e3e79dde794683","src/internal.rs":"5654ee0fc5acd5dab8def2724045dcba656c75c7ce5160765eb17da85f32020a","src/lib.rs":"9a2bb79c6a62e93c360f5f8dc8940793f7fb59827afce3c218357e1a0563f3c5","src/native.rs":"aed343d9a74b7f4fd81141c21d9daf578d3e91710e320a58690e65bb97180e51","src/soft.rs":"e7cc07ed5ebfcccaec8bf4529d6914647aa505dbc1f19da16493c69a64d1660d","src/window.rs":"b8ab41db35cd91cba8e24c532d0f3e643ccea78629ae3a5fdad8e36f8a200b24"},"package":"205f3ca8e74ed814ea2c0206d47d8925077673cab2e21f9b12d48ff781cf87ee"}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "gfx-backend-metal"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
authors = ["The Gfx-rs Developers"]
|
||||
description = "Metal API backend for gfx-rs"
|
||||
homepage = "https://github.com/gfx-rs/gfx"
|
||||
|
|
@ -31,7 +31,7 @@ name = "gfx_backend_metal"
|
|||
version = "0.5"
|
||||
|
||||
[dependencies.auxil]
|
||||
version = "0.3"
|
||||
version = "0.4"
|
||||
features = ["spirv_cross"]
|
||||
package = "gfx-auxil"
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ version = "0.3"
|
|||
version = "1"
|
||||
|
||||
[dependencies.spirv_cross]
|
||||
version = "0.18"
|
||||
version = "0.20"
|
||||
features = ["msl"]
|
||||
|
||||
[dependencies.storage-map]
|
||||
|
|
|
|||
|
|
@ -2624,7 +2624,7 @@ impl com::CommandBuffer<Backend> for CommandBuffer {
|
|||
|
||||
let end = sub.size.map_or(base_range.end, |s| {
|
||||
assert_eq!(s % WORD_ALIGNMENT, 0);
|
||||
base_range.start + s
|
||||
start + s
|
||||
});
|
||||
|
||||
if (data & 0xFF) * 0x0101_0101 == data {
|
||||
|
|
|
|||
1
third_party/rust/hermit-abi/.cargo-checksum.json
vendored
Normal file
1
third_party/rust/hermit-abi/.cargo-checksum.json
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"files":{"Cargo.toml":"dd977b9273d4463b1209bf9241b74edb2ec928aedab1e11c4137b5c0ec4d4533","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"8c4278de40812c689d00e854a052ff47e1abf0c03441537b3a9d7ee9a8c94617","rust-toolchain":"58bea07cb6d97f9cfcd5c8f98b1feca0fb81cce5b0bf29a8e70ed2641956e9a6","src/lib.rs":"d9b2246533bff48539b2bfa3ad92b1005f779d41a9e06829c026800dfb413e6e","src/tcpstream.rs":"73807a89635126a347da53ee7ffd07795e107e9dd98cd7d5914bc9f1ef4f5a8d"},"package":"61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4"}
|
||||
42
third_party/rust/hermit-abi/Cargo.toml
vendored
Normal file
42
third_party/rust/hermit-abi/Cargo.toml
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.12"
|
||||
authors = ["Stefan Lankes"]
|
||||
description = "hermit-abi is small interface to call functions from the unikernel RustyHermit.\nIt is used to build the target `x86_64-unknown-hermit`.\n"
|
||||
readme = "README.md"
|
||||
keywords = ["unikernel", "libos"]
|
||||
categories = ["os"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/hermitcore/rusty-hermit"
|
||||
[package.metadata.docs.rs]
|
||||
default-target = "x86_64-unknown-hermit"
|
||||
features = ["docs"]
|
||||
[dependencies.compiler_builtins]
|
||||
version = "0.1.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.core]
|
||||
version = "1.0.0"
|
||||
optional = true
|
||||
package = "rustc-std-workspace-core"
|
||||
|
||||
[dependencies.libc]
|
||||
version = "0.2.51"
|
||||
default-features = false
|
||||
|
||||
[features]
|
||||
default = []
|
||||
docs = []
|
||||
rustc-dep-of-std = ["core", "compiler_builtins/rustc-dep-of-std", "libc/rustc-dep-of-std"]
|
||||
201
third_party/rust/hermit-abi/LICENSE-APACHE
vendored
Normal file
201
third_party/rust/hermit-abi/LICENSE-APACHE
vendored
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
23
third_party/rust/hermit-abi/LICENSE-MIT
vendored
Normal file
23
third_party/rust/hermit-abi/LICENSE-MIT
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
22
third_party/rust/hermit-abi/README.md
vendored
Normal file
22
third_party/rust/hermit-abi/README.md
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# hermit-abi
|
||||
|
||||
[](https://crates.io/crates/hermit-abi)
|
||||
[](https://docs.rs/hermit-abi)
|
||||
[](https://img.shields.io/crates/l/hermit-abi.svg)
|
||||
|
||||
This is small interface to call functions from the unikernel [RustyHermit](https://github.com/hermitcore/libhermit-rs).
|
||||
|
||||
Please read the README of [RustyHermit](https://github.com/hermitcore/libhermit-rs) for more information.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
## Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|
||||
1
third_party/rust/hermit-abi/rust-toolchain
vendored
Normal file
1
third_party/rust/hermit-abi/rust-toolchain
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
nightly
|
||||
386
third_party/rust/hermit-abi/src/lib.rs
vendored
Normal file
386
third_party/rust/hermit-abi/src/lib.rs
vendored
Normal file
|
|
@ -0,0 +1,386 @@
|
|||
//! `hermit-abi` is small interface to call functions from the unikernel
|
||||
//! [RustyHermit](https://github.com/hermitcore/libhermit-rs).
|
||||
|
||||
#![cfg_attr(feature = "rustc-dep-of-std", no_std)]
|
||||
#![feature(const_raw_ptr_to_usize_cast)]
|
||||
extern crate libc;
|
||||
|
||||
pub mod tcpstream;
|
||||
|
||||
use libc::c_void;
|
||||
|
||||
// sysmbols, which are part of the library operating system
|
||||
extern "C" {
|
||||
fn sys_get_processor_count() -> usize;
|
||||
fn sys_malloc(size: usize, align: usize) -> *mut u8;
|
||||
fn sys_realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8;
|
||||
fn sys_free(ptr: *mut u8, size: usize, align: usize);
|
||||
fn sys_notify(id: usize, count: i32) -> i32;
|
||||
fn sys_add_queue(id: usize, timeout_ns: i64) -> i32;
|
||||
fn sys_wait(id: usize) -> i32;
|
||||
fn sys_destroy_queue(id: usize) -> i32;
|
||||
fn sys_read(fd: i32, buf: *mut u8, len: usize) -> isize;
|
||||
fn sys_write(fd: i32, buf: *const u8, len: usize) -> isize;
|
||||
fn sys_close(fd: i32) -> i32;
|
||||
fn sys_sem_init(sem: *mut *const c_void, value: u32) -> i32;
|
||||
fn sys_sem_destroy(sem: *const c_void) -> i32;
|
||||
fn sys_sem_post(sem: *const c_void) -> i32;
|
||||
fn sys_sem_trywait(sem: *const c_void) -> i32;
|
||||
fn sys_sem_timedwait(sem: *const c_void, ms: u32) -> i32;
|
||||
fn sys_recmutex_init(recmutex: *mut *const c_void) -> i32;
|
||||
fn sys_recmutex_destroy(recmutex: *const c_void) -> i32;
|
||||
fn sys_recmutex_lock(recmutex: *const c_void) -> i32;
|
||||
fn sys_recmutex_unlock(recmutex: *const c_void) -> i32;
|
||||
fn sys_getpid() -> u32;
|
||||
fn sys_exit(arg: i32) -> !;
|
||||
fn sys_abort() -> !;
|
||||
fn sys_usleep(usecs: u64);
|
||||
fn sys_spawn(
|
||||
id: *mut Tid,
|
||||
func: extern "C" fn(usize),
|
||||
arg: usize,
|
||||
prio: u8,
|
||||
core_id: isize,
|
||||
) -> i32;
|
||||
fn sys_spawn2(
|
||||
func: extern "C" fn(usize),
|
||||
arg: usize,
|
||||
prio: u8,
|
||||
stack_size: usize,
|
||||
core_id: isize,
|
||||
) -> Tid;
|
||||
fn sys_join(id: Tid) -> i32;
|
||||
fn sys_yield();
|
||||
fn sys_clock_gettime(clock_id: u64, tp: *mut timespec) -> i32;
|
||||
fn sys_open(name: *const i8, flags: i32, mode: i32) -> i32;
|
||||
fn sys_unlink(name: *const i8) -> i32;
|
||||
fn sys_network_init() -> i32;
|
||||
}
|
||||
|
||||
/// A thread handle type
|
||||
pub type Tid = u32;
|
||||
|
||||
/// Priority of a thread
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)]
|
||||
pub struct Priority(u8);
|
||||
|
||||
impl Priority {
|
||||
pub const fn into(self) -> u8 {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub const fn from(x: u8) -> Self {
|
||||
Priority(x)
|
||||
}
|
||||
}
|
||||
|
||||
pub const HIGH_PRIO: Priority = Priority::from(3);
|
||||
pub const NORMAL_PRIO: Priority = Priority::from(2);
|
||||
pub const LOW_PRIO: Priority = Priority::from(1);
|
||||
|
||||
/// A handle, identifying a socket
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
|
||||
pub struct Handle(usize);
|
||||
|
||||
pub const NSEC_PER_SEC: u64 = 1_000_000_000;
|
||||
pub const CLOCK_REALTIME: u64 = 1;
|
||||
pub const CLOCK_MONOTONIC: u64 = 4;
|
||||
pub const STDIN_FILENO: libc::c_int = 0;
|
||||
pub const STDOUT_FILENO: libc::c_int = 1;
|
||||
pub const STDERR_FILENO: libc::c_int = 2;
|
||||
pub const O_RDONLY: i32 = 0o0;
|
||||
pub const O_WRONLY: i32 = 0o1;
|
||||
pub const O_RDWR: i32 = 0o2;
|
||||
pub const O_CREAT: i32 = 0o100;
|
||||
pub const O_EXCL: i32 = 0o200;
|
||||
pub const O_TRUNC: i32 = 0o1000;
|
||||
pub const O_APPEND: i32 = 0o2000;
|
||||
|
||||
/// returns true if file descriptor `fd` is a tty
|
||||
pub fn isatty(_fd: libc::c_int) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// intialize the network stack
|
||||
pub fn network_init() -> i32 {
|
||||
unsafe { sys_network_init() }
|
||||
}
|
||||
|
||||
/// `timespec` is used by `clock_gettime` to retrieve the
|
||||
/// current time
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(C)]
|
||||
pub struct timespec {
|
||||
/// seconds
|
||||
pub tv_sec: i64,
|
||||
/// nanoseconds
|
||||
pub tv_nsec: i64,
|
||||
}
|
||||
|
||||
/// determines the number of activated processors
|
||||
#[inline(always)]
|
||||
pub unsafe fn get_processor_count() -> usize {
|
||||
sys_get_processor_count()
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn malloc(size: usize, align: usize) -> *mut u8 {
|
||||
sys_malloc(size, align)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8 {
|
||||
sys_realloc(ptr, size, align, new_size)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn free(ptr: *mut u8, size: usize, align: usize) {
|
||||
sys_free(ptr, size, align)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn notify(id: usize, count: i32) -> i32 {
|
||||
sys_notify(id, count)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn add_queue(id: usize, timeout_ns: i64) -> i32 {
|
||||
sys_add_queue(id, timeout_ns)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn wait(id: usize) -> i32 {
|
||||
sys_wait(id)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn destroy_queue(id: usize) -> i32 {
|
||||
sys_destroy_queue(id)
|
||||
}
|
||||
|
||||
/// read from a file descriptor
|
||||
///
|
||||
/// read() attempts to read `len` bytes of data from the object
|
||||
/// referenced by the descriptor `fd` into the buffer pointed
|
||||
/// to by `buf`.
|
||||
#[inline(always)]
|
||||
pub unsafe fn read(fd: i32, buf: *mut u8, len: usize) -> isize {
|
||||
sys_read(fd, buf, len)
|
||||
}
|
||||
|
||||
/// write to a file descriptor
|
||||
///
|
||||
/// write() attempts to write `len` of data to the object
|
||||
/// referenced by the descriptor `fd` from the
|
||||
/// buffer pointed to by `buf`.
|
||||
#[inline(always)]
|
||||
pub unsafe fn write(fd: i32, buf: *const u8, len: usize) -> isize {
|
||||
sys_write(fd, buf, len)
|
||||
}
|
||||
|
||||
/// close a file descriptor
|
||||
///
|
||||
/// The close() call deletes a file descriptor `fd` from the object
|
||||
/// reference table.
|
||||
#[inline(always)]
|
||||
pub unsafe fn close(fd: i32) -> i32 {
|
||||
sys_close(fd)
|
||||
}
|
||||
|
||||
/// sem_init() initializes the unnamed semaphore at the address
|
||||
/// pointed to by `sem`. The `value` argument specifies the
|
||||
/// initial value for the semaphore.
|
||||
#[inline(always)]
|
||||
pub unsafe fn sem_init(sem: *mut *const c_void, value: u32) -> i32 {
|
||||
sys_sem_init(sem, value)
|
||||
}
|
||||
|
||||
/// sem_destroy() frees the unnamed semaphore at the address
|
||||
/// pointed to by `sem`.
|
||||
#[inline(always)]
|
||||
pub unsafe fn sem_destroy(sem: *const c_void) -> i32 {
|
||||
sys_sem_destroy(sem)
|
||||
}
|
||||
|
||||
/// sem_post() increments the semaphore pointed to by `sem`.
|
||||
/// If the semaphore's value consequently becomes greater
|
||||
/// than zero, then another thread blocked in a sem_wait call
|
||||
/// will be woken up and proceed to lock the semaphore.
|
||||
#[inline(always)]
|
||||
pub unsafe fn sem_post(sem: *const c_void) -> i32 {
|
||||
sys_sem_post(sem)
|
||||
}
|
||||
|
||||
/// try to decrement a semaphore
|
||||
///
|
||||
/// sem_trywait() is the same as sem_timedwait(), except that
|
||||
/// if the decrement cannot be immediately performed, then call
|
||||
/// returns a negative value instead of blocking.
|
||||
#[inline(always)]
|
||||
pub unsafe fn sem_trywait(sem: *const c_void) -> i32 {
|
||||
sys_sem_trywait(sem)
|
||||
}
|
||||
|
||||
/// decrement a semaphore
|
||||
///
|
||||
/// sem_timedwait() decrements the semaphore pointed to by `sem`.
|
||||
/// If the semaphore's value is greater than zero, then the
|
||||
/// the function returns immediately. If the semaphore currently
|
||||
/// has the value zero, then the call blocks until either
|
||||
/// it becomes possible to perform the decrement of the time limit
|
||||
/// to wait for the semaphore is expired. A time limit `ms` of
|
||||
/// means infinity waiting time.
|
||||
#[inline(always)]
|
||||
pub unsafe fn sem_timedwait(sem: *const c_void, ms: u32) -> i32 {
|
||||
sys_sem_timedwait(sem, ms)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn recmutex_init(recmutex: *mut *const c_void) -> i32 {
|
||||
sys_recmutex_init(recmutex)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn recmutex_destroy(recmutex: *const c_void) -> i32 {
|
||||
sys_recmutex_destroy(recmutex)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn recmutex_lock(recmutex: *const c_void) -> i32 {
|
||||
sys_recmutex_lock(recmutex)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
pub unsafe fn recmutex_unlock(recmutex: *const c_void) -> i32 {
|
||||
sys_recmutex_unlock(recmutex)
|
||||
}
|
||||
|
||||
/// Determines the id of the current thread
|
||||
#[inline(always)]
|
||||
pub unsafe fn getpid() -> u32 {
|
||||
sys_getpid()
|
||||
}
|
||||
|
||||
/// cause normal termination and return `arg`
|
||||
/// to the host system
|
||||
#[inline(always)]
|
||||
pub unsafe fn exit(arg: i32) -> ! {
|
||||
sys_exit(arg)
|
||||
}
|
||||
|
||||
/// cause abnormal termination
|
||||
#[inline(always)]
|
||||
pub unsafe fn abort() -> ! {
|
||||
sys_abort()
|
||||
}
|
||||
|
||||
/// suspend execution for microsecond intervals
|
||||
///
|
||||
/// The usleep() function suspends execution of the calling
|
||||
/// thread for (at least) `usecs` microseconds.
|
||||
#[inline(always)]
|
||||
pub unsafe fn usleep(usecs: u64) {
|
||||
sys_usleep(usecs)
|
||||
}
|
||||
|
||||
/// spawn a new thread
|
||||
///
|
||||
/// spawn() starts a new thread. The new thread starts execution
|
||||
/// by invoking `func(usize)`; `arg` is passed as the argument
|
||||
/// to `func`. `prio` defines the priority of the new thread,
|
||||
/// which can be between `LOW_PRIO` and `HIGH_PRIO`.
|
||||
/// `core_id` defines the core, where the thread is located.
|
||||
/// A negative value give the operating system the possibility
|
||||
/// to select the core by its own.
|
||||
#[inline(always)]
|
||||
pub unsafe fn spawn(
|
||||
id: *mut Tid,
|
||||
func: extern "C" fn(usize),
|
||||
arg: usize,
|
||||
prio: u8,
|
||||
core_id: isize,
|
||||
) -> i32 {
|
||||
sys_spawn(id, func, arg, prio, core_id)
|
||||
}
|
||||
|
||||
/// spawn a new thread with user-specified stack size
|
||||
///
|
||||
/// spawn2() starts a new thread. The new thread starts execution
|
||||
/// by invoking `func(usize)`; `arg` is passed as the argument
|
||||
/// to `func`. `prio` defines the priority of the new thread,
|
||||
/// which can be between `LOW_PRIO` and `HIGH_PRIO`.
|
||||
/// `core_id` defines the core, where the thread is located.
|
||||
/// A negative value give the operating system the possibility
|
||||
/// to select the core by its own.
|
||||
/// In contrast to spawn(), spawn2() is able to define the
|
||||
/// stack size.
|
||||
#[inline(always)]
|
||||
pub unsafe fn spawn2(
|
||||
func: extern "C" fn(usize),
|
||||
arg: usize,
|
||||
prio: u8,
|
||||
stack_size: usize,
|
||||
core_id: isize,
|
||||
) -> Tid {
|
||||
sys_spawn2(func, arg, prio, stack_size, core_id)
|
||||
}
|
||||
|
||||
/// join with a terminated thread
|
||||
///
|
||||
/// The join() function waits for the thread specified by `id`
|
||||
/// to terminate.
|
||||
#[inline(always)]
|
||||
pub unsafe fn join(id: Tid) -> i32 {
|
||||
sys_join(id)
|
||||
}
|
||||
|
||||
/// yield the processor
|
||||
///
|
||||
/// causes the calling thread to relinquish the CPU. The thread
|
||||
/// is moved to the end of the queue for its static priority.
|
||||
#[inline(always)]
|
||||
pub unsafe fn yield_now() {
|
||||
sys_yield()
|
||||
}
|
||||
|
||||
/// get current time
|
||||
///
|
||||
/// The clock_gettime() functions allow the calling thread
|
||||
/// to retrieve the value used by a clock which is specified
|
||||
/// by `clock_id`.
|
||||
///
|
||||
/// `CLOCK_REALTIME`: the system's real time clock,
|
||||
/// expressed as the amount of time since the Epoch.
|
||||
///
|
||||
/// `CLOCK_MONOTONIC`: clock that increments monotonically,
|
||||
/// tracking the time since an arbitrary point
|
||||
#[inline(always)]
|
||||
pub unsafe fn clock_gettime(clock_id: u64, tp: *mut timespec) -> i32 {
|
||||
sys_clock_gettime(clock_id, tp)
|
||||
}
|
||||
|
||||
/// open and possibly create a file
|
||||
///
|
||||
/// The open() system call opens the file specified by `name`.
|
||||
/// If the specified file does not exist, it may optionally
|
||||
/// be created by open().
|
||||
#[inline(always)]
|
||||
pub unsafe fn open(name: *const i8, flags: i32, mode: i32) -> i32 {
|
||||
sys_open(name, flags, mode)
|
||||
}
|
||||
|
||||
/// delete the file it refers to `name`
|
||||
#[inline(always)]
|
||||
pub unsafe fn unlink(name: *const i8) -> i32 {
|
||||
sys_unlink(name)
|
||||
}
|
||||
110
third_party/rust/hermit-abi/src/tcpstream.rs
vendored
Normal file
110
third_party/rust/hermit-abi/src/tcpstream.rs
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
//! `tcpstream` provide an interface to the network stack
|
||||
|
||||
use crate::Handle;
|
||||
|
||||
extern "Rust" {
|
||||
fn sys_tcp_stream_connect(ip: &[u8], port: u16, timeout: Option<u64>) -> Result<Handle, ()>;
|
||||
fn sys_tcp_stream_close(handle: Handle) -> Result<(), ()>;
|
||||
fn sys_tcp_stream_read(handle: Handle, buffer: &mut [u8]) -> Result<usize, ()>;
|
||||
fn sys_tcp_stream_write(handle: Handle, buffer: &[u8]) -> Result<usize, ()>;
|
||||
fn sys_tcp_stream_set_read_timeout(handle: Handle, timeout: Option<u64>) -> Result<(), ()>;
|
||||
fn sys_tcp_stream_get_read_timeout(handle: Handle) -> Result<Option<u64>, ()>;
|
||||
fn sys_tcp_stream_set_write_timeout(handle: Handle, timeout: Option<u64>) -> Result<(), ()>;
|
||||
fn sys_tcp_stream_get_write_timeout(handle: Handle) -> Result<Option<u64>, ()>;
|
||||
fn sys_tcp_stream_duplicate(handle: Handle) -> Result<Handle, ()>;
|
||||
fn sys_tcp_stream_peek(handle: Handle, buf: &mut [u8]) -> Result<usize, ()>;
|
||||
fn sys_tcp_stream_set_nonblocking(handle: Handle, mode: bool) -> Result<(), ()>;
|
||||
fn sys_tcp_stream_set_tll(handle: Handle, ttl: u32) -> Result<(), ()>;
|
||||
fn sys_tcp_stream_get_tll(handle: Handle) -> Result<u32, ()>;
|
||||
fn sys_tcp_stream_shutdown(handle: Handle, how: i32) -> Result<(), ()>;
|
||||
}
|
||||
|
||||
/// Opens a TCP connection to a remote host.
|
||||
#[inline(always)]
|
||||
pub fn connect(ip: &[u8], port: u16, timeout: Option<u64>) -> Result<Handle, ()> {
|
||||
unsafe { sys_tcp_stream_connect(ip, port, timeout) }
|
||||
}
|
||||
|
||||
/// Close a TCP connection
|
||||
#[inline(always)]
|
||||
pub fn close(handle: Handle) -> Result<(), ()> {
|
||||
unsafe { sys_tcp_stream_close(handle) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn duplicate(handle: Handle) -> Result<Handle, ()> {
|
||||
unsafe { sys_tcp_stream_duplicate(handle) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn peek(handle: Handle, buf: &mut [u8]) -> Result<usize, ()> {
|
||||
unsafe { sys_tcp_stream_peek(handle, buf) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn read(handle: Handle, buffer: &mut [u8]) -> Result<usize, ()> {
|
||||
unsafe { sys_tcp_stream_read(handle, buffer) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn write(handle: Handle, buffer: &[u8]) -> Result<usize, ()> {
|
||||
unsafe { sys_tcp_stream_write(handle, buffer) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn set_read_timeout(handle: Handle, timeout: Option<u64>) -> Result<(), ()> {
|
||||
unsafe { sys_tcp_stream_set_read_timeout(handle, timeout) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn set_write_timeout(handle: Handle, timeout: Option<u64>) -> Result<(), ()> {
|
||||
unsafe { sys_tcp_stream_set_write_timeout(handle, timeout) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_read_timeout(handle: Handle) -> Result<Option<u64>, ()> {
|
||||
unsafe { sys_tcp_stream_get_read_timeout(handle) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_write_timeout(handle: Handle) -> Result<Option<u64>, ()> {
|
||||
unsafe { sys_tcp_stream_get_write_timeout(handle) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn set_nodelay(_: Handle, mode: bool) -> Result<(), ()> {
|
||||
// smoltcp does not support Nagle's algorithm
|
||||
// => to enable Nagle's algorithm ins't possineö
|
||||
if mode == true {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn nodelay(_: Handle) -> Result<bool, ()> {
|
||||
// smoltcp does not support Nagle's algorithm
|
||||
// => return always true
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn set_nonblocking(handle: Handle, mode: bool) -> Result<(), ()> {
|
||||
unsafe { sys_tcp_stream_set_nonblocking(handle, mode) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn set_tll(handle: Handle, ttl: u32) -> Result<(), ()> {
|
||||
unsafe { sys_tcp_stream_set_tll(handle, ttl) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_tll(handle: Handle) -> Result<u32, ()> {
|
||||
unsafe { sys_tcp_stream_get_tll(handle) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn shutdown(handle: Handle, how: i32) -> Result<(), ()> {
|
||||
unsafe { sys_tcp_stream_shutdown(handle, how) }
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
{"files":{"CHANGELOG.md":"fef18c34a831fd8d6a6c4248ee76363a2ff273757989fd0f1fd0ba410421c08b","CONTRIBUTING.md":"2390961aab1bba026135338da1216b6cc828dfaeed9357d9c155c55a252d3efb","Cargo.toml":"70e408f452f3b9a83dd60cf5d1e2fcf92982a0fffbd017601e974e0ea2df3224","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0593d22d122d4bfec6407115e3907546312976f75473417aaa4c57ecd2095ae6","README.md":"12451d6905fe9cdac206410de8071b562e5ea936b6e55a19ac97982831a0fcdb","src/lib.rs":"deccac6ae539302e2f1c12b4f91cecd1583272916543ea09717a6ac91efc133c"},"package":"514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d"}
|
||||
{"files":{"CHANGELOG.md":"648196d9fad2d62618f5778dab9127cf6bb801e3a432d72179f118350d36ff23","CONTRIBUTING.md":"2390961aab1bba026135338da1216b6cc828dfaeed9357d9c155c55a252d3efb","Cargo.lock":"a7cbc6156b3b0ed9e8afdaae9668067e86aaeafc237f99c87e7fda76d8032c24","Cargo.toml":"08fed4ec7fac699f408ef1abdd39b1a6294b2c015cfe859eedbbb4c286bb7912","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0593d22d122d4bfec6407115e3907546312976f75473417aaa4c57ecd2095ae6","README.md":"12451d6905fe9cdac206410de8071b562e5ea936b6e55a19ac97982831a0fcdb","ci/cgroups/Dockerfile":"b018cda01776cabe033af06a22c5ad337c90c07fdb8093e94857f2fc5a0b2bdb","examples/values.rs":"46c833324b7339d359054c4f8e8284259e860df206c552c63b5893ade59c16a6","fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us":"d2ace393dc9388863d75d8de140df516d7ffe4aa7ed2f9a545aa71c9930d6638","fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us":"7ccd86cde0b22ffc2318f2509726d2a13053f6973e96dc5ca6965a56497e485e","fixtures/cgroups/cgroups/good/cpu.cfs_period_us":"d2ace393dc9388863d75d8de140df516d7ffe4aa7ed2f9a545aa71c9930d6638","fixtures/cgroups/cgroups/good/cpu.cfs_quota_us":"cdc3397c35d915e5fe61f8d2bdedcae00a225d55cc6b090580cde1b71c63463b","fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us":"74d01a0c051c963d9a9b8ab9dbeab1723f0ad8534ea9fa6a942f358d7fa011b4","fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us":"1e6ffd8a95fab538ddd645a767e8cc505722d5c8aaf008969f2ed8ab753ff61e","fixtures/cgroups/proc/cgroups/cgroup":"6812299a4409bfd831ed751fdbbfdd9c5749f69acd7b14c5b0a704271a1f74c6","fixtures/cgroups/proc/cgroups/mountinfo":"3187b0b1c0fa192790abced7d435190e8979059186055688e4c3c2ca013398c6","src/lib.rs":"e1ce45ba3b2655fabb49ea0af50080808fd305c884d79cb4b9527198dab828ac","src/linux.rs":"c10382e85a4b196d6fd9a481d9b3d5978b8bb18eaeb7670716ced7d71b919f5e"},"package":"05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"}
|
||||
55
third_party/rust/num_cpus/CHANGELOG.md
vendored
55
third_party/rust/num_cpus/CHANGELOG.md
vendored
|
|
@ -1,3 +1,58 @@
|
|||
## v1.13.0
|
||||
|
||||
### Features
|
||||
|
||||
- add Linux cgroups support when calling `get()`.
|
||||
|
||||
## v1.12.0
|
||||
|
||||
#### Fixes
|
||||
|
||||
- fix `get` on OpenBSD to ignore offline CPUs
|
||||
- implement `get_physical` on OpenBSD
|
||||
|
||||
## v1.11.1
|
||||
|
||||
#### Fixes
|
||||
|
||||
- Use `mem::zeroed` instead of `mem::uninitialized`.
|
||||
|
||||
## v1.11.0
|
||||
|
||||
#### Features
|
||||
|
||||
- add `hermit` target OS support
|
||||
- removes `bitrig` support
|
||||
|
||||
#### Fixes
|
||||
|
||||
- fix `get_physical` count with AMD hyperthreading.
|
||||
|
||||
## v1.10.1
|
||||
|
||||
#### Fixes
|
||||
|
||||
- improve `haiku` CPU detection
|
||||
|
||||
## v1.10.0
|
||||
|
||||
#### Features
|
||||
|
||||
- add `illumos` target OS support
|
||||
- add default fallback if target is unknown to `1`
|
||||
|
||||
## v1.9.0
|
||||
|
||||
#### Features
|
||||
|
||||
- add `sgx` target env support
|
||||
|
||||
## v1.8.0
|
||||
|
||||
#### Features
|
||||
|
||||
- add `wasm-unknown-unknown` target support
|
||||
|
||||
## v1.7.0
|
||||
|
||||
#### Features
|
||||
|
|
|
|||
26
third_party/rust/num_cpus/Cargo.lock
generated
vendored
Normal file
26
third_party/rust/num_cpus/Cargo.lock
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.0"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120"
|
||||
"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8"
|
||||
6
third_party/rust/num_cpus/Cargo.toml
vendored
6
third_party/rust/num_cpus/Cargo.toml
vendored
|
|
@ -3,7 +3,7 @@
|
|||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "num_cpus"
|
||||
version = "1.7.0"
|
||||
version = "1.13.0"
|
||||
authors = ["Sean McArthur <sean@seanmonstar.com>"]
|
||||
description = "Get the number of CPUs on a machine."
|
||||
documentation = "https://docs.rs/num_cpus"
|
||||
|
|
@ -23,3 +23,5 @@ license = "MIT/Apache-2.0"
|
|||
repository = "https://github.com/seanmonstar/num_cpus"
|
||||
[dependencies.libc]
|
||||
version = "0.2.26"
|
||||
[target."cfg(all(any(target_arch = \"x86_64\", target_arch = \"aarch64\"), target_os = \"hermit\"))".dependencies.hermit-abi]
|
||||
version = "0.1.3"
|
||||
|
|
|
|||
9
third_party/rust/num_cpus/ci/cgroups/Dockerfile
vendored
Normal file
9
third_party/rust/num_cpus/ci/cgroups/Dockerfile
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
FROM rust:1.40
|
||||
|
||||
WORKDIR /usr/num_cpus
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build
|
||||
|
||||
CMD [ "cargo", "test", "--lib" ]
|
||||
6
third_party/rust/num_cpus/examples/values.rs
vendored
Normal file
6
third_party/rust/num_cpus/examples/values.rs
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extern crate num_cpus;
|
||||
|
||||
fn main() {
|
||||
println!("Logical CPUs: {}", num_cpus::get());
|
||||
println!("Physical CPUs: {}", num_cpus::get_physical());
|
||||
}
|
||||
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us
vendored
Normal file
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
100000
|
||||
|
||||
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us
vendored
Normal file
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
150000
|
||||
|
||||
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/good/cpu.cfs_period_us
vendored
Normal file
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/good/cpu.cfs_period_us
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
100000
|
||||
|
||||
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/good/cpu.cfs_quota_us
vendored
Normal file
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/good/cpu.cfs_quota_us
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
600000
|
||||
|
||||
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us
vendored
Normal file
2
third_party/rust/num_cpus/fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
0
|
||||
|
||||
1
third_party/rust/num_cpus/fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us
vendored
Normal file
1
third_party/rust/num_cpus/fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
600000
|
||||
3
third_party/rust/num_cpus/fixtures/cgroups/proc/cgroups/cgroup
vendored
Normal file
3
third_party/rust/num_cpus/fixtures/cgroups/proc/cgroups/cgroup
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
12:perf_event:/
|
||||
11:cpu,cpuacct:/
|
||||
3:devices:/user.slice
|
||||
8
third_party/rust/num_cpus/fixtures/cgroups/proc/cgroups/mountinfo
vendored
Normal file
8
third_party/rust/num_cpus/fixtures/cgroups/proc/cgroups/mountinfo
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
1 0 8:1 / / rw,noatime shared:1 - ext4 /dev/sda1 rw,errors=remount-ro,data=reordered
|
||||
2 1 0:1 / /dev rw,relatime shared:2 - devtmpfs udev rw,size=10240k,nr_inodes=16487629,mode=755
|
||||
3 1 0:2 / /proc rw,nosuid,nodev,noexec,relatime shared:3 - proc proc rw
|
||||
4 1 0:3 / /sys rw,nosuid,nodev,noexec,relatime shared:4 - sysfs sysfs rw
|
||||
5 4 0:4 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:5 - tmpfs tmpfs ro,mode=755
|
||||
6 5 0:5 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:6 - cgroup cgroup rw,cpuset
|
||||
7 5 0:6 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:7 - cgroup cgroup rw,cpu,cpuacct
|
||||
8 5 0:7 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:8 - cgroup cgroup rw,memory
|
||||
273
third_party/rust/num_cpus/src/lib.rs
vendored
273
third_party/rust/num_cpus/src/lib.rs
vendored
|
|
@ -1,27 +1,73 @@
|
|||
//! # num_cpus
|
||||
//!
|
||||
//! A crate with utilities to determine the number of CPUs available on the
|
||||
//! current system.
|
||||
//!
|
||||
//! ## Example
|
||||
//! Sometimes the CPU will exaggerate the number of CPUs it contains, because it can use
|
||||
//! [processor tricks] to deliver increased performance when there are more threads. This
|
||||
//! crate provides methods to get both the logical and physical numbers of cores.
|
||||
//!
|
||||
//! This information can be used as a guide to how many tasks can be run in parallel.
|
||||
//! There are many properties of the system architecture that will affect parallelism,
|
||||
//! for example memory access speeds (for all the caches and RAM) and the physical
|
||||
//! architecture of the processor, so the number of CPUs should be used as a rough guide
|
||||
//! only.
|
||||
//!
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! Fetch the number of logical CPUs.
|
||||
//!
|
||||
//! ```
|
||||
//! let cpus = num_cpus::get();
|
||||
//! ```
|
||||
//!
|
||||
//! See [`rayon::Threadpool`] for an example of where the number of CPUs could be
|
||||
//! used when setting up parallel jobs (Where the threadpool example uses a fixed
|
||||
//! number 8, it could use the number of CPUs).
|
||||
//!
|
||||
//! [processor tricks]: https://en.wikipedia.org/wiki/Simultaneous_multithreading
|
||||
//! [`rayon::ThreadPool`]: https://docs.rs/rayon/1.*/rayon/struct.ThreadPool.html
|
||||
#![cfg_attr(test, deny(warnings))]
|
||||
#![deny(missing_docs)]
|
||||
#![doc(html_root_url = "https://docs.rs/num_cpus/1.7.0")]
|
||||
#![doc(html_root_url = "https://docs.rs/num_cpus/1.13.0")]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
#[cfg(not(windows))]
|
||||
extern crate libc;
|
||||
|
||||
#[cfg(target_os = "hermit")]
|
||||
extern crate hermit_abi;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
mod linux;
|
||||
#[cfg(target_os = "linux")]
|
||||
use linux::{get_num_cpus, get_num_physical_cpus};
|
||||
|
||||
/// Returns the number of available CPUs of the current system.
|
||||
///
|
||||
/// This function will get the number of logical cores. Sometimes this is different from the number
|
||||
/// of physical cores (See [Simultaneous multithreading on Wikipedia][smt]).
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let cpus = num_cpus::get();
|
||||
/// if cpus > 1 {
|
||||
/// println!("We are on a multicore system with {} CPUs", cpus);
|
||||
/// } else {
|
||||
/// println!("We are on a single core system");
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// This will check sched affinity on Linux.
|
||||
/// This will check [sched affinity] on Linux, showing a lower number of CPUs if the current
|
||||
/// thread does not have access to all the computer's CPUs.
|
||||
///
|
||||
/// This will also check [cgroups], frequently used in containers to constrain CPU usage.
|
||||
///
|
||||
/// [smt]: https://en.wikipedia.org/wiki/Simultaneous_multithreading
|
||||
/// [sched affinity]: http://www.gnu.org/software/libc/manual/html_node/CPU-Affinity.html
|
||||
/// [cgroups]: https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
|
||||
#[inline]
|
||||
pub fn get() -> usize {
|
||||
get_num_cpus()
|
||||
|
|
@ -29,18 +75,42 @@ pub fn get() -> usize {
|
|||
|
||||
/// Returns the number of physical cores of the current system.
|
||||
///
|
||||
/// If not possible on the particular architecture, returns same as `get()`
|
||||
/// which is the logical CPUs.
|
||||
/// # Note
|
||||
///
|
||||
/// Physical count is supported only on Linux, mac OS and Windows platforms.
|
||||
/// On other platforms, or if the physical count fails on supported platforms,
|
||||
/// this function returns the same as [`get()`], which is the number of logical
|
||||
/// CPUS.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let logical_cpus = num_cpus::get();
|
||||
/// let physical_cpus = num_cpus::get_physical();
|
||||
/// if logical_cpus > physical_cpus {
|
||||
/// println!("We have simultaneous multithreading with about {:.2} \
|
||||
/// logical cores to 1 physical core.",
|
||||
/// (logical_cpus as f64) / (physical_cpus as f64));
|
||||
/// } else if logical_cpus == physical_cpus {
|
||||
/// println!("Either we don't have simultaneous multithreading, or our \
|
||||
/// system doesn't support getting the number of physical CPUs.");
|
||||
/// } else {
|
||||
/// println!("We have less logical CPUs than physical CPUs, maybe we only have access to \
|
||||
/// some of the CPUs on our system.");
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// [`get()`]: fn.get.html
|
||||
#[inline]
|
||||
pub fn get_physical() -> usize {
|
||||
get_num_physical_cpus()
|
||||
}
|
||||
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "windows", target_os="macos")))]
|
||||
#[cfg(not(any(target_os = "linux", target_os = "windows", target_os="macos", target_os="openbsd")))]
|
||||
#[inline]
|
||||
fn get_num_physical_cpus() -> usize {
|
||||
// Not implemented, fallback
|
||||
// Not implemented, fall back
|
||||
get_num_cpus()
|
||||
}
|
||||
|
||||
|
|
@ -127,48 +197,6 @@ fn get_num_physical_cpus_windows() -> Option<usize> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_num_physical_cpus() -> usize {
|
||||
use std::io::BufReader;
|
||||
use std::io::BufRead;
|
||||
use std::fs::File;
|
||||
use std::collections::HashSet;
|
||||
|
||||
let file = match File::open("/proc/cpuinfo") {
|
||||
Ok(val) => val,
|
||||
Err(_) => {return get_num_cpus()},
|
||||
};
|
||||
let reader = BufReader::new(file);
|
||||
let mut set = HashSet::new();
|
||||
let mut coreid: u32 = 0;
|
||||
let mut physid: u32 = 0;
|
||||
let mut chgcount = 0;
|
||||
for line in reader.lines().filter_map(|result| result.ok()) {
|
||||
let parts: Vec<&str> = line.split(':').map(|s| s.trim()).collect();
|
||||
if parts.len() != 2 {
|
||||
continue
|
||||
}
|
||||
if parts[0] == "core id" || parts[0] == "physical id" {
|
||||
let value = match parts[1].trim().parse() {
|
||||
Ok(val) => val,
|
||||
Err(_) => break,
|
||||
};
|
||||
match parts[0] {
|
||||
"core id" => coreid = value,
|
||||
"physical id" => physid = value,
|
||||
_ => {},
|
||||
}
|
||||
chgcount += 1;
|
||||
}
|
||||
if chgcount == 2 {
|
||||
set.insert((physid, coreid));
|
||||
chgcount = 0;
|
||||
}
|
||||
}
|
||||
let count = set.len();
|
||||
if count == 0 { get_num_cpus() } else { count }
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn get_num_cpus() -> usize {
|
||||
#[repr(C)]
|
||||
|
|
@ -191,7 +219,7 @@ fn get_num_cpus() -> usize {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut sysinfo: SYSTEM_INFO = std::mem::uninitialized();
|
||||
let mut sysinfo: SYSTEM_INFO = std::mem::zeroed();
|
||||
GetSystemInfo(&mut sysinfo);
|
||||
sysinfo.dwNumberOfProcessors as usize
|
||||
}
|
||||
|
|
@ -199,9 +227,10 @@ fn get_num_cpus() -> usize {
|
|||
|
||||
#[cfg(any(target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "netbsd"))]
|
||||
fn get_num_cpus() -> usize {
|
||||
use std::ptr;
|
||||
|
||||
let mut cpus: libc::c_uint = 0;
|
||||
let mut cpus_size = std::mem::size_of_val(&cpus);
|
||||
|
||||
|
|
@ -215,7 +244,7 @@ fn get_num_cpus() -> usize {
|
|||
2,
|
||||
&mut cpus as *mut _ as *mut _,
|
||||
&mut cpus_size as *mut _ as *mut _,
|
||||
0 as *mut _,
|
||||
ptr::null_mut(),
|
||||
0);
|
||||
}
|
||||
if cpus < 1 {
|
||||
|
|
@ -227,19 +256,45 @@ fn get_num_cpus() -> usize {
|
|||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
fn get_num_cpus() -> usize {
|
||||
use std::ptr;
|
||||
|
||||
let mut cpus: libc::c_uint = 0;
|
||||
let mut cpus_size = std::mem::size_of_val(&cpus);
|
||||
let mut mib = [libc::CTL_HW, libc::HW_NCPUONLINE, 0, 0];
|
||||
let rc: libc::c_int;
|
||||
|
||||
unsafe {
|
||||
rc = libc::sysctl(mib.as_mut_ptr(),
|
||||
2,
|
||||
&mut cpus as *mut _ as *mut _,
|
||||
&mut cpus_size as *mut _ as *mut _,
|
||||
ptr::null_mut(),
|
||||
0);
|
||||
}
|
||||
if rc < 0 {
|
||||
cpus = 1;
|
||||
}
|
||||
cpus as usize
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
fn get_num_physical_cpus() -> usize {
|
||||
use std::ptr;
|
||||
|
||||
let mut cpus: libc::c_uint = 0;
|
||||
let mut cpus_size = std::mem::size_of_val(&cpus);
|
||||
let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];
|
||||
let rc: libc::c_int;
|
||||
|
||||
unsafe {
|
||||
libc::sysctl(mib.as_mut_ptr(),
|
||||
2,
|
||||
&mut cpus as *mut _ as *mut _,
|
||||
&mut cpus_size as *mut _ as *mut _,
|
||||
0 as *mut _,
|
||||
0);
|
||||
rc = libc::sysctl(mib.as_mut_ptr(),
|
||||
2,
|
||||
&mut cpus as *mut _ as *mut _,
|
||||
&mut cpus_size as *mut _ as *mut _,
|
||||
ptr::null_mut(),
|
||||
0);
|
||||
}
|
||||
if cpus < 1 {
|
||||
if rc < 0 {
|
||||
cpus = 1;
|
||||
}
|
||||
cpus as usize
|
||||
|
|
@ -269,33 +324,13 @@ fn get_num_physical_cpus() -> usize {
|
|||
cpus as usize
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_num_cpus() -> usize {
|
||||
let mut set: libc::cpu_set_t = unsafe { std::mem::zeroed() };
|
||||
if unsafe { libc::sched_getaffinity(0, std::mem::size_of::<libc::cpu_set_t>(), &mut set) } == 0 {
|
||||
let mut count: u32 = 0;
|
||||
for i in 0..libc::CPU_SETSIZE as usize {
|
||||
if unsafe { libc::CPU_ISSET(i, &set) } {
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
count as usize
|
||||
} else {
|
||||
let cpus = unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) };
|
||||
if cpus < 1 {
|
||||
1
|
||||
} else {
|
||||
cpus as usize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_os = "nacl",
|
||||
target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "android",
|
||||
target_os = "solaris",
|
||||
target_os = "illumos",
|
||||
target_os = "fuchsia")
|
||||
)]
|
||||
fn get_num_cpus() -> usize {
|
||||
|
|
@ -314,7 +349,79 @@ fn get_num_cpus() -> usize {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "emscripten", target_os = "redox", target_os = "haiku"))]
|
||||
#[cfg(target_os = "haiku")]
|
||||
fn get_num_cpus() -> usize {
|
||||
use std::mem;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
type bigtime_t = i64;
|
||||
#[allow(non_camel_case_types)]
|
||||
type status_t = i32;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct system_info {
|
||||
pub boot_time: bigtime_t,
|
||||
pub cpu_count: u32,
|
||||
pub max_pages: u64,
|
||||
pub used_pages: u64,
|
||||
pub cached_pages: u64,
|
||||
pub block_cache_pages: u64,
|
||||
pub ignored_pages: u64,
|
||||
pub needed_memory: u64,
|
||||
pub free_memory: u64,
|
||||
pub max_swap_pages: u64,
|
||||
pub free_swap_pages: u64,
|
||||
pub page_faults: u32,
|
||||
pub max_sems: u32,
|
||||
pub used_sems: u32,
|
||||
pub max_ports: u32,
|
||||
pub used_ports: u32,
|
||||
pub max_threads: u32,
|
||||
pub used_threads: u32,
|
||||
pub max_teams: u32,
|
||||
pub used_teams: u32,
|
||||
pub kernel_name: [::std::os::raw::c_char; 256usize],
|
||||
pub kernel_build_date: [::std::os::raw::c_char; 32usize],
|
||||
pub kernel_build_time: [::std::os::raw::c_char; 32usize],
|
||||
pub kernel_version: i64,
|
||||
pub abi: u32,
|
||||
}
|
||||
|
||||
extern {
|
||||
fn get_system_info(info: *mut system_info) -> status_t;
|
||||
}
|
||||
|
||||
let mut info: system_info = unsafe { mem::zeroed() };
|
||||
let status = unsafe { get_system_info(&mut info as *mut _) };
|
||||
if status == 0 {
|
||||
info.cpu_count as usize
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "hermit")]
|
||||
fn get_num_cpus() -> usize {
|
||||
unsafe { hermit_abi::get_processor_count() }
|
||||
}
|
||||
|
||||
#[cfg(not(any(
|
||||
target_os = "nacl",
|
||||
target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "android",
|
||||
target_os = "solaris",
|
||||
target_os = "illumos",
|
||||
target_os = "fuchsia",
|
||||
target_os = "linux",
|
||||
target_os = "openbsd",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "netbsd",
|
||||
target_os = "haiku",
|
||||
target_os = "hermit",
|
||||
windows,
|
||||
)))]
|
||||
fn get_num_cpus() -> usize {
|
||||
1
|
||||
}
|
||||
|
|
|
|||
414
third_party/rust/num_cpus/src/linux.rs
vendored
Normal file
414
third_party/rust/num_cpus/src/linux.rs
vendored
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Read};
|
||||
use std::mem;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Once;
|
||||
|
||||
use libc;
|
||||
|
||||
macro_rules! debug {
|
||||
($($args:expr),*) => ({
|
||||
if false {
|
||||
//if true {
|
||||
println!($($args),*);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
macro_rules! some {
|
||||
($e:expr) => ({
|
||||
match $e {
|
||||
Some(v) => v,
|
||||
None => {
|
||||
debug!("NONE: {:?}", stringify!($e));
|
||||
return None;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_num_cpus() -> usize {
|
||||
match cgroups_num_cpus() {
|
||||
Some(n) => n,
|
||||
None => logical_cpus(),
|
||||
}
|
||||
}
|
||||
|
||||
fn logical_cpus() -> usize {
|
||||
let mut set: libc::cpu_set_t = unsafe { mem::zeroed() };
|
||||
if unsafe { libc::sched_getaffinity(0, mem::size_of::<libc::cpu_set_t>(), &mut set) } == 0 {
|
||||
let mut count: u32 = 0;
|
||||
for i in 0..libc::CPU_SETSIZE as usize {
|
||||
if unsafe { libc::CPU_ISSET(i, &set) } {
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
count as usize
|
||||
} else {
|
||||
let cpus = unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) };
|
||||
if cpus < 1 {
|
||||
1
|
||||
} else {
|
||||
cpus as usize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_num_physical_cpus() -> usize {
|
||||
let file = match File::open("/proc/cpuinfo") {
|
||||
Ok(val) => val,
|
||||
Err(_) => return get_num_cpus(),
|
||||
};
|
||||
let reader = BufReader::new(file);
|
||||
let mut map = HashMap::new();
|
||||
let mut physid: u32 = 0;
|
||||
let mut cores: usize = 0;
|
||||
let mut chgcount = 0;
|
||||
for line in reader.lines().filter_map(|result| result.ok()) {
|
||||
let mut it = line.split(':');
|
||||
let (key, value) = match (it.next(), it.next()) {
|
||||
(Some(key), Some(value)) => (key.trim(), value.trim()),
|
||||
_ => continue,
|
||||
};
|
||||
if key == "physical id" {
|
||||
match value.parse() {
|
||||
Ok(val) => physid = val,
|
||||
Err(_) => break,
|
||||
};
|
||||
chgcount += 1;
|
||||
}
|
||||
if key == "cpu cores" {
|
||||
match value.parse() {
|
||||
Ok(val) => cores = val,
|
||||
Err(_) => break,
|
||||
};
|
||||
chgcount += 1;
|
||||
}
|
||||
if chgcount == 2 {
|
||||
map.insert(physid, cores);
|
||||
chgcount = 0;
|
||||
}
|
||||
}
|
||||
let count = map.into_iter().fold(0, |acc, (_, cores)| acc + cores);
|
||||
|
||||
if count == 0 {
|
||||
get_num_cpus()
|
||||
} else {
|
||||
count
|
||||
}
|
||||
}
|
||||
|
||||
/// Cached CPUs calculated from cgroups.
|
||||
///
|
||||
/// If 0, check logical cpus.
|
||||
// Allow deprecation warnings, we want to work on older rustc
|
||||
#[allow(warnings)]
|
||||
static CGROUPS_CPUS: AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
|
||||
|
||||
fn cgroups_num_cpus() -> Option<usize> {
|
||||
#[allow(warnings)]
|
||||
static ONCE: Once = ::std::sync::ONCE_INIT;
|
||||
|
||||
ONCE.call_once(init_cgroups);
|
||||
|
||||
let cpus = CGROUPS_CPUS.load(Ordering::Acquire);
|
||||
|
||||
if cpus > 0 {
|
||||
Some(cpus)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn init_cgroups() {
|
||||
// Should only be called once
|
||||
debug_assert!(CGROUPS_CPUS.load(Ordering::SeqCst) == 0);
|
||||
|
||||
match load_cgroups("/proc/self/cgroup", "/proc/self/mountinfo") {
|
||||
Some(quota) => {
|
||||
if quota == 0 {
|
||||
return;
|
||||
}
|
||||
|
||||
let logical = logical_cpus();
|
||||
let count = ::std::cmp::min(quota, logical);
|
||||
|
||||
CGROUPS_CPUS.store(count, Ordering::SeqCst);
|
||||
}
|
||||
None => return,
|
||||
}
|
||||
}
|
||||
|
||||
fn load_cgroups<P1, P2>(cgroup_proc: P1, mountinfo_proc: P2) -> Option<usize>
|
||||
where
|
||||
P1: AsRef<Path>,
|
||||
P2: AsRef<Path>,
|
||||
{
|
||||
let subsys = some!(Subsys::load_cpu(cgroup_proc));
|
||||
let mntinfo = some!(MountInfo::load_cpu(mountinfo_proc));
|
||||
let cgroup = some!(Cgroup::translate(mntinfo, subsys));
|
||||
cgroup.cpu_quota()
|
||||
}
|
||||
|
||||
struct Cgroup {
|
||||
base: PathBuf,
|
||||
}
|
||||
|
||||
struct MountInfo {
|
||||
root: String,
|
||||
mount_point: String,
|
||||
}
|
||||
|
||||
struct Subsys {
|
||||
base: String,
|
||||
}
|
||||
|
||||
impl Cgroup {
|
||||
fn new(dir: PathBuf) -> Cgroup {
|
||||
Cgroup {
|
||||
base: dir,
|
||||
}
|
||||
}
|
||||
|
||||
fn translate(mntinfo: MountInfo, subsys: Subsys) -> Option<Cgroup> {
|
||||
// Translate the subsystem directory via the host paths.
|
||||
debug!(
|
||||
"subsys = {:?}; root = {:?}; mount_point = {:?}",
|
||||
subsys.base,
|
||||
mntinfo.root,
|
||||
mntinfo.mount_point
|
||||
);
|
||||
|
||||
let rel_from_root = some!(Path::new(&subsys.base).strip_prefix(&mntinfo.root).ok());
|
||||
|
||||
debug!("rel_from_root: {:?}", rel_from_root);
|
||||
|
||||
// join(mp.MountPoint, relPath)
|
||||
let mut path = PathBuf::from(mntinfo.mount_point);
|
||||
path.push(rel_from_root);
|
||||
Some(Cgroup::new(path))
|
||||
}
|
||||
|
||||
fn cpu_quota(&self) -> Option<usize> {
|
||||
let quota_us = some!(self.quota_us());
|
||||
let period_us = some!(self.period_us());
|
||||
|
||||
// protect against dividing by zero
|
||||
if period_us == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Ceil the division, since we want to be able to saturate
|
||||
// the available CPUs, and flooring would leave a CPU un-utilized.
|
||||
|
||||
Some((quota_us as f64 / period_us as f64).ceil() as usize)
|
||||
}
|
||||
|
||||
fn quota_us(&self) -> Option<usize> {
|
||||
self.param("cpu.cfs_quota_us")
|
||||
}
|
||||
|
||||
fn period_us(&self) -> Option<usize> {
|
||||
self.param("cpu.cfs_period_us")
|
||||
}
|
||||
|
||||
fn param(&self, param: &str) -> Option<usize> {
|
||||
let mut file = some!(File::open(self.base.join(param)).ok());
|
||||
|
||||
let mut buf = String::new();
|
||||
some!(file.read_to_string(&mut buf).ok());
|
||||
|
||||
buf.trim().parse().ok()
|
||||
}
|
||||
}
|
||||
|
||||
impl MountInfo {
|
||||
fn load_cpu<P: AsRef<Path>>(proc_path: P) -> Option<MountInfo> {
|
||||
let file = some!(File::open(proc_path).ok());
|
||||
let file = BufReader::new(file);
|
||||
|
||||
file.lines()
|
||||
.filter_map(|result| result.ok())
|
||||
.filter_map(MountInfo::parse_line)
|
||||
.next()
|
||||
}
|
||||
|
||||
fn parse_line(line: String) -> Option<MountInfo> {
|
||||
let mut fields = line.split(' ');
|
||||
|
||||
let mnt_root = some!(fields.nth(3));
|
||||
let mnt_point = some!(fields.nth(0));
|
||||
|
||||
if fields.nth(3) != Some("cgroup") {
|
||||
return None;
|
||||
}
|
||||
|
||||
let super_opts = some!(fields.nth(1));
|
||||
|
||||
// We only care about the 'cpu' option
|
||||
if !super_opts.split(',').any(|opt| opt == "cpu") {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(MountInfo {
|
||||
root: mnt_root.to_owned(),
|
||||
mount_point: mnt_point.to_owned(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Subsys {
|
||||
fn load_cpu<P: AsRef<Path>>(proc_path: P) -> Option<Subsys> {
|
||||
let file = some!(File::open(proc_path).ok());
|
||||
let file = BufReader::new(file);
|
||||
|
||||
file.lines()
|
||||
.filter_map(|result| result.ok())
|
||||
.filter_map(Subsys::parse_line)
|
||||
.next()
|
||||
}
|
||||
|
||||
fn parse_line(line: String) -> Option<Subsys> {
|
||||
// Example format:
|
||||
// 11:cpu,cpuacct:/
|
||||
let mut fields = line.split(':');
|
||||
|
||||
let sub_systems = some!(fields.nth(1));
|
||||
|
||||
if !sub_systems.split(',').any(|sub| sub == "cpu") {
|
||||
return None;
|
||||
}
|
||||
|
||||
fields.next().map(|path| Subsys { base: path.to_owned() })
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::path::{Path, PathBuf};
|
||||
use super::{Cgroup, MountInfo, Subsys};
|
||||
|
||||
|
||||
static FIXTURES_PROC: &'static str = "fixtures/cgroups/proc/cgroups";
|
||||
|
||||
static FIXTURES_CGROUPS: &'static str = "fixtures/cgroups/cgroups";
|
||||
|
||||
macro_rules! join {
|
||||
($base:expr, $($path:expr),+) => ({
|
||||
Path::new($base)
|
||||
$(.join($path))+
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_mountinfo() {
|
||||
let path = join!(FIXTURES_PROC, "mountinfo");
|
||||
|
||||
let mnt_info = MountInfo::load_cpu(path).unwrap();
|
||||
|
||||
assert_eq!(mnt_info.root, "/");
|
||||
assert_eq!(mnt_info.mount_point, "/sys/fs/cgroup/cpu,cpuacct");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_subsys() {
|
||||
let path = join!(FIXTURES_PROC, "cgroup");
|
||||
|
||||
let subsys = Subsys::load_cpu(path).unwrap();
|
||||
|
||||
assert_eq!(subsys.base, "/");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cgroup_mount() {
|
||||
let cases = &[
|
||||
(
|
||||
"/",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/",
|
||||
Some("/sys/fs/cgroup/cpu"),
|
||||
),
|
||||
(
|
||||
"/docker/01abcd",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/docker/01abcd",
|
||||
Some("/sys/fs/cgroup/cpu"),
|
||||
),
|
||||
(
|
||||
"/docker/01abcd",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/docker/01abcd/",
|
||||
Some("/sys/fs/cgroup/cpu"),
|
||||
),
|
||||
(
|
||||
"/docker/01abcd",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/docker/01abcd/large",
|
||||
Some("/sys/fs/cgroup/cpu/large"),
|
||||
),
|
||||
|
||||
// fails
|
||||
|
||||
(
|
||||
"/docker/01abcd",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/",
|
||||
None,
|
||||
),
|
||||
(
|
||||
"/docker/01abcd",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/docker",
|
||||
None,
|
||||
),
|
||||
(
|
||||
"/docker/01abcd",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/elsewhere",
|
||||
None,
|
||||
),
|
||||
(
|
||||
"/docker/01abcd",
|
||||
"/sys/fs/cgroup/cpu",
|
||||
"/docker/01abcd-other-dir",
|
||||
None,
|
||||
),
|
||||
];
|
||||
|
||||
for &(root, mount_point, subsys, expected) in cases.iter() {
|
||||
let mnt_info = MountInfo {
|
||||
root: root.into(),
|
||||
mount_point: mount_point.into(),
|
||||
};
|
||||
let subsys = Subsys {
|
||||
base: subsys.into(),
|
||||
};
|
||||
|
||||
let actual = Cgroup::translate(mnt_info, subsys).map(|c| c.base);
|
||||
let expected = expected.map(|s| PathBuf::from(s));
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cgroup_cpu_quota() {
|
||||
let cgroup = Cgroup::new(join!(FIXTURES_CGROUPS, "good"));
|
||||
assert_eq!(cgroup.cpu_quota(), Some(6));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cgroup_cpu_quota_divide_by_zero() {
|
||||
let cgroup = Cgroup::new(join!(FIXTURES_CGROUPS, "zero-period"));
|
||||
assert!(cgroup.quota_us().is_some());
|
||||
assert_eq!(cgroup.period_us(), Some(0));
|
||||
assert_eq!(cgroup.cpu_quota(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cgroup_cpu_quota_ceil() {
|
||||
let cgroup = Cgroup::new(join!(FIXTURES_CGROUPS, "ceil"));
|
||||
assert_eq!(cgroup.cpu_quota(), Some(2));
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -12,9 +12,6 @@ keywords = ["spirv", "cross"]
|
|||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
glsl = []
|
||||
|
|
@ -22,8 +19,4 @@ hlsl = []
|
|||
msl = []
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.build-dependencies]
|
||||
cc = "1.0.4"
|
||||
|
||||
#[target.wasm32-unknown-unknown.dependencies]
|
||||
#wasm-bindgen = "0.2.33"
|
||||
#js-sys = "0.3.10"
|
||||
cc = { version = "1", features = ["parallel"] }
|
||||
|
|
|
|||
|
|
@ -16,6 +16,30 @@ pub mod root {
|
|||
pub const SourceLanguage_SourceLanguageHLSL: root::spv::SourceLanguage = 5;
|
||||
pub const SourceLanguage_SourceLanguageMax: root::spv::SourceLanguage = 2147483647;
|
||||
pub type SourceLanguage = u32;
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelRayGenerationNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelRayGenerationKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelIntersectionNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelIntersectionKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelAnyHitNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelAnyHitKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelClosestHitNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelClosestHitKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelMissNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelMissKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelCallableNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelCallableKHR;
|
||||
}
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum ExecutionModel {
|
||||
|
|
@ -28,12 +52,12 @@ pub mod root {
|
|||
ExecutionModelKernel = 6,
|
||||
ExecutionModelTaskNV = 5267,
|
||||
ExecutionModelMeshNV = 5268,
|
||||
ExecutionModelRayGenerationNV = 5313,
|
||||
ExecutionModelIntersectionNV = 5314,
|
||||
ExecutionModelAnyHitNV = 5315,
|
||||
ExecutionModelClosestHitNV = 5316,
|
||||
ExecutionModelMissNV = 5317,
|
||||
ExecutionModelCallableNV = 5318,
|
||||
ExecutionModelRayGenerationKHR = 5313,
|
||||
ExecutionModelIntersectionKHR = 5314,
|
||||
ExecutionModelAnyHitKHR = 5315,
|
||||
ExecutionModelClosestHitKHR = 5316,
|
||||
ExecutionModelMissKHR = 5317,
|
||||
ExecutionModelCallableKHR = 5318,
|
||||
ExecutionModelMax = 2147483647,
|
||||
}
|
||||
pub const AddressingModel_AddressingModelLogical: root::spv::AddressingModel = 0;
|
||||
|
|
@ -133,11 +157,17 @@ pub mod root {
|
|||
pub const StorageClass_StorageClassAtomicCounter: root::spv::StorageClass = 10;
|
||||
pub const StorageClass_StorageClassImage: root::spv::StorageClass = 11;
|
||||
pub const StorageClass_StorageClassStorageBuffer: root::spv::StorageClass = 12;
|
||||
pub const StorageClass_StorageClassCallableDataKHR: root::spv::StorageClass = 5328;
|
||||
pub const StorageClass_StorageClassCallableDataNV: root::spv::StorageClass = 5328;
|
||||
pub const StorageClass_StorageClassIncomingCallableDataKHR: root::spv::StorageClass = 5329;
|
||||
pub const StorageClass_StorageClassIncomingCallableDataNV: root::spv::StorageClass = 5329;
|
||||
pub const StorageClass_StorageClassRayPayloadKHR: root::spv::StorageClass = 5338;
|
||||
pub const StorageClass_StorageClassRayPayloadNV: root::spv::StorageClass = 5338;
|
||||
pub const StorageClass_StorageClassHitAttributeKHR: root::spv::StorageClass = 5339;
|
||||
pub const StorageClass_StorageClassHitAttributeNV: root::spv::StorageClass = 5339;
|
||||
pub const StorageClass_StorageClassIncomingRayPayloadKHR: root::spv::StorageClass = 5342;
|
||||
pub const StorageClass_StorageClassIncomingRayPayloadNV: root::spv::StorageClass = 5342;
|
||||
pub const StorageClass_StorageClassShaderRecordBufferKHR: root::spv::StorageClass = 5343;
|
||||
pub const StorageClass_StorageClassShaderRecordBufferNV: root::spv::StorageClass = 5343;
|
||||
pub const StorageClass_StorageClassPhysicalStorageBuffer: root::spv::StorageClass = 5349;
|
||||
pub const StorageClass_StorageClassPhysicalStorageBufferEXT: root::spv::StorageClass = 5349;
|
||||
|
|
@ -615,6 +645,54 @@ pub mod root {
|
|||
pub const BuiltInInvocationsPerPixelNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInFragInvocationCountEXT;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInLaunchIdNV: root::spv::BuiltIn = BuiltIn::BuiltInLaunchIdKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInLaunchSizeNV: root::spv::BuiltIn = BuiltIn::BuiltInLaunchSizeKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInWorldRayOriginNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInWorldRayOriginKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInWorldRayDirectionNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInWorldRayDirectionKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInObjectRayOriginNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInObjectRayOriginKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInObjectRayDirectionNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInObjectRayDirectionKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInRayTminNV: root::spv::BuiltIn = BuiltIn::BuiltInRayTminKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInRayTmaxNV: root::spv::BuiltIn = BuiltIn::BuiltInRayTmaxKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInInstanceCustomIndexNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInInstanceCustomIndexKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInObjectToWorldNV: root::spv::BuiltIn = BuiltIn::BuiltInObjectToWorldKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInWorldToObjectNV: root::spv::BuiltIn = BuiltIn::BuiltInWorldToObjectKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInHitTNV: root::spv::BuiltIn = BuiltIn::BuiltInHitTKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInHitKindNV: root::spv::BuiltIn = BuiltIn::BuiltInHitKindKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInIncomingRayFlagsNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInIncomingRayFlagsKHR;
|
||||
}
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum BuiltIn {
|
||||
|
|
@ -695,20 +773,21 @@ pub mod root {
|
|||
BuiltInBaryCoordNoPerspNV = 5287,
|
||||
BuiltInFragSizeEXT = 5292,
|
||||
BuiltInFragInvocationCountEXT = 5293,
|
||||
BuiltInLaunchIdNV = 5319,
|
||||
BuiltInLaunchSizeNV = 5320,
|
||||
BuiltInWorldRayOriginNV = 5321,
|
||||
BuiltInWorldRayDirectionNV = 5322,
|
||||
BuiltInObjectRayOriginNV = 5323,
|
||||
BuiltInObjectRayDirectionNV = 5324,
|
||||
BuiltInRayTminNV = 5325,
|
||||
BuiltInRayTmaxNV = 5326,
|
||||
BuiltInInstanceCustomIndexNV = 5327,
|
||||
BuiltInObjectToWorldNV = 5330,
|
||||
BuiltInWorldToObjectNV = 5331,
|
||||
BuiltInHitTNV = 5332,
|
||||
BuiltInHitKindNV = 5333,
|
||||
BuiltInIncomingRayFlagsNV = 5351,
|
||||
BuiltInLaunchIdKHR = 5319,
|
||||
BuiltInLaunchSizeKHR = 5320,
|
||||
BuiltInWorldRayOriginKHR = 5321,
|
||||
BuiltInWorldRayDirectionKHR = 5322,
|
||||
BuiltInObjectRayOriginKHR = 5323,
|
||||
BuiltInObjectRayDirectionKHR = 5324,
|
||||
BuiltInRayTminKHR = 5325,
|
||||
BuiltInRayTmaxKHR = 5326,
|
||||
BuiltInInstanceCustomIndexKHR = 5327,
|
||||
BuiltInObjectToWorldKHR = 5330,
|
||||
BuiltInWorldToObjectKHR = 5331,
|
||||
BuiltInHitTKHR = 5332,
|
||||
BuiltInHitKindKHR = 5333,
|
||||
BuiltInIncomingRayFlagsKHR = 5351,
|
||||
BuiltInRayGeometryIndexKHR = 5352,
|
||||
BuiltInWarpsPerSMNV = 5374,
|
||||
BuiltInSMCountNV = 5375,
|
||||
BuiltInWarpIDNV = 5376,
|
||||
|
|
@ -1137,6 +1216,7 @@ pub mod root {
|
|||
pub const Scope_ScopeInvocation: root::spv::Scope = 4;
|
||||
pub const Scope_ScopeQueueFamily: root::spv::Scope = 5;
|
||||
pub const Scope_ScopeQueueFamilyKHR: root::spv::Scope = 5;
|
||||
pub const Scope_ScopeShaderCallKHR: root::spv::Scope = 6;
|
||||
pub const Scope_ScopeMax: root::spv::Scope = 2147483647;
|
||||
pub type Scope = u32;
|
||||
pub const GroupOperation_GroupOperationReduce: root::spv::GroupOperation = 0;
|
||||
|
|
@ -1333,6 +1413,9 @@ pub mod root {
|
|||
pub const Capability_CapabilitySignedZeroInfNanPreserve: root::spv::Capability = 4466;
|
||||
pub const Capability_CapabilityRoundingModeRTE: root::spv::Capability = 4467;
|
||||
pub const Capability_CapabilityRoundingModeRTZ: root::spv::Capability = 4468;
|
||||
pub const Capability_CapabilityRayQueryProvisionalKHR: root::spv::Capability = 4471;
|
||||
pub const Capability_CapabilityRayTraversalPrimitiveCullingProvisionalKHR:
|
||||
root::spv::Capability = 4478;
|
||||
pub const Capability_CapabilityFloat16ImageAMD: root::spv::Capability = 5008;
|
||||
pub const Capability_CapabilityImageGatherBiasLodAMD: root::spv::Capability = 5009;
|
||||
pub const Capability_CapabilityFragmentMaskAMD: root::spv::Capability = 5010;
|
||||
|
|
@ -1408,6 +1491,7 @@ pub mod root {
|
|||
pub const Capability_CapabilityPhysicalStorageBufferAddressesEXT: root::spv::Capability =
|
||||
5347;
|
||||
pub const Capability_CapabilityComputeDerivativeGroupLinearNV: root::spv::Capability = 5350;
|
||||
pub const Capability_CapabilityRayTracingProvisionalKHR: root::spv::Capability = 5353;
|
||||
pub const Capability_CapabilityCooperativeMatrixNV: root::spv::Capability = 5357;
|
||||
pub const Capability_CapabilityFragmentShaderSampleInterlockEXT: root::spv::Capability =
|
||||
5363;
|
||||
|
|
@ -1430,6 +1514,108 @@ pub mod root {
|
|||
root::spv::Capability = 5698;
|
||||
pub const Capability_CapabilityMax: root::spv::Capability = 2147483647;
|
||||
pub type Capability = u32;
|
||||
pub const RayFlagsShift_RayFlagsOpaqueKHRShift: root::spv::RayFlagsShift = 0;
|
||||
pub const RayFlagsShift_RayFlagsNoOpaqueKHRShift: root::spv::RayFlagsShift = 1;
|
||||
pub const RayFlagsShift_RayFlagsTerminateOnFirstHitKHRShift: root::spv::RayFlagsShift = 2;
|
||||
pub const RayFlagsShift_RayFlagsSkipClosestHitShaderKHRShift: root::spv::RayFlagsShift = 3;
|
||||
pub const RayFlagsShift_RayFlagsCullBackFacingTrianglesKHRShift: root::spv::RayFlagsShift =
|
||||
4;
|
||||
pub const RayFlagsShift_RayFlagsCullFrontFacingTrianglesKHRShift: root::spv::RayFlagsShift =
|
||||
5;
|
||||
pub const RayFlagsShift_RayFlagsCullOpaqueKHRShift: root::spv::RayFlagsShift = 6;
|
||||
pub const RayFlagsShift_RayFlagsCullNoOpaqueKHRShift: root::spv::RayFlagsShift = 7;
|
||||
pub const RayFlagsShift_RayFlagsSkipTrianglesKHRShift: root::spv::RayFlagsShift = 8;
|
||||
pub const RayFlagsShift_RayFlagsSkipAABBsKHRShift: root::spv::RayFlagsShift = 9;
|
||||
pub const RayFlagsShift_RayFlagsMax: root::spv::RayFlagsShift = 2147483647;
|
||||
pub type RayFlagsShift = u32;
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsMaskNone: root::spv::RayFlagsMask = root::spv::RayFlagsMask(0);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsOpaqueKHRMask: root::spv::RayFlagsMask = root::spv::RayFlagsMask(1);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsNoOpaqueKHRMask: root::spv::RayFlagsMask = root::spv::RayFlagsMask(2);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsTerminateOnFirstHitKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(4);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsSkipClosestHitShaderKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(8);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullBackFacingTrianglesKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(16);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullFrontFacingTrianglesKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(32);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullOpaqueKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(64);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullNoOpaqueKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(128);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsSkipTrianglesKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(256);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsSkipAABBsKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(512);
|
||||
}
|
||||
impl ::std::ops::BitOr<root::spv::RayFlagsMask> for root::spv::RayFlagsMask {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn bitor(self, other: Self) -> Self {
|
||||
RayFlagsMask(self.0 | other.0)
|
||||
}
|
||||
}
|
||||
impl ::std::ops::BitOrAssign for root::spv::RayFlagsMask {
|
||||
#[inline]
|
||||
fn bitor_assign(&mut self, rhs: root::spv::RayFlagsMask) {
|
||||
self.0 |= rhs.0;
|
||||
}
|
||||
}
|
||||
impl ::std::ops::BitAnd<root::spv::RayFlagsMask> for root::spv::RayFlagsMask {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn bitand(self, other: Self) -> Self {
|
||||
RayFlagsMask(self.0 & other.0)
|
||||
}
|
||||
}
|
||||
impl ::std::ops::BitAndAssign for root::spv::RayFlagsMask {
|
||||
#[inline]
|
||||
fn bitand_assign(&mut self, rhs: root::spv::RayFlagsMask) {
|
||||
self.0 &= rhs.0;
|
||||
}
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RayFlagsMask(pub u32);
|
||||
pub const RayQueryIntersection_RayQueryIntersectionRayQueryCandidateIntersectionKHR:
|
||||
root::spv::RayQueryIntersection = 0;
|
||||
pub const RayQueryIntersection_RayQueryIntersectionRayQueryCommittedIntersectionKHR:
|
||||
root::spv::RayQueryIntersection = 1;
|
||||
pub const RayQueryIntersection_RayQueryIntersectionMax: root::spv::RayQueryIntersection =
|
||||
2147483647;
|
||||
pub type RayQueryIntersection = u32;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR : root :: spv :: RayQueryCommittedIntersectionType = 0 ;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR : root :: spv :: RayQueryCommittedIntersectionType = 1 ;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR : root :: spv :: RayQueryCommittedIntersectionType = 2 ;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeMax:
|
||||
root::spv::RayQueryCommittedIntersectionType = 2147483647;
|
||||
pub type RayQueryCommittedIntersectionType = u32;
|
||||
pub const RayQueryCandidateIntersectionType_RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR : root :: spv :: RayQueryCandidateIntersectionType = 0 ;
|
||||
pub const RayQueryCandidateIntersectionType_RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR : root :: spv :: RayQueryCandidateIntersectionType = 1 ;
|
||||
pub const RayQueryCandidateIntersectionType_RayQueryCandidateIntersectionTypeMax:
|
||||
root::spv::RayQueryCandidateIntersectionType = 2147483647;
|
||||
pub type RayQueryCandidateIntersectionType = u32;
|
||||
pub const Op_OpNop: root::spv::Op = 0;
|
||||
pub const Op_OpUndef: root::spv::Op = 1;
|
||||
pub const Op_OpSourceContinued: root::spv::Op = 2;
|
||||
|
|
@ -1780,6 +1966,13 @@ pub mod root {
|
|||
pub const Op_OpSubgroupAnyKHR: root::spv::Op = 4429;
|
||||
pub const Op_OpSubgroupAllEqualKHR: root::spv::Op = 4430;
|
||||
pub const Op_OpSubgroupReadInvocationKHR: root::spv::Op = 4432;
|
||||
pub const Op_OpTypeRayQueryProvisionalKHR: root::spv::Op = 4472;
|
||||
pub const Op_OpRayQueryInitializeKHR: root::spv::Op = 4473;
|
||||
pub const Op_OpRayQueryTerminateKHR: root::spv::Op = 4474;
|
||||
pub const Op_OpRayQueryGenerateIntersectionKHR: root::spv::Op = 4475;
|
||||
pub const Op_OpRayQueryConfirmIntersectionKHR: root::spv::Op = 4476;
|
||||
pub const Op_OpRayQueryProceedKHR: root::spv::Op = 4477;
|
||||
pub const Op_OpRayQueryGetIntersectionTypeKHR: root::spv::Op = 4479;
|
||||
pub const Op_OpGroupIAddNonUniformAMD: root::spv::Op = 5000;
|
||||
pub const Op_OpGroupFAddNonUniformAMD: root::spv::Op = 5001;
|
||||
pub const Op_OpGroupFMinNonUniformAMD: root::spv::Op = 5002;
|
||||
|
|
@ -1794,11 +1987,17 @@ pub mod root {
|
|||
pub const Op_OpImageSampleFootprintNV: root::spv::Op = 5283;
|
||||
pub const Op_OpGroupNonUniformPartitionNV: root::spv::Op = 5296;
|
||||
pub const Op_OpWritePackedPrimitiveIndices4x8NV: root::spv::Op = 5299;
|
||||
pub const Op_OpReportIntersectionKHR: root::spv::Op = 5334;
|
||||
pub const Op_OpReportIntersectionNV: root::spv::Op = 5334;
|
||||
pub const Op_OpIgnoreIntersectionKHR: root::spv::Op = 5335;
|
||||
pub const Op_OpIgnoreIntersectionNV: root::spv::Op = 5335;
|
||||
pub const Op_OpTerminateRayKHR: root::spv::Op = 5336;
|
||||
pub const Op_OpTerminateRayNV: root::spv::Op = 5336;
|
||||
pub const Op_OpTraceNV: root::spv::Op = 5337;
|
||||
pub const Op_OpTraceRayKHR: root::spv::Op = 5337;
|
||||
pub const Op_OpTypeAccelerationStructureKHR: root::spv::Op = 5341;
|
||||
pub const Op_OpTypeAccelerationStructureNV: root::spv::Op = 5341;
|
||||
pub const Op_OpExecuteCallableKHR: root::spv::Op = 5344;
|
||||
pub const Op_OpExecuteCallableNV: root::spv::Op = 5344;
|
||||
pub const Op_OpTypeCooperativeMatrixNV: root::spv::Op = 5358;
|
||||
pub const Op_OpCooperativeMatrixLoadNV: root::spv::Op = 5359;
|
||||
|
|
@ -1975,6 +2174,24 @@ pub mod root {
|
|||
pub const Op_OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: root::spv::Op = 5814;
|
||||
pub const Op_OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: root::spv::Op = 5815;
|
||||
pub const Op_OpSubgroupAvcSicGetInterRawSadsINTEL: root::spv::Op = 5816;
|
||||
pub const Op_OpRayQueryGetRayTMinKHR: root::spv::Op = 6016;
|
||||
pub const Op_OpRayQueryGetRayFlagsKHR: root::spv::Op = 6017;
|
||||
pub const Op_OpRayQueryGetIntersectionTKHR: root::spv::Op = 6018;
|
||||
pub const Op_OpRayQueryGetIntersectionInstanceCustomIndexKHR: root::spv::Op = 6019;
|
||||
pub const Op_OpRayQueryGetIntersectionInstanceIdKHR: root::spv::Op = 6020;
|
||||
pub const Op_OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR:
|
||||
root::spv::Op = 6021;
|
||||
pub const Op_OpRayQueryGetIntersectionGeometryIndexKHR: root::spv::Op = 6022;
|
||||
pub const Op_OpRayQueryGetIntersectionPrimitiveIndexKHR: root::spv::Op = 6023;
|
||||
pub const Op_OpRayQueryGetIntersectionBarycentricsKHR: root::spv::Op = 6024;
|
||||
pub const Op_OpRayQueryGetIntersectionFrontFaceKHR: root::spv::Op = 6025;
|
||||
pub const Op_OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: root::spv::Op = 6026;
|
||||
pub const Op_OpRayQueryGetIntersectionObjectRayDirectionKHR: root::spv::Op = 6027;
|
||||
pub const Op_OpRayQueryGetIntersectionObjectRayOriginKHR: root::spv::Op = 6028;
|
||||
pub const Op_OpRayQueryGetWorldRayDirectionKHR: root::spv::Op = 6029;
|
||||
pub const Op_OpRayQueryGetWorldRayOriginKHR: root::spv::Op = 6030;
|
||||
pub const Op_OpRayQueryGetIntersectionObjectToWorldKHR: root::spv::Op = 6031;
|
||||
pub const Op_OpRayQueryGetIntersectionWorldToObjectKHR: root::spv::Op = 6032;
|
||||
pub const Op_OpMax: root::spv::Op = 2147483647;
|
||||
pub type Op = u32;
|
||||
}
|
||||
|
|
@ -2008,9 +2225,10 @@ pub mod root {
|
|||
Image = 16,
|
||||
SampledImage = 17,
|
||||
Sampler = 18,
|
||||
AccelerationStructureNV = 19,
|
||||
ControlPointArray = 20,
|
||||
Char = 21,
|
||||
AccelerationStructure = 19,
|
||||
RayQuery = 20,
|
||||
ControlPointArray = 21,
|
||||
Char = 22,
|
||||
}
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
@ -2235,6 +2453,8 @@ pub mod root {
|
|||
pub point_coord_compat: bool,
|
||||
pub vertex_transform_clip_space: bool,
|
||||
pub vertex_invert_y: bool,
|
||||
pub force_storage_buffer_as_uav: bool,
|
||||
pub nonwritable_uav_texture_as_srv: bool,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
@ -2264,6 +2484,7 @@ pub mod root {
|
|||
pub vertex_invert_y: bool,
|
||||
pub version: u32,
|
||||
pub es: bool,
|
||||
pub enable_420_pack_extension: bool,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
@ -2304,6 +2525,8 @@ pub mod root {
|
|||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ScType {
|
||||
pub type_: root::spirv_cross::SPIRType_BaseType,
|
||||
pub vecsize: u32,
|
||||
pub columns: u32,
|
||||
pub member_types: *mut u32,
|
||||
pub member_types_size: usize,
|
||||
pub array: *mut u32,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,30 @@ pub mod root {
|
|||
pub const SourceLanguage_SourceLanguageHLSL: root::spv::SourceLanguage = 5;
|
||||
pub const SourceLanguage_SourceLanguageMax: root::spv::SourceLanguage = 2147483647;
|
||||
pub type SourceLanguage = u32;
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelRayGenerationNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelRayGenerationKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelIntersectionNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelIntersectionKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelAnyHitNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelAnyHitKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelClosestHitNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelClosestHitKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelMissNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelMissKHR;
|
||||
}
|
||||
impl root::spv::ExecutionModel {
|
||||
pub const ExecutionModelCallableNV: root::spv::ExecutionModel =
|
||||
ExecutionModel::ExecutionModelCallableKHR;
|
||||
}
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum ExecutionModel {
|
||||
|
|
@ -28,12 +52,12 @@ pub mod root {
|
|||
ExecutionModelKernel = 6,
|
||||
ExecutionModelTaskNV = 5267,
|
||||
ExecutionModelMeshNV = 5268,
|
||||
ExecutionModelRayGenerationNV = 5313,
|
||||
ExecutionModelIntersectionNV = 5314,
|
||||
ExecutionModelAnyHitNV = 5315,
|
||||
ExecutionModelClosestHitNV = 5316,
|
||||
ExecutionModelMissNV = 5317,
|
||||
ExecutionModelCallableNV = 5318,
|
||||
ExecutionModelRayGenerationKHR = 5313,
|
||||
ExecutionModelIntersectionKHR = 5314,
|
||||
ExecutionModelAnyHitKHR = 5315,
|
||||
ExecutionModelClosestHitKHR = 5316,
|
||||
ExecutionModelMissKHR = 5317,
|
||||
ExecutionModelCallableKHR = 5318,
|
||||
ExecutionModelMax = 2147483647,
|
||||
}
|
||||
pub const AddressingModel_AddressingModelLogical: root::spv::AddressingModel = 0;
|
||||
|
|
@ -133,11 +157,17 @@ pub mod root {
|
|||
pub const StorageClass_StorageClassAtomicCounter: root::spv::StorageClass = 10;
|
||||
pub const StorageClass_StorageClassImage: root::spv::StorageClass = 11;
|
||||
pub const StorageClass_StorageClassStorageBuffer: root::spv::StorageClass = 12;
|
||||
pub const StorageClass_StorageClassCallableDataKHR: root::spv::StorageClass = 5328;
|
||||
pub const StorageClass_StorageClassCallableDataNV: root::spv::StorageClass = 5328;
|
||||
pub const StorageClass_StorageClassIncomingCallableDataKHR: root::spv::StorageClass = 5329;
|
||||
pub const StorageClass_StorageClassIncomingCallableDataNV: root::spv::StorageClass = 5329;
|
||||
pub const StorageClass_StorageClassRayPayloadKHR: root::spv::StorageClass = 5338;
|
||||
pub const StorageClass_StorageClassRayPayloadNV: root::spv::StorageClass = 5338;
|
||||
pub const StorageClass_StorageClassHitAttributeKHR: root::spv::StorageClass = 5339;
|
||||
pub const StorageClass_StorageClassHitAttributeNV: root::spv::StorageClass = 5339;
|
||||
pub const StorageClass_StorageClassIncomingRayPayloadKHR: root::spv::StorageClass = 5342;
|
||||
pub const StorageClass_StorageClassIncomingRayPayloadNV: root::spv::StorageClass = 5342;
|
||||
pub const StorageClass_StorageClassShaderRecordBufferKHR: root::spv::StorageClass = 5343;
|
||||
pub const StorageClass_StorageClassShaderRecordBufferNV: root::spv::StorageClass = 5343;
|
||||
pub const StorageClass_StorageClassPhysicalStorageBuffer: root::spv::StorageClass = 5349;
|
||||
pub const StorageClass_StorageClassPhysicalStorageBufferEXT: root::spv::StorageClass = 5349;
|
||||
|
|
@ -615,6 +645,54 @@ pub mod root {
|
|||
pub const BuiltInInvocationsPerPixelNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInFragInvocationCountEXT;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInLaunchIdNV: root::spv::BuiltIn = BuiltIn::BuiltInLaunchIdKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInLaunchSizeNV: root::spv::BuiltIn = BuiltIn::BuiltInLaunchSizeKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInWorldRayOriginNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInWorldRayOriginKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInWorldRayDirectionNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInWorldRayDirectionKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInObjectRayOriginNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInObjectRayOriginKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInObjectRayDirectionNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInObjectRayDirectionKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInRayTminNV: root::spv::BuiltIn = BuiltIn::BuiltInRayTminKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInRayTmaxNV: root::spv::BuiltIn = BuiltIn::BuiltInRayTmaxKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInInstanceCustomIndexNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInInstanceCustomIndexKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInObjectToWorldNV: root::spv::BuiltIn = BuiltIn::BuiltInObjectToWorldKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInWorldToObjectNV: root::spv::BuiltIn = BuiltIn::BuiltInWorldToObjectKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInHitTNV: root::spv::BuiltIn = BuiltIn::BuiltInHitTKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInHitKindNV: root::spv::BuiltIn = BuiltIn::BuiltInHitKindKHR;
|
||||
}
|
||||
impl root::spv::BuiltIn {
|
||||
pub const BuiltInIncomingRayFlagsNV: root::spv::BuiltIn =
|
||||
BuiltIn::BuiltInIncomingRayFlagsKHR;
|
||||
}
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum BuiltIn {
|
||||
|
|
@ -695,20 +773,21 @@ pub mod root {
|
|||
BuiltInBaryCoordNoPerspNV = 5287,
|
||||
BuiltInFragSizeEXT = 5292,
|
||||
BuiltInFragInvocationCountEXT = 5293,
|
||||
BuiltInLaunchIdNV = 5319,
|
||||
BuiltInLaunchSizeNV = 5320,
|
||||
BuiltInWorldRayOriginNV = 5321,
|
||||
BuiltInWorldRayDirectionNV = 5322,
|
||||
BuiltInObjectRayOriginNV = 5323,
|
||||
BuiltInObjectRayDirectionNV = 5324,
|
||||
BuiltInRayTminNV = 5325,
|
||||
BuiltInRayTmaxNV = 5326,
|
||||
BuiltInInstanceCustomIndexNV = 5327,
|
||||
BuiltInObjectToWorldNV = 5330,
|
||||
BuiltInWorldToObjectNV = 5331,
|
||||
BuiltInHitTNV = 5332,
|
||||
BuiltInHitKindNV = 5333,
|
||||
BuiltInIncomingRayFlagsNV = 5351,
|
||||
BuiltInLaunchIdKHR = 5319,
|
||||
BuiltInLaunchSizeKHR = 5320,
|
||||
BuiltInWorldRayOriginKHR = 5321,
|
||||
BuiltInWorldRayDirectionKHR = 5322,
|
||||
BuiltInObjectRayOriginKHR = 5323,
|
||||
BuiltInObjectRayDirectionKHR = 5324,
|
||||
BuiltInRayTminKHR = 5325,
|
||||
BuiltInRayTmaxKHR = 5326,
|
||||
BuiltInInstanceCustomIndexKHR = 5327,
|
||||
BuiltInObjectToWorldKHR = 5330,
|
||||
BuiltInWorldToObjectKHR = 5331,
|
||||
BuiltInHitTKHR = 5332,
|
||||
BuiltInHitKindKHR = 5333,
|
||||
BuiltInIncomingRayFlagsKHR = 5351,
|
||||
BuiltInRayGeometryIndexKHR = 5352,
|
||||
BuiltInWarpsPerSMNV = 5374,
|
||||
BuiltInSMCountNV = 5375,
|
||||
BuiltInWarpIDNV = 5376,
|
||||
|
|
@ -1137,6 +1216,7 @@ pub mod root {
|
|||
pub const Scope_ScopeInvocation: root::spv::Scope = 4;
|
||||
pub const Scope_ScopeQueueFamily: root::spv::Scope = 5;
|
||||
pub const Scope_ScopeQueueFamilyKHR: root::spv::Scope = 5;
|
||||
pub const Scope_ScopeShaderCallKHR: root::spv::Scope = 6;
|
||||
pub const Scope_ScopeMax: root::spv::Scope = 2147483647;
|
||||
pub type Scope = u32;
|
||||
pub const GroupOperation_GroupOperationReduce: root::spv::GroupOperation = 0;
|
||||
|
|
@ -1333,6 +1413,9 @@ pub mod root {
|
|||
pub const Capability_CapabilitySignedZeroInfNanPreserve: root::spv::Capability = 4466;
|
||||
pub const Capability_CapabilityRoundingModeRTE: root::spv::Capability = 4467;
|
||||
pub const Capability_CapabilityRoundingModeRTZ: root::spv::Capability = 4468;
|
||||
pub const Capability_CapabilityRayQueryProvisionalKHR: root::spv::Capability = 4471;
|
||||
pub const Capability_CapabilityRayTraversalPrimitiveCullingProvisionalKHR:
|
||||
root::spv::Capability = 4478;
|
||||
pub const Capability_CapabilityFloat16ImageAMD: root::spv::Capability = 5008;
|
||||
pub const Capability_CapabilityImageGatherBiasLodAMD: root::spv::Capability = 5009;
|
||||
pub const Capability_CapabilityFragmentMaskAMD: root::spv::Capability = 5010;
|
||||
|
|
@ -1408,6 +1491,7 @@ pub mod root {
|
|||
pub const Capability_CapabilityPhysicalStorageBufferAddressesEXT: root::spv::Capability =
|
||||
5347;
|
||||
pub const Capability_CapabilityComputeDerivativeGroupLinearNV: root::spv::Capability = 5350;
|
||||
pub const Capability_CapabilityRayTracingProvisionalKHR: root::spv::Capability = 5353;
|
||||
pub const Capability_CapabilityCooperativeMatrixNV: root::spv::Capability = 5357;
|
||||
pub const Capability_CapabilityFragmentShaderSampleInterlockEXT: root::spv::Capability =
|
||||
5363;
|
||||
|
|
@ -1430,6 +1514,108 @@ pub mod root {
|
|||
root::spv::Capability = 5698;
|
||||
pub const Capability_CapabilityMax: root::spv::Capability = 2147483647;
|
||||
pub type Capability = u32;
|
||||
pub const RayFlagsShift_RayFlagsOpaqueKHRShift: root::spv::RayFlagsShift = 0;
|
||||
pub const RayFlagsShift_RayFlagsNoOpaqueKHRShift: root::spv::RayFlagsShift = 1;
|
||||
pub const RayFlagsShift_RayFlagsTerminateOnFirstHitKHRShift: root::spv::RayFlagsShift = 2;
|
||||
pub const RayFlagsShift_RayFlagsSkipClosestHitShaderKHRShift: root::spv::RayFlagsShift = 3;
|
||||
pub const RayFlagsShift_RayFlagsCullBackFacingTrianglesKHRShift: root::spv::RayFlagsShift =
|
||||
4;
|
||||
pub const RayFlagsShift_RayFlagsCullFrontFacingTrianglesKHRShift: root::spv::RayFlagsShift =
|
||||
5;
|
||||
pub const RayFlagsShift_RayFlagsCullOpaqueKHRShift: root::spv::RayFlagsShift = 6;
|
||||
pub const RayFlagsShift_RayFlagsCullNoOpaqueKHRShift: root::spv::RayFlagsShift = 7;
|
||||
pub const RayFlagsShift_RayFlagsSkipTrianglesKHRShift: root::spv::RayFlagsShift = 8;
|
||||
pub const RayFlagsShift_RayFlagsSkipAABBsKHRShift: root::spv::RayFlagsShift = 9;
|
||||
pub const RayFlagsShift_RayFlagsMax: root::spv::RayFlagsShift = 2147483647;
|
||||
pub type RayFlagsShift = u32;
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsMaskNone: root::spv::RayFlagsMask = root::spv::RayFlagsMask(0);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsOpaqueKHRMask: root::spv::RayFlagsMask = root::spv::RayFlagsMask(1);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsNoOpaqueKHRMask: root::spv::RayFlagsMask = root::spv::RayFlagsMask(2);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsTerminateOnFirstHitKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(4);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsSkipClosestHitShaderKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(8);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullBackFacingTrianglesKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(16);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullFrontFacingTrianglesKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(32);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullOpaqueKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(64);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsCullNoOpaqueKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(128);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsSkipTrianglesKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(256);
|
||||
}
|
||||
impl RayFlagsMask {
|
||||
pub const RayFlagsSkipAABBsKHRMask: root::spv::RayFlagsMask =
|
||||
root::spv::RayFlagsMask(512);
|
||||
}
|
||||
impl ::std::ops::BitOr<root::spv::RayFlagsMask> for root::spv::RayFlagsMask {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn bitor(self, other: Self) -> Self {
|
||||
RayFlagsMask(self.0 | other.0)
|
||||
}
|
||||
}
|
||||
impl ::std::ops::BitOrAssign for root::spv::RayFlagsMask {
|
||||
#[inline]
|
||||
fn bitor_assign(&mut self, rhs: root::spv::RayFlagsMask) {
|
||||
self.0 |= rhs.0;
|
||||
}
|
||||
}
|
||||
impl ::std::ops::BitAnd<root::spv::RayFlagsMask> for root::spv::RayFlagsMask {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn bitand(self, other: Self) -> Self {
|
||||
RayFlagsMask(self.0 & other.0)
|
||||
}
|
||||
}
|
||||
impl ::std::ops::BitAndAssign for root::spv::RayFlagsMask {
|
||||
#[inline]
|
||||
fn bitand_assign(&mut self, rhs: root::spv::RayFlagsMask) {
|
||||
self.0 &= rhs.0;
|
||||
}
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RayFlagsMask(pub u32);
|
||||
pub const RayQueryIntersection_RayQueryIntersectionRayQueryCandidateIntersectionKHR:
|
||||
root::spv::RayQueryIntersection = 0;
|
||||
pub const RayQueryIntersection_RayQueryIntersectionRayQueryCommittedIntersectionKHR:
|
||||
root::spv::RayQueryIntersection = 1;
|
||||
pub const RayQueryIntersection_RayQueryIntersectionMax: root::spv::RayQueryIntersection =
|
||||
2147483647;
|
||||
pub type RayQueryIntersection = u32;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR : root :: spv :: RayQueryCommittedIntersectionType = 0 ;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR : root :: spv :: RayQueryCommittedIntersectionType = 1 ;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR : root :: spv :: RayQueryCommittedIntersectionType = 2 ;
|
||||
pub const RayQueryCommittedIntersectionType_RayQueryCommittedIntersectionTypeMax:
|
||||
root::spv::RayQueryCommittedIntersectionType = 2147483647;
|
||||
pub type RayQueryCommittedIntersectionType = u32;
|
||||
pub const RayQueryCandidateIntersectionType_RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR : root :: spv :: RayQueryCandidateIntersectionType = 0 ;
|
||||
pub const RayQueryCandidateIntersectionType_RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR : root :: spv :: RayQueryCandidateIntersectionType = 1 ;
|
||||
pub const RayQueryCandidateIntersectionType_RayQueryCandidateIntersectionTypeMax:
|
||||
root::spv::RayQueryCandidateIntersectionType = 2147483647;
|
||||
pub type RayQueryCandidateIntersectionType = u32;
|
||||
pub const Op_OpNop: root::spv::Op = 0;
|
||||
pub const Op_OpUndef: root::spv::Op = 1;
|
||||
pub const Op_OpSourceContinued: root::spv::Op = 2;
|
||||
|
|
@ -1780,6 +1966,13 @@ pub mod root {
|
|||
pub const Op_OpSubgroupAnyKHR: root::spv::Op = 4429;
|
||||
pub const Op_OpSubgroupAllEqualKHR: root::spv::Op = 4430;
|
||||
pub const Op_OpSubgroupReadInvocationKHR: root::spv::Op = 4432;
|
||||
pub const Op_OpTypeRayQueryProvisionalKHR: root::spv::Op = 4472;
|
||||
pub const Op_OpRayQueryInitializeKHR: root::spv::Op = 4473;
|
||||
pub const Op_OpRayQueryTerminateKHR: root::spv::Op = 4474;
|
||||
pub const Op_OpRayQueryGenerateIntersectionKHR: root::spv::Op = 4475;
|
||||
pub const Op_OpRayQueryConfirmIntersectionKHR: root::spv::Op = 4476;
|
||||
pub const Op_OpRayQueryProceedKHR: root::spv::Op = 4477;
|
||||
pub const Op_OpRayQueryGetIntersectionTypeKHR: root::spv::Op = 4479;
|
||||
pub const Op_OpGroupIAddNonUniformAMD: root::spv::Op = 5000;
|
||||
pub const Op_OpGroupFAddNonUniformAMD: root::spv::Op = 5001;
|
||||
pub const Op_OpGroupFMinNonUniformAMD: root::spv::Op = 5002;
|
||||
|
|
@ -1794,11 +1987,17 @@ pub mod root {
|
|||
pub const Op_OpImageSampleFootprintNV: root::spv::Op = 5283;
|
||||
pub const Op_OpGroupNonUniformPartitionNV: root::spv::Op = 5296;
|
||||
pub const Op_OpWritePackedPrimitiveIndices4x8NV: root::spv::Op = 5299;
|
||||
pub const Op_OpReportIntersectionKHR: root::spv::Op = 5334;
|
||||
pub const Op_OpReportIntersectionNV: root::spv::Op = 5334;
|
||||
pub const Op_OpIgnoreIntersectionKHR: root::spv::Op = 5335;
|
||||
pub const Op_OpIgnoreIntersectionNV: root::spv::Op = 5335;
|
||||
pub const Op_OpTerminateRayKHR: root::spv::Op = 5336;
|
||||
pub const Op_OpTerminateRayNV: root::spv::Op = 5336;
|
||||
pub const Op_OpTraceNV: root::spv::Op = 5337;
|
||||
pub const Op_OpTraceRayKHR: root::spv::Op = 5337;
|
||||
pub const Op_OpTypeAccelerationStructureKHR: root::spv::Op = 5341;
|
||||
pub const Op_OpTypeAccelerationStructureNV: root::spv::Op = 5341;
|
||||
pub const Op_OpExecuteCallableKHR: root::spv::Op = 5344;
|
||||
pub const Op_OpExecuteCallableNV: root::spv::Op = 5344;
|
||||
pub const Op_OpTypeCooperativeMatrixNV: root::spv::Op = 5358;
|
||||
pub const Op_OpCooperativeMatrixLoadNV: root::spv::Op = 5359;
|
||||
|
|
@ -1975,6 +2174,24 @@ pub mod root {
|
|||
pub const Op_OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: root::spv::Op = 5814;
|
||||
pub const Op_OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: root::spv::Op = 5815;
|
||||
pub const Op_OpSubgroupAvcSicGetInterRawSadsINTEL: root::spv::Op = 5816;
|
||||
pub const Op_OpRayQueryGetRayTMinKHR: root::spv::Op = 6016;
|
||||
pub const Op_OpRayQueryGetRayFlagsKHR: root::spv::Op = 6017;
|
||||
pub const Op_OpRayQueryGetIntersectionTKHR: root::spv::Op = 6018;
|
||||
pub const Op_OpRayQueryGetIntersectionInstanceCustomIndexKHR: root::spv::Op = 6019;
|
||||
pub const Op_OpRayQueryGetIntersectionInstanceIdKHR: root::spv::Op = 6020;
|
||||
pub const Op_OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR:
|
||||
root::spv::Op = 6021;
|
||||
pub const Op_OpRayQueryGetIntersectionGeometryIndexKHR: root::spv::Op = 6022;
|
||||
pub const Op_OpRayQueryGetIntersectionPrimitiveIndexKHR: root::spv::Op = 6023;
|
||||
pub const Op_OpRayQueryGetIntersectionBarycentricsKHR: root::spv::Op = 6024;
|
||||
pub const Op_OpRayQueryGetIntersectionFrontFaceKHR: root::spv::Op = 6025;
|
||||
pub const Op_OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: root::spv::Op = 6026;
|
||||
pub const Op_OpRayQueryGetIntersectionObjectRayDirectionKHR: root::spv::Op = 6027;
|
||||
pub const Op_OpRayQueryGetIntersectionObjectRayOriginKHR: root::spv::Op = 6028;
|
||||
pub const Op_OpRayQueryGetWorldRayDirectionKHR: root::spv::Op = 6029;
|
||||
pub const Op_OpRayQueryGetWorldRayOriginKHR: root::spv::Op = 6030;
|
||||
pub const Op_OpRayQueryGetIntersectionObjectToWorldKHR: root::spv::Op = 6031;
|
||||
pub const Op_OpRayQueryGetIntersectionWorldToObjectKHR: root::spv::Op = 6032;
|
||||
pub const Op_OpMax: root::spv::Op = 2147483647;
|
||||
pub type Op = u32;
|
||||
}
|
||||
|
|
@ -2008,9 +2225,10 @@ pub mod root {
|
|||
Image = 16,
|
||||
SampledImage = 17,
|
||||
Sampler = 18,
|
||||
AccelerationStructureNV = 19,
|
||||
ControlPointArray = 20,
|
||||
Char = 21,
|
||||
AccelerationStructure = 19,
|
||||
RayQuery = 20,
|
||||
ControlPointArray = 21,
|
||||
Char = 22,
|
||||
}
|
||||
pub const MSLSamplerCoord_MSL_SAMPLER_COORD_NORMALIZED: root::spirv_cross::MSLSamplerCoord =
|
||||
0;
|
||||
|
|
@ -2206,6 +2424,8 @@ pub mod root {
|
|||
pub point_coord_compat: bool,
|
||||
pub vertex_transform_clip_space: bool,
|
||||
pub vertex_invert_y: bool,
|
||||
pub force_storage_buffer_as_uav: bool,
|
||||
pub nonwritable_uav_texture_as_srv: bool,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
@ -2235,6 +2455,7 @@ pub mod root {
|
|||
pub vertex_invert_y: bool,
|
||||
pub version: u32,
|
||||
pub es: bool,
|
||||
pub enable_420_pack_extension: bool,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
@ -2275,6 +2496,8 @@ pub mod root {
|
|||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ScType {
|
||||
pub type_: root::spirv_cross::SPIRType_BaseType,
|
||||
pub vecsize: u32,
|
||||
pub columns: u32,
|
||||
pub member_types: *mut u32,
|
||||
pub member_types_size: usize,
|
||||
pub array: *mut u32,
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ impl spirv::Decoration {
|
|||
impl spirv::Type {
|
||||
pub(crate) fn from_raw(
|
||||
ty: br::spirv_cross::SPIRType_BaseType,
|
||||
vecsize: u32,
|
||||
columns: u32,
|
||||
member_types: Vec<u32>,
|
||||
array: Vec<u32>,
|
||||
) -> Type {
|
||||
|
|
@ -104,16 +106,16 @@ impl spirv::Type {
|
|||
match ty {
|
||||
B::Unknown => Unknown,
|
||||
B::Void => Void,
|
||||
B::Boolean => Boolean { array },
|
||||
B::Boolean => Boolean { vecsize, columns, array },
|
||||
B::Char => Char { array },
|
||||
B::Int => Int { array },
|
||||
B::UInt => UInt { array },
|
||||
B::Int64 => Int64 { array },
|
||||
B::UInt64 => UInt64 { array },
|
||||
B::Int => Int { vecsize, columns, array },
|
||||
B::UInt => UInt { vecsize, columns, array },
|
||||
B::Int64 => Int64 { vecsize, array },
|
||||
B::UInt64 => UInt64 { vecsize, array },
|
||||
B::AtomicCounter => AtomicCounter { array },
|
||||
B::Half => Half { array },
|
||||
B::Float => Float { array },
|
||||
B::Double => Double { array },
|
||||
B::Half => Half { vecsize, columns, array },
|
||||
B::Float => Float { vecsize, columns, array },
|
||||
B::Double => Double { vecsize, columns, array },
|
||||
B::Struct => Struct {
|
||||
member_types,
|
||||
array,
|
||||
|
|
@ -121,12 +123,13 @@ impl spirv::Type {
|
|||
B::Image => Image { array },
|
||||
B::SampledImage => SampledImage { array },
|
||||
B::Sampler => Sampler { array },
|
||||
B::SByte => SByte { array },
|
||||
B::UByte => UByte { array },
|
||||
B::Short => Short { array },
|
||||
B::UShort => UShort { array },
|
||||
B::SByte => SByte { vecsize, array },
|
||||
B::UByte => UByte { vecsize, array },
|
||||
B::Short => Short { vecsize, array },
|
||||
B::UShort => UShort { vecsize, array },
|
||||
B::ControlPointArray => ControlPointArray,
|
||||
B::AccelerationStructureNV => AccelerationStructureNv,
|
||||
B::AccelerationStructure => AccelerationStructure,
|
||||
B::RayQuery => RayQuery,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -393,7 +396,7 @@ impl<TTargetData> Compiler<TTargetData> {
|
|||
let raw = read_from_ptr::<br::ScType>(type_ptr);
|
||||
let member_types = read_into_vec_from_ptr(raw.member_types, raw.member_types_size);
|
||||
let array = read_into_vec_from_ptr(raw.array, raw.array_size);
|
||||
let result = Type::from_raw(raw.type_, member_types, array);
|
||||
let result = Type::from_raw(raw.type_, raw.vecsize, raw.columns, member_types, array);
|
||||
|
||||
if raw.member_types_size > 0 {
|
||||
check!(br::sc_internal_free_pointer(
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ impl Default for CompilerVertexOptions {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct CompilerOptions {
|
||||
pub version: Version,
|
||||
pub enable_420_pack_extension: bool,
|
||||
pub vertex: CompilerVertexOptions,
|
||||
}
|
||||
|
||||
|
|
@ -82,6 +83,7 @@ impl CompilerOptions {
|
|||
vertex_invert_y: self.vertex.invert_y,
|
||||
vertex_transform_clip_space: self.vertex.transform_clip_space,
|
||||
version,
|
||||
enable_420_pack_extension: self.enable_420_pack_extension,
|
||||
es,
|
||||
}
|
||||
}
|
||||
|
|
@ -91,6 +93,7 @@ impl Default for CompilerOptions {
|
|||
fn default() -> CompilerOptions {
|
||||
CompilerOptions {
|
||||
version: Version::V4_50,
|
||||
enable_420_pack_extension: true,
|
||||
vertex: CompilerVertexOptions::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ pub struct CompilerOptions {
|
|||
/// Support point coordinate builtin but ignore the value.
|
||||
pub point_coord_compat: bool,
|
||||
pub vertex: CompilerVertexOptions,
|
||||
pub force_storage_buffer_as_uav: bool,
|
||||
pub nonwritable_uav_texture_as_srv: bool,
|
||||
}
|
||||
|
||||
impl CompilerOptions {
|
||||
|
|
@ -80,6 +82,8 @@ impl CompilerOptions {
|
|||
point_coord_compat: self.point_coord_compat,
|
||||
vertex_invert_y: self.vertex.invert_y,
|
||||
vertex_transform_clip_space: self.vertex.transform_clip_space,
|
||||
force_storage_buffer_as_uav: self.force_storage_buffer_as_uav,
|
||||
nonwritable_uav_texture_as_srv: self.nonwritable_uav_texture_as_srv,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -91,6 +95,8 @@ impl Default for CompilerOptions {
|
|||
point_size_compat: false,
|
||||
point_coord_compat: false,
|
||||
vertex: CompilerVertexOptions::default(),
|
||||
force_storage_buffer_as_uav: false,
|
||||
nonwritable_uav_texture_as_srv: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,33 +347,47 @@ pub enum Type {
|
|||
Unknown,
|
||||
Void,
|
||||
Boolean {
|
||||
vecsize: u32,
|
||||
columns: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Char {
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Int {
|
||||
vecsize: u32,
|
||||
columns: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
UInt {
|
||||
vecsize: u32,
|
||||
columns: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Int64 {
|
||||
vecsize: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
UInt64 {
|
||||
vecsize: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
AtomicCounter {
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Half {
|
||||
vecsize: u32,
|
||||
columns: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Float {
|
||||
vecsize: u32,
|
||||
columns: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Double {
|
||||
vecsize: u32,
|
||||
columns: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Struct {
|
||||
|
|
@ -390,19 +404,24 @@ pub enum Type {
|
|||
array: Vec<u32>,
|
||||
},
|
||||
SByte {
|
||||
vecsize: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
UByte {
|
||||
vecsize: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
Short {
|
||||
vecsize: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
UShort {
|
||||
vecsize: u32,
|
||||
array: Vec<u32>,
|
||||
},
|
||||
ControlPointArray,
|
||||
AccelerationStructureNv,
|
||||
AccelerationStructure,
|
||||
RayQuery,
|
||||
}
|
||||
|
||||
/// A SPIR-V shader module.
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ if (SPIRV_CROSS_STATIC)
|
|||
endif()
|
||||
|
||||
set(spirv-cross-abi-major 0)
|
||||
set(spirv-cross-abi-minor 30)
|
||||
set(spirv-cross-abi-minor 33)
|
||||
set(spirv-cross-abi-patch 0)
|
||||
|
||||
if (SPIRV_CROSS_SHARED)
|
||||
|
|
|
|||
|
|
@ -136,6 +136,25 @@ struct CLIParser
|
|||
return uint32_t(val);
|
||||
}
|
||||
|
||||
uint32_t next_hex_uint()
|
||||
{
|
||||
if (!argc)
|
||||
{
|
||||
THROW("Tried to parse uint, but nothing left in arguments");
|
||||
}
|
||||
|
||||
uint64_t val = stoul(*argv, nullptr, 16);
|
||||
if (val > numeric_limits<uint32_t>::max())
|
||||
{
|
||||
THROW("next_uint() out of range");
|
||||
}
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
return uint32_t(val);
|
||||
}
|
||||
|
||||
double next_double()
|
||||
{
|
||||
if (!argc)
|
||||
|
|
@ -535,6 +554,10 @@ struct CLIArguments
|
|||
bool msl_decoration_binding = false;
|
||||
bool msl_force_active_argument_buffer_resources = false;
|
||||
bool msl_force_native_arrays = false;
|
||||
bool msl_enable_frag_depth_builtin = true;
|
||||
bool msl_enable_frag_stencil_ref_builtin = true;
|
||||
uint32_t msl_enable_frag_output_mask = 0xffffffff;
|
||||
bool msl_enable_clip_distance_user_varying = true;
|
||||
bool glsl_emit_push_constant_as_ubo = false;
|
||||
bool glsl_emit_ubo_as_plain_uniforms = false;
|
||||
SmallVector<pair<uint32_t, uint32_t>> glsl_ext_framebuffer_fetch;
|
||||
|
|
@ -638,6 +661,10 @@ static void print_help()
|
|||
"\t[--msl-decoration-binding]\n"
|
||||
"\t[--msl-force-active-argument-buffer-resources]\n"
|
||||
"\t[--msl-force-native-arrays]\n"
|
||||
"\t[--msl-disable-frag-depth-builtin]\n"
|
||||
"\t[--msl-disable-frag-stencil-ref-builtin]\n"
|
||||
"\t[--msl-enable-frag-output-mask <mask>]\n"
|
||||
"\t[--msl-no-clip-distance-user-varying]\n"
|
||||
"\t[--hlsl]\n"
|
||||
"\t[--reflect]\n"
|
||||
"\t[--shader-model]\n"
|
||||
|
|
@ -831,6 +858,10 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
|
|||
msl_opts.enable_decoration_binding = args.msl_decoration_binding;
|
||||
msl_opts.force_active_argument_buffer_resources = args.msl_force_active_argument_buffer_resources;
|
||||
msl_opts.force_native_arrays = args.msl_force_native_arrays;
|
||||
msl_opts.enable_frag_depth_builtin = args.msl_enable_frag_depth_builtin;
|
||||
msl_opts.enable_frag_stencil_ref_builtin = args.msl_enable_frag_stencil_ref_builtin;
|
||||
msl_opts.enable_frag_output_mask = args.msl_enable_frag_output_mask;
|
||||
msl_opts.enable_clip_distance_user_varying = args.msl_enable_clip_distance_user_varying;
|
||||
msl_comp->set_msl_options(msl_opts);
|
||||
for (auto &v : args.msl_discrete_descriptor_sets)
|
||||
msl_comp->add_discrete_descriptor_set(v);
|
||||
|
|
@ -1213,6 +1244,13 @@ static int main_inner(int argc, char *argv[])
|
|||
args.msl_inline_uniform_blocks.push_back(make_pair(desc_set, binding));
|
||||
});
|
||||
cbs.add("--msl-force-native-arrays", [&args](CLIParser &) { args.msl_force_native_arrays = true; });
|
||||
cbs.add("--msl-disable-frag-depth-builtin", [&args](CLIParser &) { args.msl_enable_frag_depth_builtin = false; });
|
||||
cbs.add("--msl-disable-frag-stencil-ref-builtin",
|
||||
[&args](CLIParser &) { args.msl_enable_frag_stencil_ref_builtin = false; });
|
||||
cbs.add("--msl-enable-frag-output-mask",
|
||||
[&args](CLIParser &parser) { args.msl_enable_frag_output_mask = parser.next_hex_uint(); });
|
||||
cbs.add("--msl-no-clip-distance-user-varying",
|
||||
[&args](CLIParser &) { args.msl_enable_clip_distance_user_varying = false; });
|
||||
cbs.add("--extension", [&args](CLIParser &parser) { args.extensions.push_back(parser.next_string()); });
|
||||
cbs.add("--rename-entry-point", [&args](CLIParser &parser) {
|
||||
auto old_name = parser.next_string();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (c) 2014-2019 The Khronos Group Inc.
|
||||
** Copyright (c) 2014-2020 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and/or associated documentation files (the "Materials"),
|
||||
|
|
@ -54,11 +54,11 @@
|
|||
typedef unsigned int SpvId;
|
||||
|
||||
#define SPV_VERSION 0x10500
|
||||
#define SPV_REVISION 1
|
||||
#define SPV_REVISION 3
|
||||
|
||||
static const unsigned int SpvMagicNumber = 0x07230203;
|
||||
static const unsigned int SpvVersion = 0x00010400;
|
||||
static const unsigned int SpvRevision = 1;
|
||||
static const unsigned int SpvVersion = 0x00010500;
|
||||
static const unsigned int SpvRevision = 3;
|
||||
static const unsigned int SpvOpCodeMask = 0xffff;
|
||||
static const unsigned int SpvWordCountShift = 16;
|
||||
|
||||
|
|
@ -82,11 +82,17 @@ typedef enum SpvExecutionModel_ {
|
|||
SpvExecutionModelKernel = 6,
|
||||
SpvExecutionModelTaskNV = 5267,
|
||||
SpvExecutionModelMeshNV = 5268,
|
||||
SpvExecutionModelRayGenerationKHR = 5313,
|
||||
SpvExecutionModelRayGenerationNV = 5313,
|
||||
SpvExecutionModelIntersectionKHR = 5314,
|
||||
SpvExecutionModelIntersectionNV = 5314,
|
||||
SpvExecutionModelAnyHitKHR = 5315,
|
||||
SpvExecutionModelAnyHitNV = 5315,
|
||||
SpvExecutionModelClosestHitKHR = 5316,
|
||||
SpvExecutionModelClosestHitNV = 5316,
|
||||
SpvExecutionModelMissKHR = 5317,
|
||||
SpvExecutionModelMissNV = 5317,
|
||||
SpvExecutionModelCallableKHR = 5318,
|
||||
SpvExecutionModelCallableNV = 5318,
|
||||
SpvExecutionModelMax = 0x7fffffff,
|
||||
} SpvExecutionModel;
|
||||
|
|
@ -183,11 +189,17 @@ typedef enum SpvStorageClass_ {
|
|||
SpvStorageClassAtomicCounter = 10,
|
||||
SpvStorageClassImage = 11,
|
||||
SpvStorageClassStorageBuffer = 12,
|
||||
SpvStorageClassCallableDataKHR = 5328,
|
||||
SpvStorageClassCallableDataNV = 5328,
|
||||
SpvStorageClassIncomingCallableDataKHR = 5329,
|
||||
SpvStorageClassIncomingCallableDataNV = 5329,
|
||||
SpvStorageClassRayPayloadKHR = 5338,
|
||||
SpvStorageClassRayPayloadNV = 5338,
|
||||
SpvStorageClassHitAttributeKHR = 5339,
|
||||
SpvStorageClassHitAttributeNV = 5339,
|
||||
SpvStorageClassIncomingRayPayloadKHR = 5342,
|
||||
SpvStorageClassIncomingRayPayloadNV = 5342,
|
||||
SpvStorageClassShaderRecordBufferKHR = 5343,
|
||||
SpvStorageClassShaderRecordBufferNV = 5343,
|
||||
SpvStorageClassPhysicalStorageBuffer = 5349,
|
||||
SpvStorageClassPhysicalStorageBufferEXT = 5349,
|
||||
|
|
@ -562,20 +574,35 @@ typedef enum SpvBuiltIn_ {
|
|||
SpvBuiltInFragmentSizeNV = 5292,
|
||||
SpvBuiltInFragInvocationCountEXT = 5293,
|
||||
SpvBuiltInInvocationsPerPixelNV = 5293,
|
||||
SpvBuiltInLaunchIdKHR = 5319,
|
||||
SpvBuiltInLaunchIdNV = 5319,
|
||||
SpvBuiltInLaunchSizeKHR = 5320,
|
||||
SpvBuiltInLaunchSizeNV = 5320,
|
||||
SpvBuiltInWorldRayOriginKHR = 5321,
|
||||
SpvBuiltInWorldRayOriginNV = 5321,
|
||||
SpvBuiltInWorldRayDirectionKHR = 5322,
|
||||
SpvBuiltInWorldRayDirectionNV = 5322,
|
||||
SpvBuiltInObjectRayOriginKHR = 5323,
|
||||
SpvBuiltInObjectRayOriginNV = 5323,
|
||||
SpvBuiltInObjectRayDirectionKHR = 5324,
|
||||
SpvBuiltInObjectRayDirectionNV = 5324,
|
||||
SpvBuiltInRayTminKHR = 5325,
|
||||
SpvBuiltInRayTminNV = 5325,
|
||||
SpvBuiltInRayTmaxKHR = 5326,
|
||||
SpvBuiltInRayTmaxNV = 5326,
|
||||
SpvBuiltInInstanceCustomIndexKHR = 5327,
|
||||
SpvBuiltInInstanceCustomIndexNV = 5327,
|
||||
SpvBuiltInObjectToWorldKHR = 5330,
|
||||
SpvBuiltInObjectToWorldNV = 5330,
|
||||
SpvBuiltInWorldToObjectKHR = 5331,
|
||||
SpvBuiltInWorldToObjectNV = 5331,
|
||||
SpvBuiltInHitTKHR = 5332,
|
||||
SpvBuiltInHitTNV = 5332,
|
||||
SpvBuiltInHitKindKHR = 5333,
|
||||
SpvBuiltInHitKindNV = 5333,
|
||||
SpvBuiltInIncomingRayFlagsKHR = 5351,
|
||||
SpvBuiltInIncomingRayFlagsNV = 5351,
|
||||
SpvBuiltInRayGeometryIndexKHR = 5352,
|
||||
SpvBuiltInWarpsPerSMNV = 5374,
|
||||
SpvBuiltInSMCountNV = 5375,
|
||||
SpvBuiltInWarpIDNV = 5376,
|
||||
|
|
@ -713,6 +740,7 @@ typedef enum SpvScope_ {
|
|||
SpvScopeInvocation = 4,
|
||||
SpvScopeQueueFamily = 5,
|
||||
SpvScopeQueueFamilyKHR = 5,
|
||||
SpvScopeShaderCallKHR = 6,
|
||||
SpvScopeMax = 0x7fffffff,
|
||||
} SpvScope;
|
||||
|
||||
|
|
@ -837,6 +865,8 @@ typedef enum SpvCapability_ {
|
|||
SpvCapabilitySignedZeroInfNanPreserve = 4466,
|
||||
SpvCapabilityRoundingModeRTE = 4467,
|
||||
SpvCapabilityRoundingModeRTZ = 4468,
|
||||
SpvCapabilityRayQueryProvisionalKHR = 4471,
|
||||
SpvCapabilityRayTraversalPrimitiveCullingProvisionalKHR = 4478,
|
||||
SpvCapabilityFloat16ImageAMD = 5008,
|
||||
SpvCapabilityImageGatherBiasLodAMD = 5009,
|
||||
SpvCapabilityFragmentMaskAMD = 5010,
|
||||
|
|
@ -890,6 +920,7 @@ typedef enum SpvCapability_ {
|
|||
SpvCapabilityPhysicalStorageBufferAddresses = 5347,
|
||||
SpvCapabilityPhysicalStorageBufferAddressesEXT = 5347,
|
||||
SpvCapabilityComputeDerivativeGroupLinearNV = 5350,
|
||||
SpvCapabilityRayTracingProvisionalKHR = 5353,
|
||||
SpvCapabilityCooperativeMatrixNV = 5357,
|
||||
SpvCapabilityFragmentShaderSampleInterlockEXT = 5363,
|
||||
SpvCapabilityFragmentShaderShadingRateInterlockEXT = 5372,
|
||||
|
|
@ -907,6 +938,53 @@ typedef enum SpvCapability_ {
|
|||
SpvCapabilityMax = 0x7fffffff,
|
||||
} SpvCapability;
|
||||
|
||||
typedef enum SpvRayFlagsShift_ {
|
||||
SpvRayFlagsOpaqueKHRShift = 0,
|
||||
SpvRayFlagsNoOpaqueKHRShift = 1,
|
||||
SpvRayFlagsTerminateOnFirstHitKHRShift = 2,
|
||||
SpvRayFlagsSkipClosestHitShaderKHRShift = 3,
|
||||
SpvRayFlagsCullBackFacingTrianglesKHRShift = 4,
|
||||
SpvRayFlagsCullFrontFacingTrianglesKHRShift = 5,
|
||||
SpvRayFlagsCullOpaqueKHRShift = 6,
|
||||
SpvRayFlagsCullNoOpaqueKHRShift = 7,
|
||||
SpvRayFlagsSkipTrianglesKHRShift = 8,
|
||||
SpvRayFlagsSkipAABBsKHRShift = 9,
|
||||
SpvRayFlagsMax = 0x7fffffff,
|
||||
} SpvRayFlagsShift;
|
||||
|
||||
typedef enum SpvRayFlagsMask_ {
|
||||
SpvRayFlagsMaskNone = 0,
|
||||
SpvRayFlagsOpaqueKHRMask = 0x00000001,
|
||||
SpvRayFlagsNoOpaqueKHRMask = 0x00000002,
|
||||
SpvRayFlagsTerminateOnFirstHitKHRMask = 0x00000004,
|
||||
SpvRayFlagsSkipClosestHitShaderKHRMask = 0x00000008,
|
||||
SpvRayFlagsCullBackFacingTrianglesKHRMask = 0x00000010,
|
||||
SpvRayFlagsCullFrontFacingTrianglesKHRMask = 0x00000020,
|
||||
SpvRayFlagsCullOpaqueKHRMask = 0x00000040,
|
||||
SpvRayFlagsCullNoOpaqueKHRMask = 0x00000080,
|
||||
SpvRayFlagsSkipTrianglesKHRMask = 0x00000100,
|
||||
SpvRayFlagsSkipAABBsKHRMask = 0x00000200,
|
||||
} SpvRayFlagsMask;
|
||||
|
||||
typedef enum SpvRayQueryIntersection_ {
|
||||
SpvRayQueryIntersectionRayQueryCandidateIntersectionKHR = 0,
|
||||
SpvRayQueryIntersectionRayQueryCommittedIntersectionKHR = 1,
|
||||
SpvRayQueryIntersectionMax = 0x7fffffff,
|
||||
} SpvRayQueryIntersection;
|
||||
|
||||
typedef enum SpvRayQueryCommittedIntersectionType_ {
|
||||
SpvRayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR = 0,
|
||||
SpvRayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR = 1,
|
||||
SpvRayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR = 2,
|
||||
SpvRayQueryCommittedIntersectionTypeMax = 0x7fffffff,
|
||||
} SpvRayQueryCommittedIntersectionType;
|
||||
|
||||
typedef enum SpvRayQueryCandidateIntersectionType_ {
|
||||
SpvRayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR = 0,
|
||||
SpvRayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR = 1,
|
||||
SpvRayQueryCandidateIntersectionTypeMax = 0x7fffffff,
|
||||
} SpvRayQueryCandidateIntersectionType;
|
||||
|
||||
typedef enum SpvOp_ {
|
||||
SpvOpNop = 0,
|
||||
SpvOpUndef = 1,
|
||||
|
|
@ -1258,6 +1336,13 @@ typedef enum SpvOp_ {
|
|||
SpvOpSubgroupAnyKHR = 4429,
|
||||
SpvOpSubgroupAllEqualKHR = 4430,
|
||||
SpvOpSubgroupReadInvocationKHR = 4432,
|
||||
SpvOpTypeRayQueryProvisionalKHR = 4472,
|
||||
SpvOpRayQueryInitializeKHR = 4473,
|
||||
SpvOpRayQueryTerminateKHR = 4474,
|
||||
SpvOpRayQueryGenerateIntersectionKHR = 4475,
|
||||
SpvOpRayQueryConfirmIntersectionKHR = 4476,
|
||||
SpvOpRayQueryProceedKHR = 4477,
|
||||
SpvOpRayQueryGetIntersectionTypeKHR = 4479,
|
||||
SpvOpGroupIAddNonUniformAMD = 5000,
|
||||
SpvOpGroupFAddNonUniformAMD = 5001,
|
||||
SpvOpGroupFMinNonUniformAMD = 5002,
|
||||
|
|
@ -1272,11 +1357,17 @@ typedef enum SpvOp_ {
|
|||
SpvOpImageSampleFootprintNV = 5283,
|
||||
SpvOpGroupNonUniformPartitionNV = 5296,
|
||||
SpvOpWritePackedPrimitiveIndices4x8NV = 5299,
|
||||
SpvOpReportIntersectionKHR = 5334,
|
||||
SpvOpReportIntersectionNV = 5334,
|
||||
SpvOpIgnoreIntersectionKHR = 5335,
|
||||
SpvOpIgnoreIntersectionNV = 5335,
|
||||
SpvOpTerminateRayKHR = 5336,
|
||||
SpvOpTerminateRayNV = 5336,
|
||||
SpvOpTraceNV = 5337,
|
||||
SpvOpTraceRayKHR = 5337,
|
||||
SpvOpTypeAccelerationStructureKHR = 5341,
|
||||
SpvOpTypeAccelerationStructureNV = 5341,
|
||||
SpvOpExecuteCallableKHR = 5344,
|
||||
SpvOpExecuteCallableNV = 5344,
|
||||
SpvOpTypeCooperativeMatrixNV = 5358,
|
||||
SpvOpCooperativeMatrixLoadNV = 5359,
|
||||
|
|
@ -1433,6 +1524,23 @@ typedef enum SpvOp_ {
|
|||
SpvOpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814,
|
||||
SpvOpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815,
|
||||
SpvOpSubgroupAvcSicGetInterRawSadsINTEL = 5816,
|
||||
SpvOpRayQueryGetRayTMinKHR = 6016,
|
||||
SpvOpRayQueryGetRayFlagsKHR = 6017,
|
||||
SpvOpRayQueryGetIntersectionTKHR = 6018,
|
||||
SpvOpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019,
|
||||
SpvOpRayQueryGetIntersectionInstanceIdKHR = 6020,
|
||||
SpvOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021,
|
||||
SpvOpRayQueryGetIntersectionGeometryIndexKHR = 6022,
|
||||
SpvOpRayQueryGetIntersectionPrimitiveIndexKHR = 6023,
|
||||
SpvOpRayQueryGetIntersectionBarycentricsKHR = 6024,
|
||||
SpvOpRayQueryGetIntersectionFrontFaceKHR = 6025,
|
||||
SpvOpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026,
|
||||
SpvOpRayQueryGetIntersectionObjectRayDirectionKHR = 6027,
|
||||
SpvOpRayQueryGetIntersectionObjectRayOriginKHR = 6028,
|
||||
SpvOpRayQueryGetWorldRayDirectionKHR = 6029,
|
||||
SpvOpRayQueryGetWorldRayOriginKHR = 6030,
|
||||
SpvOpRayQueryGetIntersectionObjectToWorldKHR = 6031,
|
||||
SpvOpRayQueryGetIntersectionWorldToObjectKHR = 6032,
|
||||
SpvOpMax = 0x7fffffff,
|
||||
} SpvOp;
|
||||
|
||||
|
|
@ -1791,6 +1899,13 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy
|
|||
case SpvOpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpTypeRayQueryProvisionalKHR: *hasResult = true; *hasResultType = false; break;
|
||||
case SpvOpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case SpvOpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case SpvOpRayQueryGenerateIntersectionKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case SpvOpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case SpvOpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
|
|
@ -1964,6 +2079,23 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy
|
|||
case SpvOpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionInstanceCustomIndexKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionInstanceIdKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionGeometryIndexKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionPrimitiveIndexKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionBarycentricsKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionFrontFaceKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionCandidateAABBOpaqueKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionObjectRayDirectionKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionObjectRayOriginKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetWorldRayDirectionKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetWorldRayOriginKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case SpvOpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break;
|
||||
}
|
||||
}
|
||||
#endif /* SPV_ENABLE_UTILITY_CODE */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2014-2019 The Khronos Group Inc.
|
||||
// Copyright (c) 2014-2020 The Khronos Group Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and/or associated documentation files (the "Materials"),
|
||||
|
|
@ -50,11 +50,11 @@ namespace spv {
|
|||
typedef unsigned int Id;
|
||||
|
||||
#define SPV_VERSION 0x10500
|
||||
#define SPV_REVISION 1
|
||||
#define SPV_REVISION 3
|
||||
|
||||
static const unsigned int MagicNumber = 0x07230203;
|
||||
static const unsigned int Version = 0x00010400;
|
||||
static const unsigned int Revision = 1;
|
||||
static const unsigned int Version = 0x00010500;
|
||||
static const unsigned int Revision = 3;
|
||||
static const unsigned int OpCodeMask = 0xffff;
|
||||
static const unsigned int WordCountShift = 16;
|
||||
|
||||
|
|
@ -78,11 +78,17 @@ enum ExecutionModel {
|
|||
ExecutionModelKernel = 6,
|
||||
ExecutionModelTaskNV = 5267,
|
||||
ExecutionModelMeshNV = 5268,
|
||||
ExecutionModelRayGenerationKHR = 5313,
|
||||
ExecutionModelRayGenerationNV = 5313,
|
||||
ExecutionModelIntersectionKHR = 5314,
|
||||
ExecutionModelIntersectionNV = 5314,
|
||||
ExecutionModelAnyHitKHR = 5315,
|
||||
ExecutionModelAnyHitNV = 5315,
|
||||
ExecutionModelClosestHitKHR = 5316,
|
||||
ExecutionModelClosestHitNV = 5316,
|
||||
ExecutionModelMissKHR = 5317,
|
||||
ExecutionModelMissNV = 5317,
|
||||
ExecutionModelCallableKHR = 5318,
|
||||
ExecutionModelCallableNV = 5318,
|
||||
ExecutionModelMax = 0x7fffffff,
|
||||
};
|
||||
|
|
@ -179,11 +185,17 @@ enum StorageClass {
|
|||
StorageClassAtomicCounter = 10,
|
||||
StorageClassImage = 11,
|
||||
StorageClassStorageBuffer = 12,
|
||||
StorageClassCallableDataKHR = 5328,
|
||||
StorageClassCallableDataNV = 5328,
|
||||
StorageClassIncomingCallableDataKHR = 5329,
|
||||
StorageClassIncomingCallableDataNV = 5329,
|
||||
StorageClassRayPayloadKHR = 5338,
|
||||
StorageClassRayPayloadNV = 5338,
|
||||
StorageClassHitAttributeKHR = 5339,
|
||||
StorageClassHitAttributeNV = 5339,
|
||||
StorageClassIncomingRayPayloadKHR = 5342,
|
||||
StorageClassIncomingRayPayloadNV = 5342,
|
||||
StorageClassShaderRecordBufferKHR = 5343,
|
||||
StorageClassShaderRecordBufferNV = 5343,
|
||||
StorageClassPhysicalStorageBuffer = 5349,
|
||||
StorageClassPhysicalStorageBufferEXT = 5349,
|
||||
|
|
@ -558,20 +570,35 @@ enum BuiltIn {
|
|||
BuiltInFragmentSizeNV = 5292,
|
||||
BuiltInFragInvocationCountEXT = 5293,
|
||||
BuiltInInvocationsPerPixelNV = 5293,
|
||||
BuiltInLaunchIdKHR = 5319,
|
||||
BuiltInLaunchIdNV = 5319,
|
||||
BuiltInLaunchSizeKHR = 5320,
|
||||
BuiltInLaunchSizeNV = 5320,
|
||||
BuiltInWorldRayOriginKHR = 5321,
|
||||
BuiltInWorldRayOriginNV = 5321,
|
||||
BuiltInWorldRayDirectionKHR = 5322,
|
||||
BuiltInWorldRayDirectionNV = 5322,
|
||||
BuiltInObjectRayOriginKHR = 5323,
|
||||
BuiltInObjectRayOriginNV = 5323,
|
||||
BuiltInObjectRayDirectionKHR = 5324,
|
||||
BuiltInObjectRayDirectionNV = 5324,
|
||||
BuiltInRayTminKHR = 5325,
|
||||
BuiltInRayTminNV = 5325,
|
||||
BuiltInRayTmaxKHR = 5326,
|
||||
BuiltInRayTmaxNV = 5326,
|
||||
BuiltInInstanceCustomIndexKHR = 5327,
|
||||
BuiltInInstanceCustomIndexNV = 5327,
|
||||
BuiltInObjectToWorldKHR = 5330,
|
||||
BuiltInObjectToWorldNV = 5330,
|
||||
BuiltInWorldToObjectKHR = 5331,
|
||||
BuiltInWorldToObjectNV = 5331,
|
||||
BuiltInHitTKHR = 5332,
|
||||
BuiltInHitTNV = 5332,
|
||||
BuiltInHitKindKHR = 5333,
|
||||
BuiltInHitKindNV = 5333,
|
||||
BuiltInIncomingRayFlagsKHR = 5351,
|
||||
BuiltInIncomingRayFlagsNV = 5351,
|
||||
BuiltInRayGeometryIndexKHR = 5352,
|
||||
BuiltInWarpsPerSMNV = 5374,
|
||||
BuiltInSMCountNV = 5375,
|
||||
BuiltInWarpIDNV = 5376,
|
||||
|
|
@ -709,6 +736,7 @@ enum Scope {
|
|||
ScopeInvocation = 4,
|
||||
ScopeQueueFamily = 5,
|
||||
ScopeQueueFamilyKHR = 5,
|
||||
ScopeShaderCallKHR = 6,
|
||||
ScopeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
|
@ -833,6 +861,8 @@ enum Capability {
|
|||
CapabilitySignedZeroInfNanPreserve = 4466,
|
||||
CapabilityRoundingModeRTE = 4467,
|
||||
CapabilityRoundingModeRTZ = 4468,
|
||||
CapabilityRayQueryProvisionalKHR = 4471,
|
||||
CapabilityRayTraversalPrimitiveCullingProvisionalKHR = 4478,
|
||||
CapabilityFloat16ImageAMD = 5008,
|
||||
CapabilityImageGatherBiasLodAMD = 5009,
|
||||
CapabilityFragmentMaskAMD = 5010,
|
||||
|
|
@ -886,6 +916,7 @@ enum Capability {
|
|||
CapabilityPhysicalStorageBufferAddresses = 5347,
|
||||
CapabilityPhysicalStorageBufferAddressesEXT = 5347,
|
||||
CapabilityComputeDerivativeGroupLinearNV = 5350,
|
||||
CapabilityRayTracingProvisionalKHR = 5353,
|
||||
CapabilityCooperativeMatrixNV = 5357,
|
||||
CapabilityFragmentShaderSampleInterlockEXT = 5363,
|
||||
CapabilityFragmentShaderShadingRateInterlockEXT = 5372,
|
||||
|
|
@ -903,6 +934,53 @@ enum Capability {
|
|||
CapabilityMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum RayFlagsShift {
|
||||
RayFlagsOpaqueKHRShift = 0,
|
||||
RayFlagsNoOpaqueKHRShift = 1,
|
||||
RayFlagsTerminateOnFirstHitKHRShift = 2,
|
||||
RayFlagsSkipClosestHitShaderKHRShift = 3,
|
||||
RayFlagsCullBackFacingTrianglesKHRShift = 4,
|
||||
RayFlagsCullFrontFacingTrianglesKHRShift = 5,
|
||||
RayFlagsCullOpaqueKHRShift = 6,
|
||||
RayFlagsCullNoOpaqueKHRShift = 7,
|
||||
RayFlagsSkipTrianglesKHRShift = 8,
|
||||
RayFlagsSkipAABBsKHRShift = 9,
|
||||
RayFlagsMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum RayFlagsMask {
|
||||
RayFlagsMaskNone = 0,
|
||||
RayFlagsOpaqueKHRMask = 0x00000001,
|
||||
RayFlagsNoOpaqueKHRMask = 0x00000002,
|
||||
RayFlagsTerminateOnFirstHitKHRMask = 0x00000004,
|
||||
RayFlagsSkipClosestHitShaderKHRMask = 0x00000008,
|
||||
RayFlagsCullBackFacingTrianglesKHRMask = 0x00000010,
|
||||
RayFlagsCullFrontFacingTrianglesKHRMask = 0x00000020,
|
||||
RayFlagsCullOpaqueKHRMask = 0x00000040,
|
||||
RayFlagsCullNoOpaqueKHRMask = 0x00000080,
|
||||
RayFlagsSkipTrianglesKHRMask = 0x00000100,
|
||||
RayFlagsSkipAABBsKHRMask = 0x00000200,
|
||||
};
|
||||
|
||||
enum RayQueryIntersection {
|
||||
RayQueryIntersectionRayQueryCandidateIntersectionKHR = 0,
|
||||
RayQueryIntersectionRayQueryCommittedIntersectionKHR = 1,
|
||||
RayQueryIntersectionMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum RayQueryCommittedIntersectionType {
|
||||
RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR = 0,
|
||||
RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR = 1,
|
||||
RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR = 2,
|
||||
RayQueryCommittedIntersectionTypeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum RayQueryCandidateIntersectionType {
|
||||
RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR = 0,
|
||||
RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR = 1,
|
||||
RayQueryCandidateIntersectionTypeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum Op {
|
||||
OpNop = 0,
|
||||
OpUndef = 1,
|
||||
|
|
@ -1254,6 +1332,13 @@ enum Op {
|
|||
OpSubgroupAnyKHR = 4429,
|
||||
OpSubgroupAllEqualKHR = 4430,
|
||||
OpSubgroupReadInvocationKHR = 4432,
|
||||
OpTypeRayQueryProvisionalKHR = 4472,
|
||||
OpRayQueryInitializeKHR = 4473,
|
||||
OpRayQueryTerminateKHR = 4474,
|
||||
OpRayQueryGenerateIntersectionKHR = 4475,
|
||||
OpRayQueryConfirmIntersectionKHR = 4476,
|
||||
OpRayQueryProceedKHR = 4477,
|
||||
OpRayQueryGetIntersectionTypeKHR = 4479,
|
||||
OpGroupIAddNonUniformAMD = 5000,
|
||||
OpGroupFAddNonUniformAMD = 5001,
|
||||
OpGroupFMinNonUniformAMD = 5002,
|
||||
|
|
@ -1268,11 +1353,17 @@ enum Op {
|
|||
OpImageSampleFootprintNV = 5283,
|
||||
OpGroupNonUniformPartitionNV = 5296,
|
||||
OpWritePackedPrimitiveIndices4x8NV = 5299,
|
||||
OpReportIntersectionKHR = 5334,
|
||||
OpReportIntersectionNV = 5334,
|
||||
OpIgnoreIntersectionKHR = 5335,
|
||||
OpIgnoreIntersectionNV = 5335,
|
||||
OpTerminateRayKHR = 5336,
|
||||
OpTerminateRayNV = 5336,
|
||||
OpTraceNV = 5337,
|
||||
OpTraceRayKHR = 5337,
|
||||
OpTypeAccelerationStructureKHR = 5341,
|
||||
OpTypeAccelerationStructureNV = 5341,
|
||||
OpExecuteCallableKHR = 5344,
|
||||
OpExecuteCallableNV = 5344,
|
||||
OpTypeCooperativeMatrixNV = 5358,
|
||||
OpCooperativeMatrixLoadNV = 5359,
|
||||
|
|
@ -1429,6 +1520,23 @@ enum Op {
|
|||
OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814,
|
||||
OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815,
|
||||
OpSubgroupAvcSicGetInterRawSadsINTEL = 5816,
|
||||
OpRayQueryGetRayTMinKHR = 6016,
|
||||
OpRayQueryGetRayFlagsKHR = 6017,
|
||||
OpRayQueryGetIntersectionTKHR = 6018,
|
||||
OpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019,
|
||||
OpRayQueryGetIntersectionInstanceIdKHR = 6020,
|
||||
OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021,
|
||||
OpRayQueryGetIntersectionGeometryIndexKHR = 6022,
|
||||
OpRayQueryGetIntersectionPrimitiveIndexKHR = 6023,
|
||||
OpRayQueryGetIntersectionBarycentricsKHR = 6024,
|
||||
OpRayQueryGetIntersectionFrontFaceKHR = 6025,
|
||||
OpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026,
|
||||
OpRayQueryGetIntersectionObjectRayDirectionKHR = 6027,
|
||||
OpRayQueryGetIntersectionObjectRayOriginKHR = 6028,
|
||||
OpRayQueryGetWorldRayDirectionKHR = 6029,
|
||||
OpRayQueryGetWorldRayOriginKHR = 6030,
|
||||
OpRayQueryGetIntersectionObjectToWorldKHR = 6031,
|
||||
OpRayQueryGetIntersectionWorldToObjectKHR = 6032,
|
||||
OpMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
|
@ -1787,6 +1895,13 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpTypeRayQueryProvisionalKHR: *hasResult = true; *hasResultType = false; break;
|
||||
case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpRayQueryGenerateIntersectionKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
|
|
@ -1960,6 +2075,23 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionInstanceCustomIndexKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionInstanceIdKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionGeometryIndexKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionPrimitiveIndexKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionBarycentricsKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionFrontFaceKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionObjectRayDirectionKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionObjectRayOriginKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetWorldRayDirectionKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetWorldRayOriginKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break;
|
||||
}
|
||||
}
|
||||
#endif /* SPV_ENABLE_UTILITY_CODE */
|
||||
|
|
@ -1974,6 +2106,7 @@ inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask
|
|||
inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); }
|
||||
inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); }
|
||||
inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); }
|
||||
inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); }
|
||||
|
||||
} // end namespace spv
|
||||
|
||||
|
|
|
|||
|
|
@ -530,7 +530,8 @@ struct SPIRType : IVariant
|
|||
Image,
|
||||
SampledImage,
|
||||
Sampler,
|
||||
AccelerationStructureNV,
|
||||
AccelerationStructure,
|
||||
RayQuery,
|
||||
|
||||
// Keep internal types at the end.
|
||||
ControlPointArray,
|
||||
|
|
@ -562,6 +563,10 @@ struct SPIRType : IVariant
|
|||
|
||||
SmallVector<TypeID> member_types;
|
||||
|
||||
// If member order has been rewritten to handle certain scenarios with Offset,
|
||||
// allow codegen to rewrite the index.
|
||||
SmallVector<uint32_t> member_type_index_redirection;
|
||||
|
||||
struct ImageType
|
||||
{
|
||||
TypeID type;
|
||||
|
|
@ -775,7 +780,7 @@ struct SPIRBlock : IVariant
|
|||
ComplexLoop
|
||||
};
|
||||
|
||||
enum
|
||||
enum : uint32_t
|
||||
{
|
||||
NoDominator = 0xffffffffu
|
||||
};
|
||||
|
|
|
|||
|
|
@ -871,7 +871,7 @@ ShaderResources Compiler::get_shader_resources(const unordered_set<VariableID> *
|
|||
res.atomic_counters.push_back({ var.self, var.basetype, type.self, get_name(var.self) });
|
||||
}
|
||||
// Acceleration structures
|
||||
else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::AccelerationStructureNV)
|
||||
else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::AccelerationStructure)
|
||||
{
|
||||
res.acceleration_structures.push_back({ var.self, var.basetype, type.self, get_name(var.self) });
|
||||
}
|
||||
|
|
@ -4204,19 +4204,22 @@ Bitset Compiler::combined_decoration_for_member(const SPIRType &type, uint32_t i
|
|||
|
||||
if (type_meta)
|
||||
{
|
||||
auto &memb = type_meta->members;
|
||||
if (index >= memb.size())
|
||||
auto &members = type_meta->members;
|
||||
if (index >= members.size())
|
||||
return flags;
|
||||
auto &dec = memb[index];
|
||||
auto &dec = members[index];
|
||||
|
||||
// If our type is a struct, traverse all the members as well recursively.
|
||||
flags.merge_or(dec.decoration_flags);
|
||||
|
||||
for (uint32_t i = 0; i < type.member_types.size(); i++)
|
||||
auto &member_type = get<SPIRType>(type.member_types[index]);
|
||||
|
||||
// If our member type is a struct, traverse all the child members as well recursively.
|
||||
auto &member_childs = member_type.member_types;
|
||||
for (uint32_t i = 0; i < member_childs.size(); i++)
|
||||
{
|
||||
auto &memb_type = get<SPIRType>(type.member_types[i]);
|
||||
if (!memb_type.pointer)
|
||||
flags.merge_or(combined_decoration_for_member(memb_type, i));
|
||||
auto &child_member_type = get<SPIRType>(member_childs[i]);
|
||||
if (!child_member_type.pointer)
|
||||
flags.merge_or(combined_decoration_for_member(member_type, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -615,6 +615,22 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
|
|||
case SPVC_COMPILER_OPTION_MSL_FORCE_NATIVE_ARRAYS:
|
||||
options->msl.force_native_arrays = value != 0;
|
||||
break;
|
||||
|
||||
case SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_OUTPUT_MASK:
|
||||
options->msl.enable_frag_output_mask = value;
|
||||
break;
|
||||
|
||||
case SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_DEPTH_BUILTIN:
|
||||
options->msl.enable_frag_depth_builtin = value != 0;
|
||||
break;
|
||||
|
||||
case SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_STENCIL_REF_BUILTIN:
|
||||
options->msl.enable_frag_stencil_ref_builtin = value != 0;
|
||||
break;
|
||||
|
||||
case SPVC_COMPILER_OPTION_MSL_ENABLE_CLIP_DISTANCE_USER_VARYING:
|
||||
options->msl.enable_clip_distance_user_varying = value != 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
/* Bumped if ABI or API breaks backwards compatibility. */
|
||||
#define SPVC_C_API_VERSION_MAJOR 0
|
||||
/* Bumped if APIs or enumerations are added in a backwards compatible way. */
|
||||
#define SPVC_C_API_VERSION_MINOR 30
|
||||
#define SPVC_C_API_VERSION_MINOR 33
|
||||
/* Bumped if internal implementation details change. */
|
||||
#define SPVC_C_API_VERSION_PATCH 0
|
||||
|
||||
|
|
@ -210,6 +210,7 @@ typedef enum spvc_resource_type
|
|||
SPVC_RESOURCE_TYPE_SEPARATE_IMAGE = 10,
|
||||
SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11,
|
||||
SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12,
|
||||
SPVC_RESOURCE_TYPE_RAY_QUERY = 13,
|
||||
SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff
|
||||
} spvc_resource_type;
|
||||
|
||||
|
|
@ -582,6 +583,11 @@ typedef enum spvc_compiler_option
|
|||
|
||||
SPVC_COMPILER_OPTION_HLSL_NONWRITABLE_UAV_TEXTURE_AS_SRV = 55 | SPVC_COMPILER_OPTION_HLSL_BIT,
|
||||
|
||||
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_OUTPUT_MASK = 56 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_DEPTH_BUILTIN = 57 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||
SPVC_COMPILER_OPTION_MSL_ENABLE_FRAG_STENCIL_REF_BUILTIN = 58 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||
SPVC_COMPILER_OPTION_MSL_ENABLE_CLIP_DISTANCE_USER_VARYING = 59 | SPVC_COMPILER_OPTION_MSL_BIT,
|
||||
|
||||
SPVC_COMPILER_OPTION_INT_MAX = 0x7fffffff
|
||||
} spvc_compiler_option;
|
||||
|
||||
|
|
|
|||
|
|
@ -501,6 +501,11 @@ void CompilerGLSL::find_static_extensions()
|
|||
switch (cap)
|
||||
{
|
||||
case CapabilityShaderNonUniformEXT:
|
||||
if (!options.vulkan_semantics)
|
||||
require_extension_internal("GL_NV_gpu_shader5");
|
||||
else
|
||||
require_extension_internal("GL_EXT_nonuniform_qualifier");
|
||||
break;
|
||||
case CapabilityRuntimeDescriptorArrayEXT:
|
||||
if (!options.vulkan_semantics)
|
||||
SPIRV_CROSS_THROW("GL_EXT_nonuniform_qualifier is only supported in Vulkan GLSL.");
|
||||
|
|
@ -525,6 +530,11 @@ string CompilerGLSL::compile()
|
|||
{
|
||||
if (options.vulkan_semantics)
|
||||
backend.allow_precision_qualifiers = true;
|
||||
else
|
||||
{
|
||||
// only NV_gpu_shader5 supports divergent indexing on OpenGL, and it does so without extra qualifiers
|
||||
backend.nonuniform_qualifier = "";
|
||||
}
|
||||
backend.force_gl_in_out_block = true;
|
||||
backend.supports_extensions = true;
|
||||
backend.use_array_constructor = true;
|
||||
|
|
@ -4626,6 +4636,26 @@ SPIRType CompilerGLSL::binary_op_bitcast_helper(string &cast_op0, string &cast_o
|
|||
return expected_type;
|
||||
}
|
||||
|
||||
bool CompilerGLSL::emit_complex_bitcast(uint32_t result_type, uint32_t id, uint32_t op0)
|
||||
{
|
||||
// Some bitcasts may require complex casting sequences, and are implemented here.
|
||||
// Otherwise a simply unary function will do with bitcast_glsl_op.
|
||||
|
||||
auto &output_type = get<SPIRType>(result_type);
|
||||
auto &input_type = expression_type(op0);
|
||||
string expr;
|
||||
|
||||
if (output_type.basetype == SPIRType::Half && input_type.basetype == SPIRType::Float && input_type.vecsize == 1)
|
||||
expr = join("unpackFloat2x16(floatBitsToUint(", to_unpacked_expression(op0), "))");
|
||||
else if (output_type.basetype == SPIRType::Float && input_type.basetype == SPIRType::Half && input_type.vecsize == 2)
|
||||
expr = join("uintBitsToFloat(packFloat2x16(", to_unpacked_expression(op0), "))");
|
||||
else
|
||||
return false;
|
||||
|
||||
emit_op(result_type, id, expr, should_forward(op0));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CompilerGLSL::emit_binary_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1,
|
||||
const char *op, SPIRType::BaseType input_type, bool skip_cast_if_equal_type)
|
||||
{
|
||||
|
|
@ -6683,6 +6713,8 @@ string CompilerGLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &i
|
|||
// And finally, some even more special purpose casts.
|
||||
if (out_type.basetype == SPIRType::UInt64 && in_type.basetype == SPIRType::UInt && in_type.vecsize == 2)
|
||||
return "packUint2x32";
|
||||
else if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::UInt64 && out_type.vecsize == 2)
|
||||
return "unpackUint2x32";
|
||||
else if (out_type.basetype == SPIRType::Half && in_type.basetype == SPIRType::UInt && in_type.vecsize == 1)
|
||||
return "unpackFloat2x16";
|
||||
else if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::Half && in_type.vecsize == 2)
|
||||
|
|
@ -8545,7 +8577,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||
if (expr.expression_dependencies.empty())
|
||||
forwarded_temporaries.erase(ops[1]);
|
||||
|
||||
if (has_decoration(ops[1], DecorationNonUniformEXT) || has_decoration(ops[2], DecorationNonUniformEXT))
|
||||
if (has_decoration(ops[1], DecorationNonUniformEXT))
|
||||
propagate_nonuniform_qualifier(ops[1]);
|
||||
|
||||
break;
|
||||
|
|
@ -9562,8 +9594,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||
uint32_t id = ops[1];
|
||||
uint32_t arg = ops[2];
|
||||
|
||||
auto op = bitcast_glsl_op(get<SPIRType>(result_type), expression_type(arg));
|
||||
emit_unary_func_op(result_type, id, arg, op.c_str());
|
||||
if (!emit_complex_bitcast(result_type, id, arg))
|
||||
{
|
||||
auto op = bitcast_glsl_op(get<SPIRType>(result_type), expression_type(arg));
|
||||
emit_unary_func_op(result_type, id, arg, op.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -9759,15 +9794,33 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||
}
|
||||
|
||||
case OpAtomicLoad:
|
||||
flush_all_atomic_capable_variables();
|
||||
// FIXME: Image?
|
||||
// OpAtomicLoad seems to only be relevant for atomic counters.
|
||||
{
|
||||
// In plain GLSL, we have no atomic loads, so emulate this by fetch adding by 0 and hope compiler figures it out.
|
||||
// Alternatively, we could rely on KHR_memory_model, but that's not very helpful for GL.
|
||||
auto &type = expression_type(ops[2]);
|
||||
forced_temporaries.insert(ops[1]);
|
||||
GLSL_UFOP(atomicCounter);
|
||||
bool atomic_image = check_atomic_image(ops[2]);
|
||||
bool unsigned_type = (type.basetype == SPIRType::UInt) ||
|
||||
(atomic_image && get<SPIRType>(type.image.type).basetype == SPIRType::UInt);
|
||||
const char *op = atomic_image ? "imageAtomicAdd" : "atomicAdd";
|
||||
const char *increment = unsigned_type ? "0u" : "0";
|
||||
emit_op(ops[0], ops[1], join(op, "(", to_expression(ops[2]), ", ", increment, ")"), false);
|
||||
flush_all_atomic_capable_variables();
|
||||
break;
|
||||
}
|
||||
|
||||
case OpAtomicStore:
|
||||
SPIRV_CROSS_THROW("Unsupported opcode OpAtomicStore.");
|
||||
{
|
||||
// In plain GLSL, we have no atomic stores, so emulate this with an atomic exchange where we don't consume the result.
|
||||
// Alternatively, we could rely on KHR_memory_model, but that's not very helpful for GL.
|
||||
uint32_t ptr = ops[0];
|
||||
// Ignore semantics for now, probably only relevant to CL.
|
||||
uint32_t val = ops[3];
|
||||
const char *op = check_atomic_image(ptr) ? "imageAtomicExchange" : "atomicExchange";
|
||||
statement(op, "(", to_expression(ptr), ", ", to_expression(val), ");");
|
||||
flush_all_atomic_capable_variables();
|
||||
break;
|
||||
}
|
||||
|
||||
case OpAtomicIIncrement:
|
||||
case OpAtomicIDecrement:
|
||||
|
|
@ -11486,7 +11539,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id)
|
|||
// this distinction into the type system.
|
||||
return comparison_ids.count(id) ? "samplerShadow" : "sampler";
|
||||
|
||||
case SPIRType::AccelerationStructureNV:
|
||||
case SPIRType::AccelerationStructure:
|
||||
return "accelerationStructureNV";
|
||||
|
||||
case SPIRType::Void:
|
||||
|
|
@ -11908,10 +11961,19 @@ void CompilerGLSL::emit_function(SPIRFunction &func, const Bitset &return_flags)
|
|||
// If we don't declare the variable when it is assigned we're forced to go through a helper function
|
||||
// which copies elements one by one.
|
||||
add_local_variable_name(var.self);
|
||||
auto &dominated = entry_block.dominated_variables;
|
||||
if (find(begin(dominated), end(dominated), var.self) == end(dominated))
|
||||
entry_block.dominated_variables.push_back(var.self);
|
||||
var.deferred_declaration = true;
|
||||
|
||||
if (var.initializer)
|
||||
{
|
||||
statement(variable_decl(var), ";");
|
||||
var.deferred_declaration = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &dominated = entry_block.dominated_variables;
|
||||
if (find(begin(dominated), end(dominated), var.self) == end(dominated))
|
||||
entry_block.dominated_variables.push_back(var.self);
|
||||
var.deferred_declaration = true;
|
||||
}
|
||||
}
|
||||
else if (var.storage == StorageClassFunction && var.remapped_variable && var.static_expression)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -514,6 +514,8 @@ protected:
|
|||
SPIRType binary_op_bitcast_helper(std::string &cast_op0, std::string &cast_op1, SPIRType::BaseType &input_type,
|
||||
uint32_t op0, uint32_t op1, bool skip_cast_if_equal_type);
|
||||
|
||||
virtual bool emit_complex_bitcast(uint32_t result_type, uint32_t id, uint32_t op0);
|
||||
|
||||
std::string to_ternary_expression(const SPIRType &result_type, uint32_t select, uint32_t true_value,
|
||||
uint32_t false_value);
|
||||
|
||||
|
|
|
|||
|
|
@ -401,8 +401,12 @@ string CompilerHLSL::type_to_glsl(const SPIRType &type, uint32_t id)
|
|||
case SPIRType::Double:
|
||||
return "double";
|
||||
case SPIRType::Int64:
|
||||
if (hlsl_options.shader_model < 60)
|
||||
SPIRV_CROSS_THROW("64-bit integers only supported in SM 6.0.");
|
||||
return "int64_t";
|
||||
case SPIRType::UInt64:
|
||||
if (hlsl_options.shader_model < 60)
|
||||
SPIRV_CROSS_THROW("64-bit integers only supported in SM 6.0.");
|
||||
return "uint64_t";
|
||||
default:
|
||||
return "???";
|
||||
|
|
@ -1499,6 +1503,24 @@ void CompilerHLSL::emit_resources()
|
|||
statement("");
|
||||
}
|
||||
|
||||
if (requires_uint2_packing)
|
||||
{
|
||||
statement("uint64_t SPIRV_Cross_packUint2x32(uint2 value)");
|
||||
begin_scope();
|
||||
statement("return (uint64_t(value.y) << 32) | uint64_t(value.x);");
|
||||
end_scope();
|
||||
statement("");
|
||||
|
||||
statement("uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)");
|
||||
begin_scope();
|
||||
statement("uint2 Unpacked;");
|
||||
statement("Unpacked.x = uint(value & 0xffffffff);");
|
||||
statement("Unpacked.y = uint(value >> 32);");
|
||||
statement("return Unpacked;");
|
||||
end_scope();
|
||||
statement("");
|
||||
}
|
||||
|
||||
if (requires_explicit_fp16_packing)
|
||||
{
|
||||
// HLSL does not pack into a single word sadly :(
|
||||
|
|
@ -3194,6 +3216,11 @@ void CompilerHLSL::emit_uniform(const SPIRVariable &var)
|
|||
emit_legacy_uniform(var);
|
||||
}
|
||||
|
||||
bool CompilerHLSL::emit_complex_bitcast(uint32_t, uint32_t, uint32_t)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string CompilerHLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &in_type)
|
||||
{
|
||||
if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::Int)
|
||||
|
|
@ -4046,7 +4073,7 @@ void CompilerHLSL::emit_access_chain(const Instruction &instruction)
|
|||
add_implied_read_expression(e, ops[i]);
|
||||
}
|
||||
|
||||
if (has_decoration(ops[1], DecorationNonUniformEXT) || has_decoration(ops[2], DecorationNonUniformEXT))
|
||||
if (has_decoration(ops[1], DecorationNonUniformEXT))
|
||||
propagate_nonuniform_qualifier(ops[1]);
|
||||
}
|
||||
else
|
||||
|
|
@ -4060,9 +4087,11 @@ void CompilerHLSL::emit_atomic(const uint32_t *ops, uint32_t length, spv::Op op)
|
|||
const char *atomic_op = nullptr;
|
||||
|
||||
string value_expr;
|
||||
if (op != OpAtomicIDecrement && op != OpAtomicIIncrement)
|
||||
if (op != OpAtomicIDecrement && op != OpAtomicIIncrement && op != OpAtomicLoad && op != OpAtomicStore)
|
||||
value_expr = to_expression(ops[op == OpAtomicCompareExchange ? 6 : 5]);
|
||||
|
||||
bool is_atomic_store = false;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case OpAtomicIIncrement:
|
||||
|
|
@ -4075,6 +4104,11 @@ void CompilerHLSL::emit_atomic(const uint32_t *ops, uint32_t length, spv::Op op)
|
|||
value_expr = "-1";
|
||||
break;
|
||||
|
||||
case OpAtomicLoad:
|
||||
atomic_op = "InterlockedAdd";
|
||||
value_expr = "0";
|
||||
break;
|
||||
|
||||
case OpAtomicISub:
|
||||
atomic_op = "InterlockedAdd";
|
||||
value_expr = join("-", enclose_expression(value_expr));
|
||||
|
|
@ -4110,6 +4144,11 @@ void CompilerHLSL::emit_atomic(const uint32_t *ops, uint32_t length, spv::Op op)
|
|||
atomic_op = "InterlockedExchange";
|
||||
break;
|
||||
|
||||
case OpAtomicStore:
|
||||
atomic_op = "InterlockedExchange";
|
||||
is_atomic_store = true;
|
||||
break;
|
||||
|
||||
case OpAtomicCompareExchange:
|
||||
if (length < 8)
|
||||
SPIRV_CROSS_THROW("Not enough data for opcode.");
|
||||
|
|
@ -4121,31 +4160,57 @@ void CompilerHLSL::emit_atomic(const uint32_t *ops, uint32_t length, spv::Op op)
|
|||
SPIRV_CROSS_THROW("Unknown atomic opcode.");
|
||||
}
|
||||
|
||||
uint32_t result_type = ops[0];
|
||||
uint32_t id = ops[1];
|
||||
forced_temporaries.insert(ops[1]);
|
||||
|
||||
auto &type = get<SPIRType>(result_type);
|
||||
statement(variable_decl(type, to_name(id)), ";");
|
||||
|
||||
auto &data_type = expression_type(ops[2]);
|
||||
auto *chain = maybe_get<SPIRAccessChain>(ops[2]);
|
||||
SPIRType::BaseType expr_type;
|
||||
if (data_type.storage == StorageClassImage || !chain)
|
||||
if (is_atomic_store)
|
||||
{
|
||||
statement(atomic_op, "(", to_expression(ops[2]), ", ", value_expr, ", ", to_name(id), ");");
|
||||
expr_type = data_type.basetype;
|
||||
auto &data_type = expression_type(ops[0]);
|
||||
auto *chain = maybe_get<SPIRAccessChain>(ops[0]);
|
||||
|
||||
auto &tmp_id = extra_sub_expressions[ops[0]];
|
||||
if (!tmp_id)
|
||||
{
|
||||
tmp_id = ir.increase_bound_by(1);
|
||||
emit_uninitialized_temporary_expression(get_pointee_type(data_type).self, tmp_id);
|
||||
}
|
||||
|
||||
if (data_type.storage == StorageClassImage || !chain)
|
||||
{
|
||||
statement(atomic_op, "(", to_expression(ops[0]), ", ", to_expression(ops[3]), ", ", to_expression(tmp_id), ");");
|
||||
}
|
||||
else
|
||||
{
|
||||
// RWByteAddress buffer is always uint in its underlying type.
|
||||
statement(chain->base, ".", atomic_op, "(", chain->dynamic_index, chain->static_index, ", ", to_expression(ops[3]),
|
||||
", ", to_expression(tmp_id), ");");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// RWByteAddress buffer is always uint in its underlying type.
|
||||
expr_type = SPIRType::UInt;
|
||||
statement(chain->base, ".", atomic_op, "(", chain->dynamic_index, chain->static_index, ", ", value_expr, ", ",
|
||||
to_name(id), ");");
|
||||
}
|
||||
uint32_t result_type = ops[0];
|
||||
uint32_t id = ops[1];
|
||||
forced_temporaries.insert(ops[1]);
|
||||
|
||||
auto expr = bitcast_expression(type, expr_type, to_name(id));
|
||||
set<SPIRExpression>(id, expr, result_type, true);
|
||||
auto &type = get<SPIRType>(result_type);
|
||||
statement(variable_decl(type, to_name(id)), ";");
|
||||
|
||||
auto &data_type = expression_type(ops[2]);
|
||||
auto *chain = maybe_get<SPIRAccessChain>(ops[2]);
|
||||
SPIRType::BaseType expr_type;
|
||||
if (data_type.storage == StorageClassImage || !chain)
|
||||
{
|
||||
statement(atomic_op, "(", to_expression(ops[2]), ", ", value_expr, ", ", to_name(id), ");");
|
||||
expr_type = data_type.basetype;
|
||||
}
|
||||
else
|
||||
{
|
||||
// RWByteAddress buffer is always uint in its underlying type.
|
||||
expr_type = SPIRType::UInt;
|
||||
statement(chain->base, ".", atomic_op, "(", chain->dynamic_index, chain->static_index, ", ", value_expr,
|
||||
", ", to_name(id), ");");
|
||||
}
|
||||
|
||||
auto expr = bitcast_expression(type, expr_type, to_name(id));
|
||||
set<SPIRExpression>(id, expr, result_type, true);
|
||||
}
|
||||
flush_all_atomic_capable_variables();
|
||||
}
|
||||
|
||||
|
|
@ -4372,6 +4437,27 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|||
emit_access_chain(instruction);
|
||||
break;
|
||||
}
|
||||
case OpBitcast:
|
||||
{
|
||||
auto bitcast_type = get_bitcast_type(ops[0], ops[2]);
|
||||
if (bitcast_type == CompilerHLSL::TypeNormal)
|
||||
CompilerGLSL::emit_instruction(instruction);
|
||||
else
|
||||
{
|
||||
if (!requires_uint2_packing)
|
||||
{
|
||||
requires_uint2_packing = true;
|
||||
force_recompile();
|
||||
}
|
||||
|
||||
if (bitcast_type == CompilerHLSL::TypePackUint2x32)
|
||||
emit_unary_func_op(ops[0], ops[1], ops[2], "SPIRV_Cross_packUint2x32");
|
||||
else
|
||||
emit_unary_func_op(ops[0], ops[1], ops[2], "SPIRV_Cross_unpackUint2x32");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case OpStore:
|
||||
{
|
||||
|
|
@ -4919,6 +5005,8 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|||
case OpAtomicIAdd:
|
||||
case OpAtomicIIncrement:
|
||||
case OpAtomicIDecrement:
|
||||
case OpAtomicLoad:
|
||||
case OpAtomicStore:
|
||||
{
|
||||
emit_atomic(ops, instruction.length, opcode);
|
||||
break;
|
||||
|
|
@ -5350,3 +5438,18 @@ bool CompilerHLSL::is_hlsl_resource_binding_used(ExecutionModel model, uint32_t
|
|||
auto itr = resource_bindings.find(tuple);
|
||||
return itr != end(resource_bindings) && itr->second.second;
|
||||
}
|
||||
|
||||
CompilerHLSL::BitcastType CompilerHLSL::get_bitcast_type(uint32_t result_type, uint32_t op0)
|
||||
{
|
||||
auto &rslt_type = get<SPIRType>(result_type);
|
||||
auto &expr_type = expression_type(op0);
|
||||
|
||||
if (rslt_type.basetype == SPIRType::BaseType::UInt64 && expr_type.basetype == SPIRType::BaseType::UInt &&
|
||||
expr_type.vecsize == 2)
|
||||
return BitcastType::TypePackUint2x32;
|
||||
else if (rslt_type.basetype == SPIRType::BaseType::UInt && rslt_type.vecsize == 2 &&
|
||||
expr_type.basetype == SPIRType::BaseType::UInt64)
|
||||
return BitcastType::TypeUnpackUint64;
|
||||
|
||||
return BitcastType::TypeNormal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ private:
|
|||
std::string layout_for_member(const SPIRType &type, uint32_t index) override;
|
||||
std::string to_interpolation_qualifiers(const Bitset &flags) override;
|
||||
std::string bitcast_glsl_op(const SPIRType &result_type, const SPIRType &argument_type) override;
|
||||
bool emit_complex_bitcast(uint32_t result_type, uint32_t id, uint32_t op0) override;
|
||||
std::string to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_t id) override;
|
||||
std::string to_sampler_expression(uint32_t id);
|
||||
std::string to_resource_binding(const SPIRVariable &var);
|
||||
|
|
@ -249,6 +250,7 @@ private:
|
|||
// TODO: Refactor this to be more similar to MSL, maybe have some common system in place?
|
||||
bool requires_op_fmod = false;
|
||||
bool requires_fp16_packing = false;
|
||||
bool requires_uint2_packing = false;
|
||||
bool requires_explicit_fp16_packing = false;
|
||||
bool requires_unorm8_packing = false;
|
||||
bool requires_snorm8_packing = false;
|
||||
|
|
@ -288,6 +290,15 @@ private:
|
|||
QueryTypeCount = 3
|
||||
};
|
||||
|
||||
enum BitcastType
|
||||
{
|
||||
TypeNormal,
|
||||
TypePackUint2x32,
|
||||
TypeUnpackUint64
|
||||
};
|
||||
|
||||
BitcastType get_bitcast_type(uint32_t result_type, uint32_t op0);
|
||||
|
||||
void emit_builtin_variables();
|
||||
bool require_output = false;
|
||||
bool require_input = false;
|
||||
|
|
|
|||
|
|
@ -965,6 +965,16 @@ void CompilerMSL::emit_entry_point_declarations()
|
|||
}
|
||||
// For some reason, without this, we end up emitting the arrays twice.
|
||||
buffer_arrays.clear();
|
||||
|
||||
// Emit disabled fragment outputs.
|
||||
std::sort(disabled_frag_outputs.begin(), disabled_frag_outputs.end());
|
||||
for (uint32_t var_id : disabled_frag_outputs)
|
||||
{
|
||||
auto &var = get<SPIRVariable>(var_id);
|
||||
add_local_variable_name(var_id);
|
||||
statement(variable_decl(var), ";");
|
||||
var.deferred_declaration = false;
|
||||
}
|
||||
}
|
||||
|
||||
string CompilerMSL::compile()
|
||||
|
|
@ -1742,6 +1752,9 @@ void CompilerMSL::add_composite_variable_to_interface_block(StorageClass storage
|
|||
// When we flatten, we flatten directly from the "out" struct,
|
||||
// not from a function variable.
|
||||
flatten_from_ib_var = true;
|
||||
|
||||
if (!msl_options.enable_clip_distance_user_varying)
|
||||
return;
|
||||
}
|
||||
else if (!meta.strip_array)
|
||||
{
|
||||
|
|
@ -1947,6 +1960,9 @@ void CompilerMSL::add_composite_member_variable_to_interface_block(StorageClass
|
|||
// When we flatten, we flatten directly from the "out" struct,
|
||||
// not from a function variable.
|
||||
flatten_from_ib_var = true;
|
||||
|
||||
if (!msl_options.enable_clip_distance_user_varying)
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < elem_cnt; i++)
|
||||
|
|
@ -2442,6 +2458,7 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch)
|
|||
|
||||
bool is_builtin = is_builtin_variable(var);
|
||||
auto bi_type = BuiltIn(get_decoration(var_id, DecorationBuiltIn));
|
||||
uint32_t location = get_decoration(var_id, DecorationLocation);
|
||||
|
||||
// These builtins are part of the stage in/out structs.
|
||||
bool is_interface_block_builtin =
|
||||
|
|
@ -2467,6 +2484,21 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch)
|
|||
if (bi_type == BuiltInClipDistance)
|
||||
hidden = false;
|
||||
|
||||
// It's not enough to simply avoid marking fragment outputs if the pipeline won't
|
||||
// accept them. We can't put them in the struct at all, or otherwise the compiler
|
||||
// complains that the outputs weren't explicitly marked.
|
||||
if (get_execution_model() == ExecutionModelFragment && storage == StorageClassOutput && !patch &&
|
||||
((is_builtin && ((bi_type == BuiltInFragDepth && !msl_options.enable_frag_depth_builtin) ||
|
||||
(bi_type == BuiltInFragStencilRefEXT && !msl_options.enable_frag_stencil_ref_builtin))) ||
|
||||
(!is_builtin && !(msl_options.enable_frag_output_mask & (1 << location)))))
|
||||
{
|
||||
hidden = true;
|
||||
disabled_frag_outputs.push_back(var_id);
|
||||
// If a builtin, force it to have the proper name.
|
||||
if (is_builtin)
|
||||
set_name(var_id, builtin_to_glsl(bi_type, StorageClassFunction));
|
||||
}
|
||||
|
||||
// Barycentric inputs must be emitted in stage-in, because they can have interpolation arguments.
|
||||
if (is_active && (bi_type == BuiltInBaryCoordNV || bi_type == BuiltInBaryCoordNoPerspNV))
|
||||
{
|
||||
|
|
@ -2496,7 +2528,6 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch)
|
|||
SPIRV_CROSS_THROW("Component decoration is not supported in tessellation shaders.");
|
||||
else if (pack_components)
|
||||
{
|
||||
uint32_t location = get_decoration(var_id, DecorationLocation);
|
||||
auto &location_meta = meta.location_meta[location];
|
||||
location_meta.num_components = std::max(location_meta.num_components, component + type.vecsize);
|
||||
}
|
||||
|
|
@ -3055,10 +3086,20 @@ bool CompilerMSL::validate_member_packing_rules_msl(const SPIRType &type, uint32
|
|||
if (!mbr_type.array.empty())
|
||||
{
|
||||
// If we have an array type, array stride must match exactly with SPIR-V.
|
||||
uint32_t spirv_array_stride = type_struct_member_array_stride(type, index);
|
||||
uint32_t msl_array_stride = get_declared_struct_member_array_stride_msl(type, index);
|
||||
if (spirv_array_stride != msl_array_stride)
|
||||
return false;
|
||||
|
||||
// An exception to this requirement is if we have one array element and a packed decoration.
|
||||
// This comes from DX scalar layout workaround.
|
||||
// If app tries to be cheeky and access the member out of bounds, this will not work, but this is the best we can do.
|
||||
bool relax_array_stride = has_extended_member_decoration(type.self, index, SPIRVCrossDecorationPhysicalTypePacked) &&
|
||||
mbr_type.array.back() == 1 && mbr_type.array_size_literal.back();
|
||||
|
||||
if (!relax_array_stride)
|
||||
{
|
||||
uint32_t spirv_array_stride = type_struct_member_array_stride(type, index);
|
||||
uint32_t msl_array_stride = get_declared_struct_member_array_stride_msl(type, index);
|
||||
if (spirv_array_stride != msl_array_stride)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_matrix(mbr_type))
|
||||
|
|
@ -3170,6 +3211,77 @@ void CompilerMSL::ensure_member_packing_rules_msl(SPIRType &ib_type, uint32_t in
|
|||
else
|
||||
unset_extended_member_decoration(ib_type.self, index, SPIRVCrossDecorationPhysicalTypePacked);
|
||||
}
|
||||
else
|
||||
SPIRV_CROSS_THROW("Found a buffer packing case which we cannot represent in MSL.");
|
||||
|
||||
// Try validating again, now with physical type remapping.
|
||||
if (validate_member_packing_rules_msl(ib_type, index))
|
||||
return;
|
||||
|
||||
// We might have a particular odd scalar layout case where the last element of an array
|
||||
// does not take up as much space as the ArrayStride or MatrixStride. This can happen with DX cbuffers.
|
||||
// The "proper" workaround for this is extremely painful and essentially impossible in the edge case of float3[],
|
||||
// so we hack around it by declaring the offending array or matrix with one less array size/col/row,
|
||||
// and rely on padding to get the correct value. We will technically access arrays out of bounds into the padding region,
|
||||
// but it should spill over gracefully without too much trouble. We rely on behavior like this for unsized arrays anyways.
|
||||
|
||||
// E.g. we might observe a physical layout of:
|
||||
// { float2 a[2]; float b; } in cbuffer layout where ArrayStride of a is 16, but offset of b is 24, packed right after a[1] ...
|
||||
uint32_t type_id = get_extended_member_decoration(ib_type.self, index, SPIRVCrossDecorationPhysicalTypeID);
|
||||
auto &type = get<SPIRType>(type_id);
|
||||
|
||||
// Modify the physical type in-place. This is safe since each physical type workaround is a copy.
|
||||
if (is_array(type))
|
||||
{
|
||||
if (type.array.back() > 1)
|
||||
{
|
||||
if (!type.array_size_literal.back())
|
||||
SPIRV_CROSS_THROW("Cannot apply scalar layout workaround with spec constant array size.");
|
||||
type.array.back() -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have an array of size 1, so we cannot decrement that. Our only option now is to
|
||||
// force a packed layout instead, and drop the physical type remap since ArrayStride is meaningless now.
|
||||
unset_extended_member_decoration(ib_type.self, index, SPIRVCrossDecorationPhysicalTypeID);
|
||||
set_extended_member_decoration(ib_type.self, index, SPIRVCrossDecorationPhysicalTypePacked);
|
||||
}
|
||||
}
|
||||
else if (is_matrix(type))
|
||||
{
|
||||
bool row_major = has_member_decoration(ib_type.self, index, DecorationRowMajor);
|
||||
if (!row_major)
|
||||
{
|
||||
// Slice off one column. If we only have 2 columns, this might turn the matrix into a vector with one array element instead.
|
||||
if (type.columns > 2)
|
||||
{
|
||||
type.columns--;
|
||||
}
|
||||
else if (type.columns == 2)
|
||||
{
|
||||
type.columns = 1;
|
||||
assert(type.array.empty());
|
||||
type.array.push_back(1);
|
||||
type.array_size_literal.push_back(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Slice off one row. If we only have 2 rows, this might turn the matrix into a vector with one array element instead.
|
||||
if (type.vecsize > 2)
|
||||
{
|
||||
type.vecsize--;
|
||||
}
|
||||
else if (type.vecsize == 2)
|
||||
{
|
||||
type.vecsize = type.columns;
|
||||
type.columns = 1;
|
||||
assert(type.array.empty());
|
||||
type.array.push_back(1);
|
||||
type.array_size_literal.push_back(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This better validate now, or we must fail gracefully.
|
||||
if (!validate_member_packing_rules_msl(ib_type, index))
|
||||
|
|
@ -6926,7 +7038,11 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id,
|
|||
exp += string(", ") + get_memory_order(mem_order_2);
|
||||
|
||||
exp += ")";
|
||||
emit_op(result_type, result_id, exp, false);
|
||||
|
||||
if (strcmp(op, "atomic_store_explicit") != 0)
|
||||
emit_op(result_type, result_id, exp, false);
|
||||
else
|
||||
statement(exp, ";");
|
||||
}
|
||||
|
||||
flush_all_atomic_capable_variables();
|
||||
|
|
@ -8877,12 +8993,23 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
|
|||
switch (builtin)
|
||||
{
|
||||
case BuiltInFragStencilRefEXT:
|
||||
// Similar to PointSize, only mark FragStencilRef if there's a stencil buffer.
|
||||
// Some shaders may include a FragStencilRef builtin even when used to render
|
||||
// without a stencil attachment, and Metal will reject this builtin
|
||||
// when compiling the shader into a render pipeline that does not set
|
||||
// stencilAttachmentPixelFormat.
|
||||
if (!msl_options.enable_frag_stencil_ref_builtin)
|
||||
return "";
|
||||
if (!msl_options.supports_msl_version(2, 1))
|
||||
SPIRV_CROSS_THROW("Stencil export only supported in MSL 2.1 and up.");
|
||||
return string(" [[") + builtin_qualifier(builtin) + "]]";
|
||||
|
||||
case BuiltInSampleMask:
|
||||
case BuiltInFragDepth:
|
||||
// Ditto FragDepth.
|
||||
if (!msl_options.enable_frag_depth_builtin)
|
||||
return "";
|
||||
/* fallthrough */
|
||||
case BuiltInSampleMask:
|
||||
return string(" [[") + builtin_qualifier(builtin) + "]]";
|
||||
|
||||
default:
|
||||
|
|
@ -8890,6 +9017,9 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
|
|||
}
|
||||
}
|
||||
uint32_t locn = get_ordered_member_location(type.self, index);
|
||||
// Metal will likely complain about missing color attachments, too.
|
||||
if (locn != k_unknown_location && !(msl_options.enable_frag_output_mask & (1 << locn)))
|
||||
return "";
|
||||
if (locn != k_unknown_location && has_member_decoration(type.self, index, DecorationIndex))
|
||||
return join(" [[color(", locn, "), index(", get_member_decoration(type.self, index, DecorationIndex),
|
||||
")]]");
|
||||
|
|
@ -9059,7 +9189,14 @@ string CompilerMSL::get_type_address_space(const SPIRType &type, uint32_t id, bo
|
|||
addr_space = "constant";
|
||||
}
|
||||
else if (!argument)
|
||||
{
|
||||
addr_space = "constant";
|
||||
}
|
||||
else if (type_is_msl_framebuffer_fetch(type))
|
||||
{
|
||||
// Subpass inputs are passed around by value.
|
||||
addr_space = "";
|
||||
}
|
||||
break;
|
||||
|
||||
case StorageClassFunction:
|
||||
|
|
@ -9500,8 +9637,7 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args)
|
|||
|
||||
// Use Metal's native frame-buffer fetch API for subpass inputs.
|
||||
const auto &basetype = get<SPIRType>(var.basetype);
|
||||
if (basetype.image.dim != DimSubpassData || !msl_options.is_ios() ||
|
||||
!msl_options.ios_use_framebuffer_fetch_subpasses)
|
||||
if (!type_is_msl_framebuffer_fetch(basetype))
|
||||
{
|
||||
ep_args += image_type_glsl(type, var_id) + " " + r.name;
|
||||
if (r.plane > 0)
|
||||
|
|
@ -9513,7 +9649,7 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args)
|
|||
}
|
||||
else
|
||||
{
|
||||
ep_args += image_type_glsl(type, var_id) + "4 " + r.name;
|
||||
ep_args += image_type_glsl(type, var_id) + " " + r.name;
|
||||
ep_args += " [[color(" + convert_to_string(r.index) + ")]]";
|
||||
}
|
||||
|
||||
|
|
@ -9999,6 +10135,12 @@ uint32_t CompilerMSL::get_metal_resource_index(SPIRVariable &var, SPIRType::Base
|
|||
return resource_index;
|
||||
}
|
||||
|
||||
bool CompilerMSL::type_is_msl_framebuffer_fetch(const SPIRType &type) const
|
||||
{
|
||||
return type.basetype == SPIRType::Image && type.image.dim == DimSubpassData &&
|
||||
msl_options.is_ios() && msl_options.ios_use_framebuffer_fetch_subpasses;
|
||||
}
|
||||
|
||||
string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
|
||||
{
|
||||
auto &var = get<SPIRVariable>(arg.id);
|
||||
|
|
@ -10014,6 +10156,9 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
|
|||
name_id = var.basevariable;
|
||||
|
||||
bool constref = !arg.alias_global_variable && is_pointer && arg.write_count == 0;
|
||||
// Framebuffer fetch is plain value, const looks out of place, but it is not wrong.
|
||||
if (type_is_msl_framebuffer_fetch(type))
|
||||
constref = false;
|
||||
|
||||
bool type_is_image = type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage ||
|
||||
type.basetype == SPIRType::Sampler;
|
||||
|
|
@ -10512,6 +10657,9 @@ void CompilerMSL::replace_illegal_names()
|
|||
|
||||
string CompilerMSL::to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain)
|
||||
{
|
||||
if (index < uint32_t(type.member_type_index_redirection.size()))
|
||||
index = type.member_type_index_redirection[index];
|
||||
|
||||
auto *var = maybe_get<SPIRVariable>(base);
|
||||
// If this is a buffer array, we have to dereference the buffer pointers.
|
||||
// Otherwise, if this is a pointer expression, dereference it.
|
||||
|
|
@ -10857,10 +11005,11 @@ string CompilerMSL::image_type_glsl(const SPIRType &type, uint32_t id)
|
|||
}
|
||||
|
||||
// Use Metal's native frame-buffer fetch API for subpass inputs.
|
||||
if (img_type.dim == DimSubpassData && msl_options.is_ios() &&
|
||||
msl_options.ios_use_framebuffer_fetch_subpasses)
|
||||
if (type_is_msl_framebuffer_fetch(type))
|
||||
{
|
||||
return type_to_glsl(get<SPIRType>(img_type.type));
|
||||
auto img_type_4 = get<SPIRType>(img_type.type);
|
||||
img_type_4.vecsize = 4;
|
||||
return type_to_glsl(img_type_4);
|
||||
}
|
||||
if (img_type.ms && img_type.arrayed)
|
||||
{
|
||||
|
|
@ -11220,6 +11369,11 @@ string CompilerMSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &in
|
|||
}
|
||||
}
|
||||
|
||||
bool CompilerMSL::emit_complex_bitcast(uint32_t, uint32_t, uint32_t)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns an MSL string identifying the name of a SPIR-V builtin.
|
||||
// Output builtins are qualified with the name of the stage out structure.
|
||||
string CompilerMSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
|
||||
|
|
@ -11345,13 +11499,17 @@ string CompilerMSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
|
|||
if (!msl_options.supports_msl_version(2, 0))
|
||||
SPIRV_CROSS_THROW("ViewportIndex requires Metal 2.0.");
|
||||
/* fallthrough */
|
||||
case BuiltInFragDepth:
|
||||
case BuiltInFragStencilRefEXT:
|
||||
if ((builtin == BuiltInFragDepth && !msl_options.enable_frag_depth_builtin) ||
|
||||
(builtin == BuiltInFragStencilRefEXT && !msl_options.enable_frag_stencil_ref_builtin))
|
||||
break;
|
||||
/* fallthrough */
|
||||
case BuiltInPosition:
|
||||
case BuiltInPointSize:
|
||||
case BuiltInClipDistance:
|
||||
case BuiltInCullDistance:
|
||||
case BuiltInLayer:
|
||||
case BuiltInFragDepth:
|
||||
case BuiltInFragStencilRefEXT:
|
||||
case BuiltInSampleMask:
|
||||
if (get_execution_model() == ExecutionModelTessellationControl)
|
||||
break;
|
||||
|
|
@ -11775,7 +11933,7 @@ uint32_t CompilerMSL::get_declared_type_matrix_stride_msl(const SPIRType &type,
|
|||
// For packed matrices, we just use the size of the vector type.
|
||||
// Otherwise, MatrixStride == alignment, which is the size of the underlying vector type.
|
||||
if (packed)
|
||||
return (type.width / 8) * (row_major ? type.columns : type.vecsize);
|
||||
return (type.width / 8) * ((row_major && type.columns > 1) ? type.columns : type.vecsize);
|
||||
else
|
||||
return get_declared_type_alignment_msl(type, false, row_major);
|
||||
}
|
||||
|
|
@ -11853,7 +12011,7 @@ uint32_t CompilerMSL::get_declared_type_size_msl(const SPIRType &type, bool is_p
|
|||
uint32_t vecsize = type.vecsize;
|
||||
uint32_t columns = type.columns;
|
||||
|
||||
if (row_major)
|
||||
if (row_major && columns > 1)
|
||||
swap(vecsize, columns);
|
||||
|
||||
if (vecsize == 3)
|
||||
|
|
@ -11914,7 +12072,7 @@ uint32_t CompilerMSL::get_declared_type_alignment_msl(const SPIRType &type, bool
|
|||
else
|
||||
{
|
||||
// This is the general rule for MSL. Size == alignment.
|
||||
uint32_t vecsize = row_major ? type.columns : type.vecsize;
|
||||
uint32_t vecsize = (row_major && type.columns > 1) ? type.columns : type.vecsize;
|
||||
return (type.width / 8) * (vecsize == 3 ? 4 : vecsize);
|
||||
}
|
||||
}
|
||||
|
|
@ -12302,9 +12460,28 @@ void CompilerMSL::MemberSorter::sort()
|
|||
// the members should be reordered, based on builtin and sorting aspect meta info.
|
||||
size_t mbr_cnt = type.member_types.size();
|
||||
SmallVector<uint32_t> mbr_idxs(mbr_cnt);
|
||||
iota(mbr_idxs.begin(), mbr_idxs.end(), 0); // Fill with consecutive indices
|
||||
std::iota(mbr_idxs.begin(), mbr_idxs.end(), 0); // Fill with consecutive indices
|
||||
std::stable_sort(mbr_idxs.begin(), mbr_idxs.end(), *this); // Sort member indices based on sorting aspect
|
||||
|
||||
bool sort_is_identity = true;
|
||||
for (uint32_t mbr_idx = 0; mbr_idx < mbr_cnt; mbr_idx++)
|
||||
{
|
||||
if (mbr_idx != mbr_idxs[mbr_idx])
|
||||
{
|
||||
sort_is_identity = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sort_is_identity)
|
||||
return;
|
||||
|
||||
if (meta.members.size() < type.member_types.size())
|
||||
{
|
||||
// This should never trigger in normal circumstances, but to be safe.
|
||||
meta.members.resize(type.member_types.size());
|
||||
}
|
||||
|
||||
// Move type and meta member info to the order defined by the sorted member indices.
|
||||
// This is done by creating temporary copies of both member types and meta, and then
|
||||
// copying back to the original content at the sorted indices.
|
||||
|
|
@ -12315,6 +12492,13 @@ void CompilerMSL::MemberSorter::sort()
|
|||
type.member_types[mbr_idx] = mbr_types_cpy[mbr_idxs[mbr_idx]];
|
||||
meta.members[mbr_idx] = mbr_meta_cpy[mbr_idxs[mbr_idx]];
|
||||
}
|
||||
|
||||
if (sort_aspect == SortAspect::Offset)
|
||||
{
|
||||
// If we're sorting by Offset, this might affect user code which accesses a buffer block.
|
||||
// We will need to redirect member indices from one index to sorted index.
|
||||
type.member_type_index_redirection = std::move(mbr_idxs);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort first by builtin status (put builtins at end), then by the sorting aspect.
|
||||
|
|
|
|||
|
|
@ -268,7 +268,10 @@ public:
|
|||
uint32_t dynamic_offsets_buffer_index = 23;
|
||||
uint32_t shader_input_wg_index = 0;
|
||||
uint32_t device_index = 0;
|
||||
uint32_t enable_frag_output_mask = 0xffffffff;
|
||||
bool enable_point_size_builtin = true;
|
||||
bool enable_frag_depth_builtin = true;
|
||||
bool enable_frag_stencil_ref_builtin = true;
|
||||
bool disable_rasterization = false;
|
||||
bool capture_output_to_buffer = false;
|
||||
bool swizzle_texture_samples = false;
|
||||
|
|
@ -317,12 +320,16 @@ public:
|
|||
// May reduce performance in scenarios where arrays are copied around as value-types.
|
||||
bool force_native_arrays = false;
|
||||
|
||||
bool is_ios()
|
||||
// If a shader writes clip distance, also emit user varyings which
|
||||
// can be read in subsequent stages.
|
||||
bool enable_clip_distance_user_varying = true;
|
||||
|
||||
bool is_ios() const
|
||||
{
|
||||
return platform == iOS;
|
||||
}
|
||||
|
||||
bool is_macos()
|
||||
bool is_macos() const
|
||||
{
|
||||
return platform == macOS;
|
||||
}
|
||||
|
|
@ -628,6 +635,7 @@ protected:
|
|||
bool builtin_translates_to_nonarray(spv::BuiltIn builtin) const override;
|
||||
|
||||
std::string bitcast_glsl_op(const SPIRType &result_type, const SPIRType &argument_type) override;
|
||||
bool emit_complex_bitcast(uint32_t result_id, uint32_t id, uint32_t op0) override;
|
||||
bool skip_argument(uint32_t id) const override;
|
||||
std::string to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain) override;
|
||||
std::string to_qualifiers_glsl(uint32_t id) override;
|
||||
|
|
@ -870,6 +878,8 @@ protected:
|
|||
// Must be ordered since array is in a specific order.
|
||||
std::map<SetBindingPair, std::pair<uint32_t, uint32_t>> buffers_requiring_dynamic_offset;
|
||||
|
||||
SmallVector<uint32_t> disabled_frag_outputs;
|
||||
|
||||
std::unordered_set<SetBindingPair, InternalHasher> inline_uniform_blocks;
|
||||
|
||||
uint32_t argument_buffer_ids[kMaxArgumentBuffers];
|
||||
|
|
@ -888,6 +898,8 @@ protected:
|
|||
|
||||
void activate_argument_buffer_resources();
|
||||
|
||||
bool type_is_msl_framebuffer_fetch(const SPIRType &type) const;
|
||||
|
||||
// OpcodeHandler that handles several MSL preprocessing operations.
|
||||
struct OpCodePreprocessor : OpcodeHandler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -683,11 +683,19 @@ void Parser::parse(const Instruction &instruction)
|
|||
break;
|
||||
}
|
||||
|
||||
case OpTypeAccelerationStructureNV:
|
||||
case OpTypeAccelerationStructureKHR:
|
||||
{
|
||||
uint32_t id = ops[0];
|
||||
auto &type = set<SPIRType>(id);
|
||||
type.basetype = SPIRType::AccelerationStructureNV;
|
||||
type.basetype = SPIRType::AccelerationStructure;
|
||||
break;
|
||||
}
|
||||
|
||||
case OpTypeRayQueryProvisionalKHR:
|
||||
{
|
||||
uint32_t id = ops[0];
|
||||
auto &type = set<SPIRType>(id);
|
||||
type.basetype = SPIRType::RayQuery;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -601,6 +601,7 @@ void CompilerReflection::emit_specialization_constants()
|
|||
auto &c = get<SPIRConstant>(spec_const.id);
|
||||
auto type = get<SPIRType>(c.constant_type);
|
||||
json_stream->begin_json_object();
|
||||
json_stream->emit_json_key_value("name", get_name(spec_const.id));
|
||||
json_stream->emit_json_key_value("id", spec_const.constant_id);
|
||||
json_stream->emit_json_key_value("type", type_to_glsl(type));
|
||||
json_stream->emit_json_key_value("variable_id", spec_const.id);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ extern "C"
|
|||
hlsl_options.shader_model = options->shader_model;
|
||||
hlsl_options.point_size_compat = options->point_size_compat;
|
||||
hlsl_options.point_coord_compat = options->point_coord_compat;
|
||||
hlsl_options.force_storage_buffer_as_uav = options->force_storage_buffer_as_uav;
|
||||
hlsl_options.nonwritable_uav_texture_as_srv = options->nonwritable_uav_texture_as_srv;
|
||||
|
||||
compiler_hlsl->set_hlsl_options(hlsl_options);
|
||||
} while (0);)
|
||||
|
|
@ -186,6 +188,7 @@ extern "C"
|
|||
auto glsl_options = compiler_glsl->get_common_options();
|
||||
glsl_options.version = options->version;
|
||||
glsl_options.es = options->es;
|
||||
glsl_options.enable_420pack_extension = options->enable_420_pack_extension;
|
||||
glsl_options.vertex.fixup_clipspace = options->vertex_transform_clip_space;
|
||||
glsl_options.vertex.flip_vert_y = options->vertex_invert_y;
|
||||
compiler_glsl->set_common_options(glsl_options);
|
||||
|
|
@ -377,6 +380,8 @@ extern "C"
|
|||
|
||||
auto ty = (ScType *)malloc(sizeof(ScType));
|
||||
ty->type = type.basetype;
|
||||
ty->vecsize = type.vecsize;
|
||||
ty->columns = type.columns;
|
||||
ty->member_types_size = member_types_size;
|
||||
ty->array_size = array_size;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ extern "C"
|
|||
bool point_coord_compat;
|
||||
bool vertex_transform_clip_space;
|
||||
bool vertex_invert_y;
|
||||
bool force_storage_buffer_as_uav;
|
||||
bool nonwritable_uav_texture_as_srv;
|
||||
} ScHlslCompilerOptions;
|
||||
|
||||
typedef struct ScMslCompilerOptions
|
||||
|
|
@ -85,6 +87,7 @@ extern "C"
|
|||
bool vertex_invert_y;
|
||||
uint32_t version;
|
||||
bool es;
|
||||
bool enable_420_pack_extension;
|
||||
} ScGlslCompilerOptions;
|
||||
|
||||
typedef struct ScResource
|
||||
|
|
@ -125,6 +128,8 @@ extern "C"
|
|||
typedef struct ScType
|
||||
{
|
||||
spirv_cross::SPIRType::BaseType type;
|
||||
uint32_t vecsize;
|
||||
uint32_t columns;
|
||||
uint32_t *member_types;
|
||||
size_t member_types_size;
|
||||
uint32_t *array;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ fn ast_compiles_to_glsl() {
|
|||
.unwrap();
|
||||
ast.set_compiler_options(&glsl::CompilerOptions {
|
||||
version: glsl::Version::V4_60,
|
||||
enable_420_pack_extension: true,
|
||||
vertex: glsl::CompilerVertexOptions::default(),
|
||||
})
|
||||
.unwrap();
|
||||
|
|
@ -63,6 +64,7 @@ fn ast_compiles_all_versions_to_glsl() {
|
|||
if ast
|
||||
.set_compiler_options(&glsl::CompilerOptions {
|
||||
version,
|
||||
enable_420_pack_extension: true,
|
||||
vertex: glsl::CompilerVertexOptions::default(),
|
||||
})
|
||||
.is_err()
|
||||
|
|
@ -80,6 +82,7 @@ fn ast_renames_interface_variables() {
|
|||
vert_ast
|
||||
.set_compiler_options(&glsl::CompilerOptions {
|
||||
version: glsl::Version::V1_00Es,
|
||||
enable_420_pack_extension: true,
|
||||
vertex: glsl::CompilerVertexOptions::default(),
|
||||
})
|
||||
.unwrap();
|
||||
|
|
@ -96,6 +99,7 @@ fn ast_renames_interface_variables() {
|
|||
frag_ast
|
||||
.set_compiler_options(&glsl::CompilerOptions {
|
||||
version: glsl::Version::V1_00Es,
|
||||
enable_420_pack_extension: true,
|
||||
vertex: glsl::CompilerVertexOptions::default(),
|
||||
})
|
||||
.unwrap();
|
||||
|
|
@ -178,6 +182,7 @@ fn ast_can_rename_combined_image_samplers() {
|
|||
.unwrap();
|
||||
ast.set_compiler_options(&glsl::CompilerOptions {
|
||||
version: glsl::Version::V4_10,
|
||||
enable_420_pack_extension: true,
|
||||
vertex: glsl::CompilerVertexOptions::default(),
|
||||
})
|
||||
.unwrap();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ fn ast_compiles_to_hlsl() {
|
|||
point_size_compat: false,
|
||||
point_coord_compat: false,
|
||||
vertex: hlsl::CompilerVertexOptions::default(),
|
||||
force_storage_buffer_as_uav: false,
|
||||
nonwritable_uav_texture_as_srv: false,
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
|
@ -97,6 +99,8 @@ fn ast_compiles_all_shader_models_to_hlsl() {
|
|||
point_size_compat: false,
|
||||
point_coord_compat: false,
|
||||
vertex: hlsl::CompilerVertexOptions::default(),
|
||||
force_storage_buffer_as_uav: false,
|
||||
nonwritable_uav_texture_as_srv: false,
|
||||
})
|
||||
.is_err()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -126,7 +126,9 @@ fn ast_gets_array_dimensions() {
|
|||
spirv::Type::Struct { member_types, .. } => {
|
||||
assert_eq!(member_types.len(), 3);
|
||||
let is_float = match ast.get_type(member_types[2]).unwrap() {
|
||||
spirv::Type::Float { array } => {
|
||||
spirv::Type::Float { vecsize, columns, array } => {
|
||||
assert_eq!(vecsize, 3);
|
||||
assert_eq!(columns, 1);
|
||||
assert_eq!(array.len(), 1);
|
||||
assert_eq!(array[0], 3);
|
||||
true
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"ca73037387b7d6a3301eb8056d6177da2c8b106bb9950aa831e87fad30636781","README.md":"396d46be2d3b596a4b2ab869b2647f667100fd581e91490dc61fac4faa5d9147","lib.rs":"8d56ad9d9fffbe139fa7c206b593627dd2dac104ca7d772b4e4eaf0f8d3291fc"},"package":null}
|
||||
{"files":{"Cargo.toml":"8ee4c40169b14a35aaedcadc80a5dec169cbffe4cdb4f67d3e224744edc2e1d8","README.md":"396d46be2d3b596a4b2ab869b2647f667100fd581e91490dc61fac4faa5d9147","lib.rs":"8d56ad9d9fffbe139fa7c206b593627dd2dac104ca7d772b4e4eaf0f8d3291fc"},"package":null}
|
||||
2
third_party/rust/spirv_cross/Cargo.toml
vendored
2
third_party/rust/spirv_cross/Cargo.toml
vendored
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "spirv_cross"
|
||||
version = "0.18.0"
|
||||
version = "0.20.0"
|
||||
license = "MIT/Apache-2.0"
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue