-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Codestyle] Set clang-format RemoveSemicolon
rule to true
#97934
[Codestyle] Set clang-format RemoveSemicolon
rule to true
#97934
Conversation
b9c52cc
to
b1f9f99
Compare
@Repiteo I updated the PR, removed |
I still wonder how we can compile this using the C++17 standard. 🤔 godot/drivers/metal/rendering_device_driver_metal.mm Lines 1035 to 1043 in 6732a0f
cc. @stuartcarnie |
Running this across the whole repo now catches some drivers/gles3/shaders/canvas_uniforms_inc.glsl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gles3/shaders/canvas_uniforms_inc.glsl b/drivers/gles3/shaders/canvas_uniforms_inc.glsl
index f6ad2b730a..186f01f3cf 100644
--- a/drivers/gles3/shaders/canvas_uniforms_inc.glsl
+++ b/drivers/gles3/shaders/canvas_uniforms_inc.glsl
@@ -31,7 +31,7 @@
layout(std140) uniform GlobalShaderUniformData { //ubo:1
vec4 global_shader_uniforms[MAX_GLOBAL_SHADER_UNIFORMS];
-};
+}
layout(std140) uniform CanvasData { //ubo:0
mat4 canvas_transform;
@@ -50,7 +50,7 @@ layout(std140) uniform CanvasData { //ubo:0
float tex_to_sdf;
uint pad1;
uint pad2;
-};
+}
#ifndef DISABLE_LIGHTING
#define LIGHT_FLAGS_BLEND_MASK uint(3 << 16)
@@ -84,5 +84,5 @@ struct Light {
layout(std140) uniform LightData { //ubo:2
Light light_array[MAX_LIGHTS];
-};
+}
#endif // DISABLE_LIGHTING
drivers/gles3/shaders/particles.glsl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl
index 2591937a1d..52dd61713e 100644
--- a/drivers/gles3/shaders/particles.glsl
+++ b/drivers/gles3/shaders/particles.glsl
@@ -94,7 +94,7 @@ layout(std140) uniform FrameData { //ubo:0
Attractor attractors[MAX_ATTRACTORS];
Collider colliders[MAX_COLLIDERS];
-};
+}
#define PARTICLE_FLAG_ACTIVE uint(1)
#define PARTICLE_FLAG_STARTED uint(2)
drivers/gles3/shaders/scene.glsl | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index fcfbeddb9e..fb8f376afe 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -153,7 +153,7 @@ layout(location = 15) in highp uvec4 instance_color_custom_data; // Color packed
layout(std140) uniform GlobalShaderUniformData { //ubo:1
vec4 global_shader_uniforms[MAX_GLOBAL_SHADER_UNIFORMS];
-};
+}
layout(std140) uniform SceneData { // ubo:2
highp mat4 projection_matrix;
@@ -219,7 +219,7 @@ struct PositionalShadowData {
layout(std140) uniform PositionalShadows { // ubo:9
PositionalShadowData positional_shadows[MAX_LIGHT_DATA_STRUCTS];
-};
+}
uniform lowp uint positional_shadow_index;
@@ -241,7 +241,7 @@ struct DirectionalShadowData {
layout(std140) uniform DirectionalShadows { // ubo:10
DirectionalShadowData directional_shadows[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
-};
+}
uniform lowp uint directional_shadow_index;
@@ -274,7 +274,7 @@ struct DirectionalLightData {
layout(std140) uniform DirectionalLights { // ubo:7
DirectionalLightData directional_lights[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
-};
+}
#endif // !DISABLE_LIGHT_DIRECTIONAL
// Omni and spot light data.
@@ -302,7 +302,7 @@ struct LightData { // This structure needs to be as packed as possible.
#if !defined(DISABLE_LIGHT_OMNI) || defined(ADDITIVE_OMNI)
layout(std140) uniform OmniLightData { // ubo:5
LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
-};
+}
#ifdef BASE_PASS
uniform uint omni_light_indices[MAX_FORWARD_LIGHTS];
uniform uint omni_light_count;
@@ -312,7 +312,7 @@ uniform uint omni_light_count;
#if !defined(DISABLE_LIGHT_SPOT) || defined(ADDITIVE_SPOT)
layout(std140) uniform SpotLightData { // ubo:6
LightData spot_lights[MAX_LIGHT_DATA_STRUCTS];
-};
+}
#ifdef BASE_PASS
uniform uint spot_light_indices[MAX_FORWARD_LIGHTS];
uniform uint spot_light_count;
@@ -899,7 +899,7 @@ uniform samplerCube refprobe2_texture; // texunit:-8
layout(std140) uniform GlobalShaderUniformData { //ubo:1
vec4 global_shader_uniforms[MAX_GLOBAL_SHADER_UNIFORMS];
-};
+}
/* Material Uniforms */
#ifdef MATERIAL_UNIFORMS_USED
@@ -1011,7 +1011,7 @@ struct DirectionalLightData {
layout(std140) uniform DirectionalLights { // ubo:7
DirectionalLightData directional_lights[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
-};
+}
#if defined(USE_ADDITIVE_LIGHTING) && (!defined(ADDITIVE_OMNI) && !defined(ADDITIVE_SPOT))
// Directional shadows can be in the base pass or in the additive passes
@@ -1045,7 +1045,7 @@ struct LightData { // This structure needs to be as packed as possible.
#if !defined(DISABLE_LIGHT_OMNI) || defined(ADDITIVE_OMNI)
layout(std140) uniform OmniLightData { // ubo:5
LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
-};
+}
#if defined(BASE_PASS) && !defined(USE_VERTEX_LIGHTING)
uniform uint omni_light_indices[MAX_FORWARD_LIGHTS];
uniform uint omni_light_count;
@@ -1055,7 +1055,7 @@ uniform uint omni_light_count;
#if !defined(DISABLE_LIGHT_SPOT) || defined(ADDITIVE_SPOT)
layout(std140) uniform SpotLightData { // ubo:6
LightData spot_lights[MAX_LIGHT_DATA_STRUCTS];
-};
+}
#if defined(BASE_PASS) && !defined(USE_VERTEX_LIGHTING)
uniform uint spot_light_indices[MAX_FORWARD_LIGHTS];
uniform uint spot_light_count;
@@ -1084,7 +1084,7 @@ struct PositionalShadowData {
layout(std140) uniform PositionalShadows { // ubo:9
PositionalShadowData positional_shadows[MAX_LIGHT_DATA_STRUCTS];
-};
+}
uniform lowp uint positional_shadow_index;
#else // ADDITIVE_DIRECTIONAL
@@ -1104,7 +1104,7 @@ struct DirectionalShadowData {
layout(std140) uniform DirectionalShadows { // ubo:10
DirectionalShadowData directional_shadows[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
-};
+}
uniform lowp uint directional_shadow_index;
#endif // !(defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT))
drivers/gles3/shaders/sky.glsl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gles3/shaders/sky.glsl b/drivers/gles3/shaders/sky.glsl
index 186b630bc8..936f19a076 100644
--- a/drivers/gles3/shaders/sky.glsl
+++ b/drivers/gles3/shaders/sky.glsl
@@ -56,7 +56,7 @@ uniform sampler2D quarter_res; //texunit:-3
layout(std140) uniform GlobalShaderUniformData { //ubo:1
vec4 global_shader_uniforms[MAX_GLOBAL_SHADER_UNIFORMS];
-};
+}
struct DirectionalLightData {
vec4 direction_energy;
drivers/gles3/shaders/tonemap_inc.glsl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gles3/shaders/tonemap_inc.glsl b/drivers/gles3/shaders/tonemap_inc.glsl
index 6738bdf748..11c8338c07 100644
--- a/drivers/gles3/shaders/tonemap_inc.glsl
+++ b/drivers/gles3/shaders/tonemap_inc.glsl
@@ -8,7 +8,7 @@ layout(std140) uniform TonemapData { //ubo:0
float brightness;
float contrast;
float saturation;
-};
+}
// This expects 0-1 range input.
vec3 linear_to_srgb(vec3 color) {
modules/betsy/bc1.glsl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/betsy/bc1.glsl b/modules/betsy/bc1.glsl
index f1b2c28254..3164806606 100644
--- a/modules/betsy/bc1.glsl
+++ b/modules/betsy/bc1.glsl
@@ -17,7 +17,7 @@ layout(binding = 1, rg32ui) uniform restrict writeonly uimage2D dstTexture;
layout(std430, binding = 2) readonly restrict buffer globalBuffer {
float2 c_oMatch5[256];
float2 c_oMatch6[256];
-};
+}
layout(push_constant, std430) uniform Params {
uint p_numRefinements;
.../rendering/renderer_rd/shaders/environment/volumetric_fog.glsl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl b/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl
index 929f1e34df..2a30d6c7ea 100644
--- a/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl
+++ b/servers/rendering/renderer_rd/shaders/environment/volumetric_fog.glsl
@@ -37,7 +37,7 @@ params;
#ifdef NO_IMAGE_ATOMICS
layout(set = 1, binding = 1) volatile buffer emissive_only_map_buffer {
uint emissive_only_map[];
-};
+}
#else
layout(r32ui, set = 1, binding = 1) uniform volatile uimage3D emissive_only_map;
#endif
@@ -67,10 +67,10 @@ scene_params;
#ifdef NO_IMAGE_ATOMICS
layout(set = 1, binding = 3) volatile buffer density_only_map_buffer {
uint density_only_map[];
-};
+}
layout(set = 1, binding = 4) volatile buffer light_only_map_buffer {
uint light_only_map[];
-};
+}
#else
layout(r32ui, set = 1, binding = 3) uniform volatile uimage3D density_only_map;
layout(r32ui, set = 1, binding = 4) uniform volatile uimage3D light_only_map;
.../renderer_rd/shaders/environment/volumetric_fog_process.glsl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/servers/rendering/renderer_rd/shaders/environment/volumetric_fog_process.glsl b/servers/rendering/renderer_rd/shaders/environment/volumetric_fog_process.glsl
index 90bbdfe685..22be4a6d9b 100644
--- a/servers/rendering/renderer_rd/shaders/environment/volumetric_fog_process.glsl
+++ b/servers/rendering/renderer_rd/shaders/environment/volumetric_fog_process.glsl
@@ -193,13 +193,13 @@ layout(set = 0, binding = 15) uniform texture3D prev_density_texture;
#ifdef NO_IMAGE_ATOMICS
layout(set = 0, binding = 16) buffer density_only_map_buffer {
uint density_only_map[];
-};
+}
layout(set = 0, binding = 17) buffer light_only_map_buffer {
uint light_only_map[];
-};
+}
layout(set = 0, binding = 18) buffer emissive_only_map_buffer {
uint emissive_only_map[];
-};
+}
#else
layout(r32ui, set = 0, binding = 16) uniform uimage3D density_only_map;
layout(r32ui, set = 0, binding = 17) uniform uimage3D light_only_map; |
Ya, the changes in your diff will break those shaders completely. |
- Set clang-format `Standard` rule to `c++20`
3f99de7
to
05a43a3
Compare
I added a new pass, Technically, .glsl files aren't supported by clang-format, but unsupported files are treated as .cpp files as default. That explains why clang-format can format .glsl files. That commit just makes it still work, while making it possible to update the rules for other files. |
05a43a3
to
2f6bae7
Compare
I like the workaround, but the file shouldn't be in the project root; migrate it to |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
2f6bae7
to
613760f
Compare
613760f
to
25b28aa
Compare
@adamscott that is in an Objective-C++ file, and only compiled by clang on Apple platforms. |
Maybe that's what you want to say, but it's specifically this part of the SCSub that makes it use C++20 instead of C++17. Lines 37 to 40 in 61accf0
|
Thanks! |
@@ -315,4 +315,6 @@ struct BuildIndexSequence<0, Is...> : IndexSequence<Is...> {}; | |||
#define ___gd_is_defined(val) ____gd_is_defined(__GDARG_PLACEHOLDER_##val) | |||
#define GD_IS_DEFINED(x) ___gd_is_defined(x) | |||
|
|||
#define FORCE_SEMICOLON ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to remove this before merge.
We might want to sneak this into another codebase wise refactoring, as changing typedefs.h
again will cause a recompiling of all artifacts for contributors and CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to sneak this into another codebase wise refactoring, as changing
typedefs.h
again will cause a recompiling of all artifacts for contributors and CI.
FYI @Repiteo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorporated the macro removal in #93401
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to remove this before merge.
Sorry, that's my fault!
Just note, this breaks clang formatting for anyone that is using clang format on save instead of through the git pre-commit hook. I was surprised that all my semicolons were taken away. I'm investigating right now whether I can filter clang_format by file type to get the same kind of workflow that you introduced here. edit: For VScode it turned out to be very easy! You can specify an alternate style with |
Introduces the(been replaced by turning off and on the checks for the sole exception in the codebase), as mentioned here: [Codestyle] Set clang-formatFORCE_SEMICOLON
macro to force a semi-colon to be inserted (and bypass clang-format).RemoveSemicolon
rule totrue
#97934 (comment))See [Codestyle] Set clang-formatRemoveSemicolon
rule totrue
#97934 (review) for an example.Standard
rule toc++20
This should fix the superfluous semi-colons issue that takes a lot of time for some reviewers to flag in PRs.