1Name 2 3 EXT_texture_shadow_lod 4 5Name Strings 6 7 GL_EXT_texture_shadow_lod 8 9Contact 10 11 Billy Clack, NVIDIA Corporation (bclack 'at' nvidia.com) 12 13Contributors 14 15 Ashwin Lele, NVIDIA Corporation 16 Daniel Koch, NVIDIA Corporation 17 Graeme Leese, Broadcom Corporation 18 Pyarelal Knowles, NVIDIA Corporation 19 Sagar Ghuge, Intel Corporation 20 Mark Janes, Intel Corporation 21 22Status 23 24 Complete. 25 26Version 27 28 Last Modified Date: June 3, 2019 29 Revision: 2 30 31Number 32 33 OpenGL Extension #539 34 OpenGL ES Extension #320 35 36Dependencies 37 38 OpenGL 2.0 or OpenGL ES 3.0 is required. 39 40 This extension is written against the OpenGL Shading Language 41 Specification, version 4.60.5 dated July 14, 2018. 42 43 The same shading language modifications should also be applied to the 44 OpenGL ES Shading Language Specification, version 3.20.4 under the 45 corresponding sections. 46 47 This extension interacts with ARB_texture_cube_map_array and OpenGL 4.0. 48 49 This extension interacts with OES_texture_cube_map_array and OpenGL ES 3.2. 50 51 This extension interacts with EXT_texture_cube_map_array and OpenGL ES 3.2. 52 53 This extension requires EXT_gpu_shader4 or equivalent functionality. 54 55Overview 56 57 This extension adds support for various shadow sampler types with texture 58 functions having interactions with the LOD of texture lookups. Modern 59 shading languages support LOD queries for shadow sampler types, but until 60 now the OpenGL Shading Language Specification has excluded multiple texture 61 function overloads involving LOD calculations with various shadow samplers. 62 Shading languages for other APIs do support the equivalent LOD-based 63 texture sampling functions for these types which has made porting between 64 those shading languages to GLSL cumbersome and has required the usage of 65 sub-optimal workarounds. 66 67New Procedures and Functions 68 69 None 70 71New Tokens 72 73 None 74 75Modification to the OpenGL Shading Language Specification, Version 4.60.5 76 77 Including the following line in a shader can be used to control 78 the language features described in this extension: 79 80 #extension GL_EXT_texture_shadow_lod : <behavior> 81 82 where <behavior> is specified in section 3.3. 83 84 New preprocessor #defines are added to the OpenGL Shading Language: 85 86 #define GL_EXT_texture_shadow_lod 1 87 88 89 Add to section 8.9.2 "Texel Lookup Functions" (p. 170): 90 91 (Add variants of the texture lookup functions with supplied bias p. 170) 92 93 float texture(sampler2DArrayShadow sampler, vec4 P [, float bias]) 94 float texture(samplerCubeArrayShadow sampler, vec4 P, float compare [, float bias]) 95 96 97 (Add variant of the texture lookup function with supplied offset and optional supplied bias p. 170) 98 99 float textureOffset(sampler2DArrayShadow sampler, vec4 P, ivec2 offset [, float bias]) 100 101 102 (Add new functions to the set of allowed texture LOD lookup functions p. 170) 103 104 float textureLod(sampler2DArrayShadow sampler, vec4 P, float lod) 105 float textureLod(samplerCubeShadow sampler, vec4 P, float lod) 106 float textureLod(samplerCubeArrayShadow sampler, vec4 P, float compare, float lod) 107 float textureLodOffset(sampler2DArrayShadow sampler, vec4 P, float lod, ivec2 offset) 108 109Dependencies on ARB_texture_cube_map_array and OpenGL 4.0 110 111 If neither ARB_texture_cube_map_array nor OpenGL 4.0 are supported for 112 OpenGL contexts, ignore references to samplerCubeArrayShadow. 113 114Dependencies on OES_texture_cube_map_array, EXT_texture_cube_map_array and OpenGL ES 3.2 115 116 If neither OES_texture_cube_map_array, EXT_texture_cube_map_array, nor OpenGL ES 3.2 are supported for 117 OpenGL ES contexts, ignore references to samplerCubeArrayShadow. 118 119Issues 120 121 (1) Are there any other texture function and sampler combinations that are 122 missing from the specifications that might be valid combinations? 123 124 RESOLVED: Yes, as of GLSL 4.60.5 and ESSL 3.20.4, there are other 125 missing texture functions and sampler combinations that might be valid 126 but this extension does not add support for. 127 128 There is no support for Cube samplers and textureOffset family of 129 functions, and no support for Array samplers with textureProj family 130 of functions. This extension does not add support for these functions 131 since they are 1) not related to shadow samplers and thus outside the 132 scope of this extension, 2) not yet clear if these combinations should 133 be supported at all, and 3) if support should be added then each 134 family of missing functions is deserving of its own extension. 135 136 textureGrad() is missing support for samplerCubeArrayShadow in both 137 the GLSL and ESSL specifications, and is also missing support for 138 gsampler2DArray variants only in the ESSL specification. The 139 samplerCubeArrayShadow variant is not included in this extension 140 because not all vendors can easily support the additional parameter 141 beyond the gradients. The missing gsampler2DArray variants in ESSL 142 are not added because they are unrelated to shadow types and thus 143 outside the scope of this extension. 144 145 (2) The GLSL specification already contains a definition for 146 textureOffset() with sampler2DArrayShadow; does this mean only the optional 147 bias variant of this function is needed? 148 149 RESOLVED: Yes for GLSL, but the ESSL specification does 150 not have either the non-bias or bias variants of this function so both 151 variants should be defined according to this extension. 152 153Revision History 154 155 Revision 2 156 - Minor correction on contributor name. 157 158 Revision 1 159 - Initial version. 160 161 162