glsl.450.subgroup.tese 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. #version 450
  2. vec4 undeclared_errors(vec4 f4)
  3. {
  4. vec4 result;
  5. gl_SubgroupSize; // ERROR, extension not enabled (basic)
  6. gl_SubgroupInvocationID; // ERROR, extension not enabled (basic)
  7. subgroupBarrier(); // ERROR, extension not enabled (basic)
  8. subgroupMemoryBarrier(); // ERROR, extension not enabled (basic)
  9. subgroupMemoryBarrierBuffer(); // ERROR, extension not enabled (basic)
  10. subgroupMemoryBarrierImage(); // ERROR, extension not enabled (basic)
  11. subgroupElect(); // ERROR, extension not enabled (basic)
  12. gl_NumSubgroups; // ERROR, only defined in compute
  13. gl_SubgroupID; // ERROR, only defined in compute
  14. subgroupMemoryBarrierShared(); // ERROR, only defined in compute
  15. subgroupAll(true); // ERROR extension not enabled (vote)
  16. subgroupAny(false); // ERROR extension not enabled (vote)
  17. subgroupAllEqual(f4); // ERROR extension not enabled (vote)
  18. gl_SubgroupEqMask; // ERROR extension not enabled (ballot)
  19. gl_SubgroupGeMask; // ERROR extension not enabled (ballot)
  20. gl_SubgroupGtMask; // ERROR extension not enabled (ballot)
  21. gl_SubgroupLeMask; // ERROR extension not enabled (ballot)
  22. gl_SubgroupLtMask; // ERROR extension not enabled (ballot)
  23. subgroupBroadcast(f4, 0); // ERROR extension not enabled (ballot)
  24. subgroupBroadcastFirst(f4); // ERROR extension not enabled (ballot)
  25. uvec4 ballot = subgroupBallot(false); // ERROR extension not enabled (ballot)
  26. subgroupInverseBallot(uvec4(0x1)); // ERROR extension not enabled (ballot)
  27. subgroupBallotBitExtract(ballot, 0); // ERROR extension not enabled (ballot)
  28. subgroupBallotBitCount(ballot); // ERROR extension not enabled (ballot)
  29. subgroupBallotInclusiveBitCount(ballot); // ERROR extension not enabled (ballot)
  30. subgroupBallotExclusiveBitCount(ballot); // ERROR extension not enabled (ballot)
  31. subgroupBallotFindLSB(ballot); // ERROR extension not enabled (ballot)
  32. subgroupBallotFindMSB(ballot); // ERROR extension not enabled (ballot)
  33. subgroupShuffle(f4, 0); // ERROR extension not enabled (shuffle)
  34. subgroupShuffleXor(f4, 0x1); // ERROR extension not enabled (shuffle)
  35. subgroupShuffleUp(f4, 1); // ERROR extension not enabled (shuffle_relative)
  36. subgroupShuffleDown(f4, 1); // ERROR extension not enabled (shuffle_relative)
  37. result = subgroupAdd(f4); // ERROR, extension not enabled (arith)
  38. subgroupMul(f4); // ERROR, extension not enabled (arith)
  39. subgroupMin(f4); // ERROR, extension not enabled (arith)
  40. subgroupMax(f4); // ERROR, extension not enabled (arith)
  41. subgroupAnd(ballot); // ERROR, extension not enabled (arith)
  42. subgroupOr(ballot); // ERROR, extension not enabled (arith)
  43. subgroupXor(ballot); // ERROR, extension not enabled (arith)
  44. subgroupInclusiveAdd(f4); // ERROR, extension not enabled (arith)
  45. subgroupInclusiveMul(f4); // ERROR, extension not enabled (arith)
  46. subgroupInclusiveMin(f4); // ERROR, extension not enabled (arith)
  47. subgroupInclusiveMax(f4); // ERROR, extension not enabled (arith)
  48. subgroupInclusiveAnd(ballot); // ERROR, extension not enabled (arith)
  49. subgroupInclusiveOr(ballot); // ERROR, extension not enabled (arith)
  50. subgroupInclusiveXor(ballot); // ERROR, extension not enabled (arith)
  51. subgroupExclusiveAdd(f4); // ERROR, extension not enabled (arith)
  52. subgroupExclusiveMul(f4); // ERROR, extension not enabled (arith)
  53. subgroupExclusiveMin(f4); // ERROR, extension not enabled (arith)
  54. subgroupExclusiveMax(f4); // ERROR, extension not enabled (arith)
  55. subgroupExclusiveAnd(ballot); // ERROR, extension not enabled (arith)
  56. subgroupExclusiveOr(ballot); // ERROR, extension not enabled (arith)
  57. subgroupExclusiveXor(ballot); // ERROR, extension not enabled (arith)
  58. subgroupClusteredAdd(f4, 2); // ERROR, extension not enabled (clustered)
  59. subgroupClusteredMul(f4, 2); // ERROR, extension not enabled (clustered)
  60. subgroupClusteredMin(f4, 2); // ERROR, extension not enabled (clustered)
  61. subgroupClusteredMax(f4, 2); // ERROR, extension not enabled (clustered)
  62. subgroupClusteredAnd(ballot, 2); // ERROR, extension not enabled (clustered)
  63. subgroupClusteredOr(ballot, 2); // ERROR, extension not enabled (clustered)
  64. subgroupClusteredXor(ballot, 2); // ERROR, extension not enabled (clustered)
  65. subgroupQuadBroadcast(f4, 0); // ERROR, extension not enabled (quad)
  66. subgroupQuadSwapHorizontal(f4); // ERROR, extension not enabled (quad)
  67. subgroupQuadSwapVertical(f4); // ERROR, extension not enabled (quad)
  68. subgroupQuadSwapDiagonal(f4); // ERROR, extension not enabled (quad)
  69. uvec4 parti = subgroupPartitionNV(f4); // ERROR, extension not enabled (partitioned)
  70. subgroupPartitionedAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
  71. subgroupPartitionedMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
  72. subgroupPartitionedMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
  73. subgroupPartitionedMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
  74. subgroupPartitionedAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  75. subgroupPartitionedOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  76. subgroupPartitionedXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  77. subgroupPartitionedInclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
  78. subgroupPartitionedInclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
  79. subgroupPartitionedInclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
  80. subgroupPartitionedInclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
  81. subgroupPartitionedInclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  82. subgroupPartitionedInclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  83. subgroupPartitionedInclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  84. subgroupPartitionedExclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
  85. subgroupPartitionedExclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
  86. subgroupPartitionedExclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
  87. subgroupPartitionedExclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
  88. subgroupPartitionedExclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  89. subgroupPartitionedExclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  90. subgroupPartitionedExclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
  91. return result;
  92. }
  93. #extension GL_KHR_shader_subgroup_basic: enable
  94. layout(isolines) in;
  95. layout(set = 0, binding = 0, std430) buffer Output
  96. {
  97. uvec4 result[];
  98. };
  99. void main (void)
  100. {
  101. result[gl_PrimitiveID] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0);
  102. subgroupBarrier();
  103. subgroupMemoryBarrier();
  104. subgroupMemoryBarrierBuffer();
  105. subgroupMemoryBarrierImage();
  106. subgroupElect();
  107. }
  108. #extension GL_KHR_shader_subgroup_ballot: enable
  109. void ballot_works(vec4 f4) {
  110. gl_SubgroupEqMask;
  111. gl_SubgroupGeMask;
  112. gl_SubgroupGtMask;
  113. gl_SubgroupLeMask;
  114. gl_SubgroupLtMask;
  115. subgroupBroadcast(f4, 0);
  116. subgroupBroadcastFirst(f4);
  117. uvec4 ballot = subgroupBallot(false);
  118. subgroupInverseBallot(uvec4(0x1));
  119. subgroupBallotBitExtract(ballot, 0);
  120. subgroupBallotBitCount(ballot);
  121. subgroupBallotInclusiveBitCount(ballot);
  122. subgroupBallotExclusiveBitCount(ballot);
  123. subgroupBallotFindLSB(ballot);
  124. subgroupBallotFindMSB(ballot);
  125. }
  126. #extension GL_KHR_shader_subgroup_vote: enable
  127. void vote_works(vec4 f4)
  128. {
  129. subgroupAll(true);
  130. subgroupAny(false);
  131. subgroupAllEqual(f4);
  132. }
  133. #extension GL_KHR_shader_subgroup_shuffle: enable
  134. #extension GL_KHR_shader_subgroup_shuffle_relative: enable
  135. void shuffle_works(vec4 f4)
  136. {
  137. subgroupShuffle(f4, 0);
  138. subgroupShuffleXor(f4, 0x1);
  139. subgroupShuffleUp(f4, 1);
  140. subgroupShuffleDown(f4, 1);
  141. }
  142. #extension GL_KHR_shader_subgroup_arithmetic: enable
  143. void arith_works(vec4 f4)
  144. {
  145. uvec4 ballot;
  146. subgroupAdd(f4);
  147. subgroupMul(f4);
  148. subgroupMin(f4);
  149. subgroupMax(f4);
  150. subgroupAnd(ballot);
  151. subgroupOr(ballot);
  152. subgroupXor(ballot);
  153. subgroupInclusiveAdd(f4);
  154. subgroupInclusiveMul(f4);
  155. subgroupInclusiveMin(f4);
  156. subgroupInclusiveMax(f4);
  157. subgroupInclusiveAnd(ballot);
  158. subgroupInclusiveOr(ballot);
  159. subgroupInclusiveXor(ballot);
  160. subgroupExclusiveAdd(f4);
  161. subgroupExclusiveMul(f4);
  162. subgroupExclusiveMin(f4);
  163. subgroupExclusiveMax(f4);
  164. subgroupExclusiveAnd(ballot);
  165. subgroupExclusiveOr(ballot);
  166. subgroupExclusiveXor(ballot);
  167. }
  168. #extension GL_KHR_shader_subgroup_clustered: enable
  169. void clustered_works(vec4 f4)
  170. {
  171. uvec4 ballot = uvec4(0x55,0,0,0);
  172. subgroupClusteredAdd(f4, 2);
  173. subgroupClusteredMul(f4, 2);
  174. subgroupClusteredMin(f4, 2);
  175. subgroupClusteredMax(f4, 2);
  176. subgroupClusteredAnd(ballot, 2);
  177. subgroupClusteredOr(ballot, 2);
  178. subgroupClusteredXor(ballot, 2);
  179. }
  180. #extension GL_KHR_shader_subgroup_quad: enable
  181. void quad_works(vec4 f4)
  182. {
  183. subgroupQuadBroadcast(f4, 0);
  184. subgroupQuadSwapHorizontal(f4);
  185. subgroupQuadSwapVertical(f4);
  186. subgroupQuadSwapDiagonal(f4);
  187. }
  188. #extension GL_NV_shader_subgroup_partitioned: enable
  189. void partitioned_works(vec4 f4)
  190. {
  191. uvec4 parti = subgroupPartitionNV(f4);
  192. uvec4 ballot = uvec4(0x55,0,0,0);
  193. subgroupPartitionedAddNV(f4, parti);
  194. subgroupPartitionedMulNV(f4, parti);
  195. subgroupPartitionedMinNV(f4, parti);
  196. subgroupPartitionedMaxNV(f4, parti);
  197. subgroupPartitionedAndNV(ballot, parti);
  198. subgroupPartitionedOrNV(ballot, parti);
  199. subgroupPartitionedXorNV(ballot, parti);
  200. subgroupPartitionedInclusiveAddNV(f4, parti);
  201. subgroupPartitionedInclusiveMulNV(f4, parti);
  202. subgroupPartitionedInclusiveMinNV(f4, parti);
  203. subgroupPartitionedInclusiveMaxNV(f4, parti);
  204. subgroupPartitionedInclusiveAndNV(ballot, parti);
  205. subgroupPartitionedInclusiveOrNV(ballot, parti);
  206. subgroupPartitionedInclusiveXorNV(ballot, parti);
  207. subgroupPartitionedExclusiveAddNV(f4, parti);
  208. subgroupPartitionedExclusiveMulNV(f4, parti);
  209. subgroupPartitionedExclusiveMinNV(f4, parti);
  210. subgroupPartitionedExclusiveMaxNV(f4, parti);
  211. subgroupPartitionedExclusiveAndNV(ballot, parti);
  212. subgroupPartitionedExclusiveOrNV(ballot, parti);
  213. subgroupPartitionedExclusiveXorNV(ballot, parti);
  214. }
  215. // tests for NV_shader_sm_builtins
  216. void sm_builtins_err()
  217. {
  218. gl_WarpsPerSMNV; // ERROR, no extension
  219. gl_SMCountNV; // ERROR, no extension
  220. gl_WarpIDNV; // ERROR, no extension
  221. gl_SMIDNV; // ERROR, no extension
  222. }
  223. #ifdef GL_NV_shader_sm_builtins
  224. #extension GL_NV_shader_sm_builtins : enable
  225. #endif
  226. void sm_builtins()
  227. {
  228. gl_WarpsPerSMNV;
  229. gl_SMCountNV;
  230. gl_WarpIDNV;
  231. gl_SMIDNV;
  232. }