2020-05-01 20:34:23 +08:00
|
|
|
/* SET 0, static data that does not change between any call */
|
|
|
|
|
2023-10-14 01:32:22 +08:00
|
|
|
layout(set = 0, binding = 0) uniform BakeParameters {
|
|
|
|
vec3 world_size;
|
|
|
|
float bias;
|
|
|
|
|
|
|
|
vec3 to_cell_offset;
|
|
|
|
int grid_size;
|
|
|
|
|
|
|
|
vec3 to_cell_size;
|
|
|
|
uint light_count;
|
|
|
|
|
|
|
|
mat3x4 env_transform;
|
|
|
|
|
|
|
|
ivec2 atlas_size;
|
|
|
|
float exposure_normalization;
|
|
|
|
uint bounces;
|
|
|
|
|
|
|
|
float bounce_indirect_energy;
|
|
|
|
}
|
|
|
|
bake_params;
|
|
|
|
|
2020-05-01 20:34:23 +08:00
|
|
|
struct Vertex {
|
|
|
|
vec3 position;
|
|
|
|
float normal_z;
|
|
|
|
vec2 uv;
|
|
|
|
vec2 normal_xy;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(set = 0, binding = 1, std430) restrict readonly buffer Vertices {
|
|
|
|
Vertex data[];
|
|
|
|
}
|
|
|
|
vertices;
|
|
|
|
|
|
|
|
struct Triangle {
|
|
|
|
uvec3 indices;
|
|
|
|
uint slice;
|
|
|
|
vec3 min_bounds;
|
|
|
|
uint pad0;
|
|
|
|
vec3 max_bounds;
|
|
|
|
uint pad1;
|
|
|
|
};
|
|
|
|
|
2023-10-13 22:39:48 +08:00
|
|
|
struct ClusterAABB {
|
|
|
|
vec3 min_bounds;
|
|
|
|
uint pad0;
|
|
|
|
vec3 max_bounds;
|
|
|
|
uint pad1;
|
|
|
|
};
|
|
|
|
|
2021-09-11 20:02:37 +08:00
|
|
|
layout(set = 0, binding = 2, std430) restrict readonly buffer Triangles {
|
|
|
|
Triangle data[];
|
2020-05-01 20:34:23 +08:00
|
|
|
}
|
2021-09-11 20:02:37 +08:00
|
|
|
triangles;
|
2020-05-01 20:34:23 +08:00
|
|
|
|
2023-10-13 22:39:48 +08:00
|
|
|
layout(set = 0, binding = 3, std430) restrict readonly buffer TriangleIndices {
|
2020-05-01 20:34:23 +08:00
|
|
|
uint data[];
|
|
|
|
}
|
2023-10-13 22:39:48 +08:00
|
|
|
triangle_indices;
|
2020-05-01 20:34:23 +08:00
|
|
|
|
|
|
|
#define LIGHT_TYPE_DIRECTIONAL 0
|
|
|
|
#define LIGHT_TYPE_OMNI 1
|
|
|
|
#define LIGHT_TYPE_SPOT 2
|
|
|
|
|
|
|
|
struct Light {
|
|
|
|
vec3 position;
|
|
|
|
uint type;
|
|
|
|
|
|
|
|
vec3 direction;
|
|
|
|
float energy;
|
|
|
|
|
|
|
|
vec3 color;
|
|
|
|
float size;
|
|
|
|
|
|
|
|
float range;
|
|
|
|
float attenuation;
|
2021-02-07 04:39:08 +08:00
|
|
|
float cos_spot_angle;
|
|
|
|
float inv_spot_attenuation;
|
2020-05-01 20:34:23 +08:00
|
|
|
|
2023-10-14 01:32:22 +08:00
|
|
|
float indirect_energy;
|
2022-06-15 06:55:53 +08:00
|
|
|
float shadow_blur;
|
2020-05-01 20:34:23 +08:00
|
|
|
bool static_bake;
|
2023-10-14 01:32:22 +08:00
|
|
|
uint pad;
|
2020-05-01 20:34:23 +08:00
|
|
|
};
|
|
|
|
|
2021-09-11 20:02:37 +08:00
|
|
|
layout(set = 0, binding = 4, std430) restrict readonly buffer Lights {
|
2020-05-01 20:34:23 +08:00
|
|
|
Light data[];
|
|
|
|
}
|
|
|
|
lights;
|
|
|
|
|
|
|
|
struct Seam {
|
|
|
|
uvec2 a;
|
|
|
|
uvec2 b;
|
|
|
|
};
|
|
|
|
|
2021-09-11 20:02:37 +08:00
|
|
|
layout(set = 0, binding = 5, std430) restrict readonly buffer Seams {
|
2020-05-01 20:34:23 +08:00
|
|
|
Seam data[];
|
|
|
|
}
|
|
|
|
seams;
|
|
|
|
|
2021-09-11 20:02:37 +08:00
|
|
|
layout(set = 0, binding = 6, std430) restrict readonly buffer Probes {
|
2020-05-01 20:34:23 +08:00
|
|
|
vec4 data[];
|
|
|
|
}
|
|
|
|
probe_positions;
|
|
|
|
|
2021-09-11 20:02:37 +08:00
|
|
|
layout(set = 0, binding = 7) uniform utexture3D grid;
|
2020-05-01 20:34:23 +08:00
|
|
|
|
2021-09-11 20:02:37 +08:00
|
|
|
layout(set = 0, binding = 8) uniform texture2DArray albedo_tex;
|
|
|
|
layout(set = 0, binding = 9) uniform texture2DArray emission_tex;
|
2020-05-01 20:34:23 +08:00
|
|
|
|
2021-09-11 20:02:37 +08:00
|
|
|
layout(set = 0, binding = 10) uniform sampler linear_sampler;
|
2021-10-02 05:20:20 +08:00
|
|
|
|
2023-10-13 22:39:48 +08:00
|
|
|
layout(set = 0, binding = 11, std430) restrict readonly buffer ClusterIndices {
|
|
|
|
uint data[];
|
|
|
|
}
|
|
|
|
cluster_indices;
|
|
|
|
|
|
|
|
layout(set = 0, binding = 12, std430) restrict readonly buffer ClusterAABBs {
|
|
|
|
ClusterAABB data[];
|
|
|
|
}
|
|
|
|
cluster_aabbs;
|
|
|
|
|
2021-10-02 05:20:20 +08:00
|
|
|
// Fragment action constants
|
|
|
|
const uint FA_NONE = 0;
|
|
|
|
const uint FA_SMOOTHEN_POSITION = 1;
|