lm_common_inc.glsl 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* SET 0, static data that does not change between any call */
  2. struct Vertex {
  3. vec3 position;
  4. float normal_z;
  5. vec2 uv;
  6. vec2 normal_xy;
  7. };
  8. layout(set = 0, binding = 1, std430) restrict readonly buffer Vertices {
  9. Vertex data[];
  10. }
  11. vertices;
  12. struct Triangle {
  13. uvec3 indices;
  14. uint slice;
  15. vec3 min_bounds;
  16. uint pad0;
  17. vec3 max_bounds;
  18. uint pad1;
  19. };
  20. layout(set = 0, binding = 2, std430) restrict readonly buffer Triangles {
  21. Triangle data[];
  22. }
  23. triangles;
  24. layout(set = 0, binding = 3, std430) restrict readonly buffer GridIndices {
  25. uint data[];
  26. }
  27. grid_indices;
  28. #define LIGHT_TYPE_DIRECTIONAL 0
  29. #define LIGHT_TYPE_OMNI 1
  30. #define LIGHT_TYPE_SPOT 2
  31. struct Light {
  32. vec3 position;
  33. uint type;
  34. vec3 direction;
  35. float energy;
  36. vec3 color;
  37. float size;
  38. float range;
  39. float attenuation;
  40. float cos_spot_angle;
  41. float inv_spot_attenuation;
  42. bool static_bake;
  43. uint pad[3];
  44. };
  45. layout(set = 0, binding = 4, std430) restrict readonly buffer Lights {
  46. Light data[];
  47. }
  48. lights;
  49. struct Seam {
  50. uvec2 a;
  51. uvec2 b;
  52. };
  53. layout(set = 0, binding = 5, std430) restrict readonly buffer Seams {
  54. Seam data[];
  55. }
  56. seams;
  57. layout(set = 0, binding = 6, std430) restrict readonly buffer Probes {
  58. vec4 data[];
  59. }
  60. probe_positions;
  61. layout(set = 0, binding = 7) uniform utexture3D grid;
  62. layout(set = 0, binding = 8) uniform texture2DArray albedo_tex;
  63. layout(set = 0, binding = 9) uniform texture2DArray emission_tex;
  64. layout(set = 0, binding = 10) uniform sampler linear_sampler;
  65. // Fragment action constants
  66. const uint FA_NONE = 0;
  67. const uint FA_SMOOTHEN_POSITION = 1;