mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 16:49:18 -05:00
chore: update wgpu and realign to spec (#9760)
This commit is contained in:
parent
ce76f8c3a9
commit
f208e6a26f
22 changed files with 684 additions and 632 deletions
121
Cargo.lock
generated
121
Cargo.lock
generated
|
@ -83,12 +83,15 @@ name = "arrayvec"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ash"
|
name = "ash"
|
||||||
version = "0.31.0"
|
version = "0.32.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38"
|
checksum = "06063a002a77d2734631db74e8f4ce7148b77fe522e6bca46f2ae7774fd48112"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading",
|
"libloading",
|
||||||
]
|
]
|
||||||
|
@ -351,6 +354,16 @@ dependencies = [
|
||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "codespan-reporting"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
||||||
|
dependencies = [
|
||||||
|
"termcolor",
|
||||||
|
"unicode-width",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -438,9 +451,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "d3d12"
|
name = "d3d12"
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0a60cceb22c7c53035f8980524fdc7f17cf49681a3c154e6757d30afbec6ec4"
|
checksum = "091ed1b25fe47c7ff129fc440c23650b6114f36aa00bc7212cc8041879294428"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libloading",
|
"libloading",
|
||||||
|
@ -1271,9 +1284,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-auxil"
|
name = "gfx-auxil"
|
||||||
version = "0.8.0"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e7b33ecf067f2117668d91c9b0f2e5f223ebd1ffec314caa2f3de27bb580186d"
|
checksum = "9ccf8711c9994dfa34337466bee3ae1462e172874c432ce4eb120ab2e98d39cf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
|
@ -1282,9 +1295,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx11"
|
name = "gfx-backend-dx11"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f851d03c2e8f117e3702bf41201a4fafa447d5cb1276d5375870ae7573d069dd"
|
checksum = "6f839f27f8c8a6dc553ccca7f5b35a42009432bc25db9688bba7061cd394161f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -1304,9 +1317,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx12"
|
name = "gfx-backend-dx12"
|
||||||
version = "0.7.1"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5032d716a2a5f4dafb4675a794c5dc32081af8fbc7303c93ad93ff5413c6559f"
|
checksum = "3937738b0da5839bba4e33980d29f9a06dbce184d04a3a08c9a949e7953700e3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bit-set",
|
"bit-set",
|
||||||
|
@ -1326,9 +1339,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-empty"
|
name = "gfx-backend-empty"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f07ef26a65954cfdd7b4c587f485100d1bb3b0bd6a51b02d817d6c87cca7a91"
|
checksum = "2ac55ada4bfcd35479b3421eea324d36d7da5f724e2f66ecb36d4efdb7041a5e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"log",
|
"log",
|
||||||
|
@ -1337,13 +1350,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-gl"
|
name = "gfx-backend-gl"
|
||||||
version = "0.7.1"
|
version = "0.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c6717c50ab601efe4a669bfb44db615e3888695ac8263222aeaa702642b9fbc2"
|
checksum = "0caa03d6e0b7b4f202aea1f20c3f3288cfa06d92d24cea9d69c9a7627967244a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"gfx-auxil",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"glow",
|
"glow",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
@ -1353,16 +1366,15 @@ dependencies = [
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"spirv_cross",
|
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-metal"
|
name = "gfx-backend-metal"
|
||||||
version = "0.7.0"
|
version = "0.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8dc54b456ece69ef49f8893269ebf24ac70969ed34ba2719c3f3abcc8fbff14e"
|
checksum = "96a809b746d8063ade971cfb3f188e2b0d655926979823d80be7590390f4b911"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -1370,24 +1382,24 @@ dependencies = [
|
||||||
"cocoa-foundation",
|
"cocoa-foundation",
|
||||||
"copyless",
|
"copyless",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"gfx-auxil",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"log",
|
"log",
|
||||||
"metal",
|
"metal",
|
||||||
"naga",
|
"naga",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
"profiling",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"spirv_cross",
|
|
||||||
"storage-map",
|
"storage-map",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-vulkan"
|
name = "gfx-backend-vulkan"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dabe88b1a5c91e0f969b441cc57e70364858066e4ba937deeb62065654ef9bd9"
|
checksum = "a353fc6fdb42ec646de49bbb74e4870e37a7e680caf33f3ac0615c30b1146d94"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"ash",
|
"ash",
|
||||||
|
@ -1406,9 +1418,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-hal"
|
name = "gfx-hal"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c1d9cc8d3b573dda62d0baca4f02e0209786e22c562caff001d77c389008781d"
|
checksum = "6d285bfd566f6b9134af908446ca350c0a1047495dfb9bbd826e701e8ee1d259"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"naga",
|
"naga",
|
||||||
|
@ -1418,9 +1430,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glow"
|
name = "glow"
|
||||||
version = "0.7.2"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b"
|
checksum = "4b80b98efaa8a34fce11d60dd2ce2760d5d83c373cbcc73bb87c2a3a84a54108"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"slotmap",
|
"slotmap",
|
||||||
|
@ -1430,13 +1442,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-alloc"
|
name = "gpu-alloc"
|
||||||
version = "0.3.0"
|
version = "0.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e7724b9aef57ea36d70faf54e0ee6265f86e41de16bed8333efdeab5b00e16b"
|
checksum = "bc76088804bb65a6f3b880bea9306fdaeffb25ebb453105fafa691282ee9fdba"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"gpu-alloc-types",
|
"gpu-alloc-types",
|
||||||
"tracing",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1457,7 +1468,6 @@ dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"gpu-descriptor-types",
|
"gpu-descriptor-types",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"tracing",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1759,9 +1769,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "khronos-egl"
|
name = "khronos-egl"
|
||||||
version = "3.0.2"
|
version = "4.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b19cc4a81304db2a0ad69740e83cdc3a9364e3f9bd6d88a87288a4c2deec927b"
|
checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"libloading",
|
"libloading",
|
||||||
|
@ -1781,9 +1791,9 @@ checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
version = "0.6.7"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883"
|
checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
|
@ -1902,9 +1912,9 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "metal"
|
name = "metal"
|
||||||
version = "0.21.0"
|
version = "0.22.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4598d719460ade24c7d91f335daf055bf2a7eec030728ce751814c50cdd6a26c"
|
checksum = "1c12e48c737ee9a55e8bb2352bcde588f79ae308d3529ee888f7cc0f469b5777"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
|
@ -1954,17 +1964,17 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "05089b2acdf0e6a962cdbf5e328402345a27f59fcde1a59fe97a73e8149d416f"
|
checksum = "a462414ac6a74a8fcc2c6d235d9a92b288f22682c016cf725e75d0c9470fb515"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-set",
|
"bit-set",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"codespan-reporting",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"petgraph",
|
"petgraph",
|
||||||
"serde",
|
|
||||||
"spirv_headers",
|
"spirv_headers",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
@ -2318,6 +2328,12 @@ dependencies = [
|
||||||
"unicode-xid 0.2.1",
|
"unicode-xid 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "profiling"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3a66d5e88679f2720126c11ee29da07a08f094eac52306b066edd7d393752d6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pty"
|
name = "pty"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
@ -3457,9 +3473,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thunderdome"
|
name = "thunderdome"
|
||||||
version = "0.3.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7572415bd688d401c52f6e36f4c8e805b9ae1622619303b9fa835d531db0acae"
|
checksum = "87b4947742c93ece24a0032141d9caa3d853752e694a57e35029dd2bd08673e0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
|
@ -3627,21 +3643,9 @@ checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"tracing-attributes",
|
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tracing-attributes"
|
|
||||||
version = "0.1.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2 1.0.26",
|
|
||||||
"quote 1.0.9",
|
|
||||||
"syn 1.0.65",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.17"
|
version = "0.1.17"
|
||||||
|
@ -4034,9 +4038,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-core"
|
name = "wgpu-core"
|
||||||
version = "0.7.1"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c89fa2cc5d72236461ac09c5be967012663e29cb62f1a972654cbf35e49dffa8"
|
checksum = "59abd59fe91fe502fe2dd8777bcac414069199af22dd2a92a1bb635f9f251425"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -4052,21 +4056,22 @@ dependencies = [
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"gpu-alloc",
|
"gpu-alloc",
|
||||||
"gpu-descriptor",
|
"gpu-descriptor",
|
||||||
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
"profiling",
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tracing",
|
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-types"
|
name = "wgpu-types"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72fa9ba80626278fd87351555c363378d08122d7601e58319be3d6fa85a87747"
|
checksum = "aa248d90c8e6832269b8955bf800e8241f942c25e18a235b7752226804d21556"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -967,7 +967,8 @@ fn init_logger(maybe_level: Option<Level>) {
|
||||||
)
|
)
|
||||||
// https://github.com/denoland/deno/issues/6641
|
// https://github.com/denoland/deno/issues/6641
|
||||||
.filter_module("rustyline", LevelFilter::Off)
|
.filter_module("rustyline", LevelFilter::Off)
|
||||||
// wgpu backend crates (gfx_backend), have a lot of useless INFO and WARN logs
|
// wgpu crates (gfx_backend), have a lot of useless INFO and WARN logs
|
||||||
|
.filter_module("wgpu", LevelFilter::Error)
|
||||||
.filter_module("gfx", LevelFilter::Error)
|
.filter_module("gfx", LevelFilter::Error)
|
||||||
.format(|buf, record| {
|
.format(|buf, record| {
|
||||||
let mut target = record.target().to_string();
|
let mut target = record.target().to_string();
|
||||||
|
|
|
@ -49,18 +49,13 @@ unitTest({
|
||||||
|
|
||||||
storageBuffer.unmap();
|
storageBuffer.unmap();
|
||||||
|
|
||||||
const bindGroupLayout = device.createBindGroupLayout({
|
const computePipeline = device.createComputePipeline({
|
||||||
entries: [
|
compute: {
|
||||||
{
|
module: shaderModule,
|
||||||
binding: 0,
|
entryPoint: "main",
|
||||||
visibility: 4,
|
},
|
||||||
buffer: {
|
|
||||||
type: "storage",
|
|
||||||
minBindingSize: 4,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
const bindGroupLayout = computePipeline.getBindGroupLayout(0);
|
||||||
|
|
||||||
const bindGroup = device.createBindGroup({
|
const bindGroup = device.createBindGroup({
|
||||||
layout: bindGroupLayout,
|
layout: bindGroupLayout,
|
||||||
|
@ -74,18 +69,6 @@ unitTest({
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const pipelineLayout = device.createPipelineLayout({
|
|
||||||
bindGroupLayouts: [bindGroupLayout],
|
|
||||||
});
|
|
||||||
|
|
||||||
const computePipeline = device.createComputePipeline({
|
|
||||||
layout: pipelineLayout,
|
|
||||||
compute: {
|
|
||||||
module: shaderModule,
|
|
||||||
entryPoint: "main",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const encoder = device.createCommandEncoder();
|
const encoder = device.createCommandEncoder();
|
||||||
|
|
||||||
const computePass = encoder.beginComputePass();
|
const computePass = encoder.beginComputePass();
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
[[builtin(global_invocation_id)]]
|
|
||||||
var global_id: vec3<u32>;
|
|
||||||
|
|
||||||
[[block]]
|
[[block]]
|
||||||
struct PrimeIndices {
|
struct PrimeIndices {
|
||||||
data: [[stride(4)]] array<u32>;
|
data: [[stride(4)]] array<u32>;
|
||||||
}; // this is used as both input and output for convenience
|
}; // this is used as both input and output for convenience
|
||||||
|
|
||||||
[[group(0), binding(0)]]
|
[[group(0), binding(0)]]
|
||||||
var<storage> v_indices: [[access(read_write)]] PrimeIndices;
|
var<storage> v_indices: [[access(read_write)]] PrimeIndices;
|
||||||
|
|
||||||
// The Collatz Conjecture states that for any integer n:
|
// The Collatz Conjecture states that for any integer n:
|
||||||
// If n is even, n = n/2
|
// If n is even, n = n/2
|
||||||
// If n is odd, n = 3n+1
|
// If n is odd, n = 3n+1
|
||||||
|
@ -26,14 +21,17 @@ fn collatz_iterations(n_base: u32) -> u32{
|
||||||
n = n / 2u;
|
n = n / 2u;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Overflow? (i.e. 3*n + 1 > 0xffffffffu?)
|
||||||
|
if (n >= 1431655765u) { // 0x55555555u
|
||||||
|
return 4294967295u; // 0xffffffffu
|
||||||
|
}
|
||||||
n = 3u * n + 1u;
|
n = 3u * n + 1u;
|
||||||
}
|
}
|
||||||
i = i + 1u;
|
i = i + 1u;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[stage(compute), workgroup_size(1)]]
|
[[stage(compute), workgroup_size(1)]]
|
||||||
fn main() {
|
fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) {
|
||||||
v_indices.data[global_id.x] = collatz_iterations(v_indices.data[global_id.x]);
|
v_indices.data[global_id.x] = collatz_iterations(v_indices.data[global_id.x]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,10 @@
|
||||||
[[builtin(vertex_index)]]
|
|
||||||
var<in> in_vertex_index: u32;
|
|
||||||
[[builtin(position)]]
|
|
||||||
var<out> out_pos: vec4<f32>;
|
|
||||||
|
|
||||||
[[stage(vertex)]]
|
[[stage(vertex)]]
|
||||||
fn vs_main() {
|
fn vs_main([[builtin(vertex_index)]] in_vertex_index: u32) -> [[builtin(position)]] vec4<f32> {
|
||||||
var x: f32 = f32(i32(in_vertex_index) - 1);
|
let x = f32(i32(in_vertex_index) - 1);
|
||||||
var y: f32 = f32(i32(in_vertex_index & 1) * 2 - 1);
|
let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
|
||||||
out_pos = vec4<f32>(x, y, 0.0, 1.0);
|
return vec4<f32>(x, y, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[location(0)]]
|
|
||||||
var<out> out_color: vec4<f32>;
|
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn fs_main() {
|
fn fs_main() -> [[location(0)]] vec4<f32> {
|
||||||
out_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
return {
|
return {
|
||||||
width: data[0],
|
width: data[0],
|
||||||
height: data[1],
|
height: data[1],
|
||||||
depth: data[2],
|
depthOrArrayLayers: data[2],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return data;
|
return data;
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
/**
|
/**
|
||||||
* @typedef InnerGPUAdapter
|
* @typedef InnerGPUAdapter
|
||||||
* @property {number} rid
|
* @property {number} rid
|
||||||
* @property {GPUAdapterFeatures} features
|
* @property {GPUSupportedFeatures} features
|
||||||
* @property {GPUAdapterLimits} limits
|
* @property {GPUAdapterLimits} limits
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
adapter[_name] = name;
|
adapter[_name] = name;
|
||||||
adapter[_adapter] = {
|
adapter[_adapter] = {
|
||||||
...inner,
|
...inner,
|
||||||
features: createGPUAdapterFeatures(inner.features),
|
features: createGPUSupportedFeatures(inner.features),
|
||||||
limits: createGPUAdapterLimits(inner.limits),
|
limits: createGPUAdapterLimits(inner.limits),
|
||||||
};
|
};
|
||||||
return adapter;
|
return adapter;
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
webidl.assertBranded(this, GPUAdapter);
|
webidl.assertBranded(this, GPUAdapter);
|
||||||
return this[_name];
|
return this[_name];
|
||||||
}
|
}
|
||||||
/** @returns {GPUAdapterFeatures} */
|
/** @returns {GPUSupportedFeatures} */
|
||||||
get features() {
|
get features() {
|
||||||
webidl.assertBranded(this, GPUAdapter);
|
webidl.assertBranded(this, GPUAdapter);
|
||||||
return this[_adapter].features;
|
return this[_adapter].features;
|
||||||
|
@ -245,7 +245,7 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const nonGuaranteedLimits = descriptor.nonGuaranteedLimits ?? [];
|
const nonGuaranteedLimits = descriptor.nonGuaranteedLimits;
|
||||||
// TODO(lucacasonato): validate nonGuaranteedLimits
|
// TODO(lucacasonato): validate nonGuaranteedLimits
|
||||||
|
|
||||||
const { rid, features, limits } = await core.opAsync(
|
const { rid, features, limits } = await core.opAsync(
|
||||||
|
@ -320,16 +320,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get maxTextureDimension1D() {
|
get maxTextureDimension1D() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxTextureDimension1D;
|
||||||
}
|
}
|
||||||
get maxTextureDimension2D() {
|
get maxTextureDimension2D() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxTextureDimension2D;
|
||||||
}
|
}
|
||||||
get maxTextureDimension3D() {
|
get maxTextureDimension3D() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxTextureDimension3D;
|
||||||
}
|
}
|
||||||
get maxTextureArrayLayers() {
|
get maxTextureArrayLayers() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxTextureArrayLayers;
|
||||||
}
|
}
|
||||||
get maxBindGroups() {
|
get maxBindGroups() {
|
||||||
webidl.assertBranded(this, GPUAdapterLimits);
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
@ -368,16 +372,20 @@
|
||||||
return this[_limits].maxUniformBufferBindingSize;
|
return this[_limits].maxUniformBufferBindingSize;
|
||||||
}
|
}
|
||||||
get maxStorageBufferBindingSize() {
|
get maxStorageBufferBindingSize() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxStorageBufferBindingSize;
|
||||||
}
|
}
|
||||||
get maxVertexBuffers() {
|
get maxVertexBuffers() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxVertexBuffers;
|
||||||
}
|
}
|
||||||
get maxVertexAttributes() {
|
get maxVertexAttributes() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxVertexAttributes;
|
||||||
}
|
}
|
||||||
get maxVertexBufferArrayStride() {
|
get maxVertexBufferArrayStride() {
|
||||||
throw new TypeError("Not yet implemented");
|
webidl.assertBranded(this, GPUAdapterLimits);
|
||||||
|
return this[_limits].maxVertexBufferArrayStride;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Symbol.for("Deno.customInspect")](inspect) {
|
[Symbol.for("Deno.customInspect")](inspect) {
|
||||||
|
@ -387,14 +395,14 @@
|
||||||
|
|
||||||
const _features = Symbol("[[features]]");
|
const _features = Symbol("[[features]]");
|
||||||
|
|
||||||
function createGPUAdapterFeatures(features) {
|
function createGPUSupportedFeatures(features) {
|
||||||
/** @type {GPUAdapterFeatures} */
|
/** @type {GPUSupportedFeatures} */
|
||||||
const adapterFeatures = webidl.createBranded(GPUAdapterFeatures);
|
const adapterFeatures = webidl.createBranded(GPUSupportedFeatures);
|
||||||
adapterFeatures[_features] = new Set(features);
|
adapterFeatures[_features] = new Set(features);
|
||||||
return adapterFeatures;
|
return adapterFeatures;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GPUAdapterFeatures {
|
class GPUSupportedFeatures {
|
||||||
/** @type {Set<string>} */
|
/** @type {Set<string>} */
|
||||||
[_features];
|
[_features];
|
||||||
|
|
||||||
|
@ -404,42 +412,42 @@
|
||||||
|
|
||||||
/** @return {IterableIterator<[string, string]>} */
|
/** @return {IterableIterator<[string, string]>} */
|
||||||
entries() {
|
entries() {
|
||||||
webidl.assertBranded(this, GPUAdapterFeatures);
|
webidl.assertBranded(this, GPUSupportedFeatures);
|
||||||
return this[_features].entries();
|
return this[_features].entries();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {void} */
|
/** @return {void} */
|
||||||
forEach(callbackfn, thisArg) {
|
forEach(callbackfn, thisArg) {
|
||||||
webidl.assertBranded(this, GPUAdapterFeatures);
|
webidl.assertBranded(this, GPUSupportedFeatures);
|
||||||
this[_features].forEach(callbackfn, thisArg);
|
this[_features].forEach(callbackfn, thisArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {boolean} */
|
/** @return {boolean} */
|
||||||
has(value) {
|
has(value) {
|
||||||
webidl.assertBranded(this, GPUAdapterFeatures);
|
webidl.assertBranded(this, GPUSupportedFeatures);
|
||||||
return this[_features].has(value);
|
return this[_features].has(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {IterableIterator<string>} */
|
/** @return {IterableIterator<string>} */
|
||||||
keys() {
|
keys() {
|
||||||
webidl.assertBranded(this, GPUAdapterFeatures);
|
webidl.assertBranded(this, GPUSupportedFeatures);
|
||||||
return this[_features].keys();
|
return this[_features].keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {IterableIterator<string>} */
|
/** @return {IterableIterator<string>} */
|
||||||
values() {
|
values() {
|
||||||
webidl.assertBranded(this, GPUAdapterFeatures);
|
webidl.assertBranded(this, GPUSupportedFeatures);
|
||||||
return this[_features].values();
|
return this[_features].values();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {number} */
|
/** @return {number} */
|
||||||
get size() {
|
get size() {
|
||||||
webidl.assertBranded(this, GPUAdapterFeatures);
|
webidl.assertBranded(this, GPUSupportedFeatures);
|
||||||
return this[_features].size;
|
return this[_features].size;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Symbol.iterator]() {
|
[Symbol.iterator]() {
|
||||||
webidl.assertBranded(this, GPUAdapterFeatures);
|
webidl.assertBranded(this, GPUSupportedFeatures);
|
||||||
return this[_features][Symbol.iterator]();
|
return this[_features][Symbol.iterator]();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,10 +669,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get adapter() {
|
|
||||||
webidl.assertBranded(this, GPUDevice);
|
|
||||||
return this[_device].adapter;
|
|
||||||
}
|
|
||||||
get features() {
|
get features() {
|
||||||
webidl.assertBranded(this, GPUDevice);
|
webidl.assertBranded(this, GPUDevice);
|
||||||
return this[_device].features;
|
return this[_device].features;
|
||||||
|
@ -1291,7 +1295,6 @@
|
||||||
[Symbol.for("Deno.customInspect")](inspect) {
|
[Symbol.for("Deno.customInspect")](inspect) {
|
||||||
return `${this.constructor.name} ${
|
return `${this.constructor.name} ${
|
||||||
inspect({
|
inspect({
|
||||||
adapter: this.adapter,
|
|
||||||
features: this.features,
|
features: this.features,
|
||||||
label: this.label,
|
label: this.label,
|
||||||
limits: this.limits,
|
limits: this.limits,
|
||||||
|
@ -1693,41 +1696,7 @@
|
||||||
if (size === undefined) {
|
if (size === undefined) {
|
||||||
rangeSize = Math.max(0, this[_size] - offset);
|
rangeSize = Math.max(0, this[_size] - offset);
|
||||||
} else {
|
} else {
|
||||||
rangeSize = this[_size];
|
rangeSize = size;
|
||||||
}
|
|
||||||
if (this[_state] !== "mapped" && this[_state] !== "mapped at creation") {
|
|
||||||
throw new DOMException(
|
|
||||||
`${prefix}: buffer is not mapped.`,
|
|
||||||
"OperationError",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ((offset % 8) !== 0) {
|
|
||||||
throw new DOMException(
|
|
||||||
`${prefix}: offset must be a multiple of 8.`,
|
|
||||||
"OperationError",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ((rangeSize % 4) !== 0) {
|
|
||||||
throw new DOMException(
|
|
||||||
`${prefix}: rangeSize must be a multiple of 4.`,
|
|
||||||
"OperationError",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const mappingRange = this[_mappingRange];
|
|
||||||
if (!mappingRange) {
|
|
||||||
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
|
|
||||||
}
|
|
||||||
if (offset < mappingRange[0]) {
|
|
||||||
throw new DOMException(
|
|
||||||
`${prefix}: offset is out of bounds.`,
|
|
||||||
"OperationError",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ((offset + rangeSize) > mappingRange[1]) {
|
|
||||||
throw new DOMException(
|
|
||||||
`${prefix}: offset is out of bounds.`,
|
|
||||||
"OperationError",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
const mappedRanges = this[_mappedRanges];
|
const mappedRanges = this[_mappedRanges];
|
||||||
if (!mappedRanges) {
|
if (!mappedRanges) {
|
||||||
|
@ -1752,8 +1721,8 @@
|
||||||
"op_webgpu_buffer_get_mapped_range",
|
"op_webgpu_buffer_get_mapped_range",
|
||||||
{
|
{
|
||||||
bufferRid,
|
bufferRid,
|
||||||
offset: offset - mappingRange[0],
|
offset,
|
||||||
size: rangeSize,
|
size,
|
||||||
},
|
},
|
||||||
new Uint8Array(buffer),
|
new Uint8Array(buffer),
|
||||||
);
|
);
|
||||||
|
@ -3324,10 +3293,10 @@
|
||||||
/**
|
/**
|
||||||
* @param {GPUColor} color
|
* @param {GPUColor} color
|
||||||
*/
|
*/
|
||||||
setBlendColor(color) {
|
setBlendConstant(color) {
|
||||||
webidl.assertBranded(this, GPURenderPassEncoder);
|
webidl.assertBranded(this, GPURenderPassEncoder);
|
||||||
const prefix =
|
const prefix =
|
||||||
"Failed to execute 'setBlendColor' on 'GPUComputePassEncoder'";
|
"Failed to execute 'setBlendConstant' on 'GPUComputePassEncoder'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
color = webidl.converters.GPUColor(color, {
|
color = webidl.converters.GPUColor(color, {
|
||||||
prefix,
|
prefix,
|
||||||
|
@ -3342,7 +3311,7 @@
|
||||||
context: "encoder referenced by this",
|
context: "encoder referenced by this",
|
||||||
});
|
});
|
||||||
const renderPassRid = assertResource(this, { prefix, context: "this" });
|
const renderPassRid = assertResource(this, { prefix, context: "this" });
|
||||||
core.opSync("op_webgpu_render_pass_set_blend_color", {
|
core.opSync("op_webgpu_render_pass_set_blend_constant", {
|
||||||
renderPassRid,
|
renderPassRid,
|
||||||
color: normalizeGPUColor(color),
|
color: normalizeGPUColor(color),
|
||||||
});
|
});
|
||||||
|
@ -5017,7 +4986,7 @@
|
||||||
GPU,
|
GPU,
|
||||||
GPUAdapter,
|
GPUAdapter,
|
||||||
GPUAdapterLimits,
|
GPUAdapterLimits,
|
||||||
GPUAdapterFeatures,
|
GPUSupportedFeatures,
|
||||||
GPUDevice,
|
GPUDevice,
|
||||||
GPUQueue,
|
GPUQueue,
|
||||||
GPUBuffer,
|
GPUBuffer,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
GPU,
|
GPU,
|
||||||
GPUAdapter,
|
GPUAdapter,
|
||||||
GPUAdapterLimits,
|
GPUAdapterLimits,
|
||||||
GPUAdapterFeatures,
|
GPUSupportedFeatures,
|
||||||
GPUDevice,
|
GPUDevice,
|
||||||
GPUQueue,
|
GPUQueue,
|
||||||
GPUBuffer,
|
GPUBuffer,
|
||||||
|
@ -58,10 +58,10 @@
|
||||||
GPUAdapterLimits,
|
GPUAdapterLimits,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUAdapterFeatures
|
// INTERFACE: GPUSupportedFeatures
|
||||||
webidl.converters.GPUAdapterFeatures = webidl.createInterfaceConverter(
|
webidl.converters.GPUSupportedFeatures = webidl.createInterfaceConverter(
|
||||||
"GPUAdapterFeatures",
|
"GPUSupportedFeatures",
|
||||||
GPUAdapterFeatures,
|
GPUSupportedFeatures,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPU
|
// INTERFACE: GPU
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
{
|
{
|
||||||
key: "width",
|
key: "width",
|
||||||
converter: webidl.converters["GPUIntegerCoordinate"],
|
converter: webidl.converters["GPUIntegerCoordinate"],
|
||||||
defaultValue: 1,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "height",
|
key: "height",
|
||||||
|
@ -835,28 +835,6 @@
|
||||||
dictMembersGPUPipelineLayoutDescriptor,
|
dictMembersGPUPipelineLayoutDescriptor,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPUCompilationMessageType
|
|
||||||
webidl.converters["GPUCompilationMessageType"] = webidl.createEnumConverter(
|
|
||||||
"GPUCompilationMessageType",
|
|
||||||
[
|
|
||||||
"error",
|
|
||||||
"warning",
|
|
||||||
"info",
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
// // INTERFACE: GPUCompilationMessage
|
|
||||||
// webidl.converters.GPUCompilationMessage = webidl.createInterfaceConverter(
|
|
||||||
// "GPUCompilationMessage",
|
|
||||||
// GPUCompilationMessage,
|
|
||||||
// );
|
|
||||||
|
|
||||||
// // INTERFACE: GPUCompilationInfo
|
|
||||||
// webidl.converters.GPUCompilationInfo = webidl.createInterfaceConverter(
|
|
||||||
// "GPUCompilationInfo",
|
|
||||||
// GPUCompilationInfo,
|
|
||||||
// );
|
|
||||||
|
|
||||||
// INTERFACE: GPUShaderModule
|
// INTERFACE: GPUShaderModule
|
||||||
webidl.converters.GPUShaderModule = webidl.createInterfaceConverter(
|
webidl.converters.GPUShaderModule = webidl.createInterfaceConverter(
|
||||||
"GPUShaderModule",
|
"GPUShaderModule",
|
||||||
|
@ -891,6 +869,28 @@
|
||||||
dictMembersGPUShaderModuleDescriptor,
|
dictMembersGPUShaderModuleDescriptor,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// // ENUM: GPUCompilationMessageType
|
||||||
|
// webidl.converters["GPUCompilationMessageType"] = webidl.createEnumConverter(
|
||||||
|
// "GPUCompilationMessageType",
|
||||||
|
// [
|
||||||
|
// "error",
|
||||||
|
// "warning",
|
||||||
|
// "info",
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
|
||||||
|
// // INTERFACE: GPUCompilationMessage
|
||||||
|
// webidl.converters.GPUCompilationMessage = webidl.createInterfaceConverter(
|
||||||
|
// "GPUCompilationMessage",
|
||||||
|
// GPUCompilationMessage,
|
||||||
|
// );
|
||||||
|
|
||||||
|
// // INTERFACE: GPUCompilationInfo
|
||||||
|
// webidl.converters.GPUCompilationInfo = webidl.createInterfaceConverter(
|
||||||
|
// "GPUCompilationInfo",
|
||||||
|
// GPUCompilationInfo,
|
||||||
|
// );
|
||||||
|
|
||||||
// DICTIONARY: GPUPipelineDescriptorBase
|
// DICTIONARY: GPUPipelineDescriptorBase
|
||||||
const dictMembersGPUPipelineDescriptorBase = [
|
const dictMembersGPUPipelineDescriptorBase = [
|
||||||
{ key: "layout", converter: webidl.converters["GPUPipelineLayout"] },
|
{ key: "layout", converter: webidl.converters["GPUPipelineLayout"] },
|
||||||
|
@ -960,36 +960,36 @@
|
||||||
webidl.converters["GPUVertexFormat"] = webidl.createEnumConverter(
|
webidl.converters["GPUVertexFormat"] = webidl.createEnumConverter(
|
||||||
"GPUVertexFormat",
|
"GPUVertexFormat",
|
||||||
[
|
[
|
||||||
"uchar2",
|
"uint8x2",
|
||||||
"uchar4",
|
"uint8x4",
|
||||||
"char2",
|
"sint8x2",
|
||||||
"char4",
|
"sint8x4",
|
||||||
"uchar2norm",
|
"unorm8x2",
|
||||||
"uchar4norm",
|
"unorm8x4",
|
||||||
"char2norm",
|
"snorm8x2",
|
||||||
"char4norm",
|
"snorm8x4",
|
||||||
"ushort2",
|
"uint16x2",
|
||||||
"ushort4",
|
"uint16x4",
|
||||||
"short2",
|
"sint16x2",
|
||||||
"short4",
|
"sint16x4",
|
||||||
"ushort2norm",
|
"unorm16x2",
|
||||||
"ushort4norm",
|
"unorm16x4",
|
||||||
"short2norm",
|
"snorm16x2",
|
||||||
"short4norm",
|
"snorm16x4",
|
||||||
"half2",
|
"float16x2",
|
||||||
"half4",
|
"float16x4",
|
||||||
"float",
|
"float32",
|
||||||
"float2",
|
"float32x2",
|
||||||
"float3",
|
"float32x3",
|
||||||
"float4",
|
"float32x4",
|
||||||
"uint",
|
"uint32",
|
||||||
"uint2",
|
"uint32x2",
|
||||||
"uint3",
|
"uint32x3",
|
||||||
"uint4",
|
"uint32x4",
|
||||||
"int",
|
"sint32",
|
||||||
"int2",
|
"sint32x2",
|
||||||
"int3",
|
"sint32x3",
|
||||||
"int4",
|
"sint32x4",
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1116,6 +1116,11 @@
|
||||||
converter: webidl.converters["GPUCullMode"],
|
converter: webidl.converters["GPUCullMode"],
|
||||||
defaultValue: "none",
|
defaultValue: "none",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "clampDepth",
|
||||||
|
converter: webidl.converters["boolean"],
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
webidl.converters["GPUPrimitiveState"] = webidl.createDictionaryConverter(
|
webidl.converters["GPUPrimitiveState"] = webidl.createDictionaryConverter(
|
||||||
"GPUPrimitiveState",
|
"GPUPrimitiveState",
|
||||||
|
@ -1229,11 +1234,6 @@
|
||||||
converter: webidl.converters["float"],
|
converter: webidl.converters["float"],
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: "clampDepth",
|
|
||||||
converter: webidl.converters["boolean"],
|
|
||||||
defaultValue: false,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
webidl.converters["GPUDepthStencilState"] = webidl.createDictionaryConverter(
|
webidl.converters["GPUDepthStencilState"] = webidl.createDictionaryConverter(
|
||||||
"GPUDepthStencilState",
|
"GPUDepthStencilState",
|
||||||
|
@ -1273,17 +1273,17 @@
|
||||||
[
|
[
|
||||||
"zero",
|
"zero",
|
||||||
"one",
|
"one",
|
||||||
"src-color",
|
"src",
|
||||||
"one-minus-src-color",
|
"one-minus-src",
|
||||||
"src-alpha",
|
"src-alpha",
|
||||||
"one-minus-src-alpha",
|
"one-minus-src-alpha",
|
||||||
"dst-color",
|
"dst",
|
||||||
"one-minus-dst-color",
|
"one-minus-dst",
|
||||||
"dst-alpha",
|
"dst-alpha",
|
||||||
"one-minus-dst-alpha",
|
"one-minus-dst-alpha",
|
||||||
"src-alpha-saturated",
|
"src-alpha-saturated",
|
||||||
"blend-color",
|
"constant",
|
||||||
"one-minus-blend-color",
|
"one-minus-constant",
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1559,6 +1559,44 @@
|
||||||
dictMembersGPUImageCopyTexture,
|
dictMembersGPUImageCopyTexture,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// DICTIONARY: GPUOrigin2DDict
|
||||||
|
const dictMembersGPUOrigin2DDict = [
|
||||||
|
{
|
||||||
|
key: "x",
|
||||||
|
converter: webidl.converters["GPUIntegerCoordinate"],
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "y",
|
||||||
|
converter: webidl.converters["GPUIntegerCoordinate"],
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
webidl.converters["GPUOrigin2DDict"] = webidl.createDictionaryConverter(
|
||||||
|
"GPUOrigin2DDict",
|
||||||
|
dictMembersGPUOrigin2DDict,
|
||||||
|
);
|
||||||
|
|
||||||
|
// TYPEDEF: GPUOrigin2D
|
||||||
|
webidl.converters["GPUOrigin2D"] = (V, opts) => {
|
||||||
|
// Union for (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict)
|
||||||
|
if (V === null || V === undefined) {
|
||||||
|
return webidl.converters["GPUOrigin2DDict"](V, opts);
|
||||||
|
}
|
||||||
|
if (typeof V === "object") {
|
||||||
|
const method = V[Symbol.iterator];
|
||||||
|
if (method !== undefined) {
|
||||||
|
return webidl.converters["sequence<GPUIntegerCoordinate>"](V, opts);
|
||||||
|
}
|
||||||
|
return webidl.converters["GPUOrigin2DDict"](V, opts);
|
||||||
|
}
|
||||||
|
throw webidl.makeException(
|
||||||
|
TypeError,
|
||||||
|
"can not be converted to sequence<GPUIntegerCoordinate> or GPUOrigin2DDict.",
|
||||||
|
opts,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
// INTERFACE: GPUComputePassEncoder
|
// INTERFACE: GPUComputePassEncoder
|
||||||
webidl.converters.GPUComputePassEncoder = webidl.createInterfaceConverter(
|
webidl.converters.GPUComputePassEncoder = webidl.createInterfaceConverter(
|
||||||
"GPUComputePassEncoder",
|
"GPUComputePassEncoder",
|
||||||
|
@ -1615,8 +1653,9 @@
|
||||||
"can not be converted to sequence<double> or GPUColorDict.",
|
"can not be converted to sequence<double> or GPUColorDict.",
|
||||||
opts,
|
opts,
|
||||||
);
|
);
|
||||||
}; // ENUM: GPUStoreOp
|
};
|
||||||
|
|
||||||
|
// ENUM: GPUStoreOp
|
||||||
webidl.converters["GPUStoreOp"] = webidl.createEnumConverter("GPUStoreOp", [
|
webidl.converters["GPUStoreOp"] = webidl.createEnumConverter("GPUStoreOp", [
|
||||||
"store",
|
"store",
|
||||||
"clear",
|
"clear",
|
||||||
|
@ -1638,7 +1677,7 @@
|
||||||
{
|
{
|
||||||
key: "storeOp",
|
key: "storeOp",
|
||||||
converter: webidl.converters["GPUStoreOp"],
|
converter: webidl.converters["GPUStoreOp"],
|
||||||
defaultValue: "store",
|
required: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
webidl.converters["GPURenderPassColorAttachment"] = webidl
|
webidl.converters["GPURenderPassColorAttachment"] = webidl
|
||||||
|
@ -1885,42 +1924,4 @@
|
||||||
|
|
||||||
// TYPEDEF: GPUFlagsConstant
|
// TYPEDEF: GPUFlagsConstant
|
||||||
webidl.converters["GPUFlagsConstant"] = webidl.converters["unsigned long"];
|
webidl.converters["GPUFlagsConstant"] = webidl.converters["unsigned long"];
|
||||||
|
|
||||||
// DICTIONARY: GPUOrigin2DDict
|
|
||||||
const dictMembersGPUOrigin2DDict = [
|
|
||||||
{
|
|
||||||
key: "x",
|
|
||||||
converter: webidl.converters["GPUIntegerCoordinate"],
|
|
||||||
defaultValue: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "y",
|
|
||||||
converter: webidl.converters["GPUIntegerCoordinate"],
|
|
||||||
defaultValue: 0,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
webidl.converters["GPUOrigin2DDict"] = webidl.createDictionaryConverter(
|
|
||||||
"GPUOrigin2DDict",
|
|
||||||
dictMembersGPUOrigin2DDict,
|
|
||||||
);
|
|
||||||
|
|
||||||
// TYPEDEF: GPUOrigin2D
|
|
||||||
webidl.converters["GPUOrigin2D"] = (V, opts) => {
|
|
||||||
// Union for (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict)
|
|
||||||
if (V === null || V === undefined) {
|
|
||||||
return webidl.converters["GPUOrigin2DDict"](V, opts);
|
|
||||||
}
|
|
||||||
if (typeof V === "object") {
|
|
||||||
const method = V[Symbol.iterator];
|
|
||||||
if (method !== undefined) {
|
|
||||||
return webidl.converters["sequence<GPUIntegerCoordinate>"](V, opts);
|
|
||||||
}
|
|
||||||
return webidl.converters["GPUOrigin2DDict"](V, opts);
|
|
||||||
}
|
|
||||||
throw webidl.makeException(
|
|
||||||
TypeError,
|
|
||||||
"can not be converted to sequence<GPUIntegerCoordinate> or GPUOrigin2DDict.",
|
|
||||||
opts,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -17,5 +17,5 @@ path = "lib.rs"
|
||||||
deno_core = { version = "0.86.0", path = "../../core" }
|
deno_core = { version = "0.86.0", path = "../../core" }
|
||||||
tokio = { version = "1.4.0", features = ["full"] }
|
tokio = { version = "1.4.0", features = ["full"] }
|
||||||
serde = { version = "1.0.125", features = ["derive"] }
|
serde = { version = "1.0.125", features = ["derive"] }
|
||||||
wgpu-core = { version = "0.7.0", features = ["trace"] }
|
wgpu-core = { version = "0.8.0", features = ["trace"] }
|
||||||
wgpu-types = "0.7.0"
|
wgpu-types = "0.8.0"
|
||||||
|
|
|
@ -131,7 +131,7 @@ pub fn op_webgpu_create_bind_group_layout(
|
||||||
comparison: false,
|
comparison: false,
|
||||||
},
|
},
|
||||||
"comparison" => wgpu_types::BindingType::Sampler {
|
"comparison" => wgpu_types::BindingType::Sampler {
|
||||||
filtering: false,
|
filtering: true,
|
||||||
comparison: true,
|
comparison: true,
|
||||||
},
|
},
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
|
@ -163,7 +163,7 @@ pub async fn op_webgpu_buffer_get_map_async(
|
||||||
pub struct BufferGetMappedRangeArgs {
|
pub struct BufferGetMappedRangeArgs {
|
||||||
buffer_rid: ResourceId,
|
buffer_rid: ResourceId,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
size: u64,
|
size: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_buffer_get_mapped_range(
|
pub fn op_webgpu_buffer_get_mapped_range(
|
||||||
|
@ -179,21 +179,22 @@ pub fn op_webgpu_buffer_get_mapped_range(
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
let buffer = buffer_resource.0;
|
let buffer = buffer_resource.0;
|
||||||
|
|
||||||
let slice_pointer = gfx_select!(buffer => instance.buffer_get_mapped_range(
|
let (slice_pointer, range_size) =
|
||||||
buffer,
|
gfx_select!(buffer => instance.buffer_get_mapped_range(
|
||||||
args.offset,
|
buffer,
|
||||||
std::num::NonZeroU64::new(args.size)
|
args.offset,
|
||||||
))
|
std::num::NonZeroU64::new(args.size.unwrap_or(0))
|
||||||
.map_err(|e| DomExceptionOperationError::new(&e.to_string()))?;
|
))
|
||||||
|
.map_err(|e| DomExceptionOperationError::new(&e.to_string()))?;
|
||||||
|
|
||||||
let slice = unsafe {
|
let slice = unsafe {
|
||||||
std::slice::from_raw_parts_mut(slice_pointer, args.size as usize)
|
std::slice::from_raw_parts_mut(slice_pointer, range_size as usize)
|
||||||
};
|
};
|
||||||
zero_copy.copy_from_slice(slice);
|
zero_copy.copy_from_slice(slice);
|
||||||
|
|
||||||
let rid = state
|
let rid = state
|
||||||
.resource_table
|
.resource_table
|
||||||
.add(WebGpuBufferMapped(slice_pointer, args.size as usize));
|
.add(WebGpuBufferMapped(slice_pointer, range_size as usize));
|
||||||
|
|
||||||
Ok(WebGpuResult::rid(rid))
|
Ok(WebGpuResult::rid(rid))
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,11 +222,9 @@ pub fn op_webgpu_render_bundle_encoder_pop_debug_group(
|
||||||
.get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
|
.get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
unsafe {
|
wgpu_core::command::bundle_ffi::wgpu_render_bundle_pop_debug_group(
|
||||||
wgpu_core::command::bundle_ffi::wgpu_render_bundle_pop_debug_group(
|
&mut render_bundle_encoder_resource.0.borrow_mut(),
|
||||||
&mut render_bundle_encoder_resource.0.borrow_mut(),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(WebGpuResult::empty())
|
Ok(WebGpuResult::empty())
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::num::NonZeroU32;
|
||||||
|
|
||||||
use super::error::WebGpuResult;
|
use super::error::WebGpuResult;
|
||||||
|
|
||||||
|
@ -120,8 +121,8 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
|
||||||
.get::<super::texture::WebGpuTextureView>(color_attachment.view)
|
.get::<super::texture::WebGpuTextureView>(color_attachment.view)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
let attachment = wgpu_core::command::ColorAttachmentDescriptor {
|
let attachment = wgpu_core::command::RenderPassColorAttachment {
|
||||||
attachment: texture_view_resource.0,
|
view: texture_view_resource.0,
|
||||||
resolve_target: color_attachment
|
resolve_target: color_attachment
|
||||||
.resolve_target
|
.resolve_target
|
||||||
.map(|rid| {
|
.map(|rid| {
|
||||||
|
@ -173,8 +174,8 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
depth_stencil_attachment =
|
depth_stencil_attachment =
|
||||||
Some(wgpu_core::command::DepthStencilAttachmentDescriptor {
|
Some(wgpu_core::command::RenderPassDepthStencilAttachment {
|
||||||
attachment: texture_view_resource.0,
|
view: texture_view_resource.0,
|
||||||
depth: match attachment.depth_load_op.as_str() {
|
depth: match attachment.depth_load_op.as_str() {
|
||||||
"load" => wgpu_core::command::PassChannel {
|
"load" => wgpu_core::command::PassChannel {
|
||||||
load_op: wgpu_core::command::LoadOp::Load,
|
load_op: wgpu_core::command::LoadOp::Load,
|
||||||
|
@ -361,15 +362,15 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
|
||||||
.get::<super::texture::WebGpuTexture>(args.destination.texture)
|
.get::<super::texture::WebGpuTexture>(args.destination.texture)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
let source = wgpu_core::command::BufferCopyView {
|
let source = wgpu_core::command::ImageCopyBuffer {
|
||||||
buffer: source_buffer_resource.0,
|
buffer: source_buffer_resource.0,
|
||||||
layout: wgpu_types::TextureDataLayout {
|
layout: wgpu_types::ImageDataLayout {
|
||||||
offset: args.source.offset.unwrap_or(0),
|
offset: args.source.offset.unwrap_or(0),
|
||||||
bytes_per_row: args.source.bytes_per_row.unwrap_or(0),
|
bytes_per_row: NonZeroU32::new(args.source.bytes_per_row.unwrap_or(0)),
|
||||||
rows_per_image: args.source.rows_per_image.unwrap_or(0),
|
rows_per_image: NonZeroU32::new(args.source.rows_per_image.unwrap_or(0)),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let destination = wgpu_core::command::TextureCopyView {
|
let destination = wgpu_core::command::ImageCopyTexture {
|
||||||
texture: destination_texture_resource.0,
|
texture: destination_texture_resource.0,
|
||||||
mip_level: args.destination.mip_level.unwrap_or(0),
|
mip_level: args.destination.mip_level.unwrap_or(0),
|
||||||
origin: args
|
origin: args
|
||||||
|
@ -388,7 +389,7 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
|
||||||
&wgpu_types::Extent3d {
|
&wgpu_types::Extent3d {
|
||||||
width: args.copy_size.width.unwrap_or(1),
|
width: args.copy_size.width.unwrap_or(1),
|
||||||
height: args.copy_size.height.unwrap_or(1),
|
height: args.copy_size.height.unwrap_or(1),
|
||||||
depth: args.copy_size.depth.unwrap_or(1),
|
depth_or_array_layers: args.copy_size.depth_or_array_layers.unwrap_or(1),
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -422,7 +423,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
|
||||||
.get::<super::buffer::WebGpuBuffer>(args.destination.buffer)
|
.get::<super::buffer::WebGpuBuffer>(args.destination.buffer)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
let source = wgpu_core::command::TextureCopyView {
|
let source = wgpu_core::command::ImageCopyTexture {
|
||||||
texture: source_texture_resource.0,
|
texture: source_texture_resource.0,
|
||||||
mip_level: args.source.mip_level.unwrap_or(0),
|
mip_level: args.source.mip_level.unwrap_or(0),
|
||||||
origin: args.source.origin.map_or(Default::default(), |origin| {
|
origin: args.source.origin.map_or(Default::default(), |origin| {
|
||||||
|
@ -433,12 +434,16 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let destination = wgpu_core::command::BufferCopyView {
|
let destination = wgpu_core::command::ImageCopyBuffer {
|
||||||
buffer: destination_buffer_resource.0,
|
buffer: destination_buffer_resource.0,
|
||||||
layout: wgpu_types::TextureDataLayout {
|
layout: wgpu_types::ImageDataLayout {
|
||||||
offset: args.destination.offset.unwrap_or(0),
|
offset: args.destination.offset.unwrap_or(0),
|
||||||
bytes_per_row: args.destination.bytes_per_row.unwrap_or(0),
|
bytes_per_row: NonZeroU32::new(
|
||||||
rows_per_image: args.destination.rows_per_image.unwrap_or(0),
|
args.destination.bytes_per_row.unwrap_or(0),
|
||||||
|
),
|
||||||
|
rows_per_image: NonZeroU32::new(
|
||||||
|
args.destination.rows_per_image.unwrap_or(0),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
gfx_ok!(command_encoder => instance.command_encoder_copy_texture_to_buffer(
|
gfx_ok!(command_encoder => instance.command_encoder_copy_texture_to_buffer(
|
||||||
|
@ -448,7 +453,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
|
||||||
&wgpu_types::Extent3d {
|
&wgpu_types::Extent3d {
|
||||||
width: args.copy_size.width.unwrap_or(1),
|
width: args.copy_size.width.unwrap_or(1),
|
||||||
height: args.copy_size.height.unwrap_or(1),
|
height: args.copy_size.height.unwrap_or(1),
|
||||||
depth: args.copy_size.depth.unwrap_or(1),
|
depth_or_array_layers: args.copy_size.depth_or_array_layers.unwrap_or(1),
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -482,7 +487,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
|
||||||
.get::<super::texture::WebGpuTexture>(args.destination.texture)
|
.get::<super::texture::WebGpuTexture>(args.destination.texture)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
let source = wgpu_core::command::TextureCopyView {
|
let source = wgpu_core::command::ImageCopyTexture {
|
||||||
texture: source_texture_resource.0,
|
texture: source_texture_resource.0,
|
||||||
mip_level: args.source.mip_level.unwrap_or(0),
|
mip_level: args.source.mip_level.unwrap_or(0),
|
||||||
origin: args.source.origin.map_or(Default::default(), |origin| {
|
origin: args.source.origin.map_or(Default::default(), |origin| {
|
||||||
|
@ -493,7 +498,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let destination = wgpu_core::command::TextureCopyView {
|
let destination = wgpu_core::command::ImageCopyTexture {
|
||||||
texture: destination_texture_resource.0,
|
texture: destination_texture_resource.0,
|
||||||
mip_level: args.destination.mip_level.unwrap_or(0),
|
mip_level: args.destination.mip_level.unwrap_or(0),
|
||||||
origin: args
|
origin: args
|
||||||
|
@ -512,7 +517,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
|
||||||
&wgpu_types::Extent3d {
|
&wgpu_types::Extent3d {
|
||||||
width: args.copy_size.width.unwrap_or(1),
|
width: args.copy_size.width.unwrap_or(1),
|
||||||
height: args.copy_size.height.unwrap_or(1),
|
height: args.copy_size.height.unwrap_or(1),
|
||||||
depth: args.copy_size.depth.unwrap_or(1),
|
depth_or_array_layers: args.copy_size.depth_or_array_layers.unwrap_or(1),
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,13 +132,11 @@ pub fn op_webgpu_compute_pass_begin_pipeline_statistics_query(
|
||||||
.get::<super::WebGpuQuerySet>(args.query_set)
|
.get::<super::WebGpuQuerySet>(args.query_set)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
unsafe {
|
wgpu_core::command::compute_ffi::wgpu_compute_pass_begin_pipeline_statistics_query(
|
||||||
wgpu_core::command::compute_ffi::wgpu_compute_pass_begin_pipeline_statistics_query(
|
&mut compute_pass_resource.0.borrow_mut(),
|
||||||
&mut compute_pass_resource.0.borrow_mut(),
|
query_set_resource.0,
|
||||||
query_set_resource.0,
|
args.query_index,
|
||||||
args.query_index,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(WebGpuResult::empty())
|
Ok(WebGpuResult::empty())
|
||||||
}
|
}
|
||||||
|
@ -159,11 +157,9 @@ pub fn op_webgpu_compute_pass_end_pipeline_statistics_query(
|
||||||
.get::<WebGpuComputePass>(args.compute_pass_rid)
|
.get::<WebGpuComputePass>(args.compute_pass_rid)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
unsafe {
|
wgpu_core::command::compute_ffi::wgpu_compute_pass_end_pipeline_statistics_query(
|
||||||
wgpu_core::command::compute_ffi::wgpu_compute_pass_end_pipeline_statistics_query(
|
&mut compute_pass_resource.0.borrow_mut(),
|
||||||
&mut compute_pass_resource.0.borrow_mut(),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(WebGpuResult::empty())
|
Ok(WebGpuResult::empty())
|
||||||
}
|
}
|
||||||
|
@ -190,13 +186,11 @@ pub fn op_webgpu_compute_pass_write_timestamp(
|
||||||
.get::<super::WebGpuQuerySet>(args.query_set)
|
.get::<super::WebGpuQuerySet>(args.query_set)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
unsafe {
|
wgpu_core::command::compute_ffi::wgpu_compute_pass_write_timestamp(
|
||||||
wgpu_core::command::compute_ffi::wgpu_compute_pass_write_timestamp(
|
&mut compute_pass_resource.0.borrow_mut(),
|
||||||
&mut compute_pass_resource.0.borrow_mut(),
|
query_set_resource.0,
|
||||||
query_set_resource.0,
|
args.query_index,
|
||||||
args.query_index,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(WebGpuResult::empty())
|
Ok(WebGpuResult::empty())
|
||||||
}
|
}
|
||||||
|
|
89
extensions/webgpu/lib.deno_webgpu.d.ts
vendored
89
extensions/webgpu/lib.deno_webgpu.d.ts
vendored
|
@ -35,7 +35,7 @@ declare class GPUAdapterLimits {
|
||||||
maxVertexBufferArrayStride?: number;
|
maxVertexBufferArrayStride?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class GPUAdapterFeatures {
|
declare class GPUSupportedFeatures {
|
||||||
forEach(
|
forEach(
|
||||||
callbackfn: (
|
callbackfn: (
|
||||||
value: GPUFeatureName,
|
value: GPUFeatureName,
|
||||||
|
@ -69,10 +69,10 @@ declare type GPUPowerPreference = "low-power" | "high-performance";
|
||||||
|
|
||||||
declare class GPUAdapter {
|
declare class GPUAdapter {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly features: GPUAdapterFeatures;
|
readonly features: GPUSupportedFeatures;
|
||||||
readonly limits: GPUAdapterLimits;
|
readonly limits: GPUAdapterLimits;
|
||||||
|
|
||||||
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice | null>;
|
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
|
declare interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
|
||||||
|
@ -114,7 +114,6 @@ declare class GPUDevice extends EventTarget implements GPUObjectBase {
|
||||||
| ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any)
|
| ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any)
|
||||||
| null;
|
| null;
|
||||||
|
|
||||||
readonly adapter: GPUAdapter;
|
|
||||||
readonly features: ReadonlyArray<GPUFeatureName>;
|
readonly features: ReadonlyArray<GPUFeatureName>;
|
||||||
readonly limits: Record<string, number>;
|
readonly limits: Record<string, number>;
|
||||||
readonly queue: GPUQueue;
|
readonly queue: GPUQueue;
|
||||||
|
@ -515,6 +514,7 @@ declare interface GPUPrimitiveState {
|
||||||
stripIndexFormat?: GPUIndexFormat;
|
stripIndexFormat?: GPUIndexFormat;
|
||||||
frontFace?: GPUFrontFace;
|
frontFace?: GPUFrontFace;
|
||||||
cullMode?: GPUCullMode;
|
cullMode?: GPUCullMode;
|
||||||
|
clampDepth?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare type GPUFrontFace = "ccw" | "cw";
|
declare type GPUFrontFace = "ccw" | "cw";
|
||||||
|
@ -561,17 +561,17 @@ declare interface GPUBlendComponent {
|
||||||
declare type GPUBlendFactor =
|
declare type GPUBlendFactor =
|
||||||
| "zero"
|
| "zero"
|
||||||
| "one"
|
| "one"
|
||||||
| "src-color"
|
| "src"
|
||||||
| "one-minus-src-color"
|
| "one-minus-src"
|
||||||
| "src-alpha"
|
| "src-alpha"
|
||||||
| "one-minus-src-alpha"
|
| "one-minus-src-alpha"
|
||||||
| "dst-color"
|
| "dst"
|
||||||
| "one-minus-dst-color"
|
| "one-minus-dst"
|
||||||
| "dst-alpha"
|
| "dst-alpha"
|
||||||
| "one-minus-dst-alpha"
|
| "one-minus-dst-alpha"
|
||||||
| "src-alpha-saturated"
|
| "src-alpha-saturated"
|
||||||
| "blend-color"
|
| "constant"
|
||||||
| "one-minus-blend-color";
|
| "one-minus-constant";
|
||||||
|
|
||||||
declare type GPUBlendOperation =
|
declare type GPUBlendOperation =
|
||||||
| "add"
|
| "add"
|
||||||
|
@ -595,8 +595,6 @@ declare interface GPUDepthStencilState {
|
||||||
depthBias?: number;
|
depthBias?: number;
|
||||||
depthBiasSlopeScale?: number;
|
depthBiasSlopeScale?: number;
|
||||||
depthBiasClamp?: number;
|
depthBiasClamp?: number;
|
||||||
|
|
||||||
clampDepth?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface GPUStencilFaceState {
|
declare interface GPUStencilFaceState {
|
||||||
|
@ -619,37 +617,36 @@ declare type GPUStencilOperation =
|
||||||
declare type GPUIndexFormat = "uint16" | "uint32";
|
declare type GPUIndexFormat = "uint16" | "uint32";
|
||||||
|
|
||||||
declare type GPUVertexFormat =
|
declare type GPUVertexFormat =
|
||||||
| "uchar2"
|
| "uint8x2"
|
||||||
| "uchar4"
|
| "uint8x4"
|
||||||
| "char2"
|
| "sint8x2"
|
||||||
| "char4"
|
| "sint8x4"
|
||||||
| "uchar2norm"
|
| "unorm8x2"
|
||||||
| "uchar4norm"
|
| "unorm8x4"
|
||||||
| "char2norm"
|
| "snorm8x2"
|
||||||
| "char4norm"
|
| "snorm8x4"
|
||||||
| "ushort2"
|
| "uint16x2"
|
||||||
| "ushort4"
|
| "uint16x4"
|
||||||
| "short2"
|
| "sint16x2"
|
||||||
| "short4"
|
| "sint16x4"
|
||||||
| "ushort2norm"
|
| "unorm16x2"
|
||||||
| "ushort4norm"
|
| "unorm16x4"
|
||||||
| "short2norm"
|
| "snorm16x2"
|
||||||
| "short4norm"
|
| "snorm16x4"
|
||||||
| "half2"
|
| "float16x2"
|
||||||
| "half4"
|
| "float16x4"
|
||||||
| "float"
|
| "float32"
|
||||||
| "float2"
|
| "float32x2"
|
||||||
| "float3"
|
| "float32x3"
|
||||||
| "float4"
|
| "float32x4"
|
||||||
| "uint"
|
| "uint32"
|
||||||
| "uint2"
|
| "uint32x2"
|
||||||
| "uint3"
|
| "uint32x3"
|
||||||
| "uint4"
|
| "uint32x4"
|
||||||
| "int"
|
| "sint32"
|
||||||
| "int2"
|
| "sint32x2"
|
||||||
| "int3"
|
| "sint32x3"
|
||||||
| "int4";
|
| "sint32x4";
|
||||||
|
|
||||||
declare type GPUInputStepMode = "vertex" | "instance";
|
declare type GPUInputStepMode = "vertex" | "instance";
|
||||||
|
|
||||||
declare interface GPUVertexState extends GPUProgrammableStage {
|
declare interface GPUVertexState extends GPUProgrammableStage {
|
||||||
|
@ -910,7 +907,7 @@ declare class GPURenderPassEncoder
|
||||||
height: number,
|
height: number,
|
||||||
): undefined;
|
): undefined;
|
||||||
|
|
||||||
setBlendColor(color: GPUColor): undefined;
|
setBlendConstant(color: GPUColor): undefined;
|
||||||
setStencilReference(reference: number): undefined;
|
setStencilReference(reference: number): undefined;
|
||||||
|
|
||||||
beginOcclusionQuery(queryIndex: number): undefined;
|
beginOcclusionQuery(queryIndex: number): undefined;
|
||||||
|
@ -1118,9 +1115,9 @@ declare interface GPUOrigin3DDict {
|
||||||
declare type GPUOrigin3D = number[] | GPUOrigin3DDict;
|
declare type GPUOrigin3D = number[] | GPUOrigin3DDict;
|
||||||
|
|
||||||
declare interface GPUExtent3DDict {
|
declare interface GPUExtent3DDict {
|
||||||
width?: number;
|
width: number;
|
||||||
height?: number;
|
height?: number;
|
||||||
depth?: number;
|
depthOrArrayLayers?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare type GPUExtent3D = number[] | GPUExtent3DDict;
|
declare type GPUExtent3D = number[] | GPUExtent3DDict;
|
||||||
|
|
|
@ -291,10 +291,10 @@ pub async fn op_webgpu_request_adapter(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct GpuLimits {
|
struct GpuLimits {
|
||||||
_max_texture_dimension1d: Option<u32>,
|
max_texture_dimension_1d: Option<u32>,
|
||||||
_max_texture_dimension2d: Option<u32>,
|
max_texture_dimension_2d: Option<u32>,
|
||||||
_max_texture_dimension3d: Option<u32>,
|
max_texture_dimension_3d: Option<u32>,
|
||||||
_max_texture_array_layers: Option<u32>,
|
max_texture_array_layers: Option<u32>,
|
||||||
max_bind_groups: Option<u32>,
|
max_bind_groups: Option<u32>,
|
||||||
max_dynamic_uniform_buffers_per_pipeline_layout: Option<u32>,
|
max_dynamic_uniform_buffers_per_pipeline_layout: Option<u32>,
|
||||||
max_dynamic_storage_buffers_per_pipeline_layout: Option<u32>,
|
max_dynamic_storage_buffers_per_pipeline_layout: Option<u32>,
|
||||||
|
@ -304,10 +304,55 @@ struct GpuLimits {
|
||||||
max_storage_textures_per_shader_stage: Option<u32>,
|
max_storage_textures_per_shader_stage: Option<u32>,
|
||||||
max_uniform_buffers_per_shader_stage: Option<u32>,
|
max_uniform_buffers_per_shader_stage: Option<u32>,
|
||||||
max_uniform_buffer_binding_size: Option<u32>,
|
max_uniform_buffer_binding_size: Option<u32>,
|
||||||
_max_storage_buffer_binding_size: Option<u32>,
|
max_storage_buffer_binding_size: Option<u32>,
|
||||||
_max_vertex_buffers: Option<u32>,
|
max_vertex_buffers: Option<u32>,
|
||||||
_max_vertex_attributes: Option<u32>,
|
max_vertex_attributes: Option<u32>,
|
||||||
_max_vertex_buffer_array_stride: Option<u32>,
|
max_vertex_buffer_array_stride: Option<u32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<GpuLimits> for wgpu_types::Limits {
|
||||||
|
fn from(limits: GpuLimits) -> wgpu_types::Limits {
|
||||||
|
wgpu_types::Limits {
|
||||||
|
max_texture_dimension_1d: limits.max_texture_dimension_1d.unwrap_or(8192),
|
||||||
|
max_texture_dimension_2d: limits.max_texture_dimension_2d.unwrap_or(8192),
|
||||||
|
max_texture_dimension_3d: limits.max_texture_dimension_3d.unwrap_or(2048),
|
||||||
|
max_texture_array_layers: limits.max_texture_array_layers.unwrap_or(2048),
|
||||||
|
max_bind_groups: limits.max_bind_groups.unwrap_or(4),
|
||||||
|
max_dynamic_uniform_buffers_per_pipeline_layout: limits
|
||||||
|
.max_dynamic_uniform_buffers_per_pipeline_layout
|
||||||
|
.unwrap_or(8),
|
||||||
|
max_dynamic_storage_buffers_per_pipeline_layout: limits
|
||||||
|
.max_dynamic_storage_buffers_per_pipeline_layout
|
||||||
|
.unwrap_or(4),
|
||||||
|
max_sampled_textures_per_shader_stage: limits
|
||||||
|
.max_sampled_textures_per_shader_stage
|
||||||
|
.unwrap_or(16),
|
||||||
|
max_samplers_per_shader_stage: limits
|
||||||
|
.max_samplers_per_shader_stage
|
||||||
|
.unwrap_or(16),
|
||||||
|
max_storage_buffers_per_shader_stage: limits
|
||||||
|
.max_storage_buffers_per_shader_stage
|
||||||
|
.unwrap_or(4),
|
||||||
|
max_storage_textures_per_shader_stage: limits
|
||||||
|
.max_storage_textures_per_shader_stage
|
||||||
|
.unwrap_or(4),
|
||||||
|
max_uniform_buffers_per_shader_stage: limits
|
||||||
|
.max_uniform_buffers_per_shader_stage
|
||||||
|
.unwrap_or(12),
|
||||||
|
max_uniform_buffer_binding_size: limits
|
||||||
|
.max_uniform_buffer_binding_size
|
||||||
|
.unwrap_or(16384),
|
||||||
|
max_storage_buffer_binding_size: limits
|
||||||
|
.max_storage_buffer_binding_size
|
||||||
|
.unwrap_or(134217728),
|
||||||
|
max_vertex_buffers: limits.max_vertex_buffers.unwrap_or(8),
|
||||||
|
max_vertex_attributes: limits.max_vertex_attributes.unwrap_or(16),
|
||||||
|
max_vertex_buffer_array_stride: limits
|
||||||
|
.max_vertex_buffer_array_stride
|
||||||
|
.unwrap_or(2048),
|
||||||
|
max_push_constant_size: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -416,34 +461,7 @@ pub async fn op_webgpu_request_device(
|
||||||
features,
|
features,
|
||||||
limits: args
|
limits: args
|
||||||
.non_guaranteed_limits
|
.non_guaranteed_limits
|
||||||
.map_or(Default::default(), |limits| wgpu_types::Limits {
|
.map_or(wgpu_types::Limits::default(), Into::into),
|
||||||
max_bind_groups: limits.max_bind_groups.unwrap_or(4),
|
|
||||||
max_dynamic_uniform_buffers_per_pipeline_layout: limits
|
|
||||||
.max_dynamic_uniform_buffers_per_pipeline_layout
|
|
||||||
.unwrap_or(8),
|
|
||||||
max_dynamic_storage_buffers_per_pipeline_layout: limits
|
|
||||||
.max_dynamic_storage_buffers_per_pipeline_layout
|
|
||||||
.unwrap_or(4),
|
|
||||||
max_sampled_textures_per_shader_stage: limits
|
|
||||||
.max_sampled_textures_per_shader_stage
|
|
||||||
.unwrap_or(16),
|
|
||||||
max_samplers_per_shader_stage: limits
|
|
||||||
.max_samplers_per_shader_stage
|
|
||||||
.unwrap_or(16),
|
|
||||||
max_storage_buffers_per_shader_stage: limits
|
|
||||||
.max_storage_buffers_per_shader_stage
|
|
||||||
.unwrap_or(4),
|
|
||||||
max_storage_textures_per_shader_stage: limits
|
|
||||||
.max_storage_textures_per_shader_stage
|
|
||||||
.unwrap_or(4),
|
|
||||||
max_uniform_buffers_per_shader_stage: limits
|
|
||||||
.max_uniform_buffers_per_shader_stage
|
|
||||||
.unwrap_or(12),
|
|
||||||
max_uniform_buffer_binding_size: limits
|
|
||||||
.max_uniform_buffer_binding_size
|
|
||||||
.unwrap_or(16384),
|
|
||||||
max_push_constant_size: 0,
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let (device, maybe_err) = gfx_select!(adapter => instance.adapter_request_device(
|
let (device, maybe_err) = gfx_select!(adapter => instance.adapter_request_device(
|
||||||
|
@ -705,8 +723,8 @@ fn declare_webgpu_ops() -> Vec<(&'static str, Box<OpFn>)> {
|
||||||
op_sync(render_pass::op_webgpu_render_pass_set_scissor_rect),
|
op_sync(render_pass::op_webgpu_render_pass_set_scissor_rect),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"op_webgpu_render_pass_set_blend_color",
|
"op_webgpu_render_pass_set_blend_constant",
|
||||||
op_sync(render_pass::op_webgpu_render_pass_set_blend_color),
|
op_sync(render_pass::op_webgpu_render_pass_set_blend_constant),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"op_webgpu_render_pass_set_stencil_reference",
|
"op_webgpu_render_pass_set_stencil_reference",
|
||||||
|
|
|
@ -97,25 +97,32 @@ fn serialize_blend_factor(blend_factor: &str) -> wgpu_types::BlendFactor {
|
||||||
match blend_factor {
|
match blend_factor {
|
||||||
"zero" => wgpu_types::BlendFactor::Zero,
|
"zero" => wgpu_types::BlendFactor::Zero,
|
||||||
"one" => wgpu_types::BlendFactor::One,
|
"one" => wgpu_types::BlendFactor::One,
|
||||||
"src-color" => wgpu_types::BlendFactor::SrcColor,
|
"src" => wgpu_types::BlendFactor::Src,
|
||||||
"one-minus-src-color" => wgpu_types::BlendFactor::OneMinusSrcColor,
|
"one-minus-src" => wgpu_types::BlendFactor::OneMinusSrc,
|
||||||
"src-alpha" => wgpu_types::BlendFactor::SrcAlpha,
|
"src-alpha" => wgpu_types::BlendFactor::SrcAlpha,
|
||||||
"one-minus-src-alpha" => wgpu_types::BlendFactor::OneMinusSrcAlpha,
|
"one-minus-src-alpha" => wgpu_types::BlendFactor::OneMinusSrcAlpha,
|
||||||
"dst-color" => wgpu_types::BlendFactor::DstColor,
|
"dst" => wgpu_types::BlendFactor::Dst,
|
||||||
"one-minus-dst-color" => wgpu_types::BlendFactor::OneMinusDstColor,
|
"one-minus-dst" => wgpu_types::BlendFactor::OneMinusDst,
|
||||||
"dst-alpha" => wgpu_types::BlendFactor::DstAlpha,
|
"dst-alpha" => wgpu_types::BlendFactor::DstAlpha,
|
||||||
"one-minus-dst-alpha" => wgpu_types::BlendFactor::OneMinusDstAlpha,
|
"one-minus-dst-alpha" => wgpu_types::BlendFactor::OneMinusDstAlpha,
|
||||||
"src-alpha-saturated" => wgpu_types::BlendFactor::SrcAlphaSaturated,
|
"src-alpha-saturated" => wgpu_types::BlendFactor::SrcAlphaSaturated,
|
||||||
"blend-color" => wgpu_types::BlendFactor::BlendColor,
|
"constant" => wgpu_types::BlendFactor::Constant,
|
||||||
"one-minus-blend-color" => wgpu_types::BlendFactor::OneMinusBlendColor,
|
"one-minus-constant" => wgpu_types::BlendFactor::OneMinusConstant,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn serialize_blend_state(state: GpuBlendState) -> wgpu_types::BlendState {
|
||||||
|
wgpu_types::BlendState {
|
||||||
|
alpha: serialize_blend_component(state.alpha),
|
||||||
|
color: serialize_blend_component(state.color),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn serialize_blend_component(
|
fn serialize_blend_component(
|
||||||
blend: GpuBlendComponent,
|
blend: GpuBlendComponent,
|
||||||
) -> wgpu_types::BlendState {
|
) -> wgpu_types::BlendComponent {
|
||||||
wgpu_types::BlendState {
|
wgpu_types::BlendComponent {
|
||||||
src_factor: blend
|
src_factor: blend
|
||||||
.src_factor
|
.src_factor
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -201,7 +208,7 @@ pub fn op_webgpu_create_compute_pipeline(
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (compute_pipeline, _, maybe_err) = gfx_select!(device => instance.device_create_compute_pipeline(
|
let (compute_pipeline, maybe_err) = gfx_select!(device => instance.device_create_compute_pipeline(
|
||||||
device,
|
device,
|
||||||
&descriptor,
|
&descriptor,
|
||||||
std::marker::PhantomData,
|
std::marker::PhantomData,
|
||||||
|
@ -264,6 +271,7 @@ struct GpuPrimitiveState {
|
||||||
strip_index_format: Option<String>,
|
strip_index_format: Option<String>,
|
||||||
front_face: Option<String>,
|
front_face: Option<String>,
|
||||||
cull_mode: Option<String>,
|
cull_mode: Option<String>,
|
||||||
|
clamp_depth: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Clone)]
|
#[derive(Deserialize, Clone)]
|
||||||
|
@ -311,17 +319,97 @@ struct GpuDepthStencilState {
|
||||||
depth_bias: Option<i32>,
|
depth_bias: Option<i32>,
|
||||||
depth_bias_slope_scale: Option<f32>,
|
depth_bias_slope_scale: Option<f32>,
|
||||||
depth_bias_clamp: Option<f32>,
|
depth_bias_clamp: Option<f32>,
|
||||||
clamp_depth: Option<bool>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct GpuVertexAttribute {
|
struct GpuVertexAttribute {
|
||||||
format: String,
|
format: GpuVertexFormat,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
shader_location: u32,
|
shader_location: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(rename_all = "lowercase")]
|
||||||
|
enum GpuVertexFormat {
|
||||||
|
Uint8x2,
|
||||||
|
Uint8x4,
|
||||||
|
Sint8x2,
|
||||||
|
Sint8x4,
|
||||||
|
Unorm8x2,
|
||||||
|
Unorm8x4,
|
||||||
|
Snorm8x2,
|
||||||
|
Snorm8x4,
|
||||||
|
Uint16x2,
|
||||||
|
Uint16x4,
|
||||||
|
Sint16x2,
|
||||||
|
Sint16x4,
|
||||||
|
Unorm16x2,
|
||||||
|
Unorm16x4,
|
||||||
|
Snorm16x2,
|
||||||
|
Snorm16x4,
|
||||||
|
Float16x2,
|
||||||
|
Float16x4,
|
||||||
|
Float32,
|
||||||
|
Float32x2,
|
||||||
|
Float32x3,
|
||||||
|
Float32x4,
|
||||||
|
Uint32,
|
||||||
|
Uint32x2,
|
||||||
|
Uint32x3,
|
||||||
|
Uint32x4,
|
||||||
|
Sint32,
|
||||||
|
Sint32x2,
|
||||||
|
Sint32x3,
|
||||||
|
Sint32x4,
|
||||||
|
Float64,
|
||||||
|
Float64x2,
|
||||||
|
Float64x3,
|
||||||
|
Float64x4,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<GpuVertexFormat> for wgpu_types::VertexFormat {
|
||||||
|
fn from(vf: GpuVertexFormat) -> wgpu_types::VertexFormat {
|
||||||
|
use wgpu_types::VertexFormat;
|
||||||
|
match vf {
|
||||||
|
GpuVertexFormat::Uint8x2 => VertexFormat::Uint8x2,
|
||||||
|
GpuVertexFormat::Uint8x4 => VertexFormat::Uint8x4,
|
||||||
|
GpuVertexFormat::Sint8x2 => VertexFormat::Sint8x2,
|
||||||
|
GpuVertexFormat::Sint8x4 => VertexFormat::Sint8x4,
|
||||||
|
GpuVertexFormat::Unorm8x2 => VertexFormat::Unorm8x2,
|
||||||
|
GpuVertexFormat::Unorm8x4 => VertexFormat::Unorm8x4,
|
||||||
|
GpuVertexFormat::Snorm8x2 => VertexFormat::Snorm8x2,
|
||||||
|
GpuVertexFormat::Snorm8x4 => VertexFormat::Snorm8x4,
|
||||||
|
GpuVertexFormat::Uint16x2 => VertexFormat::Uint16x2,
|
||||||
|
GpuVertexFormat::Uint16x4 => VertexFormat::Uint16x4,
|
||||||
|
GpuVertexFormat::Sint16x2 => VertexFormat::Sint16x2,
|
||||||
|
GpuVertexFormat::Sint16x4 => VertexFormat::Sint16x4,
|
||||||
|
GpuVertexFormat::Unorm16x2 => VertexFormat::Unorm16x2,
|
||||||
|
GpuVertexFormat::Unorm16x4 => VertexFormat::Unorm16x4,
|
||||||
|
GpuVertexFormat::Snorm16x2 => VertexFormat::Snorm16x2,
|
||||||
|
GpuVertexFormat::Snorm16x4 => VertexFormat::Snorm16x4,
|
||||||
|
GpuVertexFormat::Float16x2 => VertexFormat::Float16x2,
|
||||||
|
GpuVertexFormat::Float16x4 => VertexFormat::Float16x4,
|
||||||
|
GpuVertexFormat::Float32 => VertexFormat::Float32,
|
||||||
|
GpuVertexFormat::Float32x2 => VertexFormat::Float32x2,
|
||||||
|
GpuVertexFormat::Float32x3 => VertexFormat::Float32x3,
|
||||||
|
GpuVertexFormat::Float32x4 => VertexFormat::Float32x4,
|
||||||
|
GpuVertexFormat::Uint32 => VertexFormat::Uint32,
|
||||||
|
GpuVertexFormat::Uint32x2 => VertexFormat::Uint32x2,
|
||||||
|
GpuVertexFormat::Uint32x3 => VertexFormat::Uint32x3,
|
||||||
|
GpuVertexFormat::Uint32x4 => VertexFormat::Uint32x4,
|
||||||
|
GpuVertexFormat::Sint32 => VertexFormat::Sint32,
|
||||||
|
GpuVertexFormat::Sint32x2 => VertexFormat::Sint32x2,
|
||||||
|
GpuVertexFormat::Sint32x3 => VertexFormat::Sint32x3,
|
||||||
|
GpuVertexFormat::Sint32x4 => VertexFormat::Sint32x4,
|
||||||
|
GpuVertexFormat::Float64 => VertexFormat::Float64,
|
||||||
|
GpuVertexFormat::Float64x2 => VertexFormat::Float64x2,
|
||||||
|
GpuVertexFormat::Float64x3 => VertexFormat::Float64x3,
|
||||||
|
GpuVertexFormat::Float64x4 => VertexFormat::Float64x4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct GpuVertexBufferLayout {
|
struct GpuVertexBufferLayout {
|
||||||
|
@ -418,41 +506,9 @@ pub fn op_webgpu_create_render_pipeline(
|
||||||
attributes: Cow::from(
|
attributes: Cow::from(
|
||||||
buffer
|
buffer
|
||||||
.attributes
|
.attributes
|
||||||
.iter()
|
.into_iter()
|
||||||
.map(|attribute| wgpu_types::VertexAttribute {
|
.map(|attribute| wgpu_types::VertexAttribute {
|
||||||
format: match attribute.format.as_str() {
|
format: attribute.format.into(),
|
||||||
"uchar2" => wgpu_types::VertexFormat::Uchar2,
|
|
||||||
"uchar4" => wgpu_types::VertexFormat::Uchar4,
|
|
||||||
"char2" => wgpu_types::VertexFormat::Char2,
|
|
||||||
"char4" => wgpu_types::VertexFormat::Char4,
|
|
||||||
"uchar2norm" => wgpu_types::VertexFormat::Uchar2Norm,
|
|
||||||
"uchar4norm" => wgpu_types::VertexFormat::Uchar4,
|
|
||||||
"char2norm" => wgpu_types::VertexFormat::Char2Norm,
|
|
||||||
"char4norm" => wgpu_types::VertexFormat::Char4Norm,
|
|
||||||
"ushort2" => wgpu_types::VertexFormat::Ushort2,
|
|
||||||
"ushort4" => wgpu_types::VertexFormat::Ushort4,
|
|
||||||
"short2" => wgpu_types::VertexFormat::Short2,
|
|
||||||
"short4" => wgpu_types::VertexFormat::Short4,
|
|
||||||
"ushort2norm" => wgpu_types::VertexFormat::Ushort2Norm,
|
|
||||||
"ushort4norm" => wgpu_types::VertexFormat::Ushort4Norm,
|
|
||||||
"short2norm" => wgpu_types::VertexFormat::Short2Norm,
|
|
||||||
"short4norm" => wgpu_types::VertexFormat::Short4Norm,
|
|
||||||
"half2" => wgpu_types::VertexFormat::Half2,
|
|
||||||
"half4" => wgpu_types::VertexFormat::Half4,
|
|
||||||
"float" => wgpu_types::VertexFormat::Float,
|
|
||||||
"float2" => wgpu_types::VertexFormat::Float2,
|
|
||||||
"float3" => wgpu_types::VertexFormat::Float3,
|
|
||||||
"float4" => wgpu_types::VertexFormat::Float4,
|
|
||||||
"uint" => wgpu_types::VertexFormat::Uint,
|
|
||||||
"uint2" => wgpu_types::VertexFormat::Uint2,
|
|
||||||
"uint3" => wgpu_types::VertexFormat::Uint3,
|
|
||||||
"uint4" => wgpu_types::VertexFormat::Uint4,
|
|
||||||
"int" => wgpu_types::VertexFormat::Int,
|
|
||||||
"int2" => wgpu_types::VertexFormat::Int2,
|
|
||||||
"int3" => wgpu_types::VertexFormat::Int3,
|
|
||||||
"int4" => wgpu_types::VertexFormat::Int4,
|
|
||||||
_ => unreachable!(),
|
|
||||||
},
|
|
||||||
offset: attribute.offset,
|
offset: attribute.offset,
|
||||||
shader_location: attribute.shader_location,
|
shader_location: attribute.shader_location,
|
||||||
})
|
})
|
||||||
|
@ -491,14 +547,16 @@ pub fn op_webgpu_create_render_pipeline(
|
||||||
},
|
},
|
||||||
cull_mode: match primitive.cull_mode {
|
cull_mode: match primitive.cull_mode {
|
||||||
Some(cull_mode) => match cull_mode.as_str() {
|
Some(cull_mode) => match cull_mode.as_str() {
|
||||||
"none" => wgpu_types::CullMode::None,
|
"none" => None,
|
||||||
"front" => wgpu_types::CullMode::Front,
|
"front" => Some(wgpu_types::Face::Front),
|
||||||
"back" => wgpu_types::CullMode::Back,
|
"back" => Some(wgpu_types::Face::Back),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
},
|
},
|
||||||
None => wgpu_types::CullMode::None,
|
None => None,
|
||||||
},
|
},
|
||||||
polygon_mode: Default::default(), // native-only
|
polygon_mode: Default::default(), // native-only
|
||||||
|
conservative: false, // native-only
|
||||||
|
clamp_depth: primitive.clamp_depth,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
depth_stencil: args.depth_stencil.map(|depth_stencil| {
|
depth_stencil: args.depth_stencil.map(|depth_stencil| {
|
||||||
|
@ -527,7 +585,6 @@ pub fn op_webgpu_create_render_pipeline(
|
||||||
slope_scale: depth_stencil.depth_bias_slope_scale.unwrap_or(0.0),
|
slope_scale: depth_stencil.depth_bias_slope_scale.unwrap_or(0.0),
|
||||||
clamp: depth_stencil.depth_bias_clamp.unwrap_or(0.0),
|
clamp: depth_stencil.depth_bias_clamp.unwrap_or(0.0),
|
||||||
},
|
},
|
||||||
clamp_depth: depth_stencil.clamp_depth.unwrap_or(false),
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
multisample: args.multisample.map_or(Default::default(), |multisample| {
|
multisample: args.multisample.map_or(Default::default(), |multisample| {
|
||||||
|
@ -554,31 +611,16 @@ pub fn op_webgpu_create_render_pipeline(
|
||||||
targets: Cow::from(
|
targets: Cow::from(
|
||||||
fragment
|
fragment
|
||||||
.targets
|
.targets
|
||||||
.iter()
|
.into_iter()
|
||||||
.map(|target| {
|
.map(|target| wgpu_types::ColorTargetState {
|
||||||
let blends = target.blend.clone().map(|blend| {
|
format: super::texture::serialize_texture_format(&target.format)
|
||||||
(
|
|
||||||
serialize_blend_component(blend.alpha),
|
|
||||||
serialize_blend_component(blend.color),
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
wgpu_types::ColorTargetState {
|
|
||||||
format: super::texture::serialize_texture_format(
|
|
||||||
&target.format,
|
|
||||||
)
|
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
alpha_blend: blends
|
blend: target.blend.map(serialize_blend_state),
|
||||||
.clone()
|
write_mask: target
|
||||||
.map_or(Default::default(), |states| states.0),
|
.write_mask
|
||||||
color_blend: blends
|
.map_or(Default::default(), |mask| {
|
||||||
.map_or(Default::default(), |states| states.1),
|
wgpu_types::ColorWrite::from_bits(mask).unwrap()
|
||||||
write_mask: target
|
}),
|
||||||
.write_mask
|
|
||||||
.map_or(Default::default(), |mask| {
|
|
||||||
wgpu_types::ColorWrite::from_bits(mask).unwrap()
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect::<Vec<wgpu_types::ColorTargetState>>(),
|
.collect::<Vec<wgpu_types::ColorTargetState>>(),
|
||||||
),
|
),
|
||||||
|
@ -594,7 +636,7 @@ pub fn op_webgpu_create_render_pipeline(
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (render_pipeline, _, maybe_err) = gfx_select!(device => instance.device_create_render_pipeline(
|
let (render_pipeline, maybe_err) = gfx_select!(device => instance.device_create_render_pipeline(
|
||||||
device,
|
device,
|
||||||
&descriptor,
|
&descriptor,
|
||||||
std::marker::PhantomData,
|
std::marker::PhantomData,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
use std::num::NonZeroU32;
|
||||||
|
|
||||||
use deno_core::error::bad_resource_id;
|
use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::null_opbuf;
|
use deno_core::error::null_opbuf;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
|
@ -124,7 +126,7 @@ pub fn op_webgpu_write_texture(
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
let queue = queue_resource.0;
|
let queue = queue_resource.0;
|
||||||
|
|
||||||
let destination = wgpu_core::command::TextureCopyView {
|
let destination = wgpu_core::command::ImageCopyTexture {
|
||||||
texture: texture_resource.0,
|
texture: texture_resource.0,
|
||||||
mip_level: args.destination.mip_level.unwrap_or(0),
|
mip_level: args.destination.mip_level.unwrap_or(0),
|
||||||
origin: args
|
origin: args
|
||||||
|
@ -136,10 +138,12 @@ pub fn op_webgpu_write_texture(
|
||||||
z: origin.z.unwrap_or(0),
|
z: origin.z.unwrap_or(0),
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let data_layout = wgpu_types::TextureDataLayout {
|
let data_layout = wgpu_types::ImageDataLayout {
|
||||||
offset: args.data_layout.offset.unwrap_or(0),
|
offset: args.data_layout.offset.unwrap_or(0),
|
||||||
bytes_per_row: args.data_layout.bytes_per_row.unwrap_or(0),
|
bytes_per_row: NonZeroU32::new(args.data_layout.bytes_per_row.unwrap_or(0)),
|
||||||
rows_per_image: args.data_layout.rows_per_image.unwrap_or(0),
|
rows_per_image: NonZeroU32::new(
|
||||||
|
args.data_layout.rows_per_image.unwrap_or(0),
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
gfx_ok!(queue => instance.queue_write_texture(
|
gfx_ok!(queue => instance.queue_write_texture(
|
||||||
|
@ -150,7 +154,7 @@ pub fn op_webgpu_write_texture(
|
||||||
&wgpu_types::Extent3d {
|
&wgpu_types::Extent3d {
|
||||||
width: args.size.width.unwrap_or(1),
|
width: args.size.width.unwrap_or(1),
|
||||||
height: args.size.height.unwrap_or(1),
|
height: args.size.height.unwrap_or(1),
|
||||||
depth: args.size.depth.unwrap_or(1),
|
depth_or_array_layers: args.size.depth_or_array_layers.unwrap_or(1),
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,14 +98,14 @@ pub struct GpuColor {
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetBlendColorArgs {
|
pub struct RenderPassSetBlendConstantArgs {
|
||||||
render_pass_rid: ResourceId,
|
render_pass_rid: ResourceId,
|
||||||
color: GpuColor,
|
color: GpuColor,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_render_pass_set_blend_color(
|
pub fn op_webgpu_render_pass_set_blend_constant(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetBlendColorArgs,
|
args: RenderPassSetBlendConstantArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_zero_copy: Option<ZeroCopyBuf>,
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
|
@ -113,7 +113,7 @@ pub fn op_webgpu_render_pass_set_blend_color(
|
||||||
.get::<WebGpuRenderPass>(args.render_pass_rid)
|
.get::<WebGpuRenderPass>(args.render_pass_rid)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
wgpu_core::command::render_ffi::wgpu_render_pass_set_blend_color(
|
wgpu_core::command::render_ffi::wgpu_render_pass_set_blend_constant(
|
||||||
&mut render_pass_resource.0.borrow_mut(),
|
&mut render_pass_resource.0.borrow_mut(),
|
||||||
&wgpu_types::Color {
|
&wgpu_types::Color {
|
||||||
r: args.color.r,
|
r: args.color.r,
|
||||||
|
@ -173,13 +173,11 @@ pub fn op_webgpu_render_pass_begin_pipeline_statistics_query(
|
||||||
.get::<super::WebGpuQuerySet>(args.query_set)
|
.get::<super::WebGpuQuerySet>(args.query_set)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
unsafe {
|
wgpu_core::command::render_ffi::wgpu_render_pass_begin_pipeline_statistics_query(
|
||||||
wgpu_core::command::render_ffi::wgpu_render_pass_begin_pipeline_statistics_query(
|
&mut render_pass_resource.0.borrow_mut(),
|
||||||
&mut render_pass_resource.0.borrow_mut(),
|
query_set_resource.0,
|
||||||
query_set_resource.0,
|
args.query_index,
|
||||||
args.query_index,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(WebGpuResult::empty())
|
Ok(WebGpuResult::empty())
|
||||||
}
|
}
|
||||||
|
@ -200,11 +198,9 @@ pub fn op_webgpu_render_pass_end_pipeline_statistics_query(
|
||||||
.get::<WebGpuRenderPass>(args.render_pass_rid)
|
.get::<WebGpuRenderPass>(args.render_pass_rid)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
unsafe {
|
wgpu_core::command::render_ffi::wgpu_render_pass_end_pipeline_statistics_query(
|
||||||
wgpu_core::command::render_ffi::wgpu_render_pass_end_pipeline_statistics_query(
|
&mut render_pass_resource.0.borrow_mut(),
|
||||||
&mut render_pass_resource.0.borrow_mut(),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(WebGpuResult::empty())
|
Ok(WebGpuResult::empty())
|
||||||
}
|
}
|
||||||
|
@ -231,13 +227,11 @@ pub fn op_webgpu_render_pass_write_timestamp(
|
||||||
.get::<super::WebGpuQuerySet>(args.query_set)
|
.get::<super::WebGpuQuerySet>(args.query_set)
|
||||||
.ok_or_else(bad_resource_id)?;
|
.ok_or_else(bad_resource_id)?;
|
||||||
|
|
||||||
unsafe {
|
wgpu_core::command::render_ffi::wgpu_render_pass_write_timestamp(
|
||||||
wgpu_core::command::render_ffi::wgpu_render_pass_write_timestamp(
|
&mut render_pass_resource.0.borrow_mut(),
|
||||||
&mut render_pass_resource.0.borrow_mut(),
|
query_set_resource.0,
|
||||||
query_set_resource.0,
|
args.query_index,
|
||||||
args.query_index,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(WebGpuResult::empty())
|
Ok(WebGpuResult::empty())
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,14 +56,9 @@ pub fn op_webgpu_create_shader_module(
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut flags = wgpu_types::ShaderFlags::default();
|
|
||||||
flags.set(wgpu_types::ShaderFlags::VALIDATION, true);
|
|
||||||
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
|
|
||||||
flags.set(wgpu_types::ShaderFlags::EXPERIMENTAL_TRANSLATION, true);
|
|
||||||
|
|
||||||
let descriptor = wgpu_core::pipeline::ShaderModuleDescriptor {
|
let descriptor = wgpu_core::pipeline::ShaderModuleDescriptor {
|
||||||
label: args.label.map(Cow::from),
|
label: args.label.map(Cow::from),
|
||||||
flags,
|
flags: wgpu_types::ShaderFlags::all(),
|
||||||
};
|
};
|
||||||
|
|
||||||
gfx_put!(device => instance.device_create_shader_module(
|
gfx_put!(device => instance.device_create_shader_module(
|
||||||
|
|
|
@ -126,7 +126,7 @@ pub fn serialize_dimension(
|
||||||
pub struct GpuExtent3D {
|
pub struct GpuExtent3D {
|
||||||
pub width: Option<u32>,
|
pub width: Option<u32>,
|
||||||
pub height: Option<u32>,
|
pub height: Option<u32>,
|
||||||
pub depth: Option<u32>,
|
pub depth_or_array_layers: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -159,7 +159,7 @@ pub fn op_webgpu_create_texture(
|
||||||
size: wgpu_types::Extent3d {
|
size: wgpu_types::Extent3d {
|
||||||
width: args.size.width.unwrap_or(1),
|
width: args.size.width.unwrap_or(1),
|
||||||
height: args.size.height.unwrap_or(1),
|
height: args.size.height.unwrap_or(1),
|
||||||
depth: args.size.depth.unwrap_or(1),
|
depth_or_array_layers: args.size.depth_or_array_layers.unwrap_or(1),
|
||||||
},
|
},
|
||||||
mip_level_count: args.mip_level_count.unwrap_or(1),
|
mip_level_count: args.mip_level_count.unwrap_or(1),
|
||||||
sample_count: args.sample_count.unwrap_or(1),
|
sample_count: args.sample_count.unwrap_or(1),
|
||||||
|
@ -226,7 +226,9 @@ pub fn op_webgpu_create_texture_view(
|
||||||
None => wgpu_types::TextureAspect::All,
|
None => wgpu_types::TextureAspect::All,
|
||||||
},
|
},
|
||||||
base_mip_level: args.base_mip_level.unwrap_or(0),
|
base_mip_level: args.base_mip_level.unwrap_or(0),
|
||||||
level_count: std::num::NonZeroU32::new(args.mip_level_count.unwrap_or(0)),
|
mip_level_count: std::num::NonZeroU32::new(
|
||||||
|
args.mip_level_count.unwrap_or(0),
|
||||||
|
),
|
||||||
base_array_layer: args.base_array_layer.unwrap_or(0),
|
base_array_layer: args.base_array_layer.unwrap_or(0),
|
||||||
array_layer_count: std::num::NonZeroU32::new(
|
array_layer_count: std::num::NonZeroU32::new(
|
||||||
args.array_layer_count.unwrap_or(0),
|
args.array_layer_count.unwrap_or(0),
|
||||||
|
|
|
@ -6,39 +6,37 @@ dictionary GPUObjectDescriptorBase {
|
||||||
USVString label;
|
USVString label;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUAdapterLimits {
|
interface GPUAdapterLimits {
|
||||||
readonly attribute GPUSize32 maxTextureDimension1D;
|
readonly attribute unsigned long maxTextureDimension1D;
|
||||||
readonly attribute GPUSize32 maxTextureDimension2D;
|
readonly attribute unsigned long maxTextureDimension2D;
|
||||||
readonly attribute GPUSize32 maxTextureDimension3D;
|
readonly attribute unsigned long maxTextureDimension3D;
|
||||||
readonly attribute GPUSize32 maxTextureArrayLayers;
|
readonly attribute unsigned long maxTextureArrayLayers;
|
||||||
readonly attribute GPUSize32 maxBindGroups;
|
readonly attribute unsigned long maxBindGroups;
|
||||||
readonly attribute GPUSize32 maxDynamicUniformBuffersPerPipelineLayout;
|
readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout;
|
||||||
readonly attribute GPUSize32 maxDynamicStorageBuffersPerPipelineLayout;
|
readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout;
|
||||||
readonly attribute GPUSize32 maxSampledTexturesPerShaderStage;
|
readonly attribute unsigned long maxSampledTexturesPerShaderStage;
|
||||||
readonly attribute GPUSize32 maxSamplersPerShaderStage;
|
readonly attribute unsigned long maxSamplersPerShaderStage;
|
||||||
readonly attribute GPUSize32 maxStorageBuffersPerShaderStage;
|
readonly attribute unsigned long maxStorageBuffersPerShaderStage;
|
||||||
readonly attribute GPUSize32 maxStorageTexturesPerShaderStage;
|
readonly attribute unsigned long maxStorageTexturesPerShaderStage;
|
||||||
readonly attribute GPUSize32 maxUniformBuffersPerShaderStage;
|
readonly attribute unsigned long maxUniformBuffersPerShaderStage;
|
||||||
readonly attribute GPUSize32 maxUniformBufferBindingSize;
|
readonly attribute unsigned long maxUniformBufferBindingSize;
|
||||||
readonly attribute GPUSize32 maxStorageBufferBindingSize;
|
readonly attribute unsigned long maxStorageBufferBindingSize;
|
||||||
readonly attribute GPUSize32 maxVertexBuffers;
|
readonly attribute unsigned long maxVertexBuffers;
|
||||||
readonly attribute GPUSize32 maxVertexAttributes;
|
readonly attribute unsigned long maxVertexAttributes;
|
||||||
readonly attribute GPUSize32 maxVertexBufferArrayStride;
|
readonly attribute unsigned long maxVertexBufferArrayStride;
|
||||||
};
|
|
||||||
|
|
||||||
interface GPUAdapterFeatures {
|
|
||||||
readonly setlike<GPUFeatureName>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=Window]
|
||||||
partial interface Navigator {
|
interface GPUSupportedFeatures {
|
||||||
[SameObject] readonly attribute GPU gpu;
|
readonly setlike<DOMString>;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Exposed=DedicatedWorker]
|
interface mixin NavigatorGPU {
|
||||||
partial interface WorkerNavigator {
|
|
||||||
[SameObject] readonly attribute GPU gpu;
|
[SameObject] readonly attribute GPU gpu;
|
||||||
};
|
};
|
||||||
|
Navigator includes NavigatorGPU;
|
||||||
|
WorkerNavigator includes NavigatorGPU;
|
||||||
|
|
||||||
[Exposed=(Window, DedicatedWorker)]
|
[Exposed=(Window, DedicatedWorker)]
|
||||||
interface GPU {
|
interface GPU {
|
||||||
|
@ -54,12 +52,13 @@ enum GPUPowerPreference {
|
||||||
"high-performance"
|
"high-performance"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUAdapter {
|
interface GPUAdapter {
|
||||||
readonly attribute DOMString name;
|
readonly attribute DOMString name;
|
||||||
[SameObject] readonly attribute GPUAdapterFeatures features;
|
[SameObject] readonly attribute GPUSupportedFeatures features;
|
||||||
[SameObject] readonly attribute GPUAdapterLimits limits;
|
[SameObject] readonly attribute GPUAdapterLimits limits;
|
||||||
|
|
||||||
Promise<GPUDevice?> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
||||||
|
@ -78,8 +77,7 @@ enum GPUFeatureName {
|
||||||
|
|
||||||
[Exposed=(Window, DedicatedWorker), Serializable]
|
[Exposed=(Window, DedicatedWorker), Serializable]
|
||||||
interface GPUDevice : EventTarget {
|
interface GPUDevice : EventTarget {
|
||||||
[SameObject] readonly attribute GPUAdapter adapter;
|
[SameObject] readonly attribute GPUSupportedFeatures features;
|
||||||
readonly attribute FrozenArray<GPUFeatureName> features;
|
|
||||||
readonly attribute object limits;
|
readonly attribute object limits;
|
||||||
|
|
||||||
[SameObject] readonly attribute GPUQueue queue;
|
[SameObject] readonly attribute GPUQueue queue;
|
||||||
|
@ -107,7 +105,7 @@ interface GPUDevice : EventTarget {
|
||||||
};
|
};
|
||||||
GPUDevice includes GPUObjectBase;
|
GPUDevice includes GPUObjectBase;
|
||||||
|
|
||||||
[Serializable]
|
[Exposed=Window, Serializable]
|
||||||
interface GPUBuffer {
|
interface GPUBuffer {
|
||||||
Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size);
|
Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size);
|
||||||
ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size);
|
ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size);
|
||||||
|
@ -124,6 +122,7 @@ dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
|
typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUBufferUsage {
|
interface GPUBufferUsage {
|
||||||
const GPUFlagsConstant MAP_READ = 0x0001;
|
const GPUFlagsConstant MAP_READ = 0x0001;
|
||||||
const GPUFlagsConstant MAP_WRITE = 0x0002;
|
const GPUFlagsConstant MAP_WRITE = 0x0002;
|
||||||
|
@ -138,12 +137,13 @@ interface GPUBufferUsage {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUMapModeFlags;
|
typedef [EnforceRange] unsigned long GPUMapModeFlags;
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUMapMode {
|
interface GPUMapMode {
|
||||||
const GPUFlagsConstant READ = 0x0001;
|
const GPUFlagsConstant READ = 0x0001;
|
||||||
const GPUFlagsConstant WRITE = 0x0002;
|
const GPUFlagsConstant WRITE = 0x0002;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Serializable]
|
[Exposed=Window, Serializable]
|
||||||
interface GPUTexture {
|
interface GPUTexture {
|
||||||
GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
|
GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
|
||||||
|
|
||||||
|
@ -167,6 +167,7 @@ enum GPUTextureDimension {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
|
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUTextureUsage {
|
interface GPUTextureUsage {
|
||||||
const GPUFlagsConstant COPY_SRC = 0x01;
|
const GPUFlagsConstant COPY_SRC = 0x01;
|
||||||
const GPUFlagsConstant COPY_DST = 0x02;
|
const GPUFlagsConstant COPY_DST = 0x02;
|
||||||
|
@ -175,6 +176,7 @@ interface GPUTextureUsage {
|
||||||
const GPUFlagsConstant RENDER_ATTACHMENT = 0x10;
|
const GPUFlagsConstant RENDER_ATTACHMENT = 0x10;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUTextureView {
|
interface GPUTextureView {
|
||||||
};
|
};
|
||||||
GPUTextureView includes GPUObjectBase;
|
GPUTextureView includes GPUObjectBase;
|
||||||
|
@ -283,6 +285,7 @@ enum GPUTextureFormat {
|
||||||
"depth32float-stencil8",
|
"depth32float-stencil8",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUSampler {
|
interface GPUSampler {
|
||||||
};
|
};
|
||||||
GPUSampler includes GPUObjectBase;
|
GPUSampler includes GPUObjectBase;
|
||||||
|
@ -322,7 +325,7 @@ enum GPUCompareFunction {
|
||||||
"always"
|
"always"
|
||||||
};
|
};
|
||||||
|
|
||||||
[Serializable]
|
[Exposed=Window, Serializable]
|
||||||
interface GPUBindGroupLayout {
|
interface GPUBindGroupLayout {
|
||||||
};
|
};
|
||||||
GPUBindGroupLayout includes GPUObjectBase;
|
GPUBindGroupLayout includes GPUObjectBase;
|
||||||
|
@ -332,6 +335,7 @@ dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUShaderStageFlags;
|
typedef [EnforceRange] unsigned long GPUShaderStageFlags;
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUShaderStage {
|
interface GPUShaderStage {
|
||||||
const GPUFlagsConstant VERTEX = 0x1;
|
const GPUFlagsConstant VERTEX = 0x1;
|
||||||
const GPUFlagsConstant FRAGMENT = 0x2;
|
const GPUFlagsConstant FRAGMENT = 0x2;
|
||||||
|
@ -395,6 +399,7 @@ dictionary GPUStorageTextureBindingLayout {
|
||||||
GPUTextureViewDimension viewDimension = "2d";
|
GPUTextureViewDimension viewDimension = "2d";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUBindGroup {
|
interface GPUBindGroup {
|
||||||
};
|
};
|
||||||
GPUBindGroup includes GPUObjectBase;
|
GPUBindGroup includes GPUObjectBase;
|
||||||
|
@ -417,7 +422,7 @@ dictionary GPUBufferBinding {
|
||||||
GPUSize64 size;
|
GPUSize64 size;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Serializable]
|
[Exposed=Window, Serializable]
|
||||||
interface GPUPipelineLayout {
|
interface GPUPipelineLayout {
|
||||||
};
|
};
|
||||||
GPUPipelineLayout includes GPUObjectBase;
|
GPUPipelineLayout includes GPUObjectBase;
|
||||||
|
@ -426,26 +431,7 @@ dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase {
|
||||||
required sequence<GPUBindGroupLayout> bindGroupLayouts;
|
required sequence<GPUBindGroupLayout> bindGroupLayouts;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUCompilationMessageType {
|
[Exposed=Window, Serializable]
|
||||||
"error",
|
|
||||||
"warning",
|
|
||||||
"info"
|
|
||||||
};
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
interface GPUCompilationMessage {
|
|
||||||
readonly attribute DOMString message;
|
|
||||||
readonly attribute GPUCompilationMessageType type;
|
|
||||||
readonly attribute unsigned long long lineNum;
|
|
||||||
readonly attribute unsigned long long linePos;
|
|
||||||
};
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
interface GPUCompilationInfo {
|
|
||||||
readonly attribute FrozenArray<GPUCompilationMessage> messages;
|
|
||||||
};
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
interface GPUShaderModule {
|
interface GPUShaderModule {
|
||||||
Promise<GPUCompilationInfo> compilationInfo();
|
Promise<GPUCompilationInfo> compilationInfo();
|
||||||
};
|
};
|
||||||
|
@ -456,6 +442,27 @@ dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
|
||||||
object sourceMap;
|
object sourceMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum GPUCompilationMessageType {
|
||||||
|
"error",
|
||||||
|
"warning",
|
||||||
|
"info"
|
||||||
|
};
|
||||||
|
|
||||||
|
[Exposed=Window, Serializable]
|
||||||
|
interface GPUCompilationMessage {
|
||||||
|
readonly attribute DOMString message;
|
||||||
|
readonly attribute GPUCompilationMessageType type;
|
||||||
|
readonly attribute unsigned long long lineNum;
|
||||||
|
readonly attribute unsigned long long linePos;
|
||||||
|
readonly attribute unsigned long long offset;
|
||||||
|
readonly attribute unsigned long long length;
|
||||||
|
};
|
||||||
|
|
||||||
|
[Exposed=Window, Serializable]
|
||||||
|
interface GPUCompilationInfo {
|
||||||
|
readonly attribute FrozenArray<GPUCompilationMessage> messages;
|
||||||
|
};
|
||||||
|
|
||||||
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
|
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
|
||||||
GPUPipelineLayout layout;
|
GPUPipelineLayout layout;
|
||||||
};
|
};
|
||||||
|
@ -469,7 +476,7 @@ dictionary GPUProgrammableStage {
|
||||||
required USVString entryPoint;
|
required USVString entryPoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Serializable]
|
[Exposed=Window, Serializable]
|
||||||
interface GPUComputePipeline {
|
interface GPUComputePipeline {
|
||||||
};
|
};
|
||||||
GPUComputePipeline includes GPUObjectBase;
|
GPUComputePipeline includes GPUObjectBase;
|
||||||
|
@ -479,7 +486,7 @@ dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
|
||||||
required GPUProgrammableStage compute;
|
required GPUProgrammableStage compute;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Serializable]
|
[Exposed=Window, Serializable]
|
||||||
interface GPURenderPipeline {
|
interface GPURenderPipeline {
|
||||||
};
|
};
|
||||||
GPURenderPipeline includes GPUObjectBase;
|
GPURenderPipeline includes GPUObjectBase;
|
||||||
|
@ -506,6 +513,9 @@ dictionary GPUPrimitiveState {
|
||||||
GPUIndexFormat stripIndexFormat;
|
GPUIndexFormat stripIndexFormat;
|
||||||
GPUFrontFace frontFace = "ccw";
|
GPUFrontFace frontFace = "ccw";
|
||||||
GPUCullMode cullMode = "none";
|
GPUCullMode cullMode = "none";
|
||||||
|
|
||||||
|
// Enable depth clamping (requires "depth-clamping" feature)
|
||||||
|
boolean clampDepth = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUFrontFace {
|
enum GPUFrontFace {
|
||||||
|
@ -542,6 +552,7 @@ dictionary GPUBlendState {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
|
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUColorWrite {
|
interface GPUColorWrite {
|
||||||
const GPUFlagsConstant RED = 0x1;
|
const GPUFlagsConstant RED = 0x1;
|
||||||
const GPUFlagsConstant GREEN = 0x2;
|
const GPUFlagsConstant GREEN = 0x2;
|
||||||
|
@ -559,17 +570,17 @@ dictionary GPUBlendComponent {
|
||||||
enum GPUBlendFactor {
|
enum GPUBlendFactor {
|
||||||
"zero",
|
"zero",
|
||||||
"one",
|
"one",
|
||||||
"src-color",
|
"src",
|
||||||
"one-minus-src-color",
|
"one-minus-src",
|
||||||
"src-alpha",
|
"src-alpha",
|
||||||
"one-minus-src-alpha",
|
"one-minus-src-alpha",
|
||||||
"dst-color",
|
"dst",
|
||||||
"one-minus-dst-color",
|
"one-minus-dst",
|
||||||
"dst-alpha",
|
"dst-alpha",
|
||||||
"one-minus-dst-alpha",
|
"one-minus-dst-alpha",
|
||||||
"src-alpha-saturated",
|
"src-alpha-saturated",
|
||||||
"blend-color",
|
"constant",
|
||||||
"one-minus-blend-color"
|
"one-minus-constant"
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUBlendOperation {
|
enum GPUBlendOperation {
|
||||||
|
@ -595,9 +606,6 @@ dictionary GPUDepthStencilState {
|
||||||
GPUDepthBias depthBias = 0;
|
GPUDepthBias depthBias = 0;
|
||||||
float depthBiasSlopeScale = 0;
|
float depthBiasSlopeScale = 0;
|
||||||
float depthBiasClamp = 0;
|
float depthBiasClamp = 0;
|
||||||
|
|
||||||
// Enable depth clamping (requires "depth-clamping" feature)
|
|
||||||
boolean clampDepth = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUStencilFaceState {
|
dictionary GPUStencilFaceState {
|
||||||
|
@ -624,36 +632,36 @@ enum GPUIndexFormat {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUVertexFormat {
|
enum GPUVertexFormat {
|
||||||
"uchar2",
|
"uint8x2",
|
||||||
"uchar4",
|
"uint8x4",
|
||||||
"char2",
|
"sint8x2",
|
||||||
"char4",
|
"sint8x4",
|
||||||
"uchar2norm",
|
"unorm8x2",
|
||||||
"uchar4norm",
|
"unorm8x4",
|
||||||
"char2norm",
|
"snorm8x2",
|
||||||
"char4norm",
|
"snorm8x4",
|
||||||
"ushort2",
|
"uint16x2",
|
||||||
"ushort4",
|
"uint16x4",
|
||||||
"short2",
|
"sint16x2",
|
||||||
"short4",
|
"sint16x4",
|
||||||
"ushort2norm",
|
"unorm16x2",
|
||||||
"ushort4norm",
|
"unorm16x4",
|
||||||
"short2norm",
|
"snorm16x2",
|
||||||
"short4norm",
|
"snorm16x4",
|
||||||
"half2",
|
"float16x2",
|
||||||
"half4",
|
"float16x4",
|
||||||
"float",
|
"float32",
|
||||||
"float2",
|
"float32x2",
|
||||||
"float3",
|
"float32x3",
|
||||||
"float4",
|
"float32x4",
|
||||||
"uint",
|
"uint32",
|
||||||
"uint2",
|
"uint32x2",
|
||||||
"uint3",
|
"uint32x3",
|
||||||
"uint4",
|
"uint32x4",
|
||||||
"int",
|
"sint32",
|
||||||
"int2",
|
"sint32x2",
|
||||||
"int3",
|
"sint32x3",
|
||||||
"int4"
|
"sint32x4",
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUInputStepMode {
|
enum GPUInputStepMode {
|
||||||
|
@ -678,6 +686,7 @@ dictionary GPUVertexAttribute {
|
||||||
required GPUIndex32 shaderLocation;
|
required GPUIndex32 shaderLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUCommandBuffer {
|
interface GPUCommandBuffer {
|
||||||
readonly attribute Promise<double> executionTime;
|
readonly attribute Promise<double> executionTime;
|
||||||
};
|
};
|
||||||
|
@ -686,6 +695,7 @@ GPUCommandBuffer includes GPUObjectBase;
|
||||||
dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
|
dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUCommandEncoder {
|
interface GPUCommandEncoder {
|
||||||
GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor);
|
GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor);
|
||||||
GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});
|
GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});
|
||||||
|
@ -752,6 +762,11 @@ dictionary GPUImageCopyTexture {
|
||||||
GPUTextureAspect aspect = "all";
|
GPUTextureAspect aspect = "all";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dictionary GPUImageCopyExternalImage {
|
||||||
|
required (ImageBitmap or HTMLCanvasElement or OffscreenCanvas) source;
|
||||||
|
GPUOrigin2D origin = {};
|
||||||
|
};
|
||||||
|
|
||||||
interface mixin GPUProgrammablePassEncoder {
|
interface mixin GPUProgrammablePassEncoder {
|
||||||
undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
|
undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
|
||||||
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
|
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
|
||||||
|
@ -766,6 +781,7 @@ interface mixin GPUProgrammablePassEncoder {
|
||||||
undefined insertDebugMarker(USVString markerLabel);
|
undefined insertDebugMarker(USVString markerLabel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUComputePassEncoder {
|
interface GPUComputePassEncoder {
|
||||||
undefined setPipeline(GPUComputePipeline pipeline);
|
undefined setPipeline(GPUComputePipeline pipeline);
|
||||||
undefined dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1);
|
undefined dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1);
|
||||||
|
@ -801,6 +817,7 @@ interface mixin GPURenderEncoderBase {
|
||||||
undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPURenderPassEncoder {
|
interface GPURenderPassEncoder {
|
||||||
undefined setViewport(float x, float y,
|
undefined setViewport(float x, float y,
|
||||||
float width, float height,
|
float width, float height,
|
||||||
|
@ -809,7 +826,7 @@ interface GPURenderPassEncoder {
|
||||||
undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y,
|
undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y,
|
||||||
GPUIntegerCoordinate width, GPUIntegerCoordinate height);
|
GPUIntegerCoordinate width, GPUIntegerCoordinate height);
|
||||||
|
|
||||||
undefined setBlendColor(GPUColor color);
|
undefined setBlendConstant(GPUColor color);
|
||||||
undefined setStencilReference(GPUStencilValue reference);
|
undefined setStencilReference(GPUStencilValue reference);
|
||||||
|
|
||||||
undefined beginOcclusionQuery(GPUSize32 queryIndex);
|
undefined beginOcclusionQuery(GPUSize32 queryIndex);
|
||||||
|
@ -838,7 +855,7 @@ dictionary GPURenderPassColorAttachment {
|
||||||
GPUTextureView resolveTarget;
|
GPUTextureView resolveTarget;
|
||||||
|
|
||||||
required (GPULoadOp or GPUColor) loadValue;
|
required (GPULoadOp or GPUColor) loadValue;
|
||||||
GPUStoreOp storeOp = "store";
|
required GPUStoreOp storeOp;
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPURenderPassDepthStencilAttachment {
|
dictionary GPURenderPassDepthStencilAttachment {
|
||||||
|
@ -862,6 +879,7 @@ enum GPUStoreOp {
|
||||||
"clear"
|
"clear"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPURenderBundle {
|
interface GPURenderBundle {
|
||||||
};
|
};
|
||||||
GPURenderBundle includes GPUObjectBase;
|
GPURenderBundle includes GPUObjectBase;
|
||||||
|
@ -869,6 +887,7 @@ GPURenderBundle includes GPUObjectBase;
|
||||||
dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase {
|
dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPURenderBundleEncoder {
|
interface GPURenderBundleEncoder {
|
||||||
GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
|
GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
|
||||||
};
|
};
|
||||||
|
@ -882,6 +901,7 @@ dictionary GPURenderBundleEncoderDescriptor : GPUObjectDescriptorBase {
|
||||||
GPUSize32 sampleCount = 1;
|
GPUSize32 sampleCount = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUQueue {
|
interface GPUQueue {
|
||||||
undefined submit(sequence<GPUCommandBuffer> commandBuffers);
|
undefined submit(sequence<GPUCommandBuffer> commandBuffers);
|
||||||
|
|
||||||
|
@ -899,9 +919,15 @@ interface GPUQueue {
|
||||||
[AllowShared] BufferSource data,
|
[AllowShared] BufferSource data,
|
||||||
GPUImageDataLayout dataLayout,
|
GPUImageDataLayout dataLayout,
|
||||||
GPUExtent3D size);
|
GPUExtent3D size);
|
||||||
|
|
||||||
|
undefined copyExternalImageToTexture(
|
||||||
|
GPUImageCopyExternalImage source,
|
||||||
|
GPUImageCopyTexture destination,
|
||||||
|
GPUExtent3D copySize);
|
||||||
};
|
};
|
||||||
GPUQueue includes GPUObjectBase;
|
GPUQueue includes GPUObjectBase;
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUQuerySet {
|
interface GPUQuerySet {
|
||||||
undefined destroy();
|
undefined destroy();
|
||||||
};
|
};
|
||||||
|
@ -927,10 +953,36 @@ enum GPUPipelineStatisticName {
|
||||||
"compute-shader-invocations"
|
"compute-shader-invocations"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
|
interface GPUCanvasContext {
|
||||||
|
GPUSwapChain configureSwapChain(GPUSwapChainDescriptor descriptor);
|
||||||
|
|
||||||
|
GPUTextureFormat getSwapChainPreferredFormat(GPUAdapter adapter);
|
||||||
|
};
|
||||||
|
|
||||||
|
enum GPUCanvasCompositingAlphaMode {
|
||||||
|
"opaque",
|
||||||
|
"premultiplied",
|
||||||
|
};
|
||||||
|
|
||||||
|
dictionary GPUSwapChainDescriptor : GPUObjectDescriptorBase {
|
||||||
|
required GPUDevice device;
|
||||||
|
required GPUTextureFormat format;
|
||||||
|
GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT
|
||||||
|
GPUCanvasCompositingAlphaMode compositingAlphaMode = "opaque";
|
||||||
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
|
interface GPUSwapChain {
|
||||||
|
GPUTexture getCurrentTexture();
|
||||||
|
};
|
||||||
|
GPUSwapChain includes GPUObjectBase;
|
||||||
|
|
||||||
enum GPUDeviceLostReason {
|
enum GPUDeviceLostReason {
|
||||||
"destroyed",
|
"destroyed",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUDeviceLostInfo {
|
interface GPUDeviceLostInfo {
|
||||||
readonly attribute (GPUDeviceLostReason or undefined) reason;
|
readonly attribute (GPUDeviceLostReason or undefined) reason;
|
||||||
readonly attribute DOMString message;
|
readonly attribute DOMString message;
|
||||||
|
@ -945,10 +997,12 @@ enum GPUErrorFilter {
|
||||||
"validation"
|
"validation"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUOutOfMemoryError {
|
interface GPUOutOfMemoryError {
|
||||||
constructor();
|
constructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=Window]
|
||||||
interface GPUValidationError {
|
interface GPUValidationError {
|
||||||
constructor(DOMString message);
|
constructor(DOMString message);
|
||||||
readonly attribute DOMString message;
|
readonly attribute DOMString message;
|
||||||
|
@ -1016,7 +1070,7 @@ dictionary GPUOrigin3DDict {
|
||||||
typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D;
|
typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D;
|
||||||
|
|
||||||
dictionary GPUExtent3DDict {
|
dictionary GPUExtent3DDict {
|
||||||
GPUIntegerCoordinate width = 1;
|
required GPUIntegerCoordinate width;
|
||||||
GPUIntegerCoordinate height = 1;
|
GPUIntegerCoordinate height = 1;
|
||||||
GPUIntegerCoordinate depthOrArrayLayers = 1;
|
GPUIntegerCoordinate depthOrArrayLayers = 1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -296,7 +296,7 @@ delete Object.prototype.__proto__;
|
||||||
GPU: util.nonEnumerable(webgpu.GPU),
|
GPU: util.nonEnumerable(webgpu.GPU),
|
||||||
GPUAdapter: util.nonEnumerable(webgpu.GPUAdapter),
|
GPUAdapter: util.nonEnumerable(webgpu.GPUAdapter),
|
||||||
GPUAdapterLimits: util.nonEnumerable(webgpu.GPUAdapterLimits),
|
GPUAdapterLimits: util.nonEnumerable(webgpu.GPUAdapterLimits),
|
||||||
GPUAdapterFeatures: util.nonEnumerable(webgpu.GPUAdapterFeatures),
|
GPUSupportedFeatures: util.nonEnumerable(webgpu.GPUSupportedFeatures),
|
||||||
GPUDevice: util.nonEnumerable(webgpu.GPUDevice),
|
GPUDevice: util.nonEnumerable(webgpu.GPUDevice),
|
||||||
GPUQueue: util.nonEnumerable(webgpu.GPUQueue),
|
GPUQueue: util.nonEnumerable(webgpu.GPUQueue),
|
||||||
GPUBuffer: util.nonEnumerable(webgpu.GPUBuffer),
|
GPUBuffer: util.nonEnumerable(webgpu.GPUBuffer),
|
||||||
|
|
Loading…
Reference in a new issue