15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_draw_buffers 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_draw_buffers 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Contributors to GL_NV_draw_buffers 125bd8deadSopenharmony_ci Contributors to GL_NV_fbo_color_attachments 135bd8deadSopenharmony_ci Contributors to the OpenGL ES 2.0 specification 145bd8deadSopenharmony_ci Contributors to the OpenGLSL ES 1.0.17 specification 155bd8deadSopenharmony_ci Contributors to the OpenGL ES 3.0 specification 165bd8deadSopenharmony_ci Nicolas Capens, TransGaming Inc. 175bd8deadSopenharmony_ci Shannon Woods, TransGaming Inc. 185bd8deadSopenharmony_ci Alastair Patrick, Google Inc. 195bd8deadSopenharmony_ci Kenneth Russell, Google Inc. 205bd8deadSopenharmony_ci Greg Roth, NVIDIA Corporation 215bd8deadSopenharmony_ci Ben Bowman, Imagination Technologies 225bd8deadSopenharmony_ci Members of the WebGL and OpenGL ES working groups 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciContact 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Daniel Koch (dkoch 'at' nvidia.com) 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciStatus 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Complete 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciVersion 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Last Modified Date: May 11, 2013 355bd8deadSopenharmony_ci Revision: #8 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciNumber 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci OpenGL ES Extension #151 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ciDependencies 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci OpenGL ES 2.0 is required. 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci The extension is written against the OpenGL ES 2.0 specification. 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci ANGLE_framebuffer_blit affects the definition of this extension. 485bd8deadSopenharmony_ci APPLE_framebuffer_multisample affects the definitin of this extension. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ciOverview 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci This extension increases the number of available framebuffer object 535bd8deadSopenharmony_ci color attachment points, extends OpenGL ES 2.0 to allow multiple output 545bd8deadSopenharmony_ci colors, and provides a mechanism for directing those outputs to 555bd8deadSopenharmony_ci multiple color buffers. 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci This extension is similar to the combination of the GL_NV_draw_buffers 585bd8deadSopenharmony_ci and GL_NV_fbo_color_attachments extensions, but imposes certain 595bd8deadSopenharmony_ci restrictions informed by the OpenGL ES 3.0 API. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ciNew Procedures and Functions 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci void DrawBuffersEXT(sizei n, const enum *bufs); 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ciNew Tokens 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetIntegerv: 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci MAX_COLOR_ATTACHMENTS_EXT 0x8CDF 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci Accepted by the <pname> parameters of GetIntegerv and GetFloatv: 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci MAX_DRAW_BUFFERS_EXT 0x8824 745bd8deadSopenharmony_ci DRAW_BUFFER0_EXT 0x8825 755bd8deadSopenharmony_ci DRAW_BUFFER1_EXT 0x8826 765bd8deadSopenharmony_ci DRAW_BUFFER2_EXT 0x8827 775bd8deadSopenharmony_ci DRAW_BUFFER3_EXT 0x8828 785bd8deadSopenharmony_ci DRAW_BUFFER4_EXT 0x8829 795bd8deadSopenharmony_ci DRAW_BUFFER5_EXT 0x882A 805bd8deadSopenharmony_ci DRAW_BUFFER6_EXT 0x882B 815bd8deadSopenharmony_ci DRAW_BUFFER7_EXT 0x882C 825bd8deadSopenharmony_ci DRAW_BUFFER8_EXT 0x882D 835bd8deadSopenharmony_ci DRAW_BUFFER9_EXT 0x882E 845bd8deadSopenharmony_ci DRAW_BUFFER10_EXT 0x882F 855bd8deadSopenharmony_ci DRAW_BUFFER11_EXT 0x8830 865bd8deadSopenharmony_ci DRAW_BUFFER12_EXT 0x8831 875bd8deadSopenharmony_ci DRAW_BUFFER13_EXT 0x8832 885bd8deadSopenharmony_ci DRAW_BUFFER14_EXT 0x8833 895bd8deadSopenharmony_ci DRAW_BUFFER15_EXT 0x8834 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci Accepted by the <attachment> parameter of FramebufferRenderbuffer, 925bd8deadSopenharmony_ci FramebufferTexture2D and GetFramebufferAttachmentParameteriv, and by 935bd8deadSopenharmony_ci the <bufs> parameter of DrawBuffersEXT: 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci COLOR_ATTACHMENT0_EXT 0x8CE0 965bd8deadSopenharmony_ci COLOR_ATTACHMENT1_EXT 0x8CE1 975bd8deadSopenharmony_ci COLOR_ATTACHMENT2_EXT 0x8CE2 985bd8deadSopenharmony_ci COLOR_ATTACHMENT3_EXT 0x8CE3 995bd8deadSopenharmony_ci COLOR_ATTACHMENT4_EXT 0x8CE4 1005bd8deadSopenharmony_ci COLOR_ATTACHMENT5_EXT 0x8CE5 1015bd8deadSopenharmony_ci COLOR_ATTACHMENT6_EXT 0x8CE6 1025bd8deadSopenharmony_ci COLOR_ATTACHMENT7_EXT 0x8CE7 1035bd8deadSopenharmony_ci COLOR_ATTACHMENT8_EXT 0x8CE8 1045bd8deadSopenharmony_ci COLOR_ATTACHMENT9_EXT 0x8CE9 1055bd8deadSopenharmony_ci COLOR_ATTACHMENT10_EXT 0x8CEA 1065bd8deadSopenharmony_ci COLOR_ATTACHMENT11_EXT 0x8CEB 1075bd8deadSopenharmony_ci COLOR_ATTACHMENT12_EXT 0x8CEC 1085bd8deadSopenharmony_ci COLOR_ATTACHMENT13_EXT 0x8CED 1095bd8deadSopenharmony_ci COLOR_ATTACHMENT14_EXT 0x8CEE 1105bd8deadSopenharmony_ci COLOR_ATTACHMENT15_EXT 0x8CEF 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci The COLOR_ATTACHMENT0_EXT constant is equal to the 1135bd8deadSopenharmony_ci COLOR_ATTACHMENT0 constant. 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Each COLOR_ATTACHMENT<i>_EXT adheres to COLOR_ATTACHMENT<i>_EXT 1165bd8deadSopenharmony_ci = COLOR_ATTACHMENT0_EXT + <i>. 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ciChanges to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization) 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci Section 3.2, (Multisampling). Replace the second paragraph: 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci An additional buffer, called the multisample buffer, is added to the 1235bd8deadSopenharmony_ci window system-provided framebuffer. Pixel sample values, including 1245bd8deadSopenharmony_ci color, depth, and stencil values, are stored in this buffer. Samples 1255bd8deadSopenharmony_ci contain separate color values for each fragment color. When the 1265bd8deadSopenharmony_ci window system-provided framebuffer includes a multisample buffer, it 1275bd8deadSopenharmony_ci does not include depth or stencil buffers, even if the multisample 1285bd8deadSopenharmony_ci buffer does not store depth or stencil values. Color buffers do 1295bd8deadSopenharmony_ci coexist with the multisample buffer, however. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci Section 3.8.2, (Shader Execution) Replace subsection "Shader 1325bd8deadSopenharmony_ci Outputs": 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci The OpenGL ES Shading Language specification describes the values 1355bd8deadSopenharmony_ci that may be output by a fragment shader. These are gl_FragColor and 1365bd8deadSopenharmony_ci gl_FragData[n]. The final fragment color values or the final 1375bd8deadSopenharmony_ci fragment data values written by a fragment shader are clamped to the 1385bd8deadSopenharmony_ci range [0, 1] and then converted to fixed-point as described in 1395bd8deadSopenharmony_ci section 2.1.2 for framebuffer color components. 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci Writing to gl_FragColor specifies the fragment color (color number 1425bd8deadSopenharmony_ci zero) that will be used by subsequent stages of the pipeline. 1435bd8deadSopenharmony_ci Writing to gl_FragData[n] specifies the value of fragment color 1445bd8deadSopenharmony_ci number n. Any colors, or color components, associated with a 1455bd8deadSopenharmony_ci fragment that are not written by the fragment shader are undefined. 1465bd8deadSopenharmony_ci A fragment shader may not statically assign values to both 1475bd8deadSopenharmony_ci gl_FragColor and gl_FragData. In this case, a compile or link error 1485bd8deadSopenharmony_ci will result. A shader statically assigns a value to a variable if, 1495bd8deadSopenharmony_ci after preprocessing, it contains a statement that would write to the 1505bd8deadSopenharmony_ci variable, whether or not run-time flow of control will cause that 1515bd8deadSopenharmony_ci statement to be executed. 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ciChanges to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment 1545bd8deadSopenharmony_ciOperations and the Frame Buffer) 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci Modify the overview of Chapter 4 and replace the sentences 1575bd8deadSopenharmony_ci of the fifth paragraph which read: 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci "The name of the color buffer of an application-created framebuffer 1605bd8deadSopenharmony_ci object is COLOR_ATTACHMENT0. The names of the depth and stencil buffers 1615bd8deadSopenharmony_ci are DEPTH_ATTACHMENT and STENCIL_ATTACHMENT." 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci With the following: 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci "A framebuffer object has an array of color buffer attachment points, 1665bd8deadSopenharmony_ci numbered zero through <n>, a depth buffer attachment point, and a 1675bd8deadSopenharmony_ci stencil buffer attachment point." 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci Insert Table 4.3 to Section 4.2.1 (and renumber subsequent tables): 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci Symbolic Constant Meaning 1725bd8deadSopenharmony_ci ----------------- --------------------- 1735bd8deadSopenharmony_ci NONE No buffer 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci COLOR_ATTACHMENT<i>_EXT (see caption) Output fragment color to image 1765bd8deadSopenharmony_ci attached at color attachment 1775bd8deadSopenharmony_ci point i 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci Table 4.3: Arguments to DrawBuffersEXT when the context is bound to a 1805bd8deadSopenharmony_ci framebuffer object, and the buffers they indicate. <i> in 1815bd8deadSopenharmony_ci COLOR_ATTACHMENT<i>_EXT may range from zero to the value of 1825bd8deadSopenharmony_ci MAX_COLOR_ATTACHMENTS_EXT minus one. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci Replace Section 4.2.1, "Selecting a Buffer for Writing" with the following: 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci "By default, color values are written into the front buffer for 1875bd8deadSopenharmony_ci single buffered surfaces or into the back buffer for back buffered 1885bd8deadSopenharmony_ci surfaces as determined when making the context current. To control 1895bd8deadSopenharmony_ci the color buffer into which each of the fragment color values is 1905bd8deadSopenharmony_ci written, DrawBuffersEXT is used. 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci The command 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci void DrawBuffersEXT(sizei n, const enum *bufs); 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci defines the draw buffers to which all fragment colors are written. 1975bd8deadSopenharmony_ci <n> specifies the number of buffers in <bufs>. <bufs> is a pointer 1985bd8deadSopenharmony_ci to an array of symbolic constants specifying the buffer to which 1995bd8deadSopenharmony_ci each fragment color is written. 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci Each buffer listed in <bufs> must be BACK, NONE, or one of the 2025bd8deadSopenharmony_ci values from table 4.3. Further, acceptable values for the constants 2035bd8deadSopenharmony_ci in <bufs> depend on whether the GL is using the default framebuffer 2045bd8deadSopenharmony_ci (i.e., DRAW_FRAMEBUFFER_BINDING is zero), or a framebuffer object 2055bd8deadSopenharmony_ci (i.e., DRAW_FRAMEBUFFER_BINDING is non-zero). For more information 2065bd8deadSopenharmony_ci about framebuffer objects, see section 4.4. 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci If the GL is bound to the default framebuffer, then <n> must be 1 2095bd8deadSopenharmony_ci and the constant must be BACK or NONE. When draw buffer zero is 2105bd8deadSopenharmony_ci BACK, color values are written into the sole buffer for single- 2115bd8deadSopenharmony_ci buffered contexts, or into the back buffer for double-buffered 2125bd8deadSopenharmony_ci contexts. If DrawBuffersEXT is supplied with a constant other than 2135bd8deadSopenharmony_ci BACK and NONE, or with a value of <n> other than 1, the error 2145bd8deadSopenharmony_ci INVALID_OPERATION is generated. 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci If the GL is bound to a draw framebuffer object, then each of the 2175bd8deadSopenharmony_ci constants must be one of the values listed in table 4.3. Calling 2185bd8deadSopenharmony_ci DrawBuffersEXT with <n> equal zero is equivalent to setting all the 2195bd8deadSopenharmony_ci draw buffers to NONE. 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci In both cases, the draw buffers being defined correspond in order to 2225bd8deadSopenharmony_ci the respective fragment colors. The draw buffer for fragment 2235bd8deadSopenharmony_ci colors beyond <n> is set to NONE. 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci The maximum number of draw buffers is implementation-dependent. The 2265bd8deadSopenharmony_ci number of draw buffers supported can be queried by calling 2275bd8deadSopenharmony_ci GetIntegerv with the symbolic constant MAX_DRAW_BUFFERS_EXT. An 2285bd8deadSopenharmony_ci INVALID_VALUE error is generated if <n> is greater than 2295bd8deadSopenharmony_ci MAX_DRAW_BUFFERS_EXT. 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci If the GL is bound to a draw framebuffer object, the <i>th buffer listed 2325bd8deadSopenharmony_ci in <bufs> must be COLOR_ATTACHMENT<i>_EXT or NONE. Specifying a 2335bd8deadSopenharmony_ci buffer out of order, BACK, or COLOR_ATTACHMENT<m>_EXT where <m> is 2345bd8deadSopenharmony_ci greater than or equal to the value of MAX_COLOR_ATTACHMENTS_EXT, 2355bd8deadSopenharmony_ci will generate the error INVALID_OPERATION. 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci If a fragment shader writes to "gl_FragColor", DrawBuffersEXT 2385bd8deadSopenharmony_ci specifies the set of draw buffers into which the color 2395bd8deadSopenharmony_ci written to "gl_FragColor" is written. If a fragment shader writes to 2405bd8deadSopenharmony_ci "gl_FragData", DrawBuffersEXT specifies a set of draw buffers 2415bd8deadSopenharmony_ci into which each of the multiple output colors defined by these 2425bd8deadSopenharmony_ci variables are separately written. If a fragment shader writes to 2435bd8deadSopenharmony_ci neither "gl_FragColor" nor "gl_FragData" the values of the 2445bd8deadSopenharmony_ci fragment colors following shader execution are undefined, and may 2455bd8deadSopenharmony_ci differ for each fragment color. 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci Indicating a buffer or buffers using DrawBuffersEXT causes 2485bd8deadSopenharmony_ci subsequent pixel color value writes to affect the indicated 2495bd8deadSopenharmony_ci buffers. If the GL is bound to a draw framebuffer object and a draw 2505bd8deadSopenharmony_ci buffer selects an attachment that has no image attached, then that 2515bd8deadSopenharmony_ci fragment color is not written. 2525bd8deadSopenharmony_ci 2535bd8deadSopenharmony_ci Specifying NONE as the draw buffer for a fragment color will inhibit 2545bd8deadSopenharmony_ci that fragment color from being written. 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci The state required to handle color buffer selection for each 2575bd8deadSopenharmony_ci framebuffer is an integer for each supported fragment color. For the 2585bd8deadSopenharmony_ci default framebuffer, in the initial state the draw buffer for 2595bd8deadSopenharmony_ci fragment color zero is BACK if there is a default framebuffer 2605bd8deadSopenharmony_ci associated with the context, otherwise NONE. For framebuffer 2615bd8deadSopenharmony_ci objects, in the initial state the draw buffer for fragment color 2625bd8deadSopenharmony_ci zero is COLOR_ATTACHMENT0_EXT. 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci For both the default framebuffer and framebuffer objects, the 2655bd8deadSopenharmony_ci initial state of draw buffers for fragment colors other than zero is 2665bd8deadSopenharmony_ci NONE. 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci The value of the draw buffer selected for fragment color <i> can be 2695bd8deadSopenharmony_ci queried by calling GetIntegerv with the symbolic constant 2705bd8deadSopenharmony_ci DRAW_BUFFER<i>_EXT." 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci Modify Section 4.2.3 (Clearing the Buffers) and replace the first 2735bd8deadSopenharmony_ci two paragraphs with the following: 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci "The GL provides a means for setting portions of every pixel in a 2765bd8deadSopenharmony_ci particular buffer to the same value. The argument to 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci void Clear(bitfield buf); 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci is the bitwise OR of a number of values indicating which buffers are 2815bd8deadSopenharmony_ci to be cleared. The values are COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT, and 2825bd8deadSopenharmony_ci STENCIL_BUFFER_BIT, indicating the buffers currently enabled for color 2835bd8deadSopenharmony_ci writing, the depth buffer, and the stencil buffer (see below), 2845bd8deadSopenharmony_ci respectively. The value to which each buffer is cleared depends on 2855bd8deadSopenharmony_ci the setting of the clear value for that buffer. If the mask is not a 2865bd8deadSopenharmony_ci bitwise OR of the specified values, then the error INVALID_VALUE is 2875bd8deadSopenharmony_ci generated. 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci void ClearColor(clampf r, clampf, g, clampf b, clampf a); 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci sets the clear value for fixed-point color buffers. Each of the 2925bd8deadSopenharmony_ci specified components is clamped to [0, 1] and converted to fixed-point 2935bd8deadSopenharmony_ci as described in section 2.1.2 for framebuffer color components." 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci Replace the second paragraph of Section 4.4.1 (Binding and Managing 2965bd8deadSopenharmony_ci Framebuffer Objects) with the following: 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci "The namespace for framebuffer objects is the unsigned integers, with 2995bd8deadSopenharmony_ci zero reserved by OpenGL ES to refer to the default framebuffer. A 3005bd8deadSopenharmony_ci framebuffer object is created by binding an unused name to the 3015bd8deadSopenharmony_ci target FRAMEBUFFER, DRAW_FRAMEBUFFER, or READ_FRAMEBUFFER. The binding 3025bd8deadSopenharmony_ci is effected by calling 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci void BindFramebuffer(enum target, uint framebuffer); 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ci with <target> set the desired framebuffer target and <framebuffer> set 3075bd8deadSopenharmony_ci to the unused name. The resulting framebuffer object is a new state 3085bd8deadSopenharmony_ci vector. There is a number of color attachment points, plus one each 3095bd8deadSopenharmony_ci for the depth and stencil attachment points. The number of color attachment 3105bd8deadSopenharmony_ci points is equal to the value of MAX_COLOR_ATTACHMENTS_EXT." 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci Replace the third item in the bulleted list in Section 4.4.1 (Binding 3135bd8deadSopenharmony_ci and Managing Framebuffer Objects) with the following: 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci " * The only color buffer bitplanes are the ones defined by the 3165bd8deadSopenharmony_ci framebuffer attachments points named COLOR_ATTACHMENT0_EXT through 3175bd8deadSopenharmony_ci COLOR_ATTACHMENT<n>_EXT." 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci Modify Section 4.4.3 (Renderbuffer Objects) in the 3205bd8deadSopenharmony_ci "Attaching Renderbuffer Images to a Framebuffer" subsection as follows: 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci Insert the following table: 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci Name of attachment 3255bd8deadSopenharmony_ci --------------------------------------- 3265bd8deadSopenharmony_ci COLOR_ATTACHMENT<i>_EXT (see caption) 3275bd8deadSopenharmony_ci DEPTH_ATTACHMENT 3285bd8deadSopenharmony_ci STENCIL_ATTACHMENT 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci Table 4.x: Framebuffer attachment points. <i> in COLOR_ATTACHMENT<i>_EXT 3315bd8deadSopenharmony_ci may range from zero to the value of MAX_COLOR_ATTACHMENTS_EXT minus 1. 3325bd8deadSopenharmony_ci 3335bd8deadSopenharmony_ci Modify the third sentence of the paragraph following the definition of 3345bd8deadSopenharmony_ci FramebufferRenderbuffer to be as follows: 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci "<attachment> should be set to one of the attachment points of the 3375bd8deadSopenharmony_ci framebuffer listed in Table 4.x." 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci Modify Section 4.4.3 (Renderbuffer Objects) in the "Attaching Texture 3405bd8deadSopenharmony_ci Images to a Framebuffer" subsection as follows: 3415bd8deadSopenharmony_ci 3425bd8deadSopenharmony_ci Modify the last sentence of the paragraph following the definition of 3435bd8deadSopenharmony_ci FramebufferTexture2D to be as follows: 3445bd8deadSopenharmony_ci 3455bd8deadSopenharmony_ci "<attachment> must be one of the attachment points of the framebuffer 3465bd8deadSopenharmony_ci listed in Table 4.x." 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci Modify Section 4.4.5 (Framebuffer Completeness) and replace the 3rd 3495bd8deadSopenharmony_ci item in the bulleted list in the "Framebuffer Attachment Completeness" 3505bd8deadSopenharmony_ci subsection with the following: 3515bd8deadSopenharmony_ci 3525bd8deadSopenharmony_ci " * If <attachment> is COLOR_ATTACHMENT<i>_EXT, then <image> must 3535bd8deadSopenharmony_ci have a color-renderable internal format." 3545bd8deadSopenharmony_ci 3555bd8deadSopenharmony_ciChanges to Chapter 6 of the OpenGL ES 2.0 Specification (State and 3565bd8deadSopenharmony_ciState Requests) 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci In section 6.1.3 (Enumerated Queries) modify the third sentence in 3595bd8deadSopenharmony_ci the definition of GetFramebufferAttachmentParameteriv to be as follows: 3605bd8deadSopenharmony_ci 3615bd8deadSopenharmony_ci "<attachment> must be one of the attachment points of the framebuffer 3625bd8deadSopenharmony_ci listed in Table 4.x." 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ciChanges to Chapter 3 of the OpenGL ES Shading Language 1.0.17 Specification (Basics) 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci Add a new section: 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci 3.4.1 GL_EXT_draw_buffers Extension 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ci To use the GL_EXT_draw_buffers extension in a shader it 3715bd8deadSopenharmony_ci must be enabled using the #extension directive. 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ci The shading language preprocessor #define 3745bd8deadSopenharmony_ci GL_EXT_draw_buffers will be defined to 1, if the 3755bd8deadSopenharmony_ci GL_EXT_draw_buffers extension is supported. 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ciDependencies on ANGLE_framebuffer_blit and APPLE_framebuffer_multisample: 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci If neither ANGLE_framebuffer_blit nor APPLE_framebuffer_multisample are 3805bd8deadSopenharmony_ci supported, then all references to "draw framebuffers" should be replaced 3815bd8deadSopenharmony_ci with references to "framebuffers". References to DRAW_FRAMEBUFFER_BINDING 3825bd8deadSopenharmony_ci should be replaced with references to FRAMEBUFFER_BINDING. References to 3835bd8deadSopenharmony_ci DRAW_FRAMEBUFFER and READ_FRAMEBUFFER should be removed. 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci If ANGLE_framebuffer_blit is supported, DRAW_FRAMEBUFFER_BINDING, DRAW_FRAMEBUFFER 3865bd8deadSopenharmony_ci and READ_FRAMEBUFFER all refer to corresponding _ANGLE suffixed names 3875bd8deadSopenharmony_ci (they have the same token values). 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci If APPLE_framebuffer_multisample is supported, DRAW_FRAMEBUFFER_BINDING, 3905bd8deadSopenharmony_ci DRAW_FRAMEBUFFER and READ_FRAMEBUFFER all refer to the corresponding _APPLE 3915bd8deadSopenharmony_ci suffixed names (they have the same token values). 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ciErrors 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci The INVALID_OPERATION error is generated if DrawBuffersEXT is called 3965bd8deadSopenharmony_ci when the default framebuffer is bound and any of the following conditions 3975bd8deadSopenharmony_ci hold: 3985bd8deadSopenharmony_ci - <n> is zero, 3995bd8deadSopenharmony_ci - <n> is greater than 1 and less than MAX_DRAW_BUFFERS_EXT, 4005bd8deadSopenharmony_ci - <bufs> contains a value other than BACK or NONE. 4015bd8deadSopenharmony_ci 4025bd8deadSopenharmony_ci The INVALID_OPERATION error is generated if DrawBuffersEXT is called 4035bd8deadSopenharmony_ci when bound to a draw framebuffer object and any of the following 4045bd8deadSopenharmony_ci conditions hold: 4055bd8deadSopenharmony_ci - the <i>th value in <bufs> is not COLOR_ATTACHMENT<i>_EXT or NONE. 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci The INVALID_VALUE error is generated if DrawBuffersEXT is called 4085bd8deadSopenharmony_ci with a value of <n> which is greater than MAX_DRAW_BUFFERS_EXT. 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ci The INVALID_ENUM error is generated by FramebufferRenderbuffer if 4115bd8deadSopenharmony_ci the <attachment> parameter is not one of the values listed in Table 4.x. 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci The INVALID_ENUM error is generated by FramebufferTexture2D if 4145bd8deadSopenharmony_ci the <attachment> parameter is not one of the values listed in Table 4.x. 4155bd8deadSopenharmony_ci 4165bd8deadSopenharmony_ci The INVALID_ENUM error is generated by GetFramebufferAttachmentParameteriv 4175bd8deadSopenharmony_ci if the <attachment> parameter is not one of the values listed in Table 4.x. 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ciNew State 4205bd8deadSopenharmony_ci 4215bd8deadSopenharmony_ci Add Table 6.X Framebuffer (State per framebuffer object): 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci State Type Get Command Initial Value Description 4245bd8deadSopenharmony_ci ------------------ ---- ------------ ------------- ----------- 4255bd8deadSopenharmony_ci DRAW_BUFFER<i>_EXT Z10* GetIntegerv see 4.2.1 Draw buffer selected 4265bd8deadSopenharmony_ci for fragment color i 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ci Add to Table 6.18 (Implementation Dependent Values) 4295bd8deadSopenharmony_ci 4305bd8deadSopenharmony_ci Get value Type Get Cmnd Minimum Value Description Sec. 4315bd8deadSopenharmony_ci -------------------- ---- ----------- ------------- ----------- ----- 4325bd8deadSopenharmony_ci MAX_DRAW_BUFFERS_EXT Z+ GetIntegerv 1 Maximum number of 4.2.1 4335bd8deadSopenharmony_ci active draw buffers 4345bd8deadSopenharmony_ci MAX_COLOR_ATTACHMENTS_EXT Z+ GetIntegerv 1 Number of framebuffer 4.4.1 4355bd8deadSopenharmony_ci color attachment points 4365bd8deadSopenharmony_ciIssues 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci See ARB_draw_buffers for relevant issues. 4395bd8deadSopenharmony_ci 4405bd8deadSopenharmony_ci 1) What are the differences between this extension and NV_draw_buffers 4415bd8deadSopenharmony_ci + NV_fbo_color_attachments? 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ci RESOLVED. This extension: 4445bd8deadSopenharmony_ci - adds interactions with blit_framebuffer and the separate 4455bd8deadSopenharmony_ci draw/read binding points 4465bd8deadSopenharmony_ci - The draw buffer and color attachment limits are global instead 4475bd8deadSopenharmony_ci of per-fbo (see Issue 2) 4485bd8deadSopenharmony_ci - can be used to with default framebuffer to set NONE/BACK (see Issue 4) 4495bd8deadSopenharmony_ci - retains the ordering restrictions on color attachments that are 4505bd8deadSopenharmony_ci imposed by ES 3.0. 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci 2) Should the MAX_DRAW_BUFFERS_EXT and MAX_COLOR_ATTACHMENTS_EXT limits 4535bd8deadSopenharmony_ci be per-framebuffer values or implementation dependent constants? 4545bd8deadSopenharmony_ci 4555bd8deadSopenharmony_ci DISCUSSION: In ARB_draw_buffers this was per-context (see Issue 2). 4565bd8deadSopenharmony_ci EXT_framebuffer_object (and subsequently ARB_framebuffer_object, and GL 3.0 4575bd8deadSopenharmony_ci through GL 4.2) made these queries framebuffer-dependent. 4585bd8deadSopenharmony_ci However in GL 4.3 and GLES 3.0, these limits were changed from 4595bd8deadSopenharmony_ci framebuffer-dependent state to implementation-dependent state after 4605bd8deadSopenharmony_ci much discussion (Bug 7990). 4615bd8deadSopenharmony_ci 4625bd8deadSopenharmony_ci NV_draw_buffers has MAX_DRAW_BUFFERS listed as per-framebuffer state, 4635bd8deadSopenharmony_ci but NV_fbo_color_attachments has MAX_COLOR_ATTACHMENTS as an 4645bd8deadSopenharmony_ci implementation-dependent constant. 4655bd8deadSopenharmony_ci 4665bd8deadSopenharmony_ci This is relevant because some implementations are not able to support 4675bd8deadSopenharmony_ci multisampling in conjuction with multiple color attachments. If the 4685bd8deadSopenharmony_ci query is per-framebuffer, they can report a maximum of one attachment 4695bd8deadSopenharmony_ci when there are multisampled attachments, but a higher limit when only 4705bd8deadSopenharmony_ci single-sampled attachments are present. 4715bd8deadSopenharmony_ci 4725bd8deadSopenharmony_ci RESOLVED. Make this global context state as this is most consistent 4735bd8deadSopenharmony_ci with GLES 3.0 and updated GL drivers. In an implementation cannot 4745bd8deadSopenharmony_ci support multisampling in conjunction with multiple color attachments, 4755bd8deadSopenharmony_ci perhaps such an implementation could report FBO incomplete in this 4765bd8deadSopenharmony_ci situation, but this is less than desirable. 4775bd8deadSopenharmony_ci 4785bd8deadSopenharmony_ci 3) Should we support broadcast from gl_FragColor to all gl_FragData[x] 4795bd8deadSopenharmony_ci or should it be synonymous with gl_FragData[0]? 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci DISCUSSION: With NV_draw_buffers, writing to gl_FragColor writes to all 4825bd8deadSopenharmony_ci the enabled draw buffers (ie broadcast). In OpenGL ES 3.0 when using 4835bd8deadSopenharmony_ci ESSL 1.0, gl_FragColor is equivalent to writing a single output to 4845bd8deadSopenharmony_ci gl_FragData[0] and multiple outputs are not possible. When using ESSL 3.0, 4855bd8deadSopenharmony_ci only user-defined out variables may be used. 4865bd8deadSopenharmony_ci 4875bd8deadSopenharmony_ci If broadcast is supported, some implementations may have to replace 4885bd8deadSopenharmony_ci writes to gl_FragColor with replicated writes to all possible gl_FragData 4895bd8deadSopenharmony_ci locations when this extension is enabled. 4905bd8deadSopenharmony_ci 4915bd8deadSopenharmony_ci RESOLVED: Writes to gl_FragColor are broadcast to all enabled color 4925bd8deadSopenharmony_ci buffers. ES 3.0 using ESSL 1.0 doesn't support broadcast because 4935bd8deadSopenharmony_ci ESSL 1.0 was not extended to have multiple color outputs (but that is 4945bd8deadSopenharmony_ci what this extension adds). ESSL 3.0 doesn't support the broadcast because 4955bd8deadSopenharmony_ci it doesn't have the gl_FragColor variable at all, and only has user- 4965bd8deadSopenharmony_ci defined out variables. This extension extends ESSL 1.0 to have multiple 4975bd8deadSopenharmony_ci color outputs. Broadcasting from gl_FragColor to all enabled color 4985bd8deadSopenharmony_ci buffers is the most consistent with existing draw buffer extensions to 4995bd8deadSopenharmony_ci date (both NV_draw_buffers and desktop GL). 5005bd8deadSopenharmony_ci 5015bd8deadSopenharmony_ci 4) Should we allow DrawBuffersEXT to be called when the default FBO is 5025bd8deadSopenharmony_ci bound? 5035bd8deadSopenharmony_ci 5045bd8deadSopenharmony_ci DISCUSSION: NV_draw_buffers specifies that DrawBuffersNV errors with 5055bd8deadSopenharmony_ci INVALID_OPERATION when the default FBO is bound. OpenGL ES 3.0 allows 5065bd8deadSopenharmony_ci DrawBuffers to toggle between BACK and NONE on the default FBO. 5075bd8deadSopenharmony_ci 5085bd8deadSopenharmony_ci An implementation that does not natively support disabling the drawbuffer 5095bd8deadSopenharmony_ci on the default FBO could emulate this by disabling color writes. 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci RESOLVED: Allow DrawBuffersEXT to be called for the default FBO. This 5125bd8deadSopenharmony_ci is more forward looking and is compatible with ES 3.0. 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ci 5) What are the requirements on the color attachment sizes and formats? 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci RESOLVED: ES 2.0 requires that all color buffers attached to application- 5175bd8deadSopenharmony_ci created framebuffer objects must have the same number of bitplanes 5185bd8deadSopenharmony_ci (Chapter 4 overview p91). ES 2.0 also requires that all attached images 5195bd8deadSopenharmony_ci have the same width and height (Section 4.4.5 Framebuffer Completeness). 5205bd8deadSopenharmony_ci This extension does not lift those requirements, and failing to meet 5215bd8deadSopenharmony_ci them will result in an incomplete FBO (FRAMEBUFFER_UNSUPPORTED and 5225bd8deadSopenharmony_ci FRAMEBUFFER_INCOMPLETE_DIMENSIONS, respectively). 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci 6) Does this have any interactions with glClear? 5255bd8deadSopenharmony_ci 5265bd8deadSopenharmony_ci RESOLVED: Yes. When multiple color buffers are enabled for writing, 5275bd8deadSopenharmony_ci glClear clears all of the color buffers. Added language clarifying 5285bd8deadSopenharmony_ci that glClear and glClearColor may affect multiple color buffers. 5295bd8deadSopenharmony_ci 5305bd8deadSopenharmony_ci 7) What is the behavior when n=0? In the ES 3.0 spec it says that 5315bd8deadSopenharmony_ci <n> must be one for the default FBO, but doesn't specify what happens 5325bd8deadSopenharmony_ci when it's not. For user FBOs it states that the draw buffer for 5335bd8deadSopenharmony_ci fragment colors beyond <n> is set to NONE. (Bug 10059) 5345bd8deadSopenharmony_ci 5355bd8deadSopenharmony_ci RESOLVED: For the default FBO, setting <n> to zero will result in 5365bd8deadSopenharmony_ci an INVALID_OPERATION. For user created FBOs, setting <n> to zero 5375bd8deadSopenharmony_ci sets all the draw buffers to NONE. The ES 3.0 spec will be updated 5385bd8deadSopenharmony_ci accordingly. 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci 8) What value should gl_MaxDrawBuffers in the shading language report? 5415bd8deadSopenharmony_ci 5425bd8deadSopenharmony_ci RESOLVE: It should match MAX_DRAW_BUFFERS_EXT from the API. None 5435bd8deadSopenharmony_ci of the API or GLSL specifications explicitly state the linkage 5445bd8deadSopenharmony_ci between API and SL constants, but it seems logical that one would 5455bd8deadSopenharmony_ci expect them to match, regardless of whether or not an extension 5465bd8deadSopenharmony_ci directive is used in the shading language. 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ciRevision History 5495bd8deadSopenharmony_ci 5505bd8deadSopenharmony_ci 07/12/2013 dgkoch add issue 8 5515bd8deadSopenharmony_ci 05/11/2013 dgkoch add issue 7 and relevant clarifications 5525bd8deadSopenharmony_ci minor clarification for issue 5. 5535bd8deadSopenharmony_ci 01/30/2013 dgkoch add issue 6 and clear interactions 5545bd8deadSopenharmony_ci renamed to EXT_draw_buffers based on feedback 5555bd8deadSopenharmony_ci changed resolution of issue 3. 5565bd8deadSopenharmony_ci 01/23/2013 dgkoch add resolutions to issues 2-4. 5575bd8deadSopenharmony_ci add issue 5. 5585bd8deadSopenharmony_ci Add Table 4.x and update various explicit 5595bd8deadSopenharmony_ci references to COLOR_ATTACHMENT0. 5605bd8deadSopenharmony_ci Add errors. 5615bd8deadSopenharmony_ci 11/13/2012 dgkoch add revision history 5625bd8deadSopenharmony_ci add text from updated ES 3.0 spec 5635bd8deadSopenharmony_ci add issues for discussion 5645bd8deadSopenharmony_ci 10/16/2012 kbr update name string 5655bd8deadSopenharmony_ci 10/16/2012 kbr remove restrition requiring draw buffer 0 to be non-NULL 5665bd8deadSopenharmony_ci 10/12/2012 kbr remove references to GetDoublev and ReadBuffer 5675bd8deadSopenharmony_ci 10/11/2012 kbr initial draft extension 5685bd8deadSopenharmony_ci 569