-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.html
6129 lines (5980 loc) · 814 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<title>WebXR Layers API Level 1</title>
<meta content="ED" name="w3c-status">
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
<link href="https://www.w3.org/2008/site/images/favicon.ico" rel="icon">
<meta content="Bikeshed version d9bd89757, updated Thu Mar 23 10:06:53 2023 -0700" name="generator">
<link href="https://www.w3.org/TR/webxrlayers-1/" rel="canonical">
<link href="favicon-32x32.png" rel="icon" sizes="32x32" type="image/png">
<link href="favicon-96x96.png" rel="icon" sizes="96x96" type="image/png">
<style>
.unstable::before {
content: "This section is not stable";
display: block;
font-weight: bold;
text-align: right;
color: red;
}
.unstable {
border: thin solid pink;
border-radius: .5em;
padding: .5em;
margin: .5em calc(-0.5em - 1px);
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='290'><text transform='rotate(-45)' text-anchor='middle' font-family='sans-serif' font-weight='bold' font-size='70' y='210' opacity='.1' fill='white'>Unstable</text></svg>");
background-repeat: repeat;
background-color: #282828;
}
@media (prefers-color-scheme: light) {
.unstable {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='290'><text transform='rotate(-45)' text-anchor='middle' font-family='sans-serif' font-weight='bold' font-size='70' y='210' opacity='.1'>Unstable</text></svg>");
background-color: #FFF4F4;
}
}
.unstable h3:first-of-type {
margin-top: 0.5rem;
}
.unstable.example:not(.no-marker)::before {
content: "Example " counter(example) " (Unstable)";
float: none;
}
.non-normative::before {
content: "This section is non-normative.";
font-style: italic;
}
.tg {
border-collapse: collapse;
border-spacing: 0;
}
.tg th {
border-style: solid;
border-width: 1px;
background: #90b8de;
color: #fff;
font-family: sans-serif;
font-weight: bold;
border-color: grey;
}
.tg td {
padding: 4px 5px;
background-color: rgb(221, 238, 255);
font-family: monospace;
border-style: solid;
border-width: 1px;
border-color: grey;
overflow: hidden;
word-break: normal;
}
</style>
<style>/* style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: var(--a-normal-text);
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "‘";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}
[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}
[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }
[data-link-type=biblio] {
white-space: pre;
}
</style>
<style>/* style-colors */
/* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */
:root {
color-scheme: light dark;
--text: black;
--bg: white;
--unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark);
--logo-bg: #1a5e9a;
--logo-active-bg: #c00;
--logo-text: white;
--tocnav-normal-text: #707070;
--tocnav-normal-bg: var(--bg);
--tocnav-hover-text: var(--tocnav-normal-text);
--tocnav-hover-bg: #f8f8f8;
--tocnav-active-text: #c00;
--tocnav-active-bg: var(--tocnav-normal-bg);
--tocsidebar-text: var(--text);
--tocsidebar-bg: #f7f8f9;
--tocsidebar-shadow: rgba(0,0,0,.1);
--tocsidebar-heading-text: hsla(203,20%,40%,.7);
--toclink-text: var(--text);
--toclink-underline: #3980b5;
--toclink-visited-text: var(--toclink-text);
--toclink-visited-underline: #054572;
--heading-text: #005a9c;
--hr-text: var(--text);
--algo-border: #def;
--del-text: red;
--del-bg: transparent;
--ins-text: #080;
--ins-bg: transparent;
--a-normal-text: #034575;
--a-normal-underline: #bbb;
--a-visited-text: var(--a-normal-text);
--a-visited-underline: #707070;
--a-hover-bg: rgba(75%, 75%, 75%, .25);
--a-active-text: #c00;
--a-active-underline: #c00;
--blockquote-border: silver;
--blockquote-bg: transparent;
--blockquote-text: currentcolor;
--issue-border: #e05252;
--issue-bg: #fbe9e9;
--issue-text: var(--text);
--issueheading-text: #831616;
--example-border: #e0cb52;
--example-bg: #fcfaee;
--example-text: var(--text);
--exampleheading-text: #574b0f;
--note-border: #52e052;
--note-bg: #e9fbe9;
--note-text: var(--text);
--noteheading-text: hsl(120, 70%, 30%);
--notesummary-underline: silver;
--assertion-border: #aaa;
--assertion-bg: #eee;
--assertion-text: black;
--advisement-border: orange;
--advisement-bg: #fec;
--advisement-text: var(--text);
--advisementheading-text: #b35f00;
--warning-border: red;
--warning-bg: hsla(40,100%,50%,0.95);
--warning-text: var(--text);
--amendment-border: #330099;
--amendment-bg: #F5F0FF;
--amendment-text: var(--text);
--amendmentheading-text: #220066;
--def-border: #8ccbf2;
--def-bg: #def;
--def-text: var(--text);
--defrow-border: #bbd7e9;
--datacell-border: silver;
--indexinfo-text: #707070;
--indextable-hover-text: black;
--indextable-hover-bg: #f7f8f9;
--outdatedspec-bg: rgba(0, 0, 0, .5);
--outdatedspec-text: black;
--outdated-bg: maroon;
--outdated-text: white;
--outdated-shadow: red;
--editedrec-bg: darkorange;
}
</style>
<style>/* style-counters */
body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}
.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}
figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}
</style>
<style>/* style-dfn-panel */
:root {
--dfnpanel-bg: #ddd;
--dfnpanel-text: var(--text);
}
.dfn-panel {
position: absolute;
z-index: 35;
width: 20em;
min-width: min-content;
max-width: 300px;
height: auto;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: var(--dfnpanel-bg);
color: var(--dfnpanel-text);
border: outset 0.2em;
white-space: normal; /* in case it's moved into a pre */
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: var(--dfnpanel-text); }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: 2em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-issues */
a[href].issue-return {
float: right;
float: inline-end;
color: var(--issueheading-text);
font-weight: bold;
text-decoration: none;
}
</style>
<style>/* style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}
</style>
<style>/* style-selflinks */
:root {
--selflink-text: white;
--selflink-bg: gray;
--selflink-hover-text: black;
}
.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
.example > a.self-link,
.note > a.self-link,
.issue > a.self-link {
/* These blocks are overflow:auto, so positioning outside
doesn't work. */
left: auto;
right: 0;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: var(--selflink-bg);
color: var(--selflink-text);
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: var(--selflink-hover-text);
}
a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight {
background: var(--borderedblock-bg, var(--def-bg));
}
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
.highlight:not(.idl) { background: rgba(0, 0, 0, .03); }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<style>/* style-var-click-highlighting */
var { cursor: pointer; }
var.selected0 { background-color: #F4D200; box-shadow: 0 0 0 2px #F4D200; }
var.selected1 { background-color: #FF87A2; box-shadow: 0 0 0 2px #FF87A2; }
var.selected2 { background-color: #96E885; box-shadow: 0 0 0 2px #96E885; }
var.selected3 { background-color: #3EEED2; box-shadow: 0 0 0 2px #3EEED2; }
var.selected4 { background-color: #EACFB6; box-shadow: 0 0 0 2px #EACFB6; }
var.selected5 { background-color: #82DDFF; box-shadow: 0 0 0 2px #82DDFF; }
var.selected6 { background-color: #FFBCF2; box-shadow: 0 0 0 2px #FFBCF2; }
</style>
<style>/* style-darkmode */
@media (prefers-color-scheme: dark) {
:root {
--text: #ddd;
--bg: black;
--unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E");
--logo-bg: #1a5e9a;
--logo-active-bg: #c00;
--logo-text: white;
--tocnav-normal-text: #999;
--tocnav-normal-bg: var(--bg);
--tocnav-hover-text: var(--tocnav-normal-text);
--tocnav-hover-bg: #080808;
--tocnav-active-text: #f44;
--tocnav-active-bg: var(--tocnav-normal-bg);
--tocsidebar-text: var(--text);
--tocsidebar-bg: #080808;
--tocsidebar-shadow: rgba(255,255,255,.1);
--tocsidebar-heading-text: hsla(203,20%,40%,.7);
--toclink-text: var(--text);
--toclink-underline: #6af;
--toclink-visited-text: var(--toclink-text);
--toclink-visited-underline: #054572;
--heading-text: #8af;
--hr-text: var(--text);
--algo-border: #456;
--del-text: #f44;
--del-bg: transparent;
--ins-text: #4a4;
--ins-bg: transparent;
--a-normal-text: #6af;
--a-normal-underline: #555;
--a-visited-text: var(--a-normal-text);
--a-visited-underline: var(--a-normal-underline);
--a-hover-bg: rgba(25%, 25%, 25%, .2);
--a-active-text: #f44;
--a-active-underline: var(--a-active-text);
--borderedblock-bg: rgba(255, 255, 255, .05);
--blockquote-border: silver;
--blockquote-bg: var(--borderedblock-bg);
--blockquote-text: currentcolor;
--issue-border: #e05252;
--issue-bg: var(--borderedblock-bg);
--issue-text: var(--text);
--issueheading-text: hsl(0deg, 70%, 70%);
--example-border: hsl(50deg, 90%, 60%);
--example-bg: var(--borderedblock-bg);
--example-text: var(--text);
--exampleheading-text: hsl(50deg, 70%, 70%);
--note-border: hsl(120deg, 100%, 35%);
--note-bg: var(--borderedblock-bg);
--note-text: var(--text);
--noteheading-text: hsl(120, 70%, 70%);
--notesummary-underline: silver;
--assertion-border: #444;
--assertion-bg: var(--borderedblock-bg);
--assertion-text: var(--text);
--advisement-border: orange;
--advisement-bg: #222218;
--advisement-text: var(--text);
--advisementheading-text: #f84;
--warning-border: red;
--warning-bg: hsla(40,100%,20%,0.95);
--warning-text: var(--text);
--amendment-border: #330099;
--amendment-bg: #080010;
--amendment-text: var(--text);
--amendmentheading-text: #cc00ff;
--def-border: #8ccbf2;
--def-bg: #080818;
--def-text: var(--text);
--defrow-border: #136;
--datacell-border: silver;
--indexinfo-text: #aaa;
--indextable-hover-text: var(--text);
--indextable-hover-bg: #181818;
--outdatedspec-bg: rgba(255, 255, 255, .5);
--outdatedspec-text: black;
--outdated-bg: maroon;
--outdated-text: white;
--outdated-shadow: red;
--editedrec-bg: darkorange;
}
/* In case a transparent-bg image doesn't expect to be on a dark bg,
which is quite common in practice... */
img { background: white; }
}
@media (prefers-color-scheme: dark) {
:root {
--selflink-text: black;
--selflink-bg: silver;
--selflink-hover-text: white;
}
}
@media (prefers-color-scheme: dark) {
:root {
--dfnpanel-bg: #222;
--dfnpanel-text: var(--text);
}
}
@media (prefers-color-scheme: dark) {
.highlight:not(.idl) { background: rgba(255, 255, 255, .05); }
c-[a] { color: #d33682 } /* Keyword.Declaration */
c-[b] { color: #d33682 } /* Keyword.Type */
c-[c] { color: #2aa198 } /* Comment */
c-[d] { color: #2aa198 } /* Comment.Multiline */
c-[e] { color: #268bd2 } /* Name.Attribute */
c-[f] { color: #b58900 } /* Name.Tag */
c-[g] { color: #cb4b16 } /* Name.Variable */
c-[k] { color: #d33682 } /* Keyword */
c-[l] { color: #657b83 } /* Literal */
c-[m] { color: #657b83 } /* Literal.Number */
c-[n] { color: #268bd2 } /* Name */
c-[o] { color: #657b83 } /* Operator */
c-[p] { color: #657b83 } /* Punctuation */
c-[s] { color: #6c71c4 } /* Literal.String */
c-[t] { color: #6c71c4 } /* Literal.String.Single */
c-[u] { color: #6c71c4 } /* Literal.String.Double */
c-[ch] { color: #2aa198 } /* Comment.Hashbang */
c-[cp] { color: #2aa198 } /* Comment.Preproc */
c-[cpf] { color: #2aa198 } /* Comment.PreprocFile */
c-[c1] { color: #2aa198 } /* Comment.Single */
c-[cs] { color: #2aa198 } /* Comment.Special */
c-[kc] { color: #d33682 } /* Keyword.Constant */
c-[kn] { color: #d33682 } /* Keyword.Namespace */
c-[kp] { color: #d33682 } /* Keyword.Pseudo */
c-[kr] { color: #d33682 } /* Keyword.Reserved */
c-[ld] { color: #657b83 } /* Literal.Date */
c-[nc] { color: #268bd2 } /* Name.Class */
c-[no] { color: #268bd2 } /* Name.Constant */
c-[nd] { color: #268bd2 } /* Name.Decorator */
c-[ni] { color: #268bd2 } /* Name.Entity */
c-[ne] { color: #268bd2 } /* Name.Exception */
c-[nf] { color: #268bd2 } /* Name.Function */
c-[nl] { color: #268bd2 } /* Name.Label */
c-[nn] { color: #268bd2 } /* Name.Namespace */
c-[py] { color: #268bd2 } /* Name.Property */
c-[ow] { color: #657b83 } /* Operator.Word */
c-[mb] { color: #657b83 } /* Literal.Number.Bin */
c-[mf] { color: #657b83 } /* Literal.Number.Float */
c-[mh] { color: #657b83 } /* Literal.Number.Hex */
c-[mi] { color: #657b83 } /* Literal.Number.Integer */
c-[mo] { color: #657b83 } /* Literal.Number.Oct */
c-[sa] { color: #6c71c4 } /* Literal.String.Affix */
c-[sb] { color: #6c71c4 } /* Literal.String.Backtick */
c-[sc] { color: #6c71c4 } /* Literal.String.Char */
c-[dl] { color: #6c71c4 } /* Literal.String.Delimiter */
c-[sd] { color: #6c71c4 } /* Literal.String.Doc */
c-[se] { color: #6c71c4 } /* Literal.String.Escape */
c-[sh] { color: #6c71c4 } /* Literal.String.Heredoc */
c-[si] { color: #6c71c4 } /* Literal.String.Interpol */
c-[sx] { color: #6c71c4 } /* Literal.String.Other */
c-[sr] { color: #6c71c4 } /* Literal.String.Regex */
c-[ss] { color: #6c71c4 } /* Literal.String.Symbol */
c-[fm] { color: #268bd2 } /* Name.Function.Magic */
c-[vc] { color: #cb4b16 } /* Name.Variable.Class */
c-[vg] { color: #cb4b16 } /* Name.Variable.Global */
c-[vi] { color: #cb4b16 } /* Name.Variable.Instance */
c-[vm] { color: #cb4b16 } /* Name.Variable.Magic */
c-[il] { color: #657b83 } /* Literal.Number.Integer.Long */
}
</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">WebXR Layers API Level 1</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2023-04-06">6 April 2023</time></p>
<details open>
<summary>More details about this document</summary>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://immersive-web.github.io/layers/">https://immersive-web.github.io/layers/</a>
<dt>Latest published version:
<dd><a href="https://www.w3.org/TR/webxrlayers-1/">https://www.w3.org/TR/webxrlayers-1/</a>
<dt>Feedback:
<dd><a href="https://github.com/immersive-web/layers/issues/">GitHub</a>
<dd><a href="#issues-index">Inline In Spec</a>
<dt class="editor">Editor:
<dd class="editor p-author h-card vcard" data-editor-id="106988"><a class="p-name fn u-email email" href="mailto:cabanier@fb.com">Rik Cabanier</a> (<a class="p-org org" href="https://facebook.com">Meta</a>)
<dt>Participate:
<dd><a href="https://github.com/immersive-web/layers/issues/new">File an issue</a> (<a href="https://github.com/immersive-web/layers/issues">open issues</a>)
<dd><a href="https://lists.w3.org/Archives/Public/public-immersive-web-wg/">Mailing list archive</a>
<dd><a href="irc://irc.w3.org:6665/">W3C’s #immersive-web IRC</a>
</dl>
</div>
</details>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2023 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document" rel="license">permissive document license</a> rules apply. </p>
<hr title="Separator for header">
</div>
<div class="p-summary" data-fill-with="abstract">
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<p>This specification describes support for various layer types used in a WebXR session.</p>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p> <em>This section describes the status of this document at the time of its publication. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this
technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical
reports index</a> at http://www.w3.org/TR/.</em> </p>
<p> This document was published by the <a href="https://www.w3.org/groups/wg/immersive-web">Immersive Web Working Group</a> as an Editors' Draft. This document is intended to become a W3C Recommendation.
Feedback and comments on this specification are welcome. Please use <a href="https://github.com/immersive-web/layers/issues">Github issues</a>.
Discussions may also be found in the <a href="http://lists.w3.org/Archives/Public/public-immersive-web-wg/">public-immersive-web-wg@w3.org archives</a>. </p>
<p> Publication as an Editors' Draft does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. This is a draft document and may
be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite
this document as other than work in progress. </p>
<p> This document was produced by a group operating under the <a href="https://www.w3.org/Consortium/Patent-Policy/">W3C Patent Policy</a>.
W3C maintains a <a href="https://www.w3.org/groups/wg/immersive-web/ipr" rel="disclosure">public list of any patent
disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section
6 of the W3C Patent Policy</a>. </p>
<p> This document is governed by the <a href="https://www.w3.org/2021/Process-20211102/" id="w3c_process_revision">2 November 2021 W3C Process Document</a>. </p>
<p></p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li>
<a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
<ol class="toc">
<li><a href="#terminology"><span class="secno">1.1</span> <span class="content">Terminology</span></a>
<li><a href="#applicationflow"><span class="secno">1.2</span> <span class="content">Application flow</span></a>
</ol>
<li><a href="#initialization"><span class="secno">2</span> <span class="content">Initialization</span></a>
<li>
<a href="#xrlayertypes"><span class="secno">3</span> <span class="content">Layer types</span></a>
<ol class="toc">
<li><a href="#monovsstereo"><span class="secno">3.1</span> <span class="content">Mono and stereo layers</span></a>
<li><a href="#xrlayerlayouttype"><span class="secno">3.2</span> <span class="content">XRLayerLayout</span></a>
<li><a href="#xrlayerqualitytype"><span class="secno">3.3</span> <span class="content">XRLayerQuality</span></a>
<li><a href="#xrcompositionlayertype"><span class="secno">3.4</span> <span class="content">XRCompositionLayer</span></a>
<li><a href="#xrprojectionlayertype"><span class="secno">3.5</span> <span class="content">XRProjectionLayer</span></a>
<li><a href="#xrquadlayertype"><span class="secno">3.6</span> <span class="content">XRQuadLayer</span></a>
<li><a href="#xrcylinderayertype"><span class="secno">3.7</span> <span class="content">XRCylinderLayer</span></a>
<li><a href="#xrequirectlayertype"><span class="secno">3.8</span> <span class="content">XREquirectLayer</span></a>
<li><a href="#xcubelayertype"><span class="secno">3.9</span> <span class="content">XRCubeLayer</span></a>
</ol>
<li><a href="#spaces"><span class="secno">4</span> <span class="content">Spaces</span></a>
<li>
<a href="#rendering"><span class="secno">5</span> <span class="content">Rendering</span></a>
<ol class="toc">
<li><a href="#xrsubimagetype"><span class="secno">5.1</span> <span class="content">XRSubImage</span></a>
<li><a href="#xrwebglsubimagetype"><span class="secno">5.2</span> <span class="content">XRWebGLSubImage</span></a>
<li><a href="#xrtexturetype"><span class="secno">5.3</span> <span class="content">XRTextureType</span></a>
</ol>
<li>
<a href="#gpulayer"><span class="secno">6</span> <span class="content">GPU layer and view creation</span></a>
<ol class="toc">
<li><a href="#xrgpulayeroverview"><span class="secno">6.1</span> <span class="content">Overview</span></a>
<li><a href="#xropaquetextures"><span class="secno">6.2</span> <span class="content">Opaque textures</span></a>
<li><a href="#xrprojectionlayerinittype"><span class="secno">6.3</span> <span class="content">XRProjectionLayerInit</span></a>
<li><a href="#xrlayerinittype"><span class="secno">6.4</span> <span class="content">XRLayerInit</span></a>
<li><a href="#xrquadlayerinit"><span class="secno">6.5</span> <span class="content">XRQuadLayerInit</span></a>
<li><a href="#xrcylinderlayerinit"><span class="secno">6.6</span> <span class="content">XRCylinderLayerInit</span></a>
<li><a href="#xrequirectlayerinit"><span class="secno">6.7</span> <span class="content">XREquirectLayerInit</span></a>
<li><a href="#xrcubelayerinit"><span class="secno">6.8</span> <span class="content">XRCubeLayerInit</span></a>
<li><a href="#XRWebGLBindingtype"><span class="secno">6.9</span> <span class="content">XRWebGLBinding</span></a>
</ol>
<li>
<a href="#videolayer"><span class="secno">7</span> <span class="content">Video layer creation</span></a>
<ol class="toc">
<li><a href="#xrmedialayerinittype"><span class="secno">7.1</span> <span class="content">XRMediaLayerInit</span></a>
<li><a href="#xrmediaquadlayerinittype"><span class="secno">7.2</span> <span class="content">XRMediaQuadLayerInit</span></a>
<li><a href="#xrmediacylinderlayerinittype"><span class="secno">7.3</span> <span class="content">XRMediaCylinderLayerInit</span></a>
<li><a href="#xrmediaequirectlayerinittype"><span class="secno">7.4</span> <span class="content">XRMediaEquirectLayerInit</span></a>
<li><a href="#xrmediabindingtype"><span class="secno">7.5</span> <span class="content">XRMediaBinding</span></a>
</ol>
<li>
<a href="#events"><span class="secno">8</span> <span class="content">Events</span></a>
<ol class="toc">
<li><a href="#xrlayerevent-interface"><span class="secno">8.1</span> <span class="content">XRLayerEvent</span></a>
<li><a href="#event-types"><span class="secno">8.2</span> <span class="content">Event Types</span></a>
</ol>
<li><a href="#depthsorting"><span class="secno">9</span> <span class="content">Depth sorting between layers</span></a>
<li><a href="#spacewarp"><span class="secno">10</span> <span class="content">Space warp</span></a>
<li>
<a href="#webxrintegration"><span class="secno">11</span> <span class="content">WebXR Device API Integration</span></a>
<ol class="toc">
<li><a href="#xrrenderstatechanges"><span class="secno">11.1</span> <span class="content">XRRenderState changes</span></a>
<li><a href="#updaterenderstatechanges"><span class="secno">11.2</span> <span class="content">updateRenderState changes</span></a>
<li><a href="#xrcompositorchanges"><span class="secno">11.3</span> <span class="content">XRCompositor changes</span></a>
<li><a href="#xrviewchanges"><span class="secno">11.4</span> <span class="content">XRView changes</span></a>
<li><a href="#animationframeschanges"><span class="secno">11.5</span> <span class="content">Animation frames changes</span></a>
</ol>
<li>
<a href="#security"><span class="secno">12</span> <span class="content">Security and Privacy Considerations</span></a>
<ol class="toc">
<li><a href="#xrcompositiontiming"><span class="secno">12.1</span> <span class="content">Timing of the composition</span></a>
<li><a href="#xrlayerallocation"><span class="secno">12.2</span> <span class="content">Allocation of layers</span></a>
</ol>
<li>
<a href="#changes"><span class="secno"></span> <span class="content"> Changes</span></a>
<ol class="toc">
<li><a href="#changes-from-20201203"><span class="secno"></span> <span class="content"> Changes from the <span>First Public Working Draft 3 December 2020</span></span></a>
</ol>
<li>
<a href="#w3c-conformance"><span class="secno"></span> <span class="content">Conformance</span></a>
<ol class="toc">
<li><a href="#w3c-conventions"><span class="secno"></span> <span class="content">Document conventions</span></a>
<li><a href="#w3c-conformant-algorithms"><span class="secno"></span> <span class="content">Conformant Algorithms</span></a>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ol>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
<li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
</ol>
</nav>
<main>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
<section class="non-normative">
<p>This specification adds support of `composition` layers to the WebXR spec. The benefits of layers are as follows:</p>
<ul>
<li data-md>
<p><b>Performance and judder</b>: Composition layers are presented at the frame rate of the compositor (i.e. native refresh rate of HMD) rather than at the application frame rate.
Even when the application is not updating the layer’s rendering at the native refresh rate of the compositor, the compositor might be able to re-project the existing
rendering to the proper pose. This results in smoother rendering and less judder. Another feature of layers is that each of them can have different resolution. This allows the
application to scale down the main eye buffer resolution on low performance systems, but keeping essential information, such as text or a map, in its own layer at a higher
resolution.</p>
<li data-md>
<p><b>Legibility/visual fidelity</b>: In regular WebXR, the resolution for eye-buffers might be reduced to relatively low values especially on low performance systems. This makes
it harder to render high fidelity content, such as text. With Composition Layers, a static cylinder or quad layer can be drawn once at high resolution and is resampled only once by the compositor. This contrasts with
the traditional approach with rendering an <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#xrwebgllayer" id="ref-for-xrwebgllayer">XRWebGLLayer</a></code> where content is produced at the device’s refresh rate and resampled at least twice: once when rendering into WebGL eye-buffer (which can lose details due to
lower eye-buffer resolution) and the second time by the compositor.</p>
<li data-md>
<p><b>Power consumption / battery life</b>: Due to the reduced rendering pipeline, the lack of double sampling and no need to update the layer’s rendering each frame, the power
consumption is expected to be improved.</p>
<li data-md>
<p><b>Latency</b>: Pose sampling for composition layers may occur at the very end of the frame and then certain reprojection techniques could be used to update the layer’s pose to
match it with the most recent HMD pose. This may significantly reduce the effective latency for the layers' rendering and as a result improve overall experience.</p>
<li data-md>
<p><b>Support for more color types</b>: WebXR only supports RGB values. Composition layer will have broader support for color types so authors can use compressed formats or sRGB.</p>
</ul>
</section>
<h3 class="heading settled" data-level="1.1" id="terminology"><span class="secno">1.1. </span><span class="content">Terminology</span><a class="self-link" href="#terminology"></a></h3>
<h3 class="heading settled" data-level="1.2" id="applicationflow"><span class="secno">1.2. </span><span class="content">Application flow</span><a class="self-link" href="#applicationflow"></a></h3>
<section class="non-normative">
<p>If an author wants to use GL layers, they have to go through these steps:</p>
<ol>
<li data-md>
<p>For any layer type other than <code class="idl"><a data-link-type="idl" href="#xrprojectionlayer" id="ref-for-xrprojectionlayer">XRProjectionLayer</a></code> request support through <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dom-xrpermissiondescriptor-requiredfeatures" id="ref-for-dom-xrpermissiondescriptor-requiredfeatures">requiredFeatures</a></code> or <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dom-xrpermissiondescriptor-optionalfeatures" id="ref-for-dom-xrpermissiondescriptor-optionalfeatures">optionalFeatures</a></code> in <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dom-xrsystem-requestsession" id="ref-for-dom-xrsystem-requestsession">requestSession()</a></code>.</p>
<li data-md>
<p>Create an <code class="idl"><a data-link-type="idl" href="#xrwebglbinding" id="ref-for-xrwebglbinding">XRWebGLBinding</a></code> or <code class="idl"><a data-link-type="idl" href="#xrmediabinding" id="ref-for-xrmediabinding">XRMediaBinding</a></code>.</p>
<li data-md>
<p>Create layers with these objects.</p>
<li data-md>
<p>Add the layers to <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dictdef-xrrenderstateinit" id="ref-for-dictdef-xrrenderstateinit">XRRenderStateInit</a></code> and call <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate" id="ref-for-dom-xrsession-updaterenderstate">updateRenderState()</a></code>.</p>
<li data-md>
<p>During <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dom-xrsession-requestanimationframe" id="ref-for-dom-xrsession-requestanimationframe">requestAnimationFrame()</a></code> for webgl layers, draw content each WebGL layer.</p>
</ol>
</section>
<h2 class="heading settled" data-level="2" id="initialization"><span class="secno">2. </span><span class="content">Initialization</span><a class="self-link" href="#initialization"></a></h2>
<p>If an application wants to create layers other than of type <code class="idl"><a data-link-type="idl" href="#xrprojectionlayer" id="ref-for-xrprojectionlayer①">XRProjectionLayer</a></code> during a session,
the session MUST be requested with an appropriate <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#feature-descriptor" id="ref-for-feature-descriptor">feature descriptor</a>. The string "<dfn class="dfn-paneled" data-dfn-for="feature descriptor" data-dfn-type="dfn" data-noexport id="feature-descriptor-layers">layers</dfn>" is introduced
by this module as a new valid <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#feature-descriptor" id="ref-for-feature-descriptor①">feature descriptor</a> for the WebXR Layers feature.</p>
<p>Layers of type <code class="idl"><a data-link-type="idl" href="#xrprojectionlayer" id="ref-for-xrprojectionlayer②">XRProjectionLayer</a></code> MUST always be supported, regardless if the <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#feature-descriptor" id="ref-for-feature-descriptor②">feature descriptor</a> was requested.</p>
<div class="example" id="example-3a50cd84">
<a class="self-link" href="#example-3a50cd84"></a> The following code requests layers as an optional feature.
<pre class="highlight">navigator<c- p>.</c->xr<c- p>.</c->requestSession<c- p>(</c-><c- t>'immersive-vr'</c-><c- p>,</c-> <c- p>{</c->
optionalFeatures<c- o>:</c-> <c- p>[</c-><c- t>'layers'</c-><c- p>]</c->
<c- p>}</c->
</pre>
</div>
<p>Layers are only supported for XRSessions created with XRSessionMode of <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dom-xrsessionmode-immersive-vr" id="ref-for-dom-xrsessionmode-immersive-vr">"immersive-vr"</a></code> or <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr-ar-module/#dom-xrsessionmode-immersive-ar" id="ref-for-dom-xrsessionmode-immersive-ar">"immersive-ar"</a></code>. <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#dom-xrsessionmode-inline" id="ref-for-dom-xrsessionmode-inline">"inline"</a></code> sessions MUST not support layers.</p>
<p>The "<a data-link-type="dfn" href="#feature-descriptor-layers" id="ref-for-feature-descriptor-layers">layers</a>" <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#feature-descriptor" id="ref-for-feature-descriptor③">feature descriptor</a> has a <a data-link-type="dfn" href="https://immersive-web.github.io/webxr/#feature-requirements" id="ref-for-feature-requirements">feature requirement</a> that it cannot be enabled when there is an <a data-link-type="dfn" href="https://immersive-web.github.io/webxr/#active-immersive-session" id="ref-for-active-immersive-session">active immersive session</a>.</p>
<p class="note" role="note"><span class="marker">NOTE:</span> This means that executing the <code class="idl"><a data-link-type="idl" href="https://wicg.github.io/permissions-request/#dom-permissions-request" id="ref-for-dom-permissions-request">request(permissionDesc)</a></code> API with "<a data-link-type="dfn" href="#feature-descriptor-layers" id="ref-for-feature-descriptor-layers①">layers</a>" will
not enable layers support for the current active session.</p>
<h2 class="heading settled" data-level="3" id="xrlayertypes"><span class="secno">3. </span><span class="content">Layer types</span><a class="self-link" href="#xrlayertypes"></a></h2>
<h3 class="heading settled" data-level="3.1" id="monovsstereo"><span class="secno">3.1. </span><span class="content">Mono and stereo layers</span><a class="self-link" href="#monovsstereo"></a></h3>
A stereo layer MUST supply an <code class="idl"><a data-link-type="idl" href="#xrsubimage" id="ref-for-xrsubimage">XRSubImage</a></code> to render to for each view.
<p>A mono layer MUST supply a single <code class="idl"><a data-link-type="idl" href="#xrsubimage" id="ref-for-xrsubimage①">XRSubImage</a></code> which is shown to each view.</p>
<p>The <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor">XR Compositor</a> MUST ensure that layers are presented correctly in stereo to the observer.</p>
<h3 class="heading settled" data-level="3.2" id="xrlayerlayouttype"><span class="secno">3.2. </span><span class="content">XRLayerLayout</span><a class="self-link" href="#xrlayerlayouttype"></a></h3>
The <code class="idl"><a data-link-type="idl" href="#enumdef-xrlayerlayout" id="ref-for-enumdef-xrlayerlayout">XRLayerLayout</a></code> enum defines the layout of the layer.
<pre class="idl highlight def"><c- b>enum</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="enum" data-export id="enumdef-xrlayerlayout"><code><c- g>XRLayerLayout</c-></code></dfn> {
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerlayout-default" id="ref-for-dom-xrlayerlayout-default"><c- s>"default"</c-></a>,
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerlayout-mono" id="ref-for-dom-xrlayerlayout-mono"><c- s>"mono"</c-></a>,
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerlayout-stereo" id="ref-for-dom-xrlayerlayout-stereo"><c- s>"stereo"</c-></a>,
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerlayout-stereo-left-right" id="ref-for-dom-xrlayerlayout-stereo-left-right"><c- s>"stereo-left-right"</c-></a>,
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerlayout-stereo-top-bottom" id="ref-for-dom-xrlayerlayout-stereo-top-bottom"><c- s>"stereo-top-bottom"</c-></a>
};
</pre>
<ul>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerLayout" data-dfn-type="enum-value" data-export data-lt=""default"|default" id="dom-xrlayerlayout-default"><code>default</code></dfn> indicates that the layer can accomodate all the views of session’s <a data-link-type="dfn" href="https://immersive-web.github.io/webxr/#xrsession-list-of-views" id="ref-for-xrsession-list-of-views">list of views</a>.</p>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerLayout" data-dfn-type="enum-value" data-export data-lt=""mono"|mono" id="dom-xrlayerlayout-mono"><code>mono</code></dfn> indicates that the layer is mono.</p>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerLayout" data-dfn-type="enum-value" data-export data-lt=""stereo"|stereo" id="dom-xrlayerlayout-stereo"><code>stereo</code></dfn> indicates that the layer is stereo.</p>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerLayout" data-dfn-type="enum-value" data-export data-lt=""stereo-left-right"|stereo-left-right" id="dom-xrlayerlayout-stereo-left-right"><code>stereo-left-right</code></dfn> indicates that the layer is stereo and divided left to right.</p>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerLayout" data-dfn-type="enum-value" data-export data-lt=""stereo-top-bottom"|stereo-top-bottom" id="dom-xrlayerlayout-stereo-top-bottom"><code>stereo-top-bottom</code></dfn> indicates that the layer is stereo and divided top to bottom.</p>
</ul>
<p class="note" role="note"><span class="marker">NOTE:</span> If an <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer">XRCompositionLayer</a></code> is created with a <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-default" id="ref-for-dom-xrlayerlayout-default①">"default"</a></code> or <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-stereo" id="ref-for-dom-xrlayerlayout-stereo①">"stereo"</a></code> <code class="idl"><a data-link-type="idl" href="#enumdef-xrlayerlayout" id="ref-for-enumdef-xrlayerlayout①">XRLayerLayout</a></code>, it is highly recommended
that it is allocated with an <code class="idl"><a data-link-type="idl" href="#dom-xrtexturetype-texture-array" id="ref-for-dom-xrtexturetype-texture-array">"texture-array"</a></code> texture type.</p>
<p class="note" role="note"><span class="marker">Note:</span> The <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-stereo-left-right" id="ref-for-dom-xrlayerlayout-stereo-left-right①">"stereo-left-right"</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-stereo-top-bottom" id="ref-for-dom-xrlayerlayout-stereo-top-bottom①">"stereo-top-bottom"</a></code> layouts are designed to minimize draw
calls for content that is already in stereo (for example stereo videos or images). Experiences that don’t require such assets types
should use the <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-default" id="ref-for-dom-xrlayerlayout-default②">"default"</a></code> or <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-stereo" id="ref-for-dom-xrlayerlayout-stereo②">"stereo"</a></code> layout.</p>
<h3 class="heading settled" data-level="3.3" id="xrlayerqualitytype"><span class="secno">3.3. </span><span class="content">XRLayerQuality</span><a class="self-link" href="#xrlayerqualitytype"></a></h3>
The <code class="idl"><a data-link-type="idl" href="#enumdef-xrlayerquality" id="ref-for-enumdef-xrlayerquality">XRLayerQuality</a></code> enum defines the display quality of the layer.
<pre class="idl highlight def"><c- b>enum</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="enum" data-export id="enumdef-xrlayerquality"><code><c- g>XRLayerQuality</c-></code></dfn> {
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerquality-default" id="ref-for-dom-xrlayerquality-default"><c- s>"default"</c-></a>,
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerquality-text-optimized" id="ref-for-dom-xrlayerquality-text-optimized"><c- s>"text-optimized"</c-></a>,
<a class="idl-code" data-link-type="enum-value" href="#dom-xrlayerquality-graphics-optimized" id="ref-for-dom-xrlayerquality-graphics-optimized"><c- s>"graphics-optimized"</c-></a>
};
</pre>
<ul>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerQuality" data-dfn-type="enum-value" data-export data-lt=""default"|default" id="dom-xrlayerquality-default"><code>default</code></dfn> indicates that the layer is displayed with regular settings.</p>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerQuality" data-dfn-type="enum-value" data-export data-lt=""text-optimized"|text-optimized" id="dom-xrlayerquality-text-optimized"><code>text-optimized</code></dfn> indicates that <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor①">XR Compositor</a> will try to render the layer so it’s most readable.</p>
<li data-md>
<p>A layout of <dfn class="dfn-paneled idl-code" data-dfn-for="XRLayerQuality" data-dfn-type="enum-value" data-export data-lt=""graphics-optimized"|graphics-optimized" id="dom-xrlayerquality-graphics-optimized"><code>graphics-optimized</code></dfn> indicates that <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor②">XR Compositor</a> will try to render the layer with additional sharpness.</p>
</ul>
<p class="note" role="note"><span class="marker">NOTE:</span> the <code class="idl"><a data-link-type="idl" href="#dom-xrlayerquality-text-optimized" id="ref-for-dom-xrlayerquality-text-optimized①">text-optimized</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-xrlayerquality-graphics-optimized" id="ref-for-dom-xrlayerquality-graphics-optimized①">graphics-optimized</a></code> flags MAY result in additional processing by the <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor③">XR Compositor</a> which may affect performance.</p>
<h3 class="heading settled" data-level="3.4" id="xrcompositionlayertype"><span class="secno">3.4. </span><span class="content">XRCompositionLayer</span><a class="self-link" href="#xrcompositionlayertype"></a></h3>
XRCompositionLayer defines a set of common attributes and behaviors across certain layer types.
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="xrcompositionlayer"><code><c- g>XRCompositionLayer</c-></code></dfn> : <a data-link-type="idl-name" href="https://immersive-web.github.io/webxr/#xrlayer" id="ref-for-xrlayer"><c- n>XRLayer</c-></a> {
<c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#enumdef-xrlayerlayout" id="ref-for-enumdef-xrlayerlayout②"><c- n>XRLayerLayout</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="XRLayerLayout" href="#dom-xrcompositionlayer-layout" id="ref-for-dom-xrcompositionlayer-layout"><c- g>layout</c-></a>;
<c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-type="boolean" href="#dom-xrcompositionlayer-blendtexturesourcealpha" id="ref-for-dom-xrcompositionlayer-blendtexturesourcealpha"><c- g>blendTextureSourceAlpha</c-></a>;
<c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean①"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-type="boolean" href="#dom-xrcompositionlayer-forcemonopresentation" id="ref-for-dom-xrcompositionlayer-forcemonopresentation"><c- g>forceMonoPresentation</c-></a>;
<c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-float" id="ref-for-idl-float"><c- b>float</c-></a> <a class="idl-code" data-link-type="attribute" data-type="float" href="#dom-xrcompositionlayer-opacity" id="ref-for-dom-xrcompositionlayer-opacity"><c- g>opacity</c-></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long" id="ref-for-idl-unsigned-long"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned long" href="#dom-xrcompositionlayer-miplevels" id="ref-for-dom-xrcompositionlayer-miplevels"><c- g>mipLevels</c-></a>;
<c- b>attribute</c-> <a data-link-type="idl-name" href="#enumdef-xrlayerquality" id="ref-for-enumdef-xrlayerquality①"><c- n>XRLayerQuality</c-></a> <a class="idl-code" data-link-type="attribute" data-type="XRLayerQuality" href="#dom-xrcompositionlayer-quality" id="ref-for-dom-xrcompositionlayer-quality"><c- g>quality</c-></a>;
<c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean②"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#dom-xrcompositionlayer-needsredraw" id="ref-for-dom-xrcompositionlayer-needsredraw"><c- g>needsRedraw</c-></a>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined"><c- b>undefined</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="method" data-export data-lt="destroy()" id="dom-xrcompositionlayer-destroy"><code><c- g>destroy</c-></code></dfn>();
};
</pre>
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="attribute" data-export id="dom-xrcompositionlayer-layout"><code>layout</code></dfn> attribute returns the layout of the layer.</p>
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="attribute" data-export id="dom-xrcompositionlayer-blendtexturesourcealpha"><code>blendTextureSourceAlpha</code></dfn> attribute enables the layer’s texture alpha channel.</p>
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="attribute" data-export id="dom-xrcompositionlayer-forcemonopresentation"><code>forceMonoPresentation</code></dfn> attribute forces the right eye to use the same layer configuration
as the left eye. This MUST send a signal to the <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor④">XR Compositor</a> to remove the <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-stereo" id="ref-for-dom-xrlayerlayout-stereo③">stereo</a></code> effect of this <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer①">XRCompositionLayer</a></code>. Setting this to <code>true</code> on a <code class="idl"><a data-link-type="idl" href="#dom-xrlayerlayout-mono" id="ref-for-dom-xrlayerlayout-mono①">mono</a></code> layer has no effect.</p>
<p class="note" role="note"><span class="marker">NOTE:</span> this attribute has no other side effects on other information that is returned by the <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#xrsession" id="ref-for-xrsession">XRSession</a></code>. Only the operation of the <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor⑤">XR Compositor</a> is affected by this setting and experiences SHOULD continue to draw to both eyes.</p>
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="attribute" data-export id="dom-xrcompositionlayer-opacity"><code>opacity</code></dfn> attribute sets the opacity that is applied to the pixels of the layer. The <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor⑥">XR Compositor</a> MUST multiply each pixel (in premultiplied space) by this value. <code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-opacity" id="ref-for-dom-xrcompositionlayer-opacity①">opacity</a></code> is <code>1.0</code> by default. Setting <code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-opacity" id="ref-for-dom-xrcompositionlayer-opacity②">opacity</a></code> to a value less than <code>0</code> will set it to <code>0</code> and setting it to a value higher than <code>1.0</code> will set it to <code>1.0</code>.</p>
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="attribute" data-export id="dom-xrcompositionlayer-needsredraw"><code>needsRedraw</code></dfn> attribute signals that the <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer②">XRCompositionLayer</a></code> should be
rerendered in the next <a data-link-type="dfn" href="https://immersive-web.github.io/webxr/#xr-animation-frame" id="ref-for-xr-animation-frame">XR animation frame</a>. It MAY be set when <a data-link-type="dfn" href="#the-underlying-resources-of-a-layer-are-lost" id="ref-for-the-underlying-resources-of-a-layer-are-lost">the underlying resources of a layer are lost</a> or
when the <a data-link-type="dfn" href="https://www.w3.org/TR/webxr/#xr-compositor" id="ref-for-xr-compositor⑦">XR Compositor</a> can no longer reproject the layer. Failing to redraw the content in the next <a data-link-type="dfn" href="https://immersive-web.github.io/webxr/#xr-animation-frame" id="ref-for-xr-animation-frame①">XR animation frame</a> might cause flickering or other side effects.</p>
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="attribute" data-export id="dom-xrcompositionlayer-miplevels"><code>mipLevels</code></dfn> attribute returns the depth of the mip chain. This MUST be equal
or smaller than the value requested in <code class="idl"><a data-link-type="idl" href="#dom-xrlayerinit-miplevels" id="ref-for-dom-xrlayerinit-miplevels">mipLevels</a></code>.</p>
<p class="note" role="note"><span class="marker">NOTE:</span> some platforms don’t support mip levels. Authors should query <code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-miplevels" id="ref-for-dom-xrcompositionlayer-miplevels①">mipLevels</a></code> to determine if they can
target a certain mip level and not rely on the value they passed in <code class="idl"><a data-link-type="idl" href="#dom-xrlayerinit-miplevels" id="ref-for-dom-xrlayerinit-miplevels①">mipLevels</a></code>.</p>
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="XRCompositionLayer" data-dfn-type="attribute" data-export id="dom-xrcompositionlayer-quality"><code>quality</code></dfn> attribute sets and returns the quality of the <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer③">XRCompositionLayer</a></code>. <code class="idl"><a data-link-type="idl" href="#dom-xrlayerquality-default" id="ref-for-dom-xrlayerquality-default①">default</a></code> is the initial value.</p>
<div class="algorithm" data-algorithm="redrawLayerAlgo">
When <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="the-underlying-resources-of-a-layer-are-lost">the underlying resources of a layer are lost</dfn> for an <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer④">XRCompositionLayer</a></code> <var>layer</var>,
the user agent MUST run the following steps:
<ol>
<li data-md>
<p>Set <var>layer</var>’s <code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-needsredraw" id="ref-for-dom-xrcompositionlayer-needsredraw①">needsRedraw</a></code> to <code>true</code>.</p>
<li data-md>
<p>If <var>layer</var> is not an <code class="idl"><a data-link-type="idl" href="#xrprojectionlayer" id="ref-for-xrprojectionlayer③">XRProjectionLayer</a></code>, <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task">queue a task</a> to <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire" id="ref-for-concept-event-fire">fire an event</a> named <code class="idl"><a data-link-type="idl" href="#eventdef-xrlayer-redraw" id="ref-for-eventdef-xrlayer-redraw">redraw</a></code> using <code class="idl"><a data-link-type="idl" href="#xrlayerevent" id="ref-for-xrlayerevent">XRLayerEvent</a></code> on <var>layer</var>.</p>
</ol>
</div>
<p><code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-destroy" id="ref-for-dom-xrcompositionlayer-destroy">destroy()</a></code> will delete the underlying attachments. If there are no attachments, this function does nothing.</p>
<div class="algorithm" data-algorithm="intialization of a composition layer">
<p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="intialize-a-composition-layer">intialize a composition layer</dfn> with a <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#xrsession" id="ref-for-xrsession①">XRSession</a></code> <var>session</var> and an optional instance of a <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext" id="ref-for-WebGLRenderingContext">WebGLRenderingContext</a></code> or a <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/2.0/#WebGL2RenderingContext" id="ref-for-WebGL2RenderingContext">WebGL2RenderingContext</a></code> <var>context</var>, the user agent MUST run the following steps:</p>
<ol>
<li data-md>
<p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a> <a data-link-type="dfn" href="#xrcompositionlayer-session" id="ref-for-xrcompositionlayer-session">session</a> to <var>session</var>.</p>
<li data-md>
<p>If <var>context</var> is defined, set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①">this</a> <a data-link-type="dfn" href="#xrcompositionlayer-context" id="ref-for-xrcompositionlayer-context">context</a> to <var>context</var>.</p>
<li data-md>
<p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②">this</a> <code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-blendtexturesourcealpha" id="ref-for-dom-xrcompositionlayer-blendtexturesourcealpha①">blendTextureSourceAlpha</a></code> to <code>true</code>.</p>
<li data-md>
<p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③">this</a> <code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-opacity" id="ref-for-dom-xrcompositionlayer-opacity③">opacity</a></code> to <code>1.0</code>.</p>
</ol>
</div>
<div class="algorithm" data-algorithm="calling destroy on a layer">
<p>When calling <code class="idl"><a data-link-type="idl" href="#dom-xrcompositionlayer-destroy" id="ref-for-dom-xrcompositionlayer-destroy①">destroy()</a></code>, the user agent MUST run the following steps:</p>
<ol>
<li data-md>
<p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④">this</a> <a data-link-type="dfn" href="#colortextures" id="ref-for-colortextures">colorTextures</a> array to an empty array.</p>
<li data-md>
<p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤">this</a> <a data-link-type="dfn" href="#depthstenciltextures" id="ref-for-depthstenciltextures">depthStencilTextures</a> array to an empty array.</p>
<li data-md>
<p>Destroy the underlying GL attachments.</p>
</ol>
</div>
<p>Each <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer⑤">XRCompositionLayer</a></code> has a <dfn class="dfn-paneled" data-dfn-for="XRCompositionLayer" data-dfn-type="dfn" data-noexport id="xrcompositionlayer-context">context</dfn> object which is an instance
of either null or a <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext" id="ref-for-WebGLRenderingContext①">WebGLRenderingContext</a></code> or a <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/2.0/#WebGL2RenderingContext" id="ref-for-WebGL2RenderingContext①">WebGL2RenderingContext</a></code> and a <dfn class="dfn-paneled" data-dfn-for="XRCompositionLayer" data-dfn-type="dfn" data-noexport id="xrcompositionlayer-media">media</dfn> object which is an instance of null or a <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement" id="ref-for-htmlvideoelement">HTMLVideoElement</a></code>.</p>
<p>Each <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer⑥">XRCompositionLayer</a></code> has an associated <dfn class="dfn-paneled" data-dfn-for="XRCompositionLayer" data-dfn-type="dfn" data-noexport id="xrcompositionlayer-session">session</dfn>, which is the <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#xrsession" id="ref-for-xrsession②">XRSession</a></code> it was created with.</p>
<div class="algorithm" data-algorithm="setting the space on a layer">
<p>When <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="setting-the-space-on-a-layer">setting the space on a layer</dfn> with <code class="idl"><a data-link-type="idl" href="https://immersive-web.github.io/webxr/#xrspace" id="ref-for-xrspace">XRSpace</a></code> <var>space</var> and <code class="idl"><a data-link-type="idl" href="#xrcompositionlayer" id="ref-for-xrcompositionlayer⑦">XRCompositionLayer</a></code> <var>layer</var>, the user agent MUST run the following steps to validate if the <var>space</var> is valid:</p>
<ol>
<li data-md>
<p>If <var>space</var> is <code>null</code>, throw <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code> and abort these steps.</p>
<li data-md>