1Name 2 3 NV_compute_shader_derivatives 4 5Name Strings 6 7 GL_NV_compute_shader_derivatives 8 9Contact 10 11 Pat Brown, NVIDIA (pbrown 'at' nvidia.com) 12 13Contributors 14 15 Ashwin Lele, NVIDIA 16 Jeff Bolz, NVIDIA 17 Michael Chock, NVIDIA 18 19Status 20 21 Shipping 22 23Version 24 25 Last Modified: September 4, 2019 26 Revision: 3 27 28Number 29 30 OpenGL Extension #525 31 OpenGL ES Extension #308 32 33Dependencies 34 35 This extension is written against the OpenGL 4.6 Specification 36 (Compatibility Profile), dated October 24, 2016. 37 38 OpenGL 4.5 or OpenGL ES 3.2 is required. 39 40 This extension interacts with ARB_compute_variable_group_size. 41 42 This extension requires support for the OpenGL Shading Language (GLSL) 43 extension "NV_compute_shader_derivatives", which can be found at the 44 Khronos Group Github site here: 45 46 https://github.com/KhronosGroup/GLSL 47 48Overview 49 50 This extension adds OpenGL and OpenGL ES API support for the OpenGL 51 Shading Language (GLSL) extension "NV_compute_shader_derivatives". 52 53 That extension, when enabled, allows applications to use derivatives in 54 compute shaders. It adds compute shader support for explicit derivative 55 built-in functions like dFdx(), automatic derivative computation in 56 texture lookup functions like texture(), use of the optional LOD bias 57 parameter to adjust the computed level of detail values in texture lookup 58 functions, and the texture level of detail query function 59 textureQueryLod(). 60 61New Procedures and Functions 62 63 None 64 65New Tokens 66 67 None 68 69Modifications to the OpenGL 4.6 Specification (Compatibility Profile) 70 71 None 72 73Modifications to the OpenGL ES 3.2 Specification 74 75 None 76 77Additions to the AGL/GLX/WGL Specifications 78 79 None 80 81Errors 82 83 None 84 85New State 86 87 None 88 89New Implementation Dependent State 90 91 None 92 93Dependencies on ARB_compute_variable_group_size 94 95 If ARB_compute_variable_group_size is supported, the GLSL compiler/linker is 96 unable to enforce the following restrictions: 97 98 * Compute shaders using the "derivative_group_quadsNV" mode must have a 99 local workgroup size whose width and height are both multiples of two. 100 101 * Compute shaders using the "derivative_group_linearNV" mode must have a 102 local workgroup size whose total number of invocations is a multiple of four. 103 104 Instead, we need to enforce this restriction at run time. 105 106 Add the following to the list of errors under the heading of "insert at the 107 end of the first error block, shared between DispatchCompute and 108 DispatchComputeGroupSizeARB, p. 586" in ARB_compute_variable_group_size: 109 110 * An INVALID_VALUE error is generated by DispatchComputeGroupSizeARB if the 111 active program for the compute shader stage has a compute shader using the 112 "derivative_group_quadsNV" layout qualifier and <group_size_x> or 113 <group_size_y> is not a multiple of two. 114 115 * An INVALID_VALUE error is generated by DispatchComputeGroupSizeARB if the 116 active program for the compute shader stage has a compute shader using the 117 "derivative_group_linearNV" layout qualifier and the product of 118 <group_size_x>, <group_size_y>, and <group_size_z> is not a multiple of 119 four. 120 121 Note that as of September 2019, this issue does not apply to SPIR-V compute 122 shaders because SPIR-V does not provide a mechanism to specify variable 123 local group sizes. If this changes in the future, the INVALID_VALUE error 124 above would apply both to GLSL and SPIR-V compute shaders. 125 126 127Issues 128 129 (1) How does this extension interact with ARB_compute_variable_group_size? 130 131 RESOLVED: For compute shaders with fixed group size, the GLSL 132 specification calls for a compile- or link-time error if the local group 133 size is inconsistent with the derivative mode specified using the 134 "derivative_group_quadsNV" or "derivative_group_linearNV" layout 135 qualifiers. However, this sort of error can not be generated if 136 "local_size_variable" is also specified because the local group size is 137 not known until DispatchComputeGroupSizeARB is called. To deal with this, 138 we specify an INVALID_VALUE error if DispatchComputeGroupSizeARB is called 139 with a bad local group size. 140 141Revision History 142 143 Revision 3 (pbrown), 2019/09/04 144 - Add an interaction with ARB_compute_variable_group_size, specifying 145 that INVALID_VALUE is generated by DispatchComputeGroupSizeARB if the 146 derivative mode is inconsistent with the local group size specified in the 147 dispatch command. 148 149 Revision 2 (mchock) 150 - Added OpenGL ES support. 151 152 Revision 1 (pbrown) 153 - Internal revisions. 154