@@ -348,14 +348,15 @@ <h3><a name="THE_DRAWING_BUFFER">The Drawing Buffer</a></h3>
348348 </ p >
349349 < p >
350350 WebGL presents its drawing buffer to the HTML page compositor immediately before a
351- compositing operation, but only if at least one of the following has occurred since the
351+ compositing operation, but only if at least one of the following have been called since the
352352 previous compositing operation:
353353 < ul >
354354 < li > Context creation</ li >
355355 < li > Canvas resize</ li >
356356 < li >
357- < code > clear</ code > , < code > drawArrays</ code > , or < code > drawElements</ code > has been
358- called while the drawing buffer is the currently bound framebuffer
357+ Any of the
358+ < a href =#DRAW_OPERATIONS > [Draw Operations]</ a > ,
359+ called while the drawing buffer is the currently bound (draw) framebuffer.
359360 </ li >
360361 </ ul >
361362 </ p >
@@ -2575,6 +2576,9 @@ <h4>Texture objects</h4>
25752576 GLint border)
25762577 < span class ="gl-spec "> (< a href ="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-3.7.2 "> OpenGL ES 2.0 §3.7.2</ a > , < a class ="nonnormative " href ="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glCopyTexImage2D.xml "> man page</ a > )</ span >
25772578 < dd >
2579+ A < a href =#READ_OPERATIONS > [Read Operation]</ a > .
2580+ < br >
2581+
25782582 If an attempt is made to call this function with no WebGLTexture bound (see above), an
25792583 < code > INVALID_OPERATION</ code > error is generated. < br > < br >
25802584
@@ -2595,6 +2599,9 @@ <h4>Texture objects</h4>
25952599 GLint x, GLint y, GLsizei width, GLsizei height)
25962600 < span class ="gl-spec "> (< a href ="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-3.7.2 "> OpenGL ES 2.0 §3.7.2</ a > , < a class ="nonnormative " href ="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glCopyTexSubImage2D.xml "> man page</ a > )</ span >
25972601 < dd >
2602+ A < a href =#READ_OPERATIONS > [Read Operation]</ a > .
2603+ < br >
2604+
25982605 If an attempt is made to call this function with no WebGLTexture bound (see above), an
25992606 < code > INVALID_OPERATION</ code > error is generated. < br > < br >
26002607
@@ -3316,43 +3323,66 @@ <h4>Uniforms and attributes</h4>
33163323
33173324<!-- ======================================================================================================= -->
33183325
3319- < h4 > < a name =" WRITING_TO_THE_DRAWING_BUFFER " > Writing to the drawing buffer </ a > </ h4 >
3326+ < h4 > < a id = DRAW_OPERATIONS > Draw Operations </ a > </ h4 >
33203327
33213328 < p >
3322- OpenGL ES 2.0 has 3 calls which can render to the drawing buffer: < code > clear</ code > ,
3323- < code > drawArrays</ code > and < code > drawElements</ code > . Furthermore rendering can
3329+ OpenGL ES 2.0 has several calls which are allowed to
3330+ write to the currently bound (draw) framebuffer.
3331+ WebGL categorizes all such calls as < a href =#DRAW_OPERATIONS > [Draw Operations]</ a > .
3332+ </ p >
3333+ < p >
3334+ Furthermore, rendering can
33243335 be directed to the drawing buffer or to a Framebuffer object. When rendering is
3325- directed to the drawing buffer, making any of the 3 rendering calls shall
3336+ directed to the drawing buffer, making any of the rendering calls shall
33263337 cause the drawing buffer to be presented to the HTML page compositor at the start
33273338 of the next compositing operation.
33283339 </ p >
3329-
33303340 < p >
3331- If any one of these 3 calls attempts to draw to a missing attachment of a complete framebuffer,
3341+ These include, but (due to additions in extensions or in WebGL 2.0) are not limited to:
3342+ < ul >
3343+ < li > < code > clear</ code > </ li >
3344+ < li > < code > drawArrays</ code > </ li >
3345+ < li > < code > drawElements</ code > </ li >
3346+ </ ul >
3347+ For instance,
3348+ < a href ="https://registry.khronos.org/webgl/extensions/ANGLE_instanced_arrays/ "> ANGLE_instanced_arrays</ a >
3349+ adds < code > drawArraysInstancedANGLE</ code > , and
3350+ < a href ="https://registry.khronos.org/webgl/specs/latest/2.0/ "> WebGL 2.0</ a >
3351+ adds < code > drawArraysInstanced</ code > .
3352+ </ p >
3353+ < p >
3354+ If any one of these calls attempts to draw to a missing attachment of a complete framebuffer,
33323355 nothing is drawn to that attachment and no error is generated
33333356 per < a href ="../1.0/index.html#DRAWING_TO_MISSING_ATTACHMENT "> Drawing to a Missing Attachment</ a > .
33343357 </ p >
33353358
33363359 < dl class ="methods ">
33373360 < dt class ="idl-code "> void clear(GLbitfield mask)
33383361 < span class ="gl-spec "> (< a href ="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-4.2.3 "> OpenGL ES 2.0 §4.2.3</ a > , < a class ="nonnormative " href ="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glClear.xml "> man page</ a > )</ span >
3362+ < dd >
3363+ A < a href =#DRAW_OPERATIONS > [Draw Operation]</ a > .
33393364 < dt class ="idl-code "> void drawArrays(GLenum mode, GLint first, GLsizei count)
33403365 < span class ="gl-spec "> (< a href ="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-2.8 "> OpenGL ES 2.0 §2.8</ a > , < a class ="nonnormative " href ="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glDrawArrays.xml "> man page</ a > )</ span >
3341- < dd >
3366+ < dd >
3367+ A < a href =#DRAW_OPERATIONS > [Draw Operation]</ a > .
3368+ < br >
33423369 If < em > first</ em > is negative, an < code > INVALID_VALUE</ code > error will be generated.
33433370 If the CURRENT_PROGRAM is null, an < code > INVALID_OPERATION</ code > error will be generated.
33443371 < dt class ="idl-code "> void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset)
33453372 < span class ="gl-spec "> (< a href ="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-2.8 "> OpenGL ES 2.0 §2.8</ a > , < a class ="nonnormative " href ="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glDrawElements.xml "> man page</ a > )</ span >
33463373 < dd >
3374+ A < a href =#DRAW_OPERATIONS > [Draw Operation]</ a > .
3375+ < br >
33473376 Draw using the currently bound element array buffer. The given offset is in bytes, and
33483377 must be a valid multiple of the size of the given type or an < code > INVALID_OPERATION</ code >
33493378 error will be generated; in addition the offset must be non-negative or an
33503379 < code > INVALID_VALUE</ code > error will be generated; see < a href ="#BUFFER_OFFSET_AND_STRIDE ">
33513380 Buffer Offset and Stride Requirements</ a > . If < code > count</ code > is greater than zero,
33523381 then a non-null < code > WebGLBuffer</ code > must be bound to the < code > ELEMENT_ARRAY_BUFFER</ code >
3353- binding point or an < code > INVALID_OPERATION</ code > error will be generated.< br > < br >
3382+ binding point or an < code > INVALID_OPERATION</ code > error will be generated.< br >
3383+ < br >
33543384 If the CURRENT_PROGRAM is null, an < code > INVALID_OPERATION</ code > error will be generated.
3355-
3385+ < br >
33563386 WebGL performs additional error checking beyond that specified in OpenGL ES 2.0 during
33573387 calls to < code > drawArrays</ code >
33583388 and < code > drawElements</ code > . See < a href ="#ATTRIBS_AND_RANGE_CHECKING "> Enabled Vertex
@@ -3365,17 +3395,33 @@ <h4><a name="WRITING_TO_THE_DRAWING_BUFFER">Writing to the drawing buffer</a></h
33653395
33663396<!-- ======================================================================================================= -->
33673397
3368- < h4 > < a name =" readpixels " > Reading back pixels </ a > </ h4 >
3398+ < h4 > < a id = READ_OPERATIONS > Read Operations </ a > </ h4 >
33693399
33703400 < p >
3371- Pixels in the current framebuffer can be read back into an ArrayBufferView object.
3401+ OpenGL ES 2.0 has several calls which which are allowed to
3402+ read from the currently bound (read) framebuffer.
3403+ WebGL categorizes all such calls as < a href =#READ_OPERATIONS > [Read Operations]</ a > .
3404+ </ p >
3405+ < p >
3406+ These include, but (due to additions in extensions or in WebGL 2.0) are not limited to:
3407+ < ul >
3408+ < li > < code > copyTexImage2D</ code > </ li >
3409+ < li > < code > copyTexSubImage2D</ code > </ li >
3410+ < li > < code > readPixels</ code > </ li >
3411+ </ ul >
33723412 </ p >
33733413
33743414 < dl class ="methods ">
33753415 < dt class ="idl-code "> void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
33763416 GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels)
33773417 < span class ="gl-spec "> (< a href ="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-4.3.1 "> OpenGL ES 2.0 §4.3.1</ a > , < a class ="nonnormative " href ="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glReadPixels.xml "> man page</ a > )</ span >
33783418 < dd >
3419+ A < a href =#READ_OPERATIONS > [Read Operation]</ a > .
3420+ < br >
3421+
3422+ Pixels in the current framebuffer are read back into an ArrayBufferView object.
3423+ < br >
3424+
33793425 Fills < code > pixels</ code > with the pixel data in the specified rectangle of the frame
33803426 buffer. The data returned from readPixels must be up-to-date as of the most recently
33813427 sent drawing command.
@@ -3929,17 +3975,10 @@ <h3><a name="FBO_ATTACHMENTS">Framebuffer Object Attachments</a></h3>
39293975
39303976< ul >
39313977< li > < code > checkFramebufferStatus</ code > must return < code > FRAMEBUFFER_UNSUPPORTED</ code > .
3932- < li > The following calls, which either modify or read the framebuffer, must generate
3978+ < li > < a href =#DRAW_OPERATIONS > [Draw Operations]</ a > and < a href =#READ_OPERATIONS > [Read Operations]</ a > ,
3979+ which either draw to or read from the framebuffer, must generate
39333980 an < code > INVALID_FRAMEBUFFER_OPERATION</ code > error and return early, leaving the contents of
39343981 the framebuffer, destination texture or destination memory untouched.
3935- < ul >
3936- < li > clear
3937- < li > copyTexImage2D
3938- < li > copyTexSubImage2D
3939- < li > drawArrays
3940- < li > drawElements
3941- < li > readPixels
3942- </ ul >
39433982</ ul >
39443983
39453984The following combinations of framebuffer object attachments, when all of the attachments are
@@ -4021,11 +4060,13 @@ <h3><a name="PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a></h3>
40214060< h3 > < a name ="READS_OUTSIDE_FRAMEBUFFER "> Reading Pixels Outside the Framebuffer</ a > </ h3 >
40224061
40234062< p >
4024- In the WebGL API, three functions read the framebuffer: < code > copyTexImage2D</ code > ,
4025- < code > copyTexSubImage2D</ code > , and < code > readPixels</ code > . < code > copyTexImage2D</ code > is defined to
4026- generate the RGBA value (0, 0, 0, 0) for any pixel outside of the bound framebuffer.
4027- < code > copyTexSubImage2D</ code > and < code > readPixels</ code > are defined not to touch the corresponding
4028- destination range for any pixel outside the bound framebuffer.
4063+ For < a href =#READ_OPERATIONS > [Read Operations]</ a > ,
4064+ reads from out-of-bounds pixels sub-areas do not touch their corresponding destination sub-areas.
4065+ </ p >
4066+ < p >
4067+ WebGL (behaves as if it) pre-initializes resources to zeros.
4068+ Therefore for example < code > copyTexImage2D</ code > will have zeros in sub-areas that correspond to
4069+ out-of-bounds framebuffer reads.
40294070</ p >
40304071
40314072< h3 > < a name ="STENCIL_SEPARATE_LIMIT "> Stencil Separate Mask and Reference Value</ a > </ h3 >
@@ -4262,14 +4303,8 @@ <h3><a name="READING_FROM_MISSING_ATTACHMENT">Reading From a Missing Attachment<
42624303 that does not have a color attachment.
42634304</ p >
42644305< p >
4265- In the WebGL API, such operations that require data from an attachment that is missing will
4266- generate an < code > INVALID_OPERATION</ code > error. This applies to the following functions:
4267-
4268- < ul >
4269- < li > < code > copyTexImage2D</ code >
4270- < li > < code > copyTexSubImage2D</ code >
4271- < li > < code > readPixels</ code >
4272- </ ul >
4306+ In the WebGL API, any < a href =#READ_OPERATIONS > [Read Operations]</ a > that require data from an attachment that is missing will
4307+ generate an < code > INVALID_OPERATION</ code > error.
42734308</ p >
42744309
42754310< h3 > < a name ="DRAWING_TO_MISSING_ATTACHMENT "> Drawing To a Missing Attachment</ a > </ h3 >
@@ -4279,14 +4314,9 @@ <h3><a name="DRAWING_TO_MISSING_ATTACHMENT">Drawing To a Missing Attachment</a><
42794314 that does not have a color attachment.
42804315</ p >
42814316< p >
4282- In the WebGL API, such operations that draw to an attachment that is missing will draw
4283- nothing to that attachment. No error is generated. This applies to the following functions:
4284-
4285- < ul >
4286- < li > < code > clear</ code >
4287- < li > < code > drawArrays</ code >
4288- < li > < code > drawElements</ code >
4289- </ ul >
4317+ In the WebGL API, any < a href =#DRAW_OPERATIONS > [Draw Operations]</ a >
4318+ that draw to an attachment that is missing will draw
4319+ nothing to that attachment. No error is generated.
42904320</ p >
42914321
42924322< h3 > < a name ="NAN_LINE_WIDTH "> NaN Line Width</ a > </ h3 >
0 commit comments