@@ -206,22 +206,54 @@ struct LegalizeWGSLEntryPointContext
206
206
207
207
switch (result.wgslSystemValueNameEnum )
208
208
{
209
- case SystemValueSemanticName::Position:
209
+
210
+ case SystemValueSemanticName::CullDistance:
210
211
{
211
- result.wgslSystemValueName = toSlice (" position" );
212
- result.permittedTypes .add (builder.getVectorType (
213
- builder.getBasicType (BaseType::Float),
214
- builder.getIntValue (builder.getIntType (), 4 )));
215
- break ;
212
+ result.isUnsupported = true ;
213
+ }
214
+ break ;
215
+
216
+ case SystemValueSemanticName::ClipDistance:
217
+ {
218
+ // TODO: Implement this based on the 'clip-distances' feature in WGSL
219
+ // https: // www.w3.org/TR/webgpu/#dom-gpufeaturename-clip-distances
220
+ result.isUnsupported = true ;
221
+ }
222
+ break ;
223
+
224
+ case SystemValueSemanticName::Coverage:
225
+ {
226
+ result.wgslSystemValueName = toSlice (" sample_mask" );
227
+ result.permittedTypes .add (builder.getUIntType ());
228
+ }
229
+ break ;
230
+
231
+ case SystemValueSemanticName::Depth:
232
+ {
233
+ result.wgslSystemValueName = toSlice (" frag_depth" );
234
+ result.permittedTypes .add (builder.getBasicType (BaseType::Float));
235
+ }
236
+ break ;
237
+
238
+ case SystemValueSemanticName::DepthGreaterEqual:
239
+ case SystemValueSemanticName::DepthLessEqual:
240
+ {
241
+ result.isUnsupported = true ;
216
242
}
243
+ break ;
217
244
218
245
case SystemValueSemanticName::DispatchThreadID:
219
246
{
220
247
result.wgslSystemValueName = toSlice (" global_invocation_id" );
221
- IRType* const vec3uType{ builder.getVectorType (
248
+ result. permittedTypes . add ( builder.getVectorType (
222
249
builder.getBasicType (BaseType::UInt),
223
- builder.getIntValue (builder.getIntType (), 3 ))};
224
- result.permittedTypes .add (vec3uType);
250
+ builder.getIntValue (builder.getIntType (), 3 )));
251
+ }
252
+ break ;
253
+
254
+ case SystemValueSemanticName::DomainLocation:
255
+ {
256
+ result.isUnsupported = true ;
225
257
}
226
258
break ;
227
259
@@ -234,6 +266,13 @@ struct LegalizeWGSLEntryPointContext
234
266
}
235
267
break ;
236
268
269
+ case SystemValueSemanticName::GroupIndex:
270
+ {
271
+ result.wgslSystemValueName = toSlice (" local_invocation_index" );
272
+ result.permittedTypes .add (builder.getUIntType ());
273
+ }
274
+ break ;
275
+
237
276
case SystemValueSemanticName::GroupThreadID:
238
277
{
239
278
result.wgslSystemValueName = toSlice (" local_invocation_id" );
@@ -250,13 +289,78 @@ struct LegalizeWGSLEntryPointContext
250
289
}
251
290
break ;
252
291
253
- case SystemValueSemanticName::GroupIndex :
292
+ case SystemValueSemanticName::InnerCoverage :
254
293
{
255
- result.wgslSystemValueName = toSlice (" local_invocation_index" );
294
+ result.isUnsupported = true ;
295
+ }
296
+ break ;
297
+
298
+ case SystemValueSemanticName::InstanceID:
299
+ {
300
+ result.wgslSystemValueName = toSlice (" instance_index" );
256
301
result.permittedTypes .add (builder.getUIntType ());
257
302
}
258
303
break ;
259
304
305
+ case SystemValueSemanticName::IsFrontFace:
306
+ {
307
+ result.wgslSystemValueName = toSlice (" front_facing" );
308
+ result.permittedTypes .add (builder.getBoolType ());
309
+ }
310
+ break ;
311
+
312
+ case SystemValueSemanticName::OutputControlPointID:
313
+ case SystemValueSemanticName::PointSize:
314
+ {
315
+ result.isUnsupported = true ;
316
+ }
317
+ break ;
318
+
319
+ case SystemValueSemanticName::Position:
320
+ {
321
+ result.wgslSystemValueName = toSlice (" position" );
322
+ result.permittedTypes .add (builder.getVectorType (
323
+ builder.getBasicType (BaseType::Float),
324
+ builder.getIntValue (builder.getIntType (), 4 )));
325
+ break ;
326
+ }
327
+
328
+ case SystemValueSemanticName::PrimitiveID:
329
+ case SystemValueSemanticName::RenderTargetArrayIndex:
330
+ {
331
+ result.isUnsupported = true ;
332
+ break ;
333
+ }
334
+
335
+ case SystemValueSemanticName::SampleIndex:
336
+ {
337
+ result.wgslSystemValueName = toSlice (" sample_index" );
338
+ result.permittedTypes .add (builder.getUIntType ());
339
+ break ;
340
+ }
341
+
342
+ case SystemValueSemanticName::StencilRef:
343
+ case SystemValueSemanticName::Target:
344
+ case SystemValueSemanticName::TessFactor:
345
+ {
346
+ result.isUnsupported = true ;
347
+ break ;
348
+ }
349
+
350
+ case SystemValueSemanticName::VertexID:
351
+ {
352
+ result.wgslSystemValueName = toSlice (" vertex_index" );
353
+ result.permittedTypes .add (builder.getUIntType ());
354
+ break ;
355
+ }
356
+
357
+ case SystemValueSemanticName::ViewID:
358
+ case SystemValueSemanticName::ViewportArrayIndex:
359
+ {
360
+ result.isUnsupported = true ;
361
+ break ;
362
+ }
363
+
260
364
default :
261
365
{
262
366
m_sink->diagnose (
0 commit comments