15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_multiview_draw_buffers 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_multiview_draw_buffers 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Acorn Pooley, NVIDIA 125bd8deadSopenharmony_ci Greg Roth, NVIDIA 135bd8deadSopenharmony_ci Maurice Ribble, Qualcomm 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ciContact 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ci Greg Roth (groth 'at' nvidia.com) 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciVersion 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Version 3, Sept 03, 2011 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciNumber 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci OpenGL ES Extension #125 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciStatus 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci Complete 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ciDependencies 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci Written against the OpenGL ES 2.0 Specification 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci NV_draw_buffers affects the definition of this extension. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci OpenGL ES 3.0 affects the definition of this extension. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ciOverview 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci This extension allows selecting among draw buffers as the 425bd8deadSopenharmony_ci rendering target. This may be among multiple primary buffers 435bd8deadSopenharmony_ci pertaining to platform-specific stereoscopic or multiview displays 445bd8deadSopenharmony_ci or among offscreen framebuffer object color attachments. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci To remove any artificial limitations imposed on the number of 475bd8deadSopenharmony_ci possible buffers, draw buffers are identified not as individual 485bd8deadSopenharmony_ci enums, but as pairs of values consisting of an enum representing 495bd8deadSopenharmony_ci buffer locations such as COLOR_ATTACHMENT_EXT or MULTIVIEW_EXT, 505bd8deadSopenharmony_ci and an integer representing an identifying index of buffers of this 515bd8deadSopenharmony_ci location. These (location, index) pairs are used to specify draw 525bd8deadSopenharmony_ci buffer targets using a new DrawBuffersIndexedEXT call. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci Rendering to buffers of location MULTIVIEW_EXT associated with the 555bd8deadSopenharmony_ci context allows rendering to multiview buffers created by EGL using 565bd8deadSopenharmony_ci EGL_EXT_multiview_window for stereoscopic displays. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci Rendering to COLOR_ATTACHMENT_EXT buffers allows implementations to 595bd8deadSopenharmony_ci increase the number of potential color attachments indefinitely to 605bd8deadSopenharmony_ci renderbuffers and textures. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci This extension allows the traditional quad buffer stereoscopic 635bd8deadSopenharmony_ci rendering method that has proven effective by indicating a left or 645bd8deadSopenharmony_ci right draw buffer and rendering to each accordingly, but is also 655bd8deadSopenharmony_ci dynamic enough to handle an arbitrary number of color buffer targets 665bd8deadSopenharmony_ci all using the same shader. This grants the user maximum flexibility 675bd8deadSopenharmony_ci as well as a familiar interface. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ciNew Procedures and Functions 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci void ReadBufferIndexedEXT(enum src, int index); 725bd8deadSopenharmony_ci void DrawBuffersIndexedEXT(int n, const enum *location, 735bd8deadSopenharmony_ci const int *indices); 745bd8deadSopenharmony_ci void GetIntegeri_vEXT(enum target, uint index, int *data); 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ciNew Tokens 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci Accepted by the <location> parameter of DrawBuffersIndexedEXT: 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci COLOR_ATTACHMENT_EXT 0x90F0 815bd8deadSopenharmony_ci MULTIVIEW_EXT 0x90F1 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci Accepted by the <target> parameter of GetIntegeri_EXT: 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci DRAW_BUFFER_EXT 0x0C01 865bd8deadSopenharmony_ci READ_BUFFER_EXT 0x0C02 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci Accepted by the <target> parameter of GetInteger: 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ciChanges to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment 945bd8deadSopenharmony_ciOperations and the Frame Buffer) 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci Modify section 4.2.1, "Selecting a Buffer for Writing" 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci Change first paragraph to: 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci By default, color values are written into the front buffer for 1015bd8deadSopenharmony_ci single buffered contexts or into the back buffer for back buffered 1025bd8deadSopenharmony_ci contexts as determined when creating the GL context. To control 1035bd8deadSopenharmony_ci the color buffer into which each of the fragment color values is 1045bd8deadSopenharmony_ci written, DrawBuffersNV or DrawBuffersIndexedEXT is used. 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci Add to the end of 4.2.1: 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci The command 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci void DrawBuffersIndexedEXT(sizei n, const enum *locations, 1115bd8deadSopenharmony_ci const int *indices); 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci defines the draw buffers to which all fragment colors are written. 1145bd8deadSopenharmony_ci <n> specifies the number of values in <locations> and <indices>. 1155bd8deadSopenharmony_ci <locations> is a pointer to an array of symbolic constants 1165bd8deadSopenharmony_ci specifying the location of the draw buffer. <indices> is a pointer 1175bd8deadSopenharmony_ci to an array of integer values specifying the index of the draw 1185bd8deadSopenharmony_ci buffer. Together <locations> and <indices> specify the draw buffer 1195bd8deadSopenharmony_ci to which each fragment color is written. 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci Each constant in <locations> must be MULTIVIEW_EXT, COLOR_- 1225bd8deadSopenharmony_ci ATTACHMENT_EXT, or NONE. Otherwise, an INVALID_ENUM error is 1235bd8deadSopenharmony_ci generated. Further, acceptable values for the constants in 1245bd8deadSopenharmony_ci <locations> depend on whether the GL is using the default 1255bd8deadSopenharmony_ci framebuffer (i.e. DRAW_FRAMEBUFFER_BINDING is non-zero). For more 1265bd8deadSopenharmony_ci information about framebuffer objects, see section 4.4. 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci If the GL is bound to the default framebuffer, then each of the 1295bd8deadSopenharmony_ci location constants must be MULTIVIEW_EXT or NONE. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci If the GL is bound to a framebuffer object, then each of the 1325bd8deadSopenharmony_ci location constants must be COLOR_ATTACHMENT_EXT or NONE. 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci Where the constant in <locations> is MULTIVIEW_EXT, the 1355bd8deadSopenharmony_ci corresponding value in <indices> must be a value from 0 through 1365bd8deadSopenharmony_ci MAX_MULTIVIEW_BUFFERS_EXT. Where the constant in <locations> is 1375bd8deadSopenharmony_ci COLOR_ATTACHMENT_EXT, the value in <indices> must be a value from 0 1385bd8deadSopenharmony_ci through MAX_COLOR_ATTACHMENTS_NV. Otherwise, an INVALID_OPERATION 1395bd8deadSopenharmony_ci error is generated. Where the constant in <locations> is NONE, the 1405bd8deadSopenharmony_ci value in <indices> is ignored. 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci For monoscopic rendering, the only available view is index 0. For 1435bd8deadSopenharmony_ci stereoscopic rendering, view index 0 corresponds to the left buffer 1445bd8deadSopenharmony_ci and view index 1 corresponds to the right buffer. 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci The draw buffers being defined correspond, in order, to the 1475bd8deadSopenharmony_ci respective fragment colors. The draw buffer for fragment colors 1485bd8deadSopenharmony_ci beyond <n> is set to NONE. 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci Except for where the constant in <locations> is NONE, a buffer may 1515bd8deadSopenharmony_ci not be specified more than once by the arrays pointed to by 1525bd8deadSopenharmony_ci <locations> and <indices>. Specifying a buffer more than once will 1535bd8deadSopenharmony_ci result in the error INVALID_OPERATION. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci If a fragment shader writes to "gl_FragColor", DrawBuffersIndexedEXT 1565bd8deadSopenharmony_ci specifies a set of draw buffers into which the color written to 1575bd8deadSopenharmony_ci "gl_FragColor" is written. If a fragment shader writes to 1585bd8deadSopenharmony_ci gl_FragData, DrawBuffersIndexedEXT specifies a set of draw buffers 1595bd8deadSopenharmony_ci into which each of the multiple output colors defined by these 1605bd8deadSopenharmony_ci variables are separately written. If a fragment shader writes to 1615bd8deadSopenharmony_ci neither gl_FragColor nor gl_FragData, the values of the fragment 1625bd8deadSopenharmony_ci colors following shader execution are undefined, and may differ 1635bd8deadSopenharmony_ci for each fragment color. 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci Indicating a buffer or buffers using DrawBuffersIndexedEXT causes 1665bd8deadSopenharmony_ci subsequent pixel color value writes to affect the indicated 1675bd8deadSopenharmony_ci buffers. If more than one color buffer is selected for drawing, 1685bd8deadSopenharmony_ci blending is computed and applied independently for each buffer. 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci Specifying NONE in the <locations> array for a fragment color will 1715bd8deadSopenharmony_ci inhibit that fragment color from being written to any buffer. 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci Monoscopic surfaces include only left buffers, while stereoscopic 1745bd8deadSopenharmony_ci surfaces include a left and a right buffer, and multiview surfaces 1755bd8deadSopenharmony_ci include more than 1 buffer (a stereoscopic surface is a multiview 1765bd8deadSopenharmony_ci surface with 2 buffers). The type of surface is selected at EGL 1775bd8deadSopenharmony_ci surface initialization. 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci The state required to handle color buffer selection is two integers 1805bd8deadSopenharmony_ci for each supported fragment color for each framebuffer or 1815bd8deadSopenharmony_ci framebuffer object. For the default framebuffer, the initial state 1825bd8deadSopenharmony_ci of the draw buffer location for fragment color zero is MULTIVIEW_EXT 1835bd8deadSopenharmony_ci and the index is 0. For framebuffer objects, the initial state of 1845bd8deadSopenharmony_ci the draw buffer location for fragment color zero is COLOR_- 1855bd8deadSopenharmony_ci ATTACHMENT_EXT and the index is 0. The initial state of draw buffers 1865bd8deadSopenharmony_ci for fragment colors other than zero is NONE. 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci The color buffer location and index to which fragment colors are 1895bd8deadSopenharmony_ci written for an output color index <i> can be queried by calling 1905bd8deadSopenharmony_ci GetIntegeri_vEXT with <target> DRAW_BUFFER_EXT and index 1915bd8deadSopenharmony_ci <i>. This returns a pair of values representing the draw buffer 1925bd8deadSopenharmony_ci location and index. The number of multiview buffers available to a 1935bd8deadSopenharmony_ci GL context can be queried by calling GetIntegerv with <target> 1945bd8deadSopenharmony_ci MAX_MULTIVIEW_BUFFERS_EXT. 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci Section 4.3.1 (Reading Pixels), subsection "Obtaining Pixels from 1975bd8deadSopenharmony_ci the Framebuffer" add: 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci For color formats, the read buffer from which values are obtained is 2005bd8deadSopenharmony_ci one of the color buffers; the selection of color buffer is 2015bd8deadSopenharmony_ci controlled with ReadBufferIndexedEXT. 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci The command 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci void ReadBufferIndexedEXT(enum location, int index); 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci takes a symbolic constant and integer pair to select the color 2085bd8deadSopenharmony_ci buffer from which color values are obtained. <location> must be one 2095bd8deadSopenharmony_ci of MULTIVIEW_EXT, COLOR_ATTACHMENT_EXT, or NONE. Otherwise, an 2105bd8deadSopenharmony_ci INVALID_ENUM error is generated. If <location> is MULTIVIEW_EXT, 2115bd8deadSopenharmony_ci <index> must be a value from 0 through MAX_MULTIVIEW_BUFFERS_EXT. 2125bd8deadSopenharmony_ci If <location> is COLOR_ATTACHMENT_EXT, <index> must be a value from 2135bd8deadSopenharmony_ci 0 through MAX_COLOR_ATTACHMENTS_NV. Otherwise, an INVALID_OPERATION 2145bd8deadSopenharmony_ci error is generated. If <location> is NONE, <index> is ignored. 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci The acceptable values for <location> depend on whether the GL is 2175bd8deadSopenharmony_ci using the default framebuffer (i.e. FRAMEBUFFER_BINDING is zero), or 2185bd8deadSopenharmony_ci a framebuffer object (i.e. FRAMEBUFFER_BINDING is non-zero). For 2195bd8deadSopenharmony_ci more information about framebuffer objects, see section 4.4. 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci If the object bound to FRAMEBUFFER_BINDING is not framebuffer 2225bd8deadSopenharmony_ci complete (as defined in section 4.4.5), then ReadPixels generates 2235bd8deadSopenharmony_ci the error INVALID_FRAMEBUFFER_OPERATION. If <location> is a constant 2245bd8deadSopenharmony_ci that is neither legal for the default framebuffer, nor legal for a 2255bd8deadSopenharmony_ci framebuffer object, then the error INVALID_ENUM results. 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci When FRAMEBUFFER_BINDING is zero, i.e. the default framebuffer, 2285bd8deadSopenharmony_ci <location> must be MULTIVIEW_EXT or NONE. If the buffer indicated by 2295bd8deadSopenharmony_ci <index> is missing, the error INVALID_OPERATION is generated. For 2305bd8deadSopenharmony_ci the default framebuffer, the initial setting for READ_BUFFER_EXT is 2315bd8deadSopenharmony_ci <location> of MULTIVIEW_EXT and <index> of zero. 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci When the GL is using a framebuffer object, <location> must be NONE 2345bd8deadSopenharmony_ci or COLOR_ATTACHMENT_EXT. Specifying COLOR_ATTACHMENT_EXT enables 2355bd8deadSopenharmony_ci reading from the image attached to the framebuffer at COLOR_- 2365bd8deadSopenharmony_ci ATTACHMENT<index>_NV. For framebuffer objects, the initial setting 2375bd8deadSopenharmony_ci for READ_BUFFER_EXT is <location> of COLOR_ATTACHMENT_EXT and 2385bd8deadSopenharmony_ci <index> of zero. 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ci ReadPixels generates an INVALID_OPERATION error if it attempts to 2415bd8deadSopenharmony_ci select a color buffer while READ_BUFFER_EXT is none. 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ciChanges to chapter 6 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci Add to section 6.1.1, "Simple Queries" before description of 2465bd8deadSopenharmony_ci IsEnabled: 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci Indexed simple state variables are queried with the command 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci void GetIntegeri_vEXT(enum target, uint index, int* data); 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci <target> is the name of the indexed state and <index> is the 2535bd8deadSopenharmony_ci index of the particular element being queried. <data> is a 2545bd8deadSopenharmony_ci pointer to a scalar or array of the indicated type in which 2555bd8deadSopenharmony_ci to place the returned data. An INVALID_VALUE error is generated 2565bd8deadSopenharmony_ci if <index> is outside the valid range for the indexed state 2575bd8deadSopenharmony_ci <target>. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ciChanges to Chapter 3 of the OpenGL Shading Language 1.0 Specification 2605bd8deadSopenharmony_ci(Basics) 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci Add a new section: 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci 3.4.1 GL_EXT_multiview_draw_buffers Extension 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci To use the GL_EXT_multiview_draw_buffers extension in a shader it 2675bd8deadSopenharmony_ci must be enabled using the #extension directive. 2685bd8deadSopenharmony_ci 2695bd8deadSopenharmony_ci The shading language preprocessor #define GL_EXT_multiview_draw_- 2705bd8deadSopenharmony_ci buffers will be defined to 1, if the GL_EXT_multiview_draw_buffers 2715bd8deadSopenharmony_ci extension is supported. 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ciDependencies on NV_draw_buffers: 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci If NV_draw_buffers is not supported and OpenGL ES 3 is, add to the 2765bd8deadSopenharmony_ci description of DrawBuffersIndexedEXT: 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci The <i>th index listed in <indices> must be <i> or NONE. 2795bd8deadSopenharmony_ci Specifying a buffer out of order will generate the error 2805bd8deadSopenharmony_ci INVALID_OPERATION. 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci If neither NV_draw_buffers nor OpenGL ES 3 is supported, all 2835bd8deadSopenharmony_ci references to DrawBuffersNV and color attachments are removed. The 2845bd8deadSopenharmony_ci following is substituted for the above changes to Chapter 4 (Per- 2855bd8deadSopenharmony_ci Fragment Operations and the Frame Buffer): 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci Change section 4.2.1, "Selecting a Buffer for Writing" 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci Change first paragraph to: 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci By default, color values are written into the front buffer for 2925bd8deadSopenharmony_ci single buffered contexts or into the back buffer for back buffered 2935bd8deadSopenharmony_ci contexts as determined when creating the GL context. To control 2945bd8deadSopenharmony_ci the color buffer into which each of the fragment color values is 2955bd8deadSopenharmony_ci written, DrawBuffersIndexedEXT is used. 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci Add to the end of 4.2.1: 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci The command 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci void DrawBuffersIndexedEXT(sizei n, const enum *locations, 3025bd8deadSopenharmony_ci const int *indices); 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci defines the draw buffers to which all fragment colors are written. 3055bd8deadSopenharmony_ci <n> specifies the number of values in <locations> and <indices>. 3065bd8deadSopenharmony_ci <locations> is a pointer to an array of symbolic constants 3075bd8deadSopenharmony_ci specifying the location of the draw buffer. <indices> is a pointer 3085bd8deadSopenharmony_ci to an array of integer values specifying the index of the draw 3095bd8deadSopenharmony_ci buffer. Together <locations> and <indices> specify the draw buffer 3105bd8deadSopenharmony_ci to which each fragment color is written. 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci Each constant in <locations> must be MULTIVIEW_EXT or NONE. 3135bd8deadSopenharmony_ci Otherwise, an INVALID_ENUM error is generated. 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci DrawBuffersIndexedEXT generates an INVALID_OPERATION error if the GL 3165bd8deadSopenharmony_ci is bound to a framebuffer object. 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci Where the constant in <locations> is MULTIVIEW_EXT, the 3195bd8deadSopenharmony_ci corresponding value in <indices> must be a value from 0 through 3205bd8deadSopenharmony_ci MAX_MULTIVIEW_BUFFERS_EXT. Otherwise, an INVALID_OPERATION error is 3215bd8deadSopenharmony_ci generated. Where the constant in <locations> is NONE, the value 3225bd8deadSopenharmony_ci in <indices> is ignored. 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci An INVALID_VALUE error is generated if <n> is not 1. 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci For monoscopic rendering, the only available view is index 0. For 3275bd8deadSopenharmony_ci stereoscopic rendering, view index 0 is left and view index 1 is 3285bd8deadSopenharmony_ci right. 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci If a fragment shader writes to "gl_FragColor" or "gl_FragData[0]", 3315bd8deadSopenharmony_ci DrawBuffersIndexedEXT specifies a set of draw buffers into which the 3325bd8deadSopenharmony_ci output color is written. If a fragment shader writes to neither 3335bd8deadSopenharmony_ci gl_FragColor nor gl_FragData[0], the values of the fragment colors 3345bd8deadSopenharmony_ci following shader execution are undefined, and may differ for each 3355bd8deadSopenharmony_ci fragment color. 3365bd8deadSopenharmony_ci 3375bd8deadSopenharmony_ci Indicating a buffer using DrawBuffersIndexedEXT causes subsequent 3385bd8deadSopenharmony_ci pixel color value writes to affect the indicated buffer. 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ci Specifying NONE in the <locations> array for a fragment color will 3415bd8deadSopenharmony_ci inhibit that fragment color from being written to any buffer. 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci Monoscopic surfaces include only left buffers, while stereoscopic 3445bd8deadSopenharmony_ci surfaces include a left and a right buffer, and multiview surfaces 3455bd8deadSopenharmony_ci include more than 1 buffer (a stereoscopic surface is a multiview 3465bd8deadSopenharmony_ci surface with 2 buffers). The type of surface is selected at EGL 3475bd8deadSopenharmony_ci surface initialization. 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci The state required to handle color buffer selection is two integers 3505bd8deadSopenharmony_ci for the fragment color output for each framebuffer or framebuffer 3515bd8deadSopenharmony_ci object. For the default framebuffer, the initial state of the draw 3525bd8deadSopenharmony_ci buffer location for fragment color zero is MULTIVIEW_EXT and the 3535bd8deadSopenharmony_ci index is 0. For framebuffer objects, the initial state of the draw 3545bd8deadSopenharmony_ci buffer location for fragment color zero is COLOR_ATTACHMENT_EXT and 3555bd8deadSopenharmony_ci the index is 0. 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci The color buffer location and index to which fragment colors are 3585bd8deadSopenharmony_ci written can be queried by calling GetIntegeri_vEXT with <target> 3595bd8deadSopenharmony_ci DRAW_BUFFER_EXT and index 0. This returns a pair of values 3605bd8deadSopenharmony_ci representing the draw buffer location and index. The number of 3615bd8deadSopenharmony_ci multiview buffers available to a GL context can be queried by 3625bd8deadSopenharmony_ci calling GetIntegerv with <target> MAX_MULTIVIEW_BUFFERS_EXT. 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci The command 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci void ReadBufferIndexedEXT(enum location, int index); 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci takes a symbolic constant and integer pair to select the color 3695bd8deadSopenharmony_ci buffer from which color values are obtained. <location> must be 3705bd8deadSopenharmony_ci MULTIVIEW_EXT or NONE. Otherwise, an INVALID_ENUM error is 3715bd8deadSopenharmony_ci generated. If <location> is MULTIVIEW_EXT, <index> must be a value 3725bd8deadSopenharmony_ci from 0 through MAX_MULTIVIEW_BUFFERS_EXT. Otherwise, an 3735bd8deadSopenharmony_ci INVALID_OPERATION error is generated. If <location> is NONE, the 3745bd8deadSopenharmony_ci <index> is ignored. 3755bd8deadSopenharmony_ci 3765bd8deadSopenharmony_ci When FRAMEBUFFER_BINDING is zero, i.e. the default framebuffer, 3775bd8deadSopenharmony_ci <location> must be MULTIVIEW_EXT or NONE. If the buffer indicated by 3785bd8deadSopenharmony_ci <index> is missing, the error INVALID_OPERATION is generated. For 3795bd8deadSopenharmony_ci the default framebuffer, the initial setting for READ_BUFFER_EXT is 3805bd8deadSopenharmony_ci <location> of MULTIVIEW_EXT and <index> of zero. 3815bd8deadSopenharmony_ci 3825bd8deadSopenharmony_ci ReadBufferIndexedEXT generates an INVALID_OPERATION error if the GL 3835bd8deadSopenharmony_ci is bound to a framebuffer object. 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci ReadPixels generates an INVALID_OPERATION error if it attempts to 3865bd8deadSopenharmony_ci select a color buffer while READ_BUFFER_EXT is none. 3875bd8deadSopenharmony_ci 3885bd8deadSopenharmony_ciNew State 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ci Add the new Table 6.X "Framebuffer (State per framebuffer object)" : 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci State Type Get Command Initial Description 3935bd8deadSopenharmony_ci --------------- ----- --------------- ------- ----------- 3945bd8deadSopenharmony_ci DRAW_BUFFER_EXT nxZ+ GetIntegeri_vEXT See 4.2.1 Multiview draw buffer 3955bd8deadSopenharmony_ci location and index 3965bd8deadSopenharmony_ci selected for the 3975bd8deadSopenharmony_ci specified color output 3985bd8deadSopenharmony_ci READ_BUFFER_EXT nxZ+ GetInteger See 4.3.1 Read source buffer 3995bd8deadSopenharmony_ci location and index 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci Add the new Table 6.X "Framebuffer Dependent Values" : 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci State Type Get Command Min Value Description 4045bd8deadSopenharmony_ci --------------- ----- --------------- --------- ----------- 4055bd8deadSopenharmony_ci MAX_MULTIVIEW_BUFFERS_EXT Z+ GetIntegerv 1 Number of multiview 4065bd8deadSopenharmony_ci draw buffers 4075bd8deadSopenharmony_ci 4085bd8deadSopenharmony_ciIssues 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ci 1. What should this extension be called? 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci RESOLVED: multiview_draw_buffers. Multiview has come to be the 4135bd8deadSopenharmony_ci standard term to refer to stereoscopic and beyond buffer rendering 4145bd8deadSopenharmony_ci and this approach centers around the traditional usage of 4155bd8deadSopenharmony_ci a drawbuffers call to specify the buffer(s) to render to. 4165bd8deadSopenharmony_ci 4175bd8deadSopenharmony_ci 2. How should draw buffer bindings be queried? 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci RESOLVED: A new indexed integer query function called 4205bd8deadSopenharmony_ci glGetIntegeri_vEXT. This extension adds an indexed binding for draw 4215bd8deadSopenharmony_ci buffers so it follows that an indexed query should be used to 4225bd8deadSopenharmony_ci retrieve the state that it sets. The name glGetIntegeri_vEXT is 4235bd8deadSopenharmony_ci chosen as it was in desktop GL to clarify the 'i' suffix 4245bd8deadSopenharmony_ci indicating an indexed call as opposed to 'i' indicating an integer 4255bd8deadSopenharmony_ci variant of a call accepting parameters of various types. 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci 3. Should the <location> parameter of DrawBuffersIndexedEXT be removed? 4285bd8deadSopenharmony_ci 4295bd8deadSopenharmony_ci RESOLVED: No. It is useful when draw_buffers is supported. 4305bd8deadSopenharmony_ci 4315bd8deadSopenharmony_ciRevision History 4325bd8deadSopenharmony_ci Version 4, 25 Sept 2012 Clean up overview. Fix a few typographical 4335bd8deadSopenharmony_ci errors. 4345bd8deadSopenharmony_ci Version 3, 03 Sept 2011 EXTify. Remove ALL broadcast. 4355bd8deadSopenharmony_ci Add interactions for ES3 and non- 4365bd8deadSopenharmony_ci draw_buffers cases 4375bd8deadSopenharmony_ci Version 2, 02 Aug 2011 Responses to feedback. 4385bd8deadSopenharmony_ci Version 1, 14 April 2011 First draft. 4395bd8deadSopenharmony_ci 440