diff --git a/.clang-format b/.clang-format index 6a547cf6f11..87731d9eb83 100644 --- a/.clang-format +++ b/.clang-format @@ -52,8 +52,10 @@ AllowShortFunctionsOnASingleLine: Inline # AlwaysBreakAfterReturnType: None # AlwaysBreakBeforeMultilineStrings: false # AlwaysBreakTemplateDeclarations: MultiLine -# AttributeMacros: -# - __capability +AttributeMacros: + - _ALWAYS_INLINE_ + - _FORCE_INLINE_ + - _NO_INLINE_ # BinPackArguments: true # BinPackParameters: true # BitFieldColonSpacing: Both diff --git a/drivers/metal/metal_objects.h b/drivers/metal/metal_objects.h index 3966d2e8a47..1468ddc5a87 100644 --- a/drivers/metal/metal_objects.h +++ b/drivers/metal/metal_objects.h @@ -945,8 +945,7 @@ namespace rid { // Converts an Objective-C object to a pointer, and incrementing the // reference count. -_FORCE_INLINE_ -void *owned(id p_id) { +_FORCE_INLINE_ void *owned(id p_id) { return (__bridge_retained void *)p_id; } @@ -962,14 +961,12 @@ MAKE_ID(MTLVertexDescriptor *, RDD::VertexFormatID) MAKE_ID(id, RDD::CommandPoolID) // Converts a pointer to an Objective-C object without changing the reference count. -_FORCE_INLINE_ -auto get(RDD::ID p_id) { +_FORCE_INLINE_ auto get(RDD::ID p_id) { return (p_id.id) ? (__bridge ::id)(void *)p_id.id : nil; } // Converts a pointer to an Objective-C object, and decrements the reference count. -_FORCE_INLINE_ -auto release(RDD::ID p_id) { +_FORCE_INLINE_ auto release(RDD::ID p_id) { return (__bridge_transfer ::id)(void *)p_id.id; } diff --git a/misc/utility/clang_format_glsl.yml b/misc/utility/clang_format_glsl.yml index a614e7d9ce2..1977bca2edb 100644 --- a/misc/utility/clang_format_glsl.yml +++ b/misc/utility/clang_format_glsl.yml @@ -9,6 +9,10 @@ AlignTrailingComments: OverEmptyLines: 0 AllowAllParametersOfDeclarationOnNextLine: false AllowShortFunctionsOnASingleLine: Inline +AttributeMacros: + - _ALWAYS_INLINE_ + - _FORCE_INLINE_ + - _NO_INLINE_ BreakConstructorInitializers: AfterColon ColumnLimit: 0 ConstructorInitializerIndentWidth: 8 diff --git a/tests/python_build/fixtures/gles3/vertex_fragment.glsl b/tests/python_build/fixtures/gles3/vertex_fragment.glsl index 3004e22f25a..90f33bbf82e 100644 --- a/tests/python_build/fixtures/gles3/vertex_fragment.glsl +++ b/tests/python_build/fixtures/gles3/vertex_fragment.glsl @@ -3,7 +3,7 @@ #[modes] mode_ninepatch = #define USE_NINEPATCH - +/* clang-format off */ #[specializations] DISABLE_LIGHTING = false @@ -12,13 +12,13 @@ DISABLE_LIGHTING = false precision highp float; precision highp int; - +/* clang-format on */ layout(location = 0) in highp vec3 vertex; out highp vec4 position_interp; void main() { - position_interp = vec4(vertex.x,1,0,1); + position_interp = vec4(vertex.x, 1, 0, 1); } #[fragment] diff --git a/tests/python_build/fixtures/glsl/compute.glsl b/tests/python_build/fixtures/glsl/compute.glsl index e81f48d463d..fbcb6c775f5 100644 --- a/tests/python_build/fixtures/glsl/compute.glsl +++ b/tests/python_build/fixtures/glsl/compute.glsl @@ -4,7 +4,6 @@ #VERSION_DEFINES - #include "_included.glsl" void main() { diff --git a/tests/python_build/fixtures/glsl/vertex_fragment.glsl b/tests/python_build/fixtures/glsl/vertex_fragment.glsl index 0bdce783d75..90d5bd42afb 100644 --- a/tests/python_build/fixtures/glsl/vertex_fragment.glsl +++ b/tests/python_build/fixtures/glsl/vertex_fragment.glsl @@ -11,9 +11,8 @@ lines = "#define MODE_LINES"; layout(location = 0) out vec3 uv_interp; void main() { - #ifdef MODE_LINES - uv_interp = vec3(0,0,1); + uv_interp = vec3(0, 0, 1); #endif } @@ -28,5 +27,5 @@ void main() { layout(location = 0) out vec4 dst_color; void main() { - dst_color = vec4(1,1,0,0); + dst_color = vec4(1, 1, 0, 0); }