15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_clear_texture 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_clear_texture 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Tobias Hector, Imagination Technologies (tobias.hector 'at' imgtec.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Contributors to the original ARB_clear_texture 165bd8deadSopenharmony_ci Ian Romanick 175bd8deadSopenharmony_ci Daniel Koch 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciNotice 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Copyright (c) 2013 The Khronos Group Inc. Copyright terms at 225bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciStatus 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Draft 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciVersion 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Last Modified Date: September 16, 2016 315bd8deadSopenharmony_ci Revision: 2 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ciNumber 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci OpenGL ES Extension #269 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciDependencies 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci OpenGL ES 3.1 is required. 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci This extension is written against the OpenGL ES 3.1 API specification. 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci This extension interacts with EXT/OES_texture_buffer or OpenGL ES 3.2. 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci This extension interacts with EXT/OES_texture_cube_map_array or 465bd8deadSopenharmony_ci OpenGL ES 3.2. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci This extension interacts with OES_texture_stencil8 or OpenGL ES 3.2. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ciOverview 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci Texture objects are fundamental to the operation of OpenGL. They are 535bd8deadSopenharmony_ci used as a source for texture sampling and destination for rendering 545bd8deadSopenharmony_ci as well as being accessed in shaders for image load/store operations 555bd8deadSopenharmony_ci It is also possible to invalidate the contents of a texture. It is 565bd8deadSopenharmony_ci currently only possible to set texture image data to known values by 575bd8deadSopenharmony_ci uploading some or all of a image array from application memory or by 585bd8deadSopenharmony_ci attaching it to a framebuffer object and using the Clear or ClearBuffer 595bd8deadSopenharmony_ci commands. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci Both uploading initial texture data and clearing by attaching to a 625bd8deadSopenharmony_ci framebuffer have potential disadvantages when one simply wants to 635bd8deadSopenharmony_ci initialize texture data to a known value. Uploading initial data 645bd8deadSopenharmony_ci requires the application to allocate a (potentially large) chunk 655bd8deadSopenharmony_ci of memory and transferring that to the GL. This can be a costly 665bd8deadSopenharmony_ci operation both in terms of memory bandwidth and power usage. 675bd8deadSopenharmony_ci Alternatively, attaching a texture level to a framebuffer to clear it 685bd8deadSopenharmony_ci may not be possible if the texture format isn't supported for 695bd8deadSopenharmony_ci rendering, or even if it is, attaching the image to a framebuffer object 705bd8deadSopenharmony_ci may cause the texture to be allocated in certain types of memory, which 715bd8deadSopenharmony_ci it may otherwise not need to be placed in. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci This extension solves these problems by providing a mechanism whereby 745bd8deadSopenharmony_ci the contents of a texture image array can be set to known values by 755bd8deadSopenharmony_ci using the ClearTexImageEXT or ClearTexSubImageEXT commands. These commands 765bd8deadSopenharmony_ci can also be useful for initializing an image that will be used for 775bd8deadSopenharmony_ci atomic shader operations. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ciIP Status 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci No known IP claims. 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ciNew Procedures and Functions 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci void ClearTexImageEXT(uint texture, int level, 865bd8deadSopenharmony_ci enum format, enum type, 875bd8deadSopenharmony_ci const void * data); 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci void ClearTexSubImageEXT(uint texture, int level, 905bd8deadSopenharmony_ci int xoffset, int yoffset, int zoffset, 915bd8deadSopenharmony_ci sizei width, sizei height, sizei depth, 925bd8deadSopenharmony_ci enum format, enum type, 935bd8deadSopenharmony_ci const void * data); 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ciNew Types 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci None 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ciNew Tokens 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci None 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL ES 3.1 API Specification (Programs and 1045bd8deadSopenharmony_ciShaders) 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci In section 7.11.2 (Shader Memory Access Synchronization) edit the 1075bd8deadSopenharmony_ci description of the TEXTURE_UPDATE_BARRIER_BIT to add ClearTexImageEXT 1085bd8deadSopenharmony_ci and ClearTexSubImageEXT to the list of commands that can write to 1095bd8deadSopenharmony_ci texture images. 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL ES 3.1 API Specification (Textures and 1125bd8deadSopenharmony_ciSamplers) 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci Add a new Section 8.x (Clearing Texture Image Data) after 1155bd8deadSopenharmony_ci Section 8.17 (Immutable-Format Texture Images): 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci "All or part of a texture image may be filled with a constant value 1185bd8deadSopenharmony_ci by calling the command 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci void ClearTexSubImageEXT(uint texture, int level, 1215bd8deadSopenharmony_ci int xoffset, int yoffset, int zoffset, 1225bd8deadSopenharmony_ci sizei width, sizei height, sizei depth, 1235bd8deadSopenharmony_ci enum format, enum type, 1245bd8deadSopenharmony_ci const void * data); 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci with <texture> and <level> indicating which texture array image is being 1275bd8deadSopenharmony_ci cleared. It is an error if <texture> is zero or not the name of a texture 1285bd8deadSopenharmony_ci object, if <texture> is a buffer texture, or if the texture image has 1295bd8deadSopenharmony_ci a compressed internal format. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci Arguments <xoffset>, <yoffset>, and <zoffset> specify the lower left 1325bd8deadSopenharmony_ci texel coordinates of a <width>-wide by <height>-high by <depth>-deep 1335bd8deadSopenharmony_ci rectangular subregion of the texel array and are interpreted as they 1345bd8deadSopenharmony_ci are in TexSubImage3D as described in section 8.6 (Alternate Texture 1355bd8deadSopenharmony_ci Image Specification Commands). The subregion must lie within the bounds 1365bd8deadSopenharmony_ci of the texture image, as described in that section. 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci For 2D array textures, <zoffset> is interpreted as the first layer to be 1395bd8deadSopenharmony_ci cleared and <depth> is the number of layers to clear. Cube map textures are 1405bd8deadSopenharmony_ci treated as an array of six slices in the z-dimension, where the value 1415bd8deadSopenharmony_ci of <zoffset> is interpreted as specifying the cube map face for the 1425bd8deadSopenharmony_ci corresponding <layer> in table 8.25 (Layer numbers for cube map texture 1435bd8deadSopenharmony_ci faces) and <depth> is the number of faces to clear. For cube map array 1445bd8deadSopenharmony_ci textures, <zoffset> is the first layer-face to clear, and <depth> is the 1455bd8deadSopenharmony_ci number of layer-faces to clear. Each layer-face is translated into an 1465bd8deadSopenharmony_ci array layer and a cube map face as described for layer-face numbers in 1475bd8deadSopenharmony_ci section 8.5.3 [in OpenGL ES 3.2]. 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci For texture types that do not have certain dimensions, this 1505bd8deadSopenharmony_ci command treats those dimensions as having a size of 1. For example, 1515bd8deadSopenharmony_ci to clear a portion of a two-dimensional texture, the application would 1525bd8deadSopenharmony_ci use <zoffset> equal to zero and <depth> equal to one. 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci <format> and <type> specify the format and type of the source 1555bd8deadSopenharmony_ci data and are interpreted as they are for TexImage3D, as described in 1565bd8deadSopenharmony_ci section 8.4.2 (Transfer of Pixel Rectangles). Textures with a base 1575bd8deadSopenharmony_ci internal format of DEPTH_COMPONENT, STENCIL_INDEX, or DEPTH_STENCIL 1585bd8deadSopenharmony_ci require depth component, stencil, or depth/stencil component data 1595bd8deadSopenharmony_ci respectively. Textures with other base internal formats require RGBA 1605bd8deadSopenharmony_ci formats. Textures with integer internal formats (see table 8.13) require 1615bd8deadSopenharmony_ci integer data. 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci <data> is a pointer to an array of between one and four components of 1645bd8deadSopenharmony_ci texel data that will be used as the source for the constant fill value. 1655bd8deadSopenharmony_ci The elements of <data> are converted by the GL into the 1665bd8deadSopenharmony_ci <internalformat> of the texture image (that was specified when the level 1675bd8deadSopenharmony_ci was defined by any of the TexImage, TexStorage or CopyTexImage 1685bd8deadSopenharmony_ci commands) in the manner described in section 8.4.2 (Transfer of Pixel 1695bd8deadSopenharmony_ci Rectangles), and then used to fill the specified range of the 1705bd8deadSopenharmony_ci destination texture level. If <data> is NULL, then the pointer is 1715bd8deadSopenharmony_ci ignored and the sub-range of the texture image is filled with zeros. 1725bd8deadSopenharmony_ci If <texture> is a multisample texture, all the samples in a texel 1735bd8deadSopenharmony_ci are cleared to the value specified by <data>. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci Errors 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if <texture> is zero or not the 1785bd8deadSopenharmony_ci name of a texture object. 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if <texture> is a buffer 1815bd8deadSopenharmony_ci texture. 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if <texture> has a compressed 1845bd8deadSopenharmony_ci internal format. 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the base internal format is 1875bd8deadSopenharmony_ci DEPTH_COMPONENT and <format> is not DEPTH_COMPONENT. 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the base internal format is 1905bd8deadSopenharmony_ci DEPTH_STENCIL and <format> is not DEPTH_STENCIL. 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the base internal format is 1935bd8deadSopenharmony_ci STENCIL_INDEX and <format> is not STENCIL_INDEX. 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the base internal format is 1965bd8deadSopenharmony_ci RGBA and the <format> is DEPTH_COMPONENT, STENCIL_INDEX, or 1975bd8deadSopenharmony_ci DEPTH_STENCIL. 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the internal format is 2005bd8deadSopenharmony_ci integer and <format> does not specify integer data. 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the internal format is 2035bd8deadSopenharmony_ci not integer and <format> does specify integer data. 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the specified subregion 2065bd8deadSopenharmony_ci does not lie within the bounds of the texture image, as described 2075bd8deadSopenharmony_ci for TexSubImage3D in section 8.6. 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci The command 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci void ClearTexImageEXT(uint texture, int level, 2125bd8deadSopenharmony_ci enum format, enum type, 2135bd8deadSopenharmony_ci const void * data); 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci is equivalent to calling ClearTexSubImageEXT with <xoffset>, <yoffset>, 2165bd8deadSopenharmony_ci and <zoffset> equal to 0 and <width>, <height>, and <depth> equal 2175bd8deadSopenharmony_ci to the dimensions of the texture image (or zero and one for dimensions 2185bd8deadSopenharmony_ci the texture doesn't have). 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci Errors 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci In addition to the errors generated by ClearTexSubImageEXT: 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the image array identified by 2255bd8deadSopenharmony_ci <level> has not previously been defined by a TexImage* or TexStorage* 2265bd8deadSopenharmony_ci command." 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ciInteractions with EXT/OES_texture_buffer or OpenGL ES 3.2 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci If EXT_texture_buffer or equivalent functionality is not supported, 2315bd8deadSopenharmony_ci ignore all references to buffer textures. 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ciInteractions with EXT/OES_texture_cube_map_array or OpenGL ES 3.2 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci If EXT_texture_cube_map_array or equivalent functionality is not supported, 2365bd8deadSopenharmony_ci ignore all references to cube map array textures. 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ciInteractions with OES_texture_stencil8 or OpenGL ES 3.2 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ci If OES_texture_stencil8 or equivalent functionality is not supported, 2415bd8deadSopenharmony_ci ignore all references to stencil textures. 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ciErrors 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2465bd8deadSopenharmony_ci ClearTexSubImageEXT if <texture> is zero or not the name of a texture object. 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2495bd8deadSopenharmony_ci ClearTexSubImageEXT if <texture> is a buffer texture. 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2525bd8deadSopenharmony_ci ClearTexSubImageEXT if <texture> has a compressed internal format. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2555bd8deadSopenharmony_ci ClearTexSubImageEXT if the base internal format is DEPTH_COMPONENT and 2565bd8deadSopenharmony_ci <format> is not DEPTH_COMPONENT. 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2595bd8deadSopenharmony_ci ClearTexSubImageEXT if the base internal format is STENCIL_INDEX and 2605bd8deadSopenharmony_ci <format> is not STENCIL_INDEX. 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2635bd8deadSopenharmony_ci ClearTexSubImageEXT if the base internal format is DEPTH_STENCIL and 2645bd8deadSopenharmony_ci <format> is not DEPTH_STENCIL. 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2675bd8deadSopenharmony_ci ClearTexSubImageEXT if the base internal format is RGBA and the <format> 2685bd8deadSopenharmony_ci is DEPTH_COMPONENT, STENCIL_INDEX, or DEPTH_STENCIL. 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2715bd8deadSopenharmony_ci ClearTexSubImageEXT if the internal format is integer and <format> does not 2725bd8deadSopenharmony_ci specify integer data. 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT or 2755bd8deadSopenharmony_ci ClearTexSubImageEXT if the internal format is not integer and <format> 2765bd8deadSopenharmony_ci does specify integer data. 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the specified subregion 2795bd8deadSopenharmony_ci does not lie within the bouds of the texture image, as described 2805bd8deadSopenharmony_ci for TexSubImage3D in section 8.6. 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci An INVALID_OPERATION error is generated by ClearTexImageEXT if the 2835bd8deadSopenharmony_ci image array identified by <level> has not previously been defined. 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ciNew State 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci None. 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ciNew Implementation Dependent State 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci None. 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ciIssues 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci See ARB_clear_texture for relevant issues. 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci 1) How does this differ from ARB_clear_texture? 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci RESOLVED: 3005bd8deadSopenharmony_ci - Removed interactions with features not present in OpenGL ES: 3015bd8deadSopenharmony_ci - 1D arrays 3025bd8deadSopenharmony_ci - border texels 3035bd8deadSopenharmony_ci - Removed CLEAR_TEXTURE token for GetInternalFormat* which relies 3045bd8deadSopenharmony_ci on the ARB_internalformat_query2 extension which does not have 3055bd8deadSopenharmony_ci equivalent functionality in OpenGL ES. 3065bd8deadSopenharmony_ci - minor language updates to sync with OpenGL 4.5 language. 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ciRevision History 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci Revision 1, 2015/08/15, thector 3115bd8deadSopenharmony_ci - Initial revision 3125bd8deadSopenharmony_ci Revision 2, 2016/09/16, dgkoch 3135bd8deadSopenharmony_ci - added interactions with texture cube map arrays and stencil textures 3145bd8deadSopenharmony_ci - added missing suffixes on commands 3155bd8deadSopenharmony_ci - removed CLEAR_TEXTURE, which relies on functionality not in ES. 3165bd8deadSopenharmony_ci - minor language updates to sync with OpenGL 4.5 core language. 3175bd8deadSopenharmony_ci - updated some section references. 318