Commit e3828fc
[naga wgsl-out] Improve representation of minimum int64 literal
In #7424 we fixed a bug where the representation of the minimum int64
literal generated by naga was invalid WGSL. It changed us from
expressing it as `-9223372036854775808` which was invalid, to
`-9223372036854775807li - 1li`.
This is valid WGSL. However, as the values are concrete i64 types if the
shader is parsed again by naga the expression does not get const
evaluated away, leading to suboptimal code generated by the
backends. This patch makes us perform the subtraction using abstract
integers before casting to i64, solving this problem.
Additionally the input WGSL test is updated to use the same construct.1 parent 4761e27 commit e3828fc
File tree
7 files changed
+236
-236
lines changed- naga
- src/back/wgsl
- tests
- in/wgsl
- out
- hlsl
- msl
- spv
- wgsl
7 files changed
+236
-236
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1139 | 1139 | | |
1140 | 1140 | | |
1141 | 1141 | | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1146 | 1146 | | |
1147 | | - | |
| 1147 | + | |
1148 | 1148 | | |
1149 | 1149 | | |
1150 | 1150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
122 | 123 | | |
| 124 | + | |
123 | 125 | | |
124 | | - | |
| 126 | + | |
125 | 127 | | |
126 | | - | |
127 | 128 | | |
| 129 | + | |
128 | 130 | | |
129 | | - | |
130 | 131 | | |
131 | | - | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | | - | |
134 | | - | |
| 135 | + | |
135 | 136 | | |
| 137 | + | |
136 | 138 | | |
137 | | - | |
138 | | - | |
| 139 | + | |
139 | 140 | | |
| 141 | + | |
140 | 142 | | |
141 | | - | |
142 | 143 | | |
| 144 | + | |
143 | 145 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
102 | 103 | | |
| 104 | + | |
103 | 105 | | |
104 | | - | |
| 106 | + | |
105 | 107 | | |
106 | | - | |
107 | 108 | | |
| 109 | + | |
108 | 110 | | |
109 | | - | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | | - | |
113 | | - | |
| 114 | + | |
| 115 | + | |
114 | 116 | | |
115 | | - | |
116 | | - | |
| 117 | + | |
117 | 118 | | |
| 119 | + | |
118 | 120 | | |
119 | | - | |
120 | | - | |
| 121 | + | |
121 | 122 | | |
| 123 | + | |
122 | 124 | | |
123 | | - | |
124 | 125 | | |
| 126 | + | |
125 | 127 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
0 commit comments