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",
]
[[package]]
name = "android_glue"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
[[package]]
name = "ansi-parser"
version = "0.7.0"
@ -557,13 +551,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cgl"
version = "0.3.2"
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
dependencies = [
"libc",
]
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "chrono"
@ -679,22 +670,6 @@ dependencies = [
"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]]
name = "cocoa"
version = "0.24.0"
@ -1303,7 +1278,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9293a0da7d1bc1f30090ece4d9f9de79a07be7302ddb00e5eb1fefb6ee6409e2"
dependencies = [
"petgraph",
"petgraph 0.4.13",
]
[[package]]
@ -1502,15 +1477,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "either"
version = "1.6.1"
@ -1672,6 +1638,12 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
[[package]]
name = "fixedbitset"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
[[package]]
name = "flate2"
version = "1.0.20"
@ -1940,22 +1912,10 @@ dependencies = [
"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]]
name = "gfx-auxil"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07cd956b592970f08545b9325b87580eb95a51843b6f39da27b8667fec1a1216"
version = "0.5.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"fxhash",
"gfx-hal",
@ -1964,9 +1924,8 @@ dependencies = [
[[package]]
name = "gfx-backend-dx11"
version = "0.6.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54b43f06089866bdffe59b5a6801022c86b74d2c1dd28940a9cf301d3d014fbc"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"arrayvec",
"bitflags",
@ -1986,9 +1945,8 @@ dependencies = [
[[package]]
name = "gfx-backend-dx12"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375014deed24d76b03604736dd899f0925158a1a96db90cbefb9cce070f71af7"
version = "0.6.2"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"arrayvec",
"bit-set",
@ -1997,6 +1955,7 @@ dependencies = [
"gfx-auxil",
"gfx-hal",
"log",
"parking_lot 0.11.1",
"range-alloc",
"raw-window-handle",
"smallvec",
@ -2007,19 +1966,40 @@ dependencies = [
[[package]]
name = "gfx-backend-empty"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2085227c12b78f6657a900c829f2d0deb46a9be3eaf86844fde263cdc218f77c"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"gfx-hal",
"log",
"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]]
name = "gfx-backend-metal"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "273d60d5207f96d99e0d11d0718995f67e56533a9df1444d83baf787f4c3cb32"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"arrayvec",
"bitflags",
@ -2032,11 +2012,11 @@ dependencies = [
"lazy_static",
"log",
"metal",
"naga",
"objc",
"parking_lot 0.11.1",
"range-alloc",
"raw-window-handle",
"smallvec",
"spirv_cross",
"storage-map",
]
@ -2044,8 +2024,7 @@ dependencies = [
[[package]]
name = "gfx-backend-vulkan"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a3a63cf61067a09b7d1ac480af3cb2ae0c5ede5bed294607bbd814cb1666c45"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"arrayvec",
"ash",
@ -2055,77 +2034,22 @@ dependencies = [
"inplace_it",
"lazy_static",
"log",
"naga",
"objc",
"raw-window-handle",
"smallvec",
"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]]
name = "gfx-hal"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18d0754f5b7a43915fd7466883b2d1bb0800d7cc4609178d0b27bf143b9e5123"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
dependencies = [
"bitflags",
"naga",
"raw-window-handle",
]
[[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",
"thiserror",
]
[[package]]
@ -2195,17 +2119,6 @@ dependencies = [
"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]]
name = "glam"
version = "0.10.2"
@ -2222,85 +2135,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "glsl-include"
version = "0.3.1"
name = "glow"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daa2afb1631e7ab4543e0dde0e3fc68bb49c58fee89c07f30a26553b1f684ab6"
checksum = "1625b792e2f9267116dd41eb7d325e0ea2572ceba5069451906745e04f852f33"
dependencies = [
"lazy_static",
"regex",
]
[[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",
"js-sys",
"slotmap 0.4.0",
"wasm-bindgen",
"web-sys",
]
[[package]]
@ -2342,6 +2185,42 @@ dependencies = [
"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]]
name = "guillotiere"
version = "0.6.0"
@ -2821,9 +2700,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.47"
version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65"
checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175"
dependencies = [
"wasm-bindgen",
]
@ -2839,10 +2718,13 @@ dependencies = [
]
[[package]]
name = "khronos_api"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
name = "khronos-egl"
version = "3.0.0-beta"
source = "git+https://github.com/timothee-haudebourg/khronos-egl?rev=9568b2ee3b02f2c17cc9479f824db16daecf1664#9568b2ee3b02f2c17cc9479f824db16daecf1664"
dependencies = [
"libc",
"libloading 0.6.7",
]
[[package]]
name = "lazy-bytes-cast"
@ -3296,13 +3178,13 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
[[package]]
name = "naga"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0873deb76cf44b7454fba7b2ba6a89d3de70c08aceffd2c489379b3d9d08e661"
source = "git+https://github.com/gfx-rs/naga?tag=gfx-5#583f218c9dbca08daa6bf3efda60e80ecada63bb"
dependencies = [
"bitflags",
"fxhash",
"log",
"num-traits",
"petgraph 0.5.1",
"spirv_headers",
"thiserror",
]
@ -3313,7 +3195,7 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b797805fe732ea368a288e73c313952309287b8b775a13530d858b77cfe5c1cd"
dependencies = [
"cocoa 0.24.0",
"cocoa",
"dirs",
"objc",
"objc-foundation",
@ -3771,17 +3653,6 @@ dependencies = [
"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]]
name = "once_cell"
version = "1.5.2"
@ -3844,15 +3715,6 @@ dependencies = [
"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]]
name = "owned_ttf_parser"
version = "0.6.0"
@ -3948,7 +3810,17 @@ version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
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]]
@ -4323,9 +4195,8 @@ dependencies = [
[[package]]
name = "range-alloc"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6"
version = "0.1.1"
source = "git+https://github.com/gfx-rs/gfx?rev=0244e3401e9f127617cb8636397048584e7bfe8a#0244e3401e9f127617cb8636397048584e7bfe8a"
[[package]]
name = "raw-window-handle"
@ -4815,6 +4686,26 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "sharded-slab"
version = "0.1.1"
@ -4824,16 +4715,6 @@ dependencies = [
"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]]
name = "shellexpand"
version = "2.1.0"
@ -4917,6 +4798,12 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]]
name = "slotmap"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c46a3482db8f247956e464d783693ece164ca056e6e67563ee5505bdb86452cd"
[[package]]
name = "slotmap"
version = "1.0.2"
@ -5206,18 +5093,6 @@ dependencies = [
"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]]
name = "tap"
version = "1.0.1"
@ -5893,7 +5768,7 @@ dependencies = [
"serde_json",
"serde_repr",
"slab",
"slotmap",
"slotmap 1.0.2",
"specs",
"specs-idvs",
"spin_sleep",
@ -6078,6 +5953,7 @@ version = "0.8.0"
dependencies = [
"backtrace",
"bincode",
"bytemuck",
"chrono",
"conrod_core",
"conrod_winit",
@ -6093,13 +5969,8 @@ dependencies = [
"enum-iterator",
"euc",
"futures",
"gfx",
"gfx_device_gl",
"gfx_gl",
"gilrs",
"git2",
"glsl-include",
"glutin",
"glyph_brush",
"guillotiere",
"hashbrown 0.9.1",
@ -6112,12 +5983,12 @@ dependencies = [
"native-dialog",
"num 0.3.1",
"num_cpus",
"old_school_gfx_glutin_ext",
"ordered-float 2.1.1",
"rand 0.8.3",
"rodio",
"ron",
"serde",
"shaderc",
"specs",
"specs-idvs",
"termcolor",
@ -6140,7 +6011,6 @@ dependencies = [
"window_clipboard",
"winit",
"winres",
"zerocopy",
]
[[package]]
@ -6256,9 +6126,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm-bindgen"
version = "0.2.70"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be"
checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e"
dependencies = [
"cfg-if 1.0.0",
"serde",
@ -6268,9 +6138,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.70"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7"
checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62"
dependencies = [
"bumpalo",
"lazy_static",
@ -6283,9 +6153,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.20"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94"
checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35"
dependencies = [
"cfg-if 1.0.0",
"js-sys",
@ -6295,9 +6165,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.70"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c"
checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084"
dependencies = [
"quote 1.0.9",
"wasm-bindgen-macro-support",
@ -6305,9 +6175,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.70"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385"
checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
@ -6318,9 +6188,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.70"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64"
checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
[[package]]
name = "wasmer"
@ -6597,16 +6467,6 @@ dependencies = [
"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]]
name = "wayland-protocols"
version = "0.27.0"
@ -6675,9 +6535,9 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.47"
version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3"
checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3"
dependencies = [
"js-sys",
"wasm-bindgen",
@ -6723,15 +6583,11 @@ dependencies = [
[[package]]
name = "wgpu"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "991903e4c9f5b7319732b30a3d0339e27a51ea992cea22769b5f6c7f7076af6d"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/wgpu-rs.git?rev=ab8b0e3766558d541206da2790dfd63f15b13bc4#ab8b0e3766558d541206da2790dfd63f15b13bc4"
dependencies = [
"arrayvec",
"futures",
"gfx-backend-vulkan",
"js-sys",
"objc",
"parking_lot 0.11.1",
"raw-window-handle",
"smallvec",
@ -6746,22 +6602,23 @@ dependencies = [
[[package]]
name = "wgpu-core"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea487deeae90e06d77eb8e6cef945247774e7c0a0a226d238b31e90633594365"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=4ebe1f50b057046e4d4f015eb006330d62f5fe91#4ebe1f50b057046e4d4f015eb006330d62f5fe91"
dependencies = [
"arrayvec",
"bitflags",
"cfg_aliases",
"copyless",
"fxhash",
"gfx-backend-dx11",
"gfx-backend-dx12",
"gfx-backend-empty",
"gfx-backend-gl",
"gfx-backend-metal",
"gfx-backend-vulkan",
"gfx-descriptor",
"gfx-hal",
"gfx-memory",
"gpu-alloc",
"gpu-descriptor",
"naga",
"parking_lot 0.11.1",
"raw-window-handle",
@ -6773,9 +6630,8 @@ dependencies = [
[[package]]
name = "wgpu-types"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e3529528e608b54838ee618c3923b0f46e6db0334cfc6c42a16cf4ceb3bdb57"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=4ebe1f50b057046e4d4f015eb006330d62f5fe91#4ebe1f50b057046e4d4f015eb006330d62f5fe91"
dependencies = [
"bitflags",
]
@ -6861,7 +6717,7 @@ version = "0.24.0"
source = "git+https://gitlab.com/veloren/winit.git?branch=macos-test-spiffed#488c511802dfd95ca54f6f76a38547c93c7b02c9"
dependencies = [
"bitflags",
"cocoa 0.24.0",
"cocoa",
"core-foundation 0.9.1",
"core-graphics 0.22.2",
"core-video-sys",
@ -6929,16 +6785,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "x11-clipboard"
version = "0.5.1"
@ -7038,24 +6884,3 @@ name = "xml-rs"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
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
winit = {version = "0.24.0", features = ["serde"]}
wgpu = {git="https://github.com/gfx-rs/wgpu-rs.git"}
zerocopy = "0.3"
wgpu = { git="https://github.com/gfx-rs/wgpu-rs.git", rev= "ab8b0e3766558d541206da2790dfd63f15b13bc4" }
bytemuck = { version="1.4", features=["derive"] }
shaderc = "0.6.2"
# Ui

View File

@ -1,15 +1,15 @@
use bytemuck::Pod;
use wgpu::util::DeviceExt;
use zerocopy::AsBytes;
#[derive(Clone)]
pub struct Buffer<T: Copy + AsBytes> {
pub struct Buffer<T: Copy + Pod> {
pub buf: wgpu::Buffer,
// bytes
count: usize,
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 {
Self {
buf: device.create_buffer(&wgpu::BufferDescriptor {

View File

@ -1,15 +1,15 @@
use super::{buffer::Buffer, RenderError};
use zerocopy::AsBytes;
use super::buffer::Buffer;
use bytemuck::Pod;
/// 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
/// single render pass.
#[derive(Clone)]
pub struct Consts<T: Copy + AsBytes> {
pub struct Consts<T: Copy + Pod> {
buf: Buffer<T>,
}
impl<T: Copy + AsBytes> Consts<T> {
impl<T: Copy + Pod> Consts<T> {
/// Create a new `Const<T>`.
pub fn new(device: &mut wgpu::Device, len: usize) -> Self {
Self {
@ -24,7 +24,7 @@ impl<T: Copy + AsBytes> Consts<T> {
queue: &wgpu::Queue,
vals: &[T],
offset: usize,
) -> Result<(), RenderError> {
) {
self.buf.update(device, queue, vals, offset)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
use super::super::{AaMode, GlobalsLayouts};
use bytemuck::Pod;
use vek::*;
use zerocopy::AsBytes;
#[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)]
#[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex {
pos: [f32; 3],
// ____BBBBBBBBGGGGGGGGRRRRRRRR
@ -69,7 +69,7 @@ impl ParticleMode {
}
#[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)]
#[derive(Copy, Clone, Debug, Pod)]
pub struct 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.

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
use super::super::{AaMode, GlobalsLayouts, TerrainLayout};
use bytemuck::Pod;
use core::fmt;
use vek::*;
use zerocopy::AsBytes;
#[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)]
#[derive(Copy, Clone, Debug, Pod)]
pub struct Vertex {
pos: [f32; 3],
// Because we try to restrict terrain sprite data to a 128×128 block
@ -70,7 +70,7 @@ impl Vertex {
}
#[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)]
#[derive(Copy, Clone, Debug, Pod)]
pub struct Instance {
pos_ori: u32,
inst_mat0: [f32; 4],
@ -122,7 +122,7 @@ impl Default for Instance {
}
#[repr(C)]
#[derive(Copy, Clone, Debug, AsBytes)]
#[derive(Copy, Clone, Debug, Pod)]
pub struct 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
use crate::{
render::{
pipelines::lod_terrain::{Locals, LodData, Vertex},
Consts, GlobalModel, LodTerrainPipeline, Mesh, Model, Quad, Renderer,
pipelines::lod_terrain::{LodData, Vertex},
GlobalModel, LodTerrainVertex, Mesh, Model, Quad, Renderer,
},
settings::Settings,
};
@ -10,8 +10,7 @@ use common::{spiral::Spiral2d, util::srgba_to_linear};
use vek::*;
pub struct Lod {
model: Option<(u32, Model<LodTerrainPipeline>)>,
locals: Consts<Locals>,
model: Option<(u32, Model<LodTerrainVertex>)>,
data: LodData,
}
@ -25,7 +24,6 @@ impl Lod {
pub fn new(renderer: &mut Renderer, client: &Client, settings: &Settings) -> Self {
Self {
model: None,
locals: renderer.create_consts(&[Locals::default()]).unwrap(),
data: LodData::new(
renderer,
client.world_data().chunk_size(),
@ -33,7 +31,7 @@ impl Lod {
client.world_data().lod_alt.raw(),
client.world_data().lod_horizon.raw(),
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
// halves with an empty hole.
let detail = detail + 1;

View File

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

View File

@ -3,7 +3,7 @@ use crate::{
mesh::{greedy::GreedyMesh, Meshable},
render::{
pipelines::particle::ParticleMode, GlobalModel, Instances, Light, LodData, Model,
ParticleInstance, ParticlePipeline, Renderer,
ParticleInstance, ParticleVertex, Renderer,
},
};
use common::{
@ -35,7 +35,7 @@ pub struct ParticleMgr {
instances: Instances<ParticleInstance>,
/// GPU Vertex Buffers
model_cache: HashMap<&'static str, Model<ParticlePipeline>>,
model_cache: HashMap<&'static str, Model<ParticleVertex>>,
}
impl ParticleMgr {
@ -690,7 +690,7 @@ fn default_instances(renderer: &mut Renderer) -> Instances<ParticleInstance> {
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();
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_size = segment.size();
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
for vert in mesh.vertices_mut() {
vert.pos[0] -= segment_size.x as f32 / 2.0;

View File

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

View File

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

View File

@ -1,6 +1,6 @@
use super::graphic::{Graphic, GraphicCache, Id as GraphicId};
use crate::{
render::{Mesh, Renderer, Texture, UiPipeline},
render::{Mesh, Renderer, Texture, UIVertex},
Error,
};
use conrod_core::{text::GlyphCache, widget::Id};
@ -13,7 +13,7 @@ const GLYPH_CACHE_SIZE: u16 = 1;
const SCALE_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 {
// Map from text ids to their positioned glyphs.

View File

@ -3,7 +3,7 @@ mod renderer;
pub use renderer::{SampleStrat, Transform};
use crate::render::{RenderError, Renderer, Texture};
use crate::render::{Renderer, Texture};
use common::figure::Segment;
use guillotiere::{size2, SimpleAtlasAllocator};
use hashbrown::{hash_map::Entry, HashMap};
@ -443,21 +443,17 @@ fn upload_image(renderer: &mut Renderer, aabr: Aabr<u16>, tex: &Texture, image:
size,
// NOTE: Rgba texture, so each pixel is 4 bytes, ergo this cannot fail.
// 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");
}
}
fn create_image(
renderer: &mut Renderer,
image: RgbaImage,
border_color: Rgba<f32>,
) -> Result<Texture, RenderError> {
fn create_image(renderer: &mut Renderer, image: RgbaImage, border_color: Rgba<f32>) {
renderer.create_texture(
&DynamicImage::ImageRgba8(image),
None,
Some(gfx::texture::WrapMode::Border),
Some(wgpu::AddressMode::ClampToBorder),
Some(border_color.into_array().into()),
)
}

View File

@ -24,8 +24,8 @@ pub use widgets::{
use crate::{
render::{
create_ui_quad, create_ui_tri, Consts, DynamicModel, Globals, Mesh, RenderError, Renderer,
UiLocals, UiMode, UiPipeline,
create_ui_quad, create_ui_tri, Consts, Globals, Mesh, Model, RenderError, Renderer,
UIVertex, UiLocals, UiMode,
},
window::Window,
Error,
@ -105,9 +105,9 @@ pub struct Ui {
draw_commands: Vec<DrawCommand>,
// Mesh buffer for UI vertices; we reuse its allocation in order to limit vector reallocations
// during redrawing.
mesh: Mesh<UiPipeline>,
mesh: Mesh<UIVertex>,
// Model for drawing the ui
model: DynamicModel<UiPipeline>,
model: Model<UIVertex>,
// Consts for default ui drawing position (ie the interface)
interface_locals: Consts<UiLocals>,
default_globals: Consts<Globals>,
@ -543,7 +543,13 @@ impl Ui {
.map(|x| [255, 255, 255, *x])
.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);
}
}) {