45e7c0c8-2699-4912-b45f-d42bb8384189.json 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "pipeline/cluster-build",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "name": "opaque",
  10. "passes": [
  11. {
  12. "pass": "cluster-build-cs",
  13. "program": "pipeline/cluster-build|cluster-main"
  14. }
  15. ]
  16. }
  17. ],
  18. "shaders": [
  19. {
  20. "blocks": [],
  21. "samplerTextures": [],
  22. "samplers": [],
  23. "textures": [],
  24. "buffers": [],
  25. "images": [],
  26. "subpassInputs": [],
  27. "attributes": [],
  28. "varyings": [],
  29. "fragColors": [],
  30. "descriptors": [
  31. {
  32. "rate": 0,
  33. "blocks": [],
  34. "samplerTextures": [],
  35. "samplers": [],
  36. "textures": [],
  37. "buffers": [],
  38. "images": [],
  39. "subpassInputs": []
  40. },
  41. {
  42. "rate": 1,
  43. "blocks": [],
  44. "samplerTextures": [],
  45. "samplers": [],
  46. "textures": [],
  47. "buffers": [],
  48. "images": [],
  49. "subpassInputs": []
  50. },
  51. {
  52. "rate": 2,
  53. "blocks": [],
  54. "samplerTextures": [],
  55. "samplers": [],
  56. "textures": [],
  57. "buffers": [],
  58. "images": [],
  59. "subpassInputs": []
  60. },
  61. {
  62. "rate": 3,
  63. "blocks": [
  64. {
  65. "tags": {},
  66. "name": "CCConst",
  67. "members": [
  68. {
  69. "name": "cc_nearFar",
  70. "typename": "vec4",
  71. "type": 16,
  72. "count": 1
  73. },
  74. {
  75. "name": "cc_viewPort",
  76. "typename": "vec4",
  77. "type": 16,
  78. "count": 1
  79. },
  80. {
  81. "name": "cc_workGroup",
  82. "typename": "vec4",
  83. "type": 16,
  84. "count": 1
  85. },
  86. {
  87. "name": "cc_matView",
  88. "typename": "mat4",
  89. "type": 25,
  90. "count": 1
  91. },
  92. {
  93. "name": "cc_matProjInv",
  94. "typename": "mat4",
  95. "type": 25,
  96. "count": 1
  97. }
  98. ],
  99. "defines": [],
  100. "stageFlags": 32,
  101. "rate": 3
  102. }
  103. ],
  104. "samplerTextures": [],
  105. "samplers": [],
  106. "textures": [],
  107. "buffers": [
  108. {
  109. "name": "b_clustersBuffer",
  110. "memoryAccess": 3,
  111. "defines": [],
  112. "stageFlags": 32,
  113. "binding": 0
  114. }
  115. ],
  116. "images": [],
  117. "subpassInputs": []
  118. }
  119. ],
  120. "hash": 2050688826,
  121. "glsl4": {
  122. "compute": "\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nprecision highp float;\n#define LOCAL_SIZE_X 16u\n#define LOCAL_SIZE_Y 8u\n#define LOCAL_SIZE_Z 1u\nlayout (local_size_x = LOCAL_SIZE_X, local_size_y = LOCAL_SIZE_Y, local_size_z = LOCAL_SIZE_Z) in;\nlayout(std140) uniform CCConst {\n vec4 cc_nearFar;\n vec4 cc_viewPort;\n vec4 cc_workGroup;\n mat4 cc_matView;\n mat4 cc_matProjInv;\n};\nlayout(std430, set = 1, binding = 0) buffer b_clustersBuffer { vec4 b_clusters[]; };\nvec4 screen2Eye(vec4 coord) {\n vec3 ndc = vec3(\n 2.0 * (coord.x - cc_viewPort.x) / cc_viewPort.z - 1.0,\n 2.0 * (coord.y - cc_viewPort.y) / cc_viewPort.w - 1.0,\n 2.0 * coord.z - 1.0);\n CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(ndc.y);\n vec4 eye = ((cc_matProjInv) * (vec4(ndc, 1.0)));\n eye = eye / eye.w;\n return eye;\n}\nvoid main () {\n uint clusterIndex = gl_GlobalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y +\n gl_GlobalInvocationID.y * gl_WorkGroupSize.x +\n gl_GlobalInvocationID.x;\n float clusterSizeX = ceil(cc_viewPort.z / cc_workGroup.x);\n float clusterSizeY = ceil(cc_viewPort.w / cc_workGroup.y);\n vec4 minScreen = vec4(vec2(gl_GlobalInvocationID.xy) * vec2(clusterSizeX, clusterSizeY), 1.0, 1.0);\n vec4 maxScreen = vec4(vec2(gl_GlobalInvocationID.xy + uvec2(1, 1)) * vec2(clusterSizeX, clusterSizeY), 1.0, 1.0);\n vec3 minEye = screen2Eye(minScreen).xyz;\n vec3 maxEye = screen2Eye(maxScreen).xyz;\n float clusterNear = -cc_nearFar.x * pow(cc_nearFar.y / cc_nearFar.x, float(gl_GlobalInvocationID.z) / cc_workGroup.z);\n float clusterFar = -cc_nearFar.x * pow(cc_nearFar.y / cc_nearFar.x, float(gl_GlobalInvocationID.z + 1u) / cc_workGroup.z);\n vec3 minNear = minEye * clusterNear / minEye.z;\n vec3 minFar = minEye * clusterFar / minEye.z;\n vec3 maxNear = maxEye * clusterNear / maxEye.z;\n vec3 maxFar = maxEye * clusterFar / maxEye.z;\n vec3 minBounds = min(min(minNear, minFar), min(maxNear, maxFar));\n vec3 maxBounds = max(max(minNear, minFar), max(maxNear, maxFar));\n b_clusters[2u * clusterIndex + 0u] = vec4(minBounds, 1.0);\n b_clusters[2u * clusterIndex + 1u] = vec4(maxBounds, 1.0);\n}"
  123. },
  124. "glsl3": {
  125. "compute": "\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nprecision highp float;\n#define LOCAL_SIZE_X 16u\n#define LOCAL_SIZE_Y 8u\n#define LOCAL_SIZE_Z 1u\nlayout (local_size_x = LOCAL_SIZE_X, local_size_y = LOCAL_SIZE_Y, local_size_z = LOCAL_SIZE_Z) in;\nlayout(std140) uniform CCConst {\n vec4 cc_nearFar;\n vec4 cc_viewPort;\n vec4 cc_workGroup;\n mat4 cc_matView;\n mat4 cc_matProjInv;\n};\nlayout(std430) buffer b_clustersBuffer { vec4 b_clusters[]; };\nvec4 screen2Eye(vec4 coord) {\n vec3 ndc = vec3(\n 2.0 * (coord.x - cc_viewPort.x) / cc_viewPort.z - 1.0,\n 2.0 * (coord.y - cc_viewPort.y) / cc_viewPort.w - 1.0,\n 2.0 * coord.z - 1.0);\n CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(ndc.y);\n vec4 eye = ((cc_matProjInv) * (vec4(ndc, 1.0)));\n eye = eye / eye.w;\n return eye;\n}\nvoid main () {\n uint clusterIndex = gl_GlobalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y +\n gl_GlobalInvocationID.y * gl_WorkGroupSize.x +\n gl_GlobalInvocationID.x;\n float clusterSizeX = ceil(cc_viewPort.z / cc_workGroup.x);\n float clusterSizeY = ceil(cc_viewPort.w / cc_workGroup.y);\n vec4 minScreen = vec4(vec2(gl_GlobalInvocationID.xy) * vec2(clusterSizeX, clusterSizeY), 1.0, 1.0);\n vec4 maxScreen = vec4(vec2(gl_GlobalInvocationID.xy + uvec2(1, 1)) * vec2(clusterSizeX, clusterSizeY), 1.0, 1.0);\n vec3 minEye = screen2Eye(minScreen).xyz;\n vec3 maxEye = screen2Eye(maxScreen).xyz;\n float clusterNear = -cc_nearFar.x * pow(cc_nearFar.y / cc_nearFar.x, float(gl_GlobalInvocationID.z) / cc_workGroup.z);\n float clusterFar = -cc_nearFar.x * pow(cc_nearFar.y / cc_nearFar.x, float(gl_GlobalInvocationID.z + 1u) / cc_workGroup.z);\n vec3 minNear = minEye * clusterNear / minEye.z;\n vec3 minFar = minEye * clusterFar / minEye.z;\n vec3 maxNear = maxEye * clusterNear / maxEye.z;\n vec3 maxFar = maxEye * clusterFar / maxEye.z;\n vec3 minBounds = min(min(minNear, minFar), min(maxNear, maxFar));\n vec3 maxBounds = max(max(minNear, minFar), max(maxNear, maxFar));\n b_clusters[2u * clusterIndex + 0u] = vec4(minBounds, 1.0);\n b_clusters[2u * clusterIndex + 1u] = vec4(maxBounds, 1.0);\n}"
  126. },
  127. "glsl1": {
  128. "compute": ""
  129. },
  130. "builtins": {
  131. "globals": {
  132. "blocks": [
  133. {
  134. "name": "CCConst",
  135. "defines": []
  136. }
  137. ],
  138. "samplerTextures": [],
  139. "buffers": [],
  140. "images": []
  141. },
  142. "locals": {
  143. "blocks": [],
  144. "samplerTextures": [],
  145. "buffers": [],
  146. "images": []
  147. },
  148. "statistics": {
  149. "CC_EFFECT_USED_COMPUTE_UNIFORM_VECTORS": 11
  150. }
  151. },
  152. "defines": [],
  153. "name": "pipeline/cluster-build|cluster-main"
  154. }
  155. ],
  156. "combinations": [],
  157. "hideInEditor": false
  158. }