07bc4e2f96
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
99 lines
1.6 KiB
GLSL
99 lines
1.6 KiB
GLSL
|
|
/* SET 0, static data that does not change between any call */
|
|
|
|
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;
|
|
};
|
|
|
|
layout(set = 0, binding = 2, std430) restrict readonly buffer Triangles {
|
|
Triangle data[];
|
|
}
|
|
|
|
triangles;
|
|
|
|
struct Box {
|
|
vec3 min_bounds;
|
|
uint pad0;
|
|
vec3 max_bounds;
|
|
uint pad1;
|
|
};
|
|
|
|
layout(set = 0, binding = 3, std430) restrict readonly buffer Boxes {
|
|
Box data[];
|
|
}
|
|
|
|
boxes;
|
|
|
|
layout(set = 0, binding = 4, std430) restrict readonly buffer GridIndices {
|
|
uint data[];
|
|
}
|
|
|
|
grid_indices;
|
|
|
|
#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;
|
|
float spot_angle;
|
|
float spot_attenuation;
|
|
|
|
bool static_bake;
|
|
uint pad[3];
|
|
};
|
|
|
|
layout(set = 0, binding = 5, std430) restrict readonly buffer Lights {
|
|
Light data[];
|
|
}
|
|
|
|
lights;
|
|
|
|
struct Seam {
|
|
uvec2 a;
|
|
uvec2 b;
|
|
};
|
|
|
|
layout(set = 0, binding = 6, std430) restrict readonly buffer Seams {
|
|
Seam data[];
|
|
}
|
|
|
|
seams;
|
|
|
|
layout(set = 0, binding = 7, std430) restrict readonly buffer Probes {
|
|
vec4 data[];
|
|
}
|
|
|
|
probe_positions;
|
|
|
|
layout(set = 0, binding = 8) uniform utexture3D grid;
|
|
layout(set = 0, binding = 9) uniform texture3D grid_sdf;
|
|
|
|
layout(set = 0, binding = 10) uniform texture2DArray albedo_tex;
|
|
layout(set = 0, binding = 11) uniform texture2DArray emission_tex;
|
|
|
|
layout(set = 0, binding = 12) uniform sampler linear_sampler;
|