Skip to content

Commit a92254a

Browse files
Merge pull request #2517 from KhronosGroup/fix-2506
Implement line directive from ShaderDebugInfo.100.
2 parents 256192e + 8c018ed commit a92254a

14 files changed

+815
-3
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
static float3 iv;
2+
static float3 ov;
3+
4+
struct SPIRV_Cross_Input
5+
{
6+
float3 iv : TEXCOORD0;
7+
};
8+
9+
struct SPIRV_Cross_Output
10+
{
11+
float3 ov : SV_Target0;
12+
};
13+
14+
void frag_main()
15+
{
16+
#line 137 "test.frag"
17+
#line 106 "test.frag"
18+
bool _288 = iv.x < 0.0f;
19+
if (_288)
20+
{
21+
#line 107 "test.frag"
22+
ov.x = 50.0f;
23+
}
24+
else
25+
{
26+
#line 109 "test.frag"
27+
ov.x = 60.0f;
28+
}
29+
#line 114 "test.frag"
30+
for (int _519 = 0; _519 < 4; _519++)
31+
{
32+
#line 106 "test.frag"
33+
if (_288)
34+
{
35+
#line 107 "test.frag"
36+
ov.x = 50.0f;
37+
}
38+
else
39+
{
40+
#line 109 "test.frag"
41+
ov.x = 60.0f;
42+
}
43+
#line 117 "test.frag"
44+
if (iv.y < 0.0f)
45+
{
46+
#line 118 "test.frag"
47+
ov.y = 70.0f;
48+
}
49+
else
50+
{
51+
#line 120 "test.frag"
52+
ov.y = 80.0f;
53+
}
54+
}
55+
#line 126 "test.frag"
56+
for (int _523 = 0; _523 < 4; _523++)
57+
{
58+
#line 106 "test.frag"
59+
if (_288)
60+
{
61+
#line 107 "test.frag"
62+
ov.x = 50.0f;
63+
}
64+
else
65+
{
66+
#line 109 "test.frag"
67+
ov.x = 60.0f;
68+
}
69+
#line 114 "test.frag"
70+
for (int _527 = 0; _527 < 4; _527++)
71+
{
72+
#line 106 "test.frag"
73+
if (_288)
74+
{
75+
#line 107 "test.frag"
76+
ov.x = 50.0f;
77+
}
78+
else
79+
{
80+
#line 109 "test.frag"
81+
ov.x = 60.0f;
82+
}
83+
#line 117 "test.frag"
84+
if (iv.y < 0.0f)
85+
{
86+
#line 118 "test.frag"
87+
ov.y = 70.0f;
88+
}
89+
else
90+
{
91+
#line 120 "test.frag"
92+
ov.y = 80.0f;
93+
}
94+
}
95+
#line 130 "test.frag"
96+
if (iv.z < 0.0f)
97+
{
98+
#line 131 "test.frag"
99+
ov.z = 100.0f;
100+
}
101+
else
102+
{
103+
#line 133 "test.frag"
104+
ov.z = 120.0f;
105+
}
106+
}
107+
#line 142 "test.frag"
108+
}
109+
110+
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
111+
{
112+
iv = stage_input.iv;
113+
frag_main();
114+
SPIRV_Cross_Output stage_output;
115+
stage_output.ov = ov;
116+
return stage_output;
117+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#include <metal_stdlib>
2+
#include <simd/simd.h>
3+
4+
using namespace metal;
5+
6+
struct main0_out
7+
{
8+
float3 ov [[color(0)]];
9+
};
10+
11+
struct main0_in
12+
{
13+
float3 iv [[user(locn0)]];
14+
};
15+
16+
fragment main0_out main0(main0_in in [[stage_in]])
17+
{
18+
main0_out out = {};
19+
#line 137 "test.frag"
20+
#line 106 "test.frag"
21+
bool _288 = in.iv.x < 0.0;
22+
if (_288)
23+
{
24+
#line 107 "test.frag"
25+
out.ov.x = 50.0;
26+
}
27+
else
28+
{
29+
#line 109 "test.frag"
30+
out.ov.x = 60.0;
31+
}
32+
#line 114 "test.frag"
33+
for (int _519 = 0; _519 < 4; _519++)
34+
{
35+
#line 106 "test.frag"
36+
if (_288)
37+
{
38+
#line 107 "test.frag"
39+
out.ov.x = 50.0;
40+
}
41+
else
42+
{
43+
#line 109 "test.frag"
44+
out.ov.x = 60.0;
45+
}
46+
#line 117 "test.frag"
47+
if (in.iv.y < 0.0)
48+
{
49+
#line 118 "test.frag"
50+
out.ov.y = 70.0;
51+
}
52+
else
53+
{
54+
#line 120 "test.frag"
55+
out.ov.y = 80.0;
56+
}
57+
}
58+
#line 126 "test.frag"
59+
for (int _523 = 0; _523 < 4; _523++)
60+
{
61+
#line 106 "test.frag"
62+
if (_288)
63+
{
64+
#line 107 "test.frag"
65+
out.ov.x = 50.0;
66+
}
67+
else
68+
{
69+
#line 109 "test.frag"
70+
out.ov.x = 60.0;
71+
}
72+
#line 114 "test.frag"
73+
for (int _527 = 0; _527 < 4; _527++)
74+
{
75+
#line 106 "test.frag"
76+
if (_288)
77+
{
78+
#line 107 "test.frag"
79+
out.ov.x = 50.0;
80+
}
81+
else
82+
{
83+
#line 109 "test.frag"
84+
out.ov.x = 60.0;
85+
}
86+
#line 117 "test.frag"
87+
if (in.iv.y < 0.0)
88+
{
89+
#line 118 "test.frag"
90+
out.ov.y = 70.0;
91+
}
92+
else
93+
{
94+
#line 120 "test.frag"
95+
out.ov.y = 80.0;
96+
}
97+
}
98+
#line 130 "test.frag"
99+
if (in.iv.z < 0.0)
100+
{
101+
#line 131 "test.frag"
102+
out.ov.z = 100.0;
103+
}
104+
else
105+
{
106+
#line 133 "test.frag"
107+
out.ov.z = 120.0;
108+
}
109+
}
110+
#line 142 "test.frag"
111+
return out;
112+
}
113+
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#version 450
2+
#extension GL_GOOGLE_cpp_style_line_directive : require
3+
4+
layout(location = 0) in vec3 iv;
5+
layout(location = 0) out vec3 ov;
6+
7+
void main()
8+
{
9+
#line 137 "test.frag"
10+
#line 106 "test.frag"
11+
bool _288 = iv.x < 0.0;
12+
if (_288)
13+
{
14+
#line 107 "test.frag"
15+
ov.x = 50.0;
16+
}
17+
else
18+
{
19+
#line 109 "test.frag"
20+
ov.x = 60.0;
21+
}
22+
#line 114 "test.frag"
23+
for (int _519 = 0; _519 < 4; _519++)
24+
{
25+
#line 106 "test.frag"
26+
if (_288)
27+
{
28+
#line 107 "test.frag"
29+
ov.x = 50.0;
30+
}
31+
else
32+
{
33+
#line 109 "test.frag"
34+
ov.x = 60.0;
35+
}
36+
#line 117 "test.frag"
37+
if (iv.y < 0.0)
38+
{
39+
#line 118 "test.frag"
40+
ov.y = 70.0;
41+
}
42+
else
43+
{
44+
#line 120 "test.frag"
45+
ov.y = 80.0;
46+
}
47+
}
48+
#line 126 "test.frag"
49+
for (int _523 = 0; _523 < 4; _523++)
50+
{
51+
#line 106 "test.frag"
52+
if (_288)
53+
{
54+
#line 107 "test.frag"
55+
ov.x = 50.0;
56+
}
57+
else
58+
{
59+
#line 109 "test.frag"
60+
ov.x = 60.0;
61+
}
62+
#line 114 "test.frag"
63+
for (int _527 = 0; _527 < 4; _527++)
64+
{
65+
#line 106 "test.frag"
66+
if (_288)
67+
{
68+
#line 107 "test.frag"
69+
ov.x = 50.0;
70+
}
71+
else
72+
{
73+
#line 109 "test.frag"
74+
ov.x = 60.0;
75+
}
76+
#line 117 "test.frag"
77+
if (iv.y < 0.0)
78+
{
79+
#line 118 "test.frag"
80+
ov.y = 70.0;
81+
}
82+
else
83+
{
84+
#line 120 "test.frag"
85+
ov.y = 80.0;
86+
}
87+
}
88+
#line 130 "test.frag"
89+
if (iv.z < 0.0)
90+
{
91+
#line 131 "test.frag"
92+
ov.z = 100.0;
93+
}
94+
else
95+
{
96+
#line 133 "test.frag"
97+
ov.z = 120.0;
98+
}
99+
}
100+
#line 142 "test.frag"
101+
}
102+

0 commit comments

Comments
 (0)