Merge pull request #298 from nvpbrown/derivs-variable-group-size
Add spec language for compute derivatives with variable group sizes.
diff --git a/extensions/NV/NV_compute_shader_derivatives.txt b/extensions/NV/NV_compute_shader_derivatives.txt
index 4bc891b..bdd9f6c 100644
--- a/extensions/NV/NV_compute_shader_derivatives.txt
+++ b/extensions/NV/NV_compute_shader_derivatives.txt
@@ -22,8 +22,8 @@
Version
- Last Modified: November 9, 2018
- Revision: 2
+ Last Modified: September 4, 2019
+ Revision: 3
Number
@@ -37,6 +37,8 @@
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:
@@ -88,12 +90,62 @@
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 <group_size_x> or
+ <group_size_y> 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
+ <group_size_x>, <group_size_y>, and <group_size_z> 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
- None, but please refer to issues in the GLSL extension specification.
+ (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.