lm_common_inc.glsl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* SET 0, static data that does not change between any call */
  2. layout(set = 0, binding = 0) uniform BakeParameters {
  3. vec3 world_size;
  4. float bias;
  5. vec3 to_cell_offset;
  6. int grid_size;
  7. vec3 to_cell_size;
  8. uint light_count;
  9. mat3x4 env_transform;
  10. ivec2 atlas_size;
  11. float exposure_normalization;
  12. uint bounces;
  13. float bounce_indirect_energy;
  14. }
  15. bake_params;
  16. struct Vertex {
  17. vec3 position;
  18. float normal_z;
  19. vec2 uv;
  20. vec2 normal_xy;
  21. };
  22. layout(set = 0, binding = 1, std430) restrict readonly buffer Vertices {
  23. Vertex data[];
  24. }
  25. vertices;
  26. struct Triangle {
  27. uvec3 indices;
  28. uint slice;
  29. vec3 min_bounds;
  30. uint pad0;
  31. vec3 max_bounds;
  32. uint pad1;
  33. };
  34. struct ClusterAABB {
  35. vec3 min_bounds;
  36. uint pad0;
  37. vec3 max_bounds;
  38. uint pad1;
  39. };
  40. layout(set = 0, binding = 2, std430) restrict readonly buffer Triangles {
  41. Triangle data[];
  42. }
  43. triangles;
  44. layout(set = 0, binding = 3, std430) restrict readonly buffer TriangleIndices {
  45. uint data[];
  46. }
  47. triangle_indices;
  48. #define LIGHT_TYPE_DIRECTIONAL 0
  49. #define LIGHT_TYPE_OMNI 1
  50. #define LIGHT_TYPE_SPOT 2
  51. struct Light {
  52. vec3 position;
  53. uint type;
  54. vec3 direction;
  55. float energy;
  56. vec3 color;
  57. float size;
  58. float range;
  59. float attenuation;
  60. float cos_spot_angle;
  61. float inv_spot_attenuation;
  62. float indirect_energy;
  63. float shadow_blur;
  64. bool static_bake;
  65. uint pad;
  66. };
  67. layout(set = 0, binding = 4, std430) restrict readonly buffer Lights {
  68. Light data[];
  69. }
  70. lights;
  71. struct Seam {
  72. uvec2 a;
  73. uvec2 b;
  74. };
  75. layout(set = 0, binding = 5, std430) restrict readonly buffer Seams {
  76. Seam data[];
  77. }
  78. seams;
  79. layout(set = 0, binding = 6, std430) restrict readonly buffer Probes {
  80. vec4 data[];
  81. }
  82. probe_positions;
  83. layout(set = 0, binding = 7) uniform utexture3D grid;
  84. layout(set = 0, binding = 8) uniform texture2DArray albedo_tex;
  85. layout(set = 0, binding = 9) uniform texture2DArray emission_tex;
  86. layout(set = 0, binding = 10) uniform sampler linear_sampler;
  87. layout(set = 0, binding = 11, std430) restrict readonly buffer ClusterIndices {
  88. uint data[];
  89. }
  90. cluster_indices;
  91. layout(set = 0, binding = 12, std430) restrict readonly buffer ClusterAABBs {
  92. ClusterAABB data[];
  93. }
  94. cluster_aabbs;
  95. // Fragment action constants
  96. const uint FA_NONE = 0;
  97. const uint FA_SMOOTHEN_POSITION = 1;