Skip to content

Commit

Permalink
Change some WEBGL_multiview errors to be generated at draw (#2420)
Browse files Browse the repository at this point in the history
Make it possible to enable EXT_disjoint_timer_query(2) at the same
time as WEBGL_multiview. This is important particularly for emscripten
compatibility. Emscripten apps enable all available extensions at
initialization. So if a timer query is active, multiview draws and
clears now generate an INVALID_OPERATION error.

Transform feedback related errors are also changed to happen at draw
time rather than at state changes. This is a more elegant API, and
even though making it perform as well is slightly more difficult, a
sufficiently performant implementation should be possible.

Also adds a framebuffer completeness condition that baseViewIndex must
match between attachments. This is required for a performant
implementation on most desktop platforms.
  • Loading branch information
Oletus committed Jul 21, 2017
1 parent 4bac875 commit c219f1a
Showing 1 changed file with 19 additions and 42 deletions.
61 changes: 19 additions & 42 deletions extensions/proposals/WEBGL_multiview/extension.xml
Expand Up @@ -15,33 +15,15 @@
</depends>
<overview>
<mirrors href="https://www.opengl.org/registry/specs/OVR/multiview.txt" name="OVR_multiview">
<addendum>
Attempting to enable this extension when the <code>EXT_disjoint_timer_query</code> extension is enabled generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
Attempting to enable the <code>EXT_disjoint_timer_query</code> extension when this extension is enabled generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
Attempting to enable this extension when the <code>EXT_disjoint_timer_query_webgl2</code> extension is enabled generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
Attempting to enable the <code>EXT_disjoint_timer_query_webgl2</code> extension when this extension is enabled generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
When transform feedback is active, calling <code>framebufferTextureMultiviewWEBGL</code> generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
When transform feedback is active, calling <code>bindFramebuffer</code> with a framebuffer parameter that has multi-view attachments generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
When a framebuffer with multi-view attachments is bound as the draw framebuffer, calling <code>beginTransformFeedback</code> generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
Calling <code>framebufferTextureMultiviewWEBGL</code> with a <code>texture</code> parameter that does not identify a 2D array texture generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
Calling <code>framebufferTextureMultiviewWEBGL</code> with the parameters set so that <code>baseViewIndex</code> + <code>numViews</code> is greater than the value of <code>MAX_ARRAY_TEXTURE_LAYERS</code> generates an <code>INVALID_VALUE</code> error.
</addendum>
<addendum>
If <code>baseViewIndex</code> is not the same for all framebuffer attachment points where the value of <code>FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</code> is not <code>NONE</code> the framebuffer is considered incomplete. Calling getFramebufferStatus for a framebuffer in this state returns <code>FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR</code>.
</addendum>
<addendum>
If <code>baseViewIndex</code> + <code>numViews</code> is greater than the number of texture array elements in the texture bound to <code>target</code>, the framebuffer is considered incomplete. Calling getFramebufferStatus for a framebuffer in this state returns <code>FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR</code>.
</addendum>
Expand Down Expand Up @@ -124,6 +106,12 @@
<addendum>
In OpenGL ES shading language version 1.00 <code>gl_ViewID_OVR</code> has the type <code>int</code> as opposed to <code>uint</code>.
</addendum>
<addendum>
When a timer query is active and the number of views in the current draw framebuffer is greater than 1, attempting to draw or calling <code>clear</code> generates an <code>INVALID_OPERATION</code> error.
</addendum>
<addendum>
When transform feedback is active and the number of views in the current draw framebuffer is greater than 1, attempting to draw generates an <code>INVALID_OPERATION</code> error.
</addendum>
</mirrors>
<features>
<feature>
Expand Down Expand Up @@ -195,27 +183,6 @@ interface WEBGL_multiview {
</function>
</newtok>
<errors>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to enable this extension when the <code>EXT_disjoint_timer_query</code> extension is enabled.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to enable the <code>EXT_disjoint_timer_query</code> extension when this extension is enabled.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to enable this extension when the <code>EXT_disjoint_timer_query_webgl2</code> extension is enabled.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to enable the <code>EXT_disjoint_timer_query_webgl2</code> extension when this extension is enabled.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by calling <code>framebufferTextureMultiviewWEBGL</code> when transform feedback is active.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by calling <code>bindFramebuffer</code> with a <code>framebuffer</code> parameter that has multi-view attachments when transform feedback is active.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by calling <code>beginTransformFeedback</code> when a framebuffer with multi-view attachments is bound as the draw framebuffer,
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by calling <code>framebufferTextureMultiviewWEBGL</code> with a <code>texture</code> parameter that does not identify a 2D array texture.
</error>
Expand All @@ -240,6 +207,12 @@ interface WEBGL_multiview {
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to draw if the active program declares a number of views and the number of views in the draw framebuffer does not match the number of views declared in the active program.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to draw if the number of views in the current draw framebuffer is greater than 1 and transform feedback is active.
</error>
<error>
The error <code>INVALID_OPERATION</code> is generated by attempting to draw or calling <code>clear</code> if the number of views in the current draw framebuffer is greater than 1 and a timer query is active.
</error>
</errors>
<samplecode xml:space="preserve">
<pre>
Expand Down Expand Up @@ -307,5 +280,9 @@ interface WEBGL_multiview {
<revision date="2017/05/23">
<change>Made the extension compatible with WebGL 1.0 and fixed example shader code.</change>
</revision>

<revision date="2017/07/21">
<change>Specified some errors to be generated at draw time and made the extension compatible with emscripten.</change>
</revision>
</history>
</proposal>

0 comments on commit c219f1a

Please sign in to comment.