Name
NV_compute_shader_derivatives
Name Strings
GL_NV_compute_shader_derivatives
Contact
Pat Brown, NVIDIA (pbrown 'at' nvidia.com)
Contributors
Ashwin Lele, NVIDIA
Jeff Bolz, NVIDIA
Michael Chock, NVIDIA
Status
Shipping
Version
Last Modified: September 4, 2019
Revision: 3
Number
OpenGL Extension #525
OpenGL ES Extension #308
Dependencies
This extension is written against the OpenGL 4.6 Specification
(Compatibility Profile), dated October 24, 2016.
OpenGL 4.5 or OpenGL ES 3.2 is required.
This extension interacts with ARB_compute_variable_group_size.
This extension requires support for the OpenGL Shading Language (GLSL)
extension "NV_compute_shader_derivatives", which can be found at the
Khronos Group Github site here:
https://github.com/KhronosGroup/GLSL
Overview
This extension adds OpenGL and OpenGL ES API support for the OpenGL
Shading Language (GLSL) extension "NV_compute_shader_derivatives".
That extension, when enabled, allows applications to use derivatives in
compute shaders. It adds compute shader support for explicit derivative
built-in functions like dFdx(), automatic derivative computation in
texture lookup functions like texture(), use of the optional LOD bias
parameter to adjust the computed level of detail values in texture lookup
functions, and the texture level of detail query function
textureQueryLod().
New Procedures and Functions
None
New Tokens
None
Modifications to the OpenGL 4.6 Specification (Compatibility Profile)
None
Modifications to the OpenGL ES 3.2 Specification
None
Additions to the AGL/GLX/WGL Specifications
None
Errors
None
New State
None
New Implementation Dependent State
None
Dependencies on ARB_compute_variable_group_size
If ARB_compute_variable_group_size is supported, the GLSL compiler/linker is
unable to enforce the following restrictions:
* Compute shaders using the "derivative_group_quadsNV" mode must have a
local workgroup size whose width and height are both multiples of two.
* Compute shaders using the "derivative_group_linearNV" mode must have a
local workgroup size whose total number of invocations is a multiple of four.
Instead, we need to enforce this restriction at run time.
Add the following to the list of errors under the heading of "insert at the
end of the first error block, shared between DispatchCompute and
DispatchComputeGroupSizeARB, p. 586" in ARB_compute_variable_group_size:
* An INVALID_VALUE error is generated by DispatchComputeGroupSizeARB if the
active program for the compute shader stage has a compute shader using the
"derivative_group_quadsNV" layout qualifier and or
is not a multiple of two.
* An INVALID_VALUE error is generated by DispatchComputeGroupSizeARB if the
active program for the compute shader stage has a compute shader using the
"derivative_group_linearNV" layout qualifier and the product of
, , and is not a multiple of
four.
Note that as of September 2019, this issue does not apply to SPIR-V compute
shaders because SPIR-V does not provide a mechanism to specify variable
local group sizes. If this changes in the future, the INVALID_VALUE error
above would apply both to GLSL and SPIR-V compute shaders.
Issues
(1) How does this extension interact with ARB_compute_variable_group_size?
RESOLVED: For compute shaders with fixed group size, the GLSL
specification calls for a compile- or link-time error if the local group
size is inconsistent with the derivative mode specified using the
"derivative_group_quadsNV" or "derivative_group_linearNV" layout
qualifiers. However, this sort of error can not be generated if
"local_size_variable" is also specified because the local group size is
not known until DispatchComputeGroupSizeARB is called. To deal with this,
we specify an INVALID_VALUE error if DispatchComputeGroupSizeARB is called
with a bad local group size.
Revision History
Revision 3 (pbrown), 2019/09/04
- Add an interaction with ARB_compute_variable_group_size, specifying
that INVALID_VALUE is generated by DispatchComputeGroupSizeARB if the
derivative mode is inconsistent with the local group size specified in the
dispatch command.
Revision 2 (mchock)
- Added OpenGL ES support.
Revision 1 (pbrown)
- Internal revisions.