mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Finished porting all pipelines
This commit is contained in:
parent
2f72227c13
commit
54010cb441
520
Cargo.lock
generated
520
Cargo.lock
generated
@ -100,12 +100,6 @@ dependencies = [
|
|||||||
"xml-rs",
|
"xml-rs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android_glue"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi-parser"
|
name = "ansi-parser"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@ -217,11 +211,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ash"
|
name = "ash"
|
||||||
version = "0.31.0"
|
version = "0.32.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38"
|
checksum = "06063a002a77d2734631db74e8f4ce7148b77fe522e6bca46f2ae7774fd48112"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading 0.6.7",
|
"libloading 0.7.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -536,13 +530,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cgl"
|
name = "cfg_aliases"
|
||||||
version = "0.3.2"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
|
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
@ -671,22 +662,6 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cocoa"
|
|
||||||
version = "0.23.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c54201c07dcf3a5ca33fececb8042aed767ee4bfd5a0235a8ceabcda956044b2"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"block",
|
|
||||||
"cocoa-foundation",
|
|
||||||
"core-foundation 0.9.1",
|
|
||||||
"core-graphics 0.22.2",
|
|
||||||
"foreign-types",
|
|
||||||
"libc",
|
|
||||||
"objc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.24.0"
|
version = "0.24.0"
|
||||||
@ -718,6 +693,16 @@ dependencies = [
|
|||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "codespan-reporting"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
||||||
|
dependencies = [
|
||||||
|
"termcolor",
|
||||||
|
"unicode-width",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "color_quant"
|
name = "color_quant"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -1252,11 +1237,10 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "d3d12"
|
name = "d3d12"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/d3d12-rs?rev=be19a243b86e0bafb9937d661fc8eabb3e42b44e#be19a243b86e0bafb9937d661fc8eabb3e42b44e"
|
||||||
checksum = "d0a60cceb22c7c53035f8980524fdc7f17cf49681a3c154e6757d30afbec6ec4"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libloading 0.6.7",
|
"libloading 0.7.0",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1266,7 +1250,7 @@ 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 = "9293a0da7d1bc1f30090ece4d9f9de79a07be7302ddb00e5eb1fefb6ee6409e2"
|
checksum = "9293a0da7d1bc1f30090ece4d9f9de79a07be7302ddb00e5eb1fefb6ee6409e2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"petgraph",
|
"petgraph 0.4.13",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1466,15 +1450,6 @@ version = "1.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "draw_state"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "33cf9537e2d06891448799b96d5a8c8083e0e90522a7fdabe6ebf4f41d79d651"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.6.1"
|
version = "1.6.1"
|
||||||
@ -1627,6 +1602,12 @@ version = "0.1.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
|
checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fixedbitset"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.20"
|
version = "1.0.20"
|
||||||
@ -1911,22 +1892,10 @@ dependencies = [
|
|||||||
"wasi 0.10.2+wasi-snapshot-preview1",
|
"wasi 0.10.2+wasi-snapshot-preview1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gfx"
|
|
||||||
version = "0.18.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "01de46f9508a5c259aef105f0bff760ceddca832ea9c87ce03d1923e22ee155b"
|
|
||||||
dependencies = [
|
|
||||||
"draw_state",
|
|
||||||
"gfx_core",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-auxil"
|
name = "gfx-auxil"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "07cd956b592970f08545b9325b87580eb95a51843b6f39da27b8667fec1a1216"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
@ -1935,15 +1904,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx11"
|
name = "gfx-backend-dx11"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "54b43f06089866bdffe59b5a6801022c86b74d2c1dd28940a9cf301d3d014fbc"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"gfx-auxil",
|
"gfx-auxil",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"libloading 0.6.7",
|
"libloading 0.7.0",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot 0.11.1",
|
"parking_lot 0.11.1",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
@ -1957,9 +1925,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx12"
|
name = "gfx-backend-dx12"
|
||||||
version = "0.6.13"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "375014deed24d76b03604736dd899f0925158a1a96db90cbefb9cce070f71af7"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bit-set",
|
"bit-set",
|
||||||
@ -1968,29 +1935,50 @@ dependencies = [
|
|||||||
"gfx-auxil",
|
"gfx-auxil",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"log",
|
"log",
|
||||||
|
"parking_lot 0.11.1",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"spirv_cross",
|
"spirv_cross",
|
||||||
|
"thunderdome",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-empty"
|
name = "gfx-backend-empty"
|
||||||
version = "0.6.0"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "2085227c12b78f6657a900c829f2d0deb46a9be3eaf86844fde263cdc218f77c"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"log",
|
"log",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gfx-backend-gl"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
"bitflags",
|
||||||
|
"fxhash",
|
||||||
|
"gfx-hal",
|
||||||
|
"glow",
|
||||||
|
"js-sys",
|
||||||
|
"khronos-egl",
|
||||||
|
"libloading 0.7.0",
|
||||||
|
"log",
|
||||||
|
"naga",
|
||||||
|
"parking_lot 0.11.1",
|
||||||
|
"raw-window-handle",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-metal"
|
name = "gfx-backend-metal"
|
||||||
version = "0.6.5"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "273d60d5207f96d99e0d11d0718995f67e56533a9df1444d83baf787f4c3cb32"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -1998,25 +1986,23 @@ dependencies = [
|
|||||||
"cocoa-foundation",
|
"cocoa-foundation",
|
||||||
"copyless",
|
"copyless",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"gfx-auxil",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"lazy_static",
|
|
||||||
"log",
|
"log",
|
||||||
"metal",
|
"metal",
|
||||||
|
"naga",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot 0.11.1",
|
"parking_lot 0.11.1",
|
||||||
|
"profiling",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smallvec",
|
|
||||||
"spirv_cross",
|
|
||||||
"storage-map",
|
"storage-map",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-vulkan"
|
name = "gfx-backend-vulkan"
|
||||||
version = "0.6.5"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "3a3a63cf61067a09b7d1ac480af3cb2ae0c5ede5bed294607bbd814cb1666c45"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"ash",
|
"ash",
|
||||||
@ -2024,79 +2010,24 @@ dependencies = [
|
|||||||
"core-graphics-types",
|
"core-graphics-types",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"inplace_it",
|
"inplace_it",
|
||||||
"lazy_static",
|
|
||||||
"log",
|
"log",
|
||||||
|
"naga",
|
||||||
"objc",
|
"objc",
|
||||||
|
"parking_lot 0.11.1",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
"x11",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gfx-descriptor"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cd8c7afcd000f279d541a490e27117e61037537279b9342279abf4938fe60c6b"
|
|
||||||
dependencies = [
|
|
||||||
"arrayvec",
|
|
||||||
"fxhash",
|
|
||||||
"gfx-hal",
|
|
||||||
"log",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-hal"
|
name = "gfx-hal"
|
||||||
version = "0.6.0"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "18d0754f5b7a43915fd7466883b2d1bb0800d7cc4609178d0b27bf143b9e5123"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"naga",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
]
|
"thiserror",
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gfx-memory"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dccdda5d2b39412f4ca2cb15c70b5a82783a86b0606f5e985342754c8ed88f05"
|
|
||||||
dependencies = [
|
|
||||||
"bit-set",
|
|
||||||
"fxhash",
|
|
||||||
"gfx-hal",
|
|
||||||
"log",
|
|
||||||
"slab",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gfx_core"
|
|
||||||
version = "0.9.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "75fbddaef2e12b4995900539d7209d947b988a3d87ee8737484d049b526e5441"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"draw_state",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gfx_device_gl"
|
|
||||||
version = "0.16.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "109c385fa380c18888633aa27d1e16cbae518469702a2f69dcb5f52d5378bebc"
|
|
||||||
dependencies = [
|
|
||||||
"gfx_core",
|
|
||||||
"gfx_gl",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gfx_gl"
|
|
||||||
version = "0.6.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f2d38164670920cfb7491bc0cf6f49f0554bd1c44cdbedc6c78d2bf91691ff5e"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2165,17 +2096,6 @@ dependencies = [
|
|||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gl_generator"
|
|
||||||
version = "0.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"
|
|
||||||
dependencies = [
|
|
||||||
"khronos_api",
|
|
||||||
"log",
|
|
||||||
"xml-rs",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glam"
|
name = "glam"
|
||||||
version = "0.10.2"
|
version = "0.10.2"
|
||||||
@ -2192,85 +2112,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glsl-include"
|
name = "glow"
|
||||||
version = "0.3.1"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "daa2afb1631e7ab4543e0dde0e3fc68bb49c58fee89c07f30a26553b1f684ab6"
|
checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"js-sys",
|
||||||
"regex",
|
"slotmap 0.4.0",
|
||||||
]
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
[[package]]
|
|
||||||
name = "glutin"
|
|
||||||
version = "0.26.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1ae1cbb9176b9151c4ce03f012e3cd1c6c18c4be79edeaeb3d99f5d8085c5fa3"
|
|
||||||
dependencies = [
|
|
||||||
"android_glue",
|
|
||||||
"cgl",
|
|
||||||
"cocoa 0.23.0",
|
|
||||||
"core-foundation 0.9.1",
|
|
||||||
"glutin_egl_sys",
|
|
||||||
"glutin_emscripten_sys",
|
|
||||||
"glutin_gles2_sys",
|
|
||||||
"glutin_glx_sys",
|
|
||||||
"glutin_wgl_sys",
|
|
||||||
"lazy_static",
|
|
||||||
"libloading 0.6.7",
|
|
||||||
"log",
|
|
||||||
"objc",
|
|
||||||
"osmesa-sys",
|
|
||||||
"parking_lot 0.11.1",
|
|
||||||
"wayland-client 0.28.5",
|
|
||||||
"wayland-egl",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
"winit",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_egl_sys"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2abb6aa55523480c4adc5a56bbaa249992e2dddb2fc63dc96e04a3355364c211"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_emscripten_sys"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_gles2_sys"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e8094e708b730a7c8a1954f4f8a31880af00eb8a1c5b5bf85d28a0a3c6d69103"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
"objc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_glx_sys"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7e393c8fc02b807459410429150e9c4faffdb312d59b8c038566173c81991351"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
"x11-dl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_wgl_sys"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3da5951a1569dbab865c6f2a863efafff193a93caf05538d193e9e3816d21696"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2312,6 +2162,43 @@ dependencies = [
|
|||||||
"xi-unicode",
|
"xi-unicode",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gpu-alloc"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "git+https://github.com/zakarumych/gpu-alloc.git?rev=2cd1ad650cdd24d1647b6041f77ced0cbf1ff2a6#2cd1ad650cdd24d1647b6041f77ced0cbf1ff2a6"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"gpu-alloc-types",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gpu-alloc-types"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "git+https://github.com/zakarumych/gpu-alloc.git?rev=2cd1ad650cdd24d1647b6041f77ced0cbf1ff2a6#2cd1ad650cdd24d1647b6041f77ced0cbf1ff2a6"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gpu-descriptor"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8a70f1e87a3840ed6a3e99e02c2b861e4dbdf26f0d07e38f42ea5aff46cfce2"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"gpu-descriptor-types",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gpu-descriptor-types"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "guillotiere"
|
name = "guillotiere"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@ -2764,10 +2651,14 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "khronos_api"
|
name = "khronos-egl"
|
||||||
version = "3.1.0"
|
version = "4.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"libloading 0.7.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy-bytes-cast"
|
name = "lazy-bytes-cast"
|
||||||
@ -3061,9 +2952,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "metal"
|
name = "metal"
|
||||||
version = "0.20.0"
|
version = "0.21.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/metal-rs?rev=78f632d194c7c16d18b71d7373c4080847d110b0#78f632d194c7c16d18b71d7373c4080847d110b0"
|
||||||
checksum = "5c4e8a431536529327e28c9ba6992f2cb0c15d4222f0602a16e6d7695ff3bccf"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
@ -3190,14 +3080,16 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.2.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/naga?tag=gfx-22#9cd6fd9c205a57824644d0baedc6c15997be1e36"
|
||||||
checksum = "0873deb76cf44b7454fba7b2ba6a89d3de70c08aceffd2c489379b3d9d08e661"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bit-set",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"codespan-reporting",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"petgraph 0.5.1",
|
||||||
"spirv_headers",
|
"spirv_headers",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@ -3208,7 +3100,7 @@ version = "0.5.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d689b01017db3e350e0e9798d233cca9ad3bf810e7c02b9b55ec06b9ee7dbd8a"
|
checksum = "d689b01017db3e350e0e9798d233cca9ad3bf810e7c02b9b55ec06b9ee7dbd8a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cocoa 0.24.0",
|
"cocoa",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
"objc",
|
"objc",
|
||||||
"objc-foundation",
|
"objc-foundation",
|
||||||
@ -3722,17 +3614,6 @@ dependencies = [
|
|||||||
"byteorder",
|
"byteorder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "old_school_gfx_glutin_ext"
|
|
||||||
version = "0.26.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "450a2a0e6805771787b965af9a552581c9dfc588dc33761c1be690117cd792e1"
|
|
||||||
dependencies = [
|
|
||||||
"gfx_core",
|
|
||||||
"gfx_device_gl",
|
|
||||||
"glutin",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.7.2"
|
version = "1.7.2"
|
||||||
@ -3797,15 +3678,6 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "osmesa-sys"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"
|
|
||||||
dependencies = [
|
|
||||||
"shared_library",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "owned_ttf_parser"
|
name = "owned_ttf_parser"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@ -3901,7 +3773,17 @@ version = "0.4.13"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
|
checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fixedbitset",
|
"fixedbitset 0.1.9",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "petgraph"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
|
||||||
|
dependencies = [
|
||||||
|
"fixedbitset 0.2.0",
|
||||||
|
"indexmap",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4086,6 +3968,12 @@ dependencies = [
|
|||||||
"unicode-xid 0.2.1",
|
"unicode-xid 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "profiling"
|
||||||
|
version = "0.1.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b0c71198452babfbba7419e716d29853c462d59da73c41485ab7dc8b4dc0c4be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prometheus"
|
name = "prometheus"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
@ -4249,8 +4137,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "range-alloc"
|
name = "range-alloc"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe"
|
||||||
checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-window-handle"
|
name = "raw-window-handle"
|
||||||
@ -4784,6 +4671,26 @@ 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 = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
|
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shaderc"
|
||||||
|
version = "0.6.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "50b8aeaae10b9bda5cba66736a7e265f67698e912e1cc6a4678acba286e22be9"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"shaderc-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shaderc-sys"
|
||||||
|
version = "0.6.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b12d7c62d6732884c9dfab587503fa3a795b108df152415a89da23812d4737e"
|
||||||
|
dependencies = [
|
||||||
|
"cmake",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sharded-slab"
|
name = "sharded-slab"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@ -4793,16 +4700,6 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shared_library"
|
|
||||||
version = "0.1.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11"
|
|
||||||
dependencies = [
|
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shellexpand"
|
name = "shellexpand"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
@ -4892,6 +4789,12 @@ version = "0.4.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slotmap"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c46a3482db8f247956e464d783693ece164ca056e6e67563ee5505bdb86452cd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slotmap"
|
name = "slotmap"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
@ -5000,9 +4903,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spirv_cross"
|
name = "spirv_cross"
|
||||||
version = "0.22.2"
|
version = "0.23.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ebd49af36be83ecd6290b57147e2a0e26145b832634b17146d934b197ca3713"
|
checksum = "60647fadbf83c4a72f0d7ea67a7ca3a81835cf442b8deae5c134c3e0055b2e14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@ -5592,12 +5495,6 @@ dependencies = [
|
|||||||
"nom 5.1.2",
|
"nom 5.1.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "typed-arena"
|
|
||||||
version = "2.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.13.0"
|
version = "1.13.0"
|
||||||
@ -5776,7 +5673,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
"slab",
|
"slab",
|
||||||
"slotmap",
|
"slotmap 1.0.3",
|
||||||
"specs",
|
"specs",
|
||||||
"specs-idvs",
|
"specs-idvs",
|
||||||
"spin_sleep",
|
"spin_sleep",
|
||||||
@ -6032,13 +5929,8 @@ dependencies = [
|
|||||||
"enum-iterator",
|
"enum-iterator",
|
||||||
"euc",
|
"euc",
|
||||||
"futures",
|
"futures",
|
||||||
"gfx",
|
|
||||||
"gfx_device_gl",
|
|
||||||
"gfx_gl",
|
|
||||||
"gilrs",
|
"gilrs",
|
||||||
"git2",
|
"git2",
|
||||||
"glsl-include",
|
|
||||||
"glutin",
|
|
||||||
"glyph_brush",
|
"glyph_brush",
|
||||||
"guillotiere",
|
"guillotiere",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@ -6052,12 +5944,12 @@ dependencies = [
|
|||||||
"native-dialog",
|
"native-dialog",
|
||||||
"num 0.4.0",
|
"num 0.4.0",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"old_school_gfx_glutin_ext",
|
|
||||||
"ordered-float 2.1.1",
|
"ordered-float 2.1.1",
|
||||||
"rand 0.8.3",
|
"rand 0.8.3",
|
||||||
"rodio",
|
"rodio",
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
|
"shaderc",
|
||||||
"specs",
|
"specs",
|
||||||
"specs-idvs",
|
"specs-idvs",
|
||||||
"strum",
|
"strum",
|
||||||
@ -6551,16 +6443,6 @@ dependencies = [
|
|||||||
"xcursor",
|
"xcursor",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wayland-egl"
|
|
||||||
version = "0.28.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9461a67930ec16da7a4fd8b50e9ffa23f4417240b43ec84008bd1b2c94421c94"
|
|
||||||
dependencies = [
|
|
||||||
"wayland-client 0.28.5",
|
|
||||||
"wayland-sys 0.28.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wayland-protocols"
|
name = "wayland-protocols"
|
||||||
version = "0.27.0"
|
version = "0.27.0"
|
||||||
@ -6629,9 +6511,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.48"
|
version = "0.3.50"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b"
|
checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@ -6659,20 +6541,17 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu"
|
name = "wgpu"
|
||||||
version = "0.6.2"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/wgpu-rs.git#1806a5bd4d0a8740774969c92f51ad9a906a2e24"
|
||||||
checksum = "991903e4c9f5b7319732b30a3d0339e27a51ea992cea22769b5f6c7f7076af6d"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"futures",
|
|
||||||
"gfx-backend-vulkan",
|
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"objc",
|
"log",
|
||||||
|
"naga",
|
||||||
"parking_lot 0.11.1",
|
"parking_lot 0.11.1",
|
||||||
|
"profiling",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tracing",
|
|
||||||
"typed-arena",
|
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@ -6682,36 +6561,37 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-core"
|
name = "wgpu-core"
|
||||||
version = "0.6.5"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/wgpu?rev=523ef2dfec0bf18c696bc53fea252fd6fa7350c6#523ef2dfec0bf18c696bc53fea252fd6fa7350c6"
|
||||||
checksum = "ea487deeae90e06d77eb8e6cef945247774e7c0a0a226d238b31e90633594365"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"cfg_aliases",
|
||||||
"copyless",
|
"copyless",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-backend-dx11",
|
"gfx-backend-dx11",
|
||||||
"gfx-backend-dx12",
|
"gfx-backend-dx12",
|
||||||
"gfx-backend-empty",
|
"gfx-backend-empty",
|
||||||
|
"gfx-backend-gl",
|
||||||
"gfx-backend-metal",
|
"gfx-backend-metal",
|
||||||
"gfx-backend-vulkan",
|
"gfx-backend-vulkan",
|
||||||
"gfx-descriptor",
|
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"gfx-memory",
|
"gpu-alloc",
|
||||||
|
"gpu-descriptor",
|
||||||
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot 0.11.1",
|
"parking_lot 0.11.1",
|
||||||
|
"profiling",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tracing",
|
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-types"
|
name = "wgpu-types"
|
||||||
version = "0.6.1"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/wgpu?rev=523ef2dfec0bf18c696bc53fea252fd6fa7350c6#523ef2dfec0bf18c696bc53fea252fd6fa7350c6"
|
||||||
checksum = "1e3529528e608b54838ee618c3923b0f46e6db0334cfc6c42a16cf4ceb3bdb57"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
@ -6810,7 +6690,7 @@ version = "0.24.0"
|
|||||||
source = "git+https://gitlab.com/veloren/winit.git?branch=macos-test-spiffed#488c511802dfd95ca54f6f76a38547c93c7b02c9"
|
source = "git+https://gitlab.com/veloren/winit.git?branch=macos-test-spiffed#488c511802dfd95ca54f6f76a38547c93c7b02c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cocoa 0.24.0",
|
"cocoa",
|
||||||
"core-foundation 0.9.1",
|
"core-foundation 0.9.1",
|
||||||
"core-graphics 0.22.2",
|
"core-graphics 0.22.2",
|
||||||
"core-video-sys",
|
"core-video-sys",
|
||||||
@ -6872,16 +6752,6 @@ dependencies = [
|
|||||||
"tap",
|
"tap",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "x11"
|
|
||||||
version = "2.18.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"pkg-config",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11-clipboard"
|
name = "x11-clipboard"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -8,7 +8,7 @@ pub enum RenderError {
|
|||||||
CustomError(String),
|
CustomError(String),
|
||||||
CouldNotFindAdapter,
|
CouldNotFindAdapter,
|
||||||
ErrorInitializingCompiler,
|
ErrorInitializingCompiler,
|
||||||
ShaderError(shaderc::Error)
|
ShaderError(shaderc::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<wgpu::RequestDeviceError> for RenderError {
|
impl From<wgpu::RequestDeviceError> for RenderError {
|
||||||
|
@ -18,20 +18,23 @@ pub use self::{
|
|||||||
model::{Model, SubModel},
|
model::{Model, SubModel},
|
||||||
pipelines::{
|
pipelines::{
|
||||||
clouds::{create_mesh as create_clouds_mesh, Locals as CloudsLocals},
|
clouds::{create_mesh as create_clouds_mesh, Locals as CloudsLocals},
|
||||||
figure::{BoneData as FigureBoneData, BoneMeshes, FigureModel, Locals as FigureLocals},
|
figure::{
|
||||||
|
BoneData as FigureBoneData, BoneMeshes, FigureLayout, FigureModel,
|
||||||
|
Locals as FigureLocals,
|
||||||
|
},
|
||||||
lod_terrain::LodData,
|
lod_terrain::LodData,
|
||||||
particle::Instance as ParticleInstance,
|
particle::Instance as ParticleInstance,
|
||||||
postprocess::create_mesh as create_pp_mesh,
|
postprocess::create_mesh as create_pp_mesh,
|
||||||
shadow::Locals as ShadowLocals,
|
shadow::Locals as ShadowLocals,
|
||||||
skybox::create_mesh as create_skybox_mesh,
|
skybox::create_mesh as create_skybox_mesh,
|
||||||
sprite::{Instance as SpriteInstance, Locals as SpriteLocals},
|
sprite::{Instance as SpriteInstance, Locals as SpriteLocals},
|
||||||
terrain::Locals as TerrainLocals,
|
terrain::{Locals as TerrainLocals, TerrainLayout, Vertex as TerrainVertex},
|
||||||
ui::{
|
ui::{
|
||||||
create_quad as create_ui_quad,
|
create_quad as create_ui_quad,
|
||||||
create_quad_vert_gradient as create_ui_quad_vert_gradient, create_tri as create_ui_tri,
|
create_quad_vert_gradient as create_ui_quad_vert_gradient, create_tri as create_ui_tri,
|
||||||
Locals as UiLocals, Mode as UiMode,
|
Locals as UiLocals, Mode as UiMode,
|
||||||
},
|
},
|
||||||
GlobalModel, Globals, Light, Shadow,
|
GlobalModel, Globals, GlobalsLayouts, Light, Shadow,
|
||||||
},
|
},
|
||||||
renderer::{ColLightInfo, Renderer},
|
renderer::{ColLightInfo, Renderer},
|
||||||
texture::Texture,
|
texture::Texture,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::{
|
use super::{
|
||||||
super::{Mesh, Model},
|
super::{AaMode, GlobalsLayouts, Mesh, Model},
|
||||||
terrain::Vertex,
|
terrain::Vertex,
|
||||||
};
|
};
|
||||||
use crate::mesh::greedy::GreedyMesh;
|
use crate::mesh::greedy::GreedyMesh;
|
||||||
@ -107,20 +107,6 @@ impl Default for BoneData {
|
|||||||
fn default() -> Self { Self::new(anim::vek::Mat4::identity(), anim::vek::Mat4::identity()) }
|
fn default() -> Self { Self::new(anim::vek::Mat4::identity(), anim::vek::Mat4::identity()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct FigureLayout {
|
|
||||||
pub locals: wgpu::BindGroupLayout,
|
|
||||||
pub bone_data: wgpu::BindGroupLayout,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FigureLayout {
|
|
||||||
pub fn new(device: &wgpu::Device) -> Self {
|
|
||||||
Self {
|
|
||||||
locals: Locals::locals_layout(device),
|
|
||||||
bone_data: BoneData::bone_data_layout(device),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct FigureModel {
|
pub struct FigureModel {
|
||||||
pub opaque: Model<Vertex>,
|
pub opaque: Model<Vertex>,
|
||||||
/* TODO: Consider using mipmaps instead of storing multiple texture atlases for different
|
/* TODO: Consider using mipmaps instead of storing multiple texture atlases for different
|
||||||
@ -141,48 +127,138 @@ impl FigureModel {
|
|||||||
|
|
||||||
pub type BoneMeshes = (Mesh<Vertex>, anim::vek::Aabb<f32>);
|
pub type BoneMeshes = (Mesh<Vertex>, anim::vek::Aabb<f32>);
|
||||||
|
|
||||||
//gfx_defines! {
|
pub struct FigureLayout {
|
||||||
// constant Locals {
|
pub locals: wgpu::BindGroupLayout,
|
||||||
// model_mat: [[f32; 4]; 4] = "model_mat",
|
pub bone_data: wgpu::BindGroupLayout,
|
||||||
// highlight_col: [f32; 4] = "highlight_col",
|
pub col_lights: wgpu::BindGroupLayout,
|
||||||
// model_light: [f32; 4] = "model_light",
|
}
|
||||||
// atlas_offs: [i32; 4] = "atlas_offs",
|
|
||||||
// model_pos: [f32; 3] = "model_pos",
|
impl FigureLayout {
|
||||||
// flags: u32 = "flags",
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
// }
|
Self {
|
||||||
//
|
locals: Locals::layout(device),
|
||||||
// constant BoneData {
|
bone_data: BoneData::layout(device),
|
||||||
// bone_mat: [[f32; 4]; 4] = "bone_mat",
|
col_lights: device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
// normals_mat: [[f32; 4]; 4] = "normals_mat",
|
label: None,
|
||||||
// }
|
entries: &[
|
||||||
//
|
wgpu::BindGroupLayoutEntry {
|
||||||
// pipeline pipe {
|
binding: 0,
|
||||||
// vbuf: gfx::VertexBuffer<<TerrainPipeline as Pipeline>::Vertex> = (),
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
// // abuf: gfx::VertexBuffer<<TerrainPipeline as Pipeline>::Vertex> =
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
// (), col_lights: gfx::TextureSampler<[f32; 4]> = "t_col_light",
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
//
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
// locals: gfx::ConstantBuffer<Locals> = "u_locals",
|
multisampled: false,
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
},
|
||||||
// bones: gfx::ConstantBuffer<BoneData> = "u_bones",
|
count: None,
|
||||||
// lights: gfx::ConstantBuffer<Light> = "u_lights",
|
},
|
||||||
// shadows: gfx::ConstantBuffer<Shadow> = "u_shadows",
|
wgpu::BindGroupLayoutEntry {
|
||||||
//
|
binding: 1,
|
||||||
// point_shadow_maps: gfx::TextureSampler<f32> = "t_point_shadow_maps",
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
// directed_shadow_maps: gfx::TextureSampler<f32> =
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
// "t_directed_shadow_maps",
|
count: None,
|
||||||
//
|
},
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
],
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
}),
|
||||||
//
|
}
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
}
|
||||||
//
|
}
|
||||||
// // Shadow stuff
|
|
||||||
// light_shadows: gfx::ConstantBuffer<shadow::Locals> =
|
pub struct FigurePipeline {
|
||||||
// "u_light_shadows",
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
//
|
}
|
||||||
// tgt_color: gfx::BlendTarget<TgtColorFmt> = ("tgt_color",
|
|
||||||
// ColorMask::all(), gfx::preset::blend::ALPHA), tgt_depth_stencil:
|
impl FigurePipeline {
|
||||||
// gfx::DepthTarget<TgtDepthStencilFmt> = gfx::preset::depth::LESS_EQUAL_WRITE,
|
pub fn new(
|
||||||
// // tgt_depth_stencil: gfx::DepthStencilTarget<TgtDepthStencilFmt> =
|
device: &wgpu::Device,
|
||||||
// (gfx::preset::depth::LESS_EQUAL_WRITE,Stencil::new(Comparison::Always,0xff,
|
vs_module: &wgpu::ShaderModule,
|
||||||
// (StencilOp::Keep,StencilOp::Keep,StencilOp::Replace))), }
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &FigureLayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Figure pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.alt_horizon,
|
||||||
|
&global_layout.light,
|
||||||
|
&global_layout.shadow,
|
||||||
|
&global_layout.shadow_maps,
|
||||||
|
&global_layout.light_shadows,
|
||||||
|
&layout.locals,
|
||||||
|
&layout.bone_data,
|
||||||
|
&layout.col_lights,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Figure pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::SrcAlpha,
|
||||||
|
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
alpha_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::One,
|
||||||
|
dst_factor: wgpu::BlendFactor::One,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,41 +1,7 @@
|
|||||||
|
use super::super::{AaMode, GlobalsLayouts};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos_norm: u32 = "v_pos_norm",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
|
|
||||||
// locals: gfx::ConstantBuffer<TerrainLocals> = "u_locals",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
// lights: gfx::ConstantBuffer<Light> = "u_lights",
|
|
||||||
// shadows: gfx::ConstantBuffer<Shadow> = "u_shadows",
|
|
||||||
|
|
||||||
// point_shadow_maps: gfx::TextureSampler<f32> = "t_point_shadow_maps",
|
|
||||||
// directed_shadow_maps: gfx::TextureSampler<f32> =
|
|
||||||
// "t_directed_shadow_maps",
|
|
||||||
|
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
|
||||||
|
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
|
||||||
// waves: gfx::TextureSampler<[f32; 4]> = "t_waves",
|
|
||||||
|
|
||||||
// // Shadow stuff
|
|
||||||
// light_shadows: gfx::ConstantBuffer<shadow::Locals> =
|
|
||||||
// "u_light_shadows",
|
|
||||||
|
|
||||||
// tgt_color: gfx::BlendTarget<TgtColorFmt> = ("tgt_color",
|
|
||||||
// ColorMask::all(), gfx::preset::blend::ALPHA), tgt_depth_stencil:
|
|
||||||
// gfx::DepthTarget<TgtDepthStencilFmt> = gfx::preset::depth::LESS_EQUAL_TEST,
|
|
||||||
// // tgt_depth_stencil: gfx::DepthStencilTarget<TgtDepthStencilFmt> =
|
|
||||||
// (gfx::preset::depth::LESS_EQUAL_TEST,Stencil::new(Comparison::Always,0xff,
|
|
||||||
// (StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))), }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
@ -64,4 +30,147 @@ impl Vertex {
|
|||||||
| (norm_bits & 0x7) << 29,
|
| (norm_bits & 0x7) << 29,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &[wgpu::VertexAttributeDescriptor {
|
||||||
|
offset: 0,
|
||||||
|
shader_location: 0,
|
||||||
|
format: wgpu::VertexFormat::Uint,
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct FluidLayout {
|
||||||
|
pub waves: wgpu::BindGroupLayout,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FluidLayout {
|
||||||
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
|
Self {
|
||||||
|
waves: device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct FluidPipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FluidPipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &FluidLayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Fluid pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.alt_horizon,
|
||||||
|
&global_layout.light,
|
||||||
|
&global_layout.shadow,
|
||||||
|
&global_layout.shadow_maps,
|
||||||
|
&global_layout.light_shadows,
|
||||||
|
&layout.waves,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Fluid pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::None,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::SrcAlpha,
|
||||||
|
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
alpha_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::One,
|
||||||
|
dst_factor: wgpu::BlendFactor::One,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: false,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,7 @@
|
|||||||
use super::super::{Renderer, Texture};
|
use super::super::{AaMode, GlobalsLayouts, Renderer, Texture};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos: [f32; 2] = "v_pos",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// constant Locals {
|
|
||||||
// nul: [f32; 4] = "nul",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
|
|
||||||
// locals: gfx::ConstantBuffer<Locals> = "u_locals",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
// map: gfx::TextureSampler<[f32; 4]> = "t_map",
|
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
|
||||||
|
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
|
||||||
|
|
||||||
// tgt_color: gfx::RenderTarget<TgtColorFmt> = "tgt_color",
|
|
||||||
// tgt_depth_stencil: gfx::DepthTarget<TgtDepthStencilFmt> =
|
|
||||||
// gfx::preset::depth::LESS_EQUAL_WRITE, // tgt_depth_stencil:
|
|
||||||
// gfx::DepthStencilTarget<TgtDepthStencilFmt> =
|
|
||||||
// (gfx::preset::depth::LESS_EQUAL_WRITE,Stencil::new(Comparison::Always,0xff,
|
|
||||||
// (StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))), }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
@ -42,6 +14,19 @@ impl Vertex {
|
|||||||
pos: pos.into_array(),
|
pos: pos.into_array(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &[wgpu::VertexAttributeDescriptor {
|
||||||
|
offset: 0,
|
||||||
|
shader_location: 0,
|
||||||
|
format: wgpu::VertexFormat::Float2,
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LodData {
|
pub struct LodData {
|
||||||
@ -156,3 +141,88 @@ impl LodData {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct LodTerrainPipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LodTerrainPipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Lod terrain pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.alt_horizon,
|
||||||
|
&global_layout.lod_map,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Lod terrain pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -225,34 +225,201 @@ pub struct GlobalModel {
|
|||||||
pub shadow_mats: Consts<shadow::Locals>,
|
pub shadow_mats: Consts<shadow::Locals>,
|
||||||
}
|
}
|
||||||
|
|
||||||
//gfx_defines! {
|
pub struct GlobalsLayouts {
|
||||||
// constant Globals {
|
pub globals: wgpu::BindGroupLayout,
|
||||||
// view_mat: [[f32; 4]; 4] = "view_mat",
|
pub light: wgpu::BindGroupLayout,
|
||||||
// proj_mat: [[f32; 4]; 4] = "proj_mat",
|
pub shadow: wgpu::BindGroupLayout,
|
||||||
// all_mat: [[f32; 4]; 4] = "all_mat",
|
pub alt_horizon: wgpu::BindGroupLayout,
|
||||||
// cam_pos: [f32; 4] = "cam_pos",
|
pub shadow_maps: wgpu::BindGroupLayout,
|
||||||
// focus_off: [f32; 4] = "focus_off",
|
pub light_shadows: wgpu::BindGroupLayout,
|
||||||
// focus_pos: [f32; 4] = "focus_pos",
|
pub lod_map: wgpu::BindGroupLayout,
|
||||||
// /// NOTE: view_distance.x is the horizontal view distance,
|
}
|
||||||
// view_distance.y is the LOD /// detail, view_distance.z is the
|
|
||||||
// /// minimum height over any land chunk (i.e. the sea level), and
|
impl GlobalsLayouts {
|
||||||
// view_distance.w is the /// maximum height over this minimum height.
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
// ///
|
let globals = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
// /// TODO: Fix whatever alignment issue requires these uniforms to be
|
label: Some("Globals layout"),
|
||||||
// aligned. view_distance: [f32; 4] = "view_distance",
|
entries: &[
|
||||||
// time_of_day: [f32; 4] = "time_of_day", // TODO: Make this f64.
|
wgpu::BindGroupLayoutEntry {
|
||||||
// sun_dir: [f32; 4] = "sun_dir",
|
binding: 0,
|
||||||
// moon_dir: [f32; 4] = "moon_dir",
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
// tick: [f32; 4] = "tick",
|
ty: wgpu::BindingType::UniformBuffer {
|
||||||
// /// x, y represent the resolution of the screen;
|
dynamic: false,
|
||||||
// /// w, z represent the near and far planes of the shadow map.
|
min_binding_size: None,
|
||||||
// screen_res: [f32; 4] = "screen_res",
|
},
|
||||||
// light_shadow_count: [u32; 4] = "light_shadow_count",
|
count: None,
|
||||||
// shadow_proj_factors: [f32; 4] = "shadow_proj_factors",
|
},
|
||||||
// medium: [u32; 4] = "medium",
|
wgpu::BindGroupLayoutEntry {
|
||||||
// select_pos: [i32; 4] = "select_pos",
|
binding: 1,
|
||||||
// gamma_exposure: [f32; 4] = "gamma_exposure",
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
// ambiance: f32 = "ambiance",
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
// cam_mode: u32 = "cam_mode",
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
// sprite_render_distance: f32 = "sprite_render_distance",
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
// }
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 2,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
let light = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: Some("Light layout"),
|
||||||
|
entries: &[wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::UniformBuffer {
|
||||||
|
dynamic: false,
|
||||||
|
min_binding_size: None,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
let shadow = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: Some("Shadow layout"),
|
||||||
|
entries: &[wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::UniformBuffer {
|
||||||
|
dynamic: false,
|
||||||
|
min_binding_size: None,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
|
||||||
|
let alt_horizon = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: Some("alt/horizon layout"),
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 2,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 3,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let shadow_maps = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: Some("Shadow maps layout"),
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let light_shadows = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: Some("Light shadows layout"),
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 2,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 3,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let lod_map = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: Some("Lod layout"),
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
globals,
|
||||||
|
light,
|
||||||
|
shadow,
|
||||||
|
alt_horizon,
|
||||||
|
shadow_maps,
|
||||||
|
light_shadows,
|
||||||
|
lod_map,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,77 +1,7 @@
|
|||||||
|
use super::super::{AaMode, GlobalsLayouts};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos: [f32; 3] = "v_pos",
|
|
||||||
// // ____BBBBBBBBGGGGGGGGRRRRRRRR
|
|
||||||
// // col: u32 = "v_col",
|
|
||||||
// // ...AANNN
|
|
||||||
// // A = AO
|
|
||||||
// // N = Normal
|
|
||||||
// norm_ao: u32 = "v_norm_ao",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// vertex Instance {
|
|
||||||
// // created_at time, so we can calculate time relativity, needed for
|
|
||||||
// relative animation. // can save 32 bits per instance, for particles
|
|
||||||
// that are not relatively animated. inst_time: f32 = "inst_time",
|
|
||||||
//
|
|
||||||
// // The lifespan in seconds of the particle
|
|
||||||
// inst_lifespan: f32 = "inst_lifespan",
|
|
||||||
//
|
|
||||||
// // a seed value for randomness
|
|
||||||
// // can save 32 bits per instance, for particles that don't need
|
|
||||||
// randomness/uniqueness. inst_entropy: f32 = "inst_entropy",
|
|
||||||
//
|
|
||||||
// // modes should probably be seperate shaders, as a part of scaling
|
|
||||||
// and optimisation efforts. // can save 32 bits per instance, and have
|
|
||||||
// cleaner tailor made code. inst_mode: i32 = "inst_mode",
|
|
||||||
//
|
|
||||||
// // A direction for particles to move in
|
|
||||||
// inst_dir: [f32; 3] = "inst_dir",
|
|
||||||
//
|
|
||||||
// // a triangle is: f32 x 3 x 3 x 1 = 288 bits
|
|
||||||
// // a quad is: f32 x 3 x 3 x 2 = 576 bits
|
|
||||||
// // a cube is: f32 x 3 x 3 x 12 = 3456 bits
|
|
||||||
// // this vec is: f32 x 3 x 1 x 1 = 96 bits (per instance!)
|
|
||||||
// // consider using a throw-away mesh and
|
|
||||||
// // positioning the vertex vertices instead,
|
|
||||||
// // if we have:
|
|
||||||
// // - a triangle mesh, and 3 or more instances.
|
|
||||||
// // - a quad mesh, and 6 or more instances.
|
|
||||||
// // - a cube mesh, and 36 or more instances.
|
|
||||||
// inst_pos: [f32; 3] = "inst_pos",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
// ibuf: gfx::InstanceBuffer<Instance> = (),
|
|
||||||
//
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
// lights: gfx::ConstantBuffer<Light> = "u_lights",
|
|
||||||
// shadows: gfx::ConstantBuffer<Shadow> = "u_shadows",
|
|
||||||
//
|
|
||||||
// point_shadow_maps: gfx::TextureSampler<f32> = "t_point_shadow_maps",
|
|
||||||
// directed_shadow_maps: gfx::TextureSampler<f32> =
|
|
||||||
// "t_directed_shadow_maps",
|
|
||||||
//
|
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
|
||||||
//
|
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
|
||||||
//
|
|
||||||
// // Shadow stuff
|
|
||||||
// light_shadows: gfx::ConstantBuffer<shadow::Locals> =
|
|
||||||
// "u_light_shadows",
|
|
||||||
//
|
|
||||||
// tgt_color: gfx::BlendTarget<TgtColorFmt> = ("tgt_color",
|
|
||||||
// ColorMask::all(), gfx::preset::blend::ALPHA), tgt_depth_stencil:
|
|
||||||
// gfx::DepthTarget<TgtDepthStencilFmt> = gfx::preset::depth::LESS_EQUAL_WRITE,
|
|
||||||
// // tgt_depth_stencil: gfx::DepthStencilTarget<TgtDepthStencilFmt> =
|
|
||||||
// (gfx::preset::depth::LESS_EQUAL_WRITE,Stencil::new(Comparison::Always,0xff,
|
|
||||||
// (StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))), }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
@ -100,6 +30,15 @@ impl Vertex {
|
|||||||
norm_ao: norm_bits,
|
norm_ao: norm_bits,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &wgpu::vertex_attr_array![0 => Float3, 1 => Uint],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
@ -205,8 +144,113 @@ impl Instance {
|
|||||||
inst_dir: (inst_pos2 - inst_pos).into_array(),
|
inst_dir: (inst_pos2 - inst_pos).into_array(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Instance,
|
||||||
|
attributes: &wgpu::vertex_attr_array![0 => Float, 1 => Float, 2 => Float, 3 => Int, 4 => Float3],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Instance {
|
impl Default for Instance {
|
||||||
fn default() -> Self { Self::new(0.0, 0.0, ParticleMode::CampfireSmoke, Vec3::zero()) }
|
fn default() -> Self { Self::new(0.0, 0.0, ParticleMode::CampfireSmoke, Vec3::zero()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct ParticlePipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ParticlePipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Particle pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.alt_horizon,
|
||||||
|
&global_layout.light,
|
||||||
|
&global_layout.shadow,
|
||||||
|
&global_layout.shadow_maps,
|
||||||
|
&global_layout.light_shadows,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Particle pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::SrcAlpha,
|
||||||
|
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
alpha_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::One,
|
||||||
|
dst_factor: wgpu::BlendFactor::One,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc(), Instance::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,38 +1,7 @@
|
|||||||
use super::super::{Mesh, Tri};
|
use super::super::{AaMode, GlobalsLayouts, Mesh, Tri};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos: [f32; 2] = "v_pos",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// constant Locals {
|
|
||||||
// proj_mat_inv: [[f32; 4]; 4] = "proj_mat_inv",
|
|
||||||
// view_mat_inv: [[f32; 4]; 4] = "view_mat_inv",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
//
|
|
||||||
// locals: gfx::ConstantBuffer<Locals> = "u_locals",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
//
|
|
||||||
// map: gfx::TextureSampler<[f32; 4]> = "t_map",
|
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
|
||||||
//
|
|
||||||
// color_sampler: gfx::TextureSampler<<TgtColorFmt as
|
|
||||||
// gfx::format::Formatted>::View> = "src_color", depth_sampler:
|
|
||||||
// gfx::TextureSampler<<TgtDepthStencilFmt as gfx::format::Formatted>::View> =
|
|
||||||
// "src_depth",
|
|
||||||
//
|
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
|
||||||
//
|
|
||||||
// tgt_color: gfx::RenderTarget<WinColorFmt> = "tgt_color",
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Locals {
|
pub struct Locals {
|
||||||
@ -59,6 +28,21 @@ pub struct Vertex {
|
|||||||
pub pos: [f32; 2],
|
pub pos: [f32; 2],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Vertex {
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &[wgpu::VertexAttributeDescriptor {
|
||||||
|
offset: 0,
|
||||||
|
shader_location: 0,
|
||||||
|
format: wgpu::VertexFormat::Float2,
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn create_mesh() -> Mesh<Vertex> {
|
pub fn create_mesh() -> Mesh<Vertex> {
|
||||||
let mut mesh = Mesh::new();
|
let mut mesh = Mesh::new();
|
||||||
|
|
||||||
@ -78,3 +62,117 @@ pub fn create_mesh() -> Mesh<Vertex> {
|
|||||||
|
|
||||||
mesh
|
mesh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct PostProcessLayout {
|
||||||
|
pub src_color: wgpu::BindGroupLayout,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PostProcessLayout {
|
||||||
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
|
Self {
|
||||||
|
src_color: device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct PostProcessPipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PostProcessPipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &PostProcessLayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Post process pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[&global_layout.globals, &layout.src_color],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Post process pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: false,
|
||||||
|
depth_compare: wgpu::CompareFunction::Always,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,47 +1,9 @@
|
|||||||
use super::super::{ColLightInfo, Renderer, Texture};
|
use super::super::{
|
||||||
|
AaMode, ColLightInfo, FigureLayout, GlobalsLayouts, Renderer, TerrainVertex, Texture,
|
||||||
|
};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// constant Locals {
|
|
||||||
// shadow_matrices: [[f32; 4]; 4] = "shadowMatrices",
|
|
||||||
// texture_mats: [[f32; 4]; 4] = "texture_mat",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pipeline pipe {
|
|
||||||
// // Terrain vertex stuff
|
|
||||||
// vbuf: gfx::VertexBuffer<terrain::Vertex> = (),
|
|
||||||
|
|
||||||
// locals: gfx::ConstantBuffer<TerrainLocals> = "u_locals",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
|
|
||||||
// // Shadow stuff
|
|
||||||
// light_shadows: gfx::ConstantBuffer<Locals> = "u_light_shadows",
|
|
||||||
|
|
||||||
// tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> =
|
|
||||||
// gfx::state::Depth { fun: gfx::state::Comparison::Less,
|
|
||||||
// write: true,
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pipeline figure_pipe {
|
|
||||||
// // Terrain vertex stuff
|
|
||||||
// vbuf: gfx::VertexBuffer<terrain::Vertex> = (),
|
|
||||||
|
|
||||||
// locals: gfx::ConstantBuffer<figure::Locals> = "u_locals",
|
|
||||||
// bones: gfx::ConstantBuffer<figure::BoneData> = "u_bones",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
|
|
||||||
// // Shadow stuff
|
|
||||||
// light_shadows: gfx::ConstantBuffer<Locals> = "u_light_shadows",
|
|
||||||
|
|
||||||
// tgt_depth_stencil: gfx::DepthTarget<ShadowDepthStencilFmt> =
|
|
||||||
// gfx::state::Depth { fun: gfx::state::Comparison::Less,
|
|
||||||
// write: true,
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Locals {
|
pub struct Locals {
|
||||||
@ -58,6 +20,33 @@ impl Locals {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn default() -> Self { Self::new(Mat4::identity(), Mat4::identity()) }
|
pub fn default() -> Self { Self::new(Mat4::identity(), Mat4::identity()) }
|
||||||
|
|
||||||
|
fn layout(device: &wgpu::Device) -> wgpu::BindGroupLayout {
|
||||||
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::UniformBuffer {
|
||||||
|
dynamic: false,
|
||||||
|
min_binding_size: None,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ShadowLayout {
|
||||||
|
pub locals: wgpu::BindGroupLayout,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ShadowLayout {
|
||||||
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
|
Self {
|
||||||
|
locals: Locals::layout(device),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_col_lights(
|
pub fn create_col_lights(
|
||||||
@ -98,3 +87,165 @@ pub fn create_col_lights(
|
|||||||
col_lights.as_bytes(),
|
col_lights.as_bytes(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct ShadowFigurePipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ShadowFigurePipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &FigureLayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Shadow figure pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.light_shadows,
|
||||||
|
&layout.waves,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Shadow figure pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::Less,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[TerrainVertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ShadowPipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ShadowPipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &ShadowLayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Shadow pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.light_shadows,
|
||||||
|
&layout.locals,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Shadow pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::Less,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[TerrainVertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,40 +1,108 @@
|
|||||||
use super::super::{Mesh, Quad};
|
use super::super::{AaMode, GlobalsLayouts, Mesh, Quad};
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos: [f32; 3] = "v_pos",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// constant Locals {
|
|
||||||
// nul: [f32; 4] = "nul",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
|
|
||||||
// locals: gfx::ConstantBuffer<Locals> = "u_locals",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
|
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
|
||||||
|
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
|
||||||
|
|
||||||
// tgt_color: gfx::RenderTarget<TgtColorFmt> = "tgt_color",
|
|
||||||
// tgt_depth_stencil: gfx::DepthTarget<TgtDepthStencilFmt> =
|
|
||||||
// gfx::preset::depth::LESS_EQUAL_TEST, // tgt_depth_stencil:
|
|
||||||
// gfx::DepthStencilTarget<TgtDepthStencilFmt> =
|
|
||||||
// (gfx::preset::depth::LESS_EQUAL_WRITE,Stencil::new(Comparison::Always,0xff,
|
|
||||||
// (StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))), }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
pub pos: [f32; 3],
|
pub pos: [f32; 3],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Vertex {
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &[wgpu::VertexAttributeDescriptor {
|
||||||
|
offset: 0,
|
||||||
|
shader_location: 0,
|
||||||
|
format: wgpu::VertexFormat::Float3,
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SkyboxPipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SkyboxPipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
layouts: &GlobalsLayouts,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Skybox pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[&layouts.globals, &layouts.alt_horizon],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Skybox pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn create_mesh() -> Mesh<Vertex> {
|
pub fn create_mesh() -> Mesh<Vertex> {
|
||||||
let mut mesh = Mesh::new();
|
let mut mesh = Mesh::new();
|
||||||
|
|
||||||
|
@ -1,73 +1,8 @@
|
|||||||
|
use super::super::{AaMode, GlobalsLayouts, TerrainLayout};
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos: [f32; 3] = "v_pos",
|
|
||||||
// // Because we try to restrict terrain sprite data to a 128×128 block
|
|
||||||
// // we need an offset into the texture atlas.
|
|
||||||
// atlas_pos: u32 = "v_atlas_pos",
|
|
||||||
// // ____BBBBBBBBGGGGGGGGRRRRRRRR
|
|
||||||
// // col: u32 = "v_col",
|
|
||||||
// // ...AANNN
|
|
||||||
// // A = AO
|
|
||||||
// // N = Normal
|
|
||||||
// norm_ao: u32 = "v_norm_ao",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// constant Locals {
|
|
||||||
// // Each matrix performs rotatation, translation, and scaling,
|
|
||||||
// relative to the sprite // origin, for all sprite instances. The
|
|
||||||
// matrix will be in an array indexed by the // sprite instance's
|
|
||||||
// orientation (0 through 7). mat: [[f32; 4]; 4] = "mat",
|
|
||||||
// wind_sway: [f32; 4] = "wind_sway",
|
|
||||||
// offs: [f32; 4] = "offs",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// vertex/*constant*/ Instance {
|
|
||||||
// // Terrain block position and orientation
|
|
||||||
// pos_ori: u32 = "inst_pos_ori",
|
|
||||||
// inst_mat0: [f32; 4] = "inst_mat0",
|
|
||||||
// inst_mat1: [f32; 4] = "inst_mat1",
|
|
||||||
// inst_mat2: [f32; 4] = "inst_mat2",
|
|
||||||
// inst_mat3: [f32; 4] = "inst_mat3",
|
|
||||||
// inst_light: [f32; 4] = "inst_light",
|
|
||||||
// inst_wind_sway: f32 = "inst_wind_sway",
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
// ibuf: gfx::InstanceBuffer<Instance> = (),
|
|
||||||
// col_lights: gfx::TextureSampler<[f32; 4]> = "t_col_light",
|
|
||||||
//
|
|
||||||
// locals: gfx::ConstantBuffer<Locals> = "u_locals",
|
|
||||||
// // A sprite instance is a cross between a sprite and a terrain chunk.
|
|
||||||
// terrain_locals: gfx::ConstantBuffer<terrain::Locals> =
|
|
||||||
// "u_terrain_locals", globals: gfx::ConstantBuffer<Globals> =
|
|
||||||
// "u_globals", lights: gfx::ConstantBuffer<Light> = "u_lights",
|
|
||||||
// shadows: gfx::ConstantBuffer<Shadow> = "u_shadows",
|
|
||||||
//
|
|
||||||
// point_shadow_maps: gfx::TextureSampler<f32> = "t_point_shadow_maps",
|
|
||||||
// directed_shadow_maps: gfx::TextureSampler<f32> =
|
|
||||||
// "t_directed_shadow_maps",
|
|
||||||
//
|
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
|
||||||
//
|
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
|
||||||
//
|
|
||||||
// // Shadow stuff
|
|
||||||
// light_shadows: gfx::ConstantBuffer<shadow::Locals> =
|
|
||||||
// "u_light_shadows",
|
|
||||||
//
|
|
||||||
// tgt_color: gfx::BlendTarget<TgtColorFmt> = ("tgt_color",
|
|
||||||
// ColorMask::all(), gfx::preset::blend::ALPHA), tgt_depth_stencil:
|
|
||||||
// gfx::DepthTarget<TgtDepthStencilFmt> = gfx::preset::depth::LESS_EQUAL_WRITE,
|
|
||||||
// // tgt_depth_stencil: gfx::DepthStencilTarget<TgtDepthStencilFmt> =
|
|
||||||
// (gfx::preset::depth::LESS_EQUAL_WRITE,Stencil::new(Comparison::Always,0xff,
|
|
||||||
// (StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))), }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
@ -123,6 +58,15 @@ impl Vertex {
|
|||||||
norm_ao: norm_bits,
|
norm_ao: norm_bits,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &wgpu::vertex_attr_array![0 => Float3, 1 => Uint, 2 => Uint],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -162,6 +106,15 @@ impl Instance {
|
|||||||
inst_wind_sway: wind_sway,
|
inst_wind_sway: wind_sway,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Instance,
|
||||||
|
attributes: &wgpu::vertex_attr_array![0 => Uint, 1 => Float4,2 => Float4, 3 => Float4,4 => Float4,5 => Float],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Instance {
|
impl Default for Instance {
|
||||||
@ -191,4 +144,154 @@ impl Locals {
|
|||||||
offs: [offs.x, offs.y, offs.z, 0.0],
|
offs: [offs.x, offs.y, offs.z, 0.0],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn layout(device: &wgpu::Device) -> wgpu::BindGroupLayout {
|
||||||
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::UniformBuffer {
|
||||||
|
dynamic: false,
|
||||||
|
min_binding_size: None,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SpriteLayout {
|
||||||
|
pub locals: wgpu::BindGroupLayout,
|
||||||
|
pub col_lights: wgpu::BindGroupLayout,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SpriteLayout {
|
||||||
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
|
Self {
|
||||||
|
locals: Locals::layout(device),
|
||||||
|
col_lights: device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SpritePipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SpritePipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &SpriteLayout,
|
||||||
|
terrain_layout: &TerrainLayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Sprite pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.alt_horizon,
|
||||||
|
&global_layout.light,
|
||||||
|
&global_layout.shadow,
|
||||||
|
&global_layout.shadow_maps,
|
||||||
|
&global_layout.light_shadows,
|
||||||
|
&layout.col_lights,
|
||||||
|
&layout.locals,
|
||||||
|
&terrain_layout.locals,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Sprite pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::SrcAlpha,
|
||||||
|
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
alpha_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::One,
|
||||||
|
dst_factor: wgpu::BlendFactor::One,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc(), Instance::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,7 @@
|
|||||||
|
use super::super::{AaMode, GlobalsLayouts};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos_norm: u32 = "v_pos_norm",
|
|
||||||
// atlas_pos: u32 = "v_atlas_pos",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// constant Locals {
|
|
||||||
// model_offs: [f32; 3] = "model_offs",
|
|
||||||
// load_time: f32 = "load_time",
|
|
||||||
// atlas_offs: [i32; 4] = "atlas_offs",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
// col_lights: gfx::TextureSampler<[f32; 4]> = "t_col_light",
|
|
||||||
|
|
||||||
// locals: gfx::ConstantBuffer<Locals> = "u_locals",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
// lights: gfx::ConstantBuffer<Light> = "u_lights",
|
|
||||||
// shadows: gfx::ConstantBuffer<Shadow> = "u_shadows",
|
|
||||||
|
|
||||||
// point_shadow_maps: gfx::TextureSampler<f32> = "t_point_shadow_maps",
|
|
||||||
// directed_shadow_maps: gfx::TextureSampler<f32> =
|
|
||||||
// "t_directed_shadow_maps",
|
|
||||||
|
|
||||||
// alt: gfx::TextureSampler<[f32; 2]> = "t_alt",
|
|
||||||
// horizon: gfx::TextureSampler<[f32; 4]> = "t_horizon",
|
|
||||||
|
|
||||||
// noise: gfx::TextureSampler<f32> = "t_noise",
|
|
||||||
|
|
||||||
// // Shadow stuff
|
|
||||||
// light_shadows: gfx::ConstantBuffer<shadow::Locals> =
|
|
||||||
// "u_light_shadows",
|
|
||||||
|
|
||||||
// tgt_color: gfx::RenderTarget<TgtColorFmt> = "tgt_color",
|
|
||||||
// tgt_depth_stencil: gfx::DepthTarget<TgtDepthStencilFmt> =
|
|
||||||
// gfx::preset::depth::LESS_EQUAL_WRITE, // tgt_depth_stencil:
|
|
||||||
// gfx::DepthStencilTarget<TgtDepthStencilFmt> =
|
|
||||||
// (gfx::preset::depth::LESS_EQUAL_WRITE,Stencil::new(Comparison::Always,0xff,
|
|
||||||
// (StencilOp::Keep,StencilOp::Keep,StencilOp::Keep))), }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
@ -158,6 +117,15 @@ impl Vertex {
|
|||||||
pub fn set_bone_idx(&mut self, bone_idx: u8) {
|
pub fn set_bone_idx(&mut self, bone_idx: u8) {
|
||||||
self.pos_norm = (self.pos_norm & !(0xF << 27)) | ((bone_idx as u32 & 0xF) << 27);
|
self.pos_norm = (self.pos_norm & !(0xF << 27)) | ((bone_idx as u32 & 0xF) << 27);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &wgpu::vertex_attr_array![0 => Uint,1 => Uint],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -176,4 +144,144 @@ impl Locals {
|
|||||||
atlas_offs: [0; 4],
|
atlas_offs: [0; 4],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn layout(device: &wgpu::Device) -> wgpu::BindGroupLayout {
|
||||||
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::UniformBuffer {
|
||||||
|
dynamic: false,
|
||||||
|
min_binding_size: None,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct TerrainLayout {
|
||||||
|
pub locals: wgpu::BindGroupLayout,
|
||||||
|
pub col_lights: wgpu::BindGroupLayout,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TerrainLayout {
|
||||||
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
|
Self {
|
||||||
|
locals: Locals::layout(device),
|
||||||
|
col_lights: device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct TerrainPipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TerrainPipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &TerrainLayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("Terrain pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[
|
||||||
|
&global_layout.globals,
|
||||||
|
&global_layout.alt_horizon,
|
||||||
|
&global_layout.light,
|
||||||
|
&global_layout.shadow,
|
||||||
|
&global_layout.shadow_maps,
|
||||||
|
&global_layout.light_shadows,
|
||||||
|
&layout.locals,
|
||||||
|
&layout.col_lights,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("Terrain pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: true,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,7 @@
|
|||||||
use super::super::{Quad, Tri};
|
use super::super::{AaMode, GlobalsLayouts, Quad, Tri};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use zerocopy::AsBytes;
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
// gfx_defines! {
|
|
||||||
// vertex Vertex {
|
|
||||||
// pos: [f32; 2] = "v_pos",
|
|
||||||
// uv: [f32; 2] = "v_uv",
|
|
||||||
// color: [f32; 4] = "v_color",
|
|
||||||
// center: [f32; 2] = "v_center",
|
|
||||||
// mode: u32 = "v_mode",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// constant Locals {
|
|
||||||
// pos: [f32; 4] = "w_pos",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pipeline pipe {
|
|
||||||
// vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
||||||
|
|
||||||
// locals: gfx::ConstantBuffer<Locals> = "u_locals",
|
|
||||||
// globals: gfx::ConstantBuffer<Globals> = "u_globals",
|
|
||||||
// tex: gfx::TextureSampler<[f32; 4]> = "u_tex",
|
|
||||||
|
|
||||||
// scissor: gfx::Scissor = (),
|
|
||||||
|
|
||||||
// tgt_color: gfx::BlendTarget<WinColorFmt> = ("tgt_color",
|
|
||||||
// gfx::state::ColorMask::all(), gfx::preset::blend::ALPHA), tgt_depth:
|
|
||||||
// gfx::DepthTarget<WinDepthFmt> = gfx::preset::depth::LESS_EQUAL_TEST, }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
@ -39,12 +12,40 @@ pub struct Vertex {
|
|||||||
mode: u32,
|
mode: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Vertex {
|
||||||
|
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
|
||||||
|
use std::mem;
|
||||||
|
wgpu::VertexBufferDescriptor {
|
||||||
|
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
|
||||||
|
step_mode: wgpu::InputStepMode::Vertex,
|
||||||
|
attributes: &wgpu::vertex_attr_array![0 => Float2, 1 => Float2, 2 => Float4, 3 => Float2, 4 => Uint],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, AsBytes)]
|
#[derive(Copy, Clone, Debug, AsBytes)]
|
||||||
pub struct Locals {
|
pub struct Locals {
|
||||||
pos: [f32; 4],
|
pos: [f32; 4],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Locals {
|
||||||
|
fn layout(device: &wgpu::Device) -> wgpu::BindGroupLayout {
|
||||||
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::UniformBuffer {
|
||||||
|
dynamic: false,
|
||||||
|
min_binding_size: None,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<Vec4<f32>> for Locals {
|
impl From<Vec4<f32>> for Locals {
|
||||||
fn from(pos: Vec4<f32>) -> Self {
|
fn from(pos: Vec4<f32>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -94,6 +95,130 @@ impl Mode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct UILayout {
|
||||||
|
pub locals: wgpu::BindGroupLayout,
|
||||||
|
pub tex: wgpu::BindGroupLayout,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UILayout {
|
||||||
|
pub fn new(device: &wgpu::Device) -> Self {
|
||||||
|
Self {
|
||||||
|
locals: Locals::layout(device),
|
||||||
|
tex: device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
label: None,
|
||||||
|
entries: &[
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 0,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::SampledTexture {
|
||||||
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
|
dimension: wgpu::TextureViewDimension::D2,
|
||||||
|
multisampled: false,
|
||||||
|
},
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
binding: 1,
|
||||||
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||||
|
count: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct UIPipeline {
|
||||||
|
pub pipeline: wgpu::RenderPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UIPipeline {
|
||||||
|
pub fn new(
|
||||||
|
device: &wgpu::Device,
|
||||||
|
vs_module: &wgpu::ShaderModule,
|
||||||
|
fs_module: &wgpu::ShaderModule,
|
||||||
|
sc_desc: &wgpu::SwapChainDescriptor,
|
||||||
|
global_layout: &GlobalsLayouts,
|
||||||
|
layout: &UILayout,
|
||||||
|
aa_mode: AaMode,
|
||||||
|
) -> Self {
|
||||||
|
let render_pipeline_layout =
|
||||||
|
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
|
label: Some("UI pipeline layout"),
|
||||||
|
push_constant_ranges: &[],
|
||||||
|
bind_group_layouts: &[&global_layout.globals, &layout.locals, &layout.tex],
|
||||||
|
});
|
||||||
|
|
||||||
|
let samples = match aa_mode {
|
||||||
|
AaMode::None | AaMode::Fxaa => 1,
|
||||||
|
// TODO: Ensure sampling in the shader is exactly between the 4 texels
|
||||||
|
AaMode::SsaaX4 => 1,
|
||||||
|
AaMode::MsaaX4 => 4,
|
||||||
|
AaMode::MsaaX8 => 8,
|
||||||
|
AaMode::MsaaX16 => 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||||
|
label: Some("UI pipeline"),
|
||||||
|
layout: Some(&render_pipeline_layout),
|
||||||
|
vertex_stage: wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: vs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
},
|
||||||
|
fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
|
||||||
|
module: fs_module,
|
||||||
|
entry_point: "main",
|
||||||
|
}),
|
||||||
|
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
|
||||||
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
|
cull_mode: wgpu::CullMode::Back,
|
||||||
|
clamp_depth: false,
|
||||||
|
depth_bias: 0,
|
||||||
|
depth_bias_slope_scale: 0.0,
|
||||||
|
depth_bias_clamp: 0.0,
|
||||||
|
}),
|
||||||
|
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
|
color_states: &[wgpu::ColorStateDescriptor {
|
||||||
|
format: sc_desc.format,
|
||||||
|
color_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::SrcAlpha,
|
||||||
|
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
alpha_blend: wgpu::BlendDescriptor {
|
||||||
|
src_factor: wgpu::BlendFactor::One,
|
||||||
|
dst_factor: wgpu::BlendFactor::One,
|
||||||
|
operation: wgpu::BlendOperation::Add,
|
||||||
|
},
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}],
|
||||||
|
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||||
|
format: wgpu::TextureFormat::Depth24Plus,
|
||||||
|
depth_write_enabled: false,
|
||||||
|
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||||
|
stencil: wgpu::StencilStateDescriptor {
|
||||||
|
front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||||
|
read_mask: !0,
|
||||||
|
write_mask: !0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
vertex_state: wgpu::VertexStateDescriptor {
|
||||||
|
index_format: wgpu::IndexFormat::Uint16,
|
||||||
|
vertex_buffers: &[Vertex::desc()],
|
||||||
|
},
|
||||||
|
sample_count: samples,
|
||||||
|
sample_mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Self {
|
||||||
|
pipeline: render_pipeline,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn create_quad(
|
pub fn create_quad(
|
||||||
rect: Aabr<f32>,
|
rect: Aabr<f32>,
|
||||||
uv_rect: Aabr<f32>,
|
uv_rect: Aabr<f32>,
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user