Bug 1452603 - Update Cargo lockfiles and re-vendor rust dependencies. r=jrmuizel

MozReview-Commit-ID: A0PVWw50OX5

--HG--
extra : rebase_source : e245ddb3bda97e43425cbcb14367b406dd42ada8
This commit is contained in:
Kartikaya Gupta 2018-04-12 11:06:59 -04:00
Родитель 576ecda078
Коммит 4d65661587
96 изменённых файлов: 10629 добавлений и 418 удалений

89
Cargo.lock сгенерированный
Просмотреть файл

@ -31,7 +31,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -89,8 +89,8 @@ dependencies = [
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.37 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)",
"tokio-core 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -148,7 +148,7 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -564,8 +564,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.37 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)",
"strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -591,8 +591,8 @@ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.37 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -655,7 +655,7 @@ version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -844,21 +844,20 @@ dependencies = [
[[package]]
name = "gl_generator"
version = "0.8.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"khronos_api 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gleam"
version = "0.4.20"
version = "0.4.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -980,7 +979,7 @@ dependencies = [
[[package]]
name = "khronos_api"
version = "2.0.0"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -1000,8 +999,8 @@ dependencies = [
"petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.37 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)",
"string_cache 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1666,7 +1665,7 @@ name = "ron"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1755,10 +1754,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "1.0.35"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)",
"serde_derive 1.0.37 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)",
]
[[package]]
@ -1766,27 +1765,27 @@ name = "serde_bytes"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
version = "1.0.35"
source = "git+https://github.com/servo/serde?branch=deserialize_from_enums5#de4534b21f263752ed3b641c3c07e012574985bf"
version = "1.0.37"
source = "git+https://github.com/servo/serde?branch=deserialize_from_enums6#b8d39b013bec85b6146dfb1061e0e8fc55e99b5e"
dependencies = [
"proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive_internals 0.22.1 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)",
"syn 0.12.12 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive_internals 0.23.0 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)",
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive_internals"
version = "0.22.1"
source = "git+https://github.com/servo/serde?branch=deserialize_from_enums5#de4534b21f263752ed3b641c3c07e012574985bf"
version = "0.23.0"
source = "git+https://github.com/servo/serde?branch=deserialize_from_enums6#b8d39b013bec85b6146dfb1061e0e8fc55e99b5e"
dependencies = [
"proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.12.12 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1840,7 +1839,7 @@ dependencies = [
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2107,7 +2106,7 @@ name = "toml"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -2287,14 +2286,14 @@ dependencies = [
"euclid 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.32 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2313,9 +2312,9 @@ dependencies = [
"core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)",
"serde_derive 1.0.37 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)",
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2329,7 +2328,7 @@ dependencies = [
"dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.32 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2536,8 +2535,8 @@ dependencies = [
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"
"checksum gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f5c19cde55637681450c92f7a05ea16c78e2b6d0587e601ec1ebdab6960854b"
"checksum gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "959c818d9bbe9f7b7db55dce0bc44673c4da4f4ee122536c40550f984c3b8017"
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
"checksum gleam 0.4.32 (registry+https://github.com/rust-lang/crates.io-index)" = "70363479f033b72dbd558fd3b6f153dd824bf4f9dcd05dfcff6cd29a3eb9a63d"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07"
"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
@ -2550,7 +2549,7 @@ dependencies = [
"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c"
"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum khronos_api 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d867c645cfeb8a7fec503731679eac03ac11b7105aa5a71cb8f8ee5271636add"
"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554"
"checksum lalrpop 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88035943c3cfbb897a499a556212b2b053574f32b4238b71b61625bc470f80aa"
"checksum lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4fd87be4a815fd373e02773983940f0d75fb26fde8c098e9e45f7af03154c0"
"checksum lalrpop-snap 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f244285324e4e33d486910b66fd3b7cb37e2072c5bf63319f506fe99ed72650"
@ -2626,10 +2625,10 @@ dependencies = [
"checksum scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c79eb2c3ac4bc2507cda80e7f3ac5b88bd8eae4c0914d5663e6a8933994be918"
"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "800fdb0a894572994f3970035a8a5f65d8ec2cd40e6cdf7d8cd9001d7b30648e"
"checksum serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "d3bcee660dcde8f52c3765dd9ca5ee36b4bf35470a738eb0bd5a8752b0389645"
"checksum serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "adb6e51a6b3696b301bc221d785f898b4457c619b51d7ce195a6d20baecb37b3"
"checksum serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)" = "<none>"
"checksum serde_derive_internals 0.22.1 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)" = "<none>"
"checksum serde_derive 1.0.37 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)" = "<none>"
"checksum serde_derive_internals 0.23.0 (git+https://github.com/servo/serde?branch=deserialize_from_enums6)" = "<none>"
"checksum simd 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3dd0805c7363ab51a829a1511ad24b6ed0349feaa756c4bc2f977f9f496e6673"
"checksum siphasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ffc669b726f2bc9a3bcff66e5e23b56ba6bf70e22a34c3d7b6d0b3450b65b84"
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"629fd3c2eb896803544c82298d3db10b37d8af15d37a311da617baf6c6fabb28","README.md":"e0ae9e1224f6ce5d6df8e30272a1a23044d2d33b0051bf32ccd74e559f8a9f6c","generators/debug_struct_gen.rs":"35984ebe92529467d61112d95c380c84d4bd00d5dc8280749c4eb2f185313df7","generators/global_gen.rs":"eb7836db702777cb13b47b4ab46b9287a3c41995d4bafa0e659ba23688d34475","generators/mod.rs":"8622cd66c69530ed156dd3852d126a44a1ab6d84ea3086240c0b5f5cd7e91316","generators/static_gen.rs":"9fb4ee9f056263611658234539977fb415f93435d290053b84b092e05de16924","generators/static_struct_gen.rs":"23b910c2b14936766036876b9915639058e0cf3bca468c317d4edc7f6498b471","generators/struct_gen.rs":"07d1b52409c31c09010bd7f03459559f772f8b9396b3c60563401a8627b5e247","generators/templates/types/egl.rs":"d1785a30f1098e101302ba74ba4c22cf95ac44b17edf221dbb9d890f4bd635a2","generators/templates/types/gl.rs":"f71f3a2200c0fa13f09687ef05e51c28c5b11c1bb841acd402c0097d8f9130bd","generators/templates/types/glx.rs":"f444166d117b96afed2d8d13db6cd3369d6c59704f296e76202269f411bbd4a8","generators/templates/types/wgl.rs":"9d626e0959374c694c19a36d4dd34dae2f37acf3cb94e9bd4d242a16b41a970d","lib.rs":"4d68840c600a1025025438454d68d70e6da3891f2a5bb33406d4255cb257cda1","registry/mod.rs":"4c42448775dc25449c9995a5ec76e95d6c0762d92443f3c12e865768e4e1dc2a","registry/parse.rs":"e508a1c20c47a92f000d444c34e7818443b15cc9e4a45350e73791fb9c6f68a8"},"package":"4f5c19cde55637681450c92f7a05ea16c78e2b6d0587e601ec1ebdab6960854b"}
{"files":{"Cargo.toml":"a11980c70bdc8957d169c4482a3e57a0dd5cb3de6e9eae7b9c15caac7ad8f835","README.md":"e0ae9e1224f6ce5d6df8e30272a1a23044d2d33b0051bf32ccd74e559f8a9f6c","generators/debug_struct_gen.rs":"35223dab284989801bbb7bd676e25533d7fef8e2d990f686867eec1efe95dc62","generators/global_gen.rs":"cad1d5f209dc7ce06d0cea897ee56870c33b812403735adedf2c2d9d3712783f","generators/mod.rs":"9d9f9c20c70de67ca16f4692aff3cdcb7f9209433ebd49e771dbce94349a2a75","generators/static_gen.rs":"9fb4ee9f056263611658234539977fb415f93435d290053b84b092e05de16924","generators/static_struct_gen.rs":"23b910c2b14936766036876b9915639058e0cf3bca468c317d4edc7f6498b471","generators/struct_gen.rs":"03d1bcb9d8ddd64d9326fefe2898633e6714e0caffc32f54b6c873bc75b8a497","generators/templates/types/egl.rs":"d1785a30f1098e101302ba74ba4c22cf95ac44b17edf221dbb9d890f4bd635a2","generators/templates/types/gl.rs":"f71f3a2200c0fa13f09687ef05e51c28c5b11c1bb841acd402c0097d8f9130bd","generators/templates/types/glx.rs":"f444166d117b96afed2d8d13db6cd3369d6c59704f296e76202269f411bbd4a8","generators/templates/types/wgl.rs":"9d626e0959374c694c19a36d4dd34dae2f37acf3cb94e9bd4d242a16b41a970d","lib.rs":"4d68840c600a1025025438454d68d70e6da3891f2a5bb33406d4255cb257cda1","registry/mod.rs":"4c42448775dc25449c9995a5ec76e95d6c0762d92443f3c12e865768e4e1dc2a","registry/parse.rs":"5619135099e9be42e47c45a29a359d63890ab60da482bd4f437728a53d561e95"},"package":"7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"}

6
third_party/rust/gl_generator/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "gl_generator"
version = "0.8.0"
version = "0.9.0"
authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>", "Corey Richardson", "Arseny Kapoulkine"]
description = "Code generators for creating bindings to the Khronos OpenGL APIs."
homepage = "https://github.com/brendanzab/gl-rs/gl_generator/"
@ -27,10 +27,10 @@ repository = "https://github.com/brendanzab/gl-rs/"
name = "gl_generator"
path = "lib.rs"
[dependencies.khronos_api]
version = "2.0.0"
version = "2.1.0"
[dependencies.log]
version = "0.3.5"
version = "0.4.1"
[dependencies.xml-rs]
version = "0.7.0"

Просмотреть файл

@ -167,11 +167,11 @@ fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
/// let gl = Gl::load_with(|s| glfw.get_proc_address(s));
/// ~~~
#[allow(dead_code, unused_variables)]
pub fn load_with<F>(mut loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{
pub fn load_with<F>(mut loadfn: F) -> {api} where F: FnMut(&'static str) -> *const __gl_imports::raw::c_void {{
#[inline(never)]
fn do_metaloadfn(loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void,
symbol: &str,
symbols: &[&str])
fn do_metaloadfn(loadfn: &mut FnMut(&'static str) -> *const __gl_imports::raw::c_void,
symbol: &'static str,
symbols: &[&'static str])
-> *const __gl_imports::raw::c_void {{
let mut ptr = loadfn(symbol);
if ptr.is_null() {{
@ -182,7 +182,7 @@ fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
}}
ptr
}}
let mut metaloadfn = |symbol: &str, symbols: &[&str]| {{
let mut metaloadfn = |symbol: &'static str, symbols: &[&'static str]| {{
do_metaloadfn(&mut loadfn, symbol, symbols)
}};
{api} {{",

Просмотреть файл

@ -57,9 +57,9 @@ fn write_metaloadfn<W>(dest: &mut W) -> io::Result<()>
writeln!(dest,
r#"
#[inline(never)]
fn metaloadfn(loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void,
symbol: &str,
fallbacks: &[&str]) -> *const __gl_imports::raw::c_void {{
fn metaloadfn(loadfn: &mut FnMut(&'static str) -> *const __gl_imports::raw::c_void,
symbol: &'static str,
fallbacks: &[&'static str]) -> *const __gl_imports::raw::c_void {{
let mut ptr = loadfn(symbol);
if ptr.is_null() {{
for &sym in fallbacks {{
@ -218,7 +218,7 @@ fn write_fn_mods<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
}}
#[allow(dead_code)]
pub fn load_with<F>(mut loadfn: F) where F: FnMut(&str) -> *const raw::c_void {{
pub fn load_with<F>(mut loadfn: F) where F: FnMut(&'static str) -> *const raw::c_void {{
unsafe {{
storage::{fnname} = FnPtr::new(metaloadfn(&mut loadfn, "{symbol}", {fallbacks}))
}}
@ -259,7 +259,7 @@ fn write_load_fn<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
/// gl::load_with(|s| glfw.get_proc_address(s));
/// ~~~
#[allow(dead_code)]
pub fn load_with<F>(mut loadfn: F) where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{
pub fn load_with<F>(mut loadfn: F) where F: FnMut(&'static str) -> *const __gl_imports::raw::c_void {{
"));
for c in &registry.cmds {

Просмотреть файл

@ -65,12 +65,16 @@ pub fn gen_enum_item<W>(enm: &Enum, types_prefix: &str, dest: &mut W) -> io::Res
pub fn gen_types<W>(api: Api, dest: &mut W) -> io::Result<()>
where W: io::Write
{
if let Api::Egl = api {
try!(writeln!(dest, "{}", include_str!("templates/types/egl.rs")));
return Ok(());
}
try!(writeln!(dest, "{}", include_str!("templates/types/gl.rs")));
match api {
Api::Glx => try!(writeln!(dest, "{}", include_str!("templates/types/glx.rs"))),
Api::Wgl => try!(writeln!(dest, "{}", include_str!("templates/types/wgl.rs"))),
Api::Egl => try!(writeln!(dest, "{}", include_str!("templates/types/egl.rs"))),
_ => {}
}

Просмотреть файл

@ -167,11 +167,11 @@ fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
/// let gl = Gl::load_with(|s| glfw.get_proc_address(s));
/// ~~~
#[allow(dead_code, unused_variables)]
pub fn load_with<F>(mut loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{
pub fn load_with<F>(mut loadfn: F) -> {api} where F: FnMut(&'static str) -> *const __gl_imports::raw::c_void {{
#[inline(never)]
fn do_metaloadfn(loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void,
symbol: &str,
symbols: &[&str])
fn do_metaloadfn(loadfn: &mut FnMut(&'static str) -> *const __gl_imports::raw::c_void,
symbol: &'static str,
symbols: &[&'static str])
-> *const __gl_imports::raw::c_void {{
let mut ptr = loadfn(symbol);
if ptr.is_null() {{
@ -182,7 +182,7 @@ fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
}}
ptr
}}
let mut metaloadfn = |symbol: &str, symbols: &[&str]| {{
let mut metaloadfn = |symbol: &'static str, symbols: &[&'static str]| {{
do_metaloadfn(&mut loadfn, symbol, symbols)
}};
{api} {{",

Просмотреть файл

@ -151,18 +151,6 @@ fn make_enum(ident: String, ty: Option<String>, value: String, alias: Option<Str
let ty = working[..i].to_string();
let value = working[i + 1..].to_string();
(Cow::Owned(ty), value, true)
} else {
panic!("Unexpected value format: {}", value)
}
} else if value.starts_with("EGL_CAST(") && value.ends_with(")") {
// Handling "SpecialNumbers" in the egl.xml file
// The values for these enums has the form `'EGL_CAST(' type ',' expr ')'`.
let working = &value[9..value.len() - 1];
if let Some((i, _)) = working.match_indices(",").next() {
let ty = working[..i].to_string();
let value = working[i + 1..].to_string();
(Cow::Owned(ty), value, true)
} else {
panic!("Unexpected value format: {}", value)
@ -189,6 +177,47 @@ fn make_enum(ident: String, ty: Option<String>, value: String, alias: Option<Str
}
}
fn make_egl_enum(ident: String, ty: Option<String>, value: String, alias: Option<String>) -> Enum {
let (ty, value, cast) = {
if value.starts_with("EGL_CAST(") && value.ends_with(")") {
// Handling "SpecialNumbers" in the egl.xml file
// The values for these enums has the form `'EGL_CAST(' type ',' expr ')'`.
let working = &value[9..value.len() - 1];
if let Some((i, _)) = working.match_indices(",").next() {
let ty = working[..i].to_string();
let value = working[i + 1..].to_string();
(Cow::Owned(ty), value, true)
} else {
panic!("Unexpected value format: {}", value)
}
} else {
match value.chars().next() {
Some('-') | Some('0' ... '9') => (),
_ => panic!("Unexpected value format: {}", value),
}
let ty = match ty {
Some(ref ty) if ty == "ull" => "EGLuint64KHR",
Some(ty) => panic!("Unhandled enum type: {}", ty),
None if value.starts_with('-') => "EGLint",
None if ident == "TRUE" || ident == "FALSE" => "EGLBoolean",
None => "EGLenum",
};
(Cow::Borrowed(ty), value, false)
}
};
Enum {
ident: ident,
value: value,
cast: cast,
alias: alias,
ty: ty,
}
}
fn trim_cmd_prefix(ident: &str, api: Api) -> &str {
match api {
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 | Api::Glsc2 => trim_str(ident, "gl"),
@ -503,7 +532,10 @@ trait Parse: Sized + Iterator<Item = ParseEvent> {
let ty = get_attribute(&attributes, "type");
self.consume_end_element("enum");
make_enum(ident, ty, value, alias)
match api {
Api::Egl => make_egl_enum(ident, ty, value, alias),
_ => make_enum(ident, ty, value, alias)
}
}
fn consume_cmds(&mut self, api: Api) -> (Vec<Cmd>, BTreeMap<String, Vec<String>>) {
@ -1064,17 +1096,6 @@ mod tests {
assert_eq!(e.alias, Some("BAR".to_string()));
}
#[test]
fn test_cast_egl() {
let e = parse::make_enum("FOO".to_string(),
None,
"EGL_CAST(EGLint,-1)".to_string(),
Some("BAR".to_string()));
assert_eq!(e.ident, "FOO");
assert_eq!((&*e.ty, &*e.value), ("EGLint", "-1"));
assert_eq!(e.alias, Some("BAR".to_string()));
}
#[test]
fn test_no_type() {
let e = parse::make_enum("FOO".to_string(),
@ -1134,6 +1155,78 @@ mod tests {
}
}
mod make_egl_enum {
use registry::parse;
#[test]
fn test_cast_egl() {
let e = parse::make_egl_enum("FOO".to_string(),
None,
"EGL_CAST(EGLint,-1)".to_string(),
Some("BAR".to_string()));
assert_eq!(e.ident, "FOO");
assert_eq!((&*e.ty, &*e.value), ("EGLint", "-1"));
assert_eq!(e.alias, Some("BAR".to_string()));
}
#[test]
fn test_ident_true() {
let e = parse::make_egl_enum("TRUE".to_string(), None, "1234".to_string(), None);
assert_eq!(e.ty, "EGLBoolean");
}
#[test]
fn test_ident_false() {
let e = parse::make_egl_enum("FALSE".to_string(), None, "1234".to_string(), None);
assert_eq!(e.ty, "EGLBoolean");
}
#[test]
fn test_ull() {
let e = parse::make_egl_enum("FOO".to_string(),
Some("ull".to_string()),
"1234".to_string(),
None);
assert_eq!(e.ty, "EGLuint64KHR");
}
#[test]
fn test_negative_value() {
let e = parse::make_egl_enum("FOO".to_string(),
None,
"-1".to_string(),
None);
assert_eq!(e.ty, "EGLint");
}
#[test]
#[should_panic]
fn test_unknown_type() {
parse::make_egl_enum("FOO".to_string(),
Some("blargh".to_string()),
String::new(),
None);
}
#[test]
#[should_panic]
fn test_unknown_value() {
parse::make_egl_enum("FOO".to_string(),
None,
"a".to_string(),
None);
}
#[test]
#[should_panic]
fn test_empty_value() {
parse::make_egl_enum("FOO".to_string(),
None,
String::new(),
None);
}
}
mod parse_event {
mod from_xml {
use xml::attribute::OwnedAttribute;

2
third_party/rust/gleam/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{".travis.yml":"29b74b95210896ce634c11a9037638668473b5a1b3b1716c505cb04dbb6341fa","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"dacadef6f04af7170b41899ce02202e0f261b03fb4907828095ea6b0480e20a4","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"2de24b7458d6b88f20324303a48acf64a4f2bbfb83d2ec4d6ff2b4f4a1fd2275","build.rs":"b37b2926b74c1f01bfed9aeaac7286e6570b2b2cc80e51a7583f30c039675ddc","src/gl.rs":"aecca69eced4fa373a58dd8253a2811e5e10d8e247e9a935943ac5160273d1bc","src/gl_fns.rs":"7414bf2232d181de751941b47e67f0b9a74f3672788684556b8bf61773c1d8ee","src/gles_fns.rs":"51bbbece61ebec9cfb6d68eda1fffc1a9955af58f848c9f0e6fb026e5c65e5df","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"959c818d9bbe9f7b7db55dce0bc44673c4da4f4ee122536c40550f984c3b8017"}
{"files":{".travis.yml":"29b74b95210896ce634c11a9037638668473b5a1b3b1716c505cb04dbb6341fa","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"7eb0bbf4c4679d7be4c073b22b77036fa5f89264ee615bbf1f93bdbcc1b9fe75","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"2de24b7458d6b88f20324303a48acf64a4f2bbfb83d2ec4d6ff2b4f4a1fd2275","build.rs":"a1616d76f35b3a6015c2ee22ecf13eb225095b22e4190ef5ef2fcd9197b43ad1","src/gl.rs":"982935c8c519e749b42f124ed105a3cacefc186d597f476bd72ea7c88a3e5070","src/gl_fns.rs":"ea24ea0c6deb06af7809140facd5e0f7fce2bb5b340ef425ce0b10029e95294a","src/gles_fns.rs":"aaced55ced12f5dcbeec9ee88eb91696ab65ca24c41cb6fd7f2bdf380641ceb7","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"70363479f033b72dbd558fd3b6f153dd824bf4f9dcd05dfcff6cd29a3eb9a63d"}

7
third_party/rust/gleam/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "gleam"
version = "0.4.20"
version = "0.4.32"
authors = ["The Servo Project Developers"]
build = "build.rs"
description = "Generated OpenGL bindings and wrapper for Servo."
@ -20,7 +20,4 @@ documentation = "http://doc.servo.org/gleam/"
license = "Apache-2.0/MIT"
repository = "https://github.com/servo/gleam"
[build-dependencies.gl_generator]
version = "0.8"
[build-dependencies.pkg-config]
version = "0.3.8"
version = "0.9"

25
third_party/rust/gleam/build.rs поставляемый
Просмотреть файл

@ -1,5 +1,4 @@
extern crate gl_generator;
extern crate pkg_config;
use std::env;
use std::fs::File;
@ -13,16 +12,19 @@ fn main() {
let mut file_gles = File::create(&Path::new(&dest).join("gles_bindings.rs")).unwrap();
// OpenGL 3.3 bindings
let gl_extensions = ["GL_ARB_texture_rectangle",
"GL_EXT_debug_marker",
"GL_APPLE_client_storage",
"GL_APPLE_texture_range",
"GL_APPLE_fence",
"GL_ARB_get_program_binary",
"GL_ARB_blend_func_extended"];
let gl_extensions = [
"GL_ARB_texture_rectangle",
"GL_EXT_debug_marker",
"GL_APPLE_client_storage",
"GL_APPLE_texture_range",
"GL_APPLE_fence",
"GL_ARB_get_program_binary",
"GL_ARB_blend_func_extended",
"GL_KHR_debug",
];
let gl_reg = Registry::new(Api::Gl, (3, 3), Profile::Core, Fallbacks::All, gl_extensions);
gl_reg.write_bindings(gl_generator::StructGenerator, &mut file_gl)
.unwrap();
.unwrap();
// GLES 3.0 bindings
let gles_extensions = [
@ -31,13 +33,14 @@ fn main() {
"GL_OES_EGL_image_external",
"GL_EXT_disjoint_timer_query",
"GL_EXT_debug_marker",
"GL_KHR_debug",
];
let gles_reg = Registry::new(Api::Gles2, (3, 0), Profile::Core, Fallbacks::All, gles_extensions);
gles_reg.write_bindings(gl_generator::StructGenerator, &mut file_gles)
.unwrap();
.unwrap();
// OpenGL 3.3 + GLES 3.0 bindings. Used to get all enums
let gl_reg = gl_reg + gles_reg;
gl_reg.write_bindings(gl_generator::StructGenerator, &mut file_gl_and_gles)
.unwrap();
.unwrap();
}

58
third_party/rust/gleam/src/gl.rs поставляемый
Просмотреть файл

@ -13,7 +13,6 @@ use std::os::raw::{c_char, c_int, c_void};
use std::ptr;
use std::rc::Rc;
use std::str;
use std::iter::repeat;
use std::ffi::{CString, CStr};
use ffi;
@ -63,6 +62,45 @@ fn calculate_length(width: GLsizei, height: GLsizei, format: GLenum, pixel_type:
return (width * height * colors * depth) as usize;
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn get_uniform_iv_vector_length(uniform_type: &GLuint) -> usize {
match *uniform_type {
ffi::BOOL |
ffi::INT |
ffi::SAMPLER_2D |
ffi::SAMPLER_CUBE => 1,
ffi::INT_VEC2 |
ffi::BOOL_VEC2 => 2,
ffi::INT_VEC3 |
ffi::BOOL_VEC3 => 3,
ffi::INT_VEC4 |
ffi::BOOL_VEC4 => 4,
_ => panic!("Invalid location argument"),
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn get_uniform_fv_vector_length(uniform_type: &GLuint) -> usize {
match *uniform_type {
ffi::FLOAT => 1,
ffi::FLOAT_VEC2 => 2,
ffi::FLOAT_VEC3 => 3,
ffi::FLOAT_VEC4 |
ffi::FLOAT_MAT2 => 4,
ffi::FLOAT_MAT3 => 9,
ffi::FLOAT_MAT4 => 16,
_ => panic!("Invalid location argument"),
}
}
pub struct DebugMessage {
pub message: String,
pub source: GLenum,
pub ty: GLenum,
pub id: GLenum,
pub severity: GLenum,
}
pub trait Gl {
fn get_type(&self) -> GlType;
fn buffer_data_untyped(&self,
@ -130,6 +168,8 @@ pub trait Gl {
fn active_texture(&self, texture: GLenum);
fn attach_shader(&self, program: GLuint, shader: GLuint);
fn bind_attrib_location(&self, program: GLuint, index: GLuint, name: &str);
fn get_uniform_iv(&self, program: GLuint, location: GLint) -> Vec<GLint>;
fn get_uniform_fv(&self, program: GLuint, location: GLint) -> Vec<GLfloat>;
fn get_uniform_block_index(&self, program: GLuint, name: &str) -> GLuint;
fn get_uniform_indices(&self, program: GLuint, names: &[&str]) -> Vec<GLuint>;
fn bind_buffer_base(&self, target: GLenum, index: GLuint, buffer: GLuint);
@ -143,6 +183,7 @@ pub trait Gl {
fn bind_renderbuffer(&self, target: GLenum, renderbuffer: GLuint);
fn bind_framebuffer(&self, target: GLenum, framebuffer: GLuint);
fn bind_texture(&self, target: GLenum, texture: GLuint);
fn draw_buffers(&self, bufs: &[GLenum]);
fn tex_image_2d(&self,
target: GLenum,
level: GLint,
@ -265,6 +306,12 @@ pub trait Gl {
fn get_integer_64iv(&self, name: GLenum, index: GLuint) -> GLint64;
fn get_boolean_v(&self, name: GLenum) -> GLboolean;
fn get_float_v(&self, name: GLenum) -> GLfloat;
fn get_framebuffer_attachment_parameter_iv(&self,
target: GLenum,
attachment: GLenum,
pname: GLenum) -> GLint;
fn get_tex_parameter_iv(&self, target: GLenum, name: GLenum) -> GLint;
fn get_tex_parameter_fv(&self, target: GLenum, name: GLenum) -> GLfloat;
fn tex_parameter_i(&self, target: GLenum, pname: GLenum, param: GLint);
fn tex_parameter_f(&self, target: GLenum, pname: GLenum, param: GLfloat);
fn framebuffer_texture_2d(&self,
@ -312,6 +359,7 @@ pub trait Gl {
offset: GLuint);
fn vertex_attrib_divisor(&self, index: GLuint, divisor: GLuint);
fn viewport(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei);
fn get_viewport(&self) -> (GLint, GLint, GLsizei, GLsizei);
fn scissor(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei);
fn line_width(&self, width: GLfloat);
fn use_program(&self, program: GLuint);
@ -456,6 +504,14 @@ pub trait Gl {
program: GLuint,
name: &str,
) -> GLint;
fn alias_point_size_range(&self) -> (GLfloat, GLfloat);
/// Returns the the maximum supported width and height of the viewport.
fn max_viewport_dims(&self) -> (GLint, GLint);
// GL_KHR_debug
fn get_debug_messages(&self) -> Vec<DebugMessage>;
}
#[inline]

221
third_party/rust/gleam/src/gl_fns.rs поставляемый
Просмотреть файл

@ -19,6 +19,21 @@ impl GlFns
ffi_gl_: ffi_gl_,
}) as Rc<Gl>
}
fn get_active_uniform_type(&self, program: GLuint) -> GLuint {
let mut size: GLint = 0;
let mut uniform_type: GLuint = 0;
unsafe {
self.ffi_gl_.GetActiveUniform(program,
0 as GLuint,
0 as GLsizei,
ptr::null_mut(),
&mut size,
&mut uniform_type,
ptr::null_mut());
}
uniform_type
}
}
impl Gl for GlFns {
@ -109,47 +124,47 @@ impl Gl for GlFns {
}
fn gen_buffers(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenBuffers(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_renderbuffers(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenRenderbuffers(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_framebuffers(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenFramebuffers(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_textures(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenTextures(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_vertex_arrays(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenVertexArrays(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_queries(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0; n as usize];
let mut result = vec![0 as GLuint; n as usize];
unsafe {
self.ffi_gl_.GenQueries(n, result.as_mut_ptr());
}
@ -293,6 +308,28 @@ impl Gl for GlFns {
}
}
// https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetUniform.xml
fn get_uniform_iv(&self, program: GLuint, location: GLint) -> Vec<GLint> {
let uniform_type = self.get_active_uniform_type(program);
let len = get_uniform_iv_vector_length(&uniform_type);
let mut result: [GLint; 4] = [0; 4];
unsafe {
self.ffi_gl_.GetUniformiv(program, location, result.as_mut_ptr());
}
Vec::from(&result[0..len])
}
// https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetUniform.xml
fn get_uniform_fv(&self, program: GLuint, location: GLint) -> Vec<GLfloat> {
let uniform_type = self.get_active_uniform_type(program);
let len = get_uniform_fv_vector_length(&uniform_type);
let mut result: [GLfloat; 16] = [0.0; 16];
unsafe {
self.ffi_gl_.GetUniformfv(program, location, result.as_mut_ptr());
}
Vec::from(&result[0..len])
}
fn get_uniform_block_index(&self, program: GLuint, name: &str) -> GLuint {
let c_string = CString::new(name).unwrap();
unsafe {
@ -362,6 +399,12 @@ impl Gl for GlFns {
}
}
fn draw_buffers(&self, bufs: &[GLenum]) {
unsafe {
self.ffi_gl_.DrawBuffers(bufs.len() as GLsizei, bufs.as_ptr());
}
}
// FIXME: Does not verify buffer size -- unsafe!
fn tex_image_2d(&self,
target: GLenum,
@ -645,7 +688,7 @@ impl Gl for GlFns {
}
fn get_boolean_v(&self, name: GLenum) -> GLboolean {
let mut result: GLboolean = 0 as GLboolean;
let mut result = 0 as GLboolean;
unsafe {
self.ffi_gl_.GetBooleanv(name, &mut result);
}
@ -653,13 +696,37 @@ impl Gl for GlFns {
}
fn get_float_v(&self, name: GLenum) -> GLfloat {
let mut result: GLfloat = 0 as GLfloat;
let mut result = 0 as GLfloat;
unsafe {
self.ffi_gl_.GetFloatv(name, &mut result);
}
result
}
fn get_framebuffer_attachment_parameter_iv(&self, target: GLenum, attachment: GLenum, pname: GLenum) -> GLint {
let mut result: GLint = 0;
unsafe {
self.ffi_gl_.GetFramebufferAttachmentParameteriv(target, attachment, pname, &mut result);
}
result
}
fn get_tex_parameter_iv(&self, target: GLenum, pname: GLenum) -> GLint {
let mut result: GLint = 0;
unsafe {
self.ffi_gl_.GetTexParameteriv(target, pname, &mut result);
}
result
}
fn get_tex_parameter_fv(&self, target: GLenum, pname: GLenum) -> GLfloat {
let mut result: GLfloat = 0.0;
unsafe {
self.ffi_gl_.GetTexParameterfv(target, pname, &mut result);
}
result
}
fn tex_parameter_i(&self, target: GLenum, pname: GLenum, param: GLint) {
unsafe {
self.ffi_gl_.TexParameteri(target, pname, param);
@ -790,6 +857,14 @@ impl Gl for GlFns {
}
}
fn get_viewport(&self) -> (GLint, GLint, GLsizei, GLsizei) {
unsafe {
let mut ret = [0; 4];
self.ffi_gl_.GetIntegerv(ffi::VIEWPORT, ret.as_mut_ptr());
(ret[0], ret[1], ret[2], ret[3])
}
}
fn scissor(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei) {
unsafe {
self.ffi_gl_.Scissor(x, y, width, height);
@ -1235,24 +1310,25 @@ impl Gl for GlFns {
}
fn get_program_info_log(&self, program: GLuint) -> String {
let max_len = self.get_program_iv(program, ffi::INFO_LOG_LENGTH);
let mut result = vec![0u8; max_len as usize];
let mut result_len = 0 as GLsizei;
unsafe {
let mut result = vec![0u8; 1024];
let mut result_len: GLsizei = 0 as GLsizei;
self.ffi_gl_.GetProgramInfoLog(program,
1024 as GLsizei,
max_len as GLsizei,
&mut result_len,
result.as_mut_ptr() as *mut GLchar);
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
fn get_program_iv(&self, program: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetProgramiv(program, pname, &mut result);
return result;
}
result
}
fn get_program_binary(&self, program: GLuint) -> (Vec<u8>, GLenum) {
@ -1303,19 +1379,19 @@ impl Gl for GlFns {
}
fn get_vertex_attrib_iv(&self, index: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetVertexAttribiv(index, pname, &mut result);
return result;
}
result
}
fn get_vertex_attrib_fv(&self, index: GLuint, pname: GLenum) -> Vec<GLfloat> {
let mut result = vec![0 as GLfloat; 4];
unsafe {
let mut result = vec![0 as GLfloat; 4];
self.ffi_gl_.GetVertexAttribfv(index, pname, result.as_mut_ptr());
return result;
}
result
}
fn get_vertex_attrib_pointer_v(&self, index: GLuint, pname: GLenum) -> GLsizeiptr {
@ -1327,24 +1403,25 @@ impl Gl for GlFns {
}
fn get_buffer_parameter_iv(&self, target: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetBufferParameteriv(target, pname, &mut result);
return result;
}
result
}
fn get_shader_info_log(&self, shader: GLuint) -> String {
let max_len = self.get_shader_iv(shader, ffi::INFO_LOG_LENGTH);
let mut result = vec![0u8; max_len as usize];
let mut result_len = 0 as GLsizei;
unsafe {
let mut result = vec![0u8; 1024];
let mut result_len: GLsizei = 0 as GLsizei;
self.ffi_gl_.GetShaderInfoLog(shader,
1024 as GLsizei,
max_len as GLsizei,
&mut result_len,
result.as_mut_ptr() as *mut GLchar);
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
fn get_string(&self, which: GLenum) -> String {
@ -1370,11 +1447,11 @@ impl Gl for GlFns {
}
fn get_shader_iv(&self, shader: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetShaderiv(shader, pname, &mut result);
return result;
}
result
}
fn get_shader_precision_format(&self, _shader_type: GLuint, precision_type: GLuint) -> (GLint, GLint, GLint) {
@ -1599,11 +1676,11 @@ impl Gl for GlFns {
}
fn gen_fences_apple(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenFencesAPPLE(n, result.as_mut_ptr());
result
}
result
}
fn delete_fences_apple(&self, fences: &[GLuint]) {
@ -1672,5 +1749,79 @@ impl Gl for GlFns {
)
}
}
fn alias_point_size_range(&self) -> (GLfloat, GLfloat) {
unsafe {
let mut ret = [0.; 2];
self.ffi_gl_.GetFloatv(ffi::ALIASED_POINT_SIZE_RANGE, ret.as_mut_ptr());
(ret[0], ret[1])
}
}
fn max_viewport_dims(&self) -> (GLint, GLint) {
unsafe {
let mut ret = [0; 2];
self.ffi_gl_.GetIntegerv(ffi::MAX_VIEWPORT_DIMS, ret.as_mut_ptr());
(ret[0], ret[1])
}
}
// GL_KHR_debug
fn get_debug_messages(&self) -> Vec<DebugMessage> {
if !self.ffi_gl_.GetDebugMessageLog.is_loaded() {
return Vec::new();
}
let mut max_message_len = 0;
unsafe {
self.ffi_gl_.GetIntegerv(
ffi::MAX_DEBUG_MESSAGE_LENGTH,
&mut max_message_len
)
}
let mut output = Vec::new();
const CAPACITY: usize = 4;
let mut msg_data = vec![0u8; CAPACITY * max_message_len as usize];
let mut sources = [0 as GLenum; CAPACITY];
let mut types = [0 as GLenum; CAPACITY];
let mut severities = [0 as GLenum; CAPACITY];
let mut ids = [0 as GLuint; CAPACITY];
let mut lengths = [0 as GLsizei; CAPACITY];
loop {
let count = unsafe {
self.ffi_gl_.GetDebugMessageLog(
CAPACITY as _,
msg_data.len() as _,
sources.as_mut_ptr(),
types.as_mut_ptr(),
ids.as_mut_ptr(),
severities.as_mut_ptr(),
lengths.as_mut_ptr(),
msg_data.as_mut_ptr() as *mut _,
)
};
let mut offset = 0;
output.extend((0 .. count as usize).map(|i| {
let len = lengths[i] as usize;
let slice = &msg_data[offset .. offset + len];
offset += len;
DebugMessage {
message: String::from_utf8_lossy(slice).to_string(),
source: sources[i],
ty: types[i],
id: ids[i],
severity: severities[i],
}
}));
if (count as usize) < CAPACITY {
return output
}
}
}
}

219
third_party/rust/gleam/src/gles_fns.rs поставляемый
Просмотреть файл

@ -19,6 +19,21 @@ impl GlesFns
ffi_gl_: ffi_gl_,
}) as Rc<Gl>
}
fn get_active_uniform_type(&self, program: GLuint) -> GLuint {
let mut size: GLint = 0;
let mut uniform_type: GLuint = 0;
unsafe {
self.ffi_gl_.GetActiveUniform(program,
0 as GLuint,
0 as GLsizei,
ptr::null_mut(),
&mut size,
&mut uniform_type,
ptr::null_mut());
}
uniform_type
}
}
impl Gl for GlesFns {
@ -106,50 +121,50 @@ impl Gl for GlesFns {
}
fn gen_buffers(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenBuffers(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_renderbuffers(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenRenderbuffers(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_framebuffers(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenFramebuffers(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_textures(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenTextures(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_vertex_arrays(&self, n: GLsizei) -> Vec<GLuint> {
let mut result = vec![0 as GLuint; n as usize];
unsafe {
let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect();
self.ffi_gl_.GenVertexArrays(n, result.as_mut_ptr());
return result;
}
result
}
fn gen_queries(&self, n: GLsizei) -> Vec<GLuint> {
if !self.ffi_gl_.GenQueriesEXT.is_loaded() {
return Vec::new();
}
let mut result = vec![0; n as usize];
let mut result = vec![0 as GLuint; n as usize];
unsafe {
self.ffi_gl_.GenQueriesEXT(n, result.as_mut_ptr());
}
@ -317,6 +332,28 @@ impl Gl for GlesFns {
}
}
// https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetUniform.xml
fn get_uniform_iv(&self, program: GLuint, location: GLint) -> Vec<GLint> {
let uniform_type = self.get_active_uniform_type(program);
let len = get_uniform_iv_vector_length(&uniform_type);
let mut result: [GLint; 4] = [0; 4];
unsafe {
self.ffi_gl_.GetUniformiv(program, location, result.as_mut_ptr());
}
Vec::from(&result[0..len])
}
// https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetUniform.xml
fn get_uniform_fv(&self, program: GLuint, location: GLint) -> Vec<GLfloat> {
let uniform_type = self.get_active_uniform_type(program);
let len = get_uniform_fv_vector_length(&uniform_type);
let mut result: [GLfloat; 16] = [0.0; 16];
unsafe {
self.ffi_gl_.GetUniformfv(program, location, result.as_mut_ptr());
}
Vec::from(&result[0..len])
}
fn get_uniform_block_index(&self, program: GLuint, name: &str) -> GLuint {
let c_string = CString::new(name).unwrap();
unsafe {
@ -386,6 +423,12 @@ impl Gl for GlesFns {
}
}
fn draw_buffers(&self, bufs: &[GLenum]) {
unsafe {
self.ffi_gl_.DrawBuffers(bufs.len() as GLsizei, bufs.as_ptr());
}
}
// FIXME: Does not verify buffer size -- unsafe!
fn tex_image_2d(&self,
target: GLenum,
@ -665,7 +708,7 @@ impl Gl for GlesFns {
}
fn get_boolean_v(&self, name: GLenum) -> GLboolean {
let mut result: GLboolean = 0 as GLboolean;
let mut result = 0 as GLboolean;
unsafe {
self.ffi_gl_.GetBooleanv(name, &mut result);
}
@ -673,13 +716,37 @@ impl Gl for GlesFns {
}
fn get_float_v(&self, name: GLenum) -> GLfloat {
let mut result: GLfloat = 0 as GLfloat;
let mut result = 0 as GLfloat;
unsafe {
self.ffi_gl_.GetFloatv(name, &mut result);
}
result
}
fn get_framebuffer_attachment_parameter_iv(&self, target: GLenum, attachment: GLenum, pname: GLenum) -> GLint {
let mut result: GLint = 0;
unsafe {
self.ffi_gl_.GetFramebufferAttachmentParameteriv(target, attachment, pname, &mut result);
}
result
}
fn get_tex_parameter_iv(&self, target: GLenum, pname: GLenum) -> GLint {
let mut result: GLint = 0;
unsafe {
self.ffi_gl_.GetTexParameteriv(target, pname, &mut result);
}
result
}
fn get_tex_parameter_fv(&self, target: GLenum, pname: GLenum) -> GLfloat {
let mut result: GLfloat = 0.0;
unsafe {
self.ffi_gl_.GetTexParameterfv(target, pname, &mut result);
}
result
}
fn tex_parameter_i(&self, target: GLenum, pname: GLenum, param: GLint) {
unsafe {
self.ffi_gl_.TexParameteri(target, pname, param);
@ -810,6 +877,14 @@ impl Gl for GlesFns {
}
}
fn get_viewport(&self) -> (GLint, GLint, GLsizei, GLsizei) {
unsafe {
let mut ret = [0; 4];
self.ffi_gl_.GetIntegerv(ffi::VIEWPORT, ret.as_mut_ptr());
(ret[0], ret[1], ret[2], ret[3])
}
}
fn scissor(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei) {
unsafe {
self.ffi_gl_.Scissor(x, y, width, height);
@ -1196,7 +1271,7 @@ impl Gl for GlesFns {
}
fn get_active_uniform_block_i(&self, program: GLuint, index: GLuint, pname: GLenum) -> GLint {
let mut result = 0;
let mut result = 0 as GLint;
unsafe {
self.ffi_gl_.GetActiveUniformBlockiv(program, index, pname, &mut result);
}
@ -1249,24 +1324,25 @@ impl Gl for GlesFns {
}
fn get_program_info_log(&self, program: GLuint) -> String {
let max_len = self.get_program_iv(program, ffi::INFO_LOG_LENGTH);
let mut result = vec![0u8; max_len as usize];
let mut result_len = 0 as GLsizei;
unsafe {
let mut result = vec![0u8; 1024];
let mut result_len: GLsizei = 0 as GLsizei;
self.ffi_gl_.GetProgramInfoLog(program,
1024 as GLsizei,
max_len as GLsizei,
&mut result_len,
result.as_mut_ptr() as *mut GLchar);
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
fn get_program_iv(&self, program: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetProgramiv(program, pname, &mut result);
return result;
}
result
}
fn get_program_binary(&self, program: GLuint) -> (Vec<u8>, GLenum) {
@ -1308,19 +1384,19 @@ impl Gl for GlesFns {
}
fn get_vertex_attrib_iv(&self, index: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetVertexAttribiv(index, pname, &mut result);
return result;
}
result
}
fn get_vertex_attrib_fv(&self, index: GLuint, pname: GLenum) -> Vec<GLfloat> {
let mut result = vec![0 as GLfloat; 4];
unsafe {
let mut result = vec![0 as GLfloat; 4];
self.ffi_gl_.GetVertexAttribfv(index, pname, result.as_mut_ptr());
return result;
}
result
}
fn get_vertex_attrib_pointer_v(&self, index: GLuint, pname: GLenum) -> GLsizeiptr {
@ -1332,24 +1408,25 @@ impl Gl for GlesFns {
}
fn get_buffer_parameter_iv(&self, target: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetBufferParameteriv(target, pname, &mut result);
return result;
}
result
}
fn get_shader_info_log(&self, shader: GLuint) -> String {
let max_len = self.get_shader_iv(shader, ffi::INFO_LOG_LENGTH);
let mut result = vec![0u8; max_len as usize];
let mut result_len = 0 as GLsizei;
unsafe {
let mut result = vec![0u8; 1024];
let mut result_len: GLsizei = 0 as GLsizei;
self.ffi_gl_.GetShaderInfoLog(shader,
1024 as GLsizei,
max_len as GLsizei,
&mut result_len,
result.as_mut_ptr() as *mut GLchar);
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
result.truncate(if result_len > 0 {result_len as usize} else {0});
String::from_utf8(result).unwrap()
}
fn get_string(&self, which: GLenum) -> String {
@ -1375,11 +1452,11 @@ impl Gl for GlesFns {
}
fn get_shader_iv(&self, shader: GLuint, pname: GLenum) -> GLint {
let mut result = 0 as GLint;
unsafe {
let mut result: GLint = 0 as GLint;
self.ffi_gl_.GetShaderiv(shader, pname, &mut result);
return result;
}
result
}
fn get_shader_precision_format(&self,
@ -1633,5 +1710,79 @@ impl Gl for GlesFns {
) -> GLint {
panic!("not supported");
}
fn alias_point_size_range(&self) -> (GLfloat, GLfloat) {
unsafe {
let mut ret = [0.; 2];
self.ffi_gl_.GetFloatv(ffi::ALIASED_POINT_SIZE_RANGE, ret.as_mut_ptr());
(ret[0], ret[1])
}
}
fn max_viewport_dims(&self) -> (GLint, GLint) {
unsafe {
let mut ret = [0; 2];
self.ffi_gl_.GetIntegerv(ffi::MAX_VIEWPORT_DIMS, ret.as_mut_ptr());
(ret[0], ret[1])
}
}
// GL_KHR_debug
fn get_debug_messages(&self) -> Vec<DebugMessage> {
if !self.ffi_gl_.GetDebugMessageLog.is_loaded() {
return Vec::new();
}
let mut max_message_len = 0;
unsafe {
self.ffi_gl_.GetIntegerv(
ffi::MAX_DEBUG_MESSAGE_LENGTH,
&mut max_message_len
)
}
let mut output = Vec::new();
const CAPACITY: usize = 4;
let mut msg_data = vec![0u8; CAPACITY * max_message_len as usize];
let mut sources = [0 as GLenum; CAPACITY];
let mut types = [0 as GLenum; CAPACITY];
let mut severities = [0 as GLenum; CAPACITY];
let mut ids = [0 as GLuint; CAPACITY];
let mut lengths = [0 as GLsizei; CAPACITY];
loop {
let count = unsafe {
self.ffi_gl_.GetDebugMessageLog(
CAPACITY as _,
msg_data.len() as _,
sources.as_mut_ptr(),
types.as_mut_ptr(),
ids.as_mut_ptr(),
severities.as_mut_ptr(),
lengths.as_mut_ptr(),
msg_data.as_mut_ptr() as *mut _,
)
};
let mut offset = 0;
output.extend((0 .. count as usize).map(|i| {
let len = lengths[i] as usize;
let slice = &msg_data[offset .. offset + len];
offset += len;
DebugMessage {
message: String::from_utf8_lossy(slice).to_string(),
source: sources[i],
ty: types[i],
id: ids[i],
severity: severities[i],
}
}));
if (count as usize) < CAPACITY {
return output
}
}
}
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

4
third_party/rust/khronos_api/Cargo.toml поставляемый
Просмотреть файл

@ -12,9 +12,9 @@
[package]
name = "khronos_api"
version = "2.0.0"
version = "2.2.0"
authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>", "Corey Richardson", "Arseny Kapoulkine", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
include = ["/README.md", "/src/**/*", "/Cargo.toml", "/api/xml/**/*.xml", "/api_egl/api/**/*.xml"]
include = ["/README.md", "/src/**/*", "/Cargo.toml", "/build.rs", "/api/xml/**/*.xml", "/api_egl/api/**/*.xml", "/api_webgl/specs/latest/**/*.idl", "/api_webgl/extensions/**/extension.xml"]
description = "The Khronos XML API Registry, exposed as byte string constants."
homepage = "https://github.com/brendanzab/gl-rs/khronos_api/"
documentation = "https://docs.rs/khronos_api"

3
third_party/rust/khronos_api/README.md поставляемый
Просмотреть файл

@ -17,6 +17,9 @@ The following constants are provided:
- `EGL_XML`: the contents of [`egl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/egl.xml)
- `WGL_XML`: the contents of [`wgl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml)
- `GLX_XML`: the contents of [`glx.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/glx.xml)
- `WEBGL_IDL`: the contents of [`webgl.idl`](https://raw.githubusercontent.com/KhronosGroup/WebGL/master/specs/latest/1.0/webgl.idl)
- `WEBGL2_IDL`: the contents of [`webgl2.idl`](https://raw.githubusercontent.com/KhronosGroup/WebGL/master/specs/latest/2.0/webgl2.idl)
- `WEBGL_EXT_XML`: the contents of the WebGL extension XML files
## Changelog

Просмотреть файл

@ -0,0 +1,78 @@
<?xml version="1.0"?>
<ratified href="ANGLE_instanced_arrays/">
<name>ANGLE_instanced_arrays</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Contributors to ANGLE_instanced_arrays</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>19</number>
<depends>
<api version="1.0"/>
<core version="2.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/ANGLE/ANGLE_instanced_arrays.txt" name="ANGLE_instanced_arrays">
<addendum>
The implementation must validate the indices referenced by <code>drawArraysInstancedANGLE</code> and <code>drawElementsInstancedANGLE</code>
similarly to how indices referenced by <code>drawArrays</code> and <code>drawElements</code> are validated according to section
<a href="http://www.khronos.org/registry/webgl/specs/1.0/#ATTRIBS_AND_RANGE_CHECKING">Enabled Vertex Attributes and Range Checking</a> of the
WebGL specification.
</addendum>
</mirrors>
<p>
Although the extension contains ANGLE in the name it may be exposed by any implementation, whether or not the implementation uses the ANGLE library.
</p>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface ANGLE_instanced_arrays {
const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
void drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
void vertexAttribDivisorANGLE(GLuint index, GLuint divisor);
};
</idl>
<issues>
<p>How does ANGLE_instanced_arrays interact with OES_vertex_array_object?</p>
<ul>
<li>
<p>RESOLVED: When the ANGLE_instanced_arrays and OES_vertex_array_object
extensions are both enabled, attribute divisors are tracked by the
vertex array objects like any other vertex array state.
</p>
</li>
</ul>
</issues>
<history>
<revision date="2012/03/06">
<change>Initial revision.</change>
</revision>
<revision date="2013/01/26">
<change>Moved from proposal to draft.</change>
</revision>
<revision date="2013/03/11">
<change>Renumbered to 19 to fix misnumbering problem.</change>
</revision>
<revision date="2013/08/06">
<change>Moved to community approved.</change>
</revision>
<revision date="2013/08/22">
<change>Clarified non-ANGLE support.</change>
</revision>
<revision date="2014/03/13">
<change>Addendum about index validation.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/08/08">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2015/09/23">
<change>Clarified interaction with OES_vertex_array_object.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<ratified href="EXT_blend_minmax/">
<name>EXT_blend_minmax</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>25</number>
<depends>
<api version="1.0"/>
<core version="2.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/blend_minmax.txt"
name="EXT_blend_minmax">
</mirrors>
<features>
<feature>
The <code>blendEquation</code> and <code>blendEquationSeparate</code>
entry points are extended to accept <code>MIN_EXT</code> and <code>MAX_EXT</code>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_blend_minmax {
const GLenum MIN_EXT = 0x8007;
const GLenum MAX_EXT = 0x8008;
};
</idl>
<samplecode xml:space="preserve">
<pre>
var ext = gl.getExtension('EXT_blend_minmax');
gl.blendEquation(ext.MAX_EXT);
gl.getParameter(gl.BLEND_EQUATION) == ext.MAX_EXT;
</pre>
</samplecode>
<history>
<revision date="2012/12/12">
<change>Initial revision.</change>
</revision>
<revision date="2014/02/12">
<change>Moved to draft.</change>
</revision>
<revision date="2014/05/12">
<change>Removed blendEquationEXT function and the BLEND_EQUATION_EXT and
FUNC_ADD_EXT enums, all of which are already have equivalents in WebGL.</change>
</revision>
<revision date="2014/06/27">
<change>Moved to community approved after discussion on public_webgl list.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2015/05/29">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension href="EXT_color_buffer_float/">
<name>EXT_color_buffer_float</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Mark Callow, HI Corporation</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>31</number>
<depends>
<api version="2.0"/>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_color_buffer_float.txt"
name="EXT_color_buffer_float">
<addendum>
The sized internal format <code>RGB16F</code> is not color-renderable in this
extension. This is a difference in functionality compared to the <a
href="../EXT_color_buffer_half_float">EXT_color_buffer_half_float</a> extension.
</addendum>
</mirrors>
<features>
<feature>
<p>The following floating-point internal formats become <span
style="font-style: italic">color-renderable</span>: <code>R16F</code>,
<code>RG16F</code>, <code>RGBA16F</code>, <code>R32F</code>,
<code>RG32F</code>, <code>RGBA32F</code> and
<code>R11F_G11F_B10F</code>. A renderbuffer or a texture with a
color-renderable internal format can be used as a rendering target by
attaching it to a framebuffer object as a color attachment.</p>
</feature>
<feature>
<p>Renderbuffers with these internal formats can be created.</p>
</feature>
<feature>
<p>The format and type combination <code>RGBA</code> and
<code>FLOAT</code> becomes valid for reading from a floating-point
color buffer.</p>
</feature>
</features>
<p>Notes: <ul style="list-style-type: circle">
<li>Fragment shader outputs to buffers with these internal formats are
not clamped.</li>
<li>Colors specified with <code>clearColor</code> and
<code>blendColor</code> are not clamped when applied to buffers with
these internal formats.</li>
<li>The format and type combination <code>RGBA</code> and
<code>UNSIGNED_BYTE</code> cannot be used for reading from a
floating-point color buffer.</li>
<li>Multi-sample floating-point color renderbuffers may optionally be supported. Limitations
are defined in the <a
href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_color_buffer_float.txt">EXT_color_buffer_float</a>
extension.</li>
<li>The sized internal format <code>RGB16F</code> is not color-renderable in this
extension.</li>
</ul></p>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_color_buffer_float {
}; // interface EXT_color_buffer_float
</idl>
<history>
<revision date="2012/11/08">
<change>Initial revision.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/10/29">
<change>Moved to draft status.</change>
</revision>
<revision date="2016/04/14">
<change>Moved to community approved status.</change>
</revision>
<revision date="2016/06/16">
<change>Added note about RGB16F not being color-renderable.</change>
</revision>
<revision date="2016/07/21">
<change>Allowed allocation of multi-sample floating-point color renderbuffers as optional functionality.</change>
<change>Changed XML tags to fix incorrect statement that there are no behavioral changes compared to the native extension.</change>
</revision>
<revision date="2016/08/03">
<change>Removed incorrect statement about framebuffer completeness and multi-sampled floating-point color renderbuffers.</change>
</revision>
<revision date="2017/04/19">
<change>Allowed these float formats for CopyTexImage2D.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension href="EXT_color_buffer_half_float/">
<name>EXT_color_buffer_half_float</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Mark Callow, HI Corporation</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>14</number>
<depends>
<api version="1.0"/>
<ext name="OES_texture_half_float" require="true"/>
<subsumed version="2.0" by="EXT_color_buffer_float" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_color_buffer_half_float.txt"
name="EXT_color_buffer_half_float">
<addendum>
<p>All references to <code>R16F</code> and <code>RG16F</code> types
are ignored.</p>
</addendum>
<addendum>
<p>WebGL implementations supporting this extension are required to
support rendering to <code>RGBA16F</code> format.</p>
</addendum>
</mirrors>
<features>
<feature>
<p>The 16-bit floating-point types <code>RGB16F</code> and
<code>RGBA16F</code> become available as color-renderable formats.
Renderbuffers can be created in these formats. These and textures
created with <code>type = HALF_FLOAT_OES</code>, which will have one
of these internal formats, can be attached to framebuffer object color
attachments for rendering. Implementations supporting this extension are
required to support rendering to <code>RGBA16F</code> format.
Applications must check framebuffer completeness to determine if
<code>RGB16F</code> is supported.</p>
</feature>
<feature>
<p><span style="color: red">NOTE:</span> fragment shaders outputs
gl_FragColor and gl_FragData[0] will only be clamped and converted
when the color buffer is fixed-point and <code>blendColor()</code> and
<code>clearColor()</code> will no longer clamp their parameter values
on input. Clamping will be applied as necessary at draw time according
to the type of color buffer in use.</p>
</feature>
<feature>
<p>The format and type combination <code>RGBA</code> and
<code>FLOAT</code> becomes valid for reading from a floating-point
rendering buffer. Note: <code>RGBA</code> and
<code>UNSIGNED_BYTE</code> cannot be used for reading from a
floating-point rendering buffer.</p>
</feature>
<feature>
<p>The component types of framebuffer object attachments can be
queried.</p>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_color_buffer_half_float {
const GLenum RGBA16F_EXT = 0x881A;
const GLenum RGB16F_EXT = 0x881B;
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211;
const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17;
}; // interface EXT_color_buffer_half_float
</idl>
<additions>
<p>In section 5.13.12 <cite>Reading back pixels</cite>, change the allowed
format and types table to:</p>
<dl class="methods">
<dd>
<table>
<tbody>
<tr>
<th>frame buffer type</th>
<th>
<code>format</code>
</th>
<th>
<code>type</code>
</th>
</tr>
<tr>
<td>normalized fixed-point</td>
<td>RGBA</td>
<td>UNSIGNED_BYTE</td>
</tr>
<tr>
<td>floating-point</td>
<td>RGBA</td>
<td>FLOAT</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>Change the paragraph beginning "If <code>pixels</code> is null ..."
to</p><blockquote>If frame buffer type is not that indicated in the table for
the <code>format</code> and <code>type</code> combination, an
INVALID_OPERATON error is generated. If pixels is null
...</blockquote>
</additions>
<history>
<revision date="2012/11/08">
<change>Initial revision.</change>
</revision>
<revision date="2012/11/13">
<change>"Add reading-pixels-as-FLOAT feature to the Overview and related
changes to WebGL section 5.13.12.</change>
</revision>
<revision date="2012/11/26">
<change>Move to draft.</change>
</revision>
<revision date="2014/07/15">
<change>Removed webgl module. Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/11/24">
<change>Move to community approved.</change>
</revision>
<revision date="2016/05/05">
<change>Subsumed in WebGL 2.0 by EXT_color_buffer_float.</change>
</revision>
<revision date="2017/09/14">
<change>Require RGBA16F to be color-renderable and RGB16F to be optionally color-renderable.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,358 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension href="EXT_disjoint_timer_query/">
<name>EXT_disjoint_timer_query</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Contributors to ARB_occlusion_query</contributor>
<contributor>Contributors to EXT_timer_query</contributor>
<contributor>Contributors to ARB_timer_query</contributor>
<contributor>Ben Vanik, Google Inc.</contributor>
<contributor>Daniel Koch, TransGaming Inc.</contributor>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>26</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_disjoint_timer_query.txt"
name="EXT_disjoint_timer_query">
<addendum>
Specifies that queries' results only become available at certain well-defined times.
</addendum>
</mirrors>
<features>
<feature>
This extension provides a query mechanism that can be used to determine
the amount of time it takes to fully complete a set of GL commands, and
without stalling the rendering pipeline. It uses the query object
mechanisms first introduced in the occlusion query extension, which allow
time intervals to be polled asynchronously by the application.
</feature>
<feature>
This version of the disjoint_timer_query extension is exposed
only on on WebGL 1.0 contexts. See the _webgl2 version of the
extension for how it is exposed on WebGL 2.0 contexts.
</feature>
</features>
</overview>
<idl xml:space="preserve">
typedef unsigned long long GLuint64EXT;
[NoInterfaceObject]
interface WebGLTimerQueryEXT : WebGLObject {
};
[NoInterfaceObject]
interface EXT_disjoint_timer_query {
const GLenum QUERY_COUNTER_BITS_EXT = 0x8864;
const GLenum CURRENT_QUERY_EXT = 0x8865;
const GLenum QUERY_RESULT_EXT = 0x8866;
const GLenum QUERY_RESULT_AVAILABLE_EXT = 0x8867;
const GLenum TIME_ELAPSED_EXT = 0x88BF;
const GLenum TIMESTAMP_EXT = 0x8E28;
const GLenum GPU_DISJOINT_EXT = 0x8FBB;
WebGLTimerQueryEXT? createQueryEXT();
void deleteQueryEXT(WebGLTimerQueryEXT? query);
[WebGLHandlesContextLoss] boolean isQueryEXT(WebGLTimerQueryEXT? query);
void beginQueryEXT(enum target, WebGLTimerQueryEXT query);
void endQueryEXT(enum target);
void queryCounterEXT(WebGLTimerQueryEXT query, enum target);
any getQueryEXT(enum target, enum pname);
any getQueryObjectEXT(WebGLTimerQueryEXT query, enum pname);
};
</idl>
<newfun>
<function name="createQueryEXT" type="WebGLTimerQueryEXT?">
</function>
</newfun>
<newfun>
<function name="deleteQueryEXT" type="void">
<param name="query" type="WebGLTimerQueryEXT?"/>
</function>
</newfun>
<newfun>
<function name="isQueryEXT" type="boolean">
<param name="query" type="WebGLTimerQueryEXT?"/>
Returns true if the passed WebGLTimerQueryEXT is valid and false otherwise. Returns false if
the query's <a
href="http://www.khronos.org/registry/webgl/specs/1.0.1/#webgl-object-invalidated-flag">invalidated
flag</a> is set.
</function>
</newfun>
<newfun>
<function name="beginQueryEXT" type="void">
<param name="target" type="GLenum"/>
<param name="query" type="WebGLTimerQueryEXT?"/>
<code>target</code> accepts <code>TIME_ELAPSED_EXT</code>.
</function>
</newfun>
<newfun>
<function name="endQueryEXT" type="void">
<param name="target" type="GLenum"/>
<code>target</code> accepts <code>TIME_ELAPSED_EXT</code>.
</function>
</newfun>
<newfun>
<function name="queryCounterEXT" type="void">
<param name="query" type="WebGLTimerQueryEXT?"/>
<param name="target" type="GLenum"/>
<code>target</code> accepts <code>TIMESTAMP_EXT</code>.
</function>
</newfun>
<newfun>
<function name="getQueryEXT" type="any">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<code>target</code> and <code>pname</code> accept the following combinations of
parameters. The return type of this method depends on the parameter queried.
<br/>
<table width="30%">
<tr><th>target</th><th>pname</th><th>returned type</th></tr>
<tr><td>TIME_ELAPSED_EXT</td><td>CURRENT_QUERY</td><td>WebGLQuery?</td></tr>
<tr><td>TIMESTAMP_EXT</td><td>CURRENT_QUERY</td><td>null</td></tr>
<tr><td>TIME_ELAPSED_EXT</td><td>QUERY_COUNTER_BITS_EXT</td><td>GLint</td></tr>
<tr><td>TIMESTAMP_EXT</td><td>QUERY_COUNTER_BITS_EXT</td><td>GLint</td></tr>
</table>
</function>
</newfun>
<newfun>
<function name="getQueryObjectEXT" type="any">
<param name="query" type="WebGLTimerQueryEXT?"/>
<param name="pname" type="GLenum"/>
<code>pname</code> accepts <code>QUERY_RESULT_EXT</code> or <code>QUERY_RESULT_AVAILABLE_EXT</code>.
<br/>
The return type of this method depends on the parameter queried:
<table width="30%">
<tr><th>pname</th><th>returned type</th></tr>
<tr><td>QUERY_RESULT_EXT</td><td>GLuint64EXT</td></tr>
<tr><td>QUERY_RESULT_AVAILABLE_EXT</td><td>boolean</td></tr>
</table>
<br/>
In order to ensure consistent behavior across platforms, queries' results must only be made
available when the user agent's <a
href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#event-loops">event
loop</a> is not executing a task. In other words:
<ul>
<li> A query's result must not be made available until control has returned to the user
agent's main loop. </li>
<li> Repeatedly fetching a query's QUERY_RESULT_AVAILABLE_EXT parameter in a loop, without
returning control to the user agent, must always return the same value. </li>
</ul>
<div class="note">
A query's result may or may not be made available when control returns to the user
agent's event loop. It is not guaranteed that using a single setTimeout callback with a
delay of 0, or a single requestAnimationFrame callback, will allow sufficient time for
the WebGL implementation to supply the query's results.
</div>
<div class="note rationale">
This change compared to the original extension specification is enforced in order to prevent
applications from relying on being able to issue a query and fetch its result in the same
frame. In order to ensure best portability among devices and best performance among
implementations, applications must expect that queries' results will become available
asynchronously.
</div>
</function>
</newfun>
<newtok>
<function name="getParameter" type="any">
<param name="pname" type="GLenum"/>
<code>pname</code> accepts <code>TIMESTAMP_EXT</code> or <code>GPU_DISJOINT_EXT</code>.
<br/>
The return type depends on the parameter queried:
<table width="30%">
<tr><th>pname</th><th>returned type</th></tr>
<tr><td>TIMESTAMP_EXT</td><td>GLuint64EXT</td></tr>
<tr><td>GPU_DISJOINT_EXT</td><td>boolean</td></tr>
</table>
</function>
</newtok>
<issues>
<ol>
<li>
<p>
Can getQueryObjectEXT be exposed in its current form according to ECMAScript
semantics? ECMAScript's <a
href="http://wiki.ecmascript.org/doku.php?id=strawman:concurrency">de-facto concurrency
model</a> is "shared nothing" communicating event loops. Is it acceptable for sequential
calls to getQueryObjectEXT to return different answers? Note that Date.now() advances
during script execution, so this may be fine; but if concerns are raised, then the API may
need to be redesigned to use callbacks.
</p>
</li>
</ol>
</issues>
<samplecode xml:space="preserve">
<pre>
// Example (1) -- uses beginQueryEXT/endQueryEXT.
var ext = gl.getExtension('EXT_disjoint_timer_query');
var query = ext.createQueryEXT();
ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, query);
// Draw object
gl.drawElements(...);
ext.endQueryEXT(ext.TIME_ELAPSED_EXT);
// ...at some point in the future, after returning control to the browser and being called again:
var available = ext.getQueryObjectEXT(query, ext.QUERY_RESULT_AVAILABLE_EXT);
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
if (available &amp;&amp; !disjoint) {
// See how much time the rendering of the object took in nanoseconds.
var timeElapsed = ext.getQueryObjectEXT(query, ext.QUERY_RESULT_EXT);
// Do something useful with the time. Note that care should be
// taken to use all significant bits of the result, not just the
// least significant 32 bits.
adjustObjectLODBasedOnDrawTime(timeElapsed);
}
//----------------------------------------------------------------------
// Example (2) -- same as the example above, but uses queryCounterEXT instead.
var ext = gl.getExtension('EXT_disjoint_timer_query');
var startQuery = ext.createQueryEXT();
var endQuery = ext.createQueryEXT();
ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
// Draw object
gl.drawElements(...);
ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
// ...at some point in the future, after returning control to the browser and being called again:
var available = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_AVAILABLE_EXT);
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
if (available &amp;&amp; !disjoint) {
// See how much time the rendering of the object took in nanoseconds.
var timeStart = ext.getQueryObjectEXT(startQuery, ext.QUERY_RESULT_EXT);
var timeEnd = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_EXT);
// Do something useful with the time. Note that care should be
// taken to use all significant bits of the result, not just the
// least significant 32 bits.
adjustObjectLODBasedOnDrawTime(timeEnd - timeStart);
}
//----------------------------------------------------------------------
// Example (3) -- check the number of timestamp bits to determine how to best
// measure elapsed time.
var ext = gl.getExtension('EXT_disjoint_timer_query');
var timeElapsedQuery;
var startQuery;
var endQuery;
var useTimestamps = false;
if (ext.getQueryEXT(ext.TIMESTAMP_EXT, ext.QUERY_COUNTER_BITS_EXT) > 0) {
useTimestamps = true;
}
// Clear the disjoint state before starting to work with queries to increase
// the chances that the results will be valid.
gl.getParameter(ext.GPU_DISJOINT_EXT);
if (useTimestamps) {
startQuery = ext.createQueryEXT();
endQuery = ext.createQueryEXT();
ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
} else {
timeElapsedQuery = ext.createQueryEXT();
ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, timeElapsedQuery);
}
// Draw object
gl.drawElements(...);
if (useTimestamps) {
ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
} else {
ext.endQueryEXT(ext.TIME_ELAPSED_EXT);
}
// ...at some point in the future, after returning control to the browser and being called again:
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
if (disjoint) {
// Have to redo all of the measurements.
} else {
var available;
if (useTimestamps) {
available = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_AVAILABLE_EXT);
} else {
available = ext.getQueryObjectEXT(timeElapsedQuery, ext.QUERY_RESULT_AVAILABLE_EXT);
}
if (available) {
var timeElapsed;
if (useTimestamps) {
// See how much time the rendering of the object took in nanoseconds.
var timeStart = ext.getQueryObjectEXT(startQuery, ext.QUERY_RESULT_EXT);
var timeEnd = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_EXT);
timeElapsed = timeEnd - timeStart;
} else {
timeElapsed = ext.getQueryObjectEXT(query, ext.QUERY_RESULT_EXT);
}
// Do something useful with the time. Note that care should be
// taken to use all significant bits of the result, not just the
// least significant 32 bits.
adjustObjectLODBasedOnDrawTime(timeElapsed);
}
}
</pre>
</samplecode>
<history>
<revision date="2013/04/02">
<change>Initial revision.</change>
</revision>
<revision date="2013/04/03">
<change>Based on public_webgl discussion, specified that queries' results only become available at well-defined times.</change>
</revision>
<revision date="2014/02/12">
<change>Recast as EXT_disjoint_timer_query and harmonized with mirrored extension.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2015/10/05">
<change>Revised language regarding queries' availability based on feedback from Jeff Gilbert.</change>
</revision>
<revision date="2015/10/19">
<change>Promoted to community approved after discussion on public_webgl.</change>
</revision>
<revision date="2016/06/08">
<change>Added example choosing measurement technique based on number of timestamp bits.</change>
</revision>
<revision date="2016/09/30">
<change>Added clarifying note that this document only applies to WebGL 1.0. Minor reformatting and typo fixes.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension href="EXT_disjoint_timer_query_webgl2/">
<name>EXT_disjoint_timer_query_webgl2</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Contributors to ARB_occlusion_query</contributor>
<contributor>Contributors to EXT_timer_query</contributor>
<contributor>Contributors to ARB_timer_query</contributor>
<contributor>Ben Vanik, Google Inc.</contributor>
<contributor>Daniel Koch, TransGaming Inc.</contributor>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>33</number>
<depends>
<api version="2.0"/>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_disjoint_timer_query.txt"
name="EXT_disjoint_timer_query">
<addendum>
Specifies that queries' results only become available at certain well-defined times.
</addendum>
</mirrors>
<features>
<feature>
This extension provides the same functionality as <a
href="../EXT_disjoint_timer_query/">EXT_disjoint_timer_query</a>. The IDL, description, and
extension name are specialized for WebGL 2.0, which incorporates query objects into the core
specification.
</feature>
</features>
</overview>
<idl xml:space="preserve">
typedef unsigned long long GLuint64EXT;
[NoInterfaceObject]
interface EXT_disjoint_timer_query_webgl2 {
const GLenum QUERY_COUNTER_BITS_EXT = 0x8864;
const GLenum TIME_ELAPSED_EXT = 0x88BF;
const GLenum TIMESTAMP_EXT = 0x8E28;
const GLenum GPU_DISJOINT_EXT = 0x8FBB;
void queryCounterEXT(WebGLQuery query, enum target);
};
</idl>
<newtok>
<function name="beginQuery" type="">
<param name="target" type="GLenum"/>
<param name="query" type="WebGLQuery?"/>
<code>target</code> accepts <code>TIME_ELAPSED_EXT</code>.
</function>
</newtok>
<newtok>
<function name="endQuery" type="void">
<param name="target" type="GLenum"/>
<code>target</code> accepts <code>TIME_ELAPSED_EXT</code>.
</function>
</newtok>
<newfun>
<function name="queryCounterEXT" type="void">
<param name="query" type="WebGLQuery"/>
<param name="target" type="GLenum"/>
<code>target</code> accepts <code>TIMESTAMP_EXT</code>.
</function>
</newfun>
<newtok>
<function name="getQuery" type="any">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<code>target</code> and <code>pname</code> accept the following combinations of
parameters. The return type of this method now depends on the parameter queried.
<br/>
<table width="30%">
<tr><th>target</th><th>pname</th><th>returned type</th></tr>
<tr><td>TIME_ELAPSED_EXT</td><td>CURRENT_QUERY</td><td>WebGLQuery?</td></tr>
<tr><td>TIMESTAMP_EXT</td><td>CURRENT_QUERY</td><td>null</td></tr>
<tr><td>TIME_ELAPSED_EXT</td><td>QUERY_COUNTER_BITS_EXT</td><td>GLint</td></tr>
<tr><td>TIMESTAMP_EXT</td><td>QUERY_COUNTER_BITS_EXT</td><td>GLint</td></tr>
</table>
</function>
</newtok>
<newtok>
<function name="getParameter" type="any">
<param name="pname" type="GLenum"/>
<code>pname</code> accepts <code>TIMESTAMP_EXT</code> or <code>GPU_DISJOINT_EXT</code>.
<br/>
The return type depends on the parameter queried:
<table width="30%">
<tr><th>pname</th><th>returned type</th></tr>
<tr><td>TIMESTAMP_EXT</td><td>GLuint64EXT</td></tr>
<tr><td>GPU_DISJOINT_EXT</td><td>boolean</td></tr>
</table>
</function>
</newtok>
<samplecode xml:space="preserve">
<pre>
// Example (1) -- uses beginQuery/endQuery.
var ext = gl.getExtension('EXT_disjoint_timer_query_webgl2');
var query = gl.createQuery();
gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
// Draw object
gl.drawElements(...);
gl.endQuery(ext.TIME_ELAPSED_EXT);
// ...at some point in the future, after returning control to the browser and being called again:
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
if (available &amp;&amp; !disjoint) {
// See how much time the rendering of the object took in nanoseconds.
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT);
// Do something useful with the time. Note that care should be
// taken to use all significant bits of the result, not just the
// least significant 32 bits.
adjustObjectLODBasedOnDrawTime(timeElapsed);
}
//----------------------------------------------------------------------
// Example (2) -- same as the example above, but uses queryCounterEXT instead.
var ext = gl.getExtension('EXT_disjoint_timer_query_webgl2');
var startQuery = gl.createQuery();
var endQuery = gl.createQuery();
ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
// Draw object
gl.drawElements(...);
ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
// ...at some point in the future, after returning control to the browser and being called again:
var available = gl.getQueryParameter(endQuery, gl.QUERY_RESULT_AVAILABLE);
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
if (available &amp;&amp; !disjoint) {
// See how much time the rendering of the object took in nanoseconds.
var timeStart = gl.getQueryParameter(startQuery, gl.QUERY_RESULT);
var timeEnd = gl.getQueryParameter(endQuery, gl.QUERY_RESULT);
// Do something useful with the time. Note that care should be
// taken to use all significant bits of the result, not just the
// least significant 32 bits.
adjustObjectLODBasedOnDrawTime(timeEnd - timeStart);
}
//----------------------------------------------------------------------
// Example (3) -- check the number of timestamp bits to determine how to best
// measure elapsed time.
var ext = gl.getExtension('EXT_disjoint_timer_query_webgl2');
var timeElapsedQuery;
var startQuery;
var endQuery;
var useTimestamps = false;
if (gl.getQuery(ext.TIMESTAMP_EXT, ext.QUERY_COUNTER_BITS_EXT) > 0) {
useTimestamps = true;
}
// Clear the disjoint state before starting to work with queries to increase
// the chances that the results will be valid.
gl.getParameter(ext.GPU_DISJOINT_EXT);
if (useTimestamps) {
startQuery = gl.createQuery();
endQuery = gl.createQuery();
ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
} else {
timeElapsedQuery = gl.createQuery();
gl.beginQuery(ext.TIME_ELAPSED_EXT, timeElapsedQuery);
}
// Draw object
gl.drawElements(...);
if (useTimestamps) {
ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
} else {
gl.endQuery(ext.TIME_ELAPSED_EXT);
}
// ...at some point in the future, after returning control to the browser and being called again:
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
if (disjoint) {
// Have to redo all of the measurements.
} else {
var available;
if (useTimestamps) {
available = gl.getQueryParameter(endQuery, gl.QUERY_RESULT_AVAILABLE);
} else {
available = gl.getQueryParameter(timeElapsedQuery, gl.QUERY_RESULT_AVAILABLE);
}
if (available) {
var timeElapsed;
if (useTimestamps) {
// See how much time the rendering of the object took in nanoseconds.
var timeStart = gl.getQueryParameter(startQuery, gl.QUERY_RESULT);
var timeEnd = gl.getQueryParameter(endQuery, gl.QUERY_RESULT);
timeElapsed = timeEnd - timeStart;
} else {
timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT);
}
// Do something useful with the time. Note that care should be
// taken to use all significant bits of the result, not just the
// least significant 32 bits.
adjustObjectLODBasedOnDrawTime(timeElapsed);
}
}
</pre>
</samplecode>
<history>
<revision date="2016/09/30">
<change>Split WebGL 2.0 specification of this extension into its own file
for better comprehensibility.</change>
</revision>
<revision date="2016/10/11">
<change>Fixed errors in sample code pointed out by @juj.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<draft href="EXT_float_blend/">
<name>EXT_float_blend</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Mark Callow</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>35</number>
<depends>
<api version="2.0"/>
<ext name="EXT_color_buffer_float" require="true"/>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_float_blend.txt"
name="EXT_float_blend"/>
<features>
<feature>
<p>An <code>INVALID_OPERATION</code> error will no longer be raised by
<code>drawArrays</code> or <code>drawElements</code> when blending is
enabled and the draw buffer has 32-bit floating-point components. Note
that in order to create such a draw buffer the
<a href="http://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_float">
EXT_color_buffer_float</a> extension must be enabled.</p>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_float_blend {
}; // interface EXT_float_blend
</idl>
<history>
<revision date="2015/04/13">
<change>Initial revision.</change>
</revision>
<revision date="2017/01/03">
<change>Promoted to draft status after discussion on public_webgl.</change>
</revision>
</history>
</draft>

Просмотреть файл

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<ratified href="EXT_frag_depth/">
<name>EXT_frag_depth</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>16</number>
<depends>
<api version="1.0"/>
<core version="2.0">
<glsl version="300 es"/>
</core>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_frag_depth.txt"
name="EXT_frag_depth">
</mirrors>
<features>
<feature>
Adds the ability to set the depth value of a fragment from
within the fragment shader with the built-in output variable gl_FragDepthEXT.
</feature>
<glsl extname="GL_EXT_frag_depth">
<stage type="fragment"/>
<output name="gl_FragDepthEXT" type="float" />
</glsl>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_frag_depth {
};
</idl>
<samplecode xml:space="preserve">
<pre>
void main(){
gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
gl_FragDepthEXT = 0.5;
}
</pre>
</samplecode>
<history>
<revision date="2012/11/22">
<change>Initial revision.</change>
</revision>
<revision date="2012/12/17">
<change>Moved to draft.</change>
</revision>
<revision date="2014/05/13">
<change>Moved to community approved.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2015/05/29">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension href="EXT_sRGB/">
<name>EXT_sRGB</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>17</number>
<depends>
<api version="1.0"/>
<core version="2.0">
<addendum>Additional format restrictions apply for CopyTexImage2D</addendum>
</core>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_sRGB.txt"
name="EXT_sRGB">
</mirrors>
<features>
<feature>
Adds the sRGB support to textures and framebuffer objects.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_sRGB {
const GLenum SRGB_EXT = 0x8C40;
const GLenum SRGB_ALPHA_EXT = 0x8C42;
const GLenum SRGB8_ALPHA8_EXT = 0x8C43;
const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210;
};
</idl>
<newtok>
<function name="texImage2D">
<param name="format" type="GLenum"/>
<param name="internalformat" type="GLenum"/>
Accepted by the <code>format</code> and <code>internalformat</code> parameters: <code>SRGB_EXT</code> and <code>SRGB_ALPHA_EXT</code>
</function>
<function name="texSubImage2D">
<param name="format" type="GLenum"/>
Accepted by the <code>format</code> parameter: <code>SRGB_EXT</code> and <code>SRGB_ALPHA_EXT</code>
</function>
<function name="renderbufferStorage">
<param name="internalformat" type="GLenum"/>
Accepted by the <code>internalformat</code> parameter: <code>SRGB_ALPHA8_EXT</code>
</function>
<function name="getFramebufferAttachmentParameter">
<param name="pname" type="GLenum"/>
Accepted by the <code>pname</code> parameter: FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
</function>
</newtok>
<samplecode xml:space="preserve">
<pre>
var ext = gl.getExtension('EXT_sRGB');
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
texImage2D(gl.TEXTURE_2D, 0, ext.SRGB_EXT, 256, 256, 0, ext.SRGB_EXT, gl.UNSIGNED_BYTE, data);
</pre>
</samplecode>
<history>
<revision date="2012/12/16">
<change>Initial revision.</change>
</revision>
<revision date="2013/01/26">
<change>Moved from proposal to draft</change>
</revision>
<revision date="2014/05/13">
<change>Moved from draft to community approved</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<ratified href="EXT_shader_texture_lod/">
<name>EXT_shader_texture_lod</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Vladimir Vukicevic (vladimir 'at' mozilla.com)</contributor>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>27</number>
<depends>
<api version="1.0"/>
<core version="2.0">
<glsl version="300 es"/>
</core>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_shader_texture_lod.txt"
name="EXT_shader_texture_lod">
</mirrors>
<features>
<feature>
This extension adds additional texture functions to the
OpenGL ES Shading Language which provide the shader writer
with explicit control of LOD.
</feature>
<glsl extname="GL_EXT_shader_texture_lod">
<stage type="fragment"/>
<function name="texture2DLodEXT" type="vec4">
<param name="sampler" type="sampler2D" />
<param name="coord" type="vec2" />
<param name="lod" type="float" />
</function>
<function name="texture2DProjLodEXT" type="vec4">
<param name="sampler" type="sampler2D" />
<param name="coord" type="vec3" />
<param name="lod" type="float" />
</function>
<function name="texture2DProjLodEXT" type="vec4">
<param name="sampler" type="sampler2D" />
<param name="coord" type="vec4" />
<param name="lod" type="float" />
</function>
<function name="textureCubeLodEXT" type="vec4">
<param name="sampler" type="samplerCube" />
<param name="coord" type="vec3" />
<param name="lod" type="float" />
</function>
<function name="texture2DGradEXT" type="vec4">
<param name="sampler" type="sampler2D" />
<param name="P" type="vec2" />
<param name="dPdx" type="vec2" />
<param name="dPdy" type="vec2" />
</function>
<function name="texture2DProjGradEXT" type="vec4">
<param name="sampler" type="sampler2D" />
<param name="P" type="vec3" />
<param name="dPdx" type="vec2" />
<param name="dPdy" type="vec2" />
</function>
<function name="texture2DProjGradEXT" type="vec4">
<param name="sampler" type="sampler2D" />
<param name="P" type="vec4" />
<param name="dPdx" type="vec2" />
<param name="dPdy" type="vec2" />
</function>
<function name="textureCubeGradEXT" type="vec4">
<param name="sampler" type="samplerCube" />
<param name="P" type="vec3" />
<param name="dPdx" type="vec3" />
<param name="dPdy" type="vec3" />
</function>
</glsl>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_shader_texture_lod {
};
</idl>
<samplecode xml:space="preserve">
<pre>
#extension GL_EXT_shader_texture_lod : enable
#extension GL_OES_standard_derivatives : enable
uniform sampler2D myTexture;
varying vec2 texcoord;
void main(){
// avoids artifacts when wrapping texture coordinates
gl_FragColor = texture2DGradEXT(myTexture, mod(texcoord, vec2(0.1, 0.5)), dFdx(texcoord), dFdy(texcoord));
}
</pre>
</samplecode>
<history>
<revision date="2014/02/10">
<change>Initial revision.</change>
</revision>
<revision date="2014/02/18">
<change>Moved to draft.</change>
</revision>
<revision date="2014/06/27">
<change>Moved to community approved after discussion on public_webgl list.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/11/07">
<change>Corrected extension name to include GL_ prefix.</change>
</revision>
<revision date="2015/05/29">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<ratified href="EXT_texture_filter_anisotropic/">
<name>EXT_texture_filter_anisotropic</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
<contributor>Florian B&#246;sch (pyalot 'at' gmail.com)</contributor>
</contributors>
<number>11</number>
<depends>
<api version="1.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/texture_filter_anisotropic.txt" name="EXT_texture_filter_anisotropic"/>
<features>
<feature>
The <code>getTexParameter</code>, <code>texParameterf</code> and <code>texParameteri</code> entry points'
parameter <code>pname</code> accepts the value <code>TEXTURE_MAX_ANISOTROPY_EXT</code>
</feature>
<feature>
The <code>getParameter</code> entry point parameter <code>pname</code> accepts the value <code>MAX_TEXTURE_MAX_ANISOTROPY_EXT</code>, returning a value of type <code>float</code>.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_texture_filter_anisotropic {
const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
};
</idl>
<history>
<revision date="2012/01/27">
<change>Initial revision.</change>
</revision>
<revision date="2012/02/24">
<change>Added the EXT suffix to the enumerants and aliases to the extension name</change>
</revision>
<revision date="2012/07/19">
<change>Moved from draft to community approved status</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<ratified href="OES_element_index_uint/">
<name>OES_element_index_uint</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
<contributor>Florian B&#246;sch (pyalot 'at' gmail.com)</contributor>
</contributors>
<number>10</number>
<depends>
<api version="1.0" />
<core version="2.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_element_index_uint.txt" name="OES_element_index_uint"/>
<features>
<feature>
The <code>drawElements</code> entry point parameter <code>type</code> accepts the value <code>UNSIGNED_INT</code>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_element_index_uint {
};
</idl>
<history>
<revision date="2012/01/24">
<change>Initial revision.</change>
</revision>
<revision date="2012/01/27">
<change>Removed the bufferData requirement as this is not checked by webgl</change>
</revision>
<revision date="2012/02/24">
<change>Removed the enumerants from the IDL which are contained in the context and added aliases to the extension name</change>
</revision>
<revision date="2012/10/16">
<change>Based on feedback on public_webgl, moved from draft to community approved, and removed aliases.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<draft href="OES_fbo_render_mipmap/">
<name>OES_fbo_render_mipmap</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>28</number>
<depends>
<api version="1.0"/>
<core version="2.0" />
</depends>
<overview>
<mirrors href="https://www.khronos.org/registry/gles/extensions/OES/OES_fbo_render_mipmap.txt"
name="OES_fbo_render_mipmap">
</mirrors>
<features>
<feature>
Any level of a texture can be attached to a framebuffer object.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_fbo_render_mipmap {
};
</idl>
<samplecode xml:space="preserve">
<pre>
var extension = gl.getExtension('OES_fbo_render_mipmap');
if(extension !=== null){
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
var fbos = [];
for(var level=0; level&lt;7; level++){
var size = 128/Math.pow(2, level);
gl.texImage2D(gl.TEXTURE_2D, level, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
var fbo = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, level);
fbos.push(fbo);
var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
console.assert(fboStatus == gl.FRAMEBUFFER_COMPLETE, 'Framebuffer is not complete');
}
gl.bindTexture(gl.TEXTURE_2D, null);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
console.assert(gl.getError() == gl.NO_ERROR, 'A GL error occured');
}
</pre>
</samplecode>
<history>
<revision date="2015/01/26">
<change>Initial revision.</change>
</revision>
<revision date="2015/01/31">
<change>Moved to draft.</change>
</revision>
</history>
</draft>

Просмотреть файл

@ -0,0 +1,62 @@
<?xml version="1.0"?>
<ratified href="OES_standard_derivatives/">
<name>OES_standard_derivatives</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>4</number>
<depends>
<api version="1.0"/>
<core version="2.0">
<glsl version="300 es"/>
</core>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_standard_derivatives.txt" name="OES_standard_derivatives" />
<features>
<feature>
The <code>hint</code> entry point accepts <code>FRAGMENT_SHADER_DERIVATIVE_HINT_OES</code>
as a target and the <code>getParameter</code> entry point accepts it as a pname.
</feature>
<glsl extname="GL_OES_standard_derivatives">
<stage type="fragment"/>
<function name="dFdx" type="genType">
<param type="genType" />
</function>
<function name="dFdy" type="genType">
<param type="genType" />
</function>
<function name="fwidth" type="genType">
<param type="genType" />
</function>
</glsl>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_standard_derivatives {
const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B;
};
</idl>
<history>
<revision date="2010/01/13">
<change>Initial revision.</change>
</revision>
<revision date="2011/12/07">
<change>Added <code>genType</code> argument and return type to function declarations.</change>
</revision>
<revision date="2012/01/03">
<change>Removed webgl module per changes to Web IDL spec.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ratified href="OES_texture_float/">
<name>OES_texture_float</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>1</number>
<depends>
<api version="1.0"/>
<removed version="2.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt"
name="OES_texture_float">
<addendum>Optional support for <code>FLOAT</code> textures as FBO
attachments.</addendum>
</mirrors>
<features>
<feature> The <code>texImage2D</code> and <code>texSubImage2D</code>
entry points taking <code>ArrayBufferView</code> are extended to accept
<code>Float32Array</code> with the pixel type <code>FLOAT</code>.
</feature>
<feature> The <code>texImage2D</code> and <code>texSubImage2D</code>
entry points taking <code>ImageData</code>,
<code>HTMLImageElement</code>, <code>HTMLCanvasElement</code> and
<code>HTMLVideoElement</code> are extended to accept the pixel type
<code>FLOAT</code>. </feature>
<feature>Upon activation of this extension, implementations supporting
<a href="../WEBGL_color_buffer_float/">WEBGL_color_buffer_float</a>
shall implicitly enable it. This requirement maintains the historical
behavior prior to the differentiation of float renderability from float
textures, so as to not break existing content.</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_texture_float { }; </idl>
<history>
<revision date="2010/11/29">
<change>Initial revision.</change>
</revision>
<revision date="2010/12/13">
<change>Extended to support pixel type FLOAT for texImage2D and
texSubImage2D entry points taking ImageData, HTMLImageElement,
HTMLCanvasElement and HTMLVideoElement. </change>
</revision>
<revision date="2011/09/12">
<change>Added optional ability to use a FLOAT type texture as an FBO's
color attachment. </change>
</revision>
<revision date="2012/01/03">
<change>Removed webgl module per changes to Web IDL spec.</change>
</revision>
<revision date="2012/12/04">
<change>Specify that implementations supporting FLOAT color attachments
implicitly enable WEBGL_color_buffer_float.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/09/11">
<change>Corrected link to WEBGL_color_buffer_float.</change>
</revision>
<revision date="2017/09/14">
<change>Clarify behaviors regarding WEBGL_color_buffer_float.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<ratified href="OES_texture_float_linear/">
<name>OES_texture_float_linear</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>20</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float_linear.txt"
name="OES_texture_float_linear">
</mirrors>
<features>
Expands upon the OES_texture_float extension by allowing support for
LINEAR magnification filter and LINEAR, NEAREST_MIPMAP_LINEAR,
LINEAR_MIPMAP_NEAREST and LINEAR_MIPMAP_NEAREST minification filters.
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_texture_float_linear { };</idl>
<history>
<revision date="2013/02/20">
<change>Initial revision.</change>
</revision>
<revision date="2013/03/11">
<change>Moved to draft status after discussion on public_webgl.</change>
</revision>
<revision date="2013/08/06">
<change>Moved to community approved.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/08/08">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<ratified href="OES_texture_half_float/">
<name>OES_texture_half_float</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>2</number>
<depends>
<api version="1.0"/>
<removed version="2.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt"
name="OES_texture_half_float">
<addendum>Optional support for <code>HALF_FLOAT</code> textures as FBO
attachments.</addendum>
</mirrors>
<features>
<feature> The <code>texImage2D</code> and <code>texSubImage2D</code>
entry points taking <code>ArrayBufferView</code> are extended to accept
<code>Uint16Array</code> with the pixel type <code>HALF_FLOAT_OES</code>.
</feature>
<feature> The <code>texImage2D</code> and <code>texSubImage2D</code>
entry points taking <code>ImageData</code>,
<code>HTMLImageElement</code>, <code>HTMLCanvasElement</code> and
<code>HTMLVideoElement</code> are extended to accept the pixel type
<code>HALF_FLOAT_OES</code>. </feature>
<feature>Upon activation of this extension, implementations supporting
<a href="../EXT_color_buffer_half_float/">EXT_color_buffer_half_float</a>
shall implicitly enable it. This requirement maintains the historical
behavior prior to the differentiation of float renderability from float
textures, so as to not break existing content.</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_texture_half_float {
const GLenum HALF_FLOAT_OES = 0x8D61;
};
</idl>
<history>
<revision date="2010/11/29">
<change>Initial revision.</change>
</revision>
<revision date="2011/09/12">
<change> Added similar text about <code>texImage2D</code> and
<code>texSubImage2D</code> as in OES_texture_float spec. </change>
<change> Added optional ability to use a HALF_FLOAT_OES type texture as
an FBO's color attachment. </change>
</revision>
<revision date="2012/01/03">
<change>Removed webgl module per changes to Web IDL spec.</change>
</revision>
<revision date="2012/12/04">
<change>Specify that implementations supporting HALF_FLOAT_OES color
attachments implicitly enable EXT_color_buffer_half_float.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/02/12">
<change>Allow texture uploads of half-floats via Uint16Arrays.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/09/11">
<change>Corrected link to EXT_color_buffer_half_float.</change>
</revision>
<revision date="2017/09/14">
<change>Clarify behaviors regarding EXT_color_buffer_half_float.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<ratified href="OES_texture_half_float_linear/">
<name>OES_texture_half_float_linear</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>21</number>
<depends>
<api version="1.0"/>
<removed version="2.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float_linear.txt"
name="OES_texture_half_float_linear">
</mirrors>
<features>
Expands upon the OES_texture_half_float extension by allowing support for
LINEAR magnification filter and LINEAR, NEAREST_MIPMAP_LINEAR,
LINEAR_MIPMAP_NEAREST and LINEAR_MIPMAP_NEAREST minification filters.
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_texture_half_float_linear { };</idl>
<history>
<revision date="2013/02/20">
<change>Initial revision.</change>
</revision>
<revision date="2013/03/11">
<change>Moved to draft status after discussion on public_webgl.</change>
</revision>
<revision date="2013/08/06">
<change>Moved to community approved.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/08/08">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,138 @@
<?xml version="1.0"?>
<ratified href="OES_vertex_array_object/">
<name>OES_vertex_array_object</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>5</number>
<depends>
<api version="1.0"/>
<core version="2.0" />
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_vertex_array_object.txt" name="OES_vertex_array_object" />
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WebGLVertexArrayObjectOES : WebGLObject {
};
[NoInterfaceObject]
interface OES_vertex_array_object {
const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5;
WebGLVertexArrayObjectOES? createVertexArrayOES();
void deleteVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject);
[WebGLHandlesContextLoss] GLboolean isVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject);
void bindVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject);
};
</idl>
<newfun>
<function name="createVertexArrayOES" type="WebGLVertexArrayObjectOES?">
</function>
</newfun>
<newfun>
<function name="deleteVertexArrayOES" type="void">
<param name="arrayObject" type="WebGLVertexArrayObjectOES?"/>
</function>
</newfun>
<newfun>
<function name="isVertexArrayOES" type="GLboolean">
<param name="arrayObject" type="WebGLVertexArrayObjectOES?"/>
Returns false if the vertex array object's <a
href="../../specs/1.0/#webgl-object-invalidated-flag">invalidated
flag</a> is set.
</function>
</newfun>
<newfun>
<function name="bindVertexArrayOES" type="void">
<param name="arrayObject" type="WebGLVertexArrayObjectOES?"/>
</function>
</newfun>
<issues>
<p>The OES_vertex_array_object spec does not make it clear
what happens to buffers that are deleted when they are referenced
by vertex array objects. It is inferred that all buffers are
reference counted.
</p>
<p>Before OES_vertex_array_object there was no way to use a deleted
buffer in a single context as the spec states it would be unbound
from all bind points. After OES_vertex_array_object it is now
possible to use deleted buffers.
</p>
<p>Furthermore, the OpenGL ES 2.0 spec specifies that using a
deleted buffer has undefined results including possibly
corrupt rendering and generating GL errors. Undefined behavior
is unacceptable for WebGL.
</p>
<ul>
<li>
<p>RESOLVED: Buffers should be reference counted when attached to
a vertex array object. This is consistent with the OpenGL ES 3.0
spec's implementation of Vertex Array Objects and matches the
behavior of other WebGL objects, such as textures that are attached
to framebuffers.
</p>
<p>This will require that most implementations do not call
glDeleteBuffer when the user calls deleteBuffer on the WebGL context.
Instead the implementation must wait for all references to be released
before calling glDeleteBuffer to prevent undefined behavior.
</p>
<p>If a buffer object is deleted while it is attached to the currently
bound vertex array object, then it is as if BindBuffer had been called,
with a buffer of 0, for each target to which this buffer was attached
in the currently bound vertex array object. In other words, this buffer
is first detached from all attachment points in the currently bound
vertex array object. Note that the buffer is specifically not detached
from any other vertex array object. Detaching the buffer from any other
vertex array objects is the responsibility of the application.
</p>
</li>
</ul>
</issues>
<history>
<revision date="2011/01/27">
<change>Initial revision.</change>
</revision>
<revision date="2011/11/12">
<change>Demotion to draft.</change>
</revision>
<revision date="2011/12/06">
<change>Added vendor-specific name strings for draft extension per discussion on WebGL mailing list.</change>
</revision>
<revision date="2011/12/07">
<change>Renamed "Name Strings" section to "Alias Name Strings".</change>
<change>Sorted Revision History in ascending order.</change>
</revision>
<revision date="2012/01/03">
<change>Removed webgl module per changes to Web IDL spec.</change>
</revision>
<revision date="2012/09/24">
<change>Added resolution to deleted buffer issue</change>
</revision>
<revision date="2012/10/16">
<change>Based on feedback on public_webgl, moved from draft to community approved, and removed aliases.</change>
</revision>
<revision date="2013/05/08">
<change>Made WebGLVertexArrayObjectOES return values and arguments nullable on feedback from Benoit Jacob.</change>
</revision>
<revision date="2013/05/14">
<change>Based on pull request from J Kenneth King, added WebGLHandlesContextLoss extended attribute to isVertexArrayOES and added markup for new functions.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute to extension and WebGLVertexArrayObjectOES interface.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension href="WEBGL_color_buffer_float/">
<name>WEBGL_color_buffer_float</name>
<contact><a href="https://www.khronos.org/webgl/public-mailing-list">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Mark Callow, HI Corporation</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>15</number>
<depends>
<api version="1.0"/>
<ext name="EXT_color_buffer_half_float"/>
<ext name="OES_texture_float" require="true"/>
<subsumed version="2.0" by="EXT_color_buffer_float" />
</depends>
<overview>
<p>Adds support for rendering to 32-bit floating-point color buffers.</p>
<features>
<feature>
<p>The 32-bit floating-point type <code>RGBA32F</code> becomes available
as a color-renderable format. Renderbuffers can be created in this
format. These and textures created with <code>format = RGBA</code> and
<code>type = FLOAT</code> as specified in <a
href="http://www.khronos.org/registry/webgl/extensions/OES_texture_float/">OES_texture_float</a>,
can be attached to framebuffer object color attachments for rendering.
</p>
</feature>
<feature>
<p>The 32-bit floating-point type <code>RGB32F</code> may also optionally
become available as a color-renderable format. These and textures created
with <code>format = RGB</code> and <code>type = FLOAT</code> as specified in
<a href="http://www.khronos.org/registry/webgl/extensions/OES_texture_float/">OES_texture_float</a>,
can be attached to framebuffer object color attachments for rendering.
Applications must check framebuffer completeness to determine if an
implementation actually supports this format.
</p>
</feature>
<feature>
<p><span style="color: red">NOTE:</span> fragment shaders outputs
gl_FragColor and gl_FragData[0] will only be clamped and converted
when the color buffer is fixed-point and <code>blendColor()</code> and
<code>clearColor()</code> will no longer clamp their parameter values
on input. Clamping will be applied as necessary at draw time according
to the type of color buffer in use.</p>
</feature>
<feature>
<p>The format and type combination <code>RGBA</code> and
<code>FLOAT</code> becomes valid for reading from a floating-point
rendering buffer. Note: <code>RGBA</code> and
<code>UNSIGNED_BYTE</code> cannot be used for reading from a
floating-point rendering buffer.</p>
</feature>
<feature>
<p>The component types of framebuffer object attachments can be
queried.</p>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_color_buffer_float {
const GLenum RGBA32F_EXT = 0x8814;
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211;
const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17;
}; // interface WEBGL_color_buffer_float
</idl>
<newtok>
<function name="renderbufferStorage" type="void"><param name="target"
type="GLenum"/><param name="internalformat" type="GLenum"/><param
name="width" type="GLsizei"/><param name="height"
type="GLsizei"/><code>RGBA32F_EXT</code> is accepted as the
<code>internalformat</code> parameter of
<code>renderbufferStorage()</code>.</function>
</newtok>
<additions>
<p>The new tokens and the behavioral changes for floating-point color
buffers specified in <a
href="http://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_half_float/">EXT_color_buffer_half_float</a>
are incorporated into WebGL except for the <code>RGB16F</code> and
<code>RGBA16F</code> types. References to <code>RGB16F</code> are ignored,
and references to <code>RGBA16F</code> are replaced by references to
<code>RGBA32F</code>.</p>
</additions>
<history>
<revision date="2012/11/08">
<change>Initial revision.</change>
</revision>
<revision date="2012/11/12">
<change>Don't mirror EXT_color_buffer_half_float. Mirror has a different
meaning from what is done here.</change>
</revision>
<revision date="2012/11/13">
<change>Add reading-pixels-as-FLOAT feature to the Overview.</change>
</revision>
<revision date="2012/11/26">
<change>Move to draft.</change>
</revision>
<revision date="2014/07/15">
<change>Removed webgl module. Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/09/11">
<change>Fixed the name of the interface from EXT_color_buffer_float to WEBGL_color_buffer_float.</change>
</revision>
<revision date="2014/11/24">
<change>Removed the support for RGB32F, since it is not natively supported on all platforms where WebGL is implemented.</change>
</revision>
<revision date="2014/11/24">
<change>Move to community approved.</change>
</revision>
<revision date="2016/05/05">
<change>Subsumed in WebGL 2.0 by EXT_color_buffer_float.</change>
</revision>
<revision date="2017/09/14">
<change>Add optional RGB renderability.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,577 @@
<?xml version="1.0"?>
<extension href="WEBGL_compressed_texture_astc/">
<name>WEBGL_compressed_texture_astc</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Christophe Riccio, Unity</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>30</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the compressed texture format defined in the
<a href="https://www.opengl.org/registry/specs/KHR/texture_compression_astc_hdr.txt">
KHR_texture_compression_astc_hdr</a> OpenGL ES extension to WebGL. Consult that extension
specification for behavioral definitions, including error behaviors.
</p>
<p>
ASTC textures may be encoded using either high or low dynamic range, corresponding to an "HDR
profile" and "LDR profile". The compression format is designed to be extended, and for new
profiles to be added in the future. For this reason, enabling the WebGL extension enables all
of the profiles supported by the implementation. The supported profiles may be queried by
calling <code>getSupportedProfiles</code> against the extension object.
</p>
<features>
<feature>
Compression format <code>COMPRESSED_RGBA_ASTC_4x4_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_5x4_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_5x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_6x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_6x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x8_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x8_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x10_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_12x10_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_12x12_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR</code>,
and <code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR</code> may be passed to
the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points.
</feature>
<feature>
Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code>
will include the format from this specification.
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_4x4_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_5x4_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 4) / 5) * floor((height + 3) / 4) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_5x5_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 4) / 5) * floor((height + 4) / 5) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_6x5_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 5) / 6) * floor((height + 4) / 5) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_6x6_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 5) / 6) * floor((height + 5) / 6) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_8x5_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 7) / 8) * floor((height + 4) / 5) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_8x6_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 7) / 8) * floor((height + 5) / 6) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_8x8_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 7) / 8) * floor((height + 7) / 8) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_10x5_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 9) / 10) * floor((height + 4) / 5) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_10x6_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 9) / 10) * floor((height + 5) / 6) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_10x8_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 9) / 10) * floor((height + 7) / 8) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_10x10_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 9) / 10) * floor((height + 9) / 10) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_12x10_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 11) / 12) * floor((height + 9) / 10) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGBA_ASTC_12x12_KHR</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR</dt>
<dd>
<p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:
</p>
<blockquote><code>
floor((width + 11) / 12) * floor((height + 11) / 12) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_compressed_texture_astc {
/* Compressed Texture Format */
const GLenum COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
const GLenum COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
const GLenum COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
const GLenum COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
const GLenum COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
const GLenum COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
const GLenum COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
const GLenum COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
const GLenum COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
const GLenum COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
const GLenum COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
const GLenum COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
const GLenum COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
const GLenum COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
// Profile query support.
sequence&lt;DOMString&gt; getSupportedProfiles();
};
</idl>
<newfun>
<function name="getSupportedProfiles" type="sequence&lt;DOMString&gt;">
Returns the names of the ASTC profiles supported by the implementation. As of this writing,
valid return values will include "ldr", corresponding to the
GL_KHR_texture_compression_astc_ldr extension string; and "hdr", corresponding to the
GL_KHR_texture_compression_astc_hdr extension string. More profiles may be added in the
future.
</function>
<div class="note">
The intent of the <code>getSupportedProfiles</code> function is to allow easy reconstruction
of the underlying OpenGL or OpenGL ES extension strings for environments like Emscripten, by
prepending the string <code>GL_KHR_texture_compression_astc_</code> to the returned profile
names.
</div>
</newfun>
<newtok>
<function name="compressedTexImage2D">
<param name="internalformat" type="GLenum"/>
Accepted by the <code>internalformat</code> parameter:
<code>COMPRESSED_RGBA_ASTC_4x4_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_5x4_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_5x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_6x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_6x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x8_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x8_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x10_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_12x10_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_12x12_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR</code>
<br/>
</function>
<function name="compressedTexSubImage2D">
<param name="internalformat" type="GLenum"/>
Accepted by the <code>internalformat</code> parameter:
<code>COMPRESSED_RGBA_ASTC_4x4_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_5x4_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_5x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_6x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_6x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_8x8_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x5_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x6_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x8_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_10x10_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_12x10_KHR</code>,
<code>COMPRESSED_RGBA_ASTC_12x12_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR</code>,
<code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR</code>
<br/>
</function>
</newtok>
<errors>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_4x4_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_5x4_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 4) / 5) * floor((height + 3) / 4) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_5x5_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 4) / 5) * floor((height + 4) / 5) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_6x5_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 5) / 6) * floor((height + 4) / 5) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_6x6_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 5) / 6) * floor((height + 5) / 6) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_8x5_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 7) / 8) * floor((height + 4) / 5) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_8x6_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 7) / 8) * floor((height + 5) / 6) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_8x8_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 7) / 8) * floor((height + 7) / 8) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_10x5_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 9) / 10) * floor((height + 4) / 5) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_10x6_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 9) / 10) * floor((height + 5) / 6) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_10x8_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 9) / 10) * floor((height + 7) / 8) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_10x10_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 9) / 10) * floor((height + 9) / 10) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_12x10_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 11) / 12) * floor((height + 9) / 10) * 16
</code></blockquote>
</error>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code>
if the <code>internalformat</code> parameter is
<code>COMPRESSED_RGBA_ASTC_12x12_KHR</code> or <code>COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR</code>
and the byteLength of the ArrayBufferView is not:
<blockquote><code>
floor((width + 11) / 12) * floor((height + 11) / 12) * 16
</code></blockquote>
</error>
</errors>
<history>
<revision date="2015/03/10">
<change>Initial revision.</change>
</revision>
<revision date="2015/08/07">
<change>Added profile string support. Renamed constants back to _KHR.</change>
</revision>
<revision date="2015/08/10">
<change>Clarified intent of getSupportedProfiles. Stressed that OpenGL ES extension defines the behavior.</change>
</revision>
<revision date="2015/08/10">
<change>Moved to draft status.</change>
</revision>
<revision date="2016/12/12">
<change>Moved to community approved after discussion on public_webgl list.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,109 @@
<?xml version="1.0"?>
<extension href="WEBGL_compressed_texture_atc/">
<name>WEBGL_compressed_texture_atc</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>12</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the compressed texture formats defined in the
<a href="http://www.khronos.org/registry/gles/extensions/AMD/AMD_compressed_ATC_texture.txt">
AMD_compressed_ATC_texture</a> OpenGL extension to WebGL.
</p>
<features>
<feature>
Compression formats <code>COMPRESSED_RGB_ATC_WEBGL</code>,
<code>COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL</code>, and
<code>COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL</code> may be passed to
the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points.
These formats correspond to the 3 formats defined in the AMD_compressed_ATC_texture OpenGL
extension. Although the enum names are changed, their numeric values are the same. The correspondence
is given by this table:
<table>
<tr>
<th>WebGL format enum</th>
<th>OpenGL format enum</th>
<th>Numeric value</th>
</tr>
<tr>
<td>COMPRESSED_RGB_ATC_WEBGL</td>
<td>ATC_RGB_AMD</td>
<td>0x8C92</td>
</tr>
<tr>
<td>COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL</td>
<td>ATC_RGBA_EXPLICIT_ALPHA_AMD</td>
<td>0x8C93</td>
</tr>
<tr>
<td>COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL</td>
<td>ATC_RGBA_INTERPOLATED_ALPHA_AMD</td>
<td>0x87EE</td>
</tr>
</table>
</feature>
<feature>
Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code>
will include the 3 formats from this specification.
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGB_ATC_WEBGL</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code>, must be equal to the following number of bytes:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 8
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
<dt>COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL</dt>
<dt>COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code>, must be equal to the following number of bytes:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_compressed_texture_atc {
/* Compressed Texture Formats */
const GLenum COMPRESSED_RGB_ATC_WEBGL = 0x8C92;
const GLenum COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8C93;
const GLenum COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87EE;
};
</idl>
<history>
<revision date="2012/09/11">
<change>Initial revision.</change>
</revision>
<revision date="2013/07/03">
<change>Clarified that length of ArrayBufferView is actually byteLength.</change>
</revision>
<revision date="2014/04/17">
<change>Removed reference to compressedTexSubImage2D. This format can only be used with compressedTexImage2D.</change>
</revision>
<revision date="2014/06/27">
<change>Moved to community approved after discussion on public_webgl list.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,189 @@
<?xml version="1.0"?>
<extension href="WEBGL_compressed_texture_etc/">
<name>WEBGL_compressed_texture_etc</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Jeff Gilbert, Mozilla</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>29</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the compressed texture formats defined as core in the
<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.4.pdf">
OpenGL ES 3.0</a> spec to WebGL. These include the ETC2 and EAC formats, where
ETC2 is a superset of ETC1. ETC1 textures can be loaded using the ETC2 token
value. All of these formats are in the ETC family.
</p>
<p>
Browsers should not advertise this extension when the WebGL implementation, or
graphics driver, supports these formats by decompressing them.
</p>
<features>
<feature>
Compression formats <code>COMPRESSED_R11_EAC</code>,
<code>COMPRESSED_SIGNED_R11_EAC</code>,
<code>COMPRESSED_RG11_EAC</code>,
<code>COMPRESSED_SIGNED_RG11_EAC</code>,
<code>COMPRESSED_RGB8_ETC2</code>,
<code>COMPRESSED_SRGB8_ETC2</code>,
<code>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>,
<code>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>,
<code>COMPRESSED_RGBA8_ETC2_EAC</code>,
and <code>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</code> may be passed to the
<code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points. In
WebGL 2.0, they may also be passed to the <code>compressedTexImage3D</code> and
<code>compressedTexSubImage3D</code> entry points with the <code>TEXTURE_2D_ARRAY</code>
target.
</feature>
<feature>
Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code>
will include the formats from this specification.
</feature>
<feature>
For all of the formats, <code>validatedSize</code> (defined for each specific format
below) is validated in the following ways:
<ul>
<li>
<b>WebGL 1.0 and 2.0</b>: if the variant of <code>compressedTexImage*D</code> or
<code>compressedTexSubImage*D</code> taking <code>ArrayBufferView pixels</code> is
called, then the <code>byteLength</code> of the view must be equal to
<code>validatedSize</code>, or an INVALID_VALUE error is generated.
</li>
<li>
<b>WebGL 2.0</b>: if the variant of <code>compressedTexImage*D</code> or
<code>compressedTexSubImage*D</code> taking <code>GLintptr offset</code> is called,
and <code>offset + validatedSize</code> is greater than the size of the bound
<code>PIXEL_UNPACK_BUFFER</code>, an <code>INVALID_OPERATION</code> error is
generated.
</li>
</ul>
<dl>
<dt>COMPRESSED_R11_EAC</dt>
<dt>COMPRESSED_SIGNED_R11_EAC</dt>
<dt>COMPRESSED_RGB8_ETC2</dt>
<dt>COMPRESSED_SRGB8_ETC2</dt>
<dt>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</dt>
<dt>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</dt>
<dd><p><code>validatedSize</code> is computed in the following way:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 8
</code></blockquote>
</dd>
</dl>
<dl>
<dt>COMPRESSED_RG11_EAC</dt>
<dt>COMPRESSED_SIGNED_RG11_EAC</dt>
<dt>COMPRESSED_RGBA8_ETC2_EAC</dt>
<dt>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</dt>
<dd><p><code>validatedSize</code> is computed in the following way:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
</code></blockquote>
</dd>
</dl>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_compressed_texture_etc {
/* Compressed Texture Formats */
const GLenum COMPRESSED_R11_EAC = 0x9270;
const GLenum COMPRESSED_SIGNED_R11_EAC = 0x9271;
const GLenum COMPRESSED_RG11_EAC = 0x9272;
const GLenum COMPRESSED_SIGNED_RG11_EAC = 0x9273;
const GLenum COMPRESSED_RGB8_ETC2 = 0x9274;
const GLenum COMPRESSED_SRGB8_ETC2 = 0x9275;
const GLenum COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276;
const GLenum COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277;
const GLenum COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
const GLenum COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279;
};
</idl>
<newtok>
<function name="compressedTexImage2D">
<param name="internalformat" type="GLenum"/>
Accepted by the <code>internalformat</code> parameter:
<code>COMPRESSED_R11_EAC</code>,
<code>COMPRESSED_SIGNED_R11_EAC</code>,
<code>COMPRESSED_RG11_EAC</code>,
<code>COMPRESSED_SIGNED_RG11_EAC</code>,
<code>COMPRESSED_RGB8_ETC2</code>,
<code>COMPRESSED_SRGB8_ETC2</code>,
<code>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>,
<code>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>,
<code>COMPRESSED_RGBA8_ETC2_EAC</code> or
<code>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</code>
<br/>
</function>
<function name="compressedTexSubImage2D">
<param name="internalformat" type="GLenum"/>
Accepted by the <code>internalformat</code> parameter:
<code>COMPRESSED_R11_EAC</code>,
<code>COMPRESSED_SIGNED_R11_EAC</code>,
<code>COMPRESSED_RG11_EAC</code>,
<code>COMPRESSED_SIGNED_RG11_EAC</code>,
<code>COMPRESSED_RGB8_ETC2</code>,
<code>COMPRESSED_SRGB8_ETC2</code>,
<code>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>,
<code>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>,
<code>COMPRESSED_RGBA8_ETC2_EAC</code> or
<code>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</code>
<br/>
</function>
</newtok>
<errors>
<error enum="INVALID_VALUE">
The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code>,
<code>compressedTexSubImage2D</code>, <code>compressedTexImage3D</code>, and
<code>compressedTexSubImage3D</code> if the variant taking <code>ArrayBufferView pixels</code>
is called and the size restrictions above are not met.
</error>
<error enum="INVALID_OPERATION">
The error <code>INVALID_OPERATION</code> is generated by <code>compressedTexImage2D</code>,
<code>compressedTexSubImage2D</code>, <code>compressedTexImage3D</code>, and
<code>compressedTexSubImage3D</code> if the variant taking <code>GLintptr offset</code> is
called and the size restrictions above are not met.
</error>
</errors>
<history>
<revision date="2013/12/9">
<change>Initial revision.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/12/12">
<change>COMPRESSED_RGB_ETC2 should be COMPRESSED_RGB8_ETC2.</change>
<change>Remove unnecessary language.</change>
</revision>
<revision date="2015/01/31">
<change>Moved to draft.</change>
<change>Added issue questions.</change>
<change>Formalized the newtok and error codes.</change>
</revision>
<revision date="2016/09/16">
<change>Renamed to WEBGL_compressed_texture_es3_0.</change>
</revision>
<revision date="2016/09/21">
<change>Clarifications to the supported formats on suggestion from Mark Callow.</change>
</revision>
<revision date="2016/09/30">
<change>Addressed issues regarding 3D entry points, description of interation with WebGL 2.0,
and generation of INVALID_OPERATION and INVALID_VALUE errors. Added note that browsers should
not advertise this extension if these compressed texture formats are decompressed. Renamed to
WEBGL_compressed_texture_etc after further discussion. Promoted to community
approved.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,91 @@
<?xml version="1.0"?>
<extension href="WEBGL_compressed_texture_etc1/">
<name>WEBGL_compressed_texture_etc1</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>24</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the compressed texture format defined in the
<a href="http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt">
OES_compressed_ETC1_RGB8_texture</a> OpenGL ES extension to WebGL.
</p>
<features>
<feature>
Compression format <code>COMPRESSED_RGB_ETC1_WEBGL</code> may be passed to
the <code>compressedTexImage2D</code> entry point.
This format correspond to the format defined in the OES_compressed_ETC1_RGB8_texture OpenGL ES
extension. Although the enum name is changed, the numeric value is the same. The correspondence
is given by this table:
<table>
<tr>
<th>WebGL format enum</th>
<th>OpenGL format enum</th>
<th>Numeric value</th>
</tr>
<tr>
<td>COMPRESSED_RGB_ETC1_WEBGL</td>
<td>ETC1_RGB8_OES</td>
<td>0x8D64</td>
</tr>
</table>
</feature>
<feature>
Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code>
will include the format from this specification.
</feature>
<feature>
<p>The following format-specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGB_ETC1_WEBGL</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
<code>compressedTexImage2D</code> must be equal to the following number of bytes:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 8
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_compressed_texture_etc1 {
/* Compressed Texture Format */
const GLenum COMPRESSED_RGB_ETC1_WEBGL = 0x8D64;
};
</idl>
<history>
<revision date="2012/02/23">
<change>Initial revision.</change>
</revision>
<revision date="2013/07/03">
<change>Clarified that length of ArrayBufferView is actually byteLength.</change>
</revision>
<revision date="2013/11/27">
<change>Moved to draft status.</change>
</revision>
<revision date="2013/12/03">
<change>Assigned extension number 24 to WEBGL_compressed_texture_etc1 extension.</change>
</revision>
<revision date="2014/03/07">
<change>Remove ability to use the format with compressedTexSubImage2D, as per the GLES extension spec.</change>
</revision>
<revision date="2014/06/27">
<change>Moved to community approved after discussion on public_webgl list.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,100 @@
<?xml version="1.0"?>
<extension href="WEBGL_compressed_texture_pvrtc/">
<name>WEBGL_compressed_texture_pvrtc</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>13</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the compressed texture formats defined in the
<a href="http://www.khronos.org/registry/gles/extensions/IMG/IMG_texture_compression_pvrtc.txt">
IMG_texture_compression_pvrtc</a> OpenGL extension to WebGL.
</p>
<features>
<feature>
Compression formats <code>COMPRESSED_RGB_PVRTC_4BPPV1_IMG</code>,
<code>COMPRESSED_RGB_PVRTC_2BPPV1_IMG</code>, <code>COMPRESSED_RGBA_PVRTC_4BPPV1_IMG</code>, and
<code>COMPRESSED_RGBA_PVRTC_2BPPV1_IMG</code> may be passed to
the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points.
</feature>
<feature>
Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code>
will include the 4 formats from this specification.
</feature>
<feature>
<p>The following format-specific restrictions apply to all of the formats described
by this extension:
</p>
<p>In <code>compressedTexImage2D</code>, the <code>width</code> and <code>height</code>
parameters must be powers of two. Otherwise, an INVALID_VALUE error is generated.
</p>
<p>
In <code>compressedTexSubImage2D</code>, the <code>width</code> and <code>height</code>
parameters must be equal to the current values of the existing texture image, and the
<code>xoffset</code> and <code>yoffset</code> parameters must be zero.
Otherwise, an INVALID_VALUE error is generated.
</p>
</feature>
<feature>
<p>The following format-specific restrictions must also be enforced:</p>
<dl>
<dt>COMPRESSED_RGB_PVRTC_4BPPV1_IMG</dt>
<dt>COMPRESSED_RGBA_PVRTC_4BPPV1_IMG</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:</p>
<blockquote><code>
max(width, 8) * max(height, 8) / 2
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
<dt>COMPRESSED_RGB_PVRTC_2BPPV1_IMG</dt>
<dt>COMPRESSED_RGBA_PVRTC_2BPPV1_IMG</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be
equal to the following number of bytes:</p>
<blockquote><code>
max(width, 16) * max(height, 8) / 4
</code></blockquote>
<p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p>
</dd>
</dl>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_compressed_texture_pvrtc {
/* Compressed Texture Formats */
const GLenum COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
const GLenum COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;
const GLenum COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
const GLenum COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
};
</idl>
<history>
<revision date="2012/08/07">
<change>Initial revision.</change>
</revision>
<revision date="2013/07/03">
<change>Clarified that length of ArrayBufferView is actually byteLength.</change>
</revision>
<revision date="2014/06/27">
<change>Moved to community approved after discussion on public_webgl list.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,119 @@
<?xml version="1.0"?>
<ratified href="WEBGL_compressed_texture_s3tc/">
<name>WEBGL_compressed_texture_s3tc</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>8</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the compressed texture formats defined in the
<a href="http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt">
EXT_texture_compression_s3tc</a> OpenGL extension to WebGL.
</p>
<features>
<feature>
Compression formats <code>COMPRESSED_RGB_S3TC_DXT1_EXT</code>,
<code>COMPRESSED_RGBA_S3TC_DXT1_EXT</code>, <code>COMPRESSED_RGBA_S3TC_DXT3_EXT</code>, and
<code>COMPRESSED_RGBA_S3TC_DXT5_EXT</code> may be passed to
the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points.
</feature>
<feature>
Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code>
will include the 4 formats from this specification.
</feature>
<feature>
<p>The following format specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_RGB_S3TC_DXT1_EXT</dt>
<dt>COMPRESSED_RGBA_S3TC_DXT1_EXT</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code>
must match the following equation:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 8
</code></blockquote>
<p>
If it is not an <code>INVALID_VALUE</code> error is generated.
</p>
<p>When <code>level</code> equals zero <code>width</code> and <code>height</code>
must be a multiple of 4. When <code>level</code> is greater than 0 <code>width</code>
and <code>height</code> must be 0, 1, 2 or a multiple of 4.</p>
<p>
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
<p>
For <code>compressedTexSubImage2D</code> <code>xoffset</code> and
<code>yoffset</code> must be a multiple of 4 and
<code>width</code> must be a multiple of 4 or equal to the original
width of the <code>level</code>. <code>height</code> must be a multiple of 4 or
equal to the original height of the <code>level</code>.
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
</dd>
<dt>COMPRESSED_RGBA_S3TC_DXT3_EXT</dt>
<dt>COMPRESSED_RGBA_S3TC_DXT5_EXT</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must
match the following equation:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
</code></blockquote>
<p>
If it is not an <code>INVALID_VALUE</code> error is generated.
</p>
<p>When <code>level</code> equals zero <code>width</code> and <code>height</code>
must be a multiple of 4. When <code>level</code> is greater than 0 <code>width</code>
and <code>height</code> must be 0, 1, 2 or a multiple of 4.</p>
<p>
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
<p>
For <code>compressedTexSubImage2D</code> <code>xoffset</code> and
<code>yoffset</code> must be a multiple of 4 and
<code>width</code> must be a multiple of 4 or equal to the original
width of the <code>level</code>. <code>height</code> must be a multiple of 4 or
equal to the original height of the <code>level</code>.
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
</dd>
</dl>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_compressed_texture_s3tc {
/* Compressed Texture Formats */
const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
};
</idl>
<history>
<revision date="2012/01/25">
<change>Initial revision.</change>
</revision>
<revision date="2013/01/26">
<change>Moved from draft to community approved status</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2013/07/03">
<change>Clarified that length of ArrayBufferView is actually byteLength.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,113 @@
<?xml version="1.0"?>
<extension href="WEBGL_compressed_texture_s3tc_srgb/">
<name>WEBGL_compressed_texture_s3tc_srgb</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>32</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the sRGB compressed texture formats defined in the
<a href="https://www.opengl.org/registry/specs/EXT/texture_sRGB.txt">
EXT_texture_sRGB</a> OpenGL extension to WebGL.
</p>
<features>
<feature>
Compression formats <code>COMPRESSED_SRGB_S3TC_DXT1_EXT</code>,
<code>COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT</code>, <code>COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT</code>, and
<code>COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT</code> may be passed to
the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points.
</feature>
<feature>
Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code>
will include the 4 formats from this specification.
</feature>
<feature>
<p>The following format specific restrictions must be enforced:</p>
<dl>
<dt>COMPRESSED_SRGB_S3TC_DXT1_EXT</dt>
<dt>COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code>
must match the following equation:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 8
</code></blockquote>
<p>
If it is not an <code>INVALID_VALUE</code> error is generated.
</p>
<p>When <code>level</code> equals zero <code>width</code> and <code>height</code>
must be a multiple of 4. When <code>level</code> is greater than 0 <code>width</code>
and <code>height</code> must be 0, 1, 2 or a multiple of 4.</p>
<p>
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
<p>
For <code>compressedTexSubImage2D</code> <code>xoffset</code> and
<code>yoffset</code> must be a multiple of 4 and
<code>width</code> must be a multiple of 4 or equal to the original
width of the <code>level</code>. <code>height</code> must be a multiple of 4 or
equal to the original height of the <code>level</code>.
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
</dd>
<dt>COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT</dt>
<dt>COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT</dt>
<dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to
either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must
match the following equation:</p>
<blockquote><code>
floor((width + 3) / 4) * floor((height + 3) / 4) * 16
</code></blockquote>
<p>
If it is not an <code>INVALID_VALUE</code> error is generated.
</p>
<p>When <code>level</code> equals zero <code>width</code> and <code>height</code>
must be a multiple of 4. When <code>level</code> is greater than 0 <code>width</code>
and <code>height</code> must be 0, 1, 2 or a multiple of 4.</p>
<p>
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
<p>
For <code>compressedTexSubImage2D</code> <code>xoffset</code> and
<code>yoffset</code> must be a multiple of 4 and
<code>width</code> must be a multiple of 4 or equal to the original
width of the <code>level</code>. <code>height</code> must be a multiple of 4 or
equal to the original height of the <code>level</code>.
If they are not an <code>INVALID_OPERATION</code> error is generated.
</p>
</dd>
</dl>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_compressed_texture_s3tc_srgb {
/* Compressed Texture Formats */
const GLenum COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C;
const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D;
const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E;
const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F;
};
</idl>
<history>
<revision date="2016/06/10">
<change>Initial revision.</change>
</revision>
<revision date="2016/07/21">
<change>Moved to draft after discussion in working group, and study of possible dependencies.</change>
</revision>
<revision date="2017/05/31">
<change>Moved to community approved after Mozilla voiced support.</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,95 @@
<?xml version="1.0"?>
<ratified href="WEBGL_debug_renderer_info/">
<name>WEBGL_debug_renderer_info</name>
<contact><a href="mailto:zmo@chromium.org">zmo@chromium.org</a></contact>
<contributors>
<contributor>Members of the <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a></contributor>
</contributors>
<number>6</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>WebGL implementations might mask the <code>RENDERER</code> and <code>VENDOR</code> strings of the underlying graphics driver for privacy reasons. This extension exposes new tokens to query this information in a guaranteed manner for debugging purposes.</p>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_debug_renderer_info {
const GLenum UNMASKED_VENDOR_WEBGL = 0x9245;
const GLenum UNMASKED_RENDERER_WEBGL = 0x9246;
};
</idl>
<newtok>
<function name="getParameter" type="any">
<param name="pname" type="GLenum"/>
Two new enums <code>UNMASKED_VENDOR_WEBGL</code> and <code>UNMASKED_RENDERER_WEBGL</code> are accepted by <code>pname</code> parameter in <code>getParameter()</code>.
<table class="foo">
<tr><th>pname</th><th>returned type</th></tr>
<tr><td>UNMASKED_VENDOR_WEBGL</td><td>DOMString</td></tr>
<tr><td>UNMASKED_RENDERER_WEBGL</td><td>DOMString</td></tr>
</table>
<br />
The following pname arguments return a string describing some aspect of the underlying graphics driver.
<table class="foo">
<tr><td>UNMASKED_VENDOR_WEBGL</td><td>Return the VENDOR string of the underlying graphics driver.</td></tr>
<tr><td>UNMASKED_RENDERER_WEBGL</td><td>Return the RENDERER string of the underlying graphics driver.</td></tr>
</table>
</function>
</newtok>
<issues>
<p>
1) What enum values should be used for UNMASKED_VENDOR_WEBGL and UNMASKED_RENDERER_WEBGL?</p>
<ul>
<li> RESOLVED: The first draft used temporary enum values. They have been replaced with enums allocated from the WEBGL range of GL enums.</li>
</ul>
<p>
2) Should this extension be made available on ordinary web pages?</p>
<ul>
<li> Earlier versions of this extension noted the following concerns:
<ol>
<li> Identifying the precise graphics card in the user's computer may yield certain personally-identifiable information to the web page; for example, if the user has a unique graphics card. </li>
<li> Identifying the precise graphics card to JavaScript might encourage developers to target their WebGL applications to run only on a particular type of graphics card. This is similar to the User-Agent "sniffing" or "spoofing" problem which has historically been pervasive and problematic on the web. </li>
</ol>
User agents (web browsers) should carefully consider whether or not to expose this extension in non-privileged settings due to these concerns. </li>
<li> On the other hand, benefits of exposing this information to general web pages include:
<ol>
<li> The WebGL application can tune its rendering techniques based on previously observed performance characteristics on the same graphics card. </li>
<li> The WebGL application can gather useful information for debugging; for example, if it is running slowly, it can gather data for reproducing and fixing the problem. </li>
</ol>
</li>
</ul>
</issues>
<history>
<revision date="2011/10/03">
<change>Initial revision.</change>
</revision>
<revision date="2011/10/12">
<change>Assigned enums; assigned webgl extension number.</change>
</revision>
<revision date="2011/10/18">
<change>Clarify the meaning of "privileged".</change>
</revision>
<revision date="2011/12/07">
<change>Fixed mistake where extension still indicated draft status.</change>
</revision>
<revision date="2012/01/03">
<change>Removed webgl module per changes to Web IDL spec.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/01/28">
<change>Added issue on privacy and user agent sniffing considerations, replacing security section.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,79 @@
<?xml version="1.0"?>
<ratified href="WEBGL_debug_shaders/">
<name>WEBGL_debug_shaders</name>
<contact><a href="mailto:zmo@chromium.org">zmo@chromium.org</a></contact>
<contributors>
<contributor>Members of the <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a></contributor>
</contributors>
<number>7</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
WebGL uses the GLSL ES 2.0 spec on all platforms, and translates these shaders to the host platform's native language (HLSL, GLSL, and even GLSL ES). For debugging purpose, it is useful to be able to examine the shader after translation. This extension exposes a new function <code>getTranslatedShaderSource</code> for such purposes.
</p>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_debug_shaders {
DOMString getTranslatedShaderSource(WebGLShader shader);
};
</idl>
<newfun>
<function name="getTranslatedShaderSource" type="DOMString">
<param name="shader" type="WebGLShader" />
If no source has been defined, <code>compileShader()</code> has not been called, or the translation has failed for <code>shader</code>, an empty string is returned; otherwise, return the translated source.
</function>
</newfun>
<issues>
<p>
1) Should this extension be made available on ordinary web pages?</p>
<ul>
<li> Earlier versions of this extension noted the following concerns:
<ol>
<li> The precise pattern of how the original shader is translated may yield personally-identifiable information to the web page about the kind of graphics card in the user's computer. </li>
</ol>
User agents (web browsers) should carefully consider whether or not to expose this extension in non-privileged settings due to these concerns. </li>
<li> On the other hand, benefits of exposing this information to general web pages include:
<ol>
<li> Tools for WebGL developers can provide more detailed information about how the input shader is translated to run on the graphics card, potentially helping the developers make their applications run faster. </li>
</ol>
</li>
</ul>
</issues>
<history>
<revision date="2011/10/03">
<change>Initial revision.</change>
</revision>
<revision date="2011/10/14">
<change>Assigned WebGL extension number.</change>
</revision>
<revision date="2011/10/18">
<change>Clarify the meaning of "privileged".</change>
</revision>
<revision date="2011/12/07">
<change>Fixed mistake where extension still indicated draft status.</change>
<change>Renamed "New Functions and Methods" section to "New Functions".</change>
</revision>
<revision date="2012/01/03">
<change>Removed webgl module per changes to Web IDL spec.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/01/28">
<change>Added issue on privacy considerations, replacing security section.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,265 @@
<?xml version="1.0"?>
<ratified href="WEBGL_depth_texture/">
<name>WEBGL_depth_texture</name>
<aliases>
<alias>WEBKIT_WEBGL_depth_texture</alias>
<alias>MOZ_WEBGL_depth_texture</alias>
</aliases>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
<contributor>Florian B&#246;sch (pyalot 'at' gmail.com)</contributor>
</contributors>
<number>9</number>
<depends>
<api version="1.0"/>
<removed version="2.0" />
</depends>
<overview>
<p>This extension exposes the
<a href="http://angleproject.googlecode.com/svn/trunk/extensions/ANGLE_depth_texture.txt">ANGLE_depth_texture</a>
functionality to WebGL. ANGLE_depth_texture provides a subset of the
functionality from the OpenGL ES 2.0 extensions
<a href="http://www.khronos.org/registry/gles/extensions/OES/OES_depth_texture.txt">OES_depth_texture</a>
and
<a href="http://www.khronos.org/registry/gles/extensions/OES/OES_packed_depth_stencil.txt">OES_packed_depth_stencil</a>, with certain restrictions added for portability reasons. Specifically:</p>
<ul>
<li> ANGLE_depth_texture provides both depth and depth/stencil textures. </li>
<li> ANGLE_depth_texture does not provide the <code>DEPTH24_STENCIL8_OES</code> renderbuffer internal format from the OES_packed_depth_stencil extension. The core WebGL specification already supports allocation of depth/stencil renderbuffers. </li>
<li> ANGLE_depth_texture does not support loading image data via the TexImage or TexSubImage commands. Depth and depth/stencil textures created via this extension can only have their contents specified by rendering to them. </li>
</ul>
<p>Consult the Errors section below for specific restrictions.
</p>
<features>
<feature>
The <code>texImage2D</code> entry point is extended to accept the
<code>format</code> parameter <code>DEPTH_COMPONENT</code> and
<code>DEPTH_STENCIL</code>
</feature>
<feature>
The <code>texImage2D</code> entry point is extended to accept the
<code>internalFormat</code> parameter <code>DEPTH_COMPONENT</code>
and <code>DEPTH_STENCIL</code>
</feature>
<feature>
The <code>texImage2D</code> entry point is extended to accept
the <code>type</code> parameter <code>UNSIGNED_SHORT</code>,
<code>UNSIGNED_INT</code>, and
<code>UNSIGNED_INT_24_8_WEBGL</code>
</feature>
<feature>
The <code>framebufferTexture2D</code> entry point is extended to
accept the <code>target</code> parameter
<code>DEPTH_ATTACHMENT</code> and
<code>DEPTH_STENCIL_ATTACHMENT</code>
</feature>
<feature>
The <code>texImage2D</code> entry point is extended to accept
<code>ArrayBufferView</code> of type <code>Uint16Array</code> and
<code>Uint32Array</code>
</feature>
<feature>
<p>
The WebGL-specific constraints about <a href="http://www.khronos.org/registry/webgl/specs/1.0/#FBO_ATTACHMENTS">Framebuffer Object Attachments</a> are extended:</p>
<ul>
<li> A texture attached to an FBO's <code>DEPTH_ATTACHMENT</code> attachment point must be allocated with the <code>DEPTH_COMPONENT</code> internal format. </li>
<li> A texture attached to the <code>DEPTH_STENCIL_ATTACHMENT</code> attachment point must be allocated with the <code>DEPTH_STENCIL</code> internal format. </li>
</ul>
<p>
In the WebGL API, it is an error to concurrently attach either
renderbuffers or textures to the following combinations of
attachment points:</p>
<ul>
<li> <code>DEPTH_ATTACHMENT</code> + <code>DEPTH_STENCIL_ATTACHMENT</code> </li>
<li> <code>STENCIL_ATTACHMENT</code> + <code>DEPTH_STENCIL_ATTACHMENT</code> </li>
<li> <code>DEPTH_ATTACHMENT</code> + <code>STENCIL_ATTACHMENT</code> </li>
</ul>
<p>
See the section
<a href="http://www.khronos.org/registry/webgl/specs/1.0/#FBO_ATTACHMENTS">Framebuffer Object Attachments</a>
in the WebGL specification for the behavior if these
constraints are violated.
</p>
</feature>
<feature>
<p>
As per the OpenGL ES spec, there is no guarantee that the OpenGL ES implementation
will use the texture type to determine how to store the depth texture internally.
It may choose to downsample the 32-bit depth values to 16-bit or even 24-bit.
When a depth or depth/stencil texture is attached to a framebuffer object, calls to getParameter
with the DEPTH_BITS and STENCIL_BITS enums return the following:
<table>
<tr>
<th>Texture Type</th>
<th>DEPTH_BITS (GLint)</th>
<th>STENCIL_BITS (GLint)</th>
</tr>
<tr>
<td>UNSIGNED_SHORT</td>
<td>>= 16</td>
<td>0</td>
</tr>
<tr>
<td>UNSIGNED_INT</td>
<td>>= 16</td>
<td>0</td>
</tr>
<tr>
<td>UNSIGNED_INT_24_8_WEBGL</td>
<td>>= 24</td>
<td>>= 8</td>
</tr>
</table>
</p>
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_depth_texture {
const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;
};
</idl>
<errors>
<error>
The error <code>INVALID_OPERATION</code> is generated by
<code>texImage2D</code> if the <code>format</code> parameter is
<code>DEPTH_COMPONENT</code> or <code>DEPTH_STENCIL</code> and the
<code>target</code> is
<code>TEXTURE_CUBE_MAP_{POSITIVE,NEGATIVE}_{X,Y,Z}</code>.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by
<code>texImage2D</code> if <code>format</code> and
<code>internalformat</code> are <code>DEPTH_COMPONENT</code> and
<code>type</code> is not <code>UNSIGNED_SHORT</code> or
<code>UNSIGNED_INT</code>.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by
<code>texImage2D</code> if <code>format</code> and
<code>internalformat</code> are not <code>DEPTH_COMPONENT</code>
and <code>type</code> is <code>UNSIGNED_SHORT</code> or
<code>UNSIGNED_INT</code>.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by
<code>texImage2D</code> if <code>format</code> and
<code>internalformat</code> are <code>DEPTH_STENCIL</code> and
<code>type</code> is not <code>UNSIGNED_INT_24_8_WEBGL</code>.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by
<code>texImage2D</code> if <code>format</code> and
<code>internalformat</code> are not <code>DEPTH_STENCIL</code> and
<code>type</code> is <code>UNSIGNED_INT_24_8_WEBGL</code>.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated in the following situations:
<ul>
<li>
<code>texImage2D</code> is called with <code>format</code> and
<code>internalformat</code> of <code>DEPTH_COMPONENT</code> or
<code>DEPTH_STENCIL</code> and
<ul>
<li> <code>target</code> is not TEXTURE_2D, </li>
<li> <code>data</code> is not NULL, or </li>
<li> <code>level</code> is not zero. </li>
</ul>
</li>
<li>
<code>texSubImage2D</code> is called with <code>format</code> of
<code>DEPTH_COMPONENT</code> or <code>DEPTH_STENCIL</code>.
</li>
<li>
<code>copyTexImage2D</code> is called with an
<code>internalformat</code> that has a base internal format of
<code>DEPTH_COMPONENT</code> or <code>DEPTH_STENCIL</code>.
</li>
<li>
<code>copyTexSubImage2D</code> is called with a target texture
that has a base internal format of <code>DEPTH_COMPONENT</code>
or <code>DEPTH_STENCIL</code>.
</li>
<li>
<code>generateMipmap</code> is called on a texture that has a
base internal format of <code>DEPTH_COMPONENT</code> or
<code>DEPTH_STENCIL</code>.
</li>
</ul>
</error>
</errors>
<issues>
<p>
As per the ANGLE_depth_texture specification, when a depth
texture is sampled, the value is stored into the RED channel.
The contents of the GREEN, BLUE and ALPHA channels are
implementation dependent. It is therefore recommended to use
only the <code>r</code> component of variables in GLSL shaders
that are used to reference depth textures.
</p>
</issues>
<history>
<revision date="2012/01/23">
<change>Initial revision.</change>
</revision>
<revision date="2012/01/25">
<change>Added provisions to exclude cube depth textures.</change>
</revision>
<revision date="2012/02/06">
<change>Changed referenced WebGL API version from 2.0 to 1.0</change>
</revision>
<revision date="2012/02/24">
<change>Removed the enumerants from the IDL which are contained in the context and added aliases to the extension name</change>
</revision>
<revision date="2012/03/01">
<change>
Renamed with OES prefix and removed the addendum due to expected harmonization between OES_depth_texture and ARB_depth_texture
(depth cube maps).
</change>
</revision>
<revision date="2012/06/04">
<change>
Renamed to WEBGL prefix, and changed to reference ANGLE_depth_texture, because of
limitations preventing the current ANGLE library from loading of image data to depth
textures. Incorporated errors from ANGLE_depth_texure extension specification.
</change>
</revision>
<revision date="2012/06/20">
<change>
Incorporated depth/stencil support and UNSIGNED_INT_24_8_WEBGL enum after discussion on
public_webgl mailing list, including supported behavior and additional error behavior.
Extended rules in Section 6.5 ("Framebuffer Object Attachments") to handle texture
attachments.
</change>
</revision>
<revision date="2012/06/27">
<change>
Updated references to texSubImage2D. Added
DEPTH_STENCIL_ATTACHMENT to framebufferTexture2D.
</change>
</revision>
<revision date="2013/01/26">
<change>Moved from draft to community approved status</change>
</revision>
<revision date="2013/02/28">
<change>Updated to track ANGLE_depth_texture, indicating that only red channel is guaranteed.</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,185 @@
<?xml version="1.0"?>
<ratified href="WEBGL_draw_buffers/">
<name>WEBGL_draw_buffers</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>18</number>
<depends>
<api version="1.0"/>
<core version="2.0">
<glsl version="300 es"/>
</core>
</depends>
<overview>
<mirrors href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_buffers.txt" name="EXT_draw_buffers">
<addendum>
The implementation must support a minimum of 4 color attachments.
</addendum>
<addendum>
The value of the <code>MAX_COLOR_ATTACHMENTS_WEBGL</code> parameter must be greater than or
equal to that of the <code>MAX_DRAW_BUFFERS_WEBGL</code> parameter.
</addendum>
<addendum>
If:
<ul>
<li> A framebuffer's color attachments are all textures allocated with format <code>RGBA</code>
and type <code>UNSIGNED_BYTE</code>, and </li>
<li> The framebuffer has either:
<ul>
<li> No depth or stencil attachment </li>
<li> A valid <code>DEPTH</code> or <code>DEPTH_STENCIL</code> attachment </li>
</ul></li>
</ul>
Then a call to <code>checkFramebufferStatus</code> against this framebuffer must not return
<code>FRAMEBUFFER_UNSUPPORTED</code>. (In other words, the implementation must support the
use of <code>RGBA/UNSIGNED_BYTE</code> textures as color attachments, plus either a
<code>DEPTH</code> or <code>DEPTH_STENCIL</code> attachment.)
</addendum>
<addendum>
Attaching <code>n</code> consecutive color attachments starting at COLOR_ATTACHMENT0_WEBGL,
where <code>n</code> is between 1 and <code>MAX_DRAW_BUFFERS_WEBGL</code>, must not return
<code>FRAMEBUFFER_UNSUPPORTED</code> from a call to <code>checkFramebufferStatus</code>. In
other words, if <code>MAX_DRAW_BUFFERS_WEBGL</code> is 4, then the implementation is
required to support the following combinations of color attachments:
<ul>
<li> <code>COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE</code></li>
<li> <code>COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE</code><br/>
<code>COLOR_ATTACHMENT1_WEBGL = RGBA/UNSIGNED_BYTE</code><br/></li>
<li> <code>COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE</code><br/>
<code>COLOR_ATTACHMENT1_WEBGL = RGBA/UNSIGNED_BYTE</code><br/>
<code>COLOR_ATTACHMENT2_WEBGL = RGBA/UNSIGNED_BYTE</code><br/></li>
<li> <code>COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE</code><br/>
<code>COLOR_ATTACHMENT1_WEBGL = RGBA/UNSIGNED_BYTE</code><br/>
<code>COLOR_ATTACHMENT2_WEBGL = RGBA/UNSIGNED_BYTE</code><br/>
<code>COLOR_ATTACHMENT3_WEBGL = RGBA/UNSIGNED_BYTE</code><br/></li>
</ul>
</addendum>
<addendum>
Although the extension name is prefixed with WEBGL the extension must be enabled with the
<code>#extension GL_EXT_draw_buffers</code> directive, as shown in the sample code, to use
the extension in a shader.
Likewise the shading language preprocessor <code>#define GL_EXT_draw_buffers</code>, will be defined to 1 if the extension is supported.
</addendum>
<addendum>
The value of <code>gl_MaxDrawBuffers</code> must match <code>MAX_DRAW_BUFFERS_WEBGL</code> from the API if the extension is enabled in a WebGL context; otherwise, the value must be 1. Whether or not the extension is enabled with the <code>#extension GL_EXT_draw_buffers</code> directive in a shader does not affect the value of <code>gl_MaxDrawBuffers</code>. The value of <code>gl_MaxDrawBuffers</code> is a constant in the shader, and is guaranteed to be frozen at program link time. It is implementation-dependent whether it is frozen at shader compile time. (A consequence is that if a program is linked, and later the WEBGL_draw_buffers extension is enabled, the value of <code>gl_MaxDrawBuffers</code> seen by that program will still be 1.)
</addendum>
<addendum>
If the WEBGL_draw_buffers extension is enabled, but the fragment shader does not contain the <code>#extension GL_EXT_draw_buffers</code> directive to enable it, then writes to <code>gl_FragColor</code> are only written to <code>COLOR_ATTACHMENT0_WEBGL</code>, and not broadcast to all color attachments. In this scenario, other color attachments are guaranteed to remain untouched.
</addendum>
<addendum>
If a fragment shader writes to neither <code>gl_FragColor</code> nor <code>gl_FragData</code>, the values of
the fragment colors following shader execution are untouched.
If a fragment shader contains the <code>#extension GL_EXT_draw_buffers</code> directive, all
<code>gl_FragData</code> variables (from <code>gl_FragData[0]</code> to <code>gl_FragData[MAX_DRAW_BUFFERS_WEBGL - 1]</code>)
default to zero if no values are written to them during a shader execution.
</addendum>
<addendum>
If an image is attached to more than one color attachment point in a framebuffer, <code>checkFramebufferStatus</code>
returns <code>FRAMEBUFFER_UNSUPPORTED</code>. An image can be an individual mip level, or a face of cube map.
</addendum>
</mirrors>
<features>
<feature>
Adds support for multiple color buffers and color outputs from fragment shaders.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_draw_buffers {
const GLenum COLOR_ATTACHMENT0_WEBGL = 0x8CE0;
const GLenum COLOR_ATTACHMENT1_WEBGL = 0x8CE1;
const GLenum COLOR_ATTACHMENT2_WEBGL = 0x8CE2;
const GLenum COLOR_ATTACHMENT3_WEBGL = 0x8CE3;
const GLenum COLOR_ATTACHMENT4_WEBGL = 0x8CE4;
const GLenum COLOR_ATTACHMENT5_WEBGL = 0x8CE5;
const GLenum COLOR_ATTACHMENT6_WEBGL = 0x8CE6;
const GLenum COLOR_ATTACHMENT7_WEBGL = 0x8CE7;
const GLenum COLOR_ATTACHMENT8_WEBGL = 0x8CE8;
const GLenum COLOR_ATTACHMENT9_WEBGL = 0x8CE9;
const GLenum COLOR_ATTACHMENT10_WEBGL = 0x8CEA;
const GLenum COLOR_ATTACHMENT11_WEBGL = 0x8CEB;
const GLenum COLOR_ATTACHMENT12_WEBGL = 0x8CEC;
const GLenum COLOR_ATTACHMENT13_WEBGL = 0x8CED;
const GLenum COLOR_ATTACHMENT14_WEBGL = 0x8CEE;
const GLenum COLOR_ATTACHMENT15_WEBGL = 0x8CEF;
const GLenum DRAW_BUFFER0_WEBGL = 0x8825;
const GLenum DRAW_BUFFER1_WEBGL = 0x8826;
const GLenum DRAW_BUFFER2_WEBGL = 0x8827;
const GLenum DRAW_BUFFER3_WEBGL = 0x8828;
const GLenum DRAW_BUFFER4_WEBGL = 0x8829;
const GLenum DRAW_BUFFER5_WEBGL = 0x882A;
const GLenum DRAW_BUFFER6_WEBGL = 0x882B;
const GLenum DRAW_BUFFER7_WEBGL = 0x882C;
const GLenum DRAW_BUFFER8_WEBGL = 0x882D;
const GLenum DRAW_BUFFER9_WEBGL = 0x882E;
const GLenum DRAW_BUFFER10_WEBGL = 0x882F;
const GLenum DRAW_BUFFER11_WEBGL = 0x8830;
const GLenum DRAW_BUFFER12_WEBGL = 0x8831;
const GLenum DRAW_BUFFER13_WEBGL = 0x8832;
const GLenum DRAW_BUFFER14_WEBGL = 0x8833;
const GLenum DRAW_BUFFER15_WEBGL = 0x8834;
const GLenum MAX_COLOR_ATTACHMENTS_WEBGL = 0x8CDF;
const GLenum MAX_DRAW_BUFFERS_WEBGL = 0x8824;
void drawBuffersWEBGL(sequence&lt;GLenum&gt; buffers);
};
</idl>
<samplecode xml:space="preserve">
<pre>
#extension GL_EXT_draw_buffers : require
precision mediump float;
void main() {
gl_FragData[0] = vec4(1.0, 0.0, 0.0, 1.0);
gl_FragData[1] = vec4(0.0, 1.0, 0.0, 1.0);
gl_FragData[2] = vec4(0.0, 0.0, 1.0, 1.0);
gl_FragData[3] = vec4(1.0, 1.0, 1.0, 1.0);
}
</pre>
</samplecode>
<history>
<revision date="2012/10/16">
<change>Initial revision.</change>
</revision>
<revision date="2012/11/05">
<change>Corrected typo in drawBuffersWEBGL. Changed referenced spec version to 1.0 to fix broken link.</change>
</revision>
<revision date="2013/02/02">
<change>Renamed to EXT_draw_buffers per plan of OpenGL ES working group. Moved to draft status. Assigned number.</change>
</revision>
<revision date="2013/03/05">
<change>Renamed to WEBGL_draw_buffers per discussion on public_webgl list. Added guarantees to make it easier for developers to use the extension.</change>
</revision>
<revision date="2013/06/07">
<change>Clarified naming of shader directives.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2014/08/08">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2016/06/28">
<change>Revised behavior of gl_MaxDrawBuffers and gl_FragColor broadcasting, to avoid significant performance impact for WebGL 1.0 implementations running on top of the desktop OpenGL API.</change>
</revision>
<revision date="2016/07/08">
<change>Removed undefined behaviors.</change>
</revision>
<revision date="2016/07/11">
<change>Revised user-defined variable behavior to default to zero.</change>
</revision>
<revision date="2016/07/23">
<change>Revised behavior of the same image is attached to more than one color attachment point.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,136 @@
<?xml version="1.0"?>
<draft href="WEBGL_get_buffer_sub_data_async/">
<name>WEBGL_get_buffer_sub_data_async</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Kai Ninomiya, Google Inc.</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>34</number>
<depends>
<api version="2.0"/>
</depends>
<overview>
<p>
This extension allows asynchronous buffer readback in WebGL 2.0.
</p>
<features>
<feature>
This extension exposes an asynchronous buffer readback entry point for
non-blocking readbacks from WebGL buffers. It is equivalent to
<code>getBufferSubData</code> but returns a <code>Promise</code>
instead of an immediate readback result.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_get_buffer_sub_data_async {
// Asynchronous version of getBufferSubData which fulfills the returned promise when the data becomes available.
Promise&lt;ArrayBuffer&gt; getBufferSubDataAsync(GLenum target, GLintptr srcByteOffset, ArrayBufferView dstBuffer,
optional GLuint dstOffset = 0, optional GLuint length = 0); // May throw DOMException
};
</idl>
<newfun>
<function name="getBufferSubDataAsync" type="Promise&lt;ArrayBuffer&gt;">
<param name="target" type="GLenum"/>
<param name="srcByteOffset" type="GLintptr"/>
<param name="dstBuffer" type="ArrayBufferView"/>
<param name="dstOffset" type="optional GLuint"/>
<param name="length" type="optional GLuint"/>
Reads back data asynchronously from the bound WebGLBuffer into <code>dstBuffer</code>.
<br/><br/>
Let <code>buf</code> be the buffer bound to <code>target</code> at the time
<code>getBufferSubDataAsync</code> is called.
If <code>length</code> is 0, let <code>copyLength</code> be
<code>dstBuffer.length - dstOffset</code>; otherwise, let
<code>copyLength</code> be <code>length</code>.
<br/><br/>
If <code>copyLength</code> is greater than zero,
copy <code>copyLength</code> typed elements (each of size <code>dstBuffer.BYTES_PER_ELEMENT</code>)
from <code>buf</code> into <code>dstBuffer</code>,
reading <code>buf</code> starting at byte index <code>srcByteOffset</code> and
writing into <code>dstBuffer</code> starting at element index <code>dstOffset</code>.
If <code>copyLength</code> is 0, no data is written to <code>dstBuffer</code>, but
this does not cause a GL error to be generated.
<ul>
<li>If no WebGLBuffer is bound to <code>target</code>,
an <code>INVALID_OPERATION</code> error is generated.
</li>
<li>If <code>target</code> is <code>TRANSFORM_FEEDBACK_BUFFER</code>,
and any transform feedback object is currently active,
an <code>INVALID_OPERATION</code> error is generated.
</li>
<li>If <code>dstOffset</code> is greater than <code>dstBuffer.length</code>,
an <code>INVALID_VALUE</code> error is generated.
</li>
<li>If <code>dstOffset + copyLength</code> is greater than <code>dstBuffer.length</code>,
an <code>INVALID_VALUE</code> error is generated.
</li>
<li>If <code>srcByteOffset</code> is less than zero,
an <code>INVALID_VALUE</code> error is generated.
</li>
<li>If <code>srcByteOffset + copyLength*dstBuffer.BYTES_PER_ELEMENT</code>
is larger than the length of <code>buf</code>,
an <code>INVALID_OPERATION</code> is generated.
</li>
</ul>
When invoked, <code>getBufferSubDataAsync</code> must run these steps:
<ul>
<li>Let <code>promise</code> be a Promise to be returned.
</li>
<li>Check for the errors defined above. If there are any errors, generate the GL error
synchronously and
<a href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise">reject</a>
<code>promise</code> with an <code>InvalidStateError</code>.
</li>
<li>Insert a readback of <code>buf</code> into the GL command stream, using the range
defined above.
</li>
<li>Return <code>promise</code>, but continue running these steps in parallel.
</li>
<li>Upon completion of the readback, queue a task performing the following steps:
<ul>
<li>If the context has been lost, or if <code>dstBuffer</code> has been neutered,
<a href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise">reject</a>
<code>promise</code> with an <code>InvalidStateError</code>. In this case, no GL
error is generated.
</li>
<li>Write the readback result into <code>dstBuffer</code>, using the range defined
above.
</li>
<li><a href="https://www.w3.org/2001/tag/doc/promises-guide/#resolve-promise">Resolve</a>
<code>promise</code> with <code>dstBuffer</code>.
</li>
</ul>
The task source for this task is the <a href="#WEBGLCONTEXTEVENT">WebGL task source</a>.
</li>
</ul>
If the returned Promise is rejected, no data is written to <code>dstBuffer</code>.
<div class="note">
Even if <code>getBufferSubDataAsync</code> is called multiple times in a row with the same
<code>dstBuffer</code>, <code>then</code> callbacks added synchronously will never see
results of subsequent <code>getBufferSubDataAsync</code> calls.
</div>
<div class="note rationale">
Compared to the synchronous version of <code>getBufferSubData</code>, this version may
impose less overhead on applications. Intended use cases include reading pixels into a
pixel buffer object and examining that data on the CPU. It does not force the graphics
pipeline to be stalled as <code>getBufferSubData</code> does.
</div>
</function>
</newfun>
<history>
<revision date="2016/12/13">
<change>Initial revision.</change>
</revision>
</history>
</draft>

Просмотреть файл

@ -0,0 +1,114 @@
<?xml version="1.0"?>
<ratified href="WEBGL_lose_context/">
<name>WEBGL_lose_context</name>
<aliases>
<alias>WEBKIT_WEBGL_lose_context</alias>
<alias>MOZ_WEBGL_lose_context</alias>
</aliases>
<contact><a href="mailto:enne@chromium.org">enne@chromium.org</a></contact>
<contributors>
<contributor>Members of the <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a></contributor>
<contributor>Glenn Maynard</contributor>
</contributors>
<number>3</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>This extension exposes new functions which simulate losing and restoring the WebGL context, even on platforms where the context can never be lost. Consult the WebGL specification for documentation about the <code>webglcontextlost</code> and <code>webglcontextrestored</code> events.</p>
<p>When this extension is enabled:
<ul>
<li><code>loseContext</code> and <code>restoreContext</code> are allowed to generate INVALID_OPERATION errors even when the context is lost.</li>
</ul>
</p>
<p>
Note that this extension is <strong>not</strong> disconnected from the WebGLRenderingContext if that
object loses its context as described in "The Context Lost Event" of the WebGL specification, either
through use of this API or via actual circumstances such as a system failure.
</p>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_lose_context {
void loseContext();
void restoreContext();
};
</idl>
<newfun>
<function name="loseContext" type="void">
<p>When this function is called and the context is not lost, simulate
losing the context so as to trigger the steps described in the WebGL
spec for handling context lost. The context will remain in the lost
state according to the WebGL specification until
<code>restoreContext()</code> is called. If the context is already
lost when this function is called, generate an
<code>INVALID_OPERATION</code> error.</p>
<p>Implementations should destroy the underlying graphics context and
all graphics resources when this method is called. This is the
recommended mechanism for applications to programmatically halt their
use of the WebGL API.</p>
</function>
<function name="restoreContext" type="void">
When this function is called while the context is lost, and the conditions
defined by the WebGL specification for restoring the context are
met, simulate the context being restored so as to trigger the steps
described in the WebGL spec for handling the context being restored.
If the context is already restored when this function is called, or if
the conditions in the WebGL specification for restoring the
context are not satisfied, or if the context was not lost via <code>loseContext()</code>,
generate an <code>INVALID_OPERATION</code> error.
</function>
</newfun>
<history>
<revision date="2011/01/11">
<change>Initial revision.</change>
</revision>
<revision date="2011/04/14">
<change>Added explicit restoreContext() method based on discussion on public_webgl list, to enable testing of scenario where context stays lost for a period of time.</change>
</revision>
<revision date="2011/11/08">
<change>Renamed from WEBKIT_lose_context to WEBGL_EXT_lose_context</change>
</revision>
<revision date="2011/11/11">
<change>Changed to make it clear this extension should follow the WebGL spec for the steps involved in handling losing and restoring the context rather than just fire events.</change>
</revision>
<revision date="2011/12/06">
<change>Added vendor-specific name strings for draft extension per discussion on WebGL mailing list</change>
<change>Renamed from WEBGL_EXT_lose_context to WEBGL_lose_context</change>
</revision>
<revision date="2011/12/07">
<change>Renamed "Name Strings" section to "Alias Name Strings".</change>
</revision>
<revision date="2012/01/03">
<change>Removed webgl module per changes to Web IDL spec.</change>
</revision>
<revision date="2013/01/26">
<change>Moved from draft to community approved status</change>
</revision>
<revision date="2013/05/15">
<change>Ratified by Khronos Board of Promoters.</change>
</revision>
<revision date="2013/06/05">
<change>Clarified error generation that conflicted with WebGL spec.</change>
</revision>
<revision date="2013/08/02">
<change>
Indicated that this extension is not disconnected from the WebGLRenderingContext
when that object loses its drawing buffer (i.e. when it performs the steps
outlined in "The Context Lost Event" of the WebGL specification).</change>
</revision>
<revision date="2014/05/08">
<change>Added INVALID_OPERATION for restoreContext() without loseContext()</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2017/02/03">
<change>Per discussion in working group, document that this extension
should destroy the underlying context and all graphics resources.</change>
</revision>
</history>
</ratified>

Просмотреть файл

@ -0,0 +1,281 @@
<?xml version="1.0"?>
<draft href="WEBGL_multiview/">
<name>WEBGL_multiview</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Olli Etuaho, NVIDIA</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>36</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<mirrors href="https://www.opengl.org/registry/specs/OVR/multiview.txt" name="OVR_multiview">
<addendum>
Calling <code>framebufferTextureMultiviewWEBGL</code> with a non-null <code>texture</code> parameter that does not identify a 2D array texture generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
The values of <code>baseViewIndex</code> and <code>numViews</code> can result in an error only if the <code>texture</code> parameter is non-null.
</addendum>
<addendum>
If <code>baseViewIndex</code> is not the same for all framebuffer attachment points where the value of <code>FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</code> is not <code>NONE</code> the framebuffer is considered incomplete. Calling <code>getFramebufferStatus</code> for a framebuffer in this state returns <code>FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR</code>. Other rules for framebuffer completeness from the OVR_multiview specification also apply.
</addendum>
<addendum>
Other web APIs may expose <i>opaque multiview framebuffers</i>. Opaque multiview framebuffers are <code>WebGLFramebuffer</code> objects that act as if they have multi-view attachments, but their attachments are not exposed as textures or renderbuffers and can not be changed. Opaque multiview framebuffers may have any combination of color, depth and stencil attachments.
</addendum>
<addendum>
Calling <code>framebufferRenderbuffer</code>, <code>framebufferTexture2D</code>, <code>framebufferTextureLayer</code>, <code>framebufferTextureMultiviewWEBGL</code>, or any other call that could change framebuffer attachments with an opaque multiview framebuffer bound to <code>target</code> generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
If an opaque framebuffer is bound to <code>target</code> when calling <code>getFramebufferAttachmentParameter</code>, then <code>attachment</code> must be <code>BACK</code>, <code>DEPTH</code>, or <code>STENCIL</code>.
</addendum>
<addendum>
If an opaque framebuffer is bound to <code>target</code> when calling <code>getFramebufferAttachmentParameter</code>, then <code>pname</code> must not be <code>FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</code>.
</addendum>
<addendum>
Querying <code>FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR</code> on an opaque multiview framebuffer attachment point that has attachments must return the number of views in the opaque multiview framebuffer.
</addendum>
<addendum>
Querying <code>FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR</code> on an opaque multiview framebuffer must return 0.
</addendum>
<addendum>
Querying <code>FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</code> on an opaque multiview framebuffer must return <code>FRAMEBUFFER_DEFAULT</code>.
</addendum>
<addendum>
The number of views in an opaque multiview framebuffer may be greater than the maximum number of texture array views (the value of <code>MAX_VIEWS_OVR</code>).
</addendum>
<addendum>
Passing an opaque multiview framebuffer to <code>deleteFramebuffer</code> generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
Although the extension name is prefixed with WEBGL the extension must be enabled with the
<code>#extension GL_OVR_multiview</code> directive, as shown in the sample code, to use
the extension in a shader.
Likewise the shading language preprocessor <code>#define GL_OVR_multiview</code>, will be defined to 1 if the extension is supported.
</addendum>
<addendum>
This extension relaxes the restriction in OVR_multiview that only <code>gl_Position</code> can depend on ViewID in the vertex shader. With this change, view-dependent outputs like reflection vectors and similar are allowed.
</addendum>
<addendum>
When the number of views specified in the active program is one, <code>gl_ViewID_OVR</code> will always evaluate to zero.
</addendum>
<addendum>
When a shader written in OpenGL ES shading language version 1.00 enables or requires <code>GL_OVR_multiview</code> with an extension directive, <code>layout</code> is treated as a keyword rather than an identifier, and using a layout qualifier to specify <code>num_views</code> is allowed. Other uses of layout qualifiers are not allowed in OpenGL ES shading language 1.00.
</addendum>
<addendum>
In OpenGL ES shading language version 1.00 <code>gl_ViewID_OVR</code> has the type <code>int</code> as opposed to <code>uint</code>.
</addendum>
<addendum>
When a timer query is active and the number of views in the current draw framebuffer is greater than one, attempting to draw or calling <code>clear</code> generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
When the number of views in the current draw framebuffer is greater than one and the active program does not declare a number of views, attempting to draw generates an <code>INVALID_OPERATION</code> error.
</addendum>
</mirrors>
<features>
<feature>
Adds support for rendering into multiple views simultaneously. This is supported for opaque multiview framebuffers starting from WebGL 1.0, and 2D texture arrays starting from WebGL 2.0.
</feature>
<feature>
When a shader enables, requires, or warns <code>GL_OVR_multiview</code> with an extension directive:
<ul>
<li><code>gl_ViewID_OVR</code> is a built-in input of the type uint.</li>
</ul>
</feature>
<feature>
The GLSL macro <code>GL_OVR_multiview</code> is defined as 1.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_multiview {
const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR = 0x9630;
const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR = 0x9632;
const GLenum MAX_VIEWS_OVR = 0x9631;
const GLenum FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR = 0x9633;
void framebufferTextureMultiviewWEBGL(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, GLint baseViewIndex, GLsizei numViews);
};
</idl>
<newfun>
<function name="framebufferTextureMultiviewWEBGL" type="void">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="texture" type="GLuint"/>
<param name="level" type="GLint"/>
<param name="baseViewIndex" type="GLint"/>
<param name="numViews" type="GLsizei"/>
</function>
</newfun>
<newtok>
<function name="getParameter" type="any">
<param name="pname" type="GLenum"/>
Calling with the <code>pname</code> set to <code>MAX_VIEWS_OVR</code> returns the maximum number of views. The implementation must support at least 2 views.
<br/>
The return type depends on the parameter queried:
<table width="30%">
<tr><th>pname</th><th>returned type</th></tr>
<tr><td>MAX_VIEWS_OVR</td><td>GLint</td></tr>
</table>
</function>
</newtok>
<newtok>
<function name="getFramebufferAttachmentParameter" type="any">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="pname" type="GLenum"/>
Calling with the <code>pname</code> parameter set to <code>FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR</code> returns the number of views of the framebuffer object attachment.
Calling with the <code>pname</code> parameter set to <code>FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR</code> returns the base view index of the framebuffer object attachment.
<br/>
The return type depends on the parameter queried:
<table width="30%">
<tr><th>pname</th><th>returned type</th></tr>
<tr><td>FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR</td><td>GLsizei</td></tr>
<tr><td>FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR</td><td>GLint</td></tr>
</table>
</function>
</newtok>
<errors>
<error>
The error <code>INVALID_OPERATION</code> is generated by calling <code>framebufferTextureMultiviewWEBGL</code> with a <code>texture</code> parameter that does not identify a 2D array texture.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by calling <code>framebufferRenderbuffer</code>, <code>framebufferTexture2D</code>, <code>framebufferTextureLayer</code>, or <code>framebufferTextureMultiviewWEBGL</code> with a <code>target</code> parameter that identifies an opaque multiview framebuffer.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by calling <code>deleteFramebuffer</code> with a <code>buffer</code> parameter that identifies an opaque multiview framebuffer.
</error>
<error>
The error <code>INVALID_ENUM</code> is generated by calling <code>getFramebufferAttachmentParameter</code> with an <code>attachment</code> parameter other than <code>BACK</code>, <code>DEPTH</code> or <code>STENCIL</code> when the <code>target</code> parameter identifies an opaque multiview framebuffer.
</error>
<error>
The error <code>INVALID_ENUM</code> is generated by calling <code>getFramebufferAttachmentParameter</code> with the <code>pname</code> parameter set to <code>FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</code> when the <code>target</code> parameter identifies an opaque multiview framebuffer.
</error>
<error>
The error <code>INVALID_VALUE</code> is generated by calling <code>framebufferTextureMultiviewWEBGL</code> with a non-null <code>texture</code> in the following cases:
<ul>
<li>if <code>numViews</code> is less than one</li>
<li>if <code>numViews</code> is more than <code>MAX_VIEWS_OVR</code></li>
<li>with the parameters set so that <code>baseViewIndex</code> + <code>numViews</code> is larger than the value of <code>MAX_ARRAY_TEXTURE_LAYERS</code> minus one</li>
<li>if <code>baseViewIndex</code> is negative</li>
</ul>
</error>
<error>
The error <code>INVALID_FRAMEBUFFER_OPERATION</code> is generated by commands that read from the framebuffer such as <code>BlitFramebuffer</code>, <code>ReadPixels</code>, <code>CopyTexImage*</code>, and <code>CopyTexSubImage*</code>, if the number of views in the current read framebuffer is greater than one.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to draw if the active program declares a number of views and the number of views in the draw framebuffer does not match the number of views declared in the active program.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to draw if the number of views in the current draw framebuffer is greater than one and the active program does not declare a number of views.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to draw if the number of views in the current draw framebuffer is greater than one and transform feedback is active.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to draw or calling <code>clear</code> if the number of views in the current draw framebuffer is greater than one and a timer query is active.
</error>
</errors>
<samplecode xml:space="preserve">
<pre>
var gl = document.createElement('canvas').getContext('webgl2');
var ext = gl.getExtension('WEBGL_multiview');
var fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, fb);
var colorTex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D_ARRAY, colorTex);
gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, 512, 512, 2);
ext.framebufferTextureMultiviewWEBGL(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, colorTex, 0, 0, 2);
var depthStencilTex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D_ARRAY, depthStencilTex);
gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.DEPTH32F_STENCIL8, 512, 512, 2);
ext.framebufferTextureMultiviewWEBGL(gl.DRAW_FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, depthStencilTex, 0, 0, 2);
gl.drawElements(...); // draw will be broadcasted to the layers of colorTex and depthStencilTex.
</pre>
</samplecode>
<samplecode xml:space="preserve">
<pre>
var gl = document.createElement('canvas').getContext('webgl');
var ext = gl.getExtension('WEBGL_multiview');
// ... obtain opaque multiview framebuffer "fb" from another web API here ...
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
gl.drawElements(...); // draw will be broadcasted to the views of the opaque multiview framebuffer.
// You can not call framebufferTextureMultiviewWEBGL to change the attachments of "fb", only draw to it.
</pre>
</samplecode>
<samplecode xml:space="preserve">
<pre>
#version 300 es
#extension GL_OVR_multiview : require
precision mediump float;
layout (num_views = 2) in;
in vec4 inPos;
uniform mat4 u_viewMatrix0;
uniform mat4 u_viewMatrix1;
void main() {
if (gl_ViewID_OVR == 0u) {
gl_Position = u_viewMatrix0 * inPos;
} else {
gl_Position = u_viewMatrix1 * inPos;
}
}
</pre>
</samplecode>
<history>
<revision date="2016/11/11">
<change>Initial revision.</change>
</revision>
<revision date="2016/11/25">
<change>Specified what happens when the number of views doesn't match or if the number of views is one.</change>
</revision>
´
<revision date="2016/12/21">
<change>Specified what happens on invalid num_views declarations and if assignment to gl_Position.x is inside a larger expression.</change>
</revision>
<revision date="2017/01/12">
<change>Filled in getFramebufferAttachmentParameter and extension macro specs, formatted the documentation better, and added a simple API usage example.</change>
</revision>
<revision date="2017/03/10">
<change>Removed the core spec changes and made the specification follow the OVR_multiview specification more closely.</change>
</revision>
<revision date="2017/05/19">
<change>Introduced the concept of an opaque multiview framebuffer and fixed example code.</change>
</revision>
<revision date="2017/05/23">
<change>Made the extension compatible with WebGL 1.0 and fixed example shader code.</change>
</revision>
<revision date="2017/07/21">
<change>Specified some errors to be generated at draw time and made the extension compatible with emscripten.</change>
</revision>
<revision date="2017/08/08">
<change>Rolled back shader restrictions.</change>
</revision>
<revision date="2017/08/17">
<change>Required a multiview program to draw to a multiview framebuffer.</change>
</revision>
<revision date="2017/10/26">
<change>Took changes in the native OVR_multiview specification into account, added a more elaborate example including a depth/stencil texture, and an explicit mention that texture arrays are only supported in WebGL 2.0.</change>
</revision>
<revision date="2018/01/03">
<change>Moved to draft status.</change>
</revision>
</history>
</draft>

Просмотреть файл

@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<draft href="WEBGL_security_sensitive_resources/">
<name>WEBGL_security_sensitive_resources</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Max Vujovic (mvujovic 'at' adobe.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>23</number>
<depends>
<api version="1.0"/>
<ext name="EXT_frag_depth"/>
<ext name="WEBGL_draw_buffers"/>
<ext name="WEBGL_shared_resources"/>
</depends>
<overview>
<p>In the <a href="../../../specs/1.0/">WebGL API 1.0</a> specification, section <a href="../../../specs/1.0/#4.2">4.2 Origin Restrictions</a> restricts the following sources for texture upload:</p>
<p>
<ul>
<li>An image or video element whose origin is not the same as the origin of the <code>Document</code> that contains the <code>WebGLRenderingContext</code>'s canvas element.</li>
<li>A canvas element whose <i>origin-clean</i> flag is set to false.</li>
</ul>
</p>
<p>This extension allows these sources for texture uploads, with some restrictions regarding their uploading and use.</p>
<div class="nonnormative">
<p>Motivation:</p>
<p>This extension enables the processing of cross-origin resources in WebGL. Additionally, it defines a foundation of concepts that can be used in future extensions to process other types of security sensitive content, including arbitrary HTML content.</p>
<p>For an example of security sensitive content, consider the rendering of an HTML link. The color of the link can indicate its visited or unvisited state. Third parties must not be able to access or infer this information.</p>
<p>Specifically, third parties must not be able read the pixel data of security sensitive content through WebGL or other APIs. Additionally, third parties must not be able to divulge or approximate the pixel data of security sensitive content by timing WebGL operations.</p>
<p>Prior to this extension, WebGL restricted the upload of security sensitive content as a texture for graphical processing. This extension enables the uploading and processing of security sensitive content, with some restrictions. Note that this extension imposes no restrictions on the processing of regular, non-security sensitive content.</p>
<p>To secure a users privacy, a WebGL implementation must not leak information about the contents of security sensitive textures through the execution time of its commands. To achieve this, no part of the underlying graphics pipeline may vary in execution time based on the contents of a security sensitive texture. For example, primitive assembly and depth testing must not vary based on the contents of a security sensitive texture.</p>
<p>The vertex shading and fragment shading stages of the graphics pipeline require particular restrictions to keep their execution time independent of the contents of security sensitive textures. Specifically, the contents of a security sensitive texture must only appear in constant-time GLSL operations. A constant-time GLSL operation is an operation whose execution time does not vary based on the values of its operands. This extension will describe how a WebGL implementation can enforce this requirement.</p>
<p>Additionally, this extension attempts to identify non-constant-time GLSL operations. All other GLSL operations are assumed to be constant time in both the WebGL implementation and the underlying GPU implementation. If this assumption is false on a particular implementation, then this extension must be disabled for that implementation. In the future, GPU vendors may be able to provide a mechanism to guarantee that the assumed GLSL operations are in fact constant-time.</p>
</div>
<h3>Definitions</h3>
<p>This extension relies on the definition of several constructs in GLSL. These constructs are determined statically, after preprocessing.</p>
<h4>Regular Sampler Variables and Secure Sampler Variables</h4>
<p><code>S</code> is a regular sampler if an expression dependent on <code>S</code> appears in one or more of the following constructs:</p>
<p>
<ul>
<li><code>if</code> statement condition</li>
<li>selection operator (<code>?</code>) condition</li>
<li>loop condition</li>
<li>logical and operator (<code>&amp;&amp;</code>)</li>
<li>logical or operator (<code>||</code>)</li>
<li><code>coord</code>, <code>bias</code>, or <code>lod</code> argument in a texture lookup function call</li>
<li>assignment to <code>gl_Position</code></li>
<li>assignment to <code>gl_FragDepth</code></li>
</ul>
</p>
<p>Otherwise, <code>S</code> is a secure sampler.</p>
<h4>Sampler-Dependent Expressions</h4>
<p>An expression is dependent on the sampler <code>S</code> if:</p>
<p>
<ul>
<li>It contains a texture lookup function call with <code>S</code> as the <code>sampler</code> argument.</li>
<li>It contains an expression that is dependent on the sampler <code>S</code>.</li>
<li>It contains a variable that is dependent on the sampler <code>S</code>.</li>
</ul>
</p>
<h4>Sampler-Dependent Variables</h4>
<p>A variable is dependent on the sampler <code>S</code> if:</p>
<p>
<ul>
<li>It is assigned to an expression dependent on the sampler <code>S</code>. (e.g. If <code>a = b</code> and <code>b</code> is dependent on sampler <code>S</code>, then <code>a</code> is dependent on sampler <code>S</code>.)</li>
<li>It is addressed using a sampler-dependent expression in an assignment. (e.g. If <code>a[b] = c</code> and <code>b</code> is dependent on the sampler <code>S</code>, then <code>a</code> is dependent on sampler <code>S</code>.)</li>
<li>It is a fragment shader varying and the corresponding vertex shader varying is dependent on the sampler <code>S</code>.</li>
</ul>
</p>
<div class="nonnormative">
A WebGL implementation can create a dependency graph in its GLSL compiler to implement these GLSL constructs. One closely related implementation is described in a <a href="http://code.google.com/p/mvujovic/wiki/ShaderControlFlowAnalysis">wiki page</a>.
</div>
<h3>Features</h3>
<features>
<feature>The <code>WebGLRenderingContext</code>'s canvas's <i>origin-clean</i> flag is set to false if the context is created with a <code>WebGLContextAttributes</code> dictionary with <code>securitySensitiveDrawingBuffer</code> set to true.</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_security_sensitive_resources {
WebGLFramebuffer? createSecuritySensitiveFramebuffer();
WebGLTexture? createSecuritySensitiveTexture();
};
dictionary WebGLContextAttributes {
GLboolean securitySensitiveDrawingBuffer = false;
};
</idl>
<newfun>
<function name="createSecuritySensitiveFramebuffer" type="WebGLFramebuffer?">Behaves like <code>createFramebuffer</code>, except framebuffers created with this function are referred to as security sensitive framebuffers. Framebuffers created with <code>createFramebuffer</code> are referred to as regular framebuffers.</function>
<function name="createSecuritySensitiveTexture" type="WebGLTexture?">Behaves like <code>createTexture</code>, except textures created with this function are known as security sensitive textures. Textures created with <code>createTexture</code> are known as regular textures.</function>
</newfun>
<errors>
<error>
<div class="nonnormative">
<p>In summary, an author cannot:</p>
<ul>
<li>draw a security sensitive resource into a regular resource,</li>
<li>copy from a security sensitive resource into a regular resource,</li>
<li>read a security sensitive resource using <code>readPixels</code>,</li>
<li>use a security sensitive resource for depth testing or stencil testing,</li>
<li>share security sensitive resources with a context that cannot recognize them as security sensitive,</li>
<li>use a security sensitive resource to influence geometry, since this can affect the depth buffer.</li>
</ul>
</div>
<p>The error <code>INVALID_OPERATION</code> is generated in the following situations:</p>
<ul>
<li><code>drawArrays</code> or <code>drawElements</code> is called and a security sensitive texture is bound to a regular sampler.</li>
<li>
<p><code>drawArrays</code> or <code>drawElements</code> is called and:</p>
<ul>
<li>a security sensitive texture is bound to a secure sampler,</li>
<li>a color output variable <code>gl_FragColor</code> or <code>gl_FragData[i]</code> is dependent on the secure sampler,</li>
<li>
<p>the output variable writes to either:</p>
<ul>
<li>a regular texture,</li>
<li>a regular renderbuffer,</li>
<li>the default framebuffer with <code>securitySensitiveDrawingBuffer</code> set to false in the <code>WebGLContextAttributes</code> dictionary used to create the context.</li>
</ul>
</li>
</ul>
</li>
<li>
<p><code>copyTexImage2D</code> or <code>copyTexSubImage2D</code> is called and:</p>
<ul>
<li>the default framebuffer is bound,</li>
<li><code>securitySensitiveDrawingBuffer</code> was set to true in the <code>WebGLContextAttributes</code> dictionary used to create the context.</li>
<li>a regular texture is bound as the destination.</li>
</ul>
</li>
<li>
<p><code>copyTexImage2D</code> or <code>copyTexSubImage2D</code> is called and:</p>
<ul>
<li>a security sensitive renderbuffer is selected as the source,</li>
<li>a regular texture is bound as the destination.</li>
</ul>
</li>
<li>
<p><code>readPixels</code> is called and:</p>
<ul>
<li>the default framebuffer is bound,</li>
<li><code>securitySensitiveDrawingBuffer</code> was set to true in the <code>WebGLContextAttributes</code> dictionary used to create the context.</li>
</ul>
</li>
<li><code>readPixels</code> is called and a security sensitive renderbuffer is selected as the source.</li>
<li>
<p><code>framebufferRenderbuffer</code> is called and:</p>
<ul>
<li><code>attachment</code> is <code>DEPTH_ATTACHMENT</code>, <code>STENCIL_ATTACHMENT</code>, or <code>DEPTH_STENCIL_ATTACHMENT</code>,</li>
<li><code>renderbuffer</code> is a security sensitive renderbuffer.</li>
</ul>
</li>
<li>
<p><code>acquireSharedResource</code> is called and:</p>
<ul>
<li><code>resource</code> is a security sensitive texture or a security sensitive renderbuffer,</li>
<li>the context acquiring the resource does not have this extension enabled.</li>
</ul>
</li>
</ul>
</error>
</errors>
<issues>
<ul>
<li>
<div>Q: Why not mark textures and renderbuffers as security sensitive automatically in the WebGL implementation instead of exposing <code>createSecuritySensitive*</code> to the API consumer?</div>
<div>A: This approach could make it difficult for API consumers to determine what operation caused a resource to become security sensitive because a related error could occur much later.</div>
</li>
</ul>
</issues>
<history>
<revision date="2013/09/13">
<change>Initial revision.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
</history>
</draft>

Просмотреть файл

@ -0,0 +1,374 @@
<?xml version="1.0"?>
<draft href="WEBGL_shared_resources/">
<name>WEBGL_shared_resources</name>
<contact>
<a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org)
</contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>22</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension exposes the ability to share WebGL resources with multiple WebGLRenderingContexts.
</p>
<p>
Background:
</p>
<p>
The OpenGL ES spec defines that you can share a resource (texture, buffer, shader, program,
renderbuffer) with 2 or more GL contexts but with some caveats. To guarantee you'll see a
change made in one context in other context requires calling glFinish on the context that
made the change and call glBind on the context that wants to see the change.
</p>
<p>
Not calling glFinish and/or glBind does not guarantee you won't see the results which means
that users may do neither and their app might just happen to work on some platforms and
mysteriously have glitches, rendering corruption, gl errors or program failure on others.
</p>
<p>
WebGL must present consistent behavior for sharing and so this extension provides
an API so that implementions can enforce and optimize these requirements.
</p>
<features>
<feature>
<p>Adds a new context creation parameter:</p>
<dl>
<dt><span class="prop-value">shareGroup</span></dt>
<dd>
<em>Default: undefined</em>. If the value is set to the <code>group</code>
attribute from the <code>WEBGL_shared_resources</code> object from an existing context
then resources from the existing context are shared with the newly created context.
</dd>
</dl>
<pre class="example">
var canvas1 = document.createElement("canvas");
var canvas2 = document.createElement("canvas");
var ctx1 = canvas1.getContext("webgl");
var sharedResourcesExtension = ctx1.getExtension("WEBGL_shared_resources");
var ctx2 = canvas2.getContext("webgl", {
shareGroup: sharedResourcesExtension.group
});
</pre>
</feature>
<feature>
<p>
In order for a context to use a resouce it must first acquire it.
Contexts can make a request to acquire a resource by calling acquireSharedResource
in one of 2 modes, EXCLUSIVE or READ_ONLY. A resource may be acquired by multiple
contexts in READ_ONLY mode. The resource may only be acquired by one context
if the mode is EXCLUSIVE. acquireSharedResource returns an id you can use to cancel the acquire
by calling cancelAcquireSharedResource.
When the resource is available in the requested mode the callback
will be invoked. Resources start their life as acquired in EXCLUSIVE mode in the context
in which they are created.
</p>
<p>
To release a resource so it may be acquired by another context call releaseSharedResource and
pass it the resource to be released.
</p>
</feature>
<feature>
<p>
After a resource is acquired it must be bound before it is used. Binding
means for buffers calling bindBuffer, for textures either bindTexture or
framebufferTexture2D, for renderbuffers either bindRenderbuffer or framebufferRenderbuffer,
for shaders attachShader, for programs useProgram. Binding once is sufficient to satisfy
this requirement. In other words, if you have a texture attached to more than one texture
unit the texture only needs to be re-bound to 1 texture unit. Attemping to use a resource
which has not been bound since it was acquired generates INVALID_OPERATION.
</p>
<p>
Bind Requirement Algorithm:
</p>
<p>
Each resource has a per-context bound flag. When a resource is acquired in a context its
bound flag for that context is set to false. If one of the functions listed above
is called the bound flag for that context is set to true. Drawing and reading functions,
clear, drawArrays, drawElements, readPixels, that would access a resource whose bound flag
for that context is false generate INVALID_FRAMEBUFFER_OPERATION. All other functions that
use a resource whose bound flag for that context is false generate INVALID_OPERATION.
</p>
<p>
Note: In the specific case of programs, it is not an error to call draw with a program
or call useProgram for a program which has shaders that have
been acquired but not re-attached. Nor it is an error to draw with or call useProgram
for a program which has shaders that have not been acquired. It is an error to call linkProgram
for a program that is using shaders that have been acquired but not re-attached.
</p>
</feature>
<feature>
<p>
When an attempt is made to use a resource that is not acquired in the current context
the implementation must generate the error INVALID_OPERATION or INVALID_FRAMEBUFFER_OPRATION.
This includes all gl calls
that would access the given resource directly or indirectly. For example, a
draw call must fail if any of the resources it would access is not acquired in the
correct mode for the call. In other words, if the draw call would read from a buffer
or texture and that buffer or texture is not acquired for READ_ONLY or EXCLUSIVE mode the draw
must fail with INVALID_FRAMEBUFFER_OPERATION. If the draw would render to a texture or renderbuffer
that is not acquired for EXCLUSIVE mode the draw must fail and generate INVALID_FRAMEBUFFER_OPERATION.
If a program used in the draw is not acquired for READ_ONLY or EXCLUSIVE mode the draw or clear must fail
and generate INVALID_FRAMEBUFFER_OPERATION.
</p>
<p>
For buffers not acquired this includes but is not limited to
</p>
<pre>
bindBuffer
bufferData
bufferSubData
deleteBuffer
drawArrays
drawElements
getParameter with parameter (BUFFER_SIZE or BUFFER_USAGE)
isBuffer
vertexAttribPointer
</pre>
<p>
For a buffer acquired in READ_ONLY mode this includes but is not limited to
</p>
<pre>
bufferData
bufferSubData
</pre>
<p>
For programs not acquired this includes but is not limited to
</p>
<pre>
attachShader
bindAttribLocation
drawArrays
drawElements
deleteProgram
getActiveAttrib
getActiveUniform
getAttribLocation
getUniformLocation
getProgramParameter
getProgramInfoLog
isProgram
linkProgram
useProgram
validateProgram
</pre>
<p>
For programs acquired in READ_ONLY mode includes but is not limited to
</p>
<pre>
bindAttribLocation
deleteProgram
linkProgram
</pre>
<p>
For renderbuffers not acquired this includes but is not limited to
</p>
<pre>
bindRenderbuffer
clear
deleteRenderbuffer
drawArrays
drawElements
framebufferRenderbuffer
isRenderbuffer
renderbufferStorage
</pre>
<p>
For renderbuffers acquired in READ_ONLY mode this includes
</p>
<pre>
clear
deleteRenderbuffer
drawArrays
drawElements
renderbufferStorage
</pre>
<p>
For shaders not acquired this includes but is not limited to
</p>
<pre>
attachShader
compileShader
deleteShader
getShaderSource
getShaderParameter
isShader
shaderSource
</pre>
<p>
For shaders acquired in READ_ONLY mode this includes but is not limited to
</p>
<pre>
deleteShader
compileShader
shaderSource
</pre>
<p>
For textures not acquired this includes but is not limited to
</p>
<pre>
bindTexture
clear
compressedTexImage2D
compressedTexSubImage2D
copyTexImage2D
copyTexSubImage2D
drawArrays
drawElements
deleteTexture
framebufferTexture2D
getTexParameter
isTexture
texImage2D
texParameter
texSubImage2D
</pre>
<p>
For textures acquired in READ_ONLY mode this includes but is not limited to
</p>
<pre>
clear
compressedTexImage2D
compressedTexSubImage2D
copyTexImage2D
copyTexSubImage2D
drawArrays
drawElements
deleteTexture
texImage2D
texParameter
texSubImage2D
</pre>
<p>
The term "not limited to" is intended to point out that extension may enable
other functions to which these rule should apply. For example drawArraysInstancedANGLE
must follow the same rules as drawArrays.
</p>
</feature>
<feature>
<p>
Calling checkFramebufferStatus with the argument FRAMEBUFFER or DRAW_FRAMEBUFFER must
return FRAMEBUFFER_INCOMPLETE_ATTACHMENT if any of the resources referenced by the currently
bound framebuffer are not acquired for EXCLUSIVE access.
Calling checkFramebufferStatus with the argument READ_FRAMEBUFFER will return
FRAMEBUFFER_INCOMPLETE_ATTACHMENT if any of the resources referenced by the currently bound
framebuffer are not acquired for EXCLUSIVE or READ_ONLY access.
</p>
<p>
Note: This extension exposes the constants READ_FRAMEBUFFER and DRAW_FRAMEBUFFER only for
the purpose of calling checkFramebufferStatus. In particular, this extension does not enable
calling bindFramebuffer with either constant.
</p>
</feature>
<feature>
<p>
A context that is deleted automatically releases all resources it has acquired. Note that
currently there is no way to explicitly delete a context. Contexts are deleted through
garbage collection.
</p>
</feature>
<feature>
<p>
Note that implementing this extension changes the base class of the sharable resources.
Specifically: WebGLBuffer, WebGLProgram, WebGLRenderbuffer, WebGLShader, and WebGLTexture
change their base class from WebGLObject to WebGLSharedObject.
</p>
</feature>
</features>
</overview>
<issues>
<ul>
<li>
<div>
Q: What happens if one context deletes a resource another context is attempting to acquire?
</div>
<div>
A: Nothing special. The acquire will succeed when the context that currently has the resource
releases it. The context that acquires the resource can use the WebGLSharedObject
(buffer, texture, etc...) and will get the normal WebGL behavior associated with using
a deleted resource.
</div>
</li>
<li>
<div>
Q: Can you attach a resources that you have not acquired to a container?
</div>
<div>
A: No. An attachment can remain attached while it is released but it must be acquired
when attaching.
In particular a framebuffer attachment may not be attached to a framebuffer unless
the attachment is acquired. A shader may not be attached to a program unless the
shader is acquired. A buffer may not be attached to an attibute, vertexAttribPointer,
unless the buffer is acquired.
</div>
</li>
<li>
<div>
Q: What happens if you try to acquire a resource you already have acquired?
</div>
<div>
A: It will generate INVALID_OPERATION
</div>
</li>
</ul>
</issues>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_shared_resources {
const GLenum READ_ONLY = 0x0001;
const GLenum EXCLUSIVE = 0x0004;
const GLenum READ_FRAMEBUFFER = 0x8CA8;
const GLenum DRAW_FRAMEBUFFER = 0x8CA9;
readonly attribute WebGLShareGroup group;
long acquireSharedResource(
WebGLSharedObject resource,
GLenum mode,
AcquireResourcesCallback callback);
void releaseSharedResource(
WebGLSharedObject resource);
void cancelAcquireSharedResource(long id);
};
callback AcquireSharedResourcesCallback = void ();
[NoInterfaceObject]
interface WebGLShareGroup {
}
interface WebGLSharedObject : WebGLObject {
}
interface WebGLBuffer : WebGLSharedObject {
}
interface WebGLProgram : WebGLSharedObject {
}
interface WebGLRenderbuffer : WebGLSharedObject {
}
interface WebGLShader : WebGLSharedObject {
}
interface WebGLTexture : WebGLSharedObject {
}
</idl>
<history>
<revision date="2012/02/06">
<change>Initial revision.</change>
</revision>
<revision date="2013/05/14">
<change>Moved to draft after agreement in working group.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute to extension interface and WebGLShareGroup.</change>
</revision>
</history>
</draft>

Просмотреть файл

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vi:set sw=2 ts=4: -->
<?xml-stylesheet href="../../extension.xsl" type="text/xsl"?>
<proposal href="proposals/EXT_clip_cull_distance/">
<name>EXT_clip_cull_distance</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>XYZ</number>
<depends>
<api version="2.0"/>
</depends>
<overview>
<mirrors href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_clip_cull_distance.txt"
name="EXT_clip_cull_distance">
</mirrors>
<features>
<feature>
Adds support for hardware clip planes and cull distances to OpenGL ES.
</feature>
<glsl extname="GL_EXT_clip_cull_distance">
<stage type="vertex"/>
<output name="gl_ClipDistance" type="highp float" suffix="[]"/>
<output name="gl_CullDistance" type="highp float" suffix="[]"/>
<stage type="fragment"/>
<input name="gl_ClipDistance" type="highp float" suffix="[]"/>
<input name="gl_CullDistance" type="highp float" suffix="[]"/>
</glsl>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface EXT_clip_cull_distance {
const GLenum MAX_CLIP_DISTANCES_EXT = 0x0D32;
const GLenum MAX_CULL_DISTANCES_EXT = 0x82F9;
const GLenum MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT = 0x82FA;
const GLenum CLIP_DISTANCE0_EXT = 0x3000;
const GLenum CLIP_DISTANCE1_EXT = 0x3001;
const GLenum CLIP_DISTANCE2_EXT = 0x3002;
const GLenum CLIP_DISTANCE3_EXT = 0x3003;
const GLenum CLIP_DISTANCE4_EXT = 0x3004;
const GLenum CLIP_DISTANCE5_EXT = 0x3005;
const GLenum CLIP_DISTANCE6_EXT = 0x3006;
const GLenum CLIP_DISTANCE7_EXT = 0x3007;
};
</idl>
<samplecode xml:space="preserve">
<pre>
#extension GL_EXT_clip_cull_distance : enable
// Vertex shader
out highp float gl_ClipDistance[2];
out highp float gl_CullDistance[2];
void main(){
// Compute the clip and cull distances for this vertex
gl_ClipDistance[0] = ...;
gl_CullDistance[0] = ...;
gl_ClipDistance[1] = ...;
gl_CullDistance[1] = ...;
}
</pre>
</samplecode>
<history>
<revision date="2016/08/22">
<change>Initial revision.</change>
</revision>
</history>
</proposal>

Просмотреть файл

@ -0,0 +1,359 @@
<?xml version="1.0" encoding="UTF-8"?>
<proposal href="proposals/WEBGL_debug/">
<name>WEBGL_debug</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Emmanuel Gil Peyrot, Collabora Ltd.</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
</depends>
<overview id="overview">
<p>
This extension allows the GL to notify applications when various events
occur that may be useful during application development, debugging and
profiling.
</p>
<mirrors href="https://www.opengl.org/registry/specs/KHR/debug.txt"
name="KHR_debug">
<addendum>
References to debug contexts are deleted.
</addendum>
<addendum>
References to the debug message log and callback are deleted, replaced
with DOM events.
</addendum>
<addendum>
The <code>ObjectPtrLabel</code> and <code>GetObjectPtrLabel</code>
functions are replaced with <code>ObjectLabel</code> and
<code>GetObjectLabel</code>.
</addendum>
<addendum>
The <code>count</code> and <code>ids</code> arguments of
<code>DebugMessageControl</code> are replaced with a
<code>sequence&lt;GLuint&gt; ids</code> argument.
</addendum>
<addendum>
The <code>length</code> and <code>buf</code> arguments of
<code>DebugMessageInsert</code> and <code>PushDebugGroup</code> are
replaced with a <code>DOMString message</code> argument.
</addendum>
<addendum>
The <code>identifier</code> and <code>name</code> arguments of
<code>ObjectLabel</code> and <code>GetObjectLabel</code> are replaced
with a <code>WebGLObject object</code> argument.
</addendum>
<addendum>
The <code>length</code> and <code>label</code> arguments of
<code>ObjectLabel</code> are replaced with a <code>DOMString
label</code> argument.
</addendum>
<addendum>
The <code>bufSize</code>, <code>length</code> and <code>label</code>
arguments of <code>GetObjectLabel</code> are replaced with a
<code>DOMString</code> return type.
</addendum>
<addendum>
As per the usual WebGL binding rules, functions dont keep the KHR
suffix they have in the GLES version, but tokens do.
</addendum>
</mirrors>
<features>
<feature>
The <code>WEBGL_debug</code> extension object is a DOM
<code>EventTarget</code>, obeying the rules of the <a
href="http://www.w3.org/TR/DOM-Level-3-Events/">DOM Level 3 Events</a>,
with a new <code>WebGLDebugMessage</code> event that gets fired
whenever the driver, browser or application emits a debug message.
</feature>
<feature>
<code>debugMessageInsertKHR</code> is exposed to allow the application
to insert debug messages into the WebGL stream.
</feature>
<feature>
<code>objectLabelKHR</code> and <code>getObjectLabelKHR</code> are
exposed, to assign a label to a <code>WebGLObject</code> and retrieve
it.
</feature>
<feature>
<code>pushDebugGroupKHR</code> and <code>popDebugGroupKHR</code> make
it possible to group a list of WebGL calls together.
</feature>
<feature>
<code>debugMessageControlKHR</code> allows the application to enable
and disable the debug messages which emit a
<code>WebGLDebugMessage</code> event. This state is part of the debug
group they are part of, and gets poped on
<code>popDebugGroupKHR</code>.
</feature>
</features>
</overview>
<idl xml:space="preserve"><![CDATA[
[NoInterfaceObject]
interface WEBGL_debug : EventTarget {
const GLenum MAX_DEBUG_MESSAGE_LENGTH_KHR = 0x9143;
const GLenum MAX_DEBUG_GROUP_STACK_DEPTH_KHR = 0x826C;
const GLenum DEBUG_GROUP_STACK_DEPTH_KHR = 0x826D;
const GLenum MAX_LABEL_LENGTH_KHR = 0x82E8;
const GLenum DEBUG_SOURCE_API_KHR = 0x8246;
const GLenum DEBUG_SOURCE_WINDOW_SYSTEM_KHR = 0x8247;
const GLenum DEBUG_SOURCE_SHADER_COMPILER_KHR = 0x8248;
const GLenum DEBUG_SOURCE_THIRD_PARTY_KHR = 0x8249;
const GLenum DEBUG_SOURCE_APPLICATION_KHR = 0x824A;
const GLenum DEBUG_SOURCE_OTHER_KHR = 0x824B;
const GLenum DEBUG_TYPE_ERROR_KHR = 0x824C;
const GLenum DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR = 0x824D;
const GLenum DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR = 0x824E;
const GLenum DEBUG_TYPE_PORTABILITY_KHR = 0x824F;
const GLenum DEBUG_TYPE_PERFORMANCE_KHR = 0x8250;
const GLenum DEBUG_TYPE_OTHER_KHR = 0x8251;
const GLenum DEBUG_TYPE_MARKER_KHR = 0x8268;
const GLenum DEBUG_TYPE_PUSH_GROUP_KHR = 0x8269;
const GLenum DEBUG_TYPE_POP_GROUP_KHR = 0x826A;
const GLenum DEBUG_SEVERITY_HIGH_KHR = 0x9146;
const GLenum DEBUG_SEVERITY_MEDIUM_KHR = 0x9147;
const GLenum DEBUG_SEVERITY_LOW_KHR = 0x9148;
const GLenum DEBUG_SEVERITY_NOTIFICATION_KHR = 0x826B;
const GLenum STACK_UNDERFLOW_KHR = 0x0504;
const GLenum STACK_OVERFLOW_KHR = 0x0503;
void debugMessageControlKHR(GLenum source, GLenum type, GLenum severity, sequence<GLuint> ids, boolean enabled);
void debugMessageInsertKHR(GLenum source, GLenum type, GLuint id, GLenum severity, DOMString buf);
void pushDebugGroupKHR(GLenum source, GLuint id, DOMString message);
void popDebugGroupKHR();
void objectLabelKHR(WebGLObject? object, DOMString label);
DOMString getObjectLabelKHR(WebGLObject? object);
}; // interface WEBGL_debug
[NoInterfaceObject]
interface WebGLDebugMessage : Event {
readonly attribute GLenum source;
readonly attribute GLenum type;
readonly attribute GLuint id;
readonly attribute GLenum severity;
readonly attribute DOMString message;
}; // interface WebGLDebugMessage
]]></idl>
<newfun>
<p>On <code>WEBGL_debug</code>:</p>
<function name="debugMessageControlKHR" type="void">
<param name="source" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="severity" type="GLenum"/>
<param name="ids" type="sequence&lt;GLuint&gt;"/>
<param name="enabled" type="boolean"/>
Enables or disables the reporting of <code>WebGLDebugMessage</code>
events for the specified messages.
</function>
<function name="debugMessageInsertKHR" type="void">
<param name="source" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="id" type="GLuint"/>
<param name="severity" type="GLenum"/>
<param name="message" type="DOMString"/>
Inserts a custom message into the debug log.
</function>
<function name="pushDebugGroupKHR" type="void">
<param name="source" type="GLenum"/>
<param name="id" type="GLuint"/>
<param name="message" type="DOMString"/>
Pushes a debug group on the stack.
</function>
<function name="popDebugGroupKHR" type="void">
Closes a group opened with <code>pushDebugGroupKHR</code>.
</function>
<function name="objectLabelKHR" type="void">
<param name="object" type="WebGLObject?"/>
<param name="label" type="DOMString"/>
Assigns a label to a <code>WebGLObject</code>.
</function>
<function name="getObjectLabelKHR" type="DOMString">
<param name="object" type="WebGLObject?"/>
Retrieves the label associated with a <code>WebGLObject</code>.
</function>
<function name="addEventListener" type="void">
<param name="type" type="DOMString"/>
<param name="listener" type="EventListener"/>
Register an event handler of a specific event type on the EventTarget.
</function>
<function name="removeEventListener" type="void">
<param name="type" type="DOMString"/>
<param name="listener" type="EventListener"/>
Removes an event listener from the EventTarget.
</function>
<function name="dispatchEvent" type="boolean">
<param name="event" type="Event"/>
Dispatch an event to this EventTarget.
</function>
</newfun>
<samplecode><div class="example">
Common initialization of the extension, with an example of debug message
reporting.
<pre xml:space="preserve"><![CDATA[
function init(gl) {
...
var ext = gl.getExtension('WEBGL_debug');
ext.addEventListener('message', function(evt) {
console.log(evt.source, evt.type, evt.id, evt.severity, evt.message);
});
...
}]]></pre></div></samplecode>
<samplecode><div class="example">
Skip a section of the code.
<pre xml:space="preserve"><![CDATA[
function draw(gl, ext) {
...
// Setup of the default active debug group: Filter everything in
ext.debugMessageControlKHR(gl.DONT_CARE, gl.DONT_CARE, gl.DONT_CARE, [], true);
// Generate a debug marker debug output message
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_MARKER_KHR, 100,
ext.DEBUG_SEVERITY_NOTIFICATION_KHR,
"Message 1");
// Push debug group 1
ext.pushDebugGroupKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
1,
"Message 2");
// Setup of the debug group 1: Filter everything out
ext.debugMessageControlKHR(gl.DONT_CARE, gl.DONT_CARE, gl.DONT_CARE, [], false);
// This message won't appear in the debug output log of
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_MARKER_KHR, 100,
ext.DEBUG_SEVERITY_NOTIFICATION_KHR,
"Message 3");
// Pop debug group 1, restore the volume control of the default debug group.
ext.popDebugGroupKHR();
// Generate a debug marker debug output message
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_MARKER_KHR, 100,
ext.DEBUG_SEVERITY_NOTIFICATION_KHR,
"Message 5");
...
// Expected debug output in the JS console:
// Message 1
// Message 2
// Message 2
// Message 5
}]]></pre></div></samplecode>
<samplecode><div class="example">
Only output a subsection of the code and disable some messages for the
entire application.
<pre xml:space="preserve"><![CDATA[
function draw(gl, ext) {
...
// Setup the control of the debug output for the default debug group
ext.debugMessageControlKHR(
gl.DONT_CARE, gl.DONT_CARE, gl.DONT_CARE, [], false);
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_THIRD_PARTY_KHR, gl.DONT_CARE, gl.DONT_CARE, [], false);
var messages = [1234, 2345, 3456, 4567];
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, gl.DEBUG_TYPE_OTHER, gl.DONT_CARE,
messages, false);
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, ext.DEBUG_TYPE_PORTABILITY_KHR, gl.DONT_CARE,
messages, false);
// Push debug group 1
// Inherit the default debug group debug output volume control
// Filtered out by ext.debugMessageControlKHR
ext.pushDebugGroupKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
1,
"Message 1");
// In this section of the code, we are interested in performances.
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, ext.DEBUG_TYPE_PERFORMANCE_KHR, gl.DONT_CARE, [], true);
// But we already identify that some messages are not really useful for us.
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, ext.DEBUG_TYPE_OTHER_KHR, gl.DONT_CARE,
[5678, 6789], false);
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_PERFORMANCE_KHR, 1357,
ext.DEBUG_SEVERITY_MEDIUM_KHR,
"Message 2");
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_THIRD_PARTY_KHR, // We still filter out these messages.
ext.DEBUG_TYPE_OTHER_KHR, 3579,
ext.DEBUG_SEVERITY_MEDIUM_KHR,
"Message 3");
ext.popDebugGroupKHR();
...
// Expected debug output in the JS console:
// Message 2
}]]></pre></div></samplecode>
<history>
<revision date="2015/09/18">
<change>Initial revision.</change>
</revision>
</history>
</proposal>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<proposal href="proposals/WEBGL_subarray_uploads/">
<name>WEBGL_subarray_uploads</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Jeff Gilbert (jgilbert 'at' mozilla.com)</contributor>
</contributors>
<number>k</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<features>
<feature>
Though no-copy slicing of TypedArrays is already possible, it can still generate
considerable garbage, incuring GC load. Allowing for specification of subarray
offset and size can eliminate this source of garbage.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_subarray_uploads {
void bufferSubData(GLenum target, GLsizeiptr bufferOffset, GLsizeiptr subarrayOffset,
GLsizeiptr subarraySize, (ArrayBuffer or SharedArrayBuffer) data);
void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum sizedFormat,
GLsizeiptr subarrayOffset, GLsizeiptr subarraySize,
(ArrayBuffer or SharedArrayBuffer) data);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format, GLenum type,
GLsizeiptr subarrayOffset, GLsizeiptr subarraySize,
(ArrayBuffer or SharedArrayBuffer) data);
};
</idl>
<newfun>
<function name="bufferSubData" type="void">
<param name="target" type="GLenum"/>
<param name="bufferOffset" type="GLsizeiptr"/>
<param name="subarrayOffset" type="GLsizeiptr"/>
<param name="subarraySize" type="GLsizeiptr"/>
<param name="data" type="ArrayBuffer or SharedArrayBuffer"/>
Upload data from a subarray of an ArrayBuffer or SharedArrayBuffer.
</function>
<function name="compressedTexSubImage2D" type="void">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="sizedFormat" type="GLenum"/>
<param name="subarrayOffset" type="GLsizeiptr"/>
<param name="subarraySize" type="GLsizeiptr"/>
<param name="data" type="ArrayBuffer or SharedArrayBuffer"/>
Upload data from a subarray of an ArrayBuffer or SharedArrayBuffer.
</function>
<function name="texSubImage2D" type="void">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="subarrayOffset" type="GLsizeiptr"/>
<param name="subarraySize" type="GLsizeiptr"/>
<param name="data" type="ArrayBuffer or SharedArrayBuffer"/>
Upload data from a subarray of an ArrayBuffer or SharedArrayBuffer.
</function>
</newfun>
<history>
<revision date="2016/06/07">
<change>Initial revision</change>
</revision>
</history>
</proposal>

Просмотреть файл

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vi:set sw=2 ts=4: -->
<?xml-stylesheet href="../../extension.xsl" type="text/xsl"?>
<proposal href="proposals/WEBGL_texture_multisample/">
<name>WEBGL_texture_multisample</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Jeff Gilbert, Mozilla</contributor>
</contributors>
<number>XYZ</number>
<depends>
<api version="2.0"/>
</depends>
<overview>
<features>
<feature>
Adds <code>texStorage2DMultisample()</code> and the <code>TEXTURE_2D_MULTISAMPLE</code>
target from OpenGL ES 3.1.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_texture_storage_multisample {
const GLenum TEXTURE_2D_MULTISAMPLE = 0x9100;
void texStorage2DMultisample(GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLboolean fixedsamplelocations);
};
</idl>
<history>
<revision date="2017/12/18">
<change>Initial revision.</change>
</revision>
</history>
</proposal>

Просмотреть файл

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vi:set sw=2 ts=4: -->
<?xml-stylesheet href="../../extension.xsl" type="text/xsl"?>
<proposal href="proposals/WEBGL_texture_source_iframe/">
<name>WEBGL_texture_source_iframe</name>
<contact><a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Zhenyao Mo, Google Inc</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
<api version="2.0"/>
</depends>
<overview>
<p>This extension enables WebGL implementations to bind an HTMLIFrameElement object as the data source
to a texture. While bound, the extension provides an API to allow applications to request the latest
iframe rendering results to be blitted to the texture. The extension also provides an API to allow
applications to transform and forward related user input events from WebGL canvas to the bound iframe,
thus enabling the bound iframe to be interative inside a WebGL scene.</p>
<p>Due to security concerns, currently this extension only supports same origin iframes. This
limitaion may be lifted in the future.</p>
</overview>
<idl xml:space="preserve"><![CDATA[
[NoInterfaceObject]
interface WEBGL_texture_source_iframe {
Promise<void> bindTextureSource(GLenum target, HTMLIFrameElement iframe);
Promise<void> requestFrame(GLenum target);
void setEventForwarding(function(Event));
};
]]></idl>
<newfun>
<function name="bindTextureSource" type="Promise&lt;void&gt;">
<param name="target" type="GLenum"/>
<param name="iframe" type="HTMLIFrameElement"/>
<p>
This function connects an <code>iframe</code> to the texture currently bound to <code>target</code> and returns a promise
that will be fulfilled once the iframe is rendered and ready to be blitted to the texture. If the <code>iframe</code>
is <code>null</code>, any existing binding between the texture and an iframe is broken.
If there are any errors, generate the GL error synchronously and the returned promise is
<a href="https://www.w3.org/2001/tag/doc/promises-guide/#reject-promise">rejected</a>
with an <code>InvalidStateError</code>.
</p>
<p>
Once the function returns successfully, the texture is defined as following: its effective
internal format becomes <code>RGBA8</code>; its width and height becomes iframe element's
width and height.
</p>
<p>Error cases are listed below:
<ul>
<li><code>target</code> must be <code>TEXTURE_2D</code>; otherwise an <code>INVALID_ENUM</code>
error is generated.</li>
<li>If no texture is bound to the <code>target</code>, an <code>INVALID_OPERATION</code> is
generated.</li>
<li>If <code>iframe</code> is not the same origin, an <code>INVALID_OPERATION</code> is
generated.</li>
</ul>
</p>
<p>Note this function returns a promise asynchronously because wiring an iframe rendering results
to a WebGL texture could take multiple frames. The iframe could be invisible, therefore not part of
the rendering pipeline and needs to be inserted into it. The iframe could also be in a seperate
process from the one where WebGL is in, although this is likely not the case right now because we
currently limit iframe to be same origin only.</p>
</function>
<function name="requestFrame" type="Promise&lt;void&gt;">
<param name="target" type="GLenum"/>
<p>
This function instructs implementations to update the texture with the latest iframe rendering
results. The function returns a promise that will be fulfilled when the iframe rendering results from the same animation frame
when this function is called has been blitted to the texture.
</p>
<p>
If an application uses <code>requestAnimationFrame</code>, implementations must guarantee once
this function is called, the iframe rendering results from the same frame has been blitted to the
texture when entering the next animation frame. Therefore, it is not necessary for an
application to depend on the state of the returned promise. The promise is for applications that do not
use <code>requestAnimationFrame</code>.
</p>
<p>
Once this function called, it is not recommended to read from the texture until the returns promise is
fulfilled. The content of the texture during this period is undefined.
</p>
</function>
<function name="setEventForwarding" type="void">
<param name="func" type="Function"/>
<p>
This function allows an application to define an event forwarding
function that decides whether to forward user input events received on
the WebGL canvas to the iframe. If yes, this function needs to transform
event locations and displacements as needed. With this, an application
can allow users to interact the iframe rendered inside the WebGL scene.
</p>
<p>
The event forwarding function takes an event as input, and output a
bool. If returning true, the event is forwarded to the iframe and event
data might have been modified to transform the event from WebGL canvas
coordinates to iframe coordinates.
</p>
<p>
TODO(zmo@chromium.org): need some help how to define the forwarding function
signature.
</p>
</function>
</newfun>
<history>
<revision date="2017/09/20">
<change>Initial revision.</change>
</revision>
</history>
</proposal>

Просмотреть файл

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<proposal href="proposals/WEBGL_video_texture/">
<name>WEBGL_video_texture</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Byungseon Shin (sun.shin 'at' lge.com)</contributor>
<contributor>Andrey Volykhin (andrey.volykhin 'at' lge.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<mirrors href="https://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external.txt"
name="OES_EGL_image_external">
<addendum>Defines a new texture target <code>TEXTURE_VIDEO_IMAGE</code>.</addendum>
<addendum>Provides a mechanism for binding <code>HTMLVideoElement</code> stream to video texture targets.</addendum>
<addendum>Provides time of frame, texture width and height of <code>HTMLVideoElement</code>'s texture binding.</addendum>
</mirrors>
<features>
<feature>Add support for <code>WEBGL_video_texture</code>
binding of HTMLVideoElement.</feature>
<glsl extname="WEBGL_video_texture">
<stage type="fragment"/>
<type name="samplerVideoWEBGL"/>
<function name="texture2D" type="vec4">
<param name="sampler" type="samplerVideoWEBGL"/>
<param name="coord" type="vec2"/>
</function>
</glsl>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WebGLVideoFrameInfo {
readonly attribute double currentTime;
readonly attribute unsigned long textureWidth;
readonly attribute unsigned long textureHeight;
};
[NoInterfaceObject]
interface WEBGL_video_texture {
const GLenum TEXTURE_VIDEO_IMAGE = 0x851D;
const GLenum SAMPLER_VIDEO_IMAGE = 0x8B61;
[RaisesException] WebGLVideoFrameInfo VideoElementTargetVideoTexture(
GLenum target, HTMLVideoElement video);
};
</idl>
<samplecode xml:space="preserve">
<p> This a fragment shader that samples a video texture.</p>
<pre>
#extension GL_WEBGL_video_texture : require
precision mediump float;
varying vec2 v_texCoord;
uniform samplerVideoWEBGL uSampler;
void main(void) {
gl_FragColor = texture2D(uSampler, v_texCoord);
}
</pre>
<p> This shows application that renders video using proposed extension. </p>
<pre>
var videoElement = document.getElementById("video");
var videoTexture = gl.createTexture();
function update() {
var ext = gl.getExtension('WEBGL_video_texture');
if(ext !=== null){
gl.bindTexture(ext.TEXTURE_VIDEO_IMAGE, videoTexture);
ext.VideoElementTargetVideoTexture(ext.TEXTURE_VIDEO_IMAGE, videoElement);
gl.bindTexture(ext.TEXTURE_VIDEO_IMAGE, null);
}
}
function render() {
gl.clearColor(0.0, 0.0, 1.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.bindBuffer(gl.ARRAY_BUFFER, squareVerticesBuffer);
gl.vertexAttribPointer(vertexPositionAttribute, 3, gl.FLOAT, false, 0, 0);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(ext.TEXTURE_VIDEO_IMAGE, videoTexture);
gl.uniform1i(gl.getUniformLocation(shaderProgram, "uSampler"), 0);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
}
</pre>
<p> Application renders each video frames into WebGL canvas based on game-loop pattern. </p>
<pre>
while (true) {
update();
processInput();
render();
}
</pre>
</samplecode>
<tests/>
<issues/>
<history>
<revision date="2016/11/05">
<change>Initial revision.</change>
</revision>
<revision date="2017/01/10">
<change>Change EGLImageTargetTexture2DOES to be called at every WebGL rendering cycle.</change>
<change>Add VideoFrameInfo interface.</change>
<change>Change EGLImageTargetTexture2DOES to return VideoFrameInfo as a currently mapped frame.</change>
</revision>
<revision date="2017/08/03">
<change>Change Extension name to WEBGL_video_texture for abstracion of OES_EGL_image_external extension.</change>
<change>Define new sampler and texture type, TEXTURE_VIDEO_IMAGE and SAMPLER_VIDEO_IMAGE.</change>
<change>Change EGLImageTargetTexture2DOES to VideoElementTargetVideoTexture.</change>
</revision>
</history>
</proposal>

Просмотреть файл

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<rejected href="rejected/EXT_texture_storage/">
<name>EXT_texture_storage</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Kirill Dmitrenko (dmikis 'at' yandex-team.ru)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>k</number>
<depends>
<api version="1.0"/>
<core version="2.0"/>
</depends>
<overview>
<mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_storage.txt"
name="EXT_texture_storage">
</mirrors>
<features>
<feature>
The behaviour of <code>texImage2D</code>,
<code>compressedTexImage2D</code> and <code>copyTexImage2D</code>
methods of a WebGL context is changed. After a successful call to <code>texStorage2DEXT</code>,
the value of <code>TEXTURE_IMMUTABLE_FORMAT_EXT</code> for this texture
object is set to <code>TRUE</code>, and no further changes to the dimensions
or format of the texture may be made. Using <code>texImage2D</code>,
<code>compressedTexImage2D</code>, <code>copyTexImage2D</code> or
<code>texStorage2DEXT</code> with the same texture will result
in the error <code>INVALID_OPERATION</code> being generated.
</feature>
</features>
</overview>
<idl xml:space="preserve">
interface EXT_texture_storage {
const GLenum TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912F;
void texStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
}
</idl>
<newfun>
<function name="texStorage2DEXT" type="void">
<param name="target" type="GLenum"/>
<param name="levels" type="GLsizei"/>
<param name="internalformat" type="GLenum"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
Simultaneously specify storage for all levels of a two-dimensional texture.
</function>
</newfun>
<history>
<revision date="2015/09/16">
<change>Initial revision</change>
</revision>
<revision date="2017/01/11">
<change>Moved to rejected now that initial WebGL 2.0 implementations are shipping imminently.</change>
</revision>
</history>
</rejected>

Просмотреть файл

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<rejected href="rejected/OES_depth24/">
<name>OES_depth24</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
<core version="2.0" />
</depends>
<overview>
<mirrors href="https://www.khronos.org/registry/gles/extensions/OES/OES_depth24.txt"
name="OES_depth24">
</mirrors>
<features>
<feature>
Allows 24-bit depth components as a valid render buffer storage format.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface OES_depth24 {
const GLenum DEPTH_COMPONENT24_OES = 0x81A6;
};
</idl>
<samplecode xml:space="preserve">
<pre>
var extension = gl.getExtension('OES_depth24');
if(extension !=== null){
var depth = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, depth);
gl.renderbufferStorage(gl.RENDERBUFFER, extension.DEPTH_COMPONENT24_OES, 128, 128);
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
var fbo = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depth);
var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
console.assert(fboStatus == gl.FRAMEBUFFER_COMPLETE, 'Framebuffer is not complete');
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
console.assert(gl.getError() == gl.NO_ERROR, 'A GL error occured');
}
</pre>
</samplecode>
<history>
<revision date="2015/01/26">
<change>Initial revision.</change>
</revision>
<revision date="2015/02/05">
<change>Moved to rejected because WEBGL_depth_texture can be used as a workaround for 24-bit depth for FBOs.</change>
</revision>
</history>
</rejected>

Просмотреть файл

@ -0,0 +1,106 @@
<?xml version="1.0"?>
<rejected href="rejected/WEBGL_debug_shader_precision/">
<name>WEBGL_debug_shader_precision</name>
<contact><a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Olli Etuaho, NVIDIA</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
</depends>
<overview>
<p>
This extension enables software emulation of mediump and lowp floating point arithmetic in GLSL shaders for the purposes of shader testing. The emulation is enabled for shaders that are compiled after the extension has been enabled. Shaders compiled before the extension is enabled are not subject to emulation. The emulation does not model any specific device, but hypothetical shader units that implement IEEE half-precision floating point and the minimum requirements for lowp in The OpenGL ES Shading Language specification version 1.00.17. It is suggested that the software emulation is implemented in shader code, but a large performance cost on the order of one magnitude is still expected on all operations subject to emulation.
</p>
<div class="note">
Many varieties of PC GPUs only implement one precision for floating point operations that corresponds to highp in The OpenGL ES Shading Language, so errors in shader code which uses mediump or lowp precision may be undetectable on these GPUs. Testing shaders with this extension enabled is recommended to ensure compatibility with a wide variety of hardware. Due to the large performance cost of emulation, this extension should only be used for testing and not in a production environment.
</div>
<p>
The emulation applies to:
</p>
<ul>
<li>accesses to variables in r-value expressions (not on the left side of an assignment operator, includes passing in parameters to a function)</li>
<li>return values of built-in functions</li>
<li>return values of binary math operators, including assignment and compound assignment</li>
<li>results of binary math operations evaluated as a part of compound assignment</li>
</ul>
<div class="note">
<p>
Examples of operations not subject to emulation:
</p>
<ul>
<li>The math operator is unary, so storing the result and the return value are not subject to emulation: my_float++;</li>
</ul>
</div>
<features>
<feature>
<p>
Operations listed above resulting in a mediump precision floating point scalar, vector or matrix must perform the following steps on the resulting scalar value or each of the components of the vector or matrix:
</p>
<ol>
<li>Clamp the value to the range [-65504.0, 65504.0].</li>
<li>Determine the floating-point exponent <em>e</em> of the clamped value.</li>
<li>If <em>e</em> &lt; -15, return 0.0, skipping steps 4-6. The sign bit of the return value is undefined in this case.</li>
<li>Let <em>x</em> be the clamped value multiplied by 2^(-<em>e</em> + 10.0).</li>
<li>Let <em>y</em> be sign(<em>x</em>) * floor(abs(<em>x</em>)).</li>
<li>Return <em>y</em> * 2^(<em>e</em> - 10.0).</li>
</ol>
</feature>
<feature>
<p>
Operations listed above resulting in a lowp precision floating point scalar, vector or matrix must perform the following steps on the resulting scalar value or each of the components of the vector or matrix:
</p>
<ol>
<li>Clamp the value to the range [-2.0, 2.0].</li>
<li>Let <em>x</em> be the clamped value multiplied by 2^8.</li>
<li>Let <em>y</em> be sign(<em>x</em>) * floor(abs(<em>x</em>)).</li>
<li>Return <em>y</em> * 2^(-8).</li>
</ol>
</feature>
<feature>
<p>
sign, floor, and abs in the above steps refer to built-in functions in The OpenGL ES Shading Language.
</p>
<p>
The handling of positive and negative infinity and NaN by the above steps is undefined.
</p>
</feature>
<feature>
<p>
The <code>#pragma webgl_debug_shader_precision</code> directive is accepted by the shader compiler, and can be used to disable the emulation for specific shaders. By default, emulation is enabled by all shaders, but including <code>#pragma webgl_debug_shader_precision(off)</code> in a shader must disable emulation for that shader.
</p>
</feature>
</features>
<p>
Due to hardware limitations, it is allowed that some shaders which compile and link successfully when the extension is disabled do not compile or link when the extension is enabled.
</p>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_debug_shader_precision {
};
</idl>
<history>
<revision date="2014/11/05">
<change>Initial revision.</change>
</revision>
<revision date="2014/11/10">
<change>Added a #pragma directive to use in shaders and did minor clarifications.</change>
</revision>
<revision date="2014/11/12">
<change>Lifted restrictions concerning math operations evaluated as a part of compound assignment.</change>
</revision>
<revision date="2015/01/24">
<change>Moved to rejected on grounds of it being easy to provide as a library (with emscripten).</change>
</revision>
</history>
</rejected>

Просмотреть файл

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<rejected href="rejected/WEBGL_draw_elements_no_range_check/">
<name>WEBGL_draw_elements_no_range_check</name>
<contact><a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Olli Etuaho, NVIDIA</contributor>
<contributor>Jeff Gilbert, Mozilla</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
</depends>
<overview id="overview">
<p><code>drawElements</code> robustness is currently ensured by checking
indices in the element array buffer against the size of the array buffer
they are indexing. These checks are undesirable from a performance
perspective, since they introduce CPU overhead to the API and require index
buffers to have a copy in CPU-accessible memory.</p>
<p>This extension changes the behavior of <code>drawElements</code> to use
security features built into hardware, bypassing the CPU-side range check
and improving performance. The drawback is that if out-of-range indices are
referenced by <code>drawElements</code>, no error is generated and the
rendering results of that call will be undefined. However, supplying
out-of-range indices to <code>drawElements</code> will not result in
reading vertex data from outside the enabled vertex buffer objects, nor
abnormal program termination, as specified in the OpenGL extension
<a href="http://www.opengl.org/registry/specs/ARB/robust_buffer_access_behavior.txt">ARB_robust_buffer_access_behavior</a>.</p>
<p>It is suggested that this extension is left disabled when debugging. Any
<code>INVALID_OPERATION</code> errors from <code>drawElements</code> seen
while the extension is off mean that the application is supplying incorrect
indices to the API, even if rendering results would seem correct when this
extension is enabled.</p>
<p>This extension interacts with
<a href="http://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/">ANGLE_instanced_arrays</a>.</p>
<features>
<feature>
Calling <code>drawElements</code> will not produce an <code>INVALID_OPERATION</code>
error if a referenced index lies outside the storage of the bound buffer. Instead,
rendering is performed and attribute indices that are outside the valid range will produce
undefined rendering results.
</feature>
<feature>
Interaction with ANGLE_instanced_arrays: calling <code>drawElementsInstancedANGLE</code>
will not produce an <code>INVALID_OPERATION</code> error if a referenced index
lies outside the storage of the bound buffer, but will instead produce undefined
rendering results similarly to <code>drawElements</code>.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_draw_elements_no_range_check {
};
</idl>
<issues>
</issues>
<history>
<revision date="2014/03/14">
<change>Initial revision.</change>
</revision>
<revision date="2014/07/15">
<change>Added NoInterfaceObject extended attribute.</change>
</revision>
<revision date="2015/01/24">
<change>Moved to rejected.</change>
</revision>
</history>
</rejected>

Просмотреть файл

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<rejected href="rejected/WEBGL_subscribe_uniform/">
<name>WEBGL_subscribe_uniform</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Owen Glofcheski, Google</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
</depends>
<overview id="overview">
<p> This extension exposes the ability to subscribe to a set of uniform targets
which can be used to populate uniforms within shader programs. This extension
is generic, but currently only supports mouse position as a subscription target.
</p><p>Background:
</p><p>The depth of the web pipeline makes it difficult to support low latency
interaction as event information retrieved via javascript
is outdated by the time it's displayed to clients. By populating event
information later in the pipeline one can reduce perceived input latency.
</p><p>This extension creates a new buffer type <code>'Valuebuffer'</code> to
maintain the active state for predefined subscription targets. Since a
mechanism for buffering uniform information isn't available pre 2.0 (UBOs)
an additional data type was needed. See 'New Types' for additional
information.</p>
<p> When this extension is enabled: </p>
<ul>
<li>This extension provides a mechanism to store mouse positional information
in buffers and defer modification of uniform variables which use mouse
positional information until the WebGL commands are executed.
</li>
<li>This extension provides a mechanism to explicitly update mouse
positional information to maintain per frame consistency.
</li>
</ul>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_subscribe_uniform {
const GLenum SUBSCRIBED_VALUES_BUFFER = 0x924B;
// subscription targets
const GLenum MOUSE_POSITION = 0x924C;
WebGLValuebuffer? createValuebuffer();
void deleteValuebuffer(WebGLValuebuffer? buffer);
void isValuebuffer(WebGLValuebuffer? buffer);
void bindValuebuffer(GLenum target, WebGLValuebuffer? buffer);
void subscribeValue(GLenum traget, GLenum subscription);
void populateSubscribedValues(GLenum target);
void uniformValuebuffer(WebGLUniformLocation? location, GLenum target, GLenum subscription);
}; // interface WEBGL_subscribe_uniform
</idl>
<newfun>
<function name="createValuebuffer" type="WebGLValuebuffer">
Creates and returns a <code>Valuebuffer</code> object.</function>
<function name="deleteValuebuffer" type="void"><param
name="buffer" type="WebGLValuebuffer"/>Deletes a <code>Valuebuffer</code>
object.</function>
<function name="isValuebuffer" type="bool"><param
name="buffer" type="WebGLValuebuffer"/>Returns whether an object is a
<code>Valuebuffer</code> object.</function>
<function name="bindValuebuffer" type="void"><param
name="target" type="GLenum"/><param
name="buffer" type="WebGLValuebuffer"/>Lets you use a named
<code>Valuebuffer</code> object.</function>
<function name="subscribeValuebuffer" type="void"><param
name="target" type="GLenum"/><param
name="subscription" type="GLenum"/>Subscribes the currently bound
<code>Valuebuffer</code> object to a subscription target.</function>
<function name="populateSubscribedValues" type="void"><param
name="target" type="GLenum"/>Populates the currently bound
<code>Valuebuffer</code> object with the state of the subscriptions to
which it is subscribed.</function>
<function name="uniformValuebuffer" type="void"><param
name="location" type="WebGLUniformLocation"/><param
name="target" type="GLenum"/><param
name="subscription" type="GLenum"/>Modifies the value of a uniform variable
or uniform variable array using the state of the subscription target in the
currently bound <code>Valuebuffer</code> object.</function>
</newfun>
<newtypes>
<interface name="WebGLValuebuffer" noobject="true">
<p>This interface is used to maintain a reference to internal
<code>Valuebuffer</code> subscription states.</p>
</interface>
<p>A <code>Valuebuffer</code> abstracts the mapping of subscription targets to internal
state and acts as a single storage object for subscription information (e.g. current
mouse position). Clients can then use the objects data to populate uniform variables.</p>
<p>Post WebGL API 2.0, this abstraction could exist as a layer ontop of UBOs
which managers the mapping of subscription targets to internal state and the mapping
of subscription targets to offsets within the buffer. The UBO would be used to store the
active buffer state as well as the uniform location mapping. Clients would be required to
state all their subscription targets at once to allocate the appropriate amount of memory.
Aside from this small change the implementation is essentially the same, with UBOs replacing
<code>Valuebuffers</code> and relevant create, delete, bind methods being replaced.
Additionally, the inclusion of UBOs would replace the need for
<code>uniformValueBuffer(...)</code>.</p>
</newtypes>
<newtok>
<function name="bindValuebuffer" type="any"><param
name="target" type="GLenum"/><param
name="buffer" type="WebGLValuebuffer"/>
<p><code>SUBSCRIBED_VALUES_BUFFER</code>
is accepted as the target parameter to bindValuebuffer</p></function>
<function name="subscribeValuebuffer" type="void"><param
name="target" type="GLenum"/><param
name="subscription" type="GLenum"/>
<p><code>SUBSCRIBED_VALUES_BUFFER</code>
is accepted as the target parameter to subscribeValuebuffer</p>
<p><code>MOUSE_POSITION</code>
is accepted as the subscription parameter to subscribeValuebuffer</p></function>
<function name="populateSubscribedValues" type="void"><param
name="target" type="GLenum"/>
<p><code>SUBSCRIBED_VALUES_BUFFER</code>
is accepted as the target parameter to populateSubscribedValues</p></function>
<function name="uniformValuebuffer" type="void"><param
name="location" type="WebGLUniformLocation"/><param
name="target" type="GLenum"/><param
name="subscription" type="GLenum"/>
<p><code>SUBSCRIBED_VALUES_BUFFER</code>
is accepted as the target parameter to uniformValuebuffer</p>
<p><code>MOUSE_POSITION</code>
is accepted as the subscription parameter to uniformValuebuffer</p></function>
</newtok>
<samplecode><div class="example"><pre xml:space="preserve">
&lt;script id="vshader" type="x-shader/x-vertex"&gt;
uniform ivec2 uMousePosition;
void main()
{
gl_Position = vec4(uMousePosition, 0, 1);
}
&lt;/script&gt;
function init(gl) {
shader.uMousePosition = gl.getUniformLocation(shader, "uMousePosition");
...
var ext = gl.getExtension('WEBGL_subscribe_uniform');
// Create the value buffer and subscribe.
var valuebuffer = ext.createValuebuffer();
ext.bindValuebuffer(SUBSCRIBED_VALUES_BUFFER, valuebuffer);
ext.subscribeValue(MOUSE_POSITION);
...
}
function draw(gl) {
// Populate buffer and populate uniform
ext.bindValuebuffer(SUBSCRIBED_VALUES_BUFFER, valuebuffer);
ext.populateSubscribedValues(SUBSCRIBED_VALUES_BUFFER);
ext.uniformValuebuffer(shader.uMousePosition,
SUBSCRIBED_VALUES_BUFFER,
MOUSE_POSITION);
gl.drawElements(...);
}
</pre></div></samplecode>
<issues/>
<history>
<revision date="2014/11/13">
<change>Initial revision.</change>
</revision>
<revision date="2016/04/14">
<change>Moved to rejected state. Does not have a champion at this point. Was difficult to
reason about how to use the extension, given that the on-screen rendering would be farther
ahead than the application's state. Seems that the best solution is to focus on reducing the
depth, and therefore latency, of the browser's rendering pipeline.</change>
</revision>
</history>
</rejected>

Просмотреть файл

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<rejected href="rejected/WEBGL_texture_from_depth_video/">
<name>WEBGL_texture_from_depth_video</name>
<contact><a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Ningxin Hu, Intel</contributor>
<contributor>Anssi Kostiainen, Intel</contributor>
<contributor>Rob Manson, buildAR</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
</depends>
<overview id="overview">
<p>This extension provides support for the <a
href="http://w3c.github.io/mediacapture-depth/">Media
Capture Depth Stream Extensions</a>. Specifically, it supports
uploading to a WebGL texture a <code>video</code> element whose
source is a <code>MediaStream</code> object containing a <a
href="http://w3c.github.io/mediacapture-depth/#dfn-depth-track">
depth track</a>.</p>
<features>
<feature>
A <code>video</code> element whose source is a <code>MediaStream</code>
object containing a <a
href="http://w3c.github.io/mediacapture-depth/#dfn-depth-track">
depth track</a> may be uploaded to a WebGL
texture of format <code>RGB</code> and type
<code>UNSIGNED_SHORT_5_6_5</code>.
</feature>
</features>
</overview>
<idl xml:space="preserve">
[NoInterfaceObject]
interface WEBGL_texture_from_depth_video {
};
</idl>
<samplecode>
<div class="example">
This code sets up a video element from a depth stream, uploads
it to a WebGL texture, and samples that texture in the fragment
shader, reconstructing the 16-bit depth values from the red,
green and blue channels.
<pre xml:space="preserve">var ext = gl.getExtension("WEBGL_texture_from_depth_video");
if (ext) {
navigator.getUserMedia({ video: true }, successVideo, failureVideo);
}
var depthVideo;
function successVideo(s) {
// wire the stream into a &lt;video&gt; element for playback
depthVideo = document.querySelector('#video');
depthVideo.src = URL.createObjectURL(s);
depthVideo.play();
}
// ... later, in the rendering loop ...
if (ext) {
gl.texImage2D(
gl.TEXTURE_2D,
0,
gl.RGB,
gl.RGB,
gl.UNSIGNED_SHORT_5_6_5,
depthVideo
);
}
&lt;script id="fragment-shader" type="x-shader/x-fragment"&gt;
varying vec2 v_texCoord;
// u_tex points to the texture unit containing the depth texture.
uniform sampler2D u_tex;
void main() {
vec4 floatColor = texture2D(u_tex, v_texCoord);
vec3 rgb = floatColor.rgb;
...
float depth = 63488. * rgb.r + 2016. * rgb.g + 31. * rgb.b;
...
}
&lt;/script&gt;</pre></div>
</samplecode>
<issues>
</issues>
<history>
<revision date="2014/11/03">
<change>Initial revision.</change>
</revision>
<revision date="2015/01/24">
<change>Moved to rejected on the grounds that it can be done without an extension.</change>
</revision>
</history>
</rejected>

Просмотреть файл

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- The root element should be <draft href="~~"> for draft extensions -->
<!-- The root element should be <proposal href="~~"> for proposed extensions -->
<!-- The root element should be <ratified href="~~"> for ratified extensions -->
<!-- @href should be a URI relative to the WebGL extension registry at
http://www.khronos.org/registry/webgl/extensions/
-->
<extension href="template/">
<!-- The name of the extension. This is also the string which is passed to the
WebGLRenderingContext getExtension API to enable the extension. For example, if
the extension were OES_texture_float, then the extension would be fetched and
enabled with a call to getExtension("OES_texture_float")
Per WebGL convention, the 'GL_' prefix is dropped from all extension and enum
names, and the 'gl' prefix dropped from, and capitalization adjusted of, all
function names.
-->
<name>template</name>
<!-- The optional alternate name strings of the extension for draft exts -->
<aliases>
<alias>VENDOR_EXT_NAME</alias>
<alias>VENDOR_EXT_NAME</alias>
</aliases>
<!-- the email address of the contact of the specification -->
<!-- prefer to 'at' instead of the '@' character to reduce spam -->
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<!-- Names and email addresses of individuals who contributed to the development of
the specification
-->
<contributors>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>k <!-- extension number in registry --></number>
<depends>
<api version="1.0"/>
<core version="2.0"/>
<!-- Version in which the extension functionality was integrated into the core spec -->
<core version="2.0">
<glsl version="300 es"/>
<!-- GLSL #version required to use the feature, if any -->
<addendum> Difference in core spec from extension. </addendum>
</core>
<removed version="2.0"/>
<!-- Version as of which extension is no longer supported -->
<ext name="WEBGL_required_ext" require="true"/>
<ext name="WEBGL_base_ext"/>
<!-- api/extension with hyperlink -->
</depends>
<overview>
<!-- use mirrors if this extension wraps another -->
<mirrors href="http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt"
name="OES_texture_float">
<!-- list the deviations here if there are any -->
<addendum>Optional support for <code>FLOAT</code> textures as FBO
attachments.</addendum>
<!-- Tags not 'addendum' replace the default text that says
"Consult the above extension for documentation, issues and new functions and enumerants."
-->
</mirrors>
<!-- normal free-form XHTML is allowed here -->
<div class="nonnormative">
<p> This template for WebGL extensions is derived from the <a
href="http://www.opengl.org/registry/doc/template/txt">OpenGL extension
template</a>. Refer to the OpenGL extension template for full
documentation of the content that should be contained in the sections
below. Because WebGL is fundamentally a Web API, its extensions are
specified in XML transformed with XSLT into HTML for easier
hyperlinking. </p>
<p> Because most WebGL extensions are expected to simply mirror existing
OpenGL and OpenGL ES extensions, it is desirable to keep the WebGL
extension specifications as small as possible and simply refer to the
other specifications for the behavioral definitions. </p>
</div>
<features>
<!-- a list of features in XHTML -->
<feature>Frobs the <b>baz</b></feature>
<!-- can also specify glsl built-ins in structured format -->
<glsl extname="GL_OES_foo_bar">
<alias extname="GL_NV_foo_bar"/>
<alias extname="GL_ATI_foo_bar"/>
<stage type="fragment"/>
<stage type="vertex"/>
<function name="myfun" type="vec4">
<param type="vec4"/>
</function>
</glsl>
</features>
</overview>
<idl xml:space="preserve"> <!-- copied literally into a <pre> -->
<!-- Enums and functions introduced by the extension should be specified as
'const GLenum' and methods on the extension object. The extension IDL should
be written assuming that the typedefs in
<a href="../../specs/latest/webgl.idl">webgl.idl</a> and
<a href="../../typedarray/specs/latest/typedarrays.idl">typedarrays.idl</a>
have already been defined, and may implicitly reference other web platform
specifications.
-->
module webgl {
interface OES_foo_bar {
const GLenum NEW_ENUM = 0xF00;
void doSomethingNew(GLenum state, GLuint value);
}; // interface OES_foo_bar
}; // module webgl
</idl>
<!-- new functions -->
<newfun>
<function name="loseContext" type="void"> XHTML description </function>
</newfun>
<!-- new types -->
<newtypes>
<typedef name="in_pipe"> <type>unsigned long long</type> XHTML </typedef>
<typedef name="out_pipe"> <type>unsigned long long</type> XHTML </typedef>
<interface name="Plumber">
<member>Plumber work(in_pipe,out_pipe);</member>
<p>After attempting a connection, the plumber is no longer the same.</p>
</interface>
<interface name="Agency" noobject="true"> <member>void
register(Plumber);</member> <member>Plumber find();</member> XHTML
</interface>
</newtypes>
<!-- new tokens -->
<newtok>
<function name="getParameter" type="any"> <param name="pname"
type="GLenum"/> XHTML </function>
</newtok>
<!-- Refer to the <http://www.opengl.org/registry/doc/template.txt> OpenGL
extension template for a description of these sections. These sections
should be eliminated for WebGL extensions simply mirroring OpenGL or
OpenGL ES extensions.
-->
<!-- these take XHTML markup as contents -->
<security/>
<ipstatus/>
<additions/>
<!-- Additions to the WebGL Specification -->
<errors/>
<newstate/>
<newimplstate/>
<!-- New Implementation-Dependent State -->
<samplecode/>
<tests/>
<issues/>
<history>
<!-- a list of revisions in any order -->
<!-- Include important changes in the evolution of the extension. It's
especially important to include this section if the extension is modified
after a version has been shipped. Consult the
<http://www.opengl.org/registry/doc/template.txt> OpenGL extension template
for an example.
-->
<revision date="YYYY/MM/DD">
<!-- a list of changes -->
<change>Quuxed the bar</change>
<change>Fooed the frob</change>
</revision>
</history>
</extension>

Просмотреть файл

@ -0,0 +1,729 @@
// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile
//
// WebGL IDL definitions scraped from the Khronos specification:
// https://www.khronos.org/registry/webgl/specs/latest/
//
// This IDL depends on the typed array specification defined at:
// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl
typedef unsigned long GLenum;
typedef boolean GLboolean;
typedef unsigned long GLbitfield;
typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */
typedef short GLshort;
typedef long GLint;
typedef long GLsizei;
typedef long long GLintptr;
typedef long long GLsizeiptr;
// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL.
typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */
typedef unsigned short GLushort;
typedef unsigned long GLuint;
typedef unrestricted float GLfloat;
typedef unrestricted float GLclampf;
// The power preference settings are documented in the WebGLContextAttributes
// section of the specification.
enum WebGLPowerPreference { "default", "low-power", "high-performance" };
dictionary WebGLContextAttributes {
GLboolean alpha = true;
GLboolean depth = true;
GLboolean stencil = false;
GLboolean antialias = true;
GLboolean premultipliedAlpha = true;
GLboolean preserveDrawingBuffer = false;
WebGLPowerPreference powerPreference = "default";
GLboolean failIfMajorPerformanceCaveat = false;
};
interface WebGLObject {
};
interface WebGLBuffer : WebGLObject {
};
interface WebGLFramebuffer : WebGLObject {
};
interface WebGLProgram : WebGLObject {
};
interface WebGLRenderbuffer : WebGLObject {
};
interface WebGLShader : WebGLObject {
};
interface WebGLTexture : WebGLObject {
};
interface WebGLUniformLocation {
};
interface WebGLActiveInfo {
readonly attribute GLint size;
readonly attribute GLenum type;
readonly attribute DOMString name;
};
interface WebGLShaderPrecisionFormat {
readonly attribute GLint rangeMin;
readonly attribute GLint rangeMax;
readonly attribute GLint precision;
};
typedef (ImageBitmap or
ImageData or
HTMLImageElement or
HTMLCanvasElement or
HTMLVideoElement) TexImageSource;
typedef ([AllowShared] Float32Array or sequence<GLfloat>) Float32List;
typedef ([AllowShared] Int32Array or sequence<GLint>) Int32List;
interface mixin WebGLRenderingContextBase
{
/* ClearBufferMask */
const GLenum DEPTH_BUFFER_BIT = 0x00000100;
const GLenum STENCIL_BUFFER_BIT = 0x00000400;
const GLenum COLOR_BUFFER_BIT = 0x00004000;
/* BeginMode */
const GLenum POINTS = 0x0000;
const GLenum LINES = 0x0001;
const GLenum LINE_LOOP = 0x0002;
const GLenum LINE_STRIP = 0x0003;
const GLenum TRIANGLES = 0x0004;
const GLenum TRIANGLE_STRIP = 0x0005;
const GLenum TRIANGLE_FAN = 0x0006;
/* AlphaFunction (not supported in ES20) */
/* NEVER */
/* LESS */
/* EQUAL */
/* LEQUAL */
/* GREATER */
/* NOTEQUAL */
/* GEQUAL */
/* ALWAYS */
/* BlendingFactorDest */
const GLenum ZERO = 0;
const GLenum ONE = 1;
const GLenum SRC_COLOR = 0x0300;
const GLenum ONE_MINUS_SRC_COLOR = 0x0301;
const GLenum SRC_ALPHA = 0x0302;
const GLenum ONE_MINUS_SRC_ALPHA = 0x0303;
const GLenum DST_ALPHA = 0x0304;
const GLenum ONE_MINUS_DST_ALPHA = 0x0305;
/* BlendingFactorSrc */
/* ZERO */
/* ONE */
const GLenum DST_COLOR = 0x0306;
const GLenum ONE_MINUS_DST_COLOR = 0x0307;
const GLenum SRC_ALPHA_SATURATE = 0x0308;
/* SRC_ALPHA */
/* ONE_MINUS_SRC_ALPHA */
/* DST_ALPHA */
/* ONE_MINUS_DST_ALPHA */
/* BlendEquationSeparate */
const GLenum FUNC_ADD = 0x8006;
const GLenum BLEND_EQUATION = 0x8009;
const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
const GLenum BLEND_EQUATION_ALPHA = 0x883D;
/* BlendSubtract */
const GLenum FUNC_SUBTRACT = 0x800A;
const GLenum FUNC_REVERSE_SUBTRACT = 0x800B;
/* Separate Blend Functions */
const GLenum BLEND_DST_RGB = 0x80C8;
const GLenum BLEND_SRC_RGB = 0x80C9;
const GLenum BLEND_DST_ALPHA = 0x80CA;
const GLenum BLEND_SRC_ALPHA = 0x80CB;
const GLenum CONSTANT_COLOR = 0x8001;
const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002;
const GLenum CONSTANT_ALPHA = 0x8003;
const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004;
const GLenum BLEND_COLOR = 0x8005;
/* Buffer Objects */
const GLenum ARRAY_BUFFER = 0x8892;
const GLenum ELEMENT_ARRAY_BUFFER = 0x8893;
const GLenum ARRAY_BUFFER_BINDING = 0x8894;
const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
const GLenum STREAM_DRAW = 0x88E0;
const GLenum STATIC_DRAW = 0x88E4;
const GLenum DYNAMIC_DRAW = 0x88E8;
const GLenum BUFFER_SIZE = 0x8764;
const GLenum BUFFER_USAGE = 0x8765;
const GLenum CURRENT_VERTEX_ATTRIB = 0x8626;
/* CullFaceMode */
const GLenum FRONT = 0x0404;
const GLenum BACK = 0x0405;
const GLenum FRONT_AND_BACK = 0x0408;
/* DepthFunction */
/* NEVER */
/* LESS */
/* EQUAL */
/* LEQUAL */
/* GREATER */
/* NOTEQUAL */
/* GEQUAL */
/* ALWAYS */
/* EnableCap */
/* TEXTURE_2D */
const GLenum CULL_FACE = 0x0B44;
const GLenum BLEND = 0x0BE2;
const GLenum DITHER = 0x0BD0;
const GLenum STENCIL_TEST = 0x0B90;
const GLenum DEPTH_TEST = 0x0B71;
const GLenum SCISSOR_TEST = 0x0C11;
const GLenum POLYGON_OFFSET_FILL = 0x8037;
const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
const GLenum SAMPLE_COVERAGE = 0x80A0;
/* ErrorCode */
const GLenum NO_ERROR = 0;
const GLenum INVALID_ENUM = 0x0500;
const GLenum INVALID_VALUE = 0x0501;
const GLenum INVALID_OPERATION = 0x0502;
const GLenum OUT_OF_MEMORY = 0x0505;
/* FrontFaceDirection */
const GLenum CW = 0x0900;
const GLenum CCW = 0x0901;
/* GetPName */
const GLenum LINE_WIDTH = 0x0B21;
const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D;
const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E;
const GLenum CULL_FACE_MODE = 0x0B45;
const GLenum FRONT_FACE = 0x0B46;
const GLenum DEPTH_RANGE = 0x0B70;
const GLenum DEPTH_WRITEMASK = 0x0B72;
const GLenum DEPTH_CLEAR_VALUE = 0x0B73;
const GLenum DEPTH_FUNC = 0x0B74;
const GLenum STENCIL_CLEAR_VALUE = 0x0B91;
const GLenum STENCIL_FUNC = 0x0B92;
const GLenum STENCIL_FAIL = 0x0B94;
const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95;
const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96;
const GLenum STENCIL_REF = 0x0B97;
const GLenum STENCIL_VALUE_MASK = 0x0B93;
const GLenum STENCIL_WRITEMASK = 0x0B98;
const GLenum STENCIL_BACK_FUNC = 0x8800;
const GLenum STENCIL_BACK_FAIL = 0x8801;
const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
const GLenum STENCIL_BACK_REF = 0x8CA3;
const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4;
const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5;
const GLenum VIEWPORT = 0x0BA2;
const GLenum SCISSOR_BOX = 0x0C10;
/* SCISSOR_TEST */
const GLenum COLOR_CLEAR_VALUE = 0x0C22;
const GLenum COLOR_WRITEMASK = 0x0C23;
const GLenum UNPACK_ALIGNMENT = 0x0CF5;
const GLenum PACK_ALIGNMENT = 0x0D05;
const GLenum MAX_TEXTURE_SIZE = 0x0D33;
const GLenum MAX_VIEWPORT_DIMS = 0x0D3A;
const GLenum SUBPIXEL_BITS = 0x0D50;
const GLenum RED_BITS = 0x0D52;
const GLenum GREEN_BITS = 0x0D53;
const GLenum BLUE_BITS = 0x0D54;
const GLenum ALPHA_BITS = 0x0D55;
const GLenum DEPTH_BITS = 0x0D56;
const GLenum STENCIL_BITS = 0x0D57;
const GLenum POLYGON_OFFSET_UNITS = 0x2A00;
/* POLYGON_OFFSET_FILL */
const GLenum POLYGON_OFFSET_FACTOR = 0x8038;
const GLenum TEXTURE_BINDING_2D = 0x8069;
const GLenum SAMPLE_BUFFERS = 0x80A8;
const GLenum SAMPLES = 0x80A9;
const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA;
const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB;
/* GetTextureParameter */
/* TEXTURE_MAG_FILTER */
/* TEXTURE_MIN_FILTER */
/* TEXTURE_WRAP_S */
/* TEXTURE_WRAP_T */
const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3;
/* HintMode */
const GLenum DONT_CARE = 0x1100;
const GLenum FASTEST = 0x1101;
const GLenum NICEST = 0x1102;
/* HintTarget */
const GLenum GENERATE_MIPMAP_HINT = 0x8192;
/* DataType */
const GLenum BYTE = 0x1400;
const GLenum UNSIGNED_BYTE = 0x1401;
const GLenum SHORT = 0x1402;
const GLenum UNSIGNED_SHORT = 0x1403;
const GLenum INT = 0x1404;
const GLenum UNSIGNED_INT = 0x1405;
const GLenum FLOAT = 0x1406;
/* PixelFormat */
const GLenum DEPTH_COMPONENT = 0x1902;
const GLenum ALPHA = 0x1906;
const GLenum RGB = 0x1907;
const GLenum RGBA = 0x1908;
const GLenum LUMINANCE = 0x1909;
const GLenum LUMINANCE_ALPHA = 0x190A;
/* PixelType */
/* UNSIGNED_BYTE */
const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033;
const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034;
const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363;
/* Shaders */
const GLenum FRAGMENT_SHADER = 0x8B30;
const GLenum VERTEX_SHADER = 0x8B31;
const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
const GLenum MAX_VARYING_VECTORS = 0x8DFC;
const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872;
const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
const GLenum SHADER_TYPE = 0x8B4F;
const GLenum DELETE_STATUS = 0x8B80;
const GLenum LINK_STATUS = 0x8B82;
const GLenum VALIDATE_STATUS = 0x8B83;
const GLenum ATTACHED_SHADERS = 0x8B85;
const GLenum ACTIVE_UNIFORMS = 0x8B86;
const GLenum ACTIVE_ATTRIBUTES = 0x8B89;
const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C;
const GLenum CURRENT_PROGRAM = 0x8B8D;
/* StencilFunction */
const GLenum NEVER = 0x0200;
const GLenum LESS = 0x0201;
const GLenum EQUAL = 0x0202;
const GLenum LEQUAL = 0x0203;
const GLenum GREATER = 0x0204;
const GLenum NOTEQUAL = 0x0205;
const GLenum GEQUAL = 0x0206;
const GLenum ALWAYS = 0x0207;
/* StencilOp */
/* ZERO */
const GLenum KEEP = 0x1E00;
const GLenum REPLACE = 0x1E01;
const GLenum INCR = 0x1E02;
const GLenum DECR = 0x1E03;
const GLenum INVERT = 0x150A;
const GLenum INCR_WRAP = 0x8507;
const GLenum DECR_WRAP = 0x8508;
/* StringName */
const GLenum VENDOR = 0x1F00;
const GLenum RENDERER = 0x1F01;
const GLenum VERSION = 0x1F02;
/* TextureMagFilter */
const GLenum NEAREST = 0x2600;
const GLenum LINEAR = 0x2601;
/* TextureMinFilter */
/* NEAREST */
/* LINEAR */
const GLenum NEAREST_MIPMAP_NEAREST = 0x2700;
const GLenum LINEAR_MIPMAP_NEAREST = 0x2701;
const GLenum NEAREST_MIPMAP_LINEAR = 0x2702;
const GLenum LINEAR_MIPMAP_LINEAR = 0x2703;
/* TextureParameterName */
const GLenum TEXTURE_MAG_FILTER = 0x2800;
const GLenum TEXTURE_MIN_FILTER = 0x2801;
const GLenum TEXTURE_WRAP_S = 0x2802;
const GLenum TEXTURE_WRAP_T = 0x2803;
/* TextureTarget */
const GLenum TEXTURE_2D = 0x0DE1;
const GLenum TEXTURE = 0x1702;
const GLenum TEXTURE_CUBE_MAP = 0x8513;
const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514;
const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
/* TextureUnit */
const GLenum TEXTURE0 = 0x84C0;
const GLenum TEXTURE1 = 0x84C1;
const GLenum TEXTURE2 = 0x84C2;
const GLenum TEXTURE3 = 0x84C3;
const GLenum TEXTURE4 = 0x84C4;
const GLenum TEXTURE5 = 0x84C5;
const GLenum TEXTURE6 = 0x84C6;
const GLenum TEXTURE7 = 0x84C7;
const GLenum TEXTURE8 = 0x84C8;
const GLenum TEXTURE9 = 0x84C9;
const GLenum TEXTURE10 = 0x84CA;
const GLenum TEXTURE11 = 0x84CB;
const GLenum TEXTURE12 = 0x84CC;
const GLenum TEXTURE13 = 0x84CD;
const GLenum TEXTURE14 = 0x84CE;
const GLenum TEXTURE15 = 0x84CF;
const GLenum TEXTURE16 = 0x84D0;
const GLenum TEXTURE17 = 0x84D1;
const GLenum TEXTURE18 = 0x84D2;
const GLenum TEXTURE19 = 0x84D3;
const GLenum TEXTURE20 = 0x84D4;
const GLenum TEXTURE21 = 0x84D5;
const GLenum TEXTURE22 = 0x84D6;
const GLenum TEXTURE23 = 0x84D7;
const GLenum TEXTURE24 = 0x84D8;
const GLenum TEXTURE25 = 0x84D9;
const GLenum TEXTURE26 = 0x84DA;
const GLenum TEXTURE27 = 0x84DB;
const GLenum TEXTURE28 = 0x84DC;
const GLenum TEXTURE29 = 0x84DD;
const GLenum TEXTURE30 = 0x84DE;
const GLenum TEXTURE31 = 0x84DF;
const GLenum ACTIVE_TEXTURE = 0x84E0;
/* TextureWrapMode */
const GLenum REPEAT = 0x2901;
const GLenum CLAMP_TO_EDGE = 0x812F;
const GLenum MIRRORED_REPEAT = 0x8370;
/* Uniform Types */
const GLenum FLOAT_VEC2 = 0x8B50;
const GLenum FLOAT_VEC3 = 0x8B51;
const GLenum FLOAT_VEC4 = 0x8B52;
const GLenum INT_VEC2 = 0x8B53;
const GLenum INT_VEC3 = 0x8B54;
const GLenum INT_VEC4 = 0x8B55;
const GLenum BOOL = 0x8B56;
const GLenum BOOL_VEC2 = 0x8B57;
const GLenum BOOL_VEC3 = 0x8B58;
const GLenum BOOL_VEC4 = 0x8B59;
const GLenum FLOAT_MAT2 = 0x8B5A;
const GLenum FLOAT_MAT3 = 0x8B5B;
const GLenum FLOAT_MAT4 = 0x8B5C;
const GLenum SAMPLER_2D = 0x8B5E;
const GLenum SAMPLER_CUBE = 0x8B60;
/* Vertex Arrays */
const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
/* Read Format */
const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
/* Shader Source */
const GLenum COMPILE_STATUS = 0x8B81;
/* Shader Precision-Specified Types */
const GLenum LOW_FLOAT = 0x8DF0;
const GLenum MEDIUM_FLOAT = 0x8DF1;
const GLenum HIGH_FLOAT = 0x8DF2;
const GLenum LOW_INT = 0x8DF3;
const GLenum MEDIUM_INT = 0x8DF4;
const GLenum HIGH_INT = 0x8DF5;
/* Framebuffer Object. */
const GLenum FRAMEBUFFER = 0x8D40;
const GLenum RENDERBUFFER = 0x8D41;
const GLenum RGBA4 = 0x8056;
const GLenum RGB5_A1 = 0x8057;
const GLenum RGB565 = 0x8D62;
const GLenum DEPTH_COMPONENT16 = 0x81A5;
const GLenum STENCIL_INDEX8 = 0x8D48;
const GLenum DEPTH_STENCIL = 0x84F9;
const GLenum RENDERBUFFER_WIDTH = 0x8D42;
const GLenum RENDERBUFFER_HEIGHT = 0x8D43;
const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
const GLenum RENDERBUFFER_RED_SIZE = 0x8D50;
const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51;
const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52;
const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53;
const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54;
const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55;
const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
const GLenum COLOR_ATTACHMENT0 = 0x8CE0;
const GLenum DEPTH_ATTACHMENT = 0x8D00;
const GLenum STENCIL_ATTACHMENT = 0x8D20;
const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
const GLenum NONE = 0;
const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5;
const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
const GLenum FRAMEBUFFER_BINDING = 0x8CA6;
const GLenum RENDERBUFFER_BINDING = 0x8CA7;
const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8;
const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506;
/* WebGL-specific enums */
const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240;
const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
const GLenum CONTEXT_LOST_WEBGL = 0x9242;
const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
readonly attribute HTMLCanvasElement canvas;
readonly attribute GLsizei drawingBufferWidth;
readonly attribute GLsizei drawingBufferHeight;
[WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes();
[WebGLHandlesContextLoss] boolean isContextLost();
sequence<DOMString>? getSupportedExtensions();
object? getExtension(DOMString name);
void activeTexture(GLenum texture);
void attachShader(WebGLProgram program, WebGLShader shader);
void bindAttribLocation(WebGLProgram program, GLuint index, DOMString name);
void bindBuffer(GLenum target, WebGLBuffer? buffer);
void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
void bindTexture(GLenum target, WebGLTexture? texture);
void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void blendEquation(GLenum mode);
void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
void blendFunc(GLenum sfactor, GLenum dfactor);
void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
GLenum srcAlpha, GLenum dstAlpha);
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferData(GLenum target, [AllowShared] BufferSource? data, GLenum usage);
void bufferSubData(GLenum target, GLintptr offset, [AllowShared] BufferSource data);
[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
void clear(GLbitfield mask);
void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void clearDepth(GLclampf depth);
void clearStencil(GLint s);
void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void compileShader(WebGLShader shader);
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLint border,
[AllowShared] ArrayBufferView data);
void compressedTexSubImage2D(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format,
[AllowShared] ArrayBufferView data);
void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border);
void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height);
WebGLBuffer? createBuffer();
WebGLFramebuffer? createFramebuffer();
WebGLProgram? createProgram();
WebGLRenderbuffer? createRenderbuffer();
WebGLShader? createShader(GLenum type);
WebGLTexture? createTexture();
void cullFace(GLenum mode);
void deleteBuffer(WebGLBuffer? buffer);
void deleteFramebuffer(WebGLFramebuffer? framebuffer);
void deleteProgram(WebGLProgram? program);
void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
void deleteShader(WebGLShader? shader);
void deleteTexture(WebGLTexture? texture);
void depthFunc(GLenum func);
void depthMask(GLboolean flag);
void depthRange(GLclampf zNear, GLclampf zFar);
void detachShader(WebGLProgram program, WebGLShader shader);
void disable(GLenum cap);
void disableVertexAttribArray(GLuint index);
void drawArrays(GLenum mode, GLint first, GLsizei count);
void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
void enable(GLenum cap);
void enableVertexAttribArray(GLuint index);
void finish();
void flush();
void framebufferRenderbuffer(GLenum target, GLenum attachment,
GLenum renderbuffertarget,
WebGLRenderbuffer? renderbuffer);
void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
WebGLTexture? texture, GLint level);
void frontFace(GLenum mode);
void generateMipmap(GLenum target);
WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index);
WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index);
sequence<WebGLShader>? getAttachedShaders(WebGLProgram program);
[WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name);
any getBufferParameter(GLenum target, GLenum pname);
any getParameter(GLenum pname);
[WebGLHandlesContextLoss] GLenum getError();
any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
GLenum pname);
any getProgramParameter(WebGLProgram program, GLenum pname);
DOMString? getProgramInfoLog(WebGLProgram program);
any getRenderbufferParameter(GLenum target, GLenum pname);
any getShaderParameter(WebGLShader shader, GLenum pname);
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
DOMString? getShaderInfoLog(WebGLShader shader);
DOMString? getShaderSource(WebGLShader shader);
any getTexParameter(GLenum target, GLenum pname);
any getUniform(WebGLProgram program, WebGLUniformLocation location);
WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name);
any getVertexAttrib(GLuint index, GLenum pname);
[WebGLHandlesContextLoss] GLintptr getVertexAttribOffset(GLuint index, GLenum pname);
void hint(GLenum target, GLenum mode);
[WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
[WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
[WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
[WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
[WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
[WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
[WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
void lineWidth(GLfloat width);
void linkProgram(WebGLProgram program);
void pixelStorei(GLenum pname, GLint param);
void polygonOffset(GLfloat factor, GLfloat units);
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
void renderbufferStorage(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height);
void sampleCoverage(GLclampf value, GLboolean invert);
void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
void shaderSource(WebGLShader shader, DOMString source);
void stencilFunc(GLenum func, GLint ref, GLuint mask);
void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
void stencilMask(GLuint mask);
void stencilMaskSeparate(GLenum face, GLuint mask);
void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border, GLenum format,
GLenum type, [AllowShared] ArrayBufferView? pixels);
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
void texParameterf(GLenum target, GLenum pname, GLfloat param);
void texParameteri(GLenum target, GLenum pname, GLint param);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
void uniform1f(WebGLUniformLocation? location, GLfloat x);
void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void uniform1i(WebGLUniformLocation? location, GLint x);
void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
void uniform1fv(WebGLUniformLocation? location, Float32List v);
void uniform2fv(WebGLUniformLocation? location, Float32List v);
void uniform3fv(WebGLUniformLocation? location, Float32List v);
void uniform4fv(WebGLUniformLocation? location, Float32List v);
void uniform1iv(WebGLUniformLocation? location, Int32List v);
void uniform2iv(WebGLUniformLocation? location, Int32List v);
void uniform3iv(WebGLUniformLocation? location, Int32List v);
void uniform4iv(WebGLUniformLocation? location, Int32List v);
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
void useProgram(WebGLProgram? program);
void validateProgram(WebGLProgram program);
void vertexAttrib1f(GLuint index, GLfloat x);
void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void vertexAttrib1fv(GLuint index, Float32List values);
void vertexAttrib2fv(GLuint index, Float32List values);
void vertexAttrib3fv(GLuint index, Float32List values);
void vertexAttrib4fv(GLuint index, Float32List values);
void vertexAttribPointer(GLuint index, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, GLintptr offset);
void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
};
interface WebGLRenderingContext
{
};
WebGLRenderingContext includes WebGLRenderingContextBase;
[Constructor(DOMString type, optional WebGLContextEventInit eventInit)]
interface WebGLContextEvent : Event {
readonly attribute DOMString statusMessage;
};
// EventInit is defined in the DOM4 specification.
dictionary WebGLContextEventInit : EventInit {
DOMString statusMessage = "";
};

Просмотреть файл

@ -0,0 +1,580 @@
// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile
//
// WebGL IDL definitions scraped from the Khronos specification:
// https://www.khronos.org/registry/webgl/specs/latest/
//
// This IDL depends on the typed array specification defined at:
// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl
typedef long long GLint64;
typedef unsigned long long GLuint64;
interface WebGLQuery : WebGLObject {
};
interface WebGLSampler : WebGLObject {
};
interface WebGLSync : WebGLObject {
};
interface WebGLTransformFeedback : WebGLObject {
};
interface WebGLVertexArrayObject : WebGLObject {
};
typedef ([AllowShared] Uint32Array or sequence<GLuint>) Uint32List;
interface mixin WebGL2RenderingContextBase
{
const GLenum READ_BUFFER = 0x0C02;
const GLenum UNPACK_ROW_LENGTH = 0x0CF2;
const GLenum UNPACK_SKIP_ROWS = 0x0CF3;
const GLenum UNPACK_SKIP_PIXELS = 0x0CF4;
const GLenum PACK_ROW_LENGTH = 0x0D02;
const GLenum PACK_SKIP_ROWS = 0x0D03;
const GLenum PACK_SKIP_PIXELS = 0x0D04;
const GLenum COLOR = 0x1800;
const GLenum DEPTH = 0x1801;
const GLenum STENCIL = 0x1802;
const GLenum RED = 0x1903;
const GLenum RGB8 = 0x8051;
const GLenum RGBA8 = 0x8058;
const GLenum RGB10_A2 = 0x8059;
const GLenum TEXTURE_BINDING_3D = 0x806A;
const GLenum UNPACK_SKIP_IMAGES = 0x806D;
const GLenum UNPACK_IMAGE_HEIGHT = 0x806E;
const GLenum TEXTURE_3D = 0x806F;
const GLenum TEXTURE_WRAP_R = 0x8072;
const GLenum MAX_3D_TEXTURE_SIZE = 0x8073;
const GLenum UNSIGNED_INT_2_10_10_10_REV = 0x8368;
const GLenum MAX_ELEMENTS_VERTICES = 0x80E8;
const GLenum MAX_ELEMENTS_INDICES = 0x80E9;
const GLenum TEXTURE_MIN_LOD = 0x813A;
const GLenum TEXTURE_MAX_LOD = 0x813B;
const GLenum TEXTURE_BASE_LEVEL = 0x813C;
const GLenum TEXTURE_MAX_LEVEL = 0x813D;
const GLenum MIN = 0x8007;
const GLenum MAX = 0x8008;
const GLenum DEPTH_COMPONENT24 = 0x81A6;
const GLenum MAX_TEXTURE_LOD_BIAS = 0x84FD;
const GLenum TEXTURE_COMPARE_MODE = 0x884C;
const GLenum TEXTURE_COMPARE_FUNC = 0x884D;
const GLenum CURRENT_QUERY = 0x8865;
const GLenum QUERY_RESULT = 0x8866;
const GLenum QUERY_RESULT_AVAILABLE = 0x8867;
const GLenum STREAM_READ = 0x88E1;
const GLenum STREAM_COPY = 0x88E2;
const GLenum STATIC_READ = 0x88E5;
const GLenum STATIC_COPY = 0x88E6;
const GLenum DYNAMIC_READ = 0x88E9;
const GLenum DYNAMIC_COPY = 0x88EA;
const GLenum MAX_DRAW_BUFFERS = 0x8824;
const GLenum DRAW_BUFFER0 = 0x8825;
const GLenum DRAW_BUFFER1 = 0x8826;
const GLenum DRAW_BUFFER2 = 0x8827;
const GLenum DRAW_BUFFER3 = 0x8828;
const GLenum DRAW_BUFFER4 = 0x8829;
const GLenum DRAW_BUFFER5 = 0x882A;
const GLenum DRAW_BUFFER6 = 0x882B;
const GLenum DRAW_BUFFER7 = 0x882C;
const GLenum DRAW_BUFFER8 = 0x882D;
const GLenum DRAW_BUFFER9 = 0x882E;
const GLenum DRAW_BUFFER10 = 0x882F;
const GLenum DRAW_BUFFER11 = 0x8830;
const GLenum DRAW_BUFFER12 = 0x8831;
const GLenum DRAW_BUFFER13 = 0x8832;
const GLenum DRAW_BUFFER14 = 0x8833;
const GLenum DRAW_BUFFER15 = 0x8834;
const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49;
const GLenum MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A;
const GLenum SAMPLER_3D = 0x8B5F;
const GLenum SAMPLER_2D_SHADOW = 0x8B62;
const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B;
const GLenum PIXEL_PACK_BUFFER = 0x88EB;
const GLenum PIXEL_UNPACK_BUFFER = 0x88EC;
const GLenum PIXEL_PACK_BUFFER_BINDING = 0x88ED;
const GLenum PIXEL_UNPACK_BUFFER_BINDING = 0x88EF;
const GLenum FLOAT_MAT2x3 = 0x8B65;
const GLenum FLOAT_MAT2x4 = 0x8B66;
const GLenum FLOAT_MAT3x2 = 0x8B67;
const GLenum FLOAT_MAT3x4 = 0x8B68;
const GLenum FLOAT_MAT4x2 = 0x8B69;
const GLenum FLOAT_MAT4x3 = 0x8B6A;
const GLenum SRGB = 0x8C40;
const GLenum SRGB8 = 0x8C41;
const GLenum SRGB8_ALPHA8 = 0x8C43;
const GLenum COMPARE_REF_TO_TEXTURE = 0x884E;
const GLenum RGBA32F = 0x8814;
const GLenum RGB32F = 0x8815;
const GLenum RGBA16F = 0x881A;
const GLenum RGB16F = 0x881B;
const GLenum VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD;
const GLenum MAX_ARRAY_TEXTURE_LAYERS = 0x88FF;
const GLenum MIN_PROGRAM_TEXEL_OFFSET = 0x8904;
const GLenum MAX_PROGRAM_TEXEL_OFFSET = 0x8905;
const GLenum MAX_VARYING_COMPONENTS = 0x8B4B;
const GLenum TEXTURE_2D_ARRAY = 0x8C1A;
const GLenum TEXTURE_BINDING_2D_ARRAY = 0x8C1D;
const GLenum R11F_G11F_B10F = 0x8C3A;
const GLenum UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;
const GLenum RGB9_E5 = 0x8C3D;
const GLenum UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;
const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F;
const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80;
const GLenum TRANSFORM_FEEDBACK_VARYINGS = 0x8C83;
const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84;
const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85;
const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88;
const GLenum RASTERIZER_DISCARD = 0x8C89;
const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A;
const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B;
const GLenum INTERLEAVED_ATTRIBS = 0x8C8C;
const GLenum SEPARATE_ATTRIBS = 0x8C8D;
const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E;
const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F;
const GLenum RGBA32UI = 0x8D70;
const GLenum RGB32UI = 0x8D71;
const GLenum RGBA16UI = 0x8D76;
const GLenum RGB16UI = 0x8D77;
const GLenum RGBA8UI = 0x8D7C;
const GLenum RGB8UI = 0x8D7D;
const GLenum RGBA32I = 0x8D82;
const GLenum RGB32I = 0x8D83;
const GLenum RGBA16I = 0x8D88;
const GLenum RGB16I = 0x8D89;
const GLenum RGBA8I = 0x8D8E;
const GLenum RGB8I = 0x8D8F;
const GLenum RED_INTEGER = 0x8D94;
const GLenum RGB_INTEGER = 0x8D98;
const GLenum RGBA_INTEGER = 0x8D99;
const GLenum SAMPLER_2D_ARRAY = 0x8DC1;
const GLenum SAMPLER_2D_ARRAY_SHADOW = 0x8DC4;
const GLenum SAMPLER_CUBE_SHADOW = 0x8DC5;
const GLenum UNSIGNED_INT_VEC2 = 0x8DC6;
const GLenum UNSIGNED_INT_VEC3 = 0x8DC7;
const GLenum UNSIGNED_INT_VEC4 = 0x8DC8;
const GLenum INT_SAMPLER_2D = 0x8DCA;
const GLenum INT_SAMPLER_3D = 0x8DCB;
const GLenum INT_SAMPLER_CUBE = 0x8DCC;
const GLenum INT_SAMPLER_2D_ARRAY = 0x8DCF;
const GLenum UNSIGNED_INT_SAMPLER_2D = 0x8DD2;
const GLenum UNSIGNED_INT_SAMPLER_3D = 0x8DD3;
const GLenum UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4;
const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7;
const GLenum DEPTH_COMPONENT32F = 0x8CAC;
const GLenum DEPTH32F_STENCIL8 = 0x8CAD;
const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;
const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210;
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211;
const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212;
const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213;
const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214;
const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215;
const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216;
const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217;
const GLenum FRAMEBUFFER_DEFAULT = 0x8218;
const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
const GLenum DEPTH_STENCIL = 0x84F9;
const GLenum UNSIGNED_INT_24_8 = 0x84FA;
const GLenum DEPTH24_STENCIL8 = 0x88F0;
const GLenum UNSIGNED_NORMALIZED = 0x8C17;
const GLenum DRAW_FRAMEBUFFER_BINDING = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */
const GLenum READ_FRAMEBUFFER = 0x8CA8;
const GLenum DRAW_FRAMEBUFFER = 0x8CA9;
const GLenum READ_FRAMEBUFFER_BINDING = 0x8CAA;
const GLenum RENDERBUFFER_SAMPLES = 0x8CAB;
const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4;
const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF;
const GLenum COLOR_ATTACHMENT1 = 0x8CE1;
const GLenum COLOR_ATTACHMENT2 = 0x8CE2;
const GLenum COLOR_ATTACHMENT3 = 0x8CE3;
const GLenum COLOR_ATTACHMENT4 = 0x8CE4;
const GLenum COLOR_ATTACHMENT5 = 0x8CE5;
const GLenum COLOR_ATTACHMENT6 = 0x8CE6;
const GLenum COLOR_ATTACHMENT7 = 0x8CE7;
const GLenum COLOR_ATTACHMENT8 = 0x8CE8;
const GLenum COLOR_ATTACHMENT9 = 0x8CE9;
const GLenum COLOR_ATTACHMENT10 = 0x8CEA;
const GLenum COLOR_ATTACHMENT11 = 0x8CEB;
const GLenum COLOR_ATTACHMENT12 = 0x8CEC;
const GLenum COLOR_ATTACHMENT13 = 0x8CED;
const GLenum COLOR_ATTACHMENT14 = 0x8CEE;
const GLenum COLOR_ATTACHMENT15 = 0x8CEF;
const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56;
const GLenum MAX_SAMPLES = 0x8D57;
const GLenum HALF_FLOAT = 0x140B;
const GLenum RG = 0x8227;
const GLenum RG_INTEGER = 0x8228;
const GLenum R8 = 0x8229;
const GLenum RG8 = 0x822B;
const GLenum R16F = 0x822D;
const GLenum R32F = 0x822E;
const GLenum RG16F = 0x822F;
const GLenum RG32F = 0x8230;
const GLenum R8I = 0x8231;
const GLenum R8UI = 0x8232;
const GLenum R16I = 0x8233;
const GLenum R16UI = 0x8234;
const GLenum R32I = 0x8235;
const GLenum R32UI = 0x8236;
const GLenum RG8I = 0x8237;
const GLenum RG8UI = 0x8238;
const GLenum RG16I = 0x8239;
const GLenum RG16UI = 0x823A;
const GLenum RG32I = 0x823B;
const GLenum RG32UI = 0x823C;
const GLenum VERTEX_ARRAY_BINDING = 0x85B5;
const GLenum R8_SNORM = 0x8F94;
const GLenum RG8_SNORM = 0x8F95;
const GLenum RGB8_SNORM = 0x8F96;
const GLenum RGBA8_SNORM = 0x8F97;
const GLenum SIGNED_NORMALIZED = 0x8F9C;
const GLenum COPY_READ_BUFFER = 0x8F36;
const GLenum COPY_WRITE_BUFFER = 0x8F37;
const GLenum COPY_READ_BUFFER_BINDING = 0x8F36; /* Same as COPY_READ_BUFFER */
const GLenum COPY_WRITE_BUFFER_BINDING = 0x8F37; /* Same as COPY_WRITE_BUFFER */
const GLenum UNIFORM_BUFFER = 0x8A11;
const GLenum UNIFORM_BUFFER_BINDING = 0x8A28;
const GLenum UNIFORM_BUFFER_START = 0x8A29;
const GLenum UNIFORM_BUFFER_SIZE = 0x8A2A;
const GLenum MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B;
const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D;
const GLenum MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E;
const GLenum MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F;
const GLenum MAX_UNIFORM_BLOCK_SIZE = 0x8A30;
const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31;
const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33;
const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34;
const GLenum ACTIVE_UNIFORM_BLOCKS = 0x8A36;
const GLenum UNIFORM_TYPE = 0x8A37;
const GLenum UNIFORM_SIZE = 0x8A38;
const GLenum UNIFORM_BLOCK_INDEX = 0x8A3A;
const GLenum UNIFORM_OFFSET = 0x8A3B;
const GLenum UNIFORM_ARRAY_STRIDE = 0x8A3C;
const GLenum UNIFORM_MATRIX_STRIDE = 0x8A3D;
const GLenum UNIFORM_IS_ROW_MAJOR = 0x8A3E;
const GLenum UNIFORM_BLOCK_BINDING = 0x8A3F;
const GLenum UNIFORM_BLOCK_DATA_SIZE = 0x8A40;
const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42;
const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43;
const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44;
const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46;
const GLenum INVALID_INDEX = 0xFFFFFFFF;
const GLenum MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122;
const GLenum MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125;
const GLenum MAX_SERVER_WAIT_TIMEOUT = 0x9111;
const GLenum OBJECT_TYPE = 0x9112;
const GLenum SYNC_CONDITION = 0x9113;
const GLenum SYNC_STATUS = 0x9114;
const GLenum SYNC_FLAGS = 0x9115;
const GLenum SYNC_FENCE = 0x9116;
const GLenum SYNC_GPU_COMMANDS_COMPLETE = 0x9117;
const GLenum UNSIGNALED = 0x9118;
const GLenum SIGNALED = 0x9119;
const GLenum ALREADY_SIGNALED = 0x911A;
const GLenum TIMEOUT_EXPIRED = 0x911B;
const GLenum CONDITION_SATISFIED = 0x911C;
const GLenum WAIT_FAILED = 0x911D;
const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001;
const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;
const GLenum ANY_SAMPLES_PASSED = 0x8C2F;
const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A;
const GLenum SAMPLER_BINDING = 0x8919;
const GLenum RGB10_A2UI = 0x906F;
const GLenum INT_2_10_10_10_REV = 0x8D9F;
const GLenum TRANSFORM_FEEDBACK = 0x8E22;
const GLenum TRANSFORM_FEEDBACK_PAUSED = 0x8E23;
const GLenum TRANSFORM_FEEDBACK_ACTIVE = 0x8E24;
const GLenum TRANSFORM_FEEDBACK_BINDING = 0x8E25;
const GLenum TEXTURE_IMMUTABLE_FORMAT = 0x912F;
const GLenum MAX_ELEMENT_INDEX = 0x8D6B;
const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF;
const GLint64 TIMEOUT_IGNORED = -1;
/* WebGL-specific enums */
const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247;
/* Buffer objects */
// WebGL1:
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferData(GLenum target, [AllowShared] BufferSource? srcData, GLenum usage);
void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] BufferSource srcData);
// WebGL2:
void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage, GLuint srcOffset,
optional GLuint length = 0);
void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] ArrayBufferView srcData,
GLuint srcOffset, optional GLuint length = 0);
void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset,
GLintptr writeOffset, GLsizeiptr size);
// MapBufferRange, in particular its read-only and write-only modes,
// can not be exposed safely to JavaScript. GetBufferSubData
// replaces it for the purpose of fetching data back from the GPU.
void getBufferSubData(GLenum target, GLintptr srcByteOffset, [AllowShared] ArrayBufferView dstBuffer,
optional GLuint dstOffset = 0, optional GLuint length = 0);
/* Framebuffer objects */
void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0,
GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
void framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level,
GLint layer);
void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments);
void invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments,
GLint x, GLint y, GLsizei width, GLsizei height);
void readBuffer(GLenum src);
/* Renderbuffer objects */
any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat,
GLsizei width, GLsizei height);
/* Texture objects */
void texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
GLsizei height);
void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth);
// WebGL1 legacy entrypoints:
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border, GLenum format,
GLenum type, [AllowShared] ArrayBufferView? pixels);
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
// WebGL2 entrypoints:
void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type, GLintptr pboOffset);
void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type,
TexImageSource source); // May throw DOMException
void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
GLuint srcOffset);
void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset);
void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLenum format, GLenum type,
TexImageSource source); // May throw DOMException
void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData);
void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
GLuint srcOffset);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLenum type, GLintptr pboOffset);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLenum type,
TexImageSource source); // May throw DOMException
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
GLuint srcOffset);
void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
GLintptr pboOffset);
void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
TexImageSource source); // May throw DOMException
void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
[AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0);
void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height);
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
GLsizei height, GLint border, GLsizei imageSize, GLintptr offset);
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
GLsizei height, GLint border, [AllowShared] ArrayBufferView srcData,
optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset);
void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData,
optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset);
void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format,
[AllowShared] ArrayBufferView srcData,
optional GLuint srcOffset = 0,
optional GLuint srcLengthOverride = 0);
void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLsizei imageSize, GLintptr offset);
void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
GLenum format, [AllowShared] ArrayBufferView srcData,
optional GLuint srcOffset = 0,
optional GLuint srcLengthOverride = 0);
/* Programs and shaders */
[WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name);
/* Uniforms */
void uniform1ui(WebGLUniformLocation? location, GLuint v0);
void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
/* Vertex attribs */
void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
void vertexAttribI4iv(GLuint index, Int32List values);
void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
void vertexAttribI4uiv(GLuint index, Uint32List values);
void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
/* Writing to the drawing buffer */
void vertexAttribDivisor(GLuint index, GLuint divisor);
void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount);
void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset);
/* Reading back pixels */
// WebGL1:
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
[AllowShared] ArrayBufferView? dstData);
// WebGL2:
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
GLintptr offset);
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
[AllowShared] ArrayBufferView dstData, GLuint dstOffset);
/* Multiple Render Targets */
void drawBuffers(sequence<GLenum> buffers);
void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values,
optional GLuint srcOffset = 0);
void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values,
optional GLuint srcOffset = 0);
void clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values,
optional GLuint srcOffset = 0);
void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
/* Query Objects */
WebGLQuery? createQuery();
void deleteQuery(WebGLQuery? query);
[WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query);
void beginQuery(GLenum target, WebGLQuery query);
void endQuery(GLenum target);
WebGLQuery? getQuery(GLenum target, GLenum pname);
any getQueryParameter(WebGLQuery query, GLenum pname);
/* Sampler Objects */
WebGLSampler? createSampler();
void deleteSampler(WebGLSampler? sampler);
[WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler);
void bindSampler(GLuint unit, WebGLSampler? sampler);
void samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param);
void samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param);
any getSamplerParameter(WebGLSampler sampler, GLenum pname);
/* Sync objects */
WebGLSync? fenceSync(GLenum condition, GLbitfield flags);
[WebGLHandlesContextLoss] GLboolean isSync(WebGLSync? sync);
void deleteSync(WebGLSync? sync);
GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout);
void waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout);
any getSyncParameter(WebGLSync sync, GLenum pname);
/* Transform Feedback */
WebGLTransformFeedback? createTransformFeedback();
void deleteTransformFeedback(WebGLTransformFeedback? tf);
[WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf);
void bindTransformFeedback (GLenum target, WebGLTransformFeedback? tf);
void beginTransformFeedback(GLenum primitiveMode);
void endTransformFeedback();
void transformFeedbackVaryings(WebGLProgram program, sequence<DOMString> varyings, GLenum bufferMode);
WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index);
void pauseTransformFeedback();
void resumeTransformFeedback();
/* Uniform Buffer Objects and Transform Feedback Buffers */
void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer);
void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size);
any getIndexedParameter(GLenum target, GLuint index);
sequence<GLuint>? getUniformIndices(WebGLProgram program, sequence<DOMString> uniformNames);
any getActiveUniforms(WebGLProgram program, sequence<GLuint> uniformIndices, GLenum pname);
GLuint getUniformBlockIndex(WebGLProgram program, DOMString uniformBlockName);
any getActiveUniformBlockParameter(WebGLProgram program, GLuint uniformBlockIndex, GLenum pname);
DOMString? getActiveUniformBlockName(WebGLProgram program, GLuint uniformBlockIndex);
void uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
/* Vertex Array Objects */
WebGLVertexArrayObject? createVertexArray();
void deleteVertexArray(WebGLVertexArrayObject? vertexArray);
[WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray);
void bindVertexArray(WebGLVertexArrayObject? array);
};
interface WebGL2RenderingContext
{
};
WebGL2RenderingContext includes WebGLRenderingContextBase;
WebGL2RenderingContext includes WebGL2RenderingContextBase;

61
third_party/rust/khronos_api/build.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,61 @@
// Copyright 2015 Brendan Zabarauskas and the gl-rs developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This build script is used to discover all of the accepted extensions
// described in the Khronos WebGL repository, and construct a static slice
// containing the XML specifications for all of them.
use std::env;
use std::fs::File;
use std::path::*;
use std::io::Write;
fn main() {
// Create and open a file in the output directory to contain our generated rust code
let dest = env::var("OUT_DIR").unwrap();
let mut file = File::create(&Path::new(&dest).join("webgl_exts.rs")).unwrap();
// Find the absolute path to the folder containing the WebGL extensions.
// The absolute path is needed, because we don't know where the output
// directory will be, and `include_bytes!(..)` resolves paths relative to the
// containing file.
let root = env::current_dir().unwrap().join("api_webgl/extensions");
// Generate a slice literal, looking like this:
// `&[&*include_bytes!(..), &*include_bytes!(..), ..]`
writeln!(file, "&[").unwrap();
// The slice will have one entry for each WebGL extension. To find the
// extensions we mirror the behaviour of the `api_webgl/extensions/find-exts`
// shell script.
for entry in root.read_dir().unwrap() {
let entry = entry.unwrap();
let path = entry.path();
let ext_name = path.file_name().unwrap().to_str().unwrap();
// Each item which is a directory, and is not named `template`, may be
// an extension.
if path.is_dir() && ext_name != "template" {
// If the directory contains a file named `extension.xml`, then this
// really is an extension.
let ext_path = path.join("extension.xml");
if ext_path.is_file() {
// Include the XML file, making sure to use an absolute path.
writeln!(file, "&*include_bytes!({:?}),", ext_path.to_str().unwrap()).unwrap();
}
}
}
// Close the slice
writeln!(file, "]").unwrap();
}

14
third_party/rust/khronos_api/src/lib.rs поставляемый
Просмотреть файл

@ -14,6 +14,9 @@
//! This crates contains the sources of the official OpenGL repository.
// NOTE: if any new files are added to here, ensue they are also covered
// in the `include` section of the `Cargo.toml`.
/// The contents of [`gl.xml`](https://github.com/KhronosGroup/OpenGL-Registry/blob/master/xml/gl.xml)
pub const GL_XML: &'static [u8] = include_bytes!("../api/xml/gl.xml");
@ -25,3 +28,14 @@ pub const WGL_XML: &'static [u8] = include_bytes!("../api/xml/wgl.xml");
/// The contents of [`glx.xml`](https://github.com/KhronosGroup/OpenGL-Registry/blob/master/xml/glx.xml)
pub const GLX_XML: &'static [u8] = include_bytes!("../api/xml/glx.xml");
/// The contents of [`webgl.idl`](https://github.com/KhronosGroup/WebGL/blob/master/specs/latest/1.0/webgl.idl)
pub const WEBGL_IDL: &'static [u8] = include_bytes!("../api_webgl/specs/latest/1.0/webgl.idl");
/// The contents of [`webgl2.idl`](https://github.com/KhronosGroup/WebGL/blob/master/specs/latest/2.0/webgl2.idl)
pub const WEBGL2_IDL: &'static [u8] = include_bytes!("../api_webgl/specs/latest/2.0/webgl2.idl");
/// The contents of the WebGL extension XML files
/// These are discovered via a build script to avoid having to list each extension by name.
pub const WEBGL_EXT_XML: &'static [&'static [u8]] =
include!(concat!(env!("OUT_DIR"), "/webgl_exts.rs"));

2
third_party/rust/serde/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"921c55ce109f76220ebcd8f8ba6d7e97816e804818ba33772266eb98413fd024","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/de/from_primitive.rs":"2ddd1b60696f125652ea69da94575d9a3b76ba667924860df112abc35f56b90b","src/de/ignored_any.rs":"864eaefef0aaae36daf0c2bdee08165dabbf60710f3217142d5e280c0a35c1fe","src/de/impls.rs":"6ea6a19598bb5393de2063deed32c82ebe904b56328ec033f57b55c0e6eea4d7","src/de/mod.rs":"e020b1f027d9e552ff024b44379e87969decf96e4c6cef0e2e7827e2dc4f56c3","src/de/utf8.rs":"956b124b7ce98353cb781b56e43a6fed2e67f1389d35b7a468d5be75b1485853","src/de/value.rs":"463e107e9ce9a56cc22901aeb60edbf0d10b144ca03dcdb78988d68f6c96022b","src/export.rs":"dd08253f225862aa5009b27900e04187480c96562c35205b71b36b2ac64c4cce","src/lib.rs":"22746e82049e9b3f9c60399f552e10fddb4c33a037d00b097f3fc8083d193138","src/macros.rs":"e1d542b1dac2c1d1f9d5ada7cc5b6639767fc67851421cc3adfb942a7cf750b6","src/private/de.rs":"8f2461ead2df284d7b1b84a293b921f0138c368f88af9efd5b82ae345fbcfd59","src/private/macros.rs":"6861a4f332ea24d0ed5db1c28fe3105d2716523902f045c0bbbd439ebf9e44de","src/private/mod.rs":"bcd7c54838e139475c23a323678e20eccbe88c0be93f7977f7675cead4d3b6ed","src/private/ser.rs":"e27af87342c199a494d0001c1684ee6573a3eb330723a86fca3c3b6add38df7a","src/ser/impls.rs":"aaeeb2dd86a86808a292db73764617cce81382a346d117c725f5b48dd7e69212","src/ser/impossible.rs":"009dce92e20bd25335db7d747c595111f5eb8d21dda0f6c75bccf0d0608c5751","src/ser/mod.rs":"97c36fa5b8da27f1f95be9af54c441c8e59437e9533cdd90e376691737fc3d0f"},"package":"800fdb0a894572994f3970035a8a5f65d8ec2cd40e6cdf7d8cd9001d7b30648e"}
{"files":{"Cargo.toml":"9f887308fedf41ae7ebb25832a4d47e8a231f7eb0f84abf2bc395de82b7194d5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"16de77b2d10fac8c70219ba183ad083ae12d4553c6f3213dec39d9936622b371","src/de/from_primitive.rs":"b254035b88fdfe97c22198b7ce7c1a0e27a539fff723205d405146a3fb8d10c4","src/de/ignored_any.rs":"864eaefef0aaae36daf0c2bdee08165dabbf60710f3217142d5e280c0a35c1fe","src/de/impls.rs":"ff23fa9da794debd1ec245f6af2b0c695c54683b02e4b4048642299722009aa5","src/de/mod.rs":"e020b1f027d9e552ff024b44379e87969decf96e4c6cef0e2e7827e2dc4f56c3","src/de/utf8.rs":"956b124b7ce98353cb781b56e43a6fed2e67f1389d35b7a468d5be75b1485853","src/de/value.rs":"d59160ab42411da0e125cb40e05453612f9733684199c4b100ab7af7042dd7ad","src/export.rs":"dd08253f225862aa5009b27900e04187480c96562c35205b71b36b2ac64c4cce","src/lib.rs":"77489f97b4d2fb2ea62c3aba7450a407211a6fa342d1066268b473d9c708762c","src/macros.rs":"e1d542b1dac2c1d1f9d5ada7cc5b6639767fc67851421cc3adfb942a7cf750b6","src/private/de.rs":"3602a9d56d72543108c6da106301c3da99968deac3163b86cd9b89f7e5e8b4a3","src/private/macros.rs":"6861a4f332ea24d0ed5db1c28fe3105d2716523902f045c0bbbd439ebf9e44de","src/private/mod.rs":"0c774d86042cefdb447857070a1d4d2c0b9f519a7f5db588a1e7fcc16ca5a511","src/private/ser.rs":"a45b683bc438741644c454fdad637dc62fff6c4e7516ab877609b81bc74e24a7","src/ser/impls.rs":"a7a958b3d5644dff059a7797521a788db3ae5777621ba5ebc791ed092bfecf9d","src/ser/impossible.rs":"009dce92e20bd25335db7d747c595111f5eb8d21dda0f6c75bccf0d0608c5751","src/ser/mod.rs":"97c36fa5b8da27f1f95be9af54c441c8e59437e9533cdd90e376691737fc3d0f"},"package":"d3bcee660dcde8f52c3765dd9ca5ee36b4bf35470a738eb0bd5a8752b0389645"}

2
third_party/rust/serde/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "serde"
version = "1.0.35"
version = "1.0.37"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
description = "A generic serialization/deserialization framework"

4
third_party/rust/serde/README.md поставляемый
Просмотреть файл

@ -1,9 +1,11 @@
# Serde &emsp; [![Build Status]][travis] [![Latest Version]][crates.io]
# Serde &emsp; [![Build Status]][travis] [![Latest Version]][crates.io] [![Rustc Version 1.13+]][rustc]
[Build Status]: https://api.travis-ci.org/serde-rs/serde.svg?branch=master
[travis]: https://travis-ci.org/serde-rs/serde
[Latest Version]: https://img.shields.io/crates/v/serde.svg
[crates.io]: https://crates.io/crates/serde
[Rustc Version 1.13+]: https://img.shields.io/badge/rustc-1.13+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2016/11/10/Rust-1.13.html
**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**

Просмотреть файл

@ -9,33 +9,33 @@
use lib::*;
macro_rules! int_to_int {
($dst:ident, $n:ident) => (
($dst:ident, $n:ident) => {
if $dst::min_value() as i64 <= $n as i64 && $n as i64 <= $dst::max_value() as i64 {
Some($n as $dst)
} else {
None
}
)
};
}
macro_rules! int_to_uint {
($dst:ident, $n:ident) => (
($dst:ident, $n:ident) => {
if 0 <= $n && $n as u64 <= $dst::max_value() as u64 {
Some($n as $dst)
} else {
None
}
)
};
}
macro_rules! uint_to {
($dst:ident, $n:ident) => (
($dst:ident, $n:ident) => {
if $n as u64 <= $dst::max_value() as u64 {
Some($n as $dst)
} else {
None
}
)
};
}
pub trait FromPrimitive: Sized {
@ -52,54 +52,144 @@ pub trait FromPrimitive: Sized {
}
macro_rules! impl_from_primitive_for_int {
($t:ident) => (
($t:ident) => {
impl FromPrimitive for $t {
#[inline] fn from_isize(n: isize) -> Option<Self> { int_to_int!($t, n) }
#[inline] fn from_i8(n: i8) -> Option<Self> { int_to_int!($t, n) }
#[inline] fn from_i16(n: i16) -> Option<Self> { int_to_int!($t, n) }
#[inline] fn from_i32(n: i32) -> Option<Self> { int_to_int!($t, n) }
#[inline] fn from_i64(n: i64) -> Option<Self> { int_to_int!($t, n) }
#[inline] fn from_usize(n: usize) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u8(n: u8) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u16(n: u16) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u32(n: u32) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u64(n: u64) -> Option<Self> { uint_to!($t, n) }
#[inline]
fn from_isize(n: isize) -> Option<Self> {
int_to_int!($t, n)
}
#[inline]
fn from_i8(n: i8) -> Option<Self> {
int_to_int!($t, n)
}
#[inline]
fn from_i16(n: i16) -> Option<Self> {
int_to_int!($t, n)
}
#[inline]
fn from_i32(n: i32) -> Option<Self> {
int_to_int!($t, n)
}
#[inline]
fn from_i64(n: i64) -> Option<Self> {
int_to_int!($t, n)
}
#[inline]
fn from_usize(n: usize) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u8(n: u8) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u16(n: u16) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u32(n: u32) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u64(n: u64) -> Option<Self> {
uint_to!($t, n)
}
}
)
};
}
macro_rules! impl_from_primitive_for_uint {
($t:ident) => (
($t:ident) => {
impl FromPrimitive for $t {
#[inline] fn from_isize(n: isize) -> Option<Self> { int_to_uint!($t, n) }
#[inline] fn from_i8(n: i8) -> Option<Self> { int_to_uint!($t, n) }
#[inline] fn from_i16(n: i16) -> Option<Self> { int_to_uint!($t, n) }
#[inline] fn from_i32(n: i32) -> Option<Self> { int_to_uint!($t, n) }
#[inline] fn from_i64(n: i64) -> Option<Self> { int_to_uint!($t, n) }
#[inline] fn from_usize(n: usize) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u8(n: u8) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u16(n: u16) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u32(n: u32) -> Option<Self> { uint_to!($t, n) }
#[inline] fn from_u64(n: u64) -> Option<Self> { uint_to!($t, n) }
#[inline]
fn from_isize(n: isize) -> Option<Self> {
int_to_uint!($t, n)
}
#[inline]
fn from_i8(n: i8) -> Option<Self> {
int_to_uint!($t, n)
}
#[inline]
fn from_i16(n: i16) -> Option<Self> {
int_to_uint!($t, n)
}
#[inline]
fn from_i32(n: i32) -> Option<Self> {
int_to_uint!($t, n)
}
#[inline]
fn from_i64(n: i64) -> Option<Self> {
int_to_uint!($t, n)
}
#[inline]
fn from_usize(n: usize) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u8(n: u8) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u16(n: u16) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u32(n: u32) -> Option<Self> {
uint_to!($t, n)
}
#[inline]
fn from_u64(n: u64) -> Option<Self> {
uint_to!($t, n)
}
}
)
};
}
macro_rules! impl_from_primitive_for_float {
($t:ident) => (
($t:ident) => {
impl FromPrimitive for $t {
#[inline] fn from_isize(n: isize) -> Option<Self> { Some(n as Self) }
#[inline] fn from_i8(n: i8) -> Option<Self> { Some(n as Self) }
#[inline] fn from_i16(n: i16) -> Option<Self> { Some(n as Self) }
#[inline] fn from_i32(n: i32) -> Option<Self> { Some(n as Self) }
#[inline] fn from_i64(n: i64) -> Option<Self> { Some(n as Self) }
#[inline] fn from_usize(n: usize) -> Option<Self> { Some(n as Self) }
#[inline] fn from_u8(n: u8) -> Option<Self> { Some(n as Self) }
#[inline] fn from_u16(n: u16) -> Option<Self> { Some(n as Self) }
#[inline] fn from_u32(n: u32) -> Option<Self> { Some(n as Self) }
#[inline] fn from_u64(n: u64) -> Option<Self> { Some(n as Self) }
#[inline]
fn from_isize(n: isize) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_i8(n: i8) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_i16(n: i16) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_i32(n: i32) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_i64(n: i64) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_usize(n: usize) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_u8(n: u8) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_u16(n: u16) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_u32(n: u32) -> Option<Self> {
Some(n as Self)
}
#[inline]
fn from_u64(n: u64) -> Option<Self> {
Some(n as Self)
}
}
)
};
}
impl_from_primitive_for_int!(isize);

66
third_party/rust/serde/src/de/impls.rs поставляемый
Просмотреть файл

@ -470,7 +470,11 @@ impl<'de> Deserialize<'de> for CString {
}
macro_rules! forwarded_impl {
(( $($id: ident),* ), $ty: ty, $func: expr) => {
(
$(#[doc = $doc:tt])*
( $($id: ident),* ), $ty: ty, $func: expr
) => {
$(#[doc = $doc])*
impl<'de $(, $id : Deserialize<'de>,)*> Deserialize<'de> for $ty {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
@ -1073,7 +1077,7 @@ map_impl!(
#[cfg(feature = "std")]
macro_rules! parse_ip_impl {
($ty:ty; $size: expr) => {
($ty:ty; $size:expr) => {
impl<'de> Deserialize<'de> for $ty {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
@ -1087,7 +1091,7 @@ macro_rules! parse_ip_impl {
}
}
}
}
};
}
#[cfg(feature = "std")]
@ -1230,7 +1234,7 @@ parse_ip_impl!(net::Ipv6Addr; 16);
#[cfg(feature = "std")]
macro_rules! parse_socket_impl {
($ty:ty, $new: expr) => {
($ty:ty, $new:expr) => {
impl<'de> Deserialize<'de> for $ty {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
@ -1244,7 +1248,7 @@ macro_rules! parse_socket_impl {
}
}
}
}
};
}
#[cfg(feature = "std")]
@ -1432,10 +1436,28 @@ forwarded_impl!((T), Box<[T]>, Vec::into_boxed_slice);
forwarded_impl!((), Box<str>, String::into_boxed_str);
#[cfg(all(not(feature = "unstable"), feature = "rc", any(feature = "std", feature = "alloc")))]
forwarded_impl!((T), Arc<T>, Arc::new);
forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Deserializing a data structure containing `Arc` will not attempt to
/// deduplicate `Arc` references to the same data. Every deserialized `Arc`
/// will end up with a strong count of 1.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
(T), Arc<T>, Arc::new
}
#[cfg(all(not(feature = "unstable"), feature = "rc", any(feature = "std", feature = "alloc")))]
forwarded_impl!((T), Rc<T>, Rc::new);
forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Deserializing a data structure containing `Rc` will not attempt to
/// deduplicate `Rc` references to the same data. Every deserialized `Rc`
/// will end up with a strong count of 1.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
(T), Rc<T>, Rc::new
}
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'de, 'a, T: ?Sized> Deserialize<'de> for Cow<'a, T>
@ -1456,7 +1478,11 @@ where
#[cfg(all(feature = "unstable", feature = "rc", any(feature = "std", feature = "alloc")))]
macro_rules! box_forwarded_impl {
($t:ident) => {
(
$(#[doc = $doc:tt])*
$t:ident
) => {
$(#[doc = $doc])*
impl<'de, T: ?Sized> Deserialize<'de> for $t<T>
where
Box<T>: Deserialize<'de>,
@ -1468,14 +1494,32 @@ macro_rules! box_forwarded_impl {
Box::deserialize(deserializer).map(Into::into)
}
}
}
};
}
#[cfg(all(feature = "unstable", feature = "rc", any(feature = "std", feature = "alloc")))]
box_forwarded_impl!(Rc);
box_forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Deserializing a data structure containing `Rc` will not attempt to
/// deduplicate `Rc` references to the same data. Every deserialized `Rc`
/// will end up with a strong count of 1.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
Rc
}
#[cfg(all(feature = "unstable", feature = "rc", any(feature = "std", feature = "alloc")))]
box_forwarded_impl!(Arc);
box_forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Deserializing a data structure containing `Arc` will not attempt to
/// deduplicate `Arc` references to the same data. Every deserialized `Arc`
/// will end up with a strong count of 1.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
Arc
}
////////////////////////////////////////////////////////////////////////////////

2
third_party/rust/serde/src/de/value.rs поставляемый
Просмотреть файл

@ -37,10 +37,10 @@
use lib::*;
use self::private::{First, Second};
use de::{self, Expected, IntoDeserializer, SeqAccess};
use private::de::size_hint;
use ser;
use self::private::{First, Second};
////////////////////////////////////////////////////////////////////////////////

48
third_party/rust/serde/src/lib.rs поставляемый
Просмотреть файл

@ -79,7 +79,7 @@
////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.35")]
#![doc(html_root_url = "https://docs.rs/serde/1.0.37")]
// Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and
@ -135,16 +135,16 @@ extern crate core;
/// module.
mod lib {
mod core {
#[cfg(feature = "std")]
pub use std::*;
#[cfg(not(feature = "std"))]
pub use core::*;
#[cfg(feature = "std")]
pub use std::*;
}
pub use self::core::{cmp, iter, mem, ops, slice, str};
pub use self::core::{f32, f64};
pub use self::core::{isize, i16, i32, i64, i8};
pub use self::core::{usize, u16, u32, u64, u8};
pub use self::core::{f32, f64};
pub use self::core::cell::{Cell, RefCell};
pub use self::core::clone::{self, Clone};
@ -155,40 +155,40 @@ mod lib {
pub use self::core::option::{self, Option};
pub use self::core::result::{self, Result};
#[cfg(feature = "std")]
pub use std::borrow::{Cow, ToOwned};
#[cfg(all(feature = "alloc", not(feature = "std")))]
pub use alloc::borrow::{Cow, ToOwned};
#[cfg(feature = "std")]
pub use std::string::String;
pub use std::borrow::{Cow, ToOwned};
#[cfg(all(feature = "alloc", not(feature = "std")))]
pub use alloc::string::{String, ToString};
#[cfg(feature = "std")]
pub use std::vec::Vec;
pub use std::string::String;
#[cfg(all(feature = "alloc", not(feature = "std")))]
pub use alloc::vec::Vec;
#[cfg(feature = "std")]
pub use std::boxed::Box;
pub use std::vec::Vec;
#[cfg(all(feature = "alloc", not(feature = "std")))]
pub use alloc::boxed::Box;
#[cfg(feature = "std")]
pub use std::boxed::Box;
#[cfg(all(feature = "rc", feature = "std"))]
pub use std::rc::Rc;
#[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))]
pub use alloc::rc::Rc;
#[cfg(all(feature = "rc", feature = "std"))]
pub use std::sync::Arc;
pub use std::rc::Rc;
#[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))]
pub use alloc::arc::Arc;
#[cfg(all(feature = "rc", feature = "std"))]
pub use std::sync::Arc;
#[cfg(feature = "std")]
pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};
#[cfg(all(feature = "alloc", not(feature = "std")))]
pub use alloc::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};
#[cfg(feature = "std")]
pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};
#[cfg(feature = "std")]
pub use std::{error, net};
@ -206,16 +206,16 @@ mod lib {
#[cfg(feature = "std")]
pub use std::path::{Path, PathBuf};
#[cfg(feature = "std")]
pub use std::time::{Duration, SystemTime, UNIX_EPOCH};
#[cfg(feature = "std")]
pub use std::sync::{Mutex, RwLock};
#[cfg(feature = "std")]
pub use std::time::{Duration, SystemTime, UNIX_EPOCH};
#[cfg(feature = "unstable")]
#[allow(deprecated)]
pub use core::nonzero::{NonZero, Zeroable};
#[cfg(feature = "unstable")]
pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroUsize};
pub use core::num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
}
////////////////////////////////////////////////////////////////////////////////
@ -223,13 +223,13 @@ mod lib {
#[macro_use]
mod macros;
pub mod ser;
pub mod de;
pub mod ser;
#[doc(inline)]
pub use ser::{Serialize, Serializer};
#[doc(inline)]
pub use de::{Deserialize, Deserializer};
#[doc(inline)]
pub use ser::{Serialize, Serializer};
// Generated code uses these to support no_std. Not public API.
#[doc(hidden)]

47
third_party/rust/serde/src/private/de.rs поставляемый
Просмотреть файл

@ -11,13 +11,13 @@ use lib::*;
use de::{Deserialize, DeserializeSeed, Deserializer, Error, IntoDeserializer, Visitor};
#[cfg(any(feature = "std", feature = "alloc"))]
use de::{Unexpected, MapAccess};
use de::{MapAccess, Unexpected};
#[cfg(any(feature = "std", feature = "alloc"))]
pub use self::content::{Content, ContentDeserializer, ContentRefDeserializer,
pub use self::content::{Content, ContentDeserializer, ContentRefDeserializer, EnumDeserializer,
InternallyTaggedUnitVisitor, TagContentOtherField,
TagContentOtherFieldVisitor, TagOrContentField, TagOrContentFieldVisitor,
TaggedContentVisitor, UntaggedUnitVisitor, EnumDeserializer};
TaggedContentVisitor, UntaggedUnitVisitor};
/// If the missing field is of type `Option<T>` then treat is as `None`,
/// otherwise it is an error.
@ -228,9 +228,9 @@ mod content {
use lib::*;
use super::size_hint;
use de::{self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, MapAccess, SeqAccess,
Unexpected, Visitor};
use super::size_hint;
/// Used from generated code to buffer the contents of the Deserializer when
/// deserializing untagged enums and internally tagged enums.
@ -1184,7 +1184,8 @@ mod content {
}
impl<'de, E> EnumDeserializer<'de, E>
where E: de::Error
where
E: de::Error,
{
pub fn new(variant: Content<'de>, value: Option<Content<'de>>) -> EnumDeserializer<'de, E> {
EnumDeserializer {
@ -2082,12 +2083,13 @@ where
#[cfg(any(feature = "std", feature = "alloc"))]
pub struct FlatMapDeserializer<'a, 'de: 'a, E>(
pub &'a mut Vec<Option<(Content<'de>, Content<'de>)>>,
pub PhantomData<E>
pub PhantomData<E>,
);
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
where E: Error
where
E: Error,
{
type Error = E;
@ -2102,7 +2104,7 @@ impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
self,
name: &'static str,
variants: &'static [&'static str],
visitor: V
visitor: V,
) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
@ -2113,15 +2115,12 @@ impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
// about.
let use_item = match *item {
None => false,
Some((ref c, _)) => c.as_str().map_or(false, |x| variants.contains(&x))
Some((ref c, _)) => c.as_str().map_or(false, |x| variants.contains(&x)),
};
if use_item {
let (key, value) = item.take().unwrap();
return visitor.visit_enum(EnumDeserializer::new(
key,
Some(value)
));
return visitor.visit_enum(EnumDeserializer::new(key, Some(value)));
}
}
@ -2142,7 +2141,7 @@ impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
self,
_: &'static str,
fields: &'static [&'static str],
visitor: V
visitor: V,
) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
@ -2150,11 +2149,7 @@ impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
visitor.visit_map(FlatMapAccess::new(self.0.iter_mut(), Some(fields)))
}
fn deserialize_newtype_struct<V>(
self,
_name: &str,
visitor: V,
) -> Result<V::Value, Self::Error>
fn deserialize_newtype_struct<V>(self, _name: &str, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
@ -2180,7 +2175,7 @@ pub struct FlatMapAccess<'a, 'de: 'a, E> {
impl<'a, 'de, E> FlatMapAccess<'a, 'de, E> {
fn new(
iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>,
fields: Option<&'static [&'static str]>
fields: Option<&'static [&'static str]>,
) -> FlatMapAccess<'a, 'de, E> {
FlatMapAccess {
iter: iter,
@ -2193,7 +2188,8 @@ impl<'a, 'de, E> FlatMapAccess<'a, 'de, E> {
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E>
where E: Error
where
E: Error,
{
type Error = E;
@ -2208,13 +2204,12 @@ impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E>
let use_item = match *item {
None => false,
Some((ref c, _)) => {
c.as_str().map_or(self.fields.is_none(), |key| {
match self.fields {
c.as_str()
.map_or(self.fields.is_none(), |key| match self.fields {
None => true,
Some(fields) if fields.contains(&key) => true,
_ => false
}
})
_ => false,
})
}
};

2
third_party/rust/serde/src/private/mod.rs поставляемый
Просмотреть файл

@ -8,5 +8,5 @@
mod macros;
pub mod ser;
pub mod de;
pub mod ser;

52
third_party/rust/serde/src/private/ser.rs поставляемый
Просмотреть файл

@ -11,12 +11,8 @@ use lib::*;
use ser::{self, Impossible, Serialize, SerializeMap, SerializeStruct, Serializer};
#[cfg(any(feature = "std", feature = "alloc"))]
use self::content::{
SerializeStructVariantAsMapValue,
SerializeTupleVariantAsMapValue,
ContentSerializer,
Content,
};
use self::content::{Content, ContentSerializer, SerializeStructVariantAsMapValue,
SerializeTupleVariantAsMapValue};
/// Used to check that serde(getter) attributes return the expected type.
/// Not public API.
@ -1042,16 +1038,20 @@ pub struct FlatMapSerializer<'a, M: 'a>(pub &'a mut M);
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, M> FlatMapSerializer<'a, M>
where
M: SerializeMap + 'a
M: SerializeMap + 'a,
{
fn bad_type(self, what: Unsupported) -> M::Error {
ser::Error::custom(format_args!("can only flatten structs and maps (got {})", what))
ser::Error::custom(format_args!(
"can only flatten structs and maps (got {})",
what
))
}
}
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, M> Serializer for FlatMapSerializer<'a, M>
where M: SerializeMap + 'a
where
M: SerializeMap + 'a,
{
type Ok = ();
type Error = M::Error;
@ -1219,7 +1219,10 @@ impl<'a, M> Serializer for FlatMapSerializer<'a, M>
_: usize,
) -> Result<Self::SerializeStructVariant, Self::Error> {
try!(self.0.serialize_key(inner_variant));
Ok(FlatMapSerializeStructVariantAsMapValue::new(self.0, inner_variant))
Ok(FlatMapSerializeStructVariantAsMapValue::new(
self.0,
inner_variant,
))
}
}
@ -1228,7 +1231,8 @@ pub struct FlatMapSerializeMap<'a, M: 'a>(&'a mut M);
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, M> ser::SerializeMap for FlatMapSerializeMap<'a, M>
where M: SerializeMap + 'a
where
M: SerializeMap + 'a,
{
type Ok = ();
type Error = M::Error;
@ -1257,12 +1261,17 @@ pub struct FlatMapSerializeStruct<'a, M: 'a>(&'a mut M);
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, M> ser::SerializeStruct for FlatMapSerializeStruct<'a, M>
where M: SerializeMap + 'a
where
M: SerializeMap + 'a,
{
type Ok = ();
type Error = M::Error;
fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), Self::Error>
fn serialize_field<T: ?Sized>(
&mut self,
key: &'static str,
value: &T,
) -> Result<(), Self::Error>
where
T: Serialize,
{
@ -1283,7 +1292,8 @@ pub struct FlatMapSerializeStructVariantAsMapValue<'a, M: 'a> {
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, M> FlatMapSerializeStructVariantAsMapValue<'a, M>
where M: SerializeMap + 'a
where
M: SerializeMap + 'a,
{
fn new(map: &'a mut M, name: &'static str) -> FlatMapSerializeStructVariantAsMapValue<'a, M> {
FlatMapSerializeStructVariantAsMapValue {
@ -1296,12 +1306,17 @@ impl<'a, M> FlatMapSerializeStructVariantAsMapValue<'a, M>
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, M> ser::SerializeStructVariant for FlatMapSerializeStructVariantAsMapValue<'a, M>
where M: SerializeMap + 'a
where
M: SerializeMap + 'a,
{
type Ok = ();
type Error = M::Error;
fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), Self::Error>
fn serialize_field<T: ?Sized>(
&mut self,
key: &'static str,
value: &T,
) -> Result<(), Self::Error>
where
T: Serialize,
{
@ -1311,7 +1326,10 @@ impl<'a, M> ser::SerializeStructVariant for FlatMapSerializeStructVariantAsMapVa
}
fn end(self) -> Result<(), Self::Error> {
try!(self.map.serialize_value(&Content::Struct(self.name, self.fields)));
try!(
self.map
.serialize_value(&Content::Struct(self.name, self.fields))
);
Ok(())
}
}

38
third_party/rust/serde/src/ser/impls.rs поставляемый
Просмотреть файл

@ -320,8 +320,12 @@ map_impl!(HashMap<K: Eq + Hash, V, H: BuildHasher>);
////////////////////////////////////////////////////////////////////////////////
macro_rules! deref_impl {
($($desc:tt)+) => {
impl $($desc)+ {
(
$(#[doc = $doc:tt])*
<$($desc:tt)+
) => {
$(#[doc = $doc])*
impl <$($desc)+ {
#[inline]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@ -340,10 +344,30 @@ deref_impl!(<'a, T: ?Sized> Serialize for &'a mut T where T: Serialize);
deref_impl!(<T: ?Sized> Serialize for Box<T> where T: Serialize);
#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))]
deref_impl!(<T: ?Sized> Serialize for Rc<T> where T: Serialize);
deref_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Serializing a data structure containing `Rc` will serialize a copy of
/// the contents of the `Rc` each time the `Rc` is referenced within the
/// data structure. Serialization will not attempt to deduplicate these
/// repeated data.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
<T: ?Sized> Serialize for Rc<T> where T: Serialize
}
#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))]
deref_impl!(<T: ?Sized> Serialize for Arc<T> where T: Serialize);
deref_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Serializing a data structure containing `Arc` will serialize a copy of
/// the contents of the `Arc` each time the `Arc` is referenced within the
/// data structure. Serialization will not attempt to deduplicate these
/// repeated data.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
<T: ?Sized> Serialize for Arc<T> where T: Serialize
}
#[cfg(any(feature = "std", feature = "alloc"))]
deref_impl!(<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwned);
@ -521,11 +545,9 @@ macro_rules! serialize_display_bounded_length {
// write! only provides fmt::Formatter to Display implementations, which
// has methods write_str and write_char but no method to write arbitrary
// bytes. Therefore `written` must be valid UTF-8.
let written_str = unsafe {
str::from_utf8_unchecked(written)
};
let written_str = unsafe { str::from_utf8_unchecked(written) };
$serializer.serialize_str(written_str)
}}
}};
}
#[cfg(feature = "std")]

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"cca09c175616b8390468aae4db4cb82688934de6f9e8bb70d7765e775d1304c9","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/bound.rs":"44373ac15601ad92d7862fa33b59219bce111a5d3d8a1de6386e3490a8e4fbf5","src/de.rs":"fbe74de7a3bbcfe2128f016782d24b0ba925f7976563766f728744889d107020","src/fragment.rs":"4e34eca12e6ac4bd89f55e85786cfb677e98182f21ce1f51c0573bca5a8bcd27","src/lib.rs":"389815c14539bc1b394a53fd838a2d97d10def55acf034b67e87435c9d8287fa","src/ser.rs":"190bd80a820cf05155506c34bf5f512c26bae10f67b5877929b0b859d70a8431"},"package":null}
{"files":{"Cargo.toml":"c987a2cf69dc2e3ad028ba1175e908c839861c7661211fd3c754a389518145d5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"16de77b2d10fac8c70219ba183ad083ae12d4553c6f3213dec39d9936622b371","src/bound.rs":"a0c2e547828d0e40c7f8998cdb13c051edc69cadf9e87e3d7e4c1058ae30898f","src/de.rs":"d4b7988a0b2bb970fb4d4c0345f53278ca3ebdee1140ad54e805a8cfe53d14df","src/fragment.rs":"4e34eca12e6ac4bd89f55e85786cfb677e98182f21ce1f51c0573bca5a8bcd27","src/lib.rs":"c02319fb2021036b21768c36925e79bc50b63cab18e263f9c7ee1358d55330c4","src/ser.rs":"f841abfbaab2286836bda12b2e0cac8c588640949c50bb85c6e9525d3f72fa6c"},"package":null}

10
third_party/rust/serde_derive/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "serde_derive"
version = "1.0.35" # remember to update html_root_url
version = "1.0.37" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT/Apache-2.0"
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
@ -23,10 +23,10 @@ name = "serde_derive"
proc-macro = true
[dependencies]
proc-macro2 = "0.2"
quote = "0.4"
serde_derive_internals = { version = "=0.22.1", default-features = false, path = "../serde_derive_internals" }
syn = { version = "0.12", features = ["visit"] }
proc-macro2 = "0.3"
quote = "0.5"
serde_derive_internals = { version = "=0.23.0", default-features = false, path = "../serde_derive_internals" }
syn = { version = "0.13", features = ["visit"] }
[dev-dependencies]
serde = { version = "1.0", path = "../serde" }

4
third_party/rust/serde_derive/README.md поставляемый
Просмотреть файл

@ -1,9 +1,11 @@
# Serde &emsp; [![Build Status]][travis] [![Latest Version]][crates.io]
# Serde &emsp; [![Build Status]][travis] [![Latest Version]][crates.io] [![Rustc Version 1.13+]][rustc]
[Build Status]: https://api.travis-ci.org/serde-rs/serde.svg?branch=master
[travis]: https://travis-ci.org/serde-rs/serde
[Latest Version]: https://img.shields.io/crates/v/serde.svg
[crates.io]: https://crates.io/crates/serde
[Rustc Version 1.13+]: https://img.shields.io/badge/rustc-1.13+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2016/11/10/Rust-1.13.html
**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**

46
third_party/rust/serde_derive/src/bound.rs поставляемый
Просмотреть файл

@ -14,7 +14,7 @@ use syn::punctuated::Punctuated;
use internals::ast::{Data, Container};
use internals::attr;
use proc_macro2::{Span, Term};
use proc_macro2::Span;
// Remove the default from every type parameter because in the generated impls
// they look like associated types: "error: associated type bindings are not
@ -44,15 +44,7 @@ pub fn with_where_predicates(
predicates: &[syn::WherePredicate],
) -> syn::Generics {
let mut generics = generics.clone();
if generics.where_clause.is_none() {
generics.where_clause = Some(syn::WhereClause {
where_token: Default::default(),
predicates: Punctuated::new(),
});
}
generics.where_clause
.as_mut()
.unwrap()
generics.make_where_clause()
.predicates
.extend(predicates.into_iter().cloned());
generics
@ -72,15 +64,7 @@ where
.flat_map(|predicates| predicates.to_vec());
let mut generics = generics.clone();
if generics.where_clause.is_none() {
generics.where_clause = Some(syn::WhereClause {
where_token: Default::default(),
predicates: Punctuated::new(),
});
}
generics.where_clause
.as_mut()
.unwrap()
generics.make_where_clause()
.predicates
.extend(predicates);
generics
@ -192,6 +176,7 @@ where
// the bound e.g. Serialize
bounds: vec![
syn::TypeParamBound::Trait(syn::TraitBound {
paren_token: None,
modifier: syn::TraitBoundModifier::None,
lifetimes: None,
path: bound.clone(),
@ -201,15 +186,7 @@ where
});
let mut generics = generics.clone();
if generics.where_clause.is_none() {
generics.where_clause = Some(syn::WhereClause {
where_token: Default::default(),
predicates: Punctuated::new(),
});
}
generics.where_clause
.as_mut()
.unwrap()
generics.make_where_clause()
.predicates
.extend(new_predicates);
generics
@ -221,15 +198,7 @@ pub fn with_self_bound(
bound: &syn::Path,
) -> syn::Generics {
let mut generics = generics.clone();
if generics.where_clause.is_none() {
generics.where_clause = Some(syn::WhereClause {
where_token: Default::default(),
predicates: Punctuated::new(),
});
}
generics.where_clause
.as_mut()
.unwrap()
generics.make_where_clause()
.predicates
.push(syn::WherePredicate::Type(syn::PredicateType {
lifetimes: None,
@ -239,6 +208,7 @@ pub fn with_self_bound(
// the bound e.g. Default
bounds: vec![
syn::TypeParamBound::Trait(syn::TraitBound {
paren_token: None,
modifier: syn::TraitBoundModifier::None,
lifetimes: None,
path: bound.clone(),
@ -249,7 +219,7 @@ pub fn with_self_bound(
}
pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Generics {
let bound = syn::Lifetime::new(Term::intern(lifetime), Span::def_site());
let bound = syn::Lifetime::new(lifetime, Span::call_site());
let def = syn::LifetimeDef {
attrs: Vec::new(),
lifetime: bound,

24
third_party/rust/serde_derive/src/de.rs поставляемый
Просмотреть файл

@ -10,7 +10,7 @@ use syn::{self, Ident, Index, Member};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use quote::{ToTokens, Tokens};
use proc_macro2::{Literal, Span, Term};
use proc_macro2::{Literal, Span};
use bound;
use fragment::{Expr, Fragment, Match, Stmts};
@ -31,7 +31,7 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result<Tokens, Str
let ident = &cont.ident;
let params = Parameters::new(&cont);
let (de_impl_generics, _, ty_generics, where_clause) = split_with_de_lifetime(&params);
let dummy_const = Ident::new(&format!("_IMPL_DESERIALIZE_FOR_{}", ident), Span::def_site());
let dummy_const = Ident::new(&format!("_IMPL_DESERIALIZE_FOR_{}", ident), Span::call_site());
let body = Stmts(deserialize_body(&cont, &params));
let delife = params.borrowed.de_lifetime();
@ -187,8 +187,8 @@ enum BorrowedLifetimes {
impl BorrowedLifetimes {
fn de_lifetime(&self) -> syn::Lifetime {
match *self {
BorrowedLifetimes::Borrowed(_) => syn::Lifetime::new(Term::intern("'de"), Span::def_site()),
BorrowedLifetimes::Static => syn::Lifetime::new(Term::intern("'static"), Span::def_site()),
BorrowedLifetimes::Borrowed(_) => syn::Lifetime::new("'de", Span::call_site()),
BorrowedLifetimes::Static => syn::Lifetime::new("'static", Span::call_site()),
}
}
@ -196,7 +196,7 @@ impl BorrowedLifetimes {
match *self {
BorrowedLifetimes::Borrowed(ref bounds) => Some(syn::LifetimeDef {
attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::intern("'de"), Span::def_site()),
lifetime: syn::Lifetime::new("'de", Span::call_site()),
colon_token: None,
bounds: bounds.iter().cloned().collect(),
}),
@ -571,7 +571,7 @@ fn deserialize_seq(
let visit = match field.attrs.deserialize_with() {
None => {
let field_ty = &field.ty;
let span = Span::def_site().located_at(field.original.span());
let span = field.original.span();
let func = quote_spanned!(span=> _serde::de::SeqAccess::next_element::<#field_ty>);
quote!(try!(#func(&mut __seq)))
}
@ -2544,7 +2544,7 @@ fn deserialize_map(
let visit = match field.attrs.deserialize_with() {
None => {
let field_ty = &field.ty;
let span = Span::def_site().located_at(field.original.span());
let span = field.original.span();
let func = quote_spanned!(span=> _serde::de::MapAccess::next_value::<#field_ty>);
quote! {
try!(#func(&mut __map))
@ -2873,7 +2873,7 @@ fn deserialize_map_in_place(
}
fn field_i(i: usize) -> Ident {
Ident::new(&format!("__field{}", i), Span::def_site())
Ident::new(&format!("__field{}", i), Span::call_site())
}
/// This function wraps the expression in `#[serde(deserialize_with = "...")]`
@ -2989,7 +2989,7 @@ fn expr_is_missing(field: &Field, cattrs: &attr::Container) -> Fragment {
let name = field.attrs.name().deserialize_name();
match field.attrs.deserialize_with() {
None => {
let span = Span::def_site().located_at(field.original.span());
let span = field.original.span();
let func = quote_spanned!(span=> _serde::private::de::missing_field);
quote_expr! {
try!(#func(#name))
@ -3072,7 +3072,7 @@ impl<'a> ToTokens for DeTypeGenerics<'a> {
if self.0.borrowed.de_lifetime_def().is_some() {
let def = syn::LifetimeDef {
attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::intern("'de"), Span::def_site()),
lifetime: syn::Lifetime::new("'de", Span::call_site()),
colon_token: None,
bounds: Punctuated::new(),
};
@ -3098,7 +3098,7 @@ impl<'a> ToTokens for InPlaceTypeGenerics<'a> {
if self.0.borrowed.de_lifetime_def().is_some() {
let def = syn::LifetimeDef {
attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::intern("'de"), Span::def_site()),
lifetime: syn::Lifetime::new("'de", Span::call_site()),
colon_token: None,
bounds: Punctuated::new(),
};
@ -3123,7 +3123,7 @@ impl<'a> DeTypeGenerics<'a> {
fn place_lifetime() -> syn::LifetimeDef {
syn::LifetimeDef {
attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::intern("'place"), Span::def_site()),
lifetime: syn::Lifetime::new("'place", Span::call_site()),
colon_token: None,
bounds: Punctuated::new(),
}

10
third_party/rust/serde_derive/src/lib.rs поставляемый
Просмотреть файл

@ -22,7 +22,7 @@
//!
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.35")]
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.37")]
#![cfg_attr(feature = "cargo-clippy", allow(enum_variant_names, redundant_field_names,
too_many_arguments, used_underscore_binding))]
// The `quote!` macro requires deep recursion.
@ -41,6 +41,14 @@ extern crate proc_macro2;
use proc_macro::TokenStream;
use syn::DeriveInput;
// Quote's default is def_site but it appears call_site is likely to stabilize
// before def_site. Thus we try to use only call_site.
macro_rules! quote {
($($tt:tt)*) => {
quote_spanned!($crate::proc_macro2::Span::call_site()=> $($tt)*)
}
}
#[macro_use]
mod bound;
#[macro_use]

22
third_party/rust/serde_derive/src/ser.rs поставляемый
Просмотреть файл

@ -27,7 +27,7 @@ pub fn expand_derive_serialize(input: &syn::DeriveInput) -> Result<Tokens, Strin
let ident = &cont.ident;
let params = Parameters::new(&cont);
let (impl_generics, ty_generics, where_clause) = params.generics.split_for_impl();
let dummy_const = Ident::new(&format!("_IMPL_SERIALIZE_FOR_{}", ident), Span::def_site());
let dummy_const = Ident::new(&format!("_IMPL_SERIALIZE_FOR_{}", ident), Span::call_site());
let body = Stmts(serialize_body(&cont, &params));
let impl_block = if let Some(remote) = cont.attrs.remote() {
@ -98,9 +98,9 @@ impl Parameters {
fn new(cont: &Container) -> Self {
let is_remote = cont.attrs.remote().is_some();
let self_var = if is_remote {
Ident::new("__self", Span::def_site())
Ident::new("__self", Span::call_site())
} else {
Ident::new("self", Span::def_site())
Ident::new("self", Span::call_site())
};
let this = match cont.attrs.remote() {
@ -212,7 +212,7 @@ fn serialize_newtype_struct(
field_expr = wrap_serialize_field_with(params, field.ty, path, &field_expr);
}
let span = Span::def_site().located_at(field.original.span());
let span = field.original.span();
let func = quote_spanned!(span=> _serde::Serializer::serialize_newtype_struct);
quote_expr! {
#func(__serializer, #type_name, #field_expr)
@ -386,7 +386,7 @@ fn serialize_variant(
}
Style::Tuple => {
let field_names =
(0..variant.fields.len()).map(|i| Ident::new(&format!("__field{}", i), Span::def_site()));
(0..variant.fields.len()).map(|i| Ident::new(&format!("__field{}", i), Span::call_site()));
quote! {
#this::#variant_ident(#(ref #field_names),*)
}
@ -619,9 +619,9 @@ fn serialize_adjacently_tagged_variant(
unreachable!()
}
}
Style::Newtype => vec![Ident::new("__field0", Span::def_site())],
Style::Newtype => vec![Ident::new("__field0", Span::call_site())],
Style::Tuple => (0..variant.fields.len())
.map(|i| Ident::new(&format!("__field{}", i), Span::def_site()))
.map(|i| Ident::new(&format!("__field{}", i), Span::call_site()))
.collect(),
Style::Struct => variant
.fields
@ -862,7 +862,7 @@ fn serialize_tuple_struct_visitor(
.enumerate()
.map(|(i, field)| {
let mut field_expr = if is_enum {
let id = Ident::new(&format!("__field{}", i), Span::def_site());
let id = Ident::new(&format!("__field{}", i), Span::call_site());
quote!(#id)
} else {
get_member(params, field, &Member::Unnamed(Index {
@ -880,7 +880,7 @@ fn serialize_tuple_struct_visitor(
field_expr = wrap_serialize_field_with(params, field.ty, path, &field_expr);
}
let span = Span::def_site().located_at(field.original.span());
let span = field.original.span();
let func = tuple_trait.serialize_element(span);
let ser = quote! {
try!(#func(&mut __serde_state, #field_expr));
@ -923,7 +923,7 @@ fn serialize_struct_visitor(
field_expr = wrap_serialize_field_with(params, field.ty, path, &field_expr);
}
let span = Span::def_site().located_at(field.original.span());
let span = field.original.span();
let ser = if field.attrs.flatten() {
quote! {
try!(_serde::Serialize::serialize(&#field_expr, _serde::private::ser::FlatMapSerializer(&mut __serde_state)));
@ -981,7 +981,7 @@ fn wrap_serialize_variant_with(
.map(|(i, field)| {
let id = field
.ident
.unwrap_or_else(|| Ident::new(&format!("__field{}", i), Span::def_site()));
.unwrap_or_else(|| Ident::new(&format!("__field{}", i), Span::call_site()));
quote!(#id)
})
.collect();

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"b9774130c25f51069e3d6d1617d9bbb63d89caf11a30dce332d4553f73f0d07c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/ast.rs":"30d0f819638c1e7482529f3449980e116cd106ad5f1b5552f653390af5387ba3","src/attr.rs":"0a18342c91f03960620f7baa307937806c17d52564f3dbe234c3e67480242d6a","src/case.rs":"03a97fc3996614153cc5bbd33b5df9d55954407c4d37c5a656f70cbc76817708","src/check.rs":"a7f296d4ca97eee073c7104d888b15022d279a2a04c27dacd11afaf897858461","src/ctxt.rs":"30b38bc10c9d90ec1186ad4ab2159339d65bfaa5a1a51b5900b0ca52fbe526d1","src/lib.rs":"9e4fbabbdbd0a5c7fd486bfd0715eb8278cc2a07a8cf5e5fdbdf6a543d123081"},"package":null}
{"files":{"Cargo.toml":"b6181854cc079edf36f860a097eeb30d5c11ebeb2ff50b0fc66b31dc9759f591","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"16de77b2d10fac8c70219ba183ad083ae12d4553c6f3213dec39d9936622b371","src/ast.rs":"797fa3bf82c221c2ba945d090a0f82fe0aec18f93dc63e7aec6dadf53349d184","src/attr.rs":"37ddb86938cafd37b6a8a0bdea1c4da41ae2b2d545913af1202854af1381092d","src/case.rs":"03a97fc3996614153cc5bbd33b5df9d55954407c4d37c5a656f70cbc76817708","src/check.rs":"9aa9943532a13fb54a18a45dc7dfd353c19e1a0b7b5b7efc419ebe5f4b2b4e91","src/ctxt.rs":"30b38bc10c9d90ec1186ad4ab2159339d65bfaa5a1a51b5900b0ca52fbe526d1","src/lib.rs":"65fee3b69b94e4b810dfe1ae970889bbd948725c4f6b9e0568b30e69f0fcaae4"},"package":null}

Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "serde_derive_internals"
version = "0.22.1" # remember to update html_root_url
version = "0.23.0" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT/Apache-2.0"
description = "AST representation used by Serde derive macros. Unstable."
@ -12,8 +12,8 @@ readme = "README.md"
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
[dependencies]
proc-macro2 = "0.2"
syn = { version = "0.12", default-features = false, features = ["derive", "parsing", "clone-impls", "extra-traits"] }
proc-macro2 = "0.3"
syn = { version = "0.13", default-features = false, features = ["derive", "parsing", "clone-impls", "extra-traits"] }
[badges]
travis-ci = { repository = "serde-rs/serde" }

Просмотреть файл

@ -1,9 +1,11 @@
# Serde &emsp; [![Build Status]][travis] [![Latest Version]][crates.io]
# Serde &emsp; [![Build Status]][travis] [![Latest Version]][crates.io] [![Rustc Version 1.13+]][rustc]
[Build Status]: https://api.travis-ci.org/serde-rs/serde.svg?branch=master
[travis]: https://travis-ci.org/serde-rs/serde
[Latest Version]: https://img.shields.io/crates/v/serde.svg
[crates.io]: https://crates.io/crates/serde
[Rustc Version 1.13+]: https://img.shields.io/badge/rustc-1.13+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2016/11/10/Rust-1.13.html
**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**

Просмотреть файл

@ -75,6 +75,9 @@ impl<'a> Container<'a> {
Data::Enum(_, ref mut variants) => for variant in variants {
variant.attrs.rename_by_rule(attrs.rename_all());
for field in &mut variant.fields {
if field.attrs.flatten() {
has_flatten = true;
}
field.attrs.rename_by_rule(variant.attrs.rename_all());
}
},

Просмотреть файл

@ -15,7 +15,7 @@ use syn::punctuated::Punctuated;
use syn::synom::{Synom, ParseError};
use std::collections::BTreeSet;
use std::str::FromStr;
use proc_macro2::{Span, TokenStream, TokenNode, TokenTree};
use proc_macro2::{Span, TokenStream, TokenTree, Group};
// This module handles parsing of `#[serde(...)]` attributes. The entrypoints
// are `attr::Container::from_ast`, `attr::Variant::from_ast`, and
@ -332,7 +332,11 @@ impl Container {
// Parse `#[serde(remote = "...")]`
Meta(NameValue(ref m)) if m.ident == "remote" => {
if let Ok(path) = parse_lit_into_path(cx, m.ident.as_ref(), &m.lit) {
remote.set(path);
if is_primitive_path(&path, "Self") {
remote.set(item.ident.into());
} else {
remote.set(path);
}
}
}
@ -935,10 +939,10 @@ impl Field {
leading_colon: None,
segments: Punctuated::new(),
};
path.segments.push(Ident::new("_serde", Span::def_site()).into());
path.segments.push(Ident::new("private", Span::def_site()).into());
path.segments.push(Ident::new("de", Span::def_site()).into());
path.segments.push(Ident::new("borrow_cow_str", Span::def_site()).into());
path.segments.push(Ident::new("_serde", Span::call_site()).into());
path.segments.push(Ident::new("private", Span::call_site()).into());
path.segments.push(Ident::new("de", Span::call_site()).into());
path.segments.push(Ident::new("borrow_cow_str", Span::call_site()).into());
let expr = syn::ExprPath {
attrs: Vec::new(),
qself: None,
@ -950,10 +954,10 @@ impl Field {
leading_colon: None,
segments: Punctuated::new(),
};
path.segments.push(Ident::new("_serde", Span::def_site()).into());
path.segments.push(Ident::new("private", Span::def_site()).into());
path.segments.push(Ident::new("de", Span::def_site()).into());
path.segments.push(Ident::new("borrow_cow_bytes", Span::def_site()).into());
path.segments.push(Ident::new("_serde", Span::call_site()).into());
path.segments.push(Ident::new("private", Span::call_site()).into());
path.segments.push(Ident::new("de", Span::call_site()).into());
path.segments.push(Ident::new("borrow_cow_bytes", Span::call_site()).into());
let expr = syn::ExprPath {
attrs: Vec::new(),
qself: None,
@ -1156,7 +1160,7 @@ fn parse_lit_into_where(
return Ok(Vec::new());
}
let where_string = syn::LitStr::new(&format!("where {}", string.value()), string.span);
let where_string = syn::LitStr::new(&format!("where {}", string.value()), string.span());
parse_lit_str::<syn::WhereClause>(&where_string)
.map(|wh| wh.predicates.into_iter().collect())
@ -1291,29 +1295,32 @@ fn is_rptr(ty: &syn::Type, elem: fn(&syn::Type) -> bool) -> bool {
}
fn is_str(ty: &syn::Type) -> bool {
is_primitive_path(ty, "str")
is_primitive_type(ty, "str")
}
fn is_slice_u8(ty: &syn::Type) -> bool {
match *ty {
syn::Type::Slice(ref ty) => is_primitive_path(&ty.elem, "u8"),
syn::Type::Slice(ref ty) => is_primitive_type(&ty.elem, "u8"),
_ => false,
}
}
fn is_primitive_path(ty: &syn::Type, primitive: &str) -> bool {
fn is_primitive_type(ty: &syn::Type, primitive: &str) -> bool {
match *ty {
syn::Type::Path(ref ty) => {
ty.qself.is_none()
&& ty.path.leading_colon.is_none()
&& ty.path.segments.len() == 1
&& ty.path.segments[0].ident == primitive
&& ty.path.segments[0].arguments.is_empty()
ty.qself.is_none() && is_primitive_path(&ty.path, primitive)
}
_ => false,
}
}
fn is_primitive_path(path: &syn::Path, primitive: &str) -> bool {
path.leading_colon.is_none()
&& path.segments.len() == 1
&& path.segments[0].ident == primitive
&& path.segments[0].arguments.is_empty()
}
// All lifetimes that this type could borrow from a Deserializer.
//
// For example a type `S<'a, 'b>` could borrow `'a` and `'b`. On the other hand
@ -1403,21 +1410,17 @@ where
fn spanned_tokens(s: &syn::LitStr) -> Result<TokenStream, ParseError> {
let stream = try!(syn::parse_str(&s.value()));
Ok(respan_token_stream(stream, s.span))
Ok(respan_token_stream(stream, s.span()))
}
fn respan_token_stream(stream: TokenStream, span: Span) -> TokenStream {
stream.into_iter().map(|token| respan_token_tree(token, span)).collect()
}
fn respan_token_tree(token: TokenTree, span: Span) -> TokenTree {
TokenTree {
span: span,
kind: match token.kind {
TokenNode::Group(delimiter, nested) => {
TokenNode::Group(delimiter, respan_token_stream(nested, span))
}
other => other,
},
fn respan_token_tree(mut token: TokenTree, span: Span) -> TokenTree {
if let TokenTree::Group(ref mut g) = token {
*g = Group::new(g.delimiter(), respan_token_stream(g.stream().clone(), span));
}
token.set_span(span);
token
}

Просмотреть файл

@ -45,13 +45,24 @@ fn check_getter(cx: &Ctxt, cont: &Container) {
fn check_flatten(cx: &Ctxt, cont: &Container) {
match cont.data {
Data::Enum(_, _) => {
assert!(!cont.attrs.has_flatten());
if cont.attrs.has_flatten() {
cx.error("#[serde(flatten)] cannot be used within enums");
}
}
Data::Struct(_, _) => {
Data::Struct(style, _) => {
for field in cont.data.all_fields() {
if !field.attrs.flatten() {
continue;
}
match style {
Style::Tuple => {
cx.error("#[serde(flatten)] cannot be used on tuple structs");
}
Style::Newtype => {
cx.error("#[serde(flatten)] cannot be used on newtype structs");
}
_ => {}
}
if field.attrs.skip_serializing() {
cx.error(
"#[serde(flatten] can not be combined with \

Просмотреть файл

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.22.1")]
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.23.0")]
#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity, doc_markdown, match_same_arms,
redundant_field_names))]