Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit 9b4defe

Browse files
committed
CompilerMSL support matrices & arrays in stage-in & stage-out.
Support flattening StorageOutput & StorageInput matrices and arrays. No longer move matrix & array inputs to separate buffer. Add separate SPIRFunction::fixup_statements_in & SPIRFunction::fixup_statements_out instead of just SPIRFunction::fixup_statements. Emit SPIRFunction::fixup_statements at beginning of functions. CompilerMSL track vars_needing_early_declaration. Pass global output variables as variables to functions that access them. Sort input structs by location, same as output structs. Emit struct declarations in order output, input, uniforms. Regenerate reference shaders to new formats defined by above.
1 parent dc56513 commit 9b4defe

File tree

109 files changed

+862
-726
lines changed

Some content is hidden

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

109 files changed

+862
-726
lines changed

reference/opt/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
using namespace metal;
55

6-
struct main0_in
6+
struct main0_out
77
{
8-
float2 vUV [[user(locn0)]];
8+
float4 FragColor [[color(0)]];
99
};
1010

11-
struct main0_out
11+
struct main0_in
1212
{
13-
float4 FragColor [[color(0)]];
13+
float2 vUV [[user(locn0)]];
1414
};
1515

1616
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> uTex [[texture(1)]], sampler uSampler [[sampler(0)]])

reference/opt/shaders-msl/asm/frag/frem.asm.frag

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
using namespace metal;
55

6-
struct main0_in
6+
struct main0_out
77
{
8-
float4 vB [[user(locn1)]];
9-
float4 vA [[user(locn0)]];
8+
float4 FragColor [[color(0)]];
109
};
1110

12-
struct main0_out
11+
struct main0_in
1312
{
14-
float4 FragColor [[color(0)]];
13+
float4 vA [[user(locn0)]];
14+
float4 vB [[user(locn1)]];
1515
};
1616

1717
fragment main0_out main0(main0_in in [[stage_in]])

reference/opt/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
using namespace metal;
55

6-
struct main0_in
6+
struct main0_out
77
{
8-
float4 v0 [[user(locn0)]];
8+
float4 FragColor [[color(0)]];
99
};
1010

11-
struct main0_out
11+
struct main0_in
1212
{
13-
float4 FragColor [[color(0)]];
13+
float4 v0 [[user(locn0)]];
1414
};
1515

1616
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> uImage [[texture(0)]], sampler uImageSmplr [[sampler(0)]])

reference/opt/shaders-msl/asm/frag/srem.asm.frag

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
using namespace metal;
55

6-
struct main0_in
6+
struct main0_out
77
{
8-
int4 vB [[user(locn1)]];
9-
int4 vA [[user(locn0)]];
8+
float4 FragColor [[color(0)]];
109
};
1110

12-
struct main0_out
11+
struct main0_in
1312
{
14-
float4 FragColor [[color(0)]];
13+
int4 vA [[user(locn0)]];
14+
int4 vB [[user(locn1)]];
1515
};
1616

1717
fragment main0_out main0(main0_in in [[stage_in]])

reference/opt/shaders-msl/asm/frag/unreachable.asm.frag

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
using namespace metal;
55

6-
struct main0_in
6+
struct main0_out
77
{
8-
int counter [[user(locn0)]];
8+
float4 FragColor [[color(0)]];
99
};
1010

11-
struct main0_out
11+
struct main0_in
1212
{
13-
float4 FragColor [[color(0)]];
13+
int counter [[user(locn0)]];
1414
};
1515

1616
fragment main0_out main0(main0_in in [[stage_in]])

reference/opt/shaders-msl/desktop-only/vert/basic.desktop.sso.vert

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ struct UBO
88
float4x4 uMVP;
99
};
1010

11-
struct main0_in
12-
{
13-
float3 aNormal [[attribute(1)]];
14-
float4 aVertex [[attribute(0)]];
15-
};
16-
1711
struct main0_out
1812
{
1913
float3 vNormal [[user(locn0)]];
2014
float4 gl_Position [[position]];
2115
};
2216

17+
struct main0_in
18+
{
19+
float4 aVertex [[attribute(0)]];
20+
float3 aNormal [[attribute(1)]];
21+
};
22+
2323
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]])
2424
{
2525
main0_out out = {};

reference/opt/shaders-msl/flatten/basic.flatten.vert

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ struct UBO
88
float4x4 uMVP;
99
};
1010

11-
struct main0_in
12-
{
13-
float3 aNormal [[attribute(1)]];
14-
float4 aVertex [[attribute(0)]];
15-
};
16-
1711
struct main0_out
1812
{
1913
float3 vNormal [[user(locn0)]];
2014
float4 gl_Position [[position]];
2115
};
2216

17+
struct main0_in
18+
{
19+
float4 aVertex [[attribute(0)]];
20+
float3 aNormal [[attribute(1)]];
21+
};
22+
2323
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]])
2424
{
2525
main0_out out = {};

reference/opt/shaders-msl/flatten/multiindex.flatten.vert

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ struct UBO
88
float4 Data[3][5];
99
};
1010

11-
struct main0_in
11+
struct main0_out
1212
{
13-
int2 aIndex [[attribute(0)]];
13+
float4 gl_Position [[position]];
1414
};
1515

16-
struct main0_out
16+
struct main0_in
1717
{
18-
float4 gl_Position [[position]];
18+
int2 aIndex [[attribute(0)]];
1919
};
2020

2121
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _20 [[buffer(0)]])

reference/opt/shaders-msl/flatten/push-constant.flatten.vert

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ struct PushMe
1010
float Arr[4];
1111
};
1212

13-
struct main0_in
14-
{
15-
float4 Pos [[attribute(1)]];
16-
float2 Rot [[attribute(0)]];
17-
};
18-
1913
struct main0_out
2014
{
2115
float2 vRot [[user(locn0)]];
2216
float4 gl_Position [[position]];
2317
};
2418

19+
struct main0_in
20+
{
21+
float2 Rot [[attribute(0)]];
22+
float4 Pos [[attribute(1)]];
23+
};
24+
2525
vertex main0_out main0(main0_in in [[stage_in]], constant PushMe& registers [[buffer(0)]])
2626
{
2727
main0_out out = {};

reference/opt/shaders-msl/flatten/rowmajor.flatten.vert

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ struct UBO
1010
float2x4 uMVP;
1111
};
1212

13-
struct main0_in
13+
struct main0_out
1414
{
15-
float4 aVertex [[attribute(0)]];
15+
float4 gl_Position [[position]];
1616
};
1717

18-
struct main0_out
18+
struct main0_in
1919
{
20-
float4 gl_Position [[position]];
20+
float4 aVertex [[attribute(0)]];
2121
};
2222

2323
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]])

0 commit comments

Comments
 (0)