Skip to content

Commit 9b845a4

Browse files
Merge pull request #1141 from troughton/inline-everything
MSL: Inline all non-entry-point functions
2 parents ee7357f + 6b54032 commit 9b845a4

149 files changed

Lines changed: 546 additions & 544 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct u0_counters
1313
};
1414

1515
// Returns 2D texture coords corresponding to 1D texel buffer coords
16-
uint2 spvTexelBufferCoord(uint tc)
16+
inline uint2 spvTexelBufferCoord(uint tc)
1717
{
1818
return uint2(tc % 4096, tc / 4096);
1919
}

reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct u0_counters
1313
};
1414

1515
// Returns 2D texture coords corresponding to 1D texel buffer coords
16-
uint2 spvTexelBufferCoord(uint tc)
16+
inline uint2 spvTexelBufferCoord(uint tc)
1717
{
1818
return uint2(tc % 4096, tc / 4096);
1919
}

reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct cb5_struct
1111
};
1212

1313
// Returns 2D texture coords corresponding to 1D texel buffer coords
14-
uint2 spvTexelBufferCoord(uint tc)
14+
inline uint2 spvTexelBufferCoord(uint tc)
1515
{
1616
return uint2(tc % 4096, tc / 4096);
1717
}

reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct cb
1111
};
1212

1313
// Returns 2D texture coords corresponding to 1D texel buffer coords
14-
uint2 spvTexelBufferCoord(uint tc)
14+
inline uint2 spvTexelBufferCoord(uint tc)
1515
{
1616
return uint2(tc % 4096, tc / 4096);
1717
}

reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct main0_in
2020
};
2121

2222
template<typename T, uint A>
23-
void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
23+
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
2424
{
2525
for (uint i = 0; i < A; i++)
2626
{
@@ -29,7 +29,7 @@ void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
2929
}
3030

3131
template<typename T, uint A>
32-
void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
32+
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
3333
{
3434
for (uint i = 0; i < A; i++)
3535
{
@@ -38,7 +38,7 @@ void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T
3838
}
3939

4040
template<typename T, uint A>
41-
void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
41+
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
4242
{
4343
for (uint i = 0; i < A; i++)
4444
{
@@ -47,7 +47,7 @@ void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
4747
}
4848

4949
template<typename T, uint A>
50-
void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
50+
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
5151
{
5252
for (uint i = 0; i < A; i++)
5353
{
@@ -56,7 +56,7 @@ void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T
5656
}
5757

5858
template<typename T, uint A>
59-
void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
59+
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
6060
{
6161
for (uint i = 0; i < A; i++)
6262
{
@@ -65,7 +65,7 @@ void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T
6565
}
6666

6767
template<typename T, uint A>
68-
void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
68+
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
6969
{
7070
for (uint i = 0; i < A; i++)
7171
{

reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct main0_out
1919

2020
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
2121
template<typename Tx, typename Ty>
22-
Tx mod(Tx x, Ty y)
22+
inline Tx mod(Tx x, Ty y)
2323
{
2424
return x - y * floor(x / y);
2525
}

reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct main0_in
3434
};
3535

3636
template<typename T, uint A>
37-
void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
37+
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
3838
{
3939
for (uint i = 0; i < A; i++)
4040
{
@@ -43,7 +43,7 @@ void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
4343
}
4444

4545
template<typename T, uint A>
46-
void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
46+
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
4747
{
4848
for (uint i = 0; i < A; i++)
4949
{
@@ -52,7 +52,7 @@ void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T
5252
}
5353

5454
template<typename T, uint A>
55-
void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
55+
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
5656
{
5757
for (uint i = 0; i < A; i++)
5858
{
@@ -61,7 +61,7 @@ void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
6161
}
6262

6363
template<typename T, uint A>
64-
void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
64+
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
6565
{
6666
for (uint i = 0; i < A; i++)
6767
{
@@ -70,7 +70,7 @@ void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T
7070
}
7171

7272
template<typename T, uint A>
73-
void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
73+
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
7474
{
7575
for (uint i = 0; i < A; i++)
7676
{
@@ -79,7 +79,7 @@ void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T
7979
}
8080

8181
template<typename T, uint A>
82-
void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
82+
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
8383
{
8484
for (uint i = 0; i < A; i++)
8585
{

reference/opt/shaders-msl/comp/composite-array-initialization.comp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u);
3030
constant Data _25[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } };
3131

3232
template<typename T, uint A>
33-
void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
33+
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
3434
{
3535
for (uint i = 0; i < A; i++)
3636
{
@@ -39,7 +39,7 @@ void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
3939
}
4040

4141
template<typename T, uint A>
42-
void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
42+
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
4343
{
4444
for (uint i = 0; i < A; i++)
4545
{
@@ -48,7 +48,7 @@ void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T
4848
}
4949

5050
template<typename T, uint A>
51-
void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
51+
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
5252
{
5353
for (uint i = 0; i < A; i++)
5454
{
@@ -57,7 +57,7 @@ void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
5757
}
5858

5959
template<typename T, uint A>
60-
void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
60+
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
6161
{
6262
for (uint i = 0; i < A; i++)
6363
{
@@ -66,7 +66,7 @@ void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T
6666
}
6767

6868
template<typename T, uint A>
69-
void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
69+
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
7070
{
7171
for (uint i = 0; i < A; i++)
7272
{
@@ -75,7 +75,7 @@ void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T
7575
}
7676

7777
template<typename T, uint A>
78-
void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
78+
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
7979
{
8080
for (uint i = 0; i < A; i++)
8181
{

reference/opt/shaders-msl/comp/composite-construct.comp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct SSBO1
1616
};
1717

1818
template<typename T, uint A>
19-
void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
19+
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
2020
{
2121
for (uint i = 0; i < A; i++)
2222
{
@@ -25,7 +25,7 @@ void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
2525
}
2626

2727
template<typename T, uint A>
28-
void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
28+
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
2929
{
3030
for (uint i = 0; i < A; i++)
3131
{
@@ -34,7 +34,7 @@ void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T
3434
}
3535

3636
template<typename T, uint A>
37-
void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
37+
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
3838
{
3939
for (uint i = 0; i < A; i++)
4040
{
@@ -43,7 +43,7 @@ void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
4343
}
4444

4545
template<typename T, uint A>
46-
void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
46+
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
4747
{
4848
for (uint i = 0; i < A; i++)
4949
{
@@ -52,7 +52,7 @@ void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T
5252
}
5353

5454
template<typename T, uint A>
55-
void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
55+
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
5656
{
5757
for (uint i = 0; i < A; i++)
5858
{
@@ -61,7 +61,7 @@ void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T
6161
}
6262

6363
template<typename T, uint A>
64-
void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
64+
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
6565
{
6666
for (uint i = 0; i < A; i++)
6767
{

reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct myBlock
1313

1414
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
1515
template<typename Tx, typename Ty>
16-
Tx mod(Tx x, Ty y)
16+
inline Tx mod(Tx x, Ty y)
1717
{
1818
return x - y * floor(x / y);
1919
}

0 commit comments

Comments
 (0)