LfUpdateIndirectInfo.comp.glsl 877 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (C) 2009-2017, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include "shaders/Common.glsl"
  6. layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
  7. struct DrawArraysIndirectInfo
  8. {
  9. uint count;
  10. uint instanceCount;
  11. uint first;
  12. uint baseInstance;
  13. };
  14. layout(ANKI_SS_BINDING(0, 0), std430) buffer ss0_
  15. {
  16. uint u_queryResults[];
  17. };
  18. layout(ANKI_SS_BINDING(0, 1), std430) buffer ss1_
  19. {
  20. DrawArraysIndirectInfo u_indirectInfo[];
  21. };
  22. void main()
  23. {
  24. if(u_queryResults[gl_WorkGroupID.x] == 0)
  25. {
  26. u_indirectInfo[gl_WorkGroupID.x].count = 0;
  27. }
  28. else
  29. {
  30. u_indirectInfo[gl_WorkGroupID.x].count = 4;
  31. }
  32. u_indirectInfo[gl_WorkGroupID.x].instanceCount = 1;
  33. u_indirectInfo[gl_WorkGroupID.x].first = 0;
  34. u_indirectInfo[gl_WorkGroupID.x].baseInstance = 0;
  35. }