Switched from zerocopy to bytemuck

Fixing errors
This commit is contained in:
Capucho 2020-09-13 18:26:23 +01:00 committed by Imbris
parent 91454ab0f7
commit cd2901a3c7
28 changed files with 319 additions and 506 deletions

517
Cargo.lock generated
View File

@ -104,12 +104,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"
@ -557,13 +551,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"
@ -679,22 +670,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"
@ -1303,7 +1278,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]]
@ -1502,15 +1477,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"
@ -1672,6 +1638,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"
@ -1940,22 +1912,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.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
checksum = "07cd956b592970f08545b9325b87580eb95a51843b6f39da27b8667fec1a1216"
dependencies = [ dependencies = [
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -1964,9 +1924,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.6.17" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
checksum = "54b43f06089866bdffe59b5a6801022c86b74d2c1dd28940a9cf301d3d014fbc"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -1986,9 +1945,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.6.13" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
checksum = "375014deed24d76b03604736dd899f0925158a1a96db90cbefb9cce070f71af7"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -1997,6 +1955,7 @@ 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",
@ -2007,19 +1966,40 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-empty" name = "gfx-backend-empty"
version = "0.6.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
checksum = "2085227c12b78f6657a900c829f2d0deb46a9be3eaf86844fde263cdc218f77c"
dependencies = [ dependencies = [
"gfx-hal", "gfx-hal",
"log", "log",
"raw-window-handle", "raw-window-handle",
] ]
[[package]]
name = "gfx-backend-gl"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"arrayvec",
"bitflags",
"gfx-auxil",
"gfx-hal",
"glow",
"js-sys",
"khronos-egl",
"libloading 0.6.7",
"log",
"naga",
"parking_lot 0.11.1",
"raw-window-handle",
"smallvec",
"spirv_cross",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.6.5" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
checksum = "273d60d5207f96d99e0d11d0718995f67e56533a9df1444d83baf787f4c3cb32"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -2032,11 +2012,11 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"metal", "metal",
"naga",
"objc", "objc",
"parking_lot 0.11.1", "parking_lot 0.11.1",
"range-alloc", "range-alloc",
"raw-window-handle", "raw-window-handle",
"smallvec",
"spirv_cross", "spirv_cross",
"storage-map", "storage-map",
] ]
@ -2044,8 +2024,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.6.5" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
checksum = "3a3a63cf61067a09b7d1ac480af3cb2ae0c5ede5bed294607bbd814cb1666c45"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
@ -2055,77 +2034,22 @@ dependencies = [
"inplace_it", "inplace_it",
"lazy_static", "lazy_static",
"log", "log",
"naga",
"objc", "objc",
"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.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
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]]
@ -2195,17 +2119,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"
@ -2222,85 +2135,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.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daa2afb1631e7ab4543e0dde0e3fc68bb49c58fee89c07f30a26553b1f684ab6" checksum = "1625b792e2f9267116dd41eb7d325e0ea2572ceba5069451906745e04f852f33"
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.3",
"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]]
@ -2342,6 +2185,42 @@ dependencies = [
"xi-unicode", "xi-unicode",
] ]
[[package]]
name = "gpu-alloc"
version = "0.2.1"
source = "git+https://github.com/zakarumych/gpu-alloc?rev=d07be73f9439a37c89f5b72f2500cbf0eb4ff613#d07be73f9439a37c89f5b72f2500cbf0eb4ff613"
dependencies = [
"bitflags",
"gpu-alloc-types",
]
[[package]]
name = "gpu-alloc-types"
version = "0.1.0"
source = "git+https://github.com/zakarumych/gpu-alloc?rev=d07be73f9439a37c89f5b72f2500cbf0eb4ff613#d07be73f9439a37c89f5b72f2500cbf0eb4ff613"
dependencies = [
"bitflags",
]
[[package]]
name = "gpu-descriptor"
version = "0.1.0"
source = "git+https://github.com/zakarumych/gpu-descriptor?rev=df74fd8c7bea03149058a41aab0e4fe04077b266#df74fd8c7bea03149058a41aab0e4fe04077b266"
dependencies = [
"bitflags",
"gpu-descriptor-types",
"hashbrown 0.9.1",
"tracing",
]
[[package]]
name = "gpu-descriptor-types"
version = "0.1.0"
source = "git+https://github.com/zakarumych/gpu-descriptor?rev=df74fd8c7bea03149058a41aab0e4fe04077b266#df74fd8c7bea03149058a41aab0e4fe04077b266"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "guillotiere" name = "guillotiere"
version = "0.6.0" version = "0.6.0"
@ -2821,9 +2700,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.47" version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -2839,10 +2718,13 @@ dependencies = [
] ]
[[package]] [[package]]
name = "khronos_api" name = "khronos-egl"
version = "3.1.0" version = "3.0.0-beta"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/timothee-haudebourg/khronos-egl?rev=9568b2ee3b02f2c17cc9479f824db16daecf1664#9568b2ee3b02f2c17cc9479f824db16daecf1664"
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" dependencies = [
"libc",
"libloading 0.6.7",
]
[[package]] [[package]]
name = "lazy-bytes-cast" name = "lazy-bytes-cast"
@ -3296,13 +3178,13 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/naga?tag=gfx-5#583f218c9dbca08daa6bf3efda60e80ecada63bb"
checksum = "0873deb76cf44b7454fba7b2ba6a89d3de70c08aceffd2c489379b3d9d08e661"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"fxhash", "fxhash",
"log", "log",
"num-traits", "num-traits",
"petgraph 0.5.1",
"spirv_headers", "spirv_headers",
"thiserror", "thiserror",
] ]
@ -3313,7 +3195,7 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b797805fe732ea368a288e73c313952309287b8b775a13530d858b77cfe5c1cd" checksum = "b797805fe732ea368a288e73c313952309287b8b775a13530d858b77cfe5c1cd"
dependencies = [ dependencies = [
"cocoa 0.24.0", "cocoa",
"dirs", "dirs",
"objc", "objc",
"objc-foundation", "objc-foundation",
@ -3771,17 +3653,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.5.2" version = "1.5.2"
@ -3844,15 +3715,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"
@ -3948,7 +3810,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]]
@ -4323,9 +4195,8 @@ dependencies = [
[[package]] [[package]]
name = "range-alloc" name = "range-alloc"
version = "0.1.2" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6"
[[package]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
@ -4815,6 +4686,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"
@ -4824,16 +4715,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"
@ -4917,6 +4798,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.2" version = "1.0.2"
@ -5206,18 +5093,6 @@ dependencies = [
"unicode-xid 0.2.1", "unicode-xid 0.2.1",
] ]
[[package]]
name = "synstructure"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.60",
"unicode-xid 0.2.1",
]
[[package]] [[package]]
name = "tap" name = "tap"
version = "1.0.1" version = "1.0.1"
@ -5893,7 +5768,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_repr", "serde_repr",
"slab", "slab",
"slotmap", "slotmap 1.0.2",
"specs", "specs",
"specs-idvs", "specs-idvs",
"spin_sleep", "spin_sleep",
@ -6078,6 +5953,7 @@ version = "0.8.0"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bincode", "bincode",
"bytemuck",
"chrono", "chrono",
"conrod_core", "conrod_core",
"conrod_winit", "conrod_winit",
@ -6093,13 +5969,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 0.9.1", "hashbrown 0.9.1",
@ -6112,12 +5983,12 @@ dependencies = [
"native-dialog", "native-dialog",
"num 0.3.1", "num 0.3.1",
"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",
"termcolor", "termcolor",
@ -6140,7 +6011,6 @@ dependencies = [
"window_clipboard", "window_clipboard",
"winit", "winit",
"winres", "winres",
"zerocopy",
] ]
[[package]] [[package]]
@ -6256,9 +6126,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.70" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"serde", "serde",
@ -6268,9 +6138,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.70" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@ -6283,9 +6153,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.20" version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94" checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
@ -6295,9 +6165,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.70" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084"
dependencies = [ dependencies = [
"quote 1.0.9", "quote 1.0.9",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -6305,9 +6175,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.70" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2 1.0.24",
"quote 1.0.9", "quote 1.0.9",
@ -6318,9 +6188,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.70" version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
[[package]] [[package]]
name = "wasmer" name = "wasmer"
@ -6597,16 +6467,6 @@ dependencies = [
"xcursor", "xcursor",
] ]
[[package]]
name = "wayland-egl"
version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c653507447113c967a1aeee413699acb42d96d6302ec967c6d51930eae8aa7f5"
dependencies = [
"wayland-client 0.28.3",
"wayland-sys 0.28.3",
]
[[package]] [[package]]
name = "wayland-protocols" name = "wayland-protocols"
version = "0.27.0" version = "0.27.0"
@ -6675,9 +6535,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.47" version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -6723,15 +6583,11 @@ dependencies = [
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.6.2" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/wgpu-rs.git?rev=ab8b0e3766558d541206da2790dfd63f15b13bc4#ab8b0e3766558d541206da2790dfd63f15b13bc4"
checksum = "991903e4c9f5b7319732b30a3d0339e27a51ea992cea22769b5f6c7f7076af6d"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"futures",
"gfx-backend-vulkan",
"js-sys", "js-sys",
"objc",
"parking_lot 0.11.1", "parking_lot 0.11.1",
"raw-window-handle", "raw-window-handle",
"smallvec", "smallvec",
@ -6746,22 +6602,23 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.6.5" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/wgpu?rev=4ebe1f50b057046e4d4f015eb006330d62f5fe91#4ebe1f50b057046e4d4f015eb006330d62f5fe91"
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",
"naga", "naga",
"parking_lot 0.11.1", "parking_lot 0.11.1",
"raw-window-handle", "raw-window-handle",
@ -6773,9 +6630,8 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "0.6.1" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/wgpu?rev=4ebe1f50b057046e4d4f015eb006330d62f5fe91#4ebe1f50b057046e4d4f015eb006330d62f5fe91"
checksum = "1e3529528e608b54838ee618c3923b0f46e6db0334cfc6c42a16cf4ceb3bdb57"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
@ -6861,7 +6717,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",
@ -6929,16 +6785,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
[[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"
@ -7038,24 +6884,3 @@ name = "xml-rs"
version = "0.8.3" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a" checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a"
[[package]]
name = "zerocopy"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6580539ad917b7c026220c4b3f2c08d52ce54d6ce0dc491e66002e35388fab46"
dependencies = [
"byteorder",
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb"
dependencies = [
"proc-macro2 1.0.24",
"syn 1.0.60",
"synstructure",
]

View File

@ -27,8 +27,8 @@ anim = {package = "veloren-voxygen-anim", path = "anim", default-features = fals
# Graphics # Graphics
winit = {version = "0.24.0", features = ["serde"]} winit = {version = "0.24.0", features = ["serde"]}
wgpu = {git="https://github.com/gfx-rs/wgpu-rs.git"} wgpu = { git="https://github.com/gfx-rs/wgpu-rs.git", rev= "ab8b0e3766558d541206da2790dfd63f15b13bc4" }
zerocopy = "0.3" bytemuck = { version="1.4", features=["derive"] }
shaderc = "0.6.2" shaderc = "0.6.2"
# Ui # Ui

View File

@ -1,15 +1,15 @@
use bytemuck::Pod;
use wgpu::util::DeviceExt; use wgpu::util::DeviceExt;
use zerocopy::AsBytes;
#[derive(Clone)] #[derive(Clone)]
pub struct Buffer<T: Copy + AsBytes> { pub struct Buffer<T: Copy + Pod> {
pub buf: wgpu::Buffer, pub buf: wgpu::Buffer,
// bytes // bytes
count: usize, count: usize,
phantom_data: std::marker::PhantomData<T>, phantom_data: std::marker::PhantomData<T>,
} }
impl<T: Copy + AsBytes> Buffer<T> { impl<T: Copy + Pod> Buffer<T> {
pub fn new(device: &mut wgpu::Device, cap: usize, usage: wgpu::BufferUsage) -> Self { pub fn new(device: &mut wgpu::Device, cap: usize, usage: wgpu::BufferUsage) -> Self {
Self { Self {
buf: device.create_buffer(&wgpu::BufferDescriptor { buf: device.create_buffer(&wgpu::BufferDescriptor {

View File

@ -1,15 +1,15 @@
use super::{buffer::Buffer, RenderError}; use super::buffer::Buffer;
use zerocopy::AsBytes; use bytemuck::Pod;
/// A handle to a series of constants sitting on the GPU. This is used to hold /// A handle to a series of constants sitting on the GPU. This is used to hold
/// information used in the rendering process that does not change throughout a /// information used in the rendering process that does not change throughout a
/// single render pass. /// single render pass.
#[derive(Clone)] #[derive(Clone)]
pub struct Consts<T: Copy + AsBytes> { pub struct Consts<T: Copy + Pod> {
buf: Buffer<T>, buf: Buffer<T>,
} }
impl<T: Copy + AsBytes> Consts<T> { impl<T: Copy + Pod> Consts<T> {
/// Create a new `Const<T>`. /// Create a new `Const<T>`.
pub fn new(device: &mut wgpu::Device, len: usize) -> Self { pub fn new(device: &mut wgpu::Device, len: usize) -> Self {
Self { Self {
@ -24,7 +24,7 @@ impl<T: Copy + AsBytes> Consts<T> {
queue: &wgpu::Queue, queue: &wgpu::Queue,
vals: &[T], vals: &[T],
offset: usize, offset: usize,
) -> Result<(), RenderError> { ) {
self.buf.update(device, queue, vals, offset) self.buf.update(device, queue, vals, offset)
} }

View File

@ -1,13 +1,13 @@
use super::{buffer::Buffer, RenderError}; use super::{buffer::Buffer, RenderError};
use zerocopy::AsBytes; use bytemuck::Pod;
/// Represents a mesh that has been sent to the GPU. /// Represents a mesh that has been sent to the GPU.
#[derive(Clone)] #[derive(Clone)]
pub struct Instances<T: Copy + AsBytes> { pub struct Instances<T: Copy + Pod> {
buf: Buffer<T>, buf: Buffer<T>,
} }
impl<T: Copy + AsBytes> Instances<T> { impl<T: Copy + Pod> Instances<T> {
pub fn new(device: &mut wgpu::Device, len: usize) -> Self { pub fn new(device: &mut wgpu::Device, len: usize) -> Self {
Self { Self {
buf: Buffer::new(device, len, wgpu::BufferUsage::VERTEX), buf: Buffer::new(device, len, wgpu::BufferUsage::VERTEX),

View File

@ -22,17 +22,18 @@ pub use self::{
BoneData as FigureBoneData, BoneMeshes, FigureLayout, FigureModel, BoneData as FigureBoneData, BoneMeshes, FigureLayout, FigureModel,
Locals as FigureLocals, Locals as FigureLocals,
}, },
lod_terrain::LodData, fluid::Vertex as FluidVertex,
particle::Instance as ParticleInstance, lod_terrain::{LodData, Vertex as LodTerrainVertex},
postprocess::create_mesh as create_pp_mesh, particle::{Instance as ParticleInstance, Vertex as ParticleVertex},
postprocess::{create_mesh as create_pp_mesh, Vertex as PostProcessVertex},
shadow::Locals as ShadowLocals, shadow::Locals as ShadowLocals,
skybox::create_mesh as create_skybox_mesh, skybox::{create_mesh as create_skybox_mesh, Vertex as SkyboxVertex},
sprite::{Instance as SpriteInstance, Locals as SpriteLocals}, sprite::{Instance as SpriteInstance, Locals as SpriteLocals, Vertex as SpriteVertex},
terrain::{Locals as TerrainLocals, TerrainLayout, Vertex as TerrainVertex}, 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, Vertex as UiVertex,
}, },
GlobalModel, Globals, GlobalsLayouts, Light, Shadow, GlobalModel, Globals, GlobalsLayouts, Light, Shadow,
}, },
@ -41,7 +42,7 @@ pub use self::{
}; };
pub use wgpu::{AddressMode, FilterMode}; pub use wgpu::{AddressMode, FilterMode};
trait Vertex = Clone + zerocopy::AsBytes; pub trait Vertex = Clone + bytemuck::Pod;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Anti-aliasing modes /// Anti-aliasing modes

View File

@ -3,11 +3,11 @@ use super::{
terrain::Vertex, terrain::Vertex,
}; };
use crate::mesh::greedy::GreedyMesh; use crate::mesh::greedy::GreedyMesh;
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Locals { pub struct Locals {
model_mat: [[f32; 4]; 4], model_mat: [[f32; 4]; 4],
highlight_col: [f32; 4], highlight_col: [f32; 4],
@ -18,7 +18,7 @@ pub struct Locals {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct BoneData { pub struct BoneData {
bone_mat: [[f32; 4]; 4], bone_mat: [[f32; 4]; 4],
normals_mat: [[f32; 4]; 4], normals_mat: [[f32; 4]; 4],

View File

@ -1,9 +1,9 @@
use super::super::{AaMode, GlobalsLayouts}; use super::super::{AaMode, GlobalsLayouts};
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pos_norm: u32, pos_norm: u32,
} }

View File

@ -1,9 +1,9 @@
use super::super::{AaMode, GlobalsLayouts, Renderer, Texture}; use super::super::{AaMode, GlobalsLayouts, Renderer, Texture};
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pos: [f32; 2], pos: [f32; 2],
} }

View File

@ -12,16 +12,16 @@ pub mod ui;
use super::Consts; use super::Consts;
use crate::scene::camera::CameraMode; use crate::scene::camera::CameraMode;
use bytemuck::Pod;
use common::terrain::BlockKind; use common::terrain::BlockKind;
use vek::*; use vek::*;
use zerocopy::AsBytes;
pub const MAX_POINT_LIGHT_COUNT: usize = 31; pub const MAX_POINT_LIGHT_COUNT: usize = 31;
pub const MAX_FIGURE_SHADOW_COUNT: usize = 24; pub const MAX_FIGURE_SHADOW_COUNT: usize = 24;
pub const MAX_DIRECTED_LIGHT_COUNT: usize = 6; pub const MAX_DIRECTED_LIGHT_COUNT: usize = 6;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Globals { pub struct Globals {
view_mat: [[f32; 4]; 4], view_mat: [[f32; 4]; 4],
proj_mat: [[f32; 4]; 4], proj_mat: [[f32; 4]; 4],
@ -55,14 +55,14 @@ pub struct Globals {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Light { pub struct Light {
pos: [f32; 4], pos: [f32; 4],
col: [f32; 4], col: [f32; 4],
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Shadow { pub struct Shadow {
pos_radius: [f32; 4], pos_radius: [f32; 4],
} }

View File

@ -1,9 +1,9 @@
use super::super::{AaMode, GlobalsLayouts}; use super::super::{AaMode, GlobalsLayouts};
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pos: [f32; 3], pos: [f32; 3],
// ____BBBBBBBBGGGGGGGGRRRRRRRR // ____BBBBBBBBGGGGGGGGRRRRRRRR
@ -69,7 +69,7 @@ impl ParticleMode {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Instance { pub struct Instance {
// created_at time, so we can calculate time relativity, needed for relative animation. // 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. // can save 32 bits per instance, for particles that are not relatively animated.

View File

@ -1,9 +1,9 @@
use super::super::{AaMode, GlobalsLayouts, Mesh, Tri}; use super::super::{AaMode, GlobalsLayouts, Mesh, Tri};
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Locals { pub struct Locals {
proj_mat_inv: [[f32; 4]; 4], proj_mat_inv: [[f32; 4]; 4],
view_mat_inv: [[f32; 4]; 4], view_mat_inv: [[f32; 4]; 4],
@ -23,7 +23,7 @@ impl Locals {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pub pos: [f32; 2], pub pos: [f32; 2],
} }

View File

@ -2,11 +2,11 @@ use super::super::{
AaMode, ColLightInfo, FigureLayout, GlobalsLayouts, Renderer, TerrainLayout, TerrainVertex, AaMode, ColLightInfo, FigureLayout, GlobalsLayouts, Renderer, TerrainLayout, TerrainVertex,
Texture, Texture,
}; };
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Locals { pub struct Locals {
shadow_matrices: [[f32; 4]; 4], shadow_matrices: [[f32; 4]; 4],
texture_mats: [[f32; 4]; 4], texture_mats: [[f32; 4]; 4],

View File

@ -1,8 +1,8 @@
use super::super::{AaMode, GlobalsLayouts, Mesh, Quad}; use super::super::{AaMode, GlobalsLayouts, Mesh, Quad};
use zerocopy::AsBytes; use bytemuck::Pod;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pub pos: [f32; 3], pub pos: [f32; 3],
} }

View File

@ -1,10 +1,10 @@
use super::super::{AaMode, GlobalsLayouts, TerrainLayout}; use super::super::{AaMode, GlobalsLayouts, TerrainLayout};
use bytemuck::Pod;
use core::fmt; use core::fmt;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pos: [f32; 3], pos: [f32; 3],
// Because we try to restrict terrain sprite data to a 128×128 block // Because we try to restrict terrain sprite data to a 128×128 block
@ -70,7 +70,7 @@ impl Vertex {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Instance { pub struct Instance {
pos_ori: u32, pos_ori: u32,
inst_mat0: [f32; 4], inst_mat0: [f32; 4],
@ -122,7 +122,7 @@ impl Default for Instance {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Locals { pub struct Locals {
// Each matrix performs rotatation, translation, and scaling, relative to the sprite // 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 // origin, for all sprite instances. The matrix will be in an array indexed by the

View File

@ -1,9 +1,9 @@
use super::super::{AaMode, GlobalsLayouts}; use super::super::{AaMode, GlobalsLayouts};
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pos_norm: u32, pos_norm: u32,
atlas_pos: u32, atlas_pos: u32,
@ -112,7 +112,7 @@ impl Vertex {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Locals { pub struct Locals {
model_offs: [f32; 3], model_offs: [f32; 3],
load_time: f32, load_time: f32,

View File

@ -1,9 +1,9 @@
use super::super::{AaMode, GlobalsLayouts, Quad, Tri}; use super::super::{AaMode, GlobalsLayouts, Quad, Tri};
use bytemuck::Pod;
use vek::*; use vek::*;
use zerocopy::AsBytes;
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex { pub struct Vertex {
pos: [f32; 2], pos: [f32; 2],
uv: [f32; 2], uv: [f32; 2],
@ -24,7 +24,7 @@ impl Vertex {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)] #[derive(Copy, Clone, Debug, Pod)]
pub struct Locals { pub struct Locals {
pos: [f32; 4], pos: [f32; 4],
} }

View File

@ -946,7 +946,7 @@ impl Renderer {
} }
/// Create a new set of constants with the provided values. /// Create a new set of constants with the provided values.
pub fn create_consts<T: Copy + zerocopy::AsBytes>( pub fn create_consts<T: Copy + bytemuck::Pod>(
&mut self, &mut self,
vals: &[T], vals: &[T],
) -> Result<Consts<T>, RenderError> { ) -> Result<Consts<T>, RenderError> {
@ -956,16 +956,12 @@ impl Renderer {
} }
/// Update a set of constants with the provided values. /// Update a set of constants with the provided values.
pub fn update_consts<T: Copy + zerocopy::AsBytes>( pub fn update_consts<T: Copy + bytemuck::Pod>(&mut self, consts: &mut Consts<T>, vals: &[T]) {
&mut self,
consts: &mut Consts<T>,
vals: &[T],
) -> Result<(), RenderError> {
consts.update(&mut self.encoder, vals, 0) consts.update(&mut self.encoder, vals, 0)
} }
/// Create a new set of instances with the provided values. /// Create a new set of instances with the provided values.
pub fn create_instances<T: Copy + zerocopy::AsBytes>( pub fn create_instances<T: Copy + bytemuck::Pod>(
&mut self, &mut self,
vals: &[T], vals: &[T],
) -> Result<Instances<T>, RenderError> { ) -> Result<Instances<T>, RenderError> {

View File

@ -1,9 +1,7 @@
use super::{load::BodySpec, FigureModelEntry}; use super::{load::BodySpec, FigureModelEntry};
use crate::{ use crate::{
mesh::{greedy::GreedyMesh, Meshable}, mesh::{greedy::GreedyMesh, Meshable},
render::{ render::{BoneMeshes, ColLightInfo, FigureModel, Mesh, Renderer, TerrainVertex},
BoneMeshes, ColLightInfo, FigureModel, FigurePipeline, Mesh, Renderer, TerrainPipeline,
},
scene::camera::CameraMode, scene::camera::CameraMode,
}; };
use anim::Skeleton; use anim::Skeleton;
@ -399,7 +397,7 @@ where
// Then, set up meshing context. // Then, set up meshing context.
let mut greedy = FigureModel::make_greedy(); let mut greedy = FigureModel::make_greedy();
let mut opaque = Mesh::<TerrainPipeline>::new(); let mut opaque = Mesh::<TerrainVertex>::new();
// Choose the most conservative bounds for any LOD model. // Choose the most conservative bounds for any LOD model.
let mut figure_bounds = anim::vek::Aabb { let mut figure_bounds = anim::vek::Aabb {
min: anim::vek::Vec3::zero(), min: anim::vek::Vec3::zero(),
@ -461,13 +459,13 @@ where
fn generate_mesh<'a>( fn generate_mesh<'a>(
greedy: &mut GreedyMesh<'a>, greedy: &mut GreedyMesh<'a>,
opaque_mesh: &mut Mesh<TerrainPipeline>, opaque_mesh: &mut Mesh<TerrainVertex>,
segment: &'a Segment, segment: &'a Segment,
offset: Vec3<f32>, offset: Vec3<f32>,
bone_idx: u8, bone_idx: u8,
) -> BoneMeshes { ) -> BoneMeshes {
let (opaque, _, _, bounds) = let (opaque, _, _, bounds) =
Meshable::<FigurePipeline, &mut GreedyMesh>::generate_mesh( Meshable::<TerrainVertex, &mut GreedyMesh>::generate_mesh(
segment, segment,
(greedy, opaque_mesh, offset, Vec3::one(), bone_idx), (greedy, opaque_mesh, offset, Vec3::one(), bone_idx),
); );
@ -476,14 +474,14 @@ where
fn generate_mesh_lod_mid<'a>( fn generate_mesh_lod_mid<'a>(
greedy: &mut GreedyMesh<'a>, greedy: &mut GreedyMesh<'a>,
opaque_mesh: &mut Mesh<TerrainPipeline>, opaque_mesh: &mut Mesh<TerrainVertex>,
segment: &'a Segment, segment: &'a Segment,
offset: Vec3<f32>, offset: Vec3<f32>,
bone_idx: u8, bone_idx: u8,
) -> BoneMeshes { ) -> BoneMeshes {
let lod_scale = 0.6; let lod_scale = 0.6;
let (opaque, _, _, bounds) = let (opaque, _, _, bounds) =
Meshable::<FigurePipeline, &mut GreedyMesh>::generate_mesh( Meshable::<TerrainVertex, &mut GreedyMesh>::generate_mesh(
segment.scaled_by(Vec3::broadcast(lod_scale)), segment.scaled_by(Vec3::broadcast(lod_scale)),
( (
greedy, greedy,
@ -498,14 +496,14 @@ where
fn generate_mesh_lod_low<'a>( fn generate_mesh_lod_low<'a>(
greedy: &mut GreedyMesh<'a>, greedy: &mut GreedyMesh<'a>,
opaque_mesh: &mut Mesh<TerrainPipeline>, opaque_mesh: &mut Mesh<TerrainVertex>,
segment: &'a Segment, segment: &'a Segment,
offset: Vec3<f32>, offset: Vec3<f32>,
bone_idx: u8, bone_idx: u8,
) -> BoneMeshes { ) -> BoneMeshes {
let lod_scale = 0.3; let lod_scale = 0.3;
let (opaque, _, _, bounds) = let (opaque, _, _, bounds) =
Meshable::<FigurePipeline, &mut GreedyMesh>::generate_mesh( Meshable::<TerrainVertex, &mut GreedyMesh>::generate_mesh(
segment.scaled_by(Vec3::broadcast(lod_scale)), segment.scaled_by(Vec3::broadcast(lod_scale)),
( (
greedy, greedy,

View File

@ -7,8 +7,8 @@ pub use load::load_mesh; // TODO: Don't make this public.
use crate::{ use crate::{
ecs::comp::Interpolated, ecs::comp::Interpolated,
render::{ render::{
ColLightFmt, ColLightInfo, Consts, FigureBoneData, FigureLocals, FigureModel, GlobalModel, pipelines, ColLightInfo, Consts, FigureBoneData, FigureLocals, FigureModel, GlobalModel,
Mesh, RenderError, Renderer, ShadowPipeline, TerrainPipeline, Texture, Mesh, RenderError, Renderer, TerrainVertex, Texture,
}, },
scene::{ scene::{
camera::{Camera, CameraMode, Dependents}, camera::{Camera, CameraMode, Dependents},
@ -64,7 +64,7 @@ pub type FigureModelRef<'a> = (
&'a Consts<FigureLocals>, &'a Consts<FigureLocals>,
&'a Consts<FigureBoneData>, &'a Consts<FigureBoneData>,
&'a FigureModel, &'a FigureModel,
&'a Texture<ColLightFmt>, &'a Texture, /* <ColLightFmt> */
); );
/// An entry holding enough information to draw or destroy a figure in a /// An entry holding enough information to draw or destroy a figure in a
@ -80,7 +80,7 @@ pub struct FigureModelEntry<const N: usize> {
/// Texture used to store color/light information for this figure entry. /// Texture used to store color/light information for this figure entry.
/* TODO: Consider using mipmaps instead of storing multiple texture atlases for different /* TODO: Consider using mipmaps instead of storing multiple texture atlases for different
* LOD levels. */ * LOD levels. */
col_lights: Texture<ColLightFmt>, col_lights: Texture, /* <ColLightFmt> */
/// Models stored in this figure entry; there may be several for one figure, /// Models stored in this figure entry; there may be several for one figure,
/// because of LOD models. /// because of LOD models.
pub models: [FigureModel; N], pub models: [FigureModel; N],
@ -4000,10 +4000,8 @@ impl FigureColLights {
} }
/// Find the correct texture for this model entry. /// Find the correct texture for this model entry.
pub fn texture<'a, const N: usize>( pub fn texture<'a, const N: usize>(&'a self, model: &'a FigureModelEntry<N>) -> &'a Texture /* <ColLightFmt> */
&'a self, {
model: &'a FigureModelEntry<N>,
) -> &'a Texture<ColLightFmt> {
/* &self.col_lights */ /* &self.col_lights */
&model.col_lights &model.col_lights
} }
@ -4018,7 +4016,7 @@ impl FigureColLights {
&mut self, &mut self,
renderer: &mut Renderer, renderer: &mut Renderer,
(tex, tex_size): ColLightInfo, (tex, tex_size): ColLightInfo,
(opaque, bounds): (Mesh<TerrainPipeline>, math::Aabb<f32>), (opaque, bounds): (Mesh<TerrainVertex>, math::Aabb<f32>),
vertex_range: [Range<u32>; N], vertex_range: [Range<u32>; N],
) -> Result<FigureModelEntry<N>, RenderError> { ) -> Result<FigureModelEntry<N>, RenderError> {
span!(_guard, "create_figure", "FigureColLights::create_figure"); span!(_guard, "create_figure", "FigureColLights::create_figure");
@ -4029,7 +4027,7 @@ impl FigureColLights {
i32::from(tex_size.y), i32::from(tex_size.y),
)) ))
.expect("Not yet implemented: allocate new atlas on allocation failure."); .expect("Not yet implemented: allocate new atlas on allocation failure.");
let col_lights = ShadowPipeline::create_col_lights(renderer, (tex, tex_size))?; let col_lights = pipelines::shadow::create_col_lights(renderer, (tex, tex_size))?;
let model_len = u32::try_from(opaque.vertices().len()) let model_len = u32::try_from(opaque.vertices().len())
.expect("The model size for this figure does not fit in a u32!"); .expect("The model size for this figure does not fit in a u32!");
let model = renderer.create_model(&opaque)?; let model = renderer.create_model(&opaque)?;
@ -4298,5 +4296,5 @@ impl<S: Skeleton> FigureState<S> {
fn figure_bone_data_from_anim( fn figure_bone_data_from_anim(
mats: &[anim::FigureBoneData; anim::MAX_BONE_COUNT], mats: &[anim::FigureBoneData; anim::MAX_BONE_COUNT],
) -> &[FigureBoneData] { ) -> &[FigureBoneData] {
gfx::memory::cast_slice(mats) bytemuck::cast_slice(mats)
} }

View File

@ -1,7 +1,7 @@
use crate::{ use crate::{
render::{ render::{
pipelines::lod_terrain::{Locals, LodData, Vertex}, pipelines::lod_terrain::{LodData, Vertex},
Consts, GlobalModel, LodTerrainPipeline, Mesh, Model, Quad, Renderer, GlobalModel, LodTerrainVertex, Mesh, Model, Quad, Renderer,
}, },
settings::Settings, settings::Settings,
}; };
@ -10,8 +10,7 @@ use common::{spiral::Spiral2d, util::srgba_to_linear};
use vek::*; use vek::*;
pub struct Lod { pub struct Lod {
model: Option<(u32, Model<LodTerrainPipeline>)>, model: Option<(u32, Model<LodTerrainVertex>)>,
locals: Consts<Locals>,
data: LodData, data: LodData,
} }
@ -25,7 +24,6 @@ impl Lod {
pub fn new(renderer: &mut Renderer, client: &Client, settings: &Settings) -> Self { pub fn new(renderer: &mut Renderer, client: &Client, settings: &Settings) -> Self {
Self { Self {
model: None, model: None,
locals: renderer.create_consts(&[Locals::default()]).unwrap(),
data: LodData::new( data: LodData::new(
renderer, renderer,
client.world_data().chunk_size(), client.world_data().chunk_size(),
@ -33,7 +31,7 @@ impl Lod {
client.world_data().lod_alt.raw(), client.world_data().lod_alt.raw(),
client.world_data().lod_horizon.raw(), client.world_data().lod_horizon.raw(),
settings.graphics.lod_detail.max(100).min(2500), settings.graphics.lod_detail.max(100).min(2500),
water_color().into_array().into(), // water_color().into_array().into(),
), ),
} }
} }
@ -68,7 +66,7 @@ impl Lod {
} }
} }
fn create_lod_terrain_mesh(detail: u32) -> Mesh<LodTerrainPipeline> { fn create_lod_terrain_mesh(detail: u32) -> Mesh<LodTerrainVertex> {
// detail is even, so we choose odd detail (detail + 1) to create two even // detail is even, so we choose odd detail (detail + 1) to create two even
// halves with an empty hole. // halves with an empty hole.
let detail = detail + 1; let detail = detail + 1;

View File

@ -17,8 +17,8 @@ use crate::{
audio::{ambient::AmbientMgr, music::MusicMgr, sfx::SfxMgr, AudioFrontend}, audio::{ambient::AmbientMgr, music::MusicMgr, sfx::SfxMgr, AudioFrontend},
render::{ render::{
create_clouds_mesh, create_pp_mesh, create_skybox_mesh, CloudsLocals, CloudsPipeline, create_clouds_mesh, create_pp_mesh, create_skybox_mesh, CloudsLocals, CloudsPipeline,
Consts, GlobalModel, Globals, Light, LodData, Model, PostProcessLocals, Consts, GlobalModel, Globals, Light, LodData, Model, PostProcessLocals, Renderer, Shadow,
PostProcessPipeline, Renderer, Shadow, ShadowLocals, SkyboxLocals, SkyboxPipeline, ShadowLocals, SkyboxLocals,
}, },
settings::Settings, settings::Settings,
window::{AnalogGameInput, Event}, window::{AnalogGameInput, Event},
@ -68,8 +68,7 @@ struct EventLight {
} }
struct Skybox { struct Skybox {
model: Model<SkyboxPipeline>, model: Model<SkyboxVertex>,
locals: Consts<SkyboxLocals>,
} }
struct Clouds { struct Clouds {
@ -78,8 +77,7 @@ struct Clouds {
} }
struct PostProcess { struct PostProcess {
model: Model<PostProcessPipeline>, model: Model<PostProcessVertex>,
locals: Consts<PostProcessLocals>,
} }
pub struct Scene { pub struct Scene {
@ -290,7 +288,6 @@ impl Scene {
skybox: Skybox { skybox: Skybox {
model: renderer.create_model(&create_skybox_mesh()).unwrap(), model: renderer.create_model(&create_skybox_mesh()).unwrap(),
locals: renderer.create_consts(&[SkyboxLocals::default()]).unwrap(),
}, },
clouds: Clouds { clouds: Clouds {
model: renderer.create_model(&create_clouds_mesh()).unwrap(), model: renderer.create_model(&create_clouds_mesh()).unwrap(),
@ -298,9 +295,6 @@ impl Scene {
}, },
postprocess: PostProcess { postprocess: PostProcess {
model: renderer.create_model(&create_pp_mesh()).unwrap(), model: renderer.create_model(&create_pp_mesh()).unwrap(),
locals: renderer
.create_consts(&[PostProcessLocals::default()])
.unwrap(),
}, },
terrain: Terrain::new(renderer), terrain: Terrain::new(renderer),
lod: Lod::new(renderer, client, settings), lod: Lod::new(renderer, client, settings),

View File

@ -3,7 +3,7 @@ use crate::{
mesh::{greedy::GreedyMesh, Meshable}, mesh::{greedy::GreedyMesh, Meshable},
render::{ render::{
pipelines::particle::ParticleMode, GlobalModel, Instances, Light, LodData, Model, pipelines::particle::ParticleMode, GlobalModel, Instances, Light, LodData, Model,
ParticleInstance, ParticlePipeline, Renderer, ParticleInstance, ParticleVertex, Renderer,
}, },
}; };
use common::{ use common::{
@ -35,7 +35,7 @@ pub struct ParticleMgr {
instances: Instances<ParticleInstance>, instances: Instances<ParticleInstance>,
/// GPU Vertex Buffers /// GPU Vertex Buffers
model_cache: HashMap<&'static str, Model<ParticlePipeline>>, model_cache: HashMap<&'static str, Model<ParticleVertex>>,
} }
impl ParticleMgr { impl ParticleMgr {
@ -690,7 +690,7 @@ fn default_instances(renderer: &mut Renderer) -> Instances<ParticleInstance> {
const DEFAULT_MODEL_KEY: &str = "voxygen.voxel.particle"; const DEFAULT_MODEL_KEY: &str = "voxygen.voxel.particle";
fn default_cache(renderer: &mut Renderer) -> HashMap<&'static str, Model<ParticlePipeline>> { fn default_cache(renderer: &mut Renderer) -> HashMap<&'static str, Model<ParticleVertex>> {
let mut model_cache = HashMap::new(); let mut model_cache = HashMap::new();
model_cache.entry(DEFAULT_MODEL_KEY).or_insert_with(|| { model_cache.entry(DEFAULT_MODEL_KEY).or_insert_with(|| {
@ -706,7 +706,7 @@ fn default_cache(renderer: &mut Renderer) -> HashMap<&'static str, Model<Particl
let segment = Segment::from(&vox.read().0); let segment = Segment::from(&vox.read().0);
let segment_size = segment.size(); let segment_size = segment.size();
let mut mesh = let mut mesh =
Meshable::<ParticlePipeline, &mut GreedyMesh>::generate_mesh(segment, &mut greedy).0; Meshable::<ParticleVertex, &mut GreedyMesh>::generate_mesh(segment, &mut greedy).0;
// Center particle vertices around origin // Center particle vertices around origin
for vert in mesh.vertices_mut() { for vert in mesh.vertices_mut() {
vert.pos[0] -= segment_size.x as f32 / 2.0; vert.pos[0] -= segment_size.x as f32 / 2.0;

View File

@ -1,10 +1,10 @@
use crate::{ use crate::{
mesh::{greedy::GreedyMesh, Meshable}, mesh::{greedy::GreedyMesh, Meshable},
render::{ render::{
create_clouds_mesh, create_pp_mesh, create_skybox_mesh, BoneMeshes, CloudsLocals, create_clouds_mesh, create_pp_mesh, create_skybox_mesh, BoneMeshes, CloudsLocals, Consts,
CloudsPipeline, Consts, FigureModel, FigurePipeline, GlobalModel, Globals, Light, Mesh, FigureModel, GlobalModel, Globals, Light, Mesh, Model, PostProcessLocals,
Model, PostProcessLocals, PostProcessPipeline, Renderer, Shadow, ShadowLocals, PostProcessVertex, Renderer, Shadow, ShadowLocals, SkyboxLocals, SkyboxVertex,
SkyboxLocals, SkyboxPipeline, TerrainPipeline, TerrainVertex,
}, },
scene::{ scene::{
camera::{self, Camera, CameraMode}, camera::{self, Camera, CameraMode},
@ -45,13 +45,13 @@ impl ReadVol for VoidVol {
fn generate_mesh<'a>( fn generate_mesh<'a>(
greedy: &mut GreedyMesh<'a>, greedy: &mut GreedyMesh<'a>,
mesh: &mut Mesh<TerrainPipeline>, mesh: &mut Mesh<TerrainVertex>,
segment: Segment, segment: Segment,
offset: Vec3<f32>, offset: Vec3<f32>,
bone_idx: u8, bone_idx: u8,
) -> BoneMeshes { ) -> BoneMeshes {
let (opaque, _, /* shadow */ _, bounds) = let (opaque, _, /* shadow */ _, bounds) =
Meshable::<FigurePipeline, &mut GreedyMesh>::generate_mesh( Meshable::<TerrainVertex, &mut GreedyMesh>::generate_mesh(
segment, segment,
(greedy, mesh, offset, Vec3::one(), bone_idx), (greedy, mesh, offset, Vec3::one(), bone_idx),
); );
@ -59,13 +59,11 @@ fn generate_mesh<'a>(
} }
struct Skybox { struct Skybox {
model: Model<SkyboxPipeline>, model: Model<SkyboxVertex>,
locals: Consts<SkyboxLocals>,
} }
struct PostProcess { struct PostProcess {
model: Model<PostProcessPipeline>, model: Model<PostProcessVertex>,
locals: Consts<PostProcessLocals>,
} }
struct Clouds { struct Clouds {
@ -139,7 +137,6 @@ impl Scene {
skybox: Skybox { skybox: Skybox {
model: renderer.create_model(&create_skybox_mesh()).unwrap(), model: renderer.create_model(&create_skybox_mesh()).unwrap(),
locals: renderer.create_consts(&[SkyboxLocals::default()]).unwrap(),
}, },
clouds: Clouds { clouds: Clouds {
model: renderer.create_model(&create_clouds_mesh()).unwrap(), model: renderer.create_model(&create_clouds_mesh()).unwrap(),
@ -147,9 +144,6 @@ impl Scene {
}, },
postprocess: PostProcess { postprocess: PostProcess {
model: renderer.create_model(&create_pp_mesh()).unwrap(), model: renderer.create_model(&create_pp_mesh()).unwrap(),
locals: renderer
.create_consts(&[PostProcessLocals::default()])
.unwrap(),
}, },
lod: LodData::new( lod: LodData::new(
renderer, renderer,

View File

@ -5,9 +5,9 @@ pub use self::watcher::BlocksOfInterest;
use crate::{ use crate::{
mesh::{greedy::GreedyMesh, Meshable}, mesh::{greedy::GreedyMesh, Meshable},
render::{ render::{
ColLightFmt, ColLightInfo, Consts, FluidPipeline, GlobalModel, Instances, Mesh, Model, pipelines, ColLightInfo, Consts, FluidVertex, GlobalModel, Instances, Mesh, Model,
RenderError, Renderer, ShadowPipeline, SpriteInstance, SpriteLocals, SpritePipeline, RenderError, Renderer, SpriteInstance, SpriteLocals, SpriteVertex, TerrainLocals,
TerrainLocals, TerrainPipeline, Texture, TerrainVertex, Texture,
}, },
}; };
@ -59,8 +59,8 @@ impl Visibility {
pub struct TerrainChunkData { pub struct TerrainChunkData {
// GPU data // GPU data
load_time: f32, load_time: f32,
opaque_model: Model<TerrainPipeline>, opaque_model: Model<TerrainVertex>,
fluid_model: Option<Model<FluidPipeline>>, fluid_model: Option<Model<FluidVertex>>,
col_lights: guillotiere::AllocId, col_lights: guillotiere::AllocId,
light_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>, light_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>,
glow_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>, glow_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>,
@ -87,8 +87,8 @@ struct ChunkMeshState {
struct MeshWorkerResponse { struct MeshWorkerResponse {
pos: Vec2<i32>, pos: Vec2<i32>,
z_bounds: (f32, f32), z_bounds: (f32, f32),
opaque_mesh: Mesh<TerrainPipeline>, opaque_mesh: Mesh<TerrainVertex>,
fluid_mesh: Mesh<FluidPipeline>, fluid_mesh: Mesh<FluidVertex>,
col_lights_info: ColLightInfo, col_lights_info: ColLightInfo,
light_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>, light_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>,
glow_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>, glow_map: Box<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>,
@ -229,7 +229,7 @@ fn mesh_worker<V: BaseVol<Vox = Block> + RectRasterableVol + ReadVol + Debug + '
struct SpriteData { struct SpriteData {
/* mat: Mat4<f32>, */ /* mat: Mat4<f32>, */
locals: Consts<SpriteLocals>, locals: Consts<SpriteLocals>,
model: Model<SpritePipeline>, model: Model<SpriteVertex>,
/* scale: Vec3<f32>, */ /* scale: Vec3<f32>, */
offset: Vec3<f32>, offset: Vec3<f32>,
} }
@ -266,8 +266,8 @@ pub struct Terrain<V: RectRasterableVol = TerrainChunk> {
// GPU data // GPU data
sprite_data: Arc<HashMap<(SpriteKind, usize), Vec<SpriteData>>>, sprite_data: Arc<HashMap<(SpriteKind, usize), Vec<SpriteData>>>,
sprite_col_lights: Texture<ColLightFmt>, col_lights: Texture, /* <ColLightFmt> */
col_lights: Texture<ColLightFmt>, sprite_col_lights: Texture, /* <ColLightFmt> */
waves: Texture, waves: Texture,
phantom: PhantomData<V>, phantom: PhantomData<V>,
@ -298,7 +298,6 @@ impl<V: RectRasterableVol> Terrain<V> {
let mut locals_buffer = [SpriteLocals::default(); 8]; let mut locals_buffer = [SpriteLocals::default(); 8];
let sprite_config_ = &sprite_config; let sprite_config_ = &sprite_config;
// NOTE: Tracks the start vertex of the next model to be meshed. // NOTE: Tracks the start vertex of the next model to be meshed.
let sprite_data: HashMap<(SpriteKind, usize), _> = SpriteKind::into_enum_iter() let sprite_data: HashMap<(SpriteKind, usize), _> = SpriteKind::into_enum_iter()
.filter_map(|kind| Some((kind, kind.elim_case_pure(&sprite_config_.0).as_ref()?))) .filter_map(|kind| Some((kind, kind.elim_case_pure(&sprite_config_.0).as_ref()?)))
.flat_map(|(kind, sprite_config)| { .flat_map(|(kind, sprite_config)| {
@ -358,7 +357,7 @@ impl<V: RectRasterableVol> Terrain<V> {
// has no // has no
// interesting return value, but updates the mesh. // interesting return value, but updates the mesh.
let mut opaque_mesh = Mesh::new(); let mut opaque_mesh = Mesh::new();
Meshable::<SpritePipeline, &mut GreedyMesh>::generate_mesh( Meshable::<SpriteVertex, &mut GreedyMesh>::generate_mesh(
Segment::from(&model.read().0).scaled_by(lod_scale), Segment::from(&model.read().0).scaled_by(lod_scale),
(greedy, &mut opaque_mesh, false), (greedy, &mut opaque_mesh, false),
); );
@ -399,7 +398,7 @@ impl<V: RectRasterableVol> Terrain<V> {
.map(|mut f| f(&mut greedy, renderer)) .map(|mut f| f(&mut greedy, renderer))
.collect(); .collect();
let sprite_col_lights = ShadowPipeline::create_col_lights(renderer, greedy.finalize()) let sprite_col_lights = pipelines::shadow::create_col_lights(renderer, greedy.finalize())
.expect("Failed to upload sprite color and light data to the GPU!"); .expect("Failed to upload sprite color and light data to the GPU!");
Self { Self {
@ -416,9 +415,8 @@ impl<V: RectRasterableVol> Terrain<V> {
waves: renderer waves: renderer
.create_texture( .create_texture(
&assets::Image::load_expect("voxygen.texture.waves").read().0, &assets::Image::load_expect("voxygen.texture.waves").read().0,
Some(gfx::texture::FilterMethod::Trilinear), Some(wgpu::FilterMode::Linear),
Some(gfx::texture::WrapMode::Tile), Some(wgpu::AddressMode::Repeat),
None,
) )
.expect("Failed to create wave texture"), .expect("Failed to create wave texture"),
col_lights, col_lights,
@ -428,7 +426,7 @@ impl<V: RectRasterableVol> Terrain<V> {
fn make_atlas( fn make_atlas(
renderer: &mut Renderer, renderer: &mut Renderer,
) -> Result<(AtlasAllocator, Texture<ColLightFmt>), RenderError> { ) -> Result<(AtlasAllocator, Texture /* <ColLightFmt> */), RenderError> {
span!(_guard, "make_atlas", "Terrain::make_atlas"); span!(_guard, "make_atlas", "Terrain::make_atlas");
let max_texture_size = renderer.max_texture_size(); let max_texture_size = renderer.max_texture_size();
let atlas_size = let atlas_size =
@ -440,20 +438,29 @@ impl<V: RectRasterableVol> Terrain<V> {
..guillotiere::AllocatorOptions::default() ..guillotiere::AllocatorOptions::default()
}); });
let texture = renderer.create_texture_raw( let texture = renderer.create_texture_raw(
gfx::texture::Kind::D2( wgpu::TextureDescriptor {
max_texture_size, label: Some("Atlas texture"),
max_texture_size, size: wgpu::Extent3d {
gfx::texture::AaMode::Single, width: max_texture_size,
), height: max_texture_size,
1_u8, depth: 1,
gfx::memory::Bind::SHADER_RESOURCE, },
gfx::memory::Usage::Dynamic, mip_level_count: 1,
(0, 0), sample_count: 1,
gfx::format::Swizzle::new(), dimension: wgpu::TextureDimension::D1,
gfx::texture::SamplerInfo::new( format: wgpu::TextureFormat::Rgba8UnormSrgb,
gfx::texture::FilterMethod::Bilinear, usage: wgpu::TextureUsage::COPY_DST | wgpu::TextureUsage::SAMPLED,
gfx::texture::WrapMode::Clamp, },
), wgpu::SamplerDescriptor {
label: Some("Atlas sampler"),
address_mode_u: wgpu::AddressMode::ClampToEdge,
address_mode_v: wgpu::AddressMode::ClampToEdge,
address_mode_w: wgpu::AddressMode::ClampToEdge,
mag_filter: wgpu::FilterMode::Linear,
min_filter: wgpu::FilterMode::Linear,
mipmap_filter: wgpu::FilterMode::Nearest,
..Default::default()
},
)?; )?;
Ok((atlas, texture)) Ok((atlas, texture))
} }

View File

@ -1,6 +1,6 @@
use super::graphic::{Graphic, GraphicCache, Id as GraphicId}; use super::graphic::{Graphic, GraphicCache, Id as GraphicId};
use crate::{ use crate::{
render::{Mesh, Renderer, Texture, UiPipeline}, render::{Mesh, Renderer, Texture, UIVertex},
Error, Error,
}; };
use conrod_core::{text::GlyphCache, widget::Id}; use conrod_core::{text::GlyphCache, widget::Id};
@ -13,7 +13,7 @@ const GLYPH_CACHE_SIZE: u16 = 1;
const SCALE_TOLERANCE: f32 = 0.5; const SCALE_TOLERANCE: f32 = 0.5;
const POSITION_TOLERANCE: f32 = 0.5; const POSITION_TOLERANCE: f32 = 0.5;
type TextCache = HashMap<Id, Mesh<UiPipeline>>; type TextCache = HashMap<Id, Mesh<UIVertex>>;
pub struct Cache { pub struct Cache {
// Map from text ids to their positioned glyphs. // Map from text ids to their positioned glyphs.

View File

@ -3,7 +3,7 @@ mod renderer;
pub use renderer::{SampleStrat, Transform}; pub use renderer::{SampleStrat, Transform};
use crate::render::{RenderError, Renderer, Texture}; use crate::render::{Renderer, Texture};
use common::figure::Segment; use common::figure::Segment;
use guillotiere::{size2, SimpleAtlasAllocator}; use guillotiere::{size2, SimpleAtlasAllocator};
use hashbrown::{hash_map::Entry, HashMap}; use hashbrown::{hash_map::Entry, HashMap};
@ -443,21 +443,17 @@ fn upload_image(renderer: &mut Renderer, aabr: Aabr<u16>, tex: &Texture, image:
size, size,
// NOTE: Rgba texture, so each pixel is 4 bytes, ergo this cannot fail. // NOTE: Rgba texture, so each pixel is 4 bytes, ergo this cannot fail.
// We make the cast parameters explicit for clarity. // We make the cast parameters explicit for clarity.
gfx::memory::cast_slice::<u8, [u8; 4]>(&image), bytemuck::cast_slice::<u8, [u8; 4]>(&image),
) { ) {
warn!(?e, "Failed to update texture"); warn!(?e, "Failed to update texture");
} }
} }
fn create_image( fn create_image(renderer: &mut Renderer, image: RgbaImage, border_color: Rgba<f32>) {
renderer: &mut Renderer,
image: RgbaImage,
border_color: Rgba<f32>,
) -> Result<Texture, RenderError> {
renderer.create_texture( renderer.create_texture(
&DynamicImage::ImageRgba8(image), &DynamicImage::ImageRgba8(image),
None, None,
Some(gfx::texture::WrapMode::Border), Some(wgpu::AddressMode::ClampToBorder),
Some(border_color.into_array().into()), Some(border_color.into_array().into()),
) )
} }

View File

@ -24,8 +24,8 @@ pub use widgets::{
use crate::{ use crate::{
render::{ render::{
create_ui_quad, create_ui_tri, Consts, DynamicModel, Globals, Mesh, RenderError, Renderer, create_ui_quad, create_ui_tri, Consts, Globals, Mesh, Model, RenderError, Renderer,
UiLocals, UiMode, UiPipeline, UIVertex, UiLocals, UiMode,
}, },
window::Window, window::Window,
Error, Error,
@ -105,9 +105,9 @@ pub struct Ui {
draw_commands: Vec<DrawCommand>, draw_commands: Vec<DrawCommand>,
// Mesh buffer for UI vertices; we reuse its allocation in order to limit vector reallocations // Mesh buffer for UI vertices; we reuse its allocation in order to limit vector reallocations
// during redrawing. // during redrawing.
mesh: Mesh<UiPipeline>, mesh: Mesh<UIVertex>,
// Model for drawing the ui // Model for drawing the ui
model: DynamicModel<UiPipeline>, model: Model<UIVertex>,
// Consts for default ui drawing position (ie the interface) // Consts for default ui drawing position (ie the interface)
interface_locals: Consts<UiLocals>, interface_locals: Consts<UiLocals>,
default_globals: Consts<Globals>, default_globals: Consts<Globals>,
@ -543,7 +543,13 @@ impl Ui {
.map(|x| [255, 255, 255, *x]) .map(|x| [255, 255, 255, *x])
.collect::<Vec<[u8; 4]>>(); .collect::<Vec<[u8; 4]>>();
if let Err(err) = renderer.update_texture(cache_tex, offset, size, &new_data) { if let Err(err) = renderer.update_texture(
cache_tex,
offset,
size,
&new_data,
rect.width() * 4,
) {
warn!("Failed to update texture: {:?}", err); warn!("Failed to update texture: {:?}", err);
} }
}) { }) {