@@ -15,8 +15,6 @@ This proposal adds intrinsics that can be called from an Any hit or Closest
15
15
hit shader to obtain the positions of the vertices for the triangle that has
16
16
been hit.
17
17
18
- ---
19
-
20
18
## Motivation
21
19
22
20
Developers often need to know the positions of the vertices for the triangle
@@ -29,8 +27,6 @@ If developers can access this data from their shader code then this will remove
29
27
the need have a duplicate copy of it. In addition, this will provide drivers
30
28
with opportunities to optimize the data layout for their implementations.
31
29
32
- ---
33
-
34
30
## Proposed solution
35
31
36
32
Add intrinsics to look up the object-space vertex positions of the triangle for
@@ -41,12 +37,8 @@ For context, see related sections in DirectX Raytracing Specification:
41
37
[ RayQuery::CandidateTriangleObjectPositions] [ dxr-rq-can-tri-obj-pos ] ,
42
38
[ RayQuery::CommittedTriangleObjectPositions] [ dxr-rq-com-tri-obj-pos ] .
43
39
44
- ---
45
-
46
40
## Detailed design
47
41
48
- ---
49
-
50
42
### HLSL Additions
51
43
52
44
A new built-in structure for returning all three object-space triangle
@@ -160,8 +152,6 @@ undefined. A shader can check for a triangle hit with
160
152
161
153
Shader model 6.10 is required to use these intrinsics.
162
154
163
- ---
164
-
165
155
### Diagnostic Changes
166
156
167
157
New diagnostics:
@@ -174,8 +164,6 @@ New diagnostics:
174
164
175
165
> Open Issue: [Use Availability Attributes](#use-availability-attributes)
176
166
177
- ---
178
-
179
167
#### Validation Changes
180
168
181
169
New Validation:
@@ -189,12 +177,8 @@ requirements for DXIL ops will be used.
189
177
Existing validation for RayQuery handle will be used.
190
178
Existing validation for HitObject handle will be used.
191
179
192
- ---
193
-
194
180
### Runtime Additions
195
181
196
- ---
197
-
198
182
#### Device Capability
199
183
200
184
Use of Triangle Object Positions intrinsics require Shader Model 6.10 and
@@ -210,12 +194,8 @@ Use of HitObject intrinsics require Shader Model 6.10 and
210
194
> requirement or use of RayQuery or use of HitObject, so no other changes
211
195
> are required in the compiler, aside from the shader model requirement.
212
196
213
- ---
214
-
215
197
## Testing
216
198
217
- ---
218
-
219
199
### Compiler output
220
200
221
201
* Test AST generation for each new HLSL intrinsic
@@ -225,15 +205,11 @@ Use of HitObject intrinsics require Shader Model 6.10 and
225
205
* Use D3DReflect test to verify min shader model of 6.10 with each intrinsic
226
206
usage for library target.
227
207
228
- ---
229
-
230
208
### Diagnostics
231
209
232
210
* Test shader model diagnostic for each new HLSL intrinsic.
233
211
* Test shader stage diagnostic for `TriangleObjectPositions` intrinsic.
234
212
235
- ---
236
-
237
213
### DXIL Additions
238
214
239
215
```llvm
@@ -288,8 +264,6 @@ for the shader invocation.
288
264
However, the new RayQuery methods must be ` readonly ` because they read from
289
265
RayQuery state, which is impacted by various other RayQuery methods.
290
266
291
- ---
292
-
293
267
### SPIR-V Mapping
294
268
295
269
The ` TriangleObjectPositions() ` HLSL intrinsic can be implemented against the
@@ -316,20 +290,14 @@ opcode, with `Intersection` set to `RayQueryCandidateIntersectionKHR` for
316
290
` CandidateTriangleObjectPositions ` , and ` Intersection ` set to
317
291
` RayQueryCommittedIntersectionKHR ` for ` CommittedTriangleObjectPositions ` .
318
292
319
- ---
320
-
321
293
#### Runtime information
322
294
323
295
Use of any of these new DXIL ops will set the
324
296
` RuntimeDataFunctionInfo::MinShaderTarget ` shader model to a minimum of 6.10 in
325
297
the ` RDAT ` part for the calling function.
326
298
327
- ---
328
-
329
299
## Testing
330
300
331
- ---
332
-
333
301
### Validation
334
302
335
303
* Test shader model requirement for all DXIL ops.
@@ -338,19 +306,13 @@ the `RDAT` part for the calling function.
338
306
* Test non-constant argument validation with each DXIL op.
339
307
* Test out-of-range argument validation with each DXIL op.
340
308
341
- ---
342
-
343
309
### Execution
344
310
345
311
Testing for triangle object position operations will be added to the existing
346
312
Raytracing HLK tests.
347
313
348
- ---
349
-
350
314
## Resolved Issues
351
315
352
- ---
353
-
354
316
### Return Type
355
317
356
318
Other approaches have been proposed for the return type of this intrinsic:
@@ -388,8 +350,6 @@ Other approaches have been proposed for the return type of this intrinsic:
388
350
389
351
** Resolution** : Return built-in struct containing all three positions.
390
352
391
- ---
392
-
393
353
### Intrinsic Naming
394
354
395
355
` TriangleObjectPositions ` doesn't match the name used in SPIR-V, which is more
@@ -398,8 +358,6 @@ like `HitTriangleVertexPositions`. Should we adjust naming to align?
398
358
** Resolution** : ` TriangleObjectPositions ` aligns with our conventions for related
399
359
intrinsics.
400
360
401
- ---
402
-
403
361
### Share OpCodeClass
404
362
405
363
Should RayQuery DXIL methods share OpCodeClass for the DXIL ops?
@@ -415,8 +373,6 @@ opcode classes for no good reason.
415
373
416
374
** Resolution** : Use separate OpCodeClass for consistency with related ops.
417
375
418
- ---
419
-
420
376
### Use Availability Attributes
421
377
422
378
Instead of custom diagnostics for these functions, we could potentially use
@@ -427,19 +383,13 @@ on-demand in a custom way.
427
383
428
384
** Resolution** : This seems worthwhile to investigate in Clang but out of scope for DXC.
429
385
430
- ---
431
-
432
386
## Open Issues
433
387
434
- ---
435
-
436
388
### Built-in struct return type
437
389
438
390
` BuiltInTrianglePositions ` isn't necessarily the best name for the struct,
439
391
so suggestions for a better name are welcome.
440
392
441
- ---
442
-
443
393
### Return type for DXIL ops
444
394
445
395
There is some open debate about the return type used for DXIL operations.
@@ -461,8 +411,6 @@ A couple other options:
461
411
462
412
** Proposed Resolution** : Keep DXIL op scalar for consistency with other ops.
463
413
464
- ---
465
-
466
414
## Acknowledgments
467
415
468
416
* Amar Patel
0 commit comments