Style: Declare inline macros as attributes

This commit is contained in:
Thaddeus Crews 2025-04-18 12:00:06 -05:00
parent 09ea7bc6a3
commit dd5460c32a
No known key found for this signature in database
GPG Key ID: 8C6E5FEB5FC03CCC
6 changed files with 16 additions and 15 deletions

View File

@ -52,8 +52,10 @@ AllowShortFunctionsOnASingleLine: Inline
# AlwaysBreakAfterReturnType: None # AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false # AlwaysBreakBeforeMultilineStrings: false
# AlwaysBreakTemplateDeclarations: MultiLine # AlwaysBreakTemplateDeclarations: MultiLine
# AttributeMacros: AttributeMacros:
# - __capability - _ALWAYS_INLINE_
- _FORCE_INLINE_
- _NO_INLINE_
# BinPackArguments: true # BinPackArguments: true
# BinPackParameters: true # BinPackParameters: true
# BitFieldColonSpacing: Both # BitFieldColonSpacing: Both

View File

@ -945,8 +945,7 @@ namespace rid {
// Converts an Objective-C object to a pointer, and incrementing the // Converts an Objective-C object to a pointer, and incrementing the
// reference count. // reference count.
_FORCE_INLINE_ _FORCE_INLINE_ void *owned(id p_id) {
void *owned(id p_id) {
return (__bridge_retained void *)p_id; return (__bridge_retained void *)p_id;
} }
@ -962,14 +961,12 @@ MAKE_ID(MTLVertexDescriptor *, RDD::VertexFormatID)
MAKE_ID(id<MTLCommandQueue>, RDD::CommandPoolID) MAKE_ID(id<MTLCommandQueue>, RDD::CommandPoolID)
// Converts a pointer to an Objective-C object without changing the reference count. // Converts a pointer to an Objective-C object without changing the reference count.
_FORCE_INLINE_ _FORCE_INLINE_ auto get(RDD::ID p_id) {
auto get(RDD::ID p_id) {
return (p_id.id) ? (__bridge ::id)(void *)p_id.id : nil; return (p_id.id) ? (__bridge ::id)(void *)p_id.id : nil;
} }
// Converts a pointer to an Objective-C object, and decrements the reference count. // Converts a pointer to an Objective-C object, and decrements the reference count.
_FORCE_INLINE_ _FORCE_INLINE_ auto release(RDD::ID p_id) {
auto release(RDD::ID p_id) {
return (__bridge_transfer ::id)(void *)p_id.id; return (__bridge_transfer ::id)(void *)p_id.id;
} }

View File

@ -9,6 +9,10 @@ AlignTrailingComments:
OverEmptyLines: 0 OverEmptyLines: 0
AllowAllParametersOfDeclarationOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline AllowShortFunctionsOnASingleLine: Inline
AttributeMacros:
- _ALWAYS_INLINE_
- _FORCE_INLINE_
- _NO_INLINE_
BreakConstructorInitializers: AfterColon BreakConstructorInitializers: AfterColon
ColumnLimit: 0 ColumnLimit: 0
ConstructorInitializerIndentWidth: 8 ConstructorInitializerIndentWidth: 8

View File

@ -3,7 +3,7 @@
#[modes] #[modes]
mode_ninepatch = #define USE_NINEPATCH mode_ninepatch = #define USE_NINEPATCH
/* clang-format off */
#[specializations] #[specializations]
DISABLE_LIGHTING = false DISABLE_LIGHTING = false
@ -12,13 +12,13 @@ DISABLE_LIGHTING = false
precision highp float; precision highp float;
precision highp int; precision highp int;
/* clang-format on */
layout(location = 0) in highp vec3 vertex; layout(location = 0) in highp vec3 vertex;
out highp vec4 position_interp; out highp vec4 position_interp;
void main() { void main() {
position_interp = vec4(vertex.x,1,0,1); position_interp = vec4(vertex.x, 1, 0, 1);
} }
#[fragment] #[fragment]

View File

@ -4,7 +4,6 @@
#VERSION_DEFINES #VERSION_DEFINES
#include "_included.glsl" #include "_included.glsl"
void main() { void main() {

View File

@ -11,9 +11,8 @@ lines = "#define MODE_LINES";
layout(location = 0) out vec3 uv_interp; layout(location = 0) out vec3 uv_interp;
void main() { void main() {
#ifdef MODE_LINES #ifdef MODE_LINES
uv_interp = vec3(0,0,1); uv_interp = vec3(0, 0, 1);
#endif #endif
} }
@ -28,5 +27,5 @@ void main() {
layout(location = 0) out vec4 dst_color; layout(location = 0) out vec4 dst_color;
void main() { void main() {
dst_color = vec4(1,1,0,0); dst_color = vec4(1, 1, 0, 0);
} }