gfx/angle/extensions/EXT_draw_buffers.txt

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 Name
michael@0 2
michael@0 3 EXT_draw_buffers
michael@0 4
michael@0 5 Name Strings
michael@0 6
michael@0 7 GL_EXT_draw_buffers
michael@0 8
michael@0 9 Contributors
michael@0 10
michael@0 11 Contributors to GL_NV_draw_buffers
michael@0 12 Contributors to GL_NV_fbo_color_attachments
michael@0 13 Contributors to the OpenGL ES 2.0 specification
michael@0 14 Contributors to the OpenGLSL ES 1.0.17 specification
michael@0 15 Contributors to the OpenGL ES 3.0 specification
michael@0 16 Nicolas Capens, TransGaming Inc.
michael@0 17 Daniel Koch, TransGaming Inc.
michael@0 18 Alastair Patrick, Google Inc.
michael@0 19 Kenneth Russell, Google Inc.
michael@0 20 Greg Roth, NVIDIA Corporation
michael@0 21 Ben Bowman, Imagination Technologies
michael@0 22 Members of the WebGL and OpenGL ES working groups
michael@0 23
michael@0 24 Contact
michael@0 25
michael@0 26 Daniel Koch (daniel 'at' transgaming.com)
michael@0 27
michael@0 28 Status
michael@0 29
michael@0 30 Draft Complete
michael@0 31
michael@0 32 Version
michael@0 33
michael@0 34 Last Modified Date: January 30, 2013
michael@0 35 Revision: #7
michael@0 36
michael@0 37 Number
michael@0 38
michael@0 39 TBD
michael@0 40
michael@0 41 Dependencies
michael@0 42
michael@0 43 OpenGL ES 2.0 is required.
michael@0 44
michael@0 45 The extension is written against the OpenGL ES 2.0 specification.
michael@0 46
michael@0 47 ANGLE_framebuffer_blit affects the definition of this extension.
michael@0 48 APPLE_framebuffer_multisample affects the definitin of this extension.
michael@0 49
michael@0 50 Overview
michael@0 51
michael@0 52 This extension increases the number of available framebuffer object
michael@0 53 color attachment points, extends OpenGL ES 2.0 to allow multiple output
michael@0 54 colors, and provides a mechanism for directing those outputs to
michael@0 55 multiple color buffers.
michael@0 56
michael@0 57 This extension is similar to the combination of the GL_NV_draw_buffers
michael@0 58 and GL_NV_fbo_color_attachments extensions, but imposes certain
michael@0 59 restrictions informed by the OpenGL ES 3.0 API.
michael@0 60
michael@0 61 New Procedures and Functions
michael@0 62
michael@0 63 void DrawBuffersEXT(sizei n, const enum *bufs);
michael@0 64
michael@0 65 New Tokens
michael@0 66
michael@0 67 Accepted by the <pname> parameter of GetIntegerv:
michael@0 68
michael@0 69 MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
michael@0 70
michael@0 71 Accepted by the <pname> parameters of GetIntegerv and GetFloatv:
michael@0 72
michael@0 73 MAX_DRAW_BUFFERS_EXT 0x8824
michael@0 74 DRAW_BUFFER0_EXT 0x8825
michael@0 75 DRAW_BUFFER1_EXT 0x8826
michael@0 76 DRAW_BUFFER2_EXT 0x8827
michael@0 77 DRAW_BUFFER3_EXT 0x8828
michael@0 78 DRAW_BUFFER4_EXT 0x8829
michael@0 79 DRAW_BUFFER5_EXT 0x882A
michael@0 80 DRAW_BUFFER6_EXT 0x882B
michael@0 81 DRAW_BUFFER7_EXT 0x882C
michael@0 82 DRAW_BUFFER8_EXT 0x882D
michael@0 83 DRAW_BUFFER9_EXT 0x882E
michael@0 84 DRAW_BUFFER10_EXT 0x882F
michael@0 85 DRAW_BUFFER11_EXT 0x8830
michael@0 86 DRAW_BUFFER12_EXT 0x8831
michael@0 87 DRAW_BUFFER13_EXT 0x8832
michael@0 88 DRAW_BUFFER14_EXT 0x8833
michael@0 89 DRAW_BUFFER15_EXT 0x8834
michael@0 90
michael@0 91 Accepted by the <attachment> parameter of FramebufferRenderbuffer,
michael@0 92 FramebufferTexture2D and GetFramebufferAttachmentParameteriv, and by
michael@0 93 the <bufs> parameter of DrawBuffersEXT:
michael@0 94
michael@0 95 COLOR_ATTACHMENT0_EXT 0x8CE0
michael@0 96 COLOR_ATTACHMENT1_EXT 0x8CE1
michael@0 97 COLOR_ATTACHMENT2_EXT 0x8CE2
michael@0 98 COLOR_ATTACHMENT3_EXT 0x8CE3
michael@0 99 COLOR_ATTACHMENT4_EXT 0x8CE4
michael@0 100 COLOR_ATTACHMENT5_EXT 0x8CE5
michael@0 101 COLOR_ATTACHMENT6_EXT 0x8CE6
michael@0 102 COLOR_ATTACHMENT7_EXT 0x8CE7
michael@0 103 COLOR_ATTACHMENT8_EXT 0x8CE8
michael@0 104 COLOR_ATTACHMENT9_EXT 0x8CE9
michael@0 105 COLOR_ATTACHMENT10_EXT 0x8CEA
michael@0 106 COLOR_ATTACHMENT11_EXT 0x8CEB
michael@0 107 COLOR_ATTACHMENT12_EXT 0x8CEC
michael@0 108 COLOR_ATTACHMENT13_EXT 0x8CED
michael@0 109 COLOR_ATTACHMENT14_EXT 0x8CEE
michael@0 110 COLOR_ATTACHMENT15_EXT 0x8CEF
michael@0 111
michael@0 112 The COLOR_ATTACHMENT0_EXT constant is equal to the
michael@0 113 COLOR_ATTACHMENT0 constant.
michael@0 114
michael@0 115 Each COLOR_ATTACHMENT<i>_EXT adheres to COLOR_ATTACHMENT<i>_EXT
michael@0 116 = COLOR_ATTACHMENT0_EXT + <i>.
michael@0 117
michael@0 118 Changes to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
michael@0 119
michael@0 120 Section 3.2, (Multisampling). Replace the second paragraph:
michael@0 121
michael@0 122 An additional buffer, called the multisample buffer, is added to the
michael@0 123 window system-provided framebuffer. Pixel sample values, including
michael@0 124 color, depth, and stencil values, are stored in this buffer. Samples
michael@0 125 contain separate color values for each fragment color. When the
michael@0 126 window system-provided framebuffer includes a multisample buffer, it
michael@0 127 does not include depth or stencil buffers, even if the multisample
michael@0 128 buffer does not store depth or stencil values. Color buffers do
michael@0 129 coexist with the multisample buffer, however.
michael@0 130
michael@0 131 Section 3.8.2, (Shader Execution) Replace subsection "Shader
michael@0 132 Outputs":
michael@0 133
michael@0 134 The OpenGL ES Shading Language specification describes the values
michael@0 135 that may be output by a fragment shader. These are gl_FragColor and
michael@0 136 gl_FragData[n]. The final fragment color values or the final
michael@0 137 fragment data values written by a fragment shader are clamped to the
michael@0 138 range [0, 1] and then converted to fixed-point as described in
michael@0 139 section 2.1.2 for framebuffer color components.
michael@0 140
michael@0 141 Writing to gl_FragColor specifies the fragment color (color number
michael@0 142 zero) that will be used by subsequent stages of the pipeline.
michael@0 143 Writing to gl_FragData[n] specifies the value of fragment color
michael@0 144 number n. Any colors, or color components, associated with a
michael@0 145 fragment that are not written by the fragment shader are undefined.
michael@0 146 A fragment shader may not statically assign values to both
michael@0 147 gl_FragColor and gl_FragData. In this case, a compile or link error
michael@0 148 will result. A shader statically assigns a value to a variable if,
michael@0 149 after preprocessing, it contains a statement that would write to the
michael@0 150 variable, whether or not run-time flow of control will cause that
michael@0 151 statement to be executed.
michael@0 152
michael@0 153 Changes to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
michael@0 154 Operations and the Frame Buffer)
michael@0 155
michael@0 156 Modify the overview of Chapter 4 and replace the sentences
michael@0 157 of the fifth paragraph which read:
michael@0 158
michael@0 159 "The name of the color buffer of an application-created framebuffer
michael@0 160 object is COLOR_ATTACHMENT0. The names of the depth and stencil buffers
michael@0 161 are DEPTH_ATTACHMENT and STENCIL_ATTACHMENT."
michael@0 162
michael@0 163 With the following:
michael@0 164
michael@0 165 "A framebuffer object has an array of color buffer attachment points,
michael@0 166 numbered zero through <n>, a depth buffer attachment point, and a
michael@0 167 stencil buffer attachment point."
michael@0 168
michael@0 169 Insert Table 4.3 to Section 4.2.1 (and renumber subsequent tables):
michael@0 170
michael@0 171 Symbolic Constant Meaning
michael@0 172 ----------------- ---------------------
michael@0 173 NONE No buffer
michael@0 174
michael@0 175 COLOR_ATTACHMENT<i>_EXT (see caption) Output fragment color to image
michael@0 176 attached at color attachment
michael@0 177 point i
michael@0 178
michael@0 179 Table 4.3: Arguments to DrawBuffersEXT when the context is bound to a
michael@0 180 framebuffer object, and the buffers they indicate. <i> in
michael@0 181 COLOR_ATTACHMENT<i>_EXT may range from zero to the value of
michael@0 182 MAX_COLOR_ATTACHMENTS_EXT minus one.
michael@0 183
michael@0 184 Replace Section 4.2.1, "Selecting a Buffer for Writing" with the following:
michael@0 185
michael@0 186 "By default, color values are written into the front buffer for
michael@0 187 single buffered surfaces or into the back buffer for back buffered
michael@0 188 surfaces as determined when making the context current. To control
michael@0 189 the color buffer into which each of the fragment color values is
michael@0 190 written, DrawBuffersEXT is used.
michael@0 191
michael@0 192 The command
michael@0 193
michael@0 194 void DrawBuffersEXT(sizei n, const enum *bufs);
michael@0 195
michael@0 196 defines the draw buffers to which all fragment colors are written.
michael@0 197 <n> specifies the number of buffers in <bufs>. <bufs> is a pointer
michael@0 198 to an array of symbolic constants specifying the buffer to which
michael@0 199 each fragment color is written.
michael@0 200
michael@0 201 Each buffer listed in <bufs> must be BACK, NONE, or one of the
michael@0 202 values from table 4.3. Further, acceptable values for the constants
michael@0 203 in <bufs> depend on whether the GL is using the default framebuffer
michael@0 204 (i.e., DRAW_FRAMEBUFFER_BINDING is zero), or a framebuffer object
michael@0 205 (i.e., DRAW_FRAMEBUFFER_BINDING is non-zero). For more information
michael@0 206 about framebuffer objects, see section 4.4.
michael@0 207
michael@0 208 If the GL is bound to the default framebuffer, then <n> must be 1
michael@0 209 and the constant must be BACK or NONE. When draw buffer zero is
michael@0 210 BACK, color values are written into the sole buffer for single-
michael@0 211 buffered contexts, or into the back buffer for double-buffered
michael@0 212 contexts. If DrawBuffersEXT is supplied with a constant other than
michael@0 213 BACK and NONE, the error INVALID_OPERATION is generated.
michael@0 214
michael@0 215 If the GL is bound to a draw framebuffer object, then each of the
michael@0 216 constants must be one of the values listed in table 4.3.
michael@0 217
michael@0 218 In both cases, the draw buffers being defined correspond in order to
michael@0 219 the respective fragment colors. The draw buffer for fragment
michael@0 220 colors beyond <n> is set to NONE.
michael@0 221
michael@0 222 The maximum number of draw buffers is implementation-dependent. The
michael@0 223 number of draw buffers supported can be queried by calling
michael@0 224 GetIntegerv with the symbolic constant MAX_DRAW_BUFFERS_EXT. An
michael@0 225 INVALID_VALUE error is generated if <n> is greater than
michael@0 226 MAX_DRAW_BUFFERS_EXT.
michael@0 227
michael@0 228 If the GL is bound to a draw framebuffer object, the <i>th buffer listed
michael@0 229 in <bufs> must be COLOR_ATTACHMENT<i>_EXT or NONE. Specifying a
michael@0 230 buffer out of order, BACK, or COLOR_ATTACHMENT<m>_EXT where <m> is
michael@0 231 greater than or equal to the value of MAX_COLOR_ATTACHMENTS_EXT,
michael@0 232 will generate the error INVALID_OPERATION.
michael@0 233
michael@0 234 If a fragment shader writes to "gl_FragColor", DrawBuffersEXT
michael@0 235 specifies the set of draw buffers into which the color
michael@0 236 written to "gl_FragColor" is written. If a fragment shader writes to
michael@0 237 "gl_FragData", DrawBuffersEXT specifies a set of draw buffers
michael@0 238 into which each of the multiple output colors defined by these
michael@0 239 variables are separately written. If a fragment shader writes to
michael@0 240 neither "gl_FragColor" nor "gl_FragData" the values of the
michael@0 241 fragment colors following shader execution are undefined, and may
michael@0 242 differ for each fragment color.
michael@0 243
michael@0 244 Indicating a buffer or buffers using DrawBuffersEXT causes
michael@0 245 subsequent pixel color value writes to affect the indicated
michael@0 246 buffers. If the GL is bound to a draw framebuffer object and a draw
michael@0 247 buffer selects an attachment that has no image attached, then that
michael@0 248 fragment color is not written.
michael@0 249
michael@0 250 Specifying NONE as the draw buffer for a fragment color will inhibit
michael@0 251 that fragment color from being written.
michael@0 252
michael@0 253 The state required to handle color buffer selection for each
michael@0 254 framebuffer is an integer for each supported fragment color. For the
michael@0 255 default framebuffer, in the initial state the draw buffer for
michael@0 256 fragment color zero is BACK if there is a default framebuffer
michael@0 257 associated with the context, otherwise NONE. For framebuffer
michael@0 258 objects, in the initial state the draw buffer for fragment color
michael@0 259 zero is COLOR_ATTACHMENT0_EXT.
michael@0 260
michael@0 261 For both the default framebuffer and framebuffer objects, the
michael@0 262 initial state of draw buffers for fragment colors other than zero is
michael@0 263 NONE.
michael@0 264
michael@0 265 The value of the draw buffer selected for fragment color <i> can be
michael@0 266 queried by calling GetIntegerv with the symbolic constant
michael@0 267 DRAW_BUFFER<i>_EXT."
michael@0 268
michael@0 269 Modify Section 4.2.3 (Clearing the Buffers) and replace the first
michael@0 270 two paragraphs with the following:
michael@0 271
michael@0 272 "The GL provides a means for setting portions of every pixel in a
michael@0 273 particular buffer to the same value. The argument to
michael@0 274
michael@0 275 void Clear(bitfield buf);
michael@0 276
michael@0 277 is the bitwise OR of a number of values indicating which buffers are
michael@0 278 to be cleared. The values are COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT, and
michael@0 279 STENCIL_BUFFER_BIT, indicating the buffers currently enabled for color
michael@0 280 writing, the depth buffer, and the stencil buffer (see below),
michael@0 281 respectively. The value to which each buffer is cleared depends on
michael@0 282 the setting of the clear value for that buffer. If the mask is not a
michael@0 283 bitwise OR of the specified values, then the error INVALID_VALUE is
michael@0 284 generated.
michael@0 285
michael@0 286 void ClearColor(clampf r, clampf, g, clampf b, clampf a);
michael@0 287
michael@0 288 sets the clear value for fixed-point color buffers. Each of the
michael@0 289 specified components is clamped to [0, 1] and converted to fixed-point
michael@0 290 as described in section 2.1.2 for framebuffer color components."
michael@0 291
michael@0 292 Replace the second paragraph of Section 4.4.1 (Binding and Managing
michael@0 293 Framebuffer Objects) with the following:
michael@0 294
michael@0 295 "The namespace for framebuffer objects is the unsigned integers, with
michael@0 296 zero reserved by OpenGL ES to refer to the default framebuffer. A
michael@0 297 framebuffer object is created by binding an unused name to the
michael@0 298 target FRAMEBUFFER, DRAW_FRAMEBUFFER, or READ_FRAMEBUFFER. The binding
michael@0 299 is effected by calling
michael@0 300
michael@0 301 void BindFramebuffer(enum target, uint framebuffer);
michael@0 302
michael@0 303 with <target> set the desired framebuffer target and <framebuffer> set
michael@0 304 to the unused name. The resulting framebuffer object is a new state
michael@0 305 vector. There is a number of color attachment points, plus one each
michael@0 306 for the depth and stencil attachment points. The number of color attachment
michael@0 307 points is equal to the value of MAX_COLOR_ATTACHMENTS_EXT."
michael@0 308
michael@0 309 Replace the third item in the bulleted list in Section 4.4.1 (Binding
michael@0 310 and Managing Framebuffer Objects) with the following:
michael@0 311
michael@0 312 " * The only color buffer bitplanes are the ones defined by the
michael@0 313 framebuffer attachments points named COLOR_ATTACHMENT0_EXT through
michael@0 314 COLOR_ATTACHMENT<n>_EXT."
michael@0 315
michael@0 316 Modify Section 4.4.3 (Renderbuffer Objects) in the
michael@0 317 "Attaching Renderbuffer Images to a Framebuffer" subsection as follows:
michael@0 318
michael@0 319 Insert the following table:
michael@0 320
michael@0 321 Name of attachment
michael@0 322 ---------------------------------------
michael@0 323 COLOR_ATTACHMENT<i>_EXT (see caption)
michael@0 324 DEPTH_ATTACHMENT
michael@0 325 STENCIL_ATTACHMENT
michael@0 326
michael@0 327 Table 4.x: Framebuffer attachment points. <i> in COLOR_ATTACHMENT<i>_EXT
michael@0 328 may range from zero to the value of MAX_COLOR_ATTACHMENTS_EXT minus 1.
michael@0 329
michael@0 330 Modify the third sentence of the paragraph following the definition of
michael@0 331 FramebufferRenderbuffer to be as follows:
michael@0 332
michael@0 333 "<attachment> should be set to one of the attachment points of the
michael@0 334 framebuffer listed in Table 4.x."
michael@0 335
michael@0 336 Modify Section 4.4.3 (Renderbuffer Objects) in the "Attaching Texture
michael@0 337 Images to a Framebuffer" subsection as follows:
michael@0 338
michael@0 339 Modify the last sentence of the paragraph following the definition of
michael@0 340 FramebufferTexture2D to be as follows:
michael@0 341
michael@0 342 "<attachment> must be one of the attachment points of the framebuffer
michael@0 343 listed in Table 4.x."
michael@0 344
michael@0 345 Modify Section 4.4.5 (Framebuffer Completeness) and replace the 3rd
michael@0 346 item in the bulleted list in the "Framebuffer Attachment Completeness"
michael@0 347 subsection with the following:
michael@0 348
michael@0 349 " * If <attachment> is COLOR_ATTACHMENT<i>_EXT, then <image> must
michael@0 350 have a color-renderable internal format."
michael@0 351
michael@0 352 Changes to Chapter 6 of the OpenGL ES 2.0 Specification (State and
michael@0 353 State Requests)
michael@0 354
michael@0 355 In section 6.1.3 (Enumerated Queries) modify the third sentence in
michael@0 356 the definition of GetFramebufferAttachmentParameteriv to be as follows:
michael@0 357
michael@0 358 "<attachment> must be one of the attachment points of the framebuffer
michael@0 359 listed in Table 4.x."
michael@0 360
michael@0 361 Changes to Chapter 3 of the OpenGL ES Shading Language 1.0.17 Specification (Basics)
michael@0 362
michael@0 363 Add a new section:
michael@0 364
michael@0 365 3.4.1 GL_EXT_draw_buffers Extension
michael@0 366
michael@0 367 To use the GL_EXT_draw_buffers extension in a shader it
michael@0 368 must be enabled using the #extension directive.
michael@0 369
michael@0 370 The shading language preprocessor #define
michael@0 371 GL_EXT_draw_buffers will be defined to 1, if the
michael@0 372 GL_EXT_draw_buffers extension is supported.
michael@0 373
michael@0 374 Dependencies on ANGLE_framebuffer_blit and APPLE_framebuffer_multisample:
michael@0 375
michael@0 376 If neither ANGLE_framebuffer_blit nor APPLE_framebuffer_multisample are
michael@0 377 supported, then all references to "draw framebuffers" should be replaced
michael@0 378 with references to "framebuffers". References to DRAW_FRAMEBUFFER_BINDING
michael@0 379 should be replaced with references to FRAMEBUFFER_BINDING. References to
michael@0 380 DRAW_FRAMEBUFFER and READ_FRAMEBUFFER should be removed.
michael@0 381
michael@0 382 If ANGLE_framebuffer_blit is supported, DRAW_FRAMEBUFFER_BINDING, DRAW_FRAMEBUFFER
michael@0 383 and READ_FRAMEBUFFER all refer to corresponding _ANGLE suffixed names
michael@0 384 (they have the same token values).
michael@0 385
michael@0 386 If APPLE_framebuffer_multisample is supported, DRAW_FRAMEBUFFER_BINDING,
michael@0 387 DRAW_FRAMEBUFFER and READ_FRAMEBUFFER all refer to the corresponding _APPLE
michael@0 388 suffixed names (they have the same token values).
michael@0 389
michael@0 390 Errors
michael@0 391
michael@0 392 The INVALID_OPERATION error is generated if DrawBuffersEXT is called
michael@0 393 when the default framebuffer is bound and any of the following conditions
michael@0 394 hold:
michael@0 395 - <n> is greater than 1 and less than MAX_DRAW_BUFFERS_EXT,
michael@0 396 - <bufs> contains a value other than BACK or NONE.
michael@0 397
michael@0 398 The INVALID_OPERATION error is generated if DrawBuffersEXT is called
michael@0 399 when bound to a draw framebuffer object and any of the following
michael@0 400 conditions hold:
michael@0 401 - the <i>th value in <bufs> is not COLOR_ATTACHMENT<i>_EXT or NONE.
michael@0 402
michael@0 403 The INVALID_VALUE error is generated if DrawBuffersEXT is called
michael@0 404 with a value of <n> which is greater than MAX_DRAW_BUFFERS_EXT.
michael@0 405
michael@0 406 The INVALID_ENUM error is generated by FramebufferRenderbuffer if
michael@0 407 the <attachment> parameter is not one of the values listed in Table 4.x.
michael@0 408
michael@0 409 The INVALID_ENUM error is generated by FramebufferTexture2D if
michael@0 410 the <attachment> parameter is not one of the values listed in Table 4.x.
michael@0 411
michael@0 412 The INVALID_ENUM error is generated by GetFramebufferAttachmentParameteriv
michael@0 413 if the <attachment> parameter is not one of the values listed in Table 4.x.
michael@0 414
michael@0 415 New State
michael@0 416
michael@0 417 Add Table 6.X Framebuffer (State per framebuffer object):
michael@0 418
michael@0 419 State Type Get Command Initial Value Description
michael@0 420 ------------------ ---- ------------ ------------- -----------
michael@0 421 DRAW_BUFFER<i>_EXT Z10* GetIntegerv see 4.2.1 Draw buffer selected
michael@0 422 for fragment color i
michael@0 423
michael@0 424 Add to Table 6.18 (Implementation Dependent Values)
michael@0 425
michael@0 426 Get value Type Get Cmnd Minimum Value Description Sec.
michael@0 427 -------------------- ---- ----------- ------------- ----------- -----
michael@0 428 MAX_DRAW_BUFFERS_EXT Z+ GetIntegerv 1 Maximum number of 4.2.1
michael@0 429 active draw buffers
michael@0 430 MAX_COLOR_ATTACHMENTS_EXT Z+ GetIntegerv 1 Number of framebuffer 4.4.1
michael@0 431 color attachment points
michael@0 432 Issues
michael@0 433
michael@0 434 See ARB_draw_buffers for relevant issues.
michael@0 435
michael@0 436 1) What are the differences between this extension and NV_draw_buffers
michael@0 437 + NV_fbo_color_attachments?
michael@0 438
michael@0 439 RESOLVED. This extension:
michael@0 440 - adds interactions with blit_framebuffer and the separate
michael@0 441 draw/read binding points
michael@0 442 - The draw buffer and color attachment limits are global instead
michael@0 443 of per-fbo (see Issue 2)
michael@0 444 - can be used to with default framebuffer to set NONE/BACK (see Issue 4)
michael@0 445 - retains the ordering restrictions on color attachments that are
michael@0 446 imposed by ES 3.0.
michael@0 447
michael@0 448 2) Should the MAX_DRAW_BUFFERS_EXT and MAX_COLOR_ATTACHMENTS_EXT limits
michael@0 449 be per-framebuffer values or implementation dependent constants?
michael@0 450
michael@0 451 DISCUSSION: In ARB_draw_buffers this was per-context (see Issue 2).
michael@0 452 EXT_framebuffer_object (and subsequently ARB_framebuffer_object, and GL 3.0
michael@0 453 through GL 4.2) made these queries framebuffer-dependent.
michael@0 454 However in GL 4.3 and GLES 3.0, these limits were changed from
michael@0 455 framebuffer-dependent state to implementation-dependent state after
michael@0 456 much discussion (Bug 7990).
michael@0 457
michael@0 458 NV_draw_buffers has MAX_DRAW_BUFFERS listed as per-framebuffer state,
michael@0 459 but NV_fbo_color_attachments has MAX_COLOR_ATTACHMENTS as an
michael@0 460 implementation-dependent constant.
michael@0 461
michael@0 462 This is relevant because some implementations are not able to support
michael@0 463 multisampling in conjuction with multiple color attachments. If the
michael@0 464 query is per-framebuffer, they can report a maximum of one attachment
michael@0 465 when there are multisampled attachments, but a higher limit when only
michael@0 466 single-sampled attachments are present.
michael@0 467
michael@0 468 RESOLVED. Make this global context state as this is most consistent
michael@0 469 with GLES 3.0 and updated GL drivers. In an implementation cannot
michael@0 470 support multisampling in conjunction with multiple color attachments,
michael@0 471 perhaps such an implementation could report FBO incomplete in this
michael@0 472 situation, but this is less than desirable.
michael@0 473
michael@0 474 3) Should we support broadcast from gl_FragColor to all gl_FragData[x]
michael@0 475 or should it be synonymous with gl_FragData[0]?
michael@0 476
michael@0 477 DISCUSSION: With NV_draw_buffers, writing to gl_FragColor writes to all
michael@0 478 the enabled draw buffers (ie broadcast). In OpenGL ES 3.0 when using
michael@0 479 ESSL 1.0, gl_FragColor is equivalent to writing a single output to
michael@0 480 gl_FragData[0] and multiple outputs are not possible. When using ESSL 3.0,
michael@0 481 only user-defined out variables may be used.
michael@0 482
michael@0 483 If broadcast is supported, some implementations may have to replace
michael@0 484 writes to gl_FragColor with replicated writes to all possible gl_FragData
michael@0 485 locations when this extension is enabled.
michael@0 486
michael@0 487 RESOLVED: Writes to gl_FragColor are broadcast to all enabled color
michael@0 488 buffers. ES 3.0 using ESSL 1.0 doesn't support broadcast because
michael@0 489 ESSL 1.0 was not extended to have multiple color outputs (but that is
michael@0 490 what this extension adds). ESSL 3.0 doesn't support the broadcast because
michael@0 491 it doesn't have the gl_FragColor variable at all, and only has user-
michael@0 492 defined out variables. This extension extends ESSL 1.0 to have multiple
michael@0 493 color outputs. Broadcasting from gl_FragColor to all enabled color
michael@0 494 buffers is the most consistent with existing draw buffer extensions to
michael@0 495 date (both NV_draw_buffers and desktop GL).
michael@0 496
michael@0 497 4) Should we allow DrawBuffersEXT to be called when the default FBO is
michael@0 498 bound?
michael@0 499
michael@0 500 DISCUSSION: NV_draw_buffers specifies that DrawBuffersNV errors with
michael@0 501 INVALID_OPERATION when the default FBO is bound. OpenGL ES 3.0 allows
michael@0 502 DrawBuffers to toggle between BACK and NONE on the default FBO.
michael@0 503
michael@0 504 An implementation that does not natively support disabling the drawbuffer
michael@0 505 on the default FBO could emulate this by disabling color writes.
michael@0 506
michael@0 507 RESOLVED: Allow DrawBuffersEXT to be called for the default FBO. This
michael@0 508 is more forward looking and is compatible with ES 3.0.
michael@0 509
michael@0 510 5) What are the requirements on the color attachment sizes and formats?
michael@0 511
michael@0 512 RESOLVED: ES 2.0 requires that all color buffers attached to application-
michael@0 513 created framebuffer objects must have the same number of bitplanes
michael@0 514 (Chapter 4 overview p91). ES 2.0 also requires that all attached images
michael@0 515 have the same width and height (Section 4.4.5 Framebuffer Completeness).
michael@0 516 This extension does not lift those requirements, and failing to meet
michael@0 517 them will result in an incomplete FBO.
michael@0 518
michael@0 519 6) Does this have any interactions with glClear?
michael@0 520
michael@0 521 RESOLVED: Yes. When multiple color buffers are enabled for writing,
michael@0 522 glClear clears all of the color buffers. Added language clarifying
michael@0 523 that glClear and glClearColor may affect multiple color buffers.
michael@0 524
michael@0 525 Revision History
michael@0 526
michael@0 527 01/30/2013 dgkoch add issue 6 and clear interactions
michael@0 528 renamed to EXT_draw_buffers based on feedback
michael@0 529 changed resolution of issue 3.
michael@0 530 01/23/2013 dgkoch add resolutions to issues 2-4.
michael@0 531 add issue 5.
michael@0 532 Add Table 4.x and update various explicit
michael@0 533 references to COLOR_ATTACHMENT0.
michael@0 534 Add errors.
michael@0 535 11/13/2012 dgkoch add revision history
michael@0 536 add text from updated ES 3.0 spec
michael@0 537 add issues for discussion
michael@0 538 10/16/2012 kbr update name string
michael@0 539 10/16/2012 kbr remove restrition requiring draw buffer 0 to be non-NULL
michael@0 540 10/12/2012 kbr remove references to GetDoublev and ReadBuffer
michael@0 541 10/11/2012 kbr initial draft extension
michael@0 542

mercurial