1Name 2 3 OVR_multiview 4 5Name Strings 6 7 GL_OVR_multiview 8 9Contact 10 11 Cass Everitt, Oculus (cass.everitt 'at' oculus.com) 12 13Contributors 14 15 John Carmack, Oculus 16 Tom Forsyth, Oculus 17 Maurice Ribble, Qualcomm 18 James Dolan, NVIDIA Corporation 19 Mark Kilgard, NVIDIA Corporation 20 Michael Songy, NVIDIA Corporation 21 Yury Uralsky, NVIDIA Corporation 22 Jesse Hall, Google 23 Timothy Lottes, Epic 24 Jan-Harald Fredriksen, ARM 25 Jonas Gustavsson, Sony Mobile 26 Sam Holmes, Qualcomm 27 Nigel Williams, Qualcomm 28 Tobias Hector, Imagination Technologies 29 Daniel Koch, NVIDIA Corporation 30 James Helferty, NVIDIA Corporation 31 Olli Etuaho, NVIDIA Corporation 32 33Status 34 35 Complete. 36 37Version 38 39 Last Modified Date: October 19, 2018 40 Revision: 6 41 42Number 43 44 OpenGL Extension #478 45 OpenGL ES Extension #241 46 47Dependencies 48 49 OpenGL 3.0 or OpenGL ES 3.0 is required. 50 51 This extension is written against the OpenGL ES 3.2 (November 3, 2016) 52 specification and the OpenGL 4.6 (Core Profile) (July 30, 2017) 53 54 This extension is written against the OpenGL ES Shading Language 3.00.04 55 specification. 56 57 This extension interacts with OpenGL 3.3, ARB_timer_query, and 58 EXT_disjoint_timer_query. 59 60 This extension interacts with OpenGL 4.5, ARB_direct_state_access and 61 EXT_direct_state_access. 62 63 This extension interacts with OpenGL ES 3.2, OpenGL 4.0, 64 EXT_tessellation_shader, OES_tessellation_shader, and 65 ARB_tessellation_shader. 66 67 This extension interacts with OpenGL ES 3.2, OpenGL 3.2, 68 EXT_geometry_shader, OES_geometry_shader and ARB_geometry_shader4 69 70 This extension interacts with OpenGL 4.3, ARB_multi_draw_indirect, and 71 EXT_multi_draw_indirect. 72 73 This extension interacts with OpenGL 3.0, the OpenGL 3.0 Compatibility 74 Profile, and ARB_fragment_layer_viewport. 75 76Overview 77 78 The method of stereo rendering supported in OpenGL is currently achieved by 79 rendering to the two eye buffers sequentially. This typically incurs double 80 the application and driver overhead, despite the fact that the command 81 streams and render states are almost identical. 82 83 This extension seeks to address the inefficiency of sequential multiview 84 rendering by adding a means to render to multiple elements of a 2D texture 85 array simultaneously. In multiview rendering, draw calls are instanced into 86 each corresponding element of the texture array. The vertex program uses a 87 new gl_ViewID_OVR variable to compute per-view values, typically the vertex 88 position and view-dependent variables like reflection. 89 90 The formulation of this extension is high level in order to allow 91 implementation freedom. On existing hardware, applications and drivers can 92 realize the benefits of a single scene traversal, even if all GPU work is 93 fully duplicated per-view. But future support could enable simultaneous 94 rendering via multi-GPU, tile-based architectures could sort geometry into 95 tiles for multiple views in a single pass, and the implementation could even 96 choose to interleave at the fragment level for better texture cache 97 utilization and more coherent fragment shader branching. 98 99 The most obvious use case in this model is to support two simultaneous 100 views: one view for each eye. However, we also anticipate a usage where two 101 views are rendered per eye, where one has a wide field of view and the other 102 has a narrow one. The nature of wide field of view planar projection is 103 that the sample density can become unacceptably low in the view direction. 104 By rendering two inset eye views per eye, we can get the required sample 105 density in the center of projection without wasting samples, memory, and 106 time by oversampling in the periphery. 107 108 109New Tokens 110 111 Accepted by the <pname> parameter of GetFramebufferAttachmentParameteriv: 112 113 FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 114 FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 115 116 Accepted by the <pname> parameter of GetIntegerv: 117 118 MAX_VIEWS_OVR 0x9631 119 120 Returned by CheckFramebufferStatus: 121 122 FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 123 124 125New Procedures and Functions 126 127 void FramebufferTextureMultiviewOVR( enum target, enum attachment, 128 uint texture, int level, 129 int baseViewIndex, sizei numViews ); 130 131 [[ If OpenGL 4.5 or ARB_direct_state_access is supported ]] 132 133 void NamedFramebufferTextureMultiviewOVR( uint framebuffer, enum attachment, 134 uint texture, int level, 135 int baseViewIndex, sizei numViews ); 136 137 138Modifications to Chapter 4 of the OpenGL 4.6 Specification (Event Model) 139 140 Modify section 4.3 (Time Queries) adding the following to the list 141 of errors: 142 143 "Queries where BeginQuery or EndQuery is called with a target of 144 TIME_ELAPSED, or a if QueryCounter is called with a target of TIMESTAMP 145 return undefined values if the draw framebuffer is multiview at any 146 point during their execution." 147 148Modifications to Chapter 9 of the OpenGL ES 3.2 Specification (Framebuffers 149and Framebuffer Objects) 150 151 Add a new subsection to section 9.2.2 (Attaching Images to Framebuffer 152 Objects): 153 154 "9.2.2.2 (Multiview Images) 155 156 Finally, multiple layers of two-dimensional array textures can be 157 attached to an attachment point. Such attachments represent multiple 158 views, and the corresponding attachment point is considered to be 159 _multiview_. 160 161 In this mode there are several restrictions: 162 163 - in vertex shader gl_Position is the only output that can depend on 164 gl_ViewID_OVR (see Section 7.1 of the OpenGL ES Shading Language 165 specification) 166 - no transform feedback (section 11.1.3.11)) 167 - no tessellation control or evaluation shaders (section 11.1.3.11) 168 - no geometry shader (section 11.1.3.11) 169 - no timer queries (section 4.3) 170 - occlusion query results must be between max per-view and the sum 171 of the per-view queries, inclusive (section 15.1.4)." 172 - in fragment shader the contents of gl_Layer are undefined 173 174 [[ If implemented in OpenGL ]] 175 - the number of views rendered to by Begin/End is an undefined subset 176 of the views present in the framebuffer 177 178 Add the following to list of <pname> parameters which can be queried 179 via GetFramebufferAttachmentParameteriv when the value of 180 FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is TEXTURE in section 9.2.3 181 (Framebuffer Object Queries): 182 183 "If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR and the value 184 of FRAMEBUFFER_ATTACHMENT_OBJECT_NAME is a two-dimensional array texture, 185 then <params> will contain the number of views that were specified for the 186 attachment point via FramebufferTextureMultiviewOVR. Otherwise, <params> 187 will contain zero. 188 189 "If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR and the 190 value of FRAMEBUFFER_ATTACHMENT_OBJECT_NAME is a two-dimensional array 191 texture, then <params> will contain the base view index that was specified 192 for the attachment point via FramebufferTextureMultiviewOVR. Otherwise, 193 <params> will contain zero." 194 195 Add the following to the end of section 9.2.8 (Attaching Textures to a 196 Framebuffer), immediately before the subsection "Effects of Attaching a 197 Texture Image": 198 199 "Multiple layers of a two-dimensional array texture can be 200 attached as one of the logical buffers of a framebuffer object with the 201 commands 202 203 void FramebufferTextureMultiviewOVR( enum target, enum attachment, 204 uint texture, int level, 205 int baseViewIndex, sizei numViews ); 206 207 [[ If OpenGL 4.5 or ARB_direct_state_access is supported ]] 208 209 void NamedFramebufferTextureMultiviewOVR( uint framebuffer, enum attachment, 210 uint texture, int level, 211 int baseViewIndex, sizei numViews ); 212 213 These commands operate similarly to the FramebufferTextureLayer and 214 NamedFramebufferTexture commands, except that <baseViewIndex> 215 and <numViews> select a range of texture array elements that will be 216 targeted when rendering. Such an attachment is considered _multiview_ 217 (section 9.2.2.2) and rendering commands issued when such a framebuffer 218 object is bound are termed "multiview rendering". The maximum number 219 of views which can be bound simultaneously is determined by the value 220 of MAX_VIEWS_OVR, which can be queried with the GetIntegerv command. 221 222 The command 223 224 View( uint id ); 225 226 does not exist in the GL, but is used here to describe the multiview 227 functionality in this section. The effect of this hypothetical function 228 is to set the value of the shader built-in input gl_ViewID_OVR. 229 230 When multiview rendering is enabled, the Clear (section 15.2.3), 231 ClearBuffer* (section 15.2.3.1), and Draw* (section 10.5) 232 commands have the same effect as: 233 234 for( int i = 0; i < numViews; i++ ) { 235 for ( enum attachment : all attachment values where multiple texture array elements have been targeted for rendering ) { 236 FramebufferTextureLayer( target, attachment, texture, level, baseViewIndex + i ); 237 } 238 View( i ); 239 <command> 240 } 241 242 The result is that every such command is broadcast into every active 243 view. The shader uses gl_ViewID_OVR to compute view dependent outputs. 244 245 The number of views, as specified by <numViews>, must be the same for all 246 framebuffer attachments points where the value of FRAMEBUFFER_ATTACHMENT_- 247 OBJECT_TYPE is not NONE or the framebuffer is incomplete (section 9.4.2). 248 249 If <texture> is non-zero and the command does not result in an error, the 250 framebuffer attachment state corresponding to <attachment> is updated as 251 in the FramebufferTextureLayer command, except that the values of 252 FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER and 253 FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR are is set to 254 <baseViewIndex>, and the value of 255 FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR is set to <numViews>. 256 257 Errors 258 259 In addition to the corresponding errors for FramebufferTextureLayer when 260 called with the same parameters (other than <layer>): 261 262 An INVALID_VALUE error is generated if: 263 - <numViews> is less than 1 or if <numViews> is greater than MAX_VIEWS_OVR. 264 - <texture> is a two-dimensional array texture and <baseViewIndex> + 265 <numViews> is larger than the value of MAX_ARRAY_TEXTURE_LAYERS. 266 - texture is non-zero and <baseViewIndex> is negative." 267 268 An INVALID_OPERATION error is generated if texture is non-zero and is not 269 the name of a two-dimensional array texture." 270 271 Add the following to the list of conditions required for framebuffer 272 attachment completeness in section 9.4.1 (Framebuffer Attachment 273 Completeness): 274 275 "If <image> is a two-dimensional array and the attachment 276 is multiview, all the selected layers, [<baseViewIndex>, 277 <baseViewIndex> + <numViews>), are less than the layer count of the 278 texture." 279 280 Add the following to the list of conditions required for framebuffer 281 completeness in section 9.4.2 (Whole Framebuffer Completeness): 282 283 "The number of views is the same for all populated attachments. 284 285 { FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR }" 286 287Modifications to Chapter 11 of the OpenGL ES 3.2 Specification (Programmable 288Vertex Processing 289 290 Modify section 11.1.3.11 (Validation) adding the following conditions 291 to the list of reasons that may result in an INVALID_OPERATION error 292 being generated by any command that transfers vertices to the the GL: 293 294 * Any attachment of the draw framebuffer is multiview (section 9.2.8) 295 and any of the following conditions are true: 296 297 - There is an active program for tessellation control, tessellation 298 evaluation, or geometry stages, or 299 300 - Transform feedback is active and not paused." 301 302Modifications to Chapter 15 of the OpenGL ES 3.2 Specification (Writing 303Fragments and Samples to the Framebuffer) [OpenGL 4.6 Chapter 17] 304 305 Modify section 15.1.4 [OpenGL 4.6 section 17.3.5] (Occlusion Queries) 306 adding the following to the end of the second paragraph (describing 307 the SAMPLES_PASSED query): 308 309 "During multiview rendering (section 9.2.8), the samples-passed count 310 requirement is relaxed and the samples counted must be between the 311 maximum number of samples counted from any view, and the sum of samples 312 counted for all views." 313 314 Add the following to the end of the fourth paragraph (describing 315 ANY_SAMPLES_PASSED and ANY_SAMPLES_PASSED_CONSERVATIVE): 316 317 "During multiview rendering (section 9.2.8), the samples-boolean state 318 is set to TRUE if the samples-boolean state from any view is set to 319 TRUE." 320 321Modifications to Chapter 16 of the OpenGL ES 3.2 Specification (Reading and 322Copying Pixels) 323 324 Add the following paragraph to the end of the description of 325 BlitFramebuffer in section 16.2.1 (Blitting Pixel Rectangles): 326 327 "If the draw framebuffer has multiple views (see section 9.2.8, 328 FramebufferTextureMultiviewOVR), values taken from the read buffer are 329 only written to draw buffers in the first view of the draw framebuffer." 330 331 332New Implementation Dependent State 333 334 (Additions to Table 21.40 "Implementation Dependent Values") 335 336 Get Value Type Get Command Minimum Value Description Sec. 337 --------- ---- ----------- ------------- ----------- ---- 338 MAX_VIEWS_OVR Z+ GetIntegerv 2 Maximum number of views 9.2.8 339 340Modifications to The OpenGL ES Shading Language Specification, Version 3.00.04 341 342 Including the following line in a shader can be used to control the 343 language features described in this extension: 344 345 #extension GL_OVR_multiview : <behavior> 346 347 where <behavior> is as specified in section 3.5. 348 349 A new preprocessor #define is added to the OpenGL ES Shading Language: 350 351 #define GL_OVR_multiview 1 352 353 354 In section 4.3.8.1 "Input Layout Qualifiers": 355 356 Insert a paragraph before the final one ("Fragment shaders cannot ..."): 357 358 Vertex shaders also allow the following layout qualifier on "in" only 359 (not with variable declarations) 360 361 [[ If implemented in OpenGL ES]] 362 363 layout-qualifier-id 364 num_views = integer-constant 365 366 [[ If implemented in OpenGL ]] 367 368 layout-qualifier-id 369 num_views = integer-constant-expression 370 371 to indicate that the shader will only be used with the given number of 372 views, as described in section 4.4 ("Framebuffer Objects") of the OpenGL ES 373 Specification. If this qualifier is not declared, the behavior is as if it 374 had been set to 1. 375 376 If this layout qualifier is declared more than once in the same shader, 377 all those declarations must set num_views to the same value; otherwise a 378 compile-time error results. If multiple vertex shaders attached to a 379 single program object declare num_views, the declarations must be 380 identical; otherwise a link-time error results. It is a compile-time 381 error to declare num_views to be less than or equal to zero, or greater 382 than MAX_VIEWS_OVR. 383 384 Additions to Section 7.1 "Built-in Language Variables" 385 386 Add the following to the list of built-in variables that are intrinsically 387 declared in the vertex and fragment shading languages: 388 389 in mediump uint gl_ViewID_OVR; 390 391 The gl_ViewID_OVR built-in variable holds the integer index of the view 392 number to which the current shader invocation belongs, as defined in 393 in section 4.4.2.4 (FramebufferTextureMultiviewOVR) in the OpenGL 394 Graphics Systems Specification. 395 396 [[ If OVR_multiview2 is not supported ]] 397 398 It is a compile- or link-time error if any output variable other 399 than gl_Position is statically dependent on gl_ViewID_OVR. If an 400 output variable other than gl_Position is dynamically dependent on 401 gl_ViewID_OVR, the values are undefined. 402 403 NOTE: Implementations that also support OVR_multiview2 may not 404 generate an error if these conditions are violated, even if the 405 OVR_multiview2 extension is not enabled. 406 407Errors 408 409 INVALID_FRAMEBUFFER_OPERATION is generated by commands that read from the 410 framebuffer such as BlitFramebuffer, ReadPixels, CopyTexImage*, and 411 CopyTexSubImage*, if the number of views in the current read framebuffer 412 is greater than 1. 413 414 INVALID_OPERATION is generated if a rendering command is issued and the the 415 number of views in the current draw framebuffer is not equal to the number 416 of views declared in the currently bound program. 417 418Interactions with OpenGL 3.3, ARB_timer_query, and EXT_disjoint_timer_query 419 420 If none of OpenGL 3.3, ARB_timer_query, or EXT_disjoint_timer_query 421 are supported, ignore references to TIMESTAMP and TIME_ELAPSED queries. 422 423Interactions with OpenGL 4.5, ARB_direct_state_access, and 424EXT_direct_state_access 425 426 If none of OpenGL 4.5, ARB_direct_state_access and EXT_direct_state_access 427 are supported, the command NamedFramebufferTextureMultiviewOVR does not 428 exist. 429 430Interactions with OpenGL ES 3.2, OpenGL 4.0, EXT_tessellation_shader, 431OES_tessellation_shader and ARB_tessellation_shader. 432 433 If none of OpenGL ES 3.2, OpenGL 4.0, EXT_tessellation_shader, 434 OES_tessellation_shader or ARB_tessellation shader are supported, ignore 435 all references to tessellation shaders. 436 437Interactions with OpenGL ES 3.2, OpenGL 3.2, EXT_geometry_shader, 438OES_geometry_shader, and ARB_geometry_shader4. 439 440 If none of OpenGL ES 3.2, OpenGL 3.2, EXT_geometry_shader, 441 OES_geometry_shader, or ARB_geometry_shader4 are supported, ignore all 442 references to geometry shaders. 443 444Interactions with OpenGL 4.3, ARB_multi_draw_indirect, and 445EXT_multi_draw_indirect. 446 447 If none of OpenGL 4.3, ARB_multi_draw_indirect, or EXT_multi_draw_indirect 448 are supported, ignore all references to multi-draw-indirect. 449 450Interactions with OpenGL 3.0 451 452 If OpenGL 3.0 (or later) is not supported, ignore all references to the 453 SAMPLES_PASSED occlusion query target. 454 455Interactions with OpenGL ES 3.2, OpenGL 4.3, EXT_geometry_shader, 456OES_geometry_shader, and ARB_fragment_layer_viewport 457 458 If none of OpenGL ES 3.2, OpenGL 4.3, EXT_geometry_shader, 459 OES_geometry_shader, or ARB_fragment_layer_viewport is supported, ignore 460 all references to gl_Layer. 461 462Interactions with OpenGL 3.0 Compatibility Profile 463 464 If OpenGL 3.0 Compatibility Profile (or later) is not supported, ignore all 465 references to Begin/End. 466 467 468Issues 469 470 (1) Should geometry shaders be allowed in multiview mode? 471 472 Resolved: Not in this extension. By disallowing it, we hope to enable more 473 implementations to be available sooner, and there are complex issues that 474 arise when a GS is used to target gl_Layer explicitly. 475 476 (2) Should there be separate scissor and viewport per view? 477 478 Resolved: No, while there might be some uses for such support, it adds 479 unnecessary implementation complexity. In the case of inset rendering, there 480 will be a need to adjust the scissor per view. We will defer that issue for 481 now by forcing all views to use the same scissor and viewport. 482 483 (3) Why not just use geometry shaders? 484 485 Resolved: GS could be used to achieve stereo rendering by broadcasting each 486 primitive to each view. The problem with this approach is that it requires 487 the GS's very general mechanism with known performance implications to solve 488 a problem that does not require that solution and perhaps more frequently 489 than not, will not be the most efficient means of implementation. 490 491 (4) Why use texture arrays instead of separate FBOs? 492 493 Resolved: Use of arrays does imply that we use a minimum version of GL and 494 ES 3.0. On the other hand, it has some nice simplifying properties. In 495 particular, the format and resolution of each view is known to be the same 496 and only one FBO is bound, just like with normal rendering. It has some 497 potentially limiting interactions with GS use, but on the whole, the 498 implementation simplifications are considered worth the implied limitations. 499 500 (5) How does this extension interact with occlusion queries, timer queries, 501 etc? 502 503 Resolved: The bias will be toward relaxed rules to allow implementation 504 freedom. For example, occlusion queries should not return fewer than the max 505 samples returned from any view, but returning the sum may also be fine. 506 Simply reporting the result from view 0 is not sufficient. 507 508 (6) Is gl_ViewID_OVR visible at every pipeline stage? 509 510 Resolved: To make integration simple for app developers, the intent is for 511 gl_ViewID_OVR to be visible as a built-in at each programmable pipeline stage. 512 513 (7) Are view-dependent parameters exposed explicitly? 514 515 Resolved: No. This is implicit in the dependence of a parameter on ViewID. 516 In this extension, however, only gl_Position is allowed to depend on ViewID 517 in the vertex shader. If a shader violates this restriction it results in 518 undefined behavior or may produce an error. Later extensions may relax that 519 restriction. 520 521 (8) Should the parameters that affect view-dependent position be driver 522 visible or otherwise restricted? 523 524 Resolved: No. Letting the app index via ViewID makes it a lot harder for the 525 driver to know much about the details of the transform inputs that result in 526 view-dependent outputs, but no such support exists in the API today either. 527 Adding that support would be complex, and thus not in the spirit of an 528 extension that can be implemented broadly with low risk. 529 530 (9) Should there be a per-view UBO instead of exposing gl_ViewID_OVR in the shader? 531 532 Resolved: No. Exposing the gl_ViewID_OVR variable is the smallest change. It 533 does imply dynamic branching, predication, or indexing based on the view id, 534 however, implementations could compile separate versions of the shader with 535 view id translated to literals if that would improve performance. Extra API 536 and machinery would be required to sequence one or more UBOs to different 537 objects per view. 538 539 (10) Should there be DSA style entry points? 540 541 Resolved: Almost certainly in GL 4.5 and beyond. Less clear that it should 542 be required for ES 3.0. 543 544 (11) Should tessellation shaders be allowed in multiview mode? 545 546 Resolved: Not in this extension. By disallowing it, we hope to enable more 547 implementations to be available sooner. 548 549 (12) Does the number of views need to be declared in the shader? 550 551 Resolved: Yes. This enables the implementation to specialize the compilation 552 for the declared number of views, for example by loop-unrolling. It could 553 also serves as a notification that the shader outputs must be 'broadcast' to 554 a set of views - even in cases where the shader does not reference from 555 gl_ViewID_OVR. 556 557 (13) What should happen if the number of views declared in the shader does 558 not match num_views? 559 560 Resolved: Such a mismatch can only be detected at draw call time, so it 561 would have to either generate a draw call time error, or just result in 562 undefined results for any view > num_views. To avoid undefined results, the 563 draw call time error is preferred. 564 565 (14) How should read operations on FBOs with multiview texture attachments be 566 handled? 567 568 Resolved: Generating INVALID_OPERATION when the target is GL_READ_FRAMEBUFFER 569 for FramebufferTextureMultiviewOVR to disallow attaching a multiview texture 570 to the current read framebuffer is not sufficient to prevent a read operation 571 on a FBO with a multiview texture attachment. The multiview texture may still 572 be attached to the current write framebuffer and then bound as the read 573 framebuffer. Instead, an INVALID_FRAMEBUFFER_OPERATION error should be 574 generated for any read operations that occur whenever a multiview texture is 575 attached to the current read framebuffer. The multiview texture needs to be 576 instead attached as a 2D texture array with the level explicitly specified to 577 be read. This conforms to the expected behavior for read operations on FBOs 578 with multiview texture attachments to be consistent with 579 FramebufferTextureMultisampleMultiviewOVR. 580 581 (15) How do clears apply to framebuffers with multiple views 582 (bugzilla 16173)? 583 584 Resolved: Clears are applied to all views. 585 586 (16) How should blit operations to draw framebuffers with multiple views 587 be handled (bugzilla 16174)? 588 589 Resolved: The options are to broadcast the blit, only blit to a subset 590 of views, or throw an error. There's no particularly compelling use case 591 for either of the first options, so an error would have been desirable. 592 However, this was missed when the extension was initially drafted, and 593 implementations all ended up doing the same thing - blitting to just the 594 first view of the draw framebuffer. 595 596 (17) How do clears apply to framebuffers with multiple views 597 (bugzilla 16173)? 598 599 Resolved: Clears are applied to all views. 600 601 (18) What happens if the num_views layout qualifier has an invalid value 602 like zero or something above MAX_VIEWS_OVR? What happens if num_views 603 is specified multiple times in the same shader, or in multiple vertex 604 shaders (this is only possible in OpenGL)? 605 606 RESOLVED: This is treated similarly to how layout local_size_{x,y,z} is 607 handled in compute shaders: 608 - num_views <= 0 or > MAX_VIEWS_OVR is a compile error 609 - if declared multiple times in the same shader the values 610 must be the same or a compile-time error results. 611 - if declared in multiple shaders attached to the same program object 612 a link-time error results. 613 614 (19) Is the shader built-in variable really called gl_ViewID_OVR? The 615 shading language convention does not normally include an underscore before 616 the vendor suffix. 617 618 RESOLVED: Yes it really is. It doesn't quite follow the standard extension 619 conventions, but there were a number of implementations that already 620 supported it before this was realized. We'll just leave it this way for 621 compatibility. 622 623 (20) Is there a gl_MaxViewsOVR shading language built-in constant? 624 625 RESOLVED: No. Initial implementations didn't provide this. If this ever 626 is made KHR or core functionality, this could be added. 627 628 (21) What is the minimum values permitted for MAX_VIEWS_OVR? 629 630 RESOLVED: 2. But at least 6 is recommended for consistency with Vulkan. 631 Six views is desireable as it can be used to render all faces of a cube map 632 in a single pass. Added state table entries for this in revision 0.8. 633 634 (22) What are the rules to check if anything other than gl_Position 635 depends on gl_ViewID_OVR and what happens if the rules aren't met? 636 637 RESOLVED: It is a compile- or link-time error if it can be determined 638 that an output variable other than gl_Position is statically dependent on 639 gl_ViewID_OVR. However, if an output variable other than gl_Position 640 is dynamically dependent on gl_ViewID_OVR, the results are undefined. 641 642 NOTE: This restriction is relaxed if OVR_multiview2 is supported, 643 and some implementations may not implement these checks even if 644 OVR_multiview2 is not enabled. It is recommended and preferred that 645 all implemenations support OVR_multiview2 and that applications 646 enable the extension when present. 647 648 For non-VTG stages (eg fragment) which don't have a gl_Position output 649 variable this means that no outputs can depend on the gl_VIewID_OVR. 650 It is still possible that shader side effects (such as image or buffer 651 stores, if supported) could be view-dependent. 652 653 (23) What is the behaviour if transform feedback, tessellation or 654 geometry shaders, or timer queries are used? 655 656 RESOLVED: INVALID_OPERATION is generated for any draw operation 657 with when the draw framebuffer is multiview if there is an active 658 tessellation control, tessellation evaluation, or geometery shader, 659 or if transform feedback is active. 660 661 For timer queries there is no good time to do a multiview error check, 662 (because a multiview framebuffer could be bound before or after the 663 timer query has started) and thus the results of the TIME_ELAPSED 664 and TIMESTAMP queries have undefined values if a multiview framebuffer 665 was bound at any time during their execution. 666 667 (24) Do instanced drawing commands (DrawArraysInstanced*, and 668 DrawElementsInstanced*) work with this extension? 669 670 RESOLVED: Yes. No specific edits are required because "It Just Works"(TM) 671 672 (25) Do indirect drawing commands (DrawArraysIndirect, DrawElementsIndirect), 673 work with this extension? 674 675 RESOLVED: Yes. No specific edits are required because "It Just Works"(TM) 676 677 (26) Do multi draw indirect commands (MultiDrawArraysIndirect, 678 MultiDrawElementsIndirect) work with this extension? 679 680 RESOLVED: Yes. No specific edits are required because "It Just Works"(TM) 681 682 (27) What happens if the <baseViewIndex> + <numViews> is out of range? 683 For example, if it's greater than the number of layers in the attached 684 texture or greater than MAX_ARRAY_TEXTURE_LAYERS? 685 686 RESOLVED: In cases there the resulting value could never be a valid 687 <layer> argument to FramebufferTextureLayer, the INVALID_VALUE value 688 is generated. This follows from the fact that 689 FramebufferTextureMultiviewOVR is defined in terms of 690 FramebufferTextureLayer. For cases which are dependant on the properties 691 of a specific texture (referencing more layers than exist), this is a 692 to be a framebuffer attachment completeness check as this can change if 693 the texture is redefined after the FramebufferTextureMultiviewOVR call. 694 695 (28) What is the value of FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER after 696 FramebufferTextureMultiviewOVR is called? 697 698 RESOLVED: It is set it to the value of <baseViewIndex>. 699 A FRAMEBUFFER_ATTACHMENT_MULTIVIEW_OVR framebuffer property would be 700 useful here.. 701 702 (29) Should there be a FRAMEBUFFER_ATTACHMENT_MULTIVIEW_OVR property to 703 indicate multiview framebuffers, similar to the 704 FRAMEBUFFER_ATTACHMENT_LAYERED property? 705 706 RESOLVED: No. Ideally there would to allow distinguising between 707 layered framebuffers and multiview framebuffers, and to know which of 708 FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, 709 FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR, and 710 FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR are valid. 711 Unfortunately existing implementations don't have this, so it will 712 just have to be implied. This is something that could be improved in 713 a promoted version of this extension. 714 715 (30) What types of textures can be used for multiview rendering? 716 Two-dimensional array textures at a minimum, what about three- 717 dimensional, cube map, cube map array or two-dimensional 718 multisample textures which are also accepted by FramebufferTextureLayer 719 (which is what this extension is defined in terms of). 720 721 RESOLVED. The initial extension is limited to two-dimensional array 722 textures. A future extension could extend it further if there is demand. 723 724 (31) Is multiview supported for compute shaders? If so, how would it work? 725 726 RESOLVED. No. Multiview rendering is orthogonal to compute shaders since 727 Dispatch* commands do not operate on framebuffer attachments and therefore 728 it is meaningless to try to describe interactions with multiview 729 framebuffers. Prior to revision 3, this specification stated that 730 gl_ViewID_OVR was available in the compute shading language but not all 731 implementations did so, and for those that did, it is impossible for it 732 to ever have a value other than 0. 733 734 (32) If geometry and tessellation shaders are not supported with multiview 735 rendering why allow gl_ViewID_OVR to be accepted in tessellation and 736 geometry shaders? 737 738 RESOLVED. There is no benefit. This was removed in revision 3. Older 739 drivers may of course continue to allow such shaders to compile, but 740 it is not possible to use them. 741 742 (33) How does the gl_Layer builtin input in the fragment shader interact 743 with multiview? 744 745 RESOLVED: Whenever a multiview framebuffer is bound, the contents of 746 gl_Layer in the fragment shader are undefined. This is consistent with 747 issue (1), which disallows geometry shader with multiview framebuffers. 748 749 (34) How does this extension interact with the OpenGL Compatibility 750 Profile? 751 752 RESOLVED: When a multiview framebuffer is bound, Begin/End may render to a 753 subset of the views in the framebuffer. (Specifically which views is 754 undefined, and may be any subset of the views attached to the framebuffer, 755 including the null set.) 756 757 758Revision History 759 760 Rev. Date Author Changes 761 ---- -------- -------- ----------------------------------------- 762 0.1 10/17/14 cass Initial draft 763 0.2 11/10/14 cass Changes to use texture array instead of separate FBOs 764 0.3 02/05/15 cass Only gl_Position can be view dependent in the vertex shader. 765 0.4 02/11/15 cass Switch to view instead of layer, as these are distinct now 766 0.5 04/15/15 cass Clean up pass before publishing 767 0.6 07/01/16 nigelw Modify errors to conform to multisample multiview spec changes 768 0.7 07/25/17 tjh Clarify Blit and Clear behaviours, and fixed framebuffer attachment 769 binding psuedocode (bugzillas 16173, 16174, 16176) 770 1 10/10/17 dgkoch Completed extension. 771 - Rebased on ES 3.2 (and OpenGL 4.6 where necessary) and added 772 extension interactions 773 - Added DSA command for GL: NamedFramebufferTextureMultiviewOVR 774 - properly documented gl_ViewID_OVR and behaviour 775 - documented error behavior for num_views 776 - added error behavior for tess, geom, xfb, and timer queries 777 - documented new FRAMEBUFFER_ATTACHMENT*OVR variables 778 - clarify that only 2D-array textures are supported 779 - better document new framebuffer completeness conditions 780 - document MAX_VIEWS_OVR and specify minimum value (2) 781 - added issues 18-30 782 2 11/15/17 dgkoch Fix tessellation typos. Fix incorrect reference to compute shaders 783 instead of vertex shaders. 784 3 12/13/17 dgkoch Clarify that compute shaders are orthogonal to multiview 785 framebuffers (Issue 31). Remove gl_ViewID_OVR from compute, 786 tessellation, and geometry shaders. 787 4 05/02/18 jhelferty Clarify interop rules for gl_Layer in fragment shader (33), and 788 interop with compatibility profile's Begin/End (34). Add mention 789 of OES_geometry_shader and OES_tessellation_shader to interop. 790 Clarify what happens when transform feedback is paused. 791 5 07/25/18 oetuaho Fix off-by-one issue in baseViewIndex + numViews check. 792 6 10/19/18 dgkoch Add standard boiler plate shader extension language. 793 794