15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_YUV_target 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_YUV_target 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Amit Bansal 125bd8deadSopenharmony_ci Arshad Bebal 135bd8deadSopenharmony_ci Jeff Leger 145bd8deadSopenharmony_ci Jing Zhou 155bd8deadSopenharmony_ci Maurice Ribble 165bd8deadSopenharmony_ci Prabindh Sundareson 175bd8deadSopenharmony_ci Jan-Harald Fredriksen 185bd8deadSopenharmony_ci Daniel Koch 195bd8deadSopenharmony_ci Jamie Gennis 205bd8deadSopenharmony_ci Mark Callow 215bd8deadSopenharmony_ci Pat Brown 225bd8deadSopenharmony_ci Andrew Garrard 235bd8deadSopenharmony_ci Etay Meiri 245bd8deadSopenharmony_ci Weifeng Zhang 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciContacts 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci Jeff Leger <jleger@qti.qualcomm.com> 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciStatus 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci Complete. 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciVersion 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci April 6, 2018 (version 17) 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciNumber 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci OpenGL ES Extension #222 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciDependencies 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci Requires OpenGL ES 3.0 and ESSL 3.0. 455bd8deadSopenharmony_ci Requires EGL 1.4 and following EGL extension: 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci EGL_KHR_image_base 485bd8deadSopenharmony_ci OES_EGL_image_external 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci This extension is written based on the wording of the OpenGL ES 3.0 515bd8deadSopenharmony_ci Specification and OpenGL ES Shading Language 3.0. 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci This extension interacts with OpenGL ES 3.1. See issue 1 and 13 for 545bd8deadSopenharmony_ci more details. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci This extension interacts with OES_tessellation_shader & 575bd8deadSopenharmony_ci OES_geometry shader see first issue for more details. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci This extension borrows texture function names from the 605bd8deadSopenharmony_ci OES_EGL_image_external_essl3. This extension is compatible with 615bd8deadSopenharmony_ci OES_EGL_image_external_essl3 and can coexist but does not require it. 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci This extension interacts with EXT_shader_framebuffer_fetch. see 645bd8deadSopenharmony_ci issue 7 for more details. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ciOverview 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci This extension adds support for three new YUV related items: first 695bd8deadSopenharmony_ci rendering to YUV images, second sampling from YUV images while keeping the 705bd8deadSopenharmony_ci data in YUV space, third it defines a new built in function that does 715bd8deadSopenharmony_ci conversion from RGB to YUV with controls to choose ITU-R BT.601-7, 725bd8deadSopenharmony_ci ITU-R BT.601-7 Full range (JFIF images), or ITU-R BT.709-5 standard. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci This new functionality is layered on top of the OES_EGL_image_external 755bd8deadSopenharmony_ci extension. 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci To perform the YUV rendering capability in this extension an application 785bd8deadSopenharmony_ci will attach a texture to the framebuffer object as the color attachment. 795bd8deadSopenharmony_ci If the texture has a target type of TEXTURE_EXTERNAL_OES with YUV color 805bd8deadSopenharmony_ci format then the GL driver can use this framebuffer object as the render 815bd8deadSopenharmony_ci target, TEXTURE_EXTERNAL_OES target with RGB color format are not allowed 825bd8deadSopenharmony_ci with this extension. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ciNew Types & Keywords 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci A new OpenGL GLSL extension flag is added: 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci #extension GL_EXT_YUV_target 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci When the above GLSL extension is specified, one new sampler type 915bd8deadSopenharmony_ci will be available for sampling the 2D texture: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci __samplerExternal2DY2YEXT 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci The "__samplerExternal2DY2YEXT" is used to sample a YUV texture image and 965bd8deadSopenharmony_ci output color value without any color conversion. 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci Whenever a YUV sample is output from the sampler, the format of the YUV 995bd8deadSopenharmony_ci will be as if YUV 4:4:4 format is output. This also means that the Y 1005bd8deadSopenharmony_ci sample maps to component R, the U sample maps to component G, the V sample 1015bd8deadSopenharmony_ci maps to component B, and the component A will be 1.0f. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci The RGB sample output will be the same as in OpenGL ES specification. 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Here is one example: 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci uniform __samplerExternal2DY2YEXT u_sTexture; 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci When the above GLSL extension is specified, one new additional type will be 1105bd8deadSopenharmony_ci available to specify color space standard formula for yuv to rgb transformation. 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci yuvCscStandardEXT 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci The value of new type can be specified using one of three new keywords 1155bd8deadSopenharmony_ci itu_601, itu_601_full_range and itu_709. 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci For example: 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci yuvCscStandardEXT conv_standard = itu_601; 1205bd8deadSopenharmony_ci yuvCscStandardEXT conv_standard = itu_601_full_range; 1215bd8deadSopenharmony_ci yuvCscStandardEXT conv_standard = itu_709; 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci Keyword itu_601 means color conversion is required using the formula 1245bd8deadSopenharmony_ci specified in the ITU-R BT.601. Similarly keyword itu_601_full_range 1255bd8deadSopenharmony_ci means conversion is done using ITU BT.601 full range formula as specified 1265bd8deadSopenharmony_ci in JFIF standard while keyword itu_709 specify ITU-R BT.709 standard. Note 1275bd8deadSopenharmony_ci that new yuvCscStandardEXT type can't be use for any other purpose apart 1285bd8deadSopenharmony_ci from specifying color standard value to newly introduced color conversion 1295bd8deadSopenharmony_ci built in functions mentioned below. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ciNew Built-in function 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci When the new GLSL extension is specified, two new built in functions 1345bd8deadSopenharmony_ci will be available for rgb to yuv or yuv to rgb color space conversion. 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci vec3 rgb_2_yuv(vec3 color, yuvCscStandardEXT conv_standard); 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci The function rgb_2_yuv will apply rgb to yuv color conversion 1395bd8deadSopenharmony_ci transformation on "color" value using the formula specified as per new type 1405bd8deadSopenharmony_ci yuvCscStandardEXT variable. The first input parameter supposed to specify 1415bd8deadSopenharmony_ci rgb value using x, y & z channels of a vec3 variable, correspondingly 1425bd8deadSopenharmony_ci return value of this function will have transformed y, u and v value in its 1435bd8deadSopenharmony_ci x, y and z channel. Precision of the input color will define the precision 1445bd8deadSopenharmony_ci used for color space conversion and for output yuv color value. 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci vec3 yuv_2_rgb (vec3 color, yuvCscStandardEXT conv_standard); 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci The function yuv_2_rgb will apply yuv to rgb color conversion 1495bd8deadSopenharmony_ci transformation on "color" value using the formula specified as per new type 1505bd8deadSopenharmony_ci yuvCscStandardEXT variable. The first input parameter supposed to specify 1515bd8deadSopenharmony_ci yuv value using x, y & z channels of a vec3 variable, correspondingly 1525bd8deadSopenharmony_ci return value of this function will have transformed r, g and b value in its 1535bd8deadSopenharmony_ci x, y and z channel. Precision of the input color will define the precision 1545bd8deadSopenharmony_ci used for color space conversion and for output yuv color value. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ciNew layout qualifier 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci A shader which produces yuv format color output must qualify the fragment 1595bd8deadSopenharmony_ci shader output variable with new yuv layout qualifier as described below. 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ci layout (yuv) out vec4 color; 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci The new yuv layout qualifier can't be combined with any other layout qualifier, 1645bd8deadSopenharmony_ci can only be used with fragment shader outputs and would be available only when 1655bd8deadSopenharmony_ci the new GLSL extension is specified. Additionally if the shader qualifies 1665bd8deadSopenharmony_ci fragment shader output with the new yuv qualifier and write depth or multiple 1675bd8deadSopenharmony_ci color output, it would cause compilation failure. 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ciNew Tokens 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci Returned in the <type> parameter of GetActiveUniform: 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ciReuse tokens as in extension "OES_EGL_image_external." 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci Accepted as a target in the <target> parameter of BindTexture, 1785bd8deadSopenharmony_ci EGLImageTargetTexture2DOES, and FramebufferTexture2D: 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci TEXTURE_EXTERNAL_OES 0x8D65 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci Accepted as <value> in GetIntegerv() and GetFloatv() queries: 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci TEXTURE_BINDING_EXTERNAL_OES 0x8D67 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci Accepted as <value> in GetTexParameter*() queries: 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ciAddition to Chapter 3 of the OpenGL ES 3.0 specification 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci Add a new section: "3.8.18 External Textures," which follows section 1935bd8deadSopenharmony_ci "3.8.17 Shader Exponent Texture Color Conversion." The wording will 1945bd8deadSopenharmony_ci be the same as in extension "OES_EGL_image_external." 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ciChanges to Section 4.4.2 "Attaching Images to Framebuffer Objects" 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci At the end of subsection "Attaching Texture Images to a Framebuffer," add 1995bd8deadSopenharmony_ci the following paragraphs: 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci from 2025bd8deadSopenharmony_ci "If texture is not zero, then texture must either name an existing 2035bd8deadSopenharmony_ci two dimensional texture object and textarget must be TEXTURE_2D or 2045bd8deadSopenharmony_ci texture must name an existing cube map...." 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci to 2075bd8deadSopenharmony_ci "If texture is not zero, then texture must either name an existing 2085bd8deadSopenharmony_ci two dimensional texture object and textarget must be TEXTURE_2D or 2095bd8deadSopenharmony_ci TEXTURE_EXTERNAL_OES or texture must name an existing cube map...." 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci from 2125bd8deadSopenharmony_ci "If textarget is TEXTURE_2D, level must be greater than or equal to 2135bd8deadSopenharmony_ci zero and no larger than log2 of the value of MAX_TEXTURE_SIZE. 2145bd8deadSopenharmony_ci Otherwise, an INVALID_VALUE error is generated. 2155bd8deadSopenharmony_ci The command..." 2165bd8deadSopenharmony_ci to 2175bd8deadSopenharmony_ci "If textarget is TEXTURE_2D, level must be greater than or equal to 2185bd8deadSopenharmony_ci zero and no larger than log2 of the value of MAX_TEXTURE_SIZE. 2195bd8deadSopenharmony_ci Otherwise, an INVALID_VALUE error is generated. If textarget is 2205bd8deadSopenharmony_ci TEXTURE_EXTERNAL_OES and attachment is other than COLOR_ATTACHMENT0, 2215bd8deadSopenharmony_ci an INVALID_OPERATION error is generated. 2225bd8deadSopenharmony_ci The command..." 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci Add an additional sentence at the end of above paragraph: 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci "Since TEXTURE_EXTERNAL_OES texture target can only be specified 2275bd8deadSopenharmony_ci using an EGLImage, yuv formats can be rendered by attaching 2285bd8deadSopenharmony_ci TEXTURE_EXTERNAL_OES textarget via EGLImage." 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ciChanges to Section 4.2.3 "Clearing the Buffers" 2315bd8deadSopenharmony_ci from 2325bd8deadSopenharmony_ci "Unsigned normalized fixed-point RGBA color buffers are cleared to color 2335bd8deadSopenharmony_ci values derived by clamping each component of the clear color to the range 2345bd8deadSopenharmony_ci [0; 1], then converting the (possibly sRGB converted and/or dithered) color 2355bd8deadSopenharmony_ci to fixed-point using equations 2.3 or 2.4, respectively. The result of 2365bd8deadSopenharmony_ci clearing integer color buffers with Clear is undefined." 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci to 2395bd8deadSopenharmony_ci "Unsigned normalized fixed-point RGBA color buffers are cleared to color 2405bd8deadSopenharmony_ci values derived by clamping each component of the clear color to the range 2415bd8deadSopenharmony_ci [0; 1], then converting the (possibly sRGB converted and/or dithered) color 2425bd8deadSopenharmony_ci to fixed-point using equations 2.3 or 2.4, respectively. When clearing YUV 2435bd8deadSopenharmony_ci Color Buffers, clear color should be defined in yuv color space and so 2445bd8deadSopenharmony_ci floating point r, g, and b value will be mapped to corresponding y, u and v 2455bd8deadSopenharmony_ci value and alpha channel will be ignored. The result of clearing integer 2465bd8deadSopenharmony_ci color buffers with Clear is undefined." 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ciChanges to Section 4.4.3 "Fine Control of Buffer Updates" 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci from 2515bd8deadSopenharmony_ci "ColorMask is used to mask the writing of R, G, B and A values to all active 2525bd8deadSopenharmony_ci draw buffers. r, g, b, and a indicate whether R, G, B, or A values, respectively, 2535bd8deadSopenharmony_ci are written or not (a value of TRUE means that the corresponding value is written). 2545bd8deadSopenharmony_ci In the initial state, all color values are enabled for writing for all draw 2555bd8deadSopenharmony_ci buffers..." 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci to 2585bd8deadSopenharmony_ci "ColorMask is used to mask the writing of R, G, B and A values to all active 2595bd8deadSopenharmony_ci draw buffers. r, g, b, and a indicate whether R, G, B, or A values, respectively, 2605bd8deadSopenharmony_ci are written or not (a value of TRUE means that the corresponding value is written) 2615bd8deadSopenharmony_ci except when the color buffer is in YUV color space, in that case setting any one 2625bd8deadSopenharmony_ci of the r, g, b, and a values as false would generate draw time INVALID_OPERATION error. 2635bd8deadSopenharmony_ci In the initial state, all color values are enabled for writing for all draw 2645bd8deadSopenharmony_ci buffers..." 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ciChanges to Section 4.1.7 "Blending" 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci from 2695bd8deadSopenharmony_ci "Blending applies only if the color buffer has a fixed-point format. If the color 2705bd8deadSopenharmony_ci buffer has an integer format, proceed to the next operation." 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci to 2735bd8deadSopenharmony_ci "Blending applies only if the color buffer has a fixed-point format and non YUV space 2745bd8deadSopenharmony_ci format color buffer. If the color buffer has an integer, proceed to the next 2755bd8deadSopenharmony_ci operation. If color buffer format is YUV color space, it will generate 2765bd8deadSopenharmony_ci draw time INVALID_OPERATION error." 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ciChanges to 4.2.1 "Selecting Buffers for Writing" 2795bd8deadSopenharmony_ci from 2805bd8deadSopenharmony_ci "If some, but not all user-defined output variables are written, the values of 2815bd8deadSopenharmony_ci fragment colors corresponding to unwritten variables are similarly undefined. 2825bd8deadSopenharmony_ci The order of writes..." 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci to 2855bd8deadSopenharmony_ci "If some, but not all user-defined output variables are written, the values of 2865bd8deadSopenharmony_ci fragment colors corresponding to unwritten variables are similarly undefined unless 2875bd8deadSopenharmony_ci any of the fragment output is qualified with yuv format qualifier. In later case 2885bd8deadSopenharmony_ci compiler would restrict usage of yuv format qualifier up to a single color output. 2895bd8deadSopenharmony_ci The order of writes..." 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ciChanges to section 4.4.4 ("Framebuffer Completeness") 2925bd8deadSopenharmony_ci from 2935bd8deadSopenharmony_ci "An internal format is color-renderable if it is one of the formats from table 2945bd8deadSopenharmony_ci 3.12 noted as color-renderable or if it is unsized format RGBA or RGB. No 2955bd8deadSopenharmony_ci other formats," 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci to 2985bd8deadSopenharmony_ci "An internal format is color-renderable if it is one of the formats from table 2995bd8deadSopenharmony_ci 3.12 noted as color-renderable or if it is unsized format RGBA or RGB or if it is 3005bd8deadSopenharmony_ci YUV color space format supported by implementation. No other formats," 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ciChanges to section 3.7 ("Keywords") of the OpenGL ES Shading Language 3035bd8deadSopenharmony_cispecification 3045bd8deadSopenharmony_ci 3055bd8deadSopenharmony_ci - Add to the list of keywords: 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci __samplerExternal2DY2YEXT 3085bd8deadSopenharmony_ci yuvCscStandardExt 3095bd8deadSopenharmony_ci itu_601 3105bd8deadSopenharmony_ci itu_601_full_range 3115bd8deadSopenharmony_ci itu_709 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ciChanges to section 4.1 ("Basic Types") of the OpenGL ES Shading Language 3165bd8deadSopenharmony_cispecification 3175bd8deadSopenharmony_ci - Add to the list of Transparent types: 3185bd8deadSopenharmony_ci "yuvCscStandardExt a value type to specify color space standard formula for 3195bd8deadSopenharmony_ci transformation between yuv and rgb, taking values of itu_601, itu_601_full_range, 3205bd8deadSopenharmony_ci itu_709" 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci - Add to the list of Floating Point Sampler Types (opaque): 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci "__samplerExternal2DY2YEXT a handle for accessing an external 2D texture 3255bd8deadSopenharmony_ci whose underneath format is YUV" 3265bd8deadSopenharmony_ci 3275bd8deadSopenharmony_ci - Add a paragraph at the end of the section: 3285bd8deadSopenharmony_ci 3295bd8deadSopenharmony_ci "The __samplerExternal2DY2YEXT and yuvCscStandardExt types are optional and must 3305bd8deadSopenharmony_ci be enabled by 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci #extension GL_EXT_YUV_target : enable 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci No type constructor or type conversion is allowed on yuvCscStandardExt. A value 3355bd8deadSopenharmony_ci of itu_601, itu_601_full_range, itu_709, or a variable typed as yuvCscStandardExt 3365bd8deadSopenharmony_ci can be used as an argument to user-defined functions and the built-in functions yuv_2_rgb and 3375bd8deadSopenharmony_ci rgb_2_yuv. Other than the assignment operator, any other operations on this type 3385bd8deadSopenharmony_ci of values or variables will be treated as a compilation error." 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ciChanges to section 4.5.4 ("Default Precision Qualifiers") of the OpenGL ES 3415bd8deadSopenharmony_ciShading Language specification 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci - Add to the list of "vertex language has the following predeclared 3445bd8deadSopenharmony_ci globally scoped default precision statements:" 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci "precision lowp __samplerExternal2DY2YEXT;" 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci - Add to the list of "fragment language has the following predeclared 3495bd8deadSopenharmony_ci globally scoped default precision statements:" 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci "precision lowp __samplerExternal2DY2YEXT;" 3525bd8deadSopenharmony_ci 3535bd8deadSopenharmony_ciChanges to section 8.8 ("Texture Lookup Functions") of the OpenGL ES Shading 3545bd8deadSopenharmony_ciLanguage specification 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci - Add to the table the following sampler functions: 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci "highp ivec2 textureSize(__samplerExternal2DY2YEXT sampler, int lod) 3595bd8deadSopenharmony_ci vec4 texture(__samplerExternal2DY2YEXT sampler, vec2 P [, float bias] ) 3605bd8deadSopenharmony_ci vec4 textureProj(__samplerExternal2DY2YEXT sampler, vec3 P [, float bias] ) 3615bd8deadSopenharmony_ci vec4 textureProj(__samplerExternal2DY2YEXT sampler, vec4 P [, float bias]) 3625bd8deadSopenharmony_ci vec4 texelFetch(__samplerExternal2DY2YEXT sampler, ivec2 P, int lod)" 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ciAdd a new section 8.10 "Conversion Functions between YUV and RGB" 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci - Add a new table containing 2 entries: 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci vec3 rgb_2_yuv(vec3 color, yuvCscStandardEXT conv_standard); 3695bd8deadSopenharmony_ci apply rgb to yuv color conversion transformation on "color" value 3705bd8deadSopenharmony_ci using the formula specified by conv_standard. 3715bd8deadSopenharmony_ci 3725bd8deadSopenharmony_ci vec3 yuv_2_rgb(vec3 color, yuvCscStandardEXT conv_standard); 3735bd8deadSopenharmony_ci apply yuv to rgb color conversion transformation on "color" value 3745bd8deadSopenharmony_ci using the formula specified by conv_standard. 3755bd8deadSopenharmony_ci 3765bd8deadSopenharmony_ciCompatibility with OpenGL ES 3.1 and ESSL 3.10 3775bd8deadSopenharmony_ci 3785bd8deadSopenharmony_ci This extension is expected to work without modification with OpenGL ES 3.1 3795bd8deadSopenharmony_ci and ESSL 3.10. Some further clarification in issue 1, 9 and 13. 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ciIssues 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci 1. Do we want to explicitly disallow "__samplerExternal2DY2YEXT" from use in other 3845bd8deadSopenharmony_ci shader apart from fragment shader e.g. vertex, compute, geometry and tessellation 3855bd8deadSopenharmony_ci shaders? 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci RESOLVED: No, modern unified shader hardware supports YUV texture sampling in all 3885bd8deadSopenharmony_ci of the shader stages, we should keep this enable irrespective of shader stage. 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ci 2. What happens if the input source isn't in the expected color space for built in 3915bd8deadSopenharmony_ci functions or lets say there is cross conversion between different color space 3925bd8deadSopenharmony_ci conversion standards e.g. 601 RGB to 709 YUV etc or yuv layout qualified color 3935bd8deadSopenharmony_ci output is actually written with in rgb color space? 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci RESOLVED: Implementation can't determine how the input pixel has been 3965bd8deadSopenharmony_ci manipulated before producing the shader outputs, so results would be 3975bd8deadSopenharmony_ci undefined in this case. 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci 3. What happens if the source formats aren't the expected format for sampler? 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci RESOLVED: Non-YUV format will generate a draw time INVALID_OPERATION error. 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci 4. Is the depth or stencil behaviour changed when rendering to yuv surfaces. 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ci RESOLVED: The depth and stencil buffers will work the same when rendering 4065bd8deadSopenharmony_ci to RGB or YUV surfaces, however when shader output is qualified with yuv 4075bd8deadSopenharmony_ci layout qualifier, writing out gl_FragDepth would cause compilation failure. 4085bd8deadSopenharmony_ci 4095bd8deadSopenharmony_ci 5. Should this extension include support for renderbuffers or just 4105bd8deadSopenharmony_ci renderable textures? 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci RESOLVED: Renderbuffers doesn't add any functionality so it will not be 4135bd8deadSopenharmony_ci included. 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci 6. Is BlitFramebuffer or CopyTex[Sub]Image supported with YUV renderable 4165bd8deadSopenharmony_ci surfaces? 4175bd8deadSopenharmony_ci 4185bd8deadSopenharmony_ci RESOLVED: No. There is a lot of driver complexity in supporting and 4195bd8deadSopenharmony_ci testing case. Using these calls with a YUV source or destination 4205bd8deadSopenharmony_ci will cause an INVALID_OPERATION error. 4215bd8deadSopenharmony_ci 4225bd8deadSopenharmony_ci 7. Does EXT_shader_framebuffer_fetch work with YUV renderable surfaces? 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ci RESOLVED: Yes. The next question is the result before or after 4255bd8deadSopenharmony_ci sub-sampling? To give maximum flexibility to hardware either of these 4265bd8deadSopenharmony_ci options is acceptable. 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ci 8. Should we add support for BT.2020? 4295bd8deadSopenharmony_ci 4305bd8deadSopenharmony_ci RESOLVED: Currently No, If require BT.2020 functionality can be achieved 4315bd8deadSopenharmony_ci using __samplerExternal2DY2YEXT and user defined matrix. To keep the spec 4325bd8deadSopenharmony_ci simple, we just want to have only three currently. 4335bd8deadSopenharmony_ci 4345bd8deadSopenharmony_ci 9. Should sampling return samples converted in to linear space or raw 4355bd8deadSopenharmony_ci samples? 4365bd8deadSopenharmony_ci 4375bd8deadSopenharmony_ci RESOLVED: This extension will return raw samples. If the YUV data is 4385bd8deadSopenharmony_ci encoded in a non-linear space, as is common, the returned samples will be 4395bd8deadSopenharmony_ci in the non-linear space. If the data is encoded linearly, the returned 4405bd8deadSopenharmony_ci samples will be linear. 4415bd8deadSopenharmony_ci 4425bd8deadSopenharmony_ci 10. Are there specific requirements on how a lower resolution UV plane must 4435bd8deadSopenharmony_ci be sampled during rendering? 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci RESOLVED: To allow maximum flexibility in hardware at this time this 4465bd8deadSopenharmony_ci extension does not define how this sampling must be performed. Even if we 4475bd8deadSopenharmony_ci decide to define this behaviour in future, it would be more appropriate to 4485bd8deadSopenharmony_ci do it via a separate EGL extension. 4495bd8deadSopenharmony_ci 4505bd8deadSopenharmony_ci 11. How goes gl_FragCoord work with a lower resolution UV plane? 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci RESOLVED: It is expected to work as if that plane was rendered at full 4535bd8deadSopenharmony_ci resolution. The exception to this is talked about in issue #11 where 4545bd8deadSopenharmony_ci there is some flexibility in subpixel sampling. 4555bd8deadSopenharmony_ci 4565bd8deadSopenharmony_ci 12. Should we add YUV format support for image load store in this extension or 4575bd8deadSopenharmony_ci is it valid to use new yuv format layout qualifier with image load store ? 4585bd8deadSopenharmony_ci 4595bd8deadSopenharmony_ci RESOLVED: No, Since that would require major changes, we should do this with 4605bd8deadSopenharmony_ci a separate extension, currently using new yuv format qualifier with image load 4615bd8deadSopenharmony_ci store would cause compilation failure. 4625bd8deadSopenharmony_ci 4635bd8deadSopenharmony_ci 13. How can we defines color standard matrix other than provided via built-in 4645bd8deadSopenharmony_ci functions e.g. full range BT.709 or adding compensation for the different colour 4655bd8deadSopenharmony_ci primaries of the different standards ? 4665bd8deadSopenharmony_ci 4675bd8deadSopenharmony_ci RESOLVED: This extension defines built in utility functions for some of the 4685bd8deadSopenharmony_ci common color conversion standard, however its no way limit an app to certain 4695bd8deadSopenharmony_ci standard of output data. App can define own color matrix for such purpose 4705bd8deadSopenharmony_ci and use with either __samplerExternal2DY2YEXT or sampler2D. 4715bd8deadSopenharmony_ci 4725bd8deadSopenharmony_ci 14. What happens if shader produce a color output qualified with yuv layout 4735bd8deadSopenharmony_ci qualifier and current draw FBO format isn't YUV or draw FBO format is in 4745bd8deadSopenharmony_ci YUV color space but shader output isn't qualified with yuv layout qualifier. 4755bd8deadSopenharmony_ci 4765bd8deadSopenharmony_ci RESOLVED: In order to write YUV color output, shader color output must be 4775bd8deadSopenharmony_ci qualified with yuv layout qualifier and draw FBO format needs to be in YUV 4785bd8deadSopenharmony_ci color space otherwise lack of any of these would cause INVALID_OPERATION 4795bd8deadSopenharmony_ci error. 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci 15. What happens if shader produce yuv color output which is out of range 4825bd8deadSopenharmony_ci as per definition of color space format of rendering surface e.g. full range 4835bd8deadSopenharmony_ci output when the output color space is limited or similarly input to one of 4845bd8deadSopenharmony_ci built in color conversion functions or to the new __samplerExternal2DY2YEXT 4855bd8deadSopenharmony_ci is out of range. 4865bd8deadSopenharmony_ci 4875bd8deadSopenharmony_ci RESOLVED: If shader yuv color output or input values to one of the built in 4885bd8deadSopenharmony_ci color conversion functions or to the new __samplerExternal2DY2YEXT are not 4895bd8deadSopenharmony_ci within the specified range of the format, results would be undefined values. 4905bd8deadSopenharmony_ci 4915bd8deadSopenharmony_ci 16. How ReadPixels operate for YUV render target? 4925bd8deadSopenharmony_ci 4935bd8deadSopenharmony_ci RESOLVED: ReadPixels will convert YUV to RGBA under the current spec 4945bd8deadSopenharmony_ci requirement to support format RGBA and type UNSIGNED_BYTE combination for 4955bd8deadSopenharmony_ci the normalized fixed point surfaces depending upon format and color space 4965bd8deadSopenharmony_ci standard of currently bound rendering surface. 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ciKnown Quality Issues 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci Since YUV is a lossy compressed format and UV values represent sampling at 5015bd8deadSopenharmony_ci even locations, there may be minor quality issues along the primitive edges 5025bd8deadSopenharmony_ci or for scissor when its X or Y set to an odd value. In case of YUV 5035bd8deadSopenharmony_ci primitive rendering if geometry is animated, there may be more artifacts as 5045bd8deadSopenharmony_ci edges might flicker and sparkle frame to frame. Another way to explain 5055bd8deadSopenharmony_ci this corruption is that sometimes the different planes are stored at 5065bd8deadSopenharmony_ci different resolutions so the different interpolation for different planes 5075bd8deadSopenharmony_ci causes these artifacts. 5085bd8deadSopenharmony_ci 5095bd8deadSopenharmony_ci Due to nature of CbCr subsampling, there might be artifacts along the primitive 5105bd8deadSopenharmony_ci edges if there are partially covered pixels. Since commonly used 4:2:0 YUV 5115bd8deadSopenharmony_ci formats writes out 1 pixel for a block of 2x2 pixels, depending upon how 5125bd8deadSopenharmony_ci subsampled pixel output is calculated, there may always be artifacts around the 5135bd8deadSopenharmony_ci primitive edges for partially covered pixels e.g. implementation might always 5145bd8deadSopenharmony_ci decide to choose CbCr subsample cosited with top left pixel 2x2 Y plane block 5155bd8deadSopenharmony_ci based on this single pixel coverage. This could help to avoid artifacts in more 5165bd8deadSopenharmony_ci key cases e.g. along the diagonal of quad when its drawn using triangle strip 5175bd8deadSopenharmony_ci but it may cause artifacts in other cases when we have partially covered 5185bd8deadSopenharmony_ci pixels around the primitive edges visible after using very high zoom factor. 5195bd8deadSopenharmony_ci 5205bd8deadSopenharmony_ciDependencies on EGL_KHR_image, EGL_KHR_image_base, and EGL 1.4 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci If EGL 1.2 is not supported, or if neither the EGL_OES_image nor 5235bd8deadSopenharmony_ci EGL_OES_image_base extensions is supported, all discussion of 5245bd8deadSopenharmony_ci EGLImages should be ignored, and any calls to either 5255bd8deadSopenharmony_ci EGLImageTargetTexture2DOES or FramebufferTexture2D with 5265bd8deadSopenharmony_ci TEXTURE_EXTERNAL_OES textarget should generate the error 5275bd8deadSopenharmony_ci INVALID_OPERATION. 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ciDependencies on OES_EGL_image_external 5305bd8deadSopenharmony_ci 5315bd8deadSopenharmony_ci This extension is built on top of the OES_EGL_image_external extension. 5325bd8deadSopenharmony_ci It can coexist with the OES_EGL_image_external extension. 5335bd8deadSopenharmony_ci 5345bd8deadSopenharmony_ciRevision History 5355bd8deadSopenharmony_ci #17 (April 6, 2018, H1Gdev) 5365bd8deadSopenharmony_ci - Fix typo. 5375bd8deadSopenharmony_ci #16 (June 8, 2016, Jeff Leger) 5385bd8deadSopenharmony_ci - Add yuvCscStandardExt itu_* to the list of keywords 5395bd8deadSopenharmony_ci - Add yuvCscStandardExt as a basic type and clarify that this type 5405bd8deadSopenharmony_ci can only be used in assignments or as a function argument. 5415bd8deadSopenharmony_ci - Add rgb_2_yuv and yuv_2_rgb as built-in functions 5425bd8deadSopenharmony_ci (Bug 15704). 5435bd8deadSopenharmony_ci 5445bd8deadSopenharmony_ci #15 (April 23, 2015, Jon Leech) 5455bd8deadSopenharmony_ci - Fix typo EGLImageTargetTexImage2DOES -> EGLImageTargetTexture2DOES 5465bd8deadSopenharmony_ci (Bug 8114). 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci #14 (February 10, 2015, Amit Bansal) 5495bd8deadSopenharmony_ci - Removed YUV_EXT and Y_EXT tokens hard requirement for ReadPixels, 5505bd8deadSopenharmony_ci current plan is to propose it later as separate extension once we 5515bd8deadSopenharmony_ci have more corresponding compelling use cases. 5525bd8deadSopenharmony_ci - Adding interaction wording with EXT_shader_framebuffer_fetch 5535bd8deadSopenharmony_ci - Removed duplicated image load store issue. 5545bd8deadSopenharmony_ci - Further clarification about usage of yuv layout qualifier 5555bd8deadSopenharmony_ci 5565bd8deadSopenharmony_ci #13 (January 23, 2015, Amit Bansal) 5575bd8deadSopenharmony_ci - added texture built in functions from OES_EGL_image_external_essl3 5585bd8deadSopenharmony_ci - Added explicit clarification in overview section about RGB external images 5595bd8deadSopenharmony_ci - Interaction with geometry & tessellation shaders w.r.t. issue 1 5605bd8deadSopenharmony_ci 5615bd8deadSopenharmony_ci #12 (December 12, 2014, Amit Bansal) 5625bd8deadSopenharmony_ci - Added new yuv qualifiers and corresponding draw time checks 5635bd8deadSopenharmony_ci requirement issues 5645bd8deadSopenharmony_ci - Clarification regarding yuvCscStandardEXT type usage 5655bd8deadSopenharmony_ci - Output clamping requirement issue 5665bd8deadSopenharmony_ci - New YUV_EXT and Y_EXT tokens for ReadPixels 5675bd8deadSopenharmony_ci - Changed blending & color mask behaviour to draw time error. 5685bd8deadSopenharmony_ci - Some language clean up 5695bd8deadSopenharmony_ci 5705bd8deadSopenharmony_ci #11 (September 30, 2014, Amit Bansal) 5715bd8deadSopenharmony_ci - Changed couple of issues to spec language 5725bd8deadSopenharmony_ci - Reworded some issues after recent spec updates 5735bd8deadSopenharmony_ci 5745bd8deadSopenharmony_ci #10 (August 12, 2013, Maurice Ribble) 5755bd8deadSopenharmony_ci - Changed from QCOM to EXT extension 5765bd8deadSopenharmony_ci - Reworded issue 16 based on Mark Callow's suggestion 5775bd8deadSopenharmony_ci - Updated names of SAMPLER_EXTERNAL_2D_Y2Y_EXT, 5785bd8deadSopenharmony_ci __samplerExternal2DY2YEXT, and yuvCscStandardEXT 5795bd8deadSopenharmony_ci 5805bd8deadSopenharmony_ci #9 (August 6, 2013, Maurice Ribble) 5815bd8deadSopenharmony_ci - Added issues 15-18 5825bd8deadSopenharmony_ci 5835bd8deadSopenharmony_ci #8 (July 12, 2013, Maurice Ribble) 5845bd8deadSopenharmony_ci - Some language cleanup 5855bd8deadSopenharmony_ci - Changed some edge case errors to be more consistent 5865bd8deadSopenharmony_ci - Updates based on feedback from other khronos members 5875bd8deadSopenharmony_ci - Added issues 10-14 5885bd8deadSopenharmony_ci 5895bd8deadSopenharmony_ci #7 (June 27, 2013, Maurice Ribble) 5905bd8deadSopenharmony_ci - Some language cleanup 5915bd8deadSopenharmony_ci 5925bd8deadSopenharmony_ci #6 (May 16, 2013, Amit Bansal) 5935bd8deadSopenharmony_ci - Correcting spacing 5945bd8deadSopenharmony_ci - Modified overview to keep only one sampler and add new built-in 5955bd8deadSopenharmony_ci - Defined new types for built in and removed previous layouts 5965bd8deadSopenharmony_ci - Removed the separate GL functions for external attachment 5975bd8deadSopenharmony_ci - Modified description of sections meant for spec 5985bd8deadSopenharmony_ci - Modified issues to reflect layout and built in function update 5995bd8deadSopenharmony_ci - Changed proposed to resolved for finalized issues 6005bd8deadSopenharmony_ci - Move precision issue to the description of built in function 6015bd8deadSopenharmony_ci 6025bd8deadSopenharmony_ci #5 (March 14, 2013, Jing zhou) 6035bd8deadSopenharmony_ci - Minor rewording on same of proposals for the Issues 6045bd8deadSopenharmony_ci - Assign new token IDs from reserved QCOM ID block 6055bd8deadSopenharmony_ci 6065bd8deadSopenharmony_ci #4 (March 4, 2013, Maurice Ribble) 6075bd8deadSopenharmony_ci - First round of cleanup and todos 6085bd8deadSopenharmony_ci 6095bd8deadSopenharmony_ci #3 (February 19, 2013, Amit Bansal) 6105bd8deadSopenharmony_ci - Modified glReadPixels()issue section 6115bd8deadSopenharmony_ci 6125bd8deadSopenharmony_ci #2 (January 9, 2013, Amit Bansal) 6135bd8deadSopenharmony_ci - Changed the OES suffix to QCOM as extension is still pending to be 6145bd8deadSopenharmony_ci approved. 6155bd8deadSopenharmony_ci - Removed EGLImageTargetTexture2DOES from New Procedures and Functions 6165bd8deadSopenharmony_ci category 6175bd8deadSopenharmony_ci - Corrected error in FramebufferRenderbuffer2DExternalQCOM name at line 6185bd8deadSopenharmony_ci 167. 6195bd8deadSopenharmony_ci - Modified description of FramebufferTexture2DExternalQCOM to reflect 6205bd8deadSopenharmony_ci argument changes correctly 6215bd8deadSopenharmony_ci - Corrected typo extension to extension 6225bd8deadSopenharmony_ci - Finished the documentation of final proposal for issue 2 & 3. 6235bd8deadSopenharmony_ci - Added a new Known Quality Issue section and text corresponding to it 6245bd8deadSopenharmony_ci 6255bd8deadSopenharmony_ci #1 - (Oct 1, 2012) Original Draft 626