Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SER] Add CommittedCustomHitKind to HitObject::FromRayQuery #382

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions proposals/0027-shader-execution-reordering.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ If no hit is committed in the RayQuery,
the HitObject returned is a NOP-HitObject. A shader table record can be assigned
separately, which in turn allows invoking a shader.

An overload takes custom attributes associated with
COMMITTED_PROCEDURAL_PRIMITIVE_HIT. It is ok to always use the overload, even
for COMMITTED_TRIANGLE_HIT. For anything other than a procedural hit, the
specified attributes are ignored.
An overload takes a user-defined hit kind and custom attributes associated with
COMMITTED_PROCEDURAL_PRIMITIVE_HIT.
It is ok to always use the overload, even for COMMITTED_TRIANGLE_HIT. For anything
other than a procedural hit, the specified hit kind and attributes are ignored.

```C++
static HitObject HitObject::FromRayQuery(
Expand All @@ -189,13 +189,15 @@ static HitObject HitObject::FromRayQuery(
template<attr_t>
static HitObject HitObject::FromRayQuery(
RayQuery Query,
uint CommittedCustomHitKind,
attr_t CommittedCustomAttribs);
```

Parameter | Definition
--------- | ----------
`Return: HitObject` | The `HitObject` that contains the result of the initialization operation.
`RayQuery Query` | RayQuery from which the hit is created.
`uint CommittedCustomHitKind` | See the `HitKind` parameter of `ReportHit` for definition.
`attr_t CommittedCustomAttribs` | See the `Attributes` parameter of `ReportHit` for definition. If a closesthit shader is invoked from this `HitObject`, `attr_t` must match the attribute type of the closesthit shader.

The size of `attr_t` must not exceed `MaxAttributeSizeInBytes` specified in the `D3D12_RAYTRACING_SHADER_CONFIG`.
Expand Down Expand Up @@ -1326,10 +1328,11 @@ Validation errors:
declare %dx.types.HitObject @dx.op.hitObject_FromRayQuery.AttrT(
i32, ; opcode
i32, ; ray query
i32, ; hit kind
AttrT*) ; attributes
nounwind argmemonly
```
This is used for the HLSL overload of `HitObject::FromRayQuery` that takes `RayQuery` and the user-defined `Attribute` struct.
This is used for the HLSL overload of `HitObject::FromRayQuery` that takes `RayQuery`, a user-defined hit kind, and `Attribute` struct.
`AttrT` is the user-defined intersection attribute struct type. See `ReportHit` for definition.

Validation errors:
Expand All @@ -1338,6 +1341,9 @@ Validation errors:
- Validate the compatibility of type `AttrT`.
- Validate that `attributes` is a valid pointer.

Validation warnings:
- Validate that `hit kind` is in the range of 0-127.

#### HitObject_MakeMiss

```DXIL
Expand Down