diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2020-02-19 08:56:46 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-19 08:56:46 -0800 |
| commit | 1d9152bd2d0b1234680ce6a9f7ef940d7f179e9a (patch) | |
| tree | a4672a712ddc9217ac44fc98fcefcaccc04244e8 /tools | |
| parent | 45d1a680634c59d1081ed09dddaa444695296492 (diff) | |
Fixes for DXR 1.1 RayQuery type (#1227)
The previous change that added `RayQuery` to the standard library didn't mark it as any kind of intrinsic, so the first fix here was to add the appopriate attribtue to the stdlib declaration of `RayQuery`.
Next I found that the legalization pass was obliterating the `RayQuery` type because it had no members, and thus looked like an empty `struct` (which we eliminate for a variety of reasons). I fixed that by adding a check for a target-intrinsic decoration in type legalization.
Next I found that the type wasn't emitted correctly because our generic specialization was turning `RayQuery<0>` into a new type `RayQuery_0` (which is what our specialization is designed to do, after all).
I then disabled generic specialization for types that are marked as target intrinsics (which probably renders the preceding fix moot).
Finally, I found that the emit logic for types in HLSL wasn't handling the case of a generic intrinsic type that didn't also use its own dedicated opcode. I fixes that up by adding a specific case for `IRSpecialize` as a late catch-all.
After all these changes, a declaration of a `RayQuery` variable seems to Just Work (even without any new/improved behavior for handling default constructors).
One potential gotcha looking forward is that my checks for `IRTargetIntrinsicDecoration` aren't checking what target the decoration is for. This is fine for now because there are only two types using the decoration right now (`RayDesc` and `RayQuery`), and the special cases above are reasonable for both of them. If/when we have more target-intrinsic types with this decoration, and some of them are only intrinsic for specific targets, then we will need to revisit this choice and either:
* make these checks perform filtering based on the "current" target (similar to what the emit logic has today), or
* (more likely) make the linking and target-specialization step strip out any target-intrinsic decorations that aren't the right one(s) for the current target
Note that this change doesn't include a test case yet because I don't have a DXR 1.1 ready version of dxc to test against. I have manually confirmed that appropriate Slang input seems to be producing reasonable HLSL output when using these functions, but I cannot yet try to check that in (using an HLSL file for the expected output would be quite fragile).
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions
