diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /servers/rendering/rasterizer_rd/shaders | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) |
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.
Diffstat (limited to 'servers/rendering/rasterizer_rd/shaders')
25 files changed, 63 insertions, 0 deletions
diff --git a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl index dbeccbfff4..18555d9672 100644 --- a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl +++ b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl @@ -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 diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl index 8c2b0c925d..3e0d5c4ffc 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl @@ -12,6 +12,7 @@ layout(push_constant, binding = 0, std430) uniform Constants { vec2 direction; vec2 pad; } + constants; layout(location = 0) out highp float depth; diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl index a39866004b..ba05b8b2fb 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl @@ -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 */ diff --git a/servers/rendering/rasterizer_rd/shaders/copy.glsl b/servers/rendering/rasterizer_rd/shaders/copy.glsl index c8a8b027c8..249e7963d0 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy.glsl @@ -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 diff --git a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl index 2308f58e00..5f53045afd 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl @@ -17,6 +17,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool force_luminance; uint pad[3]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl index 2fd2e05ae1..133d97ffcb 100644 --- a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl @@ -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; diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl index 9f3ecf6053..8d88e46727 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl @@ -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; diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl index 193d0a8a3c..20bc0e2d0d 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl @@ -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 diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl index 36dba6df3d..0e6e51f0de 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl @@ -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 diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl index e4449afbd0..60c4032d80 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl @@ -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 diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl index dd347c86a7..db3043fb28 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl @@ -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; diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl index 5e54c8b4de..37ea673fbe 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl @@ -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); diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl index d0f2703214..7a79f6a3ac 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl @@ -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 diff --git a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl index 979fdb2dc1..060b1a3101 100644 --- a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl +++ b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl @@ -37,6 +37,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float exposure_adjust; float pad[3]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl index 6969a967b9..e59424e3d6 100644 --- a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl @@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float curve; uint pad; } + params; #define HALF_PI 1.5707963267948966 diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl index 4c2fb296e6..93ddcc9dbc 100644 --- a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl +++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl @@ -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 */ diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl index fcde6b9d7a..39b10871ac 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl @@ -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) { diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl index a4ff2ba815..c36143039c 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl @@ -33,6 +33,7 @@ layout(push_constant, binding = 2, std430) uniform Params { bool vertical; uint steps; } + params; #define GAUSS_TABLE_SIZE 15 diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl index 3c6b3748d8..072f57eb40 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl @@ -26,6 +26,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool filtered; uint pad[2]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/sky.glsl b/servers/rendering/rasterizer_rd/shaders/sky.glsl index f8e2257480..b0be03fe44 100644 --- a/servers/rendering/rasterizer_rd/shaders/sky.glsl +++ b/servers/rendering/rasterizer_rd/shaders/sky.glsl @@ -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 */ diff --git a/servers/rendering/rasterizer_rd/shaders/ssao.glsl b/servers/rendering/rasterizer_rd/shaders/ssao.glsl index 0175e26b85..764d7eeeac 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao.glsl @@ -78,6 +78,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float proj_scale; uint pad; } + params; vec3 reconstructCSPosition(vec2 S, float z) { diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl index 642a051ba0..ca7cc7d71b 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl @@ -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. */ diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl index db50ce1893..c590e406f3 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl @@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool orthogonal; uint pad; } + params; #ifdef MINIFY_START diff --git a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl index c91ef49c78..9d660c5865 100644 --- a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl +++ b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl @@ -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; diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl index 780d961197..f4754bfea7 100644 --- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl +++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl @@ -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; |