You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Style: Enforce separation line between function definitions
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.
This commit is contained in:
@@ -51,6 +51,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float jitter_seed;
|
||||
uint pad[2];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
//used to work around downsampling filter
|
||||
|
||||
@@ -12,6 +12,7 @@ layout(push_constant, binding = 0, std430) uniform Constants {
|
||||
vec2 direction;
|
||||
vec2 pad;
|
||||
}
|
||||
|
||||
constants;
|
||||
|
||||
layout(location = 0) out highp float depth;
|
||||
|
||||
@@ -51,6 +51,7 @@ layout(push_constant, binding = 0, std430) uniform DrawData {
|
||||
vec2 color_texture_pixel_size;
|
||||
uint lights[4];
|
||||
}
|
||||
|
||||
draw_data;
|
||||
|
||||
// The values passed per draw primitives are cached within it
|
||||
@@ -82,6 +83,7 @@ layout(set = 2, binding = 0, std140) uniform CanvasData {
|
||||
float time_pad;
|
||||
//uint light_count;
|
||||
}
|
||||
|
||||
canvas_data;
|
||||
|
||||
layout(set = 2, binding = 1) uniform textureBuffer skeleton_buffer;
|
||||
@@ -90,6 +92,7 @@ layout(set = 2, binding = 2, std140) uniform SkeletonData {
|
||||
mat4 skeleton_transform; //in world coordinates
|
||||
mat4 skeleton_transform_inverse;
|
||||
}
|
||||
|
||||
skeleton_data;
|
||||
|
||||
#ifdef USE_LIGHTING
|
||||
@@ -123,6 +126,7 @@ struct Light {
|
||||
layout(set = 2, binding = 3, std140) uniform LightData {
|
||||
Light data[MAX_LIGHTS];
|
||||
}
|
||||
|
||||
light_array;
|
||||
|
||||
layout(set = 2, binding = 4) uniform texture2D light_textures[MAX_LIGHT_TEXTURES];
|
||||
@@ -135,6 +139,7 @@ layout(set = 2, binding = 6) uniform sampler shadow_sampler;
|
||||
layout(set = 2, binding = 7, std430) restrict readonly buffer GlobalVariableData {
|
||||
vec4 data[];
|
||||
}
|
||||
|
||||
global_variables;
|
||||
|
||||
/* SET3: Render Target Data */
|
||||
|
||||
@@ -37,6 +37,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float camera_z_near;
|
||||
uint pad2[2];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#ifdef MODE_CUBEMAP_ARRAY_TO_PANORAMA
|
||||
|
||||
@@ -17,6 +17,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
bool force_luminance;
|
||||
uint pad[3];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -18,6 +18,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float z_near;
|
||||
bool z_flip;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
layout(r32f, set = 1, binding = 0) uniform restrict writeonly image2D depth_buffer;
|
||||
|
||||
@@ -37,6 +37,7 @@ layout(rgba16f, set = 1, binding = 0) uniform restrict writeonly imageCube dest_
|
||||
layout(push_constant, binding = 1, std430) uniform Params {
|
||||
uint face_size;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#define M_PI 3.14159265359
|
||||
@@ -46,26 +47,31 @@ void get_dir_0(out vec3 dir, in float u, in float v) {
|
||||
dir[1] = v;
|
||||
dir[2] = -u;
|
||||
}
|
||||
|
||||
void get_dir_1(out vec3 dir, in float u, in float v) {
|
||||
dir[0] = -1.0;
|
||||
dir[1] = v;
|
||||
dir[2] = u;
|
||||
}
|
||||
|
||||
void get_dir_2(out vec3 dir, in float u, in float v) {
|
||||
dir[0] = u;
|
||||
dir[1] = 1.0;
|
||||
dir[2] = -v;
|
||||
}
|
||||
|
||||
void get_dir_3(out vec3 dir, in float u, in float v) {
|
||||
dir[0] = u;
|
||||
dir[1] = -1.0;
|
||||
dir[2] = v;
|
||||
}
|
||||
|
||||
void get_dir_4(out vec3 dir, in float u, in float v) {
|
||||
dir[0] = u;
|
||||
dir[1] = v;
|
||||
dir[2] = 1.0;
|
||||
}
|
||||
|
||||
void get_dir_5(out vec3 dir, in float u, in float v) {
|
||||
dir[0] = -u;
|
||||
dir[1] = v;
|
||||
|
||||
@@ -51,11 +51,13 @@ layout(rgba16f, set = 2, binding = 6) uniform restrict writeonly imageCube dest_
|
||||
layout(set = 1, binding = 0, std430) buffer restrict readonly Data {
|
||||
vec4[7][5][3][24] coeffs;
|
||||
}
|
||||
|
||||
data;
|
||||
#else
|
||||
layout(set = 1, binding = 0, std430) buffer restrict readonly Data {
|
||||
vec4[7][5][6] coeffs;
|
||||
}
|
||||
|
||||
data;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
bool use_direct_write;
|
||||
float face_size;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#define M_PI 3.14159265359
|
||||
|
||||
@@ -24,6 +24,7 @@ struct CellChildren {
|
||||
layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer {
|
||||
CellChildren data[];
|
||||
}
|
||||
|
||||
cell_children;
|
||||
|
||||
struct CellData {
|
||||
@@ -36,6 +37,7 @@ struct CellData {
|
||||
layout(set = 0, binding = 2, std430) buffer CellDataBuffer {
|
||||
CellData data[];
|
||||
}
|
||||
|
||||
cell_data;
|
||||
|
||||
#endif // MODE DYNAMIC
|
||||
@@ -65,6 +67,7 @@ struct Light {
|
||||
layout(set = 0, binding = 3, std140) uniform Lights {
|
||||
Light data[MAX_LIGHTS];
|
||||
}
|
||||
|
||||
lights;
|
||||
|
||||
#endif // MODE COMPUTE LIGHT
|
||||
@@ -96,11 +99,13 @@ layout(push_constant, binding = 0, std430) uniform Params {
|
||||
float aniso_strength;
|
||||
uint pad;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
layout(set = 0, binding = 4, std430) buffer Outputs {
|
||||
vec4 data[];
|
||||
}
|
||||
|
||||
outputs;
|
||||
|
||||
#endif // MODE DYNAMIC
|
||||
@@ -143,6 +148,7 @@ layout(push_constant, binding = 0, std430) uniform Params {
|
||||
float propagation;
|
||||
float pad[3];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#ifdef MODE_DYNAMIC_LIGHTING
|
||||
|
||||
@@ -16,6 +16,7 @@ struct CellData {
|
||||
layout(set = 0, binding = 1, std140) buffer CellDataBuffer {
|
||||
CellData data[];
|
||||
}
|
||||
|
||||
cell_data;
|
||||
|
||||
layout(set = 0, binding = 2) uniform texture3D color_tex;
|
||||
@@ -36,6 +37,7 @@ layout(push_constant, binding = 0, std430) uniform Params {
|
||||
ivec3 bounds;
|
||||
uint pad;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
layout(location = 0) out vec4 color_interp;
|
||||
|
||||
@@ -20,6 +20,7 @@ struct CellChildren {
|
||||
layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer {
|
||||
CellChildren data[];
|
||||
}
|
||||
|
||||
cell_children;
|
||||
|
||||
struct CellData {
|
||||
@@ -32,6 +33,7 @@ struct CellData {
|
||||
layout(set = 0, binding = 2, std430) buffer CellDataBuffer {
|
||||
CellData data[];
|
||||
}
|
||||
|
||||
cell_data;
|
||||
|
||||
layout(r8ui, set = 0, binding = 3) uniform restrict writeonly uimage3D sdf_tex;
|
||||
@@ -42,6 +44,7 @@ layout(push_constant, binding = 0, std430) uniform Params {
|
||||
uint pad0;
|
||||
uint pad1;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
void main() {
|
||||
@@ -81,6 +84,7 @@ float distance_to_aabb(ivec3 pos, ivec3 aabb_pos, ivec3 aabb_size) {
|
||||
return length(delta);
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
ivec3 pos = ivec3(gl_GlobalInvocationID);
|
||||
|
||||
@@ -18,6 +18,7 @@ struct CellChildren {
|
||||
layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer {
|
||||
CellChildren data[];
|
||||
}
|
||||
|
||||
cell_children;
|
||||
|
||||
struct CellData {
|
||||
@@ -30,6 +31,7 @@ struct CellData {
|
||||
layout(set = 0, binding = 2, std430) buffer CellDataBuffer {
|
||||
CellData data[];
|
||||
}
|
||||
|
||||
cell_data;
|
||||
|
||||
#define LIGHT_TYPE_DIRECTIONAL 0
|
||||
@@ -57,6 +59,7 @@ struct Light {
|
||||
layout(set = 0, binding = 3, std140) uniform Lights {
|
||||
Light data[MAX_LIGHTS];
|
||||
}
|
||||
|
||||
lights;
|
||||
|
||||
#endif
|
||||
@@ -74,11 +77,13 @@ layout(push_constant, binding = 0, std430) uniform Params {
|
||||
uint cell_count;
|
||||
uint pad[2];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
layout(set = 0, binding = 4, std140) uniform Outputs {
|
||||
vec4 data[];
|
||||
}
|
||||
|
||||
output;
|
||||
|
||||
#ifdef MODE_COMPUTE_LIGHT
|
||||
|
||||
@@ -37,6 +37,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float exposure_adjust;
|
||||
float pad[3];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float curve;
|
||||
uint pad;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#define HALF_PI 1.5707963267948966
|
||||
|
||||
@@ -6,6 +6,7 @@ layout(push_constant, binding = 0, std430) uniform DrawCall {
|
||||
uint pad; //16 bits minimum size
|
||||
vec2 bake_uv2_offset; //used for bake to uv2, ignored otherwise
|
||||
}
|
||||
|
||||
draw_call;
|
||||
|
||||
/* Set 0 Scene data that never changes, ever */
|
||||
@@ -117,6 +118,7 @@ layout(set = 0, binding = 3, std140) uniform SceneData {
|
||||
float fog_height_curve;
|
||||
#endif
|
||||
}
|
||||
|
||||
scene_data;
|
||||
|
||||
#define INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE (1 << 8)
|
||||
@@ -146,6 +148,7 @@ struct InstanceData {
|
||||
layout(set = 0, binding = 4, std430) restrict readonly buffer Instances {
|
||||
InstanceData data[];
|
||||
}
|
||||
|
||||
instances;
|
||||
|
||||
struct LightData { //this structure needs to be as packed as possible
|
||||
@@ -172,6 +175,7 @@ struct LightData { //this structure needs to be as packed as possible
|
||||
layout(set = 0, binding = 5, std430) restrict readonly buffer Lights {
|
||||
LightData data[];
|
||||
}
|
||||
|
||||
lights;
|
||||
|
||||
struct ReflectionData {
|
||||
@@ -188,6 +192,7 @@ struct ReflectionData {
|
||||
layout(set = 0, binding = 6, std140) uniform ReflectionProbeData {
|
||||
ReflectionData data[MAX_REFLECTION_DATA_STRUCTS];
|
||||
}
|
||||
|
||||
reflections;
|
||||
|
||||
struct DirectionalLightData {
|
||||
@@ -226,6 +231,7 @@ struct DirectionalLightData {
|
||||
layout(set = 0, binding = 7, std140) uniform DirectionalLights {
|
||||
DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
|
||||
}
|
||||
|
||||
directional_lights;
|
||||
|
||||
struct GIProbeData {
|
||||
@@ -247,6 +253,7 @@ struct GIProbeData {
|
||||
layout(set = 0, binding = 8, std140) uniform GIProbes {
|
||||
GIProbeData data[MAX_GI_PROBES];
|
||||
}
|
||||
|
||||
gi_probes;
|
||||
|
||||
layout(set = 0, binding = 9) uniform texture3D gi_probe_textures[MAX_GI_PROBE_TEXTURES];
|
||||
@@ -261,6 +268,7 @@ struct Lightmap {
|
||||
layout(set = 0, binding = 10, std140) restrict readonly buffer Lightmaps {
|
||||
Lightmap data[];
|
||||
}
|
||||
|
||||
lightmaps;
|
||||
|
||||
layout(set = 0, binding = 11) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES];
|
||||
@@ -272,6 +280,7 @@ struct LightmapCapture {
|
||||
layout(set = 0, binding = 12, std140) restrict readonly buffer LightmapCaptures {
|
||||
LightmapCapture data[];
|
||||
}
|
||||
|
||||
lightmap_captures;
|
||||
|
||||
#define CLUSTER_COUNTER_SHIFT 20
|
||||
@@ -302,6 +311,7 @@ struct DecalData {
|
||||
layout(set = 0, binding = 15, std430) restrict readonly buffer Decals {
|
||||
DecalData data[];
|
||||
}
|
||||
|
||||
decals;
|
||||
|
||||
layout(set = 0, binding = 16) uniform utexture3D cluster_texture;
|
||||
@@ -309,6 +319,7 @@ layout(set = 0, binding = 16) uniform utexture3D cluster_texture;
|
||||
layout(set = 0, binding = 17, std430) restrict readonly buffer ClusterData {
|
||||
uint indices[];
|
||||
}
|
||||
|
||||
cluster_data;
|
||||
|
||||
layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas;
|
||||
@@ -316,6 +327,7 @@ layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas;
|
||||
layout(set = 0, binding = 19, std430) restrict readonly buffer GlobalVariableData {
|
||||
vec4 data[];
|
||||
}
|
||||
|
||||
global_variables;
|
||||
|
||||
// decal atlas
|
||||
@@ -351,6 +363,7 @@ layout(set = 3, binding = 4) uniform texture2D ao_buffer;
|
||||
layout(set = 4, binding = 0, std430) restrict readonly buffer Transforms {
|
||||
vec4 data[];
|
||||
}
|
||||
|
||||
transforms;
|
||||
|
||||
/* Set 5 User Material */
|
||||
|
||||
@@ -42,6 +42,7 @@ layout(push_constant, binding = 2, std430) uniform Params {
|
||||
|
||||
mat4 projection;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
vec2 view_to_screen(vec3 view_pos, out float w) {
|
||||
|
||||
@@ -33,6 +33,7 @@ layout(push_constant, binding = 2, std430) uniform Params {
|
||||
bool vertical;
|
||||
uint steps;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#define GAUSS_TABLE_SIZE 15
|
||||
|
||||
@@ -26,6 +26,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
bool filtered;
|
||||
uint pad[2];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -14,6 +14,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
vec4 position_multiplier;
|
||||
float time;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
void main() {
|
||||
@@ -40,6 +41,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
vec4 position_multiplier;
|
||||
float time; //TODO consider adding vec2 screen res, and float radiance size
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#define SAMPLER_NEAREST_CLAMP 0
|
||||
@@ -60,6 +62,7 @@ layout(set = 0, binding = 0) uniform sampler material_samplers[12];
|
||||
layout(set = 0, binding = 1, std430) restrict readonly buffer GlobalVariableData {
|
||||
vec4 data[];
|
||||
}
|
||||
|
||||
global_variables;
|
||||
|
||||
#ifdef USE_MATERIAL_UNIFORMS
|
||||
@@ -108,6 +111,7 @@ struct DirectionalLightData {
|
||||
layout(set = 3, binding = 0, std140) uniform DirectionalLights {
|
||||
DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
|
||||
}
|
||||
|
||||
directional_lights;
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
@@ -78,6 +78,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float proj_scale;
|
||||
uint pad;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
vec3 reconstructCSPosition(vec2 S, float z) {
|
||||
|
||||
@@ -31,6 +31,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
ivec2 axis; /** (1, 0) or (0, 1) */
|
||||
ivec2 screen_size;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
/** Filter radius in pixels. This will be multiplied by SCALE. */
|
||||
|
||||
@@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
bool orthogonal;
|
||||
uint pad;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
#ifdef MINIFY_START
|
||||
|
||||
@@ -105,6 +105,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float depth_scale;
|
||||
uint pad[3];
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
layout(set = 0, binding = 0) uniform sampler2D source_image;
|
||||
|
||||
@@ -52,6 +52,7 @@ layout(push_constant, binding = 1, std430) uniform Params {
|
||||
bool use_fxaa;
|
||||
uint pad;
|
||||
}
|
||||
|
||||
params;
|
||||
|
||||
layout(location = 0) out vec4 frag_color;
|
||||
|
||||
Reference in New Issue
Block a user