mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-10-30 14:01:39 +00:00
Switch gfx-hal to 0.6
This commit is contained in:
parent
f7ec6cc1fe
commit
d1da6d8106
135
Cargo.lock
generated
135
Cargo.lock
generated
@ -90,12 +90,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.10.1"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
|
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
@ -164,6 +161,15 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cloudabi"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.20.1"
|
version = "0.20.1"
|
||||||
@ -396,9 +402,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-auxil"
|
name = "gfx-auxil"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "67bdbf8e8d6883c70e5a0d7379ad8ab3ac95127a3761306b36122d8f1c177a8e"
|
checksum = "6311ee3cc7a3b4c8ae94c4513cd2cbe888ec37990cf0ffa672bd275391b12eb1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
@ -407,16 +413,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx11"
|
name = "gfx-backend-dx11"
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "92de0ddc0fde1a89b2a0e92dcc6bbb554bd34af0135e53a28d5ef064611094a4"
|
checksum = "de0a460b6458f3857af43064c687b1a010fe1f1b2e8c68fcd1d5db7206fa0809"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"gfx-auxil",
|
"gfx-auxil",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"libloading 0.5.2",
|
"libloading 0.6.2",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot",
|
"parking_lot 0.11.0",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@ -427,9 +433,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx12"
|
name = "gfx-backend-dx12"
|
||||||
version = "0.5.8"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "05218b5c94539f22ac7d6feb4b2482431b89f6cc897132494701ac48619218d7"
|
checksum = "815ea94b924aa3a98e52ba3f090564c2186c7ef33fc0afa2f6b72314935c8798"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"d3d12",
|
"d3d12",
|
||||||
@ -445,19 +451,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-empty"
|
name = "gfx-backend-empty"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b67bd2d7bc022b257ddbdabc5fa3b10c29c292372c3409f2b6a6e3f4e11cdb85"
|
checksum = "2085227c12b78f6657a900c829f2d0deb46a9be3eaf86844fde263cdc218f77c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
|
"log",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-metal"
|
name = "gfx-backend-metal"
|
||||||
version = "0.5.6"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "92804d20b194de6c84cb4bec14ec6a6dcae9c51f0a9186817fb412a590131ae6"
|
checksum = "42518c5b571be5ba337a89cfba5abfaf2d90b83fc4db96357f64f2ea05f20f81"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -471,7 +478,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"metal",
|
"metal",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot",
|
"parking_lot 0.11.0",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@ -481,15 +488,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-vulkan"
|
name = "gfx-backend-vulkan"
|
||||||
version = "0.5.11"
|
version = "0.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aec9c919cfc236d2c36aaa38609c1906a92f2df99a3c7f53022b01936f98275a"
|
checksum = "a84bda4200a82e1912d575801e2bb76ae19c6256359afbc0adfbbaec02fcadc6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"ash",
|
"ash",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"core-graphics-types",
|
"core-graphics-types",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
|
"inplace_it",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"objc",
|
"objc",
|
||||||
@ -501,9 +509,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-descriptor"
|
name = "gfx-descriptor"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx-extras?rev=473a4cdc63463e7986707507c4a7f6a3a767e329#473a4cdc63463e7986707507c4a7f6a3a767e329"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cd8c7afcd000f279d541a490e27117e61037537279b9342279abf4938fe60c6b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"log",
|
"log",
|
||||||
@ -511,9 +521,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-hal"
|
name = "gfx-hal"
|
||||||
version = "0.5.3"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a18534b23d4c262916231511309bc1f307c74cda8dcb68b93a10ca213a22814b"
|
checksum = "18d0754f5b7a43915fd7466883b2d1bb0800d7cc4609178d0b27bf143b9e5123"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
@ -521,8 +531,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-memory"
|
name = "gfx-memory"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx-extras?rev=473a4cdc63463e7986707507c4a7f6a3a767e329#473a4cdc63463e7986707507c4a7f6a3a767e329"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fe8d8855df07f438eb8a765e90356d5b821d644ea3b59b870091450b89576a9f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
@ -558,6 +569,12 @@ dependencies = [
|
|||||||
"quick-error",
|
"quick-error",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inplace_it"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dd01a2a73f2f399df96b22dc88ea687ef4d76226284e7531ae3c7ee1dc5cb534"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "instant"
|
name = "instant"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
@ -659,6 +676,15 @@ dependencies = [
|
|||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
|
||||||
|
dependencies = [
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
@ -778,8 +804,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/gfx-rs/naga?rev=1eb637038dd15fc1dad770eca8e6943424dbc122#1eb637038dd15fc1dad770eca8e6943424dbc122"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0873deb76cf44b7454fba7b2ba6a89d3de70c08aceffd2c489379b3d9d08e661"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
@ -925,8 +952,19 @@ version = "0.10.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
|
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lock_api",
|
"lock_api 0.3.4",
|
||||||
"parking_lot_core",
|
"parking_lot_core 0.7.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733"
|
||||||
|
dependencies = [
|
||||||
|
"instant",
|
||||||
|
"lock_api 0.4.1",
|
||||||
|
"parking_lot_core 0.8.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -936,7 +974,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
|
checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cloudabi",
|
"cloudabi 0.0.3",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
"smallvec",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cloudabi 0.1.0",
|
||||||
|
"instant",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@ -1095,9 +1148,9 @@ checksum = "60d4a9058849c3e765fe2fa68b72c1416b1766f27eac3c52d7bac8712ea0d390"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ron"
|
name = "ron"
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ece421e0c4129b90e4a35b6f625e472e96c552136f5093a2f4fa2bbb75a62d5"
|
checksum = "a91260f321dbf3b5a16ff91c451dc9eb644ce72775a6812f9c3dfffe63818f8f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -1223,9 +1276,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.4.0"
|
version = "1.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
|
checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay-client-toolkit"
|
name = "smithay-client-toolkit"
|
||||||
@ -1275,11 +1328,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "storage-map"
|
name = "storage-map"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fd0a4829a5c591dc24a944a736d6b1e4053e51339a79fd5d4702c4c999a9c45e"
|
checksum = "418bb14643aa55a7841d5303f72cf512cfb323b8cc221d51580500a1ca75206c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lock_api",
|
"lock_api 0.4.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1582,7 +1635,7 @@ dependencies = [
|
|||||||
"gfx-memory",
|
"gfx-memory",
|
||||||
"loom",
|
"loom",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot 0.11.0",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
@ -1596,7 +1649,7 @@ dependencies = [
|
|||||||
name = "wgpu-subscriber"
|
name = "wgpu-subscriber"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parking_lot",
|
"parking_lot 0.11.0",
|
||||||
"thread-id",
|
"thread-id",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-log",
|
"tracing-log",
|
||||||
@ -1676,7 +1729,7 @@ dependencies = [
|
|||||||
"ndk-glue",
|
"ndk-glue",
|
||||||
"ndk-sys",
|
"ndk-sys",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot",
|
"parking_lot 0.10.2",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smithay-client-toolkit",
|
"smithay-client-toolkit",
|
||||||
|
@ -19,7 +19,7 @@ env_logger = "0.7"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
raw-window-handle = "0.3"
|
raw-window-handle = "0.3"
|
||||||
renderdoc = { version = "0.8", optional = true, default_features = false }
|
renderdoc = { version = "0.8", optional = true, default_features = false }
|
||||||
ron = "0.5"
|
ron = "0.6"
|
||||||
winit = { version = "0.22", optional = true }
|
winit = { version = "0.22", optional = true }
|
||||||
|
|
||||||
[dependencies.wgt]
|
[dependencies.wgt]
|
||||||
@ -39,7 +39,7 @@ path = "../wgpu-subscriber"
|
|||||||
version = "0.1"
|
version = "0.1"
|
||||||
|
|
||||||
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
|
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
|
||||||
gfx-backend-vulkan = { version = "0.5", features = ["x11"] }
|
gfx-backend-vulkan = { version = "0.6", features = ["x11"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde = "1"
|
serde = "1"
|
||||||
|
@ -25,45 +25,40 @@ arrayvec = "0.5"
|
|||||||
bitflags = "1.0"
|
bitflags = "1.0"
|
||||||
copyless = "0.1"
|
copyless = "0.1"
|
||||||
fxhash = "0.2"
|
fxhash = "0.2"
|
||||||
hal = { package = "gfx-hal", version = "0.5.3" }
|
hal = { package = "gfx-hal", version = "0.6" }
|
||||||
gfx-backend-empty = "0.5"
|
gfx-backend-empty = "0.6"
|
||||||
parking_lot = "0.10"
|
parking_lot = "0.11"
|
||||||
raw-window-handle = { version = "0.3", optional = true }
|
raw-window-handle = { version = "0.3", optional = true }
|
||||||
ron = { version = "0.5", optional = true }
|
ron = { version = "0.6", optional = true }
|
||||||
serde = { version = "1.0", features = ["serde_derive"], optional = true }
|
serde = { version = "1.0", features = ["serde_derive"], optional = true }
|
||||||
smallvec = "1"
|
smallvec = "1"
|
||||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
|
gfx-descriptor = "0.2"
|
||||||
|
gfx-memory = "0.2"
|
||||||
|
|
||||||
[dependencies.naga]
|
[dependencies.naga]
|
||||||
git = "https://github.com/gfx-rs/naga"
|
version = "0.2"
|
||||||
rev = "1eb637038dd15fc1dad770eca8e6943424dbc122"
|
#git = "https://github.com/gfx-rs/naga"
|
||||||
|
#rev = "1eb637038dd15fc1dad770eca8e6943424dbc122"
|
||||||
features = ["spirv"]
|
features = ["spirv"]
|
||||||
|
|
||||||
[dependencies.gfx-descriptor]
|
|
||||||
git = "https://github.com/gfx-rs/gfx-extras"
|
|
||||||
rev = "473a4cdc63463e7986707507c4a7f6a3a767e329"
|
|
||||||
|
|
||||||
[dependencies.gfx-memory]
|
|
||||||
git = "https://github.com/gfx-rs/gfx-extras"
|
|
||||||
rev = "473a4cdc63463e7986707507c4a7f6a3a767e329"
|
|
||||||
|
|
||||||
[dependencies.wgt]
|
[dependencies.wgt]
|
||||||
path = "../wgpu-types"
|
path = "../wgpu-types"
|
||||||
package = "wgpu-types"
|
package = "wgpu-types"
|
||||||
version = "0.5"
|
version = "0.5"
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
|
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
|
||||||
gfx-backend-metal = { version = "0.5.6" }
|
gfx-backend-metal = { version = "0.6" }
|
||||||
gfx-backend-vulkan = { version = "0.5.11", optional = true }
|
gfx-backend-vulkan = { version = "0.6", optional = true }
|
||||||
|
|
||||||
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
|
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
|
||||||
gfx-backend-vulkan = { version = "0.5.11" }
|
gfx-backend-vulkan = { version = "0.6.1" }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
gfx-backend-dx12 = { version = "0.5.8" }
|
gfx-backend-dx12 = { version = "0.6" }
|
||||||
gfx-backend-dx11 = { version = "0.5" }
|
gfx-backend-dx11 = { version = "0.6" }
|
||||||
gfx-backend-vulkan = { version = "0.5.11" }
|
gfx-backend-vulkan = { version = "0.6" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
loom = "0.3"
|
loom = "0.3"
|
||||||
|
@ -14,8 +14,10 @@ use crate::{
|
|||||||
resource::BufferUse,
|
resource::BufferUse,
|
||||||
span,
|
span,
|
||||||
validation::{check_buffer_usage, MissingBufferUsageError},
|
validation::{check_buffer_usage, MissingBufferUsageError},
|
||||||
|
MAX_BIND_GROUPS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use arrayvec::ArrayVec;
|
||||||
use hal::command::CommandBuffer as _;
|
use hal::command::CommandBuffer as _;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use wgt::{BufferAddress, BufferUsage, ShaderStage};
|
use wgt::{BufferAddress, BufferUsage, ShaderStage};
|
||||||
@ -212,6 +214,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
pipeline: PipelineState::Required,
|
pipeline: PipelineState::Required,
|
||||||
debug_scope_depth: 0,
|
debug_scope_depth: 0,
|
||||||
};
|
};
|
||||||
|
let mut temp_offsets = Vec::new();
|
||||||
|
|
||||||
for command in base.commands {
|
for command in base.commands {
|
||||||
match *command {
|
match *command {
|
||||||
@ -228,7 +231,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
|
temp_offsets.clear();
|
||||||
|
temp_offsets
|
||||||
|
.extend_from_slice(&base.dynamic_offsets[..num_dynamic_offsets as usize]);
|
||||||
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];
|
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];
|
||||||
|
|
||||||
let bind_group = cmd_buf
|
let bind_group = cmd_buf
|
||||||
@ -236,7 +241,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.bind_groups
|
.bind_groups
|
||||||
.use_extend(&*bind_group_guard, bind_group_id, (), ())
|
.use_extend(&*bind_group_guard, bind_group_id, (), ())
|
||||||
.map_err(|_| ComputePassError::InvalidBindGroup(bind_group_id))?;
|
.map_err(|_| ComputePassError::InvalidBindGroup(bind_group_id))?;
|
||||||
bind_group.validate_dynamic_bindings(offsets)?;
|
bind_group.validate_dynamic_bindings(&temp_offsets)?;
|
||||||
|
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
"Encoding barriers on binding of {:?} to {:?}",
|
"Encoding barriers on binding of {:?} to {:?}",
|
||||||
@ -255,22 +260,22 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
index as usize,
|
index as usize,
|
||||||
id::Valid(bind_group_id),
|
id::Valid(bind_group_id),
|
||||||
bind_group,
|
bind_group,
|
||||||
offsets,
|
&temp_offsets,
|
||||||
) {
|
) {
|
||||||
let bind_groups = iter::once(bind_group.raw.raw()).chain(
|
let bind_groups = iter::once(bind_group.raw.raw())
|
||||||
|
.chain(
|
||||||
follow_ups
|
follow_ups
|
||||||
.clone()
|
.clone()
|
||||||
.map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw()),
|
.map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw()),
|
||||||
);
|
)
|
||||||
|
.collect::<ArrayVec<[_; MAX_BIND_GROUPS]>>();
|
||||||
|
temp_offsets.extend(follow_ups.flat_map(|(_, offsets)| offsets));
|
||||||
unsafe {
|
unsafe {
|
||||||
raw.bind_compute_descriptor_sets(
|
raw.bind_compute_descriptor_sets(
|
||||||
&pipeline_layout_guard[pipeline_layout_id].raw,
|
&pipeline_layout_guard[pipeline_layout_id].raw,
|
||||||
index as usize,
|
index as usize,
|
||||||
bind_groups,
|
bind_groups,
|
||||||
offsets
|
&temp_offsets,
|
||||||
.iter()
|
|
||||||
.chain(follow_ups.flat_map(|(_, offsets)| offsets))
|
|
||||||
.cloned(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,19 +11,19 @@ use crate::{
|
|||||||
},
|
},
|
||||||
conv,
|
conv,
|
||||||
device::{
|
device::{
|
||||||
AttachmentData, FramebufferKey, RenderPassContext, RenderPassKey, MAX_COLOR_TARGETS,
|
AttachmentData, AttachmentDataVec, FramebufferKey, RenderPassContext, RenderPassKey,
|
||||||
MAX_VERTEX_BUFFERS,
|
MAX_COLOR_TARGETS, MAX_VERTEX_BUFFERS,
|
||||||
},
|
},
|
||||||
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Token},
|
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Token},
|
||||||
id,
|
id,
|
||||||
pipeline::PipelineFlags,
|
pipeline::PipelineFlags,
|
||||||
resource::{BufferUse, TextureUse, TextureView, TextureViewInner},
|
resource::{BufferUse, TextureUse, TextureView, TextureViewInner},
|
||||||
span,
|
span,
|
||||||
track::TrackerSet,
|
track::{TextureSelector, TrackerSet},
|
||||||
validation::{
|
validation::{
|
||||||
check_buffer_usage, check_texture_usage, MissingBufferUsageError, MissingTextureUsageError,
|
check_buffer_usage, check_texture_usage, MissingBufferUsageError, MissingTextureUsageError,
|
||||||
},
|
},
|
||||||
Stored,
|
Stored, MAX_BIND_GROUPS,
|
||||||
};
|
};
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
@ -460,12 +460,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
|
|
||||||
struct OutputAttachment<'a> {
|
struct OutputAttachment<'a> {
|
||||||
texture_id: &'a Stored<id::TextureId>,
|
texture_id: &'a Stored<id::TextureId>,
|
||||||
range: &'a hal::image::SubresourceRange,
|
selector: &'a TextureSelector,
|
||||||
previous_use: Option<TextureUse>,
|
previous_use: Option<TextureUse>,
|
||||||
new_use: TextureUse,
|
new_use: TextureUse,
|
||||||
}
|
}
|
||||||
const MAX_TOTAL_ATTACHMENTS: usize = 2 * MAX_COLOR_TARGETS + 1;
|
let mut output_attachments = AttachmentDataVec::<OutputAttachment>::new();
|
||||||
let mut output_attachments = ArrayVec::<[OutputAttachment; MAX_TOTAL_ATTACHMENTS]>::new();
|
|
||||||
|
|
||||||
let context = {
|
let context = {
|
||||||
use hal::device::Device as _;
|
use hal::device::Device as _;
|
||||||
@ -512,7 +511,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.use_extend(&*view_guard, at.attachment, (), ())
|
.use_extend(&*view_guard, at.attachment, (), ())
|
||||||
.map_err(|_| RenderPassError::InvalidAttachment(at.attachment))?;
|
.map_err(|_| RenderPassError::InvalidAttachment(at.attachment))?;
|
||||||
add_view(view)?;
|
add_view(view)?;
|
||||||
depth_stencil_aspects = view.range.aspects;
|
depth_stencil_aspects = view.aspects;
|
||||||
|
|
||||||
let source_id = match view.inner {
|
let source_id = match view.inner {
|
||||||
TextureViewInner::Native { ref source_id, .. } => source_id,
|
TextureViewInner::Native { ref source_id, .. } => source_id,
|
||||||
@ -524,8 +523,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
// Using render pass for transition.
|
// Using render pass for transition.
|
||||||
let previous_use = base_trackers
|
let previous_use = base_trackers
|
||||||
.textures
|
.textures
|
||||||
.query(source_id.value, view.range.clone());
|
.query(source_id.value, view.selector.clone());
|
||||||
let new_use = if at.is_read_only(view.range.aspects)? {
|
let new_use = if at.is_read_only(view.aspects)? {
|
||||||
is_ds_read_only = true;
|
is_ds_read_only = true;
|
||||||
TextureUse::ATTACHMENT_READ
|
TextureUse::ATTACHMENT_READ
|
||||||
} else {
|
} else {
|
||||||
@ -533,14 +532,14 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
};
|
};
|
||||||
output_attachments.push(OutputAttachment {
|
output_attachments.push(OutputAttachment {
|
||||||
texture_id: source_id,
|
texture_id: source_id,
|
||||||
range: &view.range,
|
selector: &view.selector,
|
||||||
previous_use,
|
previous_use,
|
||||||
new_use,
|
new_use,
|
||||||
});
|
});
|
||||||
|
|
||||||
let new_layout = conv::map_texture_state(new_use, view.range.aspects).1;
|
let new_layout = conv::map_texture_state(new_use, view.aspects).1;
|
||||||
let old_layout = match previous_use {
|
let old_layout = match previous_use {
|
||||||
Some(usage) => conv::map_texture_state(usage, view.range.aspects).1,
|
Some(usage) => conv::map_texture_state(usage, view.aspects).1,
|
||||||
None => new_layout,
|
None => new_layout,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -573,11 +572,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
TextureViewInner::Native { ref source_id, .. } => {
|
TextureViewInner::Native { ref source_id, .. } => {
|
||||||
let previous_use = base_trackers
|
let previous_use = base_trackers
|
||||||
.textures
|
.textures
|
||||||
.query(source_id.value, view.range.clone());
|
.query(source_id.value, view.selector.clone());
|
||||||
let new_use = TextureUse::ATTACHMENT_WRITE;
|
let new_use = TextureUse::ATTACHMENT_WRITE;
|
||||||
output_attachments.push(OutputAttachment {
|
output_attachments.push(OutputAttachment {
|
||||||
texture_id: source_id,
|
texture_id: source_id,
|
||||||
range: &view.range,
|
selector: &view.selector,
|
||||||
previous_use,
|
previous_use,
|
||||||
new_use,
|
new_use,
|
||||||
});
|
});
|
||||||
@ -646,11 +645,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
TextureViewInner::Native { ref source_id, .. } => {
|
TextureViewInner::Native { ref source_id, .. } => {
|
||||||
let previous_use = base_trackers
|
let previous_use = base_trackers
|
||||||
.textures
|
.textures
|
||||||
.query(source_id.value, view.range.clone());
|
.query(source_id.value, view.selector.clone());
|
||||||
let new_use = TextureUse::ATTACHMENT_WRITE;
|
let new_use = TextureUse::ATTACHMENT_WRITE;
|
||||||
output_attachments.push(OutputAttachment {
|
output_attachments.push(OutputAttachment {
|
||||||
texture_id: source_id,
|
texture_id: source_id,
|
||||||
range: &view.range,
|
selector: &view.selector,
|
||||||
previous_use,
|
previous_use,
|
||||||
new_use,
|
new_use,
|
||||||
});
|
});
|
||||||
@ -755,7 +754,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
inputs: &[],
|
inputs: &[],
|
||||||
preserves: &[],
|
preserves: &[],
|
||||||
};
|
};
|
||||||
let all = entry.key().all().map(|(at, _)| at);
|
let all = entry
|
||||||
|
.key()
|
||||||
|
.all()
|
||||||
|
.map(|(at, _)| at)
|
||||||
|
.collect::<AttachmentDataVec<_>>();
|
||||||
|
|
||||||
let pass =
|
let pass =
|
||||||
unsafe { device.raw.create_render_pass(all, iter::once(subpass), &[]) }
|
unsafe { device.raw.create_render_pass(all, iter::once(subpass), &[]) }
|
||||||
@ -798,10 +801,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
Some(sc_id) => {
|
Some(sc_id) => {
|
||||||
assert!(cmd_buf.used_swap_chain.is_none());
|
assert!(cmd_buf.used_swap_chain.is_none());
|
||||||
// Always create a new framebuffer and delete it after presentation.
|
// Always create a new framebuffer and delete it after presentation.
|
||||||
let attachments = fb_key.all().map(|&id| match view_guard[id].inner {
|
let attachments = fb_key
|
||||||
|
.all()
|
||||||
|
.map(|&id| match view_guard[id].inner {
|
||||||
TextureViewInner::Native { ref raw, .. } => raw,
|
TextureViewInner::Native { ref raw, .. } => raw,
|
||||||
TextureViewInner::SwapChain { ref image, .. } => Borrow::borrow(image),
|
TextureViewInner::SwapChain { ref image, .. } => Borrow::borrow(image),
|
||||||
});
|
})
|
||||||
|
.collect::<AttachmentDataVec<_>>();
|
||||||
let framebuffer = unsafe {
|
let framebuffer = unsafe {
|
||||||
device
|
device
|
||||||
.raw
|
.raw
|
||||||
@ -818,13 +824,16 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
Entry::Occupied(e) => e.into_mut(),
|
Entry::Occupied(e) => e.into_mut(),
|
||||||
Entry::Vacant(e) => {
|
Entry::Vacant(e) => {
|
||||||
let fb = {
|
let fb = {
|
||||||
let attachments =
|
let attachments = e
|
||||||
e.key().all().map(|&id| match view_guard[id].inner {
|
.key()
|
||||||
|
.all()
|
||||||
|
.map(|&id| match view_guard[id].inner {
|
||||||
TextureViewInner::Native { ref raw, .. } => raw,
|
TextureViewInner::Native { ref raw, .. } => raw,
|
||||||
TextureViewInner::SwapChain { ref image, .. } => {
|
TextureViewInner::SwapChain { ref image, .. } => {
|
||||||
Borrow::borrow(image)
|
Borrow::borrow(image)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.collect::<AttachmentDataVec<_>>();
|
||||||
unsafe {
|
unsafe {
|
||||||
device
|
device
|
||||||
.raw
|
.raw
|
||||||
@ -895,7 +904,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}))
|
||||||
|
.collect::<ArrayVec<[_; MAX_COLOR_TARGETS + 1]>>();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
raw.begin_render_pass(
|
raw.begin_render_pass(
|
||||||
@ -927,6 +937,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
vertex: VertexState::default(),
|
vertex: VertexState::default(),
|
||||||
debug_scope_depth: 0,
|
debug_scope_depth: 0,
|
||||||
};
|
};
|
||||||
|
let mut temp_offsets = Vec::new();
|
||||||
|
|
||||||
for command in base.commands {
|
for command in base.commands {
|
||||||
match *command {
|
match *command {
|
||||||
@ -944,7 +955,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
|
temp_offsets.clear();
|
||||||
|
temp_offsets
|
||||||
|
.extend_from_slice(&base.dynamic_offsets[..num_dynamic_offsets as usize]);
|
||||||
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];
|
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];
|
||||||
|
|
||||||
let bind_group = trackers
|
let bind_group = trackers
|
||||||
@ -952,7 +965,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.use_extend(&*bind_group_guard, bind_group_id, (), ())
|
.use_extend(&*bind_group_guard, bind_group_id, (), ())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
bind_group
|
bind_group
|
||||||
.validate_dynamic_bindings(offsets)
|
.validate_dynamic_bindings(&temp_offsets)
|
||||||
.map_err(RenderPassError::from)?;
|
.map_err(RenderPassError::from)?;
|
||||||
|
|
||||||
trackers.merge_extend(&bind_group.used);
|
trackers.merge_extend(&bind_group.used);
|
||||||
@ -961,22 +974,22 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
index as usize,
|
index as usize,
|
||||||
id::Valid(bind_group_id),
|
id::Valid(bind_group_id),
|
||||||
bind_group,
|
bind_group,
|
||||||
offsets,
|
&temp_offsets,
|
||||||
) {
|
) {
|
||||||
let bind_groups = iter::once(bind_group.raw.raw()).chain(
|
let bind_groups = iter::once(bind_group.raw.raw())
|
||||||
|
.chain(
|
||||||
follow_ups
|
follow_ups
|
||||||
.clone()
|
.clone()
|
||||||
.map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw()),
|
.map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw()),
|
||||||
);
|
)
|
||||||
|
.collect::<ArrayVec<[_; MAX_BIND_GROUPS]>>();
|
||||||
|
temp_offsets.extend(follow_ups.flat_map(|(_, offsets)| offsets));
|
||||||
unsafe {
|
unsafe {
|
||||||
raw.bind_graphics_descriptor_sets(
|
raw.bind_graphics_descriptor_sets(
|
||||||
&pipeline_layout_guard[pipeline_layout_id].raw,
|
&pipeline_layout_guard[pipeline_layout_id].raw,
|
||||||
index as usize,
|
index as usize,
|
||||||
bind_groups,
|
bind_groups,
|
||||||
offsets
|
&temp_offsets,
|
||||||
.iter()
|
|
||||||
.chain(follow_ups.flat_map(|(_, offsets)| offsets))
|
|
||||||
.cloned(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1503,7 +1516,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.change_extend(
|
.change_extend(
|
||||||
ot.texture_id.value,
|
ot.texture_id.value,
|
||||||
&ot.texture_id.ref_count,
|
&ot.texture_id.ref_count,
|
||||||
ot.range.clone(),
|
ot.selector.clone(),
|
||||||
ot.new_use,
|
ot.new_use,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -1517,7 +1530,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.prepend(
|
.prepend(
|
||||||
ot.texture_id.value,
|
ot.texture_id.value,
|
||||||
&ot.texture_id.ref_count,
|
&ot.texture_id.ref_count,
|
||||||
ot.range.clone(),
|
ot.selector.clone(),
|
||||||
usage,
|
usage,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -12,6 +12,7 @@ use crate::{
|
|||||||
id::{BufferId, CommandEncoderId, TextureId},
|
id::{BufferId, CommandEncoderId, TextureId},
|
||||||
resource::{BufferUse, Texture, TextureUse},
|
resource::{BufferUse, Texture, TextureUse},
|
||||||
span,
|
span,
|
||||||
|
track::TextureSelector,
|
||||||
};
|
};
|
||||||
|
|
||||||
use hal::command::CommandBuffer as _;
|
use hal::command::CommandBuffer as _;
|
||||||
@ -82,7 +83,7 @@ pub(crate) fn texture_copy_view_to_hal<B: hal::Backend>(
|
|||||||
) -> Result<
|
) -> Result<
|
||||||
(
|
(
|
||||||
hal::image::SubresourceLayers,
|
hal::image::SubresourceLayers,
|
||||||
hal::image::SubresourceRange,
|
TextureSelector,
|
||||||
hal::image::Offset,
|
hal::image::Offset,
|
||||||
),
|
),
|
||||||
TransferError,
|
TransferError,
|
||||||
@ -90,7 +91,7 @@ pub(crate) fn texture_copy_view_to_hal<B: hal::Backend>(
|
|||||||
let texture = texture_guard
|
let texture = texture_guard
|
||||||
.get(view.texture)
|
.get(view.texture)
|
||||||
.map_err(|_| TransferError::InvalidTexture(view.texture))?;
|
.map_err(|_| TransferError::InvalidTexture(view.texture))?;
|
||||||
let aspects = texture.full_range.aspects;
|
|
||||||
let level = view.mip_level as hal::image::Level;
|
let level = view.mip_level as hal::image::Level;
|
||||||
let (layer, layer_count, z) = match texture.dimension {
|
let (layer, layer_count, z) = match texture.dimension {
|
||||||
wgt::TextureDimension::D1 | wgt::TextureDimension::D2 => (
|
wgt::TextureDimension::D1 | wgt::TextureDimension::D2 => (
|
||||||
@ -102,16 +103,15 @@ pub(crate) fn texture_copy_view_to_hal<B: hal::Backend>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Can't satisfy clippy here unless we modify
|
// TODO: Can't satisfy clippy here unless we modify
|
||||||
// `hal::image::SubresourceRange` in gfx to use `std::ops::RangeBounds`.
|
// `TextureSelector` to use `std::ops::RangeBounds`.
|
||||||
#[allow(clippy::range_plus_one)]
|
#[allow(clippy::range_plus_one)]
|
||||||
Ok((
|
Ok((
|
||||||
hal::image::SubresourceLayers {
|
hal::image::SubresourceLayers {
|
||||||
aspects,
|
aspects: texture.aspects,
|
||||||
level: view.mip_level as hal::image::Level,
|
level,
|
||||||
layers: layer..layer + layer_count,
|
layers: layer..layer + layer_count,
|
||||||
},
|
},
|
||||||
hal::image::SubresourceRange {
|
TextureSelector {
|
||||||
aspects,
|
|
||||||
levels: level..level + 1,
|
levels: level..level + 1,
|
||||||
layers: layer..layer + layer_count,
|
layers: layer..layer + layer_count,
|
||||||
},
|
},
|
||||||
@ -349,7 +349,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
let cmd_buf = CommandBuffer::get_encoder(&mut *cmd_buf_guard, command_encoder_id)?;
|
let cmd_buf = CommandBuffer::get_encoder(&mut *cmd_buf_guard, command_encoder_id)?;
|
||||||
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
|
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
|
||||||
let (texture_guard, _) = hub.textures.read(&mut token);
|
let (texture_guard, _) = hub.textures.read(&mut token);
|
||||||
let (dst_layers, dst_range, dst_offset) =
|
let (dst_layers, dst_selector, dst_offset) =
|
||||||
texture_copy_view_to_hal(destination, copy_size, &*texture_guard)?;
|
texture_copy_view_to_hal(destination, copy_size, &*texture_guard)?;
|
||||||
|
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
@ -383,7 +383,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.use_replace(
|
.use_replace(
|
||||||
&*texture_guard,
|
&*texture_guard,
|
||||||
destination.texture,
|
destination.texture,
|
||||||
dst_range,
|
dst_selector,
|
||||||
TextureUse::COPY_DST,
|
TextureUse::COPY_DST,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -456,7 +456,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
let cmd_buf = CommandBuffer::get_encoder(&mut *cmd_buf_guard, command_encoder_id)?;
|
let cmd_buf = CommandBuffer::get_encoder(&mut *cmd_buf_guard, command_encoder_id)?;
|
||||||
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
|
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
|
||||||
let (texture_guard, _) = hub.textures.read(&mut token);
|
let (texture_guard, _) = hub.textures.read(&mut token);
|
||||||
let (src_layers, src_range, src_offset) =
|
let (src_layers, src_selector, src_offset) =
|
||||||
texture_copy_view_to_hal(source, copy_size, &*texture_guard)?;
|
texture_copy_view_to_hal(source, copy_size, &*texture_guard)?;
|
||||||
|
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
@ -480,7 +480,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.use_replace(
|
.use_replace(
|
||||||
&*texture_guard,
|
&*texture_guard,
|
||||||
source.texture,
|
source.texture,
|
||||||
src_range,
|
src_selector,
|
||||||
TextureUse::COPY_SRC,
|
TextureUse::COPY_SRC,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -567,9 +567,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
// we can't hold both src_pending and dst_pending in scope because they
|
// we can't hold both src_pending and dst_pending in scope because they
|
||||||
// borrow the buffer tracker mutably...
|
// borrow the buffer tracker mutably...
|
||||||
let mut barriers = Vec::new();
|
let mut barriers = Vec::new();
|
||||||
let (src_layers, src_range, src_offset) =
|
let (src_layers, src_selector, src_offset) =
|
||||||
texture_copy_view_to_hal(source, copy_size, &*texture_guard)?;
|
texture_copy_view_to_hal(source, copy_size, &*texture_guard)?;
|
||||||
let (dst_layers, dst_range, dst_offset) =
|
let (dst_layers, dst_selector, dst_offset) =
|
||||||
texture_copy_view_to_hal(destination, copy_size, &*texture_guard)?;
|
texture_copy_view_to_hal(destination, copy_size, &*texture_guard)?;
|
||||||
if src_layers.aspects != dst_layers.aspects {
|
if src_layers.aspects != dst_layers.aspects {
|
||||||
Err(TransferError::MismatchedAspects)?
|
Err(TransferError::MismatchedAspects)?
|
||||||
@ -596,7 +596,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.use_replace(
|
.use_replace(
|
||||||
&*texture_guard,
|
&*texture_guard,
|
||||||
source.texture,
|
source.texture,
|
||||||
src_range,
|
src_selector,
|
||||||
TextureUse::COPY_SRC,
|
TextureUse::COPY_SRC,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -611,7 +611,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.use_replace(
|
.use_replace(
|
||||||
&*texture_guard,
|
&*texture_guard,
|
||||||
destination.texture,
|
destination.texture,
|
||||||
dst_range,
|
dst_selector,
|
||||||
TextureUse::COPY_DST,
|
TextureUse::COPY_DST,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -10,7 +10,7 @@ use crate::{
|
|||||||
GfxBackend, Global, GlobalIdentityHandlerFactory, Hub, Input, InvalidId, Storage, Token,
|
GfxBackend, Global, GlobalIdentityHandlerFactory, Hub, Input, InvalidId, Storage, Token,
|
||||||
},
|
},
|
||||||
id, pipeline, resource, span, swap_chain,
|
id, pipeline, resource, span, swap_chain,
|
||||||
track::{BufferState, TextureState, TrackerSet},
|
track::{BufferState, TextureSelector, TextureState, TrackerSet},
|
||||||
validation::{self, check_buffer_usage, check_texture_usage},
|
validation::{self, check_buffer_usage, check_texture_usage},
|
||||||
FastHashMap, Label, LifeGuard, MultiRefCount, PrivateFeatures, Stored, SubmissionIndex,
|
FastHashMap, Label, LifeGuard, MultiRefCount, PrivateFeatures, Stored, SubmissionIndex,
|
||||||
MAX_BIND_GROUPS,
|
MAX_BIND_GROUPS,
|
||||||
@ -95,6 +95,8 @@ impl<T> AttachmentData<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) type AttachmentDataVec<T> = ArrayVec<[T; MAX_COLOR_TARGETS + MAX_COLOR_TARGETS + 1]>;
|
||||||
|
|
||||||
pub(crate) type RenderPassKey = AttachmentData<(hal::pass::Attachment, hal::image::Layout)>;
|
pub(crate) type RenderPassKey = AttachmentData<(hal::pass::Attachment, hal::image::Layout)>;
|
||||||
pub(crate) type FramebufferKey = AttachmentData<id::Valid<id::TextureViewId>>;
|
pub(crate) type FramebufferKey = AttachmentData<id::Valid<id::TextureViewId>>;
|
||||||
|
|
||||||
@ -540,11 +542,11 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
ref_count: self.life_guard.add_ref(),
|
ref_count: self.life_guard.add_ref(),
|
||||||
},
|
},
|
||||||
usage: desc.usage,
|
usage: desc.usage,
|
||||||
|
aspects,
|
||||||
dimension: desc.dimension,
|
dimension: desc.dimension,
|
||||||
kind,
|
kind,
|
||||||
format: desc.format,
|
format: desc.format,
|
||||||
full_range: hal::image::SubresourceRange {
|
full_range: TextureSelector {
|
||||||
aspects,
|
|
||||||
levels: 0..desc.mip_level_count as hal::image::Level,
|
levels: 0..desc.mip_level_count as hal::image::Level,
|
||||||
layers: 0..kind.num_layers(),
|
layers: 0..kind.num_layers(),
|
||||||
},
|
},
|
||||||
@ -580,7 +582,10 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
resolves: &[],
|
resolves: &[],
|
||||||
preserves: &[],
|
preserves: &[],
|
||||||
};
|
};
|
||||||
let all = key.all().map(|(at, _)| at);
|
let all = key
|
||||||
|
.all()
|
||||||
|
.map(|(at, _)| at)
|
||||||
|
.collect::<AttachmentDataVec<_>>();
|
||||||
|
|
||||||
unsafe { self.raw.create_render_pass(all, iter::once(subpass), &[]) }
|
unsafe { self.raw.create_render_pass(all, iter::once(subpass), &[]) }
|
||||||
}
|
}
|
||||||
@ -1222,7 +1227,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.get(device_id)
|
.get(device_id)
|
||||||
.map_err(|_| DeviceError::Invalid)?;
|
.map_err(|_| DeviceError::Invalid)?;
|
||||||
let texture = device.create_texture(device_id, desc)?;
|
let texture = device.create_texture(device_id, desc)?;
|
||||||
let range = texture.full_range.clone();
|
let num_levels = texture.full_range.levels.end;
|
||||||
|
let num_layers = texture.full_range.layers.end;
|
||||||
let ref_count = texture.life_guard.add_ref();
|
let ref_count = texture.life_guard.add_ref();
|
||||||
|
|
||||||
let id = hub.textures.register_identity(id_in, texture, &mut token);
|
let id = hub.textures.register_identity(id_in, texture, &mut token);
|
||||||
@ -1247,7 +1253,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.trackers
|
.trackers
|
||||||
.lock()
|
.lock()
|
||||||
.textures
|
.textures
|
||||||
.init(id, ref_count, TextureState::with_range(&range))
|
.init(id, ref_count, TextureState::new(num_levels, num_layers))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Ok(id.0)
|
Ok(id.0)
|
||||||
}
|
}
|
||||||
@ -1335,29 +1341,26 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
total: layer_end,
|
total: layer_end,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
let end_level = desc
|
|
||||||
.level_count
|
|
||||||
.map_or(level_end, |_| required_level_count as u8);
|
|
||||||
let end_layer = desc
|
|
||||||
.array_layer_count
|
|
||||||
.map_or(layer_end, |_| required_layer_count as u16);
|
|
||||||
let aspects = match desc.aspect {
|
let aspects = match desc.aspect {
|
||||||
wgt::TextureAspect::All => texture.full_range.aspects,
|
wgt::TextureAspect::All => texture.aspects,
|
||||||
wgt::TextureAspect::DepthOnly => hal::format::Aspects::DEPTH,
|
wgt::TextureAspect::DepthOnly => hal::format::Aspects::DEPTH,
|
||||||
wgt::TextureAspect::StencilOnly => hal::format::Aspects::STENCIL,
|
wgt::TextureAspect::StencilOnly => hal::format::Aspects::STENCIL,
|
||||||
};
|
};
|
||||||
if !texture.full_range.aspects.contains(aspects) {
|
if !texture.aspects.contains(aspects) {
|
||||||
return Err(resource::CreateTextureViewError::InvalidAspect {
|
return Err(resource::CreateTextureViewError::InvalidAspect {
|
||||||
requested: aspects,
|
requested: aspects,
|
||||||
total: texture.full_range.aspects,
|
total: texture.aspects,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let format = desc.format.unwrap_or(texture.format);
|
let format = desc.format.unwrap_or(texture.format);
|
||||||
let range = hal::image::SubresourceRange {
|
let range = hal::image::SubresourceRange {
|
||||||
aspects,
|
aspects,
|
||||||
levels: desc.base_mip_level as u8..end_level,
|
level_start: desc.base_mip_level as _,
|
||||||
layers: desc.base_array_layer as u16..end_layer,
|
level_count: desc.level_count.map(|v| v.get() as _),
|
||||||
|
layer_start: desc.base_array_layer as _,
|
||||||
|
layer_count: desc.array_layer_count.map(|v| v.get() as _),
|
||||||
};
|
};
|
||||||
|
|
||||||
let raw = unsafe {
|
let raw = unsafe {
|
||||||
@ -1373,6 +1376,17 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.or(Err(resource::CreateTextureViewError::OutOfMemory))?
|
.or(Err(resource::CreateTextureViewError::OutOfMemory))?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let end_level = desc
|
||||||
|
.level_count
|
||||||
|
.map_or(level_end, |_| required_level_count as u8);
|
||||||
|
let end_layer = desc
|
||||||
|
.array_layer_count
|
||||||
|
.map_or(layer_end, |_| required_layer_count as u16);
|
||||||
|
let selector = TextureSelector {
|
||||||
|
levels: desc.base_mip_level as u8..end_level,
|
||||||
|
layers: desc.base_array_layer as u16..end_layer,
|
||||||
|
};
|
||||||
|
|
||||||
let view = resource::TextureView {
|
let view = resource::TextureView {
|
||||||
inner: resource::TextureViewInner::Native {
|
inner: resource::TextureViewInner::Native {
|
||||||
raw,
|
raw,
|
||||||
@ -1381,10 +1395,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
ref_count: texture.life_guard.add_ref(),
|
ref_count: texture.life_guard.add_ref(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
aspects,
|
||||||
format: texture.format,
|
format: texture.format,
|
||||||
extent: texture.kind.extent().at_level(range.levels.start),
|
extent: texture.kind.extent().at_level(desc.base_mip_level as _),
|
||||||
samples: texture.kind.num_samples(),
|
samples: texture.kind.num_samples(),
|
||||||
range,
|
selector,
|
||||||
life_guard: LifeGuard::new(),
|
life_guard: LifeGuard::new(),
|
||||||
};
|
};
|
||||||
let ref_count = view.life_guard.add_ref();
|
let ref_count = view.life_guard.add_ref();
|
||||||
@ -2056,7 +2071,6 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
if view
|
if view
|
||||||
.range
|
|
||||||
.aspects
|
.aspects
|
||||||
.contains(hal::format::Aspects::DEPTH | hal::format::Aspects::STENCIL)
|
.contains(hal::format::Aspects::DEPTH | hal::format::Aspects::STENCIL)
|
||||||
{
|
{
|
||||||
@ -2074,13 +2088,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.change_extend(
|
.change_extend(
|
||||||
source_id.value,
|
source_id.value,
|
||||||
&source_id.ref_count,
|
&source_id.ref_count,
|
||||||
view.range.clone(),
|
view.selector.clone(),
|
||||||
internal_use,
|
internal_use,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_texture_usage(texture.usage, pub_usage)?;
|
check_texture_usage(texture.usage, pub_usage)?;
|
||||||
let image_layout =
|
let image_layout =
|
||||||
conv::map_texture_state(internal_use, view.range.aspects).1;
|
conv::map_texture_state(internal_use, view.aspects).1;
|
||||||
SmallVec::from([hal::pso::Descriptor::Image(raw, image_layout)])
|
SmallVec::from([hal::pso::Descriptor::Image(raw, image_layout)])
|
||||||
}
|
}
|
||||||
resource::TextureViewInner::SwapChain { .. } => {
|
resource::TextureViewInner::SwapChain { .. } => {
|
||||||
@ -2138,16 +2152,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
.change_extend(
|
.change_extend(
|
||||||
source_id.value,
|
source_id.value,
|
||||||
&source_id.ref_count,
|
&source_id.ref_count,
|
||||||
view.range.clone(),
|
view.selector.clone(),
|
||||||
internal_use,
|
internal_use,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_texture_usage(texture.usage, pub_usage)?;
|
check_texture_usage(texture.usage, pub_usage)?;
|
||||||
let image_layout = conv::map_texture_state(
|
let image_layout =
|
||||||
internal_use,
|
conv::map_texture_state(internal_use, view.aspects).1;
|
||||||
view.range.aspects,
|
|
||||||
)
|
|
||||||
.1;
|
|
||||||
Ok(hal::pso::Descriptor::Image(raw, image_layout))
|
Ok(hal::pso::Descriptor::Image(raw, image_layout))
|
||||||
}
|
}
|
||||||
resource::TextureViewInner::SwapChain { .. } => {
|
resource::TextureViewInner::SwapChain { .. } => {
|
||||||
@ -2822,12 +2833,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
Err(pipeline::ImplicitLayoutError::ReflectionError(last_stage))?
|
Err(pipeline::ImplicitLayoutError::ReflectionError(last_stage))?
|
||||||
}
|
}
|
||||||
|
|
||||||
let shaders = hal::pso::GraphicsShaderSet {
|
let primitive_assembler = hal::pso::PrimitiveAssemblerDesc::Vertex {
|
||||||
|
buffers: &vertex_buffers,
|
||||||
|
attributes: &attributes,
|
||||||
|
input_assembler,
|
||||||
vertex,
|
vertex,
|
||||||
hull: None,
|
tessellation: None,
|
||||||
domain: None,
|
|
||||||
geometry: None,
|
geometry: None,
|
||||||
fragment,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@ -2852,11 +2864,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
|
|
||||||
let mut render_pass_cache = device.render_passes.lock();
|
let mut render_pass_cache = device.render_passes.lock();
|
||||||
let pipeline_desc = hal::pso::GraphicsPipelineDesc {
|
let pipeline_desc = hal::pso::GraphicsPipelineDesc {
|
||||||
shaders,
|
primitive_assembler,
|
||||||
rasterizer,
|
rasterizer,
|
||||||
vertex_buffers,
|
fragment,
|
||||||
attributes,
|
|
||||||
input_assembler,
|
|
||||||
blender,
|
blender,
|
||||||
depth_stencil,
|
depth_stencil,
|
||||||
multisampling,
|
multisampling,
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
device::DeviceError,
|
device::DeviceError,
|
||||||
id::{DeviceId, SwapChainId, TextureId},
|
id::{DeviceId, SwapChainId, TextureId},
|
||||||
track::DUMMY_SELECTOR,
|
track::{TextureSelector, DUMMY_SELECTOR},
|
||||||
validation::MissingBufferUsageError,
|
validation::MissingBufferUsageError,
|
||||||
Label, LifeGuard, RefCount, Stored,
|
Label, LifeGuard, RefCount, Stored,
|
||||||
};
|
};
|
||||||
@ -204,10 +204,11 @@ pub struct Texture<B: hal::Backend> {
|
|||||||
pub(crate) raw: B::Image,
|
pub(crate) raw: B::Image,
|
||||||
pub(crate) device_id: Stored<DeviceId>,
|
pub(crate) device_id: Stored<DeviceId>,
|
||||||
pub(crate) usage: wgt::TextureUsage,
|
pub(crate) usage: wgt::TextureUsage,
|
||||||
|
pub(crate) aspects: hal::format::Aspects,
|
||||||
pub(crate) dimension: wgt::TextureDimension,
|
pub(crate) dimension: wgt::TextureDimension,
|
||||||
pub(crate) kind: hal::image::Kind,
|
pub(crate) kind: hal::image::Kind,
|
||||||
pub(crate) format: wgt::TextureFormat,
|
pub(crate) format: wgt::TextureFormat,
|
||||||
pub(crate) full_range: hal::image::SubresourceRange,
|
pub(crate) full_range: TextureSelector,
|
||||||
pub(crate) memory: MemoryBlock<B>,
|
pub(crate) memory: MemoryBlock<B>,
|
||||||
pub(crate) life_guard: LifeGuard,
|
pub(crate) life_guard: LifeGuard,
|
||||||
}
|
}
|
||||||
@ -242,8 +243,8 @@ impl<B: hal::Backend> Borrow<RefCount> for Texture<B> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<B: hal::Backend> Borrow<hal::image::SubresourceRange> for Texture<B> {
|
impl<B: hal::Backend> Borrow<TextureSelector> for Texture<B> {
|
||||||
fn borrow(&self) -> &hal::image::SubresourceRange {
|
fn borrow(&self) -> &TextureSelector {
|
||||||
&self.full_range
|
&self.full_range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,10 +294,11 @@ pub(crate) enum TextureViewInner<B: hal::Backend> {
|
|||||||
pub struct TextureView<B: hal::Backend> {
|
pub struct TextureView<B: hal::Backend> {
|
||||||
pub(crate) inner: TextureViewInner<B>,
|
pub(crate) inner: TextureViewInner<B>,
|
||||||
//TODO: store device_id for quick access?
|
//TODO: store device_id for quick access?
|
||||||
|
pub(crate) aspects: hal::format::Aspects,
|
||||||
pub(crate) format: wgt::TextureFormat,
|
pub(crate) format: wgt::TextureFormat,
|
||||||
pub(crate) extent: hal::image::Extent,
|
pub(crate) extent: hal::image::Extent,
|
||||||
pub(crate) samples: hal::image::NumSamples,
|
pub(crate) samples: hal::image::NumSamples,
|
||||||
pub(crate) range: hal::image::SubresourceRange,
|
pub(crate) selector: TextureSelector,
|
||||||
pub(crate) life_guard: LifeGuard,
|
pub(crate) life_guard: LifeGuard,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,9 @@ use crate::{
|
|||||||
device::DeviceError,
|
device::DeviceError,
|
||||||
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Input, Token},
|
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Input, Token},
|
||||||
id::{DeviceId, SwapChainId, TextureViewId, Valid},
|
id::{DeviceId, SwapChainId, TextureViewId, Valid},
|
||||||
resource, span, LifeGuard, PrivateFeatures, Stored, SubmissionIndex,
|
resource, span,
|
||||||
|
track::TextureSelector,
|
||||||
|
LifeGuard, PrivateFeatures, Stored, SubmissionIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
use hal::{self, device::Device as _, queue::CommandQueue as _, window::PresentationSurface as _};
|
use hal::{self, device::Device as _, queue::CommandQueue as _, window::PresentationSurface as _};
|
||||||
@ -184,6 +186,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
ref_count: sc.life_guard.add_ref(),
|
ref_count: sc.life_guard.add_ref(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
aspects: hal::format::Aspects::COLOR,
|
||||||
format: sc.desc.format,
|
format: sc.desc.format,
|
||||||
extent: hal::image::Extent {
|
extent: hal::image::Extent {
|
||||||
width: sc.desc.width,
|
width: sc.desc.width,
|
||||||
@ -191,8 +194,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
depth: 1,
|
depth: 1,
|
||||||
},
|
},
|
||||||
samples: 1,
|
samples: 1,
|
||||||
range: hal::image::SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: hal::format::Aspects::COLOR,
|
|
||||||
layers: 0..1,
|
layers: 0..1,
|
||||||
levels: 0..1,
|
levels: 0..1,
|
||||||
},
|
},
|
||||||
@ -272,7 +274,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
let queue = &mut device.queue_group.queues[0];
|
let queue = &mut device.queue_group.queues[0];
|
||||||
let result = unsafe { queue.present_surface(B::get_surface_mut(surface), image, sem) };
|
let result = unsafe { queue.present(B::get_surface_mut(surface), image, sem) };
|
||||||
|
|
||||||
tracing::debug!(trace = true, "Presented. End of Frame");
|
tracing::debug!(trace = true, "Presented. End of Frame");
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ use std::{
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
pub(crate) use buffer::BufferState;
|
pub(crate) use buffer::BufferState;
|
||||||
pub(crate) use texture::TextureState;
|
pub(crate) use texture::{TextureSelector, TextureState};
|
||||||
|
|
||||||
/// A single unit of state tracking. It keeps an initial
|
/// A single unit of state tracking. It keeps an initial
|
||||||
/// usage as well as the last/current one, similar to `Range`.
|
/// usage as well as the last/current one, similar to `Range`.
|
||||||
@ -151,14 +151,17 @@ impl PendingTransition<TextureState> {
|
|||||||
tex: &'a resource::Texture<B>,
|
tex: &'a resource::Texture<B>,
|
||||||
) -> hal::memory::Barrier<'a, B> {
|
) -> hal::memory::Barrier<'a, B> {
|
||||||
tracing::trace!("\ttexture -> {:?}", self);
|
tracing::trace!("\ttexture -> {:?}", self);
|
||||||
let aspects = tex.full_range.aspects;
|
let aspects = tex.aspects;
|
||||||
hal::memory::Barrier::Image {
|
hal::memory::Barrier::Image {
|
||||||
states: conv::map_texture_state(self.usage.start, aspects)
|
states: conv::map_texture_state(self.usage.start, aspects)
|
||||||
..conv::map_texture_state(self.usage.end, aspects),
|
..conv::map_texture_state(self.usage.end, aspects),
|
||||||
target: &tex.raw,
|
target: &tex.raw,
|
||||||
range: hal::image::SubresourceRange {
|
range: hal::image::SubresourceRange {
|
||||||
aspects,
|
aspects,
|
||||||
..self.selector
|
level_start: self.selector.levels.start,
|
||||||
|
level_count: Some(self.selector.levels.end - self.selector.levels.start),
|
||||||
|
layer_start: self.selector.layers.start,
|
||||||
|
layer_count: Some(self.selector.layers.end - self.selector.layers.start),
|
||||||
},
|
},
|
||||||
families: None,
|
families: None,
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,13 @@ use std::{iter, ops::Range};
|
|||||||
//TODO: store `hal::image::State` here to avoid extra conversions
|
//TODO: store `hal::image::State` here to avoid extra conversions
|
||||||
type PlaneStates = RangedStates<hal::image::Layer, Unit<TextureUse>>;
|
type PlaneStates = RangedStates<hal::image::Layer, Unit<TextureUse>>;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
|
pub struct TextureSelector {
|
||||||
|
//pub aspects: hal::format::Aspects,
|
||||||
|
pub levels: Range<hal::image::Level>,
|
||||||
|
pub layers: Range<hal::image::Layer>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq)]
|
#[derive(Clone, Debug, Default, PartialEq)]
|
||||||
pub(crate) struct TextureState {
|
pub(crate) struct TextureState {
|
||||||
mips: ArrayVec<[PlaneStates; MAX_MIP_LEVELS as usize]>,
|
mips: ArrayVec<[PlaneStates; MAX_MIP_LEVELS as usize]>,
|
||||||
@ -37,14 +44,12 @@ impl PendingTransition<TextureState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TextureState {
|
impl TextureState {
|
||||||
pub fn with_range(range: &hal::image::SubresourceRange) -> Self {
|
pub fn new(mip_level_count: hal::image::Level, array_layer_count: hal::image::Layer) -> Self {
|
||||||
debug_assert_eq!(range.layers.start, 0);
|
|
||||||
debug_assert_eq!(range.levels.start, 0);
|
|
||||||
TextureState {
|
TextureState {
|
||||||
mips: iter::repeat_with(|| {
|
mips: iter::repeat_with(|| {
|
||||||
PlaneStates::from_range(0..range.layers.end, Unit::new(TextureUse::UNINITIALIZED))
|
PlaneStates::from_range(0..array_layer_count, Unit::new(TextureUse::UNINITIALIZED))
|
||||||
})
|
})
|
||||||
.take(range.levels.end as usize)
|
.take(mip_level_count as usize)
|
||||||
.collect(),
|
.collect(),
|
||||||
full: true,
|
full: true,
|
||||||
}
|
}
|
||||||
@ -53,7 +58,7 @@ impl TextureState {
|
|||||||
|
|
||||||
impl ResourceState for TextureState {
|
impl ResourceState for TextureState {
|
||||||
type Id = TextureId;
|
type Id = TextureId;
|
||||||
type Selector = hal::image::SubresourceRange;
|
type Selector = TextureSelector;
|
||||||
type Usage = TextureUse;
|
type Usage = TextureUse;
|
||||||
|
|
||||||
fn query(&self, selector: Self::Selector) -> Option<Self::Usage> {
|
fn query(&self, selector: Self::Selector) -> Option<Self::Usage> {
|
||||||
@ -106,13 +111,11 @@ impl ResourceState for TextureState {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// TODO: Can't satisfy clippy here unless we modify
|
// TODO: Can't satisfy clippy here unless we modify
|
||||||
// `hal::image::SubresourceRange` in gfx to use
|
// `TextureSelector` to use `std::ops::RangeBounds`.
|
||||||
// `std::ops::RangeBounds`.
|
|
||||||
#[allow(clippy::range_plus_one)]
|
#[allow(clippy::range_plus_one)]
|
||||||
let pending = PendingTransition {
|
let pending = PendingTransition {
|
||||||
id,
|
id,
|
||||||
selector: hal::image::SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: hal::format::Aspects::empty(),
|
|
||||||
levels: level..level + 1,
|
levels: level..level + 1,
|
||||||
layers: range.clone(),
|
layers: range.clone(),
|
||||||
},
|
},
|
||||||
@ -158,8 +161,7 @@ impl ResourceState for TextureState {
|
|||||||
Some(old) if old != usage => {
|
Some(old) if old != usage => {
|
||||||
return Err(PendingTransition {
|
return Err(PendingTransition {
|
||||||
id,
|
id,
|
||||||
selector: hal::image::SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: hal::format::Aspects::empty(),
|
|
||||||
levels: level..level + 1,
|
levels: level..level + 1,
|
||||||
layers: range.clone(),
|
layers: range.clone(),
|
||||||
},
|
},
|
||||||
@ -224,13 +226,11 @@ impl ResourceState for TextureState {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Can't satisfy clippy here unless we modify
|
// TODO: Can't satisfy clippy here unless we modify
|
||||||
// `hal::image::SubresourceRange` in gfx to use
|
// `TextureSelector` to use `std::ops::RangeBounds`.
|
||||||
// `std::ops::RangeBounds`.
|
|
||||||
#[allow(clippy::range_plus_one)]
|
#[allow(clippy::range_plus_one)]
|
||||||
let pending = PendingTransition {
|
let pending = PendingTransition {
|
||||||
id,
|
id,
|
||||||
selector: hal::image::SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: hal::format::Aspects::empty(),
|
|
||||||
levels: level..level + 1,
|
levels: level..level + 1,
|
||||||
layers: layers.clone(),
|
layers: layers.clone(),
|
||||||
},
|
},
|
||||||
@ -276,7 +276,6 @@ mod test {
|
|||||||
//TODO: change() tests
|
//TODO: change() tests
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::id::Id;
|
use crate::id::Id;
|
||||||
use hal::{format::Aspects, image::SubresourceRange};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn query() {
|
fn query() {
|
||||||
@ -289,8 +288,7 @@ mod test {
|
|||||||
]));
|
]));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ts.query(SubresourceRange {
|
ts.query(TextureSelector {
|
||||||
aspects: Aspects::COLOR,
|
|
||||||
levels: 1..2,
|
levels: 1..2,
|
||||||
layers: 2..5,
|
layers: 2..5,
|
||||||
}),
|
}),
|
||||||
@ -298,8 +296,7 @@ mod test {
|
|||||||
Some(TextureUse::SAMPLED),
|
Some(TextureUse::SAMPLED),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ts.query(SubresourceRange {
|
ts.query(TextureSelector {
|
||||||
aspects: Aspects::COLOR,
|
|
||||||
levels: 0..2,
|
levels: 0..2,
|
||||||
layers: 2..5,
|
layers: 2..5,
|
||||||
}),
|
}),
|
||||||
@ -307,8 +304,7 @@ mod test {
|
|||||||
Some(TextureUse::SAMPLED),
|
Some(TextureUse::SAMPLED),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ts.query(SubresourceRange {
|
ts.query(TextureSelector {
|
||||||
aspects: Aspects::COLOR,
|
|
||||||
levels: 1..2,
|
levels: 1..2,
|
||||||
layers: 1..5,
|
layers: 1..5,
|
||||||
}),
|
}),
|
||||||
@ -316,8 +312,7 @@ mod test {
|
|||||||
Some(TextureUse::SAMPLED),
|
Some(TextureUse::SAMPLED),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ts.query(SubresourceRange {
|
ts.query(TextureSelector {
|
||||||
aspects: Aspects::COLOR,
|
|
||||||
levels: 1..2,
|
levels: 1..2,
|
||||||
layers: 4..6,
|
layers: 4..6,
|
||||||
}),
|
}),
|
||||||
@ -364,8 +359,7 @@ mod test {
|
|||||||
ts1.clone().merge(Id::dummy(), &ts2, None),
|
ts1.clone().merge(Id::dummy(), &ts2, None),
|
||||||
Err(PendingTransition {
|
Err(PendingTransition {
|
||||||
id,
|
id,
|
||||||
selector: SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: Aspects::empty(),
|
|
||||||
levels: 0..1,
|
levels: 0..1,
|
||||||
layers: 1..2,
|
layers: 1..2,
|
||||||
},
|
},
|
||||||
@ -391,8 +385,7 @@ mod test {
|
|||||||
&[
|
&[
|
||||||
PendingTransition {
|
PendingTransition {
|
||||||
id,
|
id,
|
||||||
selector: SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: Aspects::empty(),
|
|
||||||
levels: 0..1,
|
levels: 0..1,
|
||||||
layers: 1..2,
|
layers: 1..2,
|
||||||
},
|
},
|
||||||
@ -400,8 +393,7 @@ mod test {
|
|||||||
},
|
},
|
||||||
PendingTransition {
|
PendingTransition {
|
||||||
id,
|
id,
|
||||||
selector: SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: Aspects::empty(),
|
|
||||||
levels: 0..1,
|
levels: 0..1,
|
||||||
layers: 2..3,
|
layers: 2..3,
|
||||||
},
|
},
|
||||||
@ -453,8 +445,7 @@ mod test {
|
|||||||
&list,
|
&list,
|
||||||
&[PendingTransition {
|
&[PendingTransition {
|
||||||
id,
|
id,
|
||||||
selector: SubresourceRange {
|
selector: TextureSelector {
|
||||||
aspects: Aspects::empty(),
|
|
||||||
levels: 0..1,
|
levels: 0..1,
|
||||||
layers: 2..3,
|
layers: 2..3,
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@ license = "MPL-2.0"
|
|||||||
[features]
|
[features]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parking_lot = "0.10"
|
parking_lot = "0.11"
|
||||||
thread-id = "3"
|
thread-id = "3"
|
||||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||||
tracing-log = "0.1"
|
tracing-log = "0.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user