Skip to content

Commit dd5460c

Browse files
committed
Style: Declare inline macros as attributes
1 parent 09ea7bc commit dd5460c

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

.clang-format

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ AllowShortFunctionsOnASingleLine: Inline
5252
# AlwaysBreakAfterReturnType: None
5353
# AlwaysBreakBeforeMultilineStrings: false
5454
# AlwaysBreakTemplateDeclarations: MultiLine
55-
# AttributeMacros:
56-
# - __capability
55+
AttributeMacros:
56+
- _ALWAYS_INLINE_
57+
- _FORCE_INLINE_
58+
- _NO_INLINE_
5759
# BinPackArguments: true
5860
# BinPackParameters: true
5961
# BitFieldColonSpacing: Both

drivers/metal/metal_objects.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,7 @@ namespace rid {
945945

946946
// Converts an Objective-C object to a pointer, and incrementing the
947947
// reference count.
948-
_FORCE_INLINE_
949-
void *owned(id p_id) {
948+
_FORCE_INLINE_ void *owned(id p_id) {
950949
return (__bridge_retained void *)p_id;
951950
}
952951

@@ -962,14 +961,12 @@ MAKE_ID(MTLVertexDescriptor *, RDD::VertexFormatID)
962961
MAKE_ID(id<MTLCommandQueue>, RDD::CommandPoolID)
963962

964963
// Converts a pointer to an Objective-C object without changing the reference count.
965-
_FORCE_INLINE_
966-
auto get(RDD::ID p_id) {
964+
_FORCE_INLINE_ auto get(RDD::ID p_id) {
967965
return (p_id.id) ? (__bridge ::id)(void *)p_id.id : nil;
968966
}
969967

970968
// Converts a pointer to an Objective-C object, and decrements the reference count.
971-
_FORCE_INLINE_
972-
auto release(RDD::ID p_id) {
969+
_FORCE_INLINE_ auto release(RDD::ID p_id) {
973970
return (__bridge_transfer ::id)(void *)p_id.id;
974971
}
975972

misc/utility/clang_format_glsl.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ AlignTrailingComments:
99
OverEmptyLines: 0
1010
AllowAllParametersOfDeclarationOnNextLine: false
1111
AllowShortFunctionsOnASingleLine: Inline
12+
AttributeMacros:
13+
- _ALWAYS_INLINE_
14+
- _FORCE_INLINE_
15+
- _NO_INLINE_
1216
BreakConstructorInitializers: AfterColon
1317
ColumnLimit: 0
1418
ConstructorInitializerIndentWidth: 8

tests/python_build/fixtures/gles3/vertex_fragment.glsl

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#[modes]
44

55
mode_ninepatch = #define USE_NINEPATCH
6-
6+
/* clang-format off */
77
#[specializations]
88

99
DISABLE_LIGHTING = false
@@ -12,13 +12,13 @@ DISABLE_LIGHTING = false
1212

1313
precision highp float;
1414
precision highp int;
15-
15+
/* clang-format on */
1616
layout(location = 0) in highp vec3 vertex;
1717

1818
out highp vec4 position_interp;
1919

2020
void main() {
21-
position_interp = vec4(vertex.x,1,0,1);
21+
position_interp = vec4(vertex.x, 1, 0, 1);
2222
}
2323

2424
#[fragment]

tests/python_build/fixtures/glsl/compute.glsl

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#VERSION_DEFINES
66

7-
87
#include "_included.glsl"
98

109
void main() {

tests/python_build/fixtures/glsl/vertex_fragment.glsl

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ lines = "#define MODE_LINES";
1111
layout(location = 0) out vec3 uv_interp;
1212

1313
void main() {
14-
1514
#ifdef MODE_LINES
16-
uv_interp = vec3(0,0,1);
15+
uv_interp = vec3(0, 0, 1);
1716
#endif
1817
}
1918

@@ -28,5 +27,5 @@ void main() {
2827
layout(location = 0) out vec4 dst_color;
2928

3029
void main() {
31-
dst_color = vec4(1,1,0,0);
30+
dst_color = vec4(1, 1, 0, 0);
3231
}

0 commit comments

Comments
 (0)