Description
- Implement
InstanceID
clang builtin,LinkInstanceID
clang builtin withhlsl_intrinsics.h
Add sema checks forInstanceID
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
Add codegen forInstanceID
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
Add codegen tests toclang/test/CodeGenHLSL/builtins/InstanceID.hlsl
Add sema tests toclang/test/SemaHLSL/BuiltIns/InstanceID-errors.hlsl
Create theint_dx_InstanceID
intrinsic inIntrinsicsDirectX.td
Create theDXILOpMapping
ofint_dx_InstanceID
to141
inDXIL.td
Create theInstanceID.ll
andInstanceID_errors.ll
tests inllvm/test/CodeGen/DirectX/
Create theint_spv_InstanceID
intrinsic inIntrinsicsSPIRV.td
In SPIRVInstructionSelector.cpp create theInstanceID
lowering and map it toint_spv_InstanceID
inSPIRVInstructionSelector::selectIntrinsic
.Create SPIR-V backend test case inllvm/test/CodeGen/SPIRV/hlsl-intrinsics/InstanceID.ll
DirectX
DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
---|---|---|---|
141 | InstanceID | 6.3 | ('library', 'intersection', 'anyhit', 'closesthit') |
SPIR-V
InstanceCustomIndexKHR
Short Description
InstanceCustomIndexKHR - Custom index associated with an intersected
instance
Description
InstanceCustomIndexKHR
A variable decorated with the InstanceCustomIndexKHR
decoration will
contain the application-defined value of the instance that intersects
the current ray. This variable contains the value that was specified in
VkAccelerationStructureInstanceKHR
:: instanceCustomIndex
for the current acceleration structure
instance in the lower 24 bits and the upper 8 bits will be zero.
Valid Usage
-
VUID-InstanceCustomIndexKHR-InstanceCustomIndexKHR-04251
TheInstanceCustomIndexKHR
decoration must be used only within
theIntersectionKHR
,AnyHitKHR
, orClosestHitKHR
Execution
Model
-
VUID-InstanceCustomIndexKHR-InstanceCustomIndexKHR-04252
The variable decorated withInstanceCustomIndexKHR
must be
declared using theInput
Storage
Class
-
VUID-InstanceCustomIndexKHR-InstanceCustomIndexKHR-04253
The variable decorated withInstanceCustomIndexKHR
must be
declared as a scalar 32-bit integer value
Test Case(s)
Example 1
//dxc InstanceID_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export uint fn() {
return InstanceID();
}
SPIRV Example(s):
Example 2
//dxc InstanceID_spirv_test.hlsl -T lib_6_8 -E fn -enable-16bit-types -spirv -fspv-target-env=universal1.5 -fcgl -O0
[shader("intersection")]
void fn() {
uint ret = InstanceID();
}
HLSL:
The user-provided identifier for the instance on the bottom-level acceleration structure instance within the top-level structure.
Syntax
uint InstanceID();
Remarks
This function can be called from the following raytracing shader types:
See also
Metadata
Metadata
Assignees
Type
Projects
Status
Activity
farzonl commentedon Jul 3, 2024
@EugeneZelenko These bugs were created via automation. There are going to be about 160+ of these coming in. This first run was just a test. Would you like me to add the
metabug
label to all the issues created by the bot?EugeneZelenko commentedon Jul 3, 2024
@farzonl:
metabug
label should be used for issues that are used for tracking multiple issues, so bot could apply the label to such issues.farzonl commentedon Jul 12, 2024
@EugeneZelenko This is the list of bugs we are going to be adding to llvm-project next week: please let me know if you see something glaring that would be painful for you: farzonl/test_repo#157
EugeneZelenko commentedon Jul 12, 2024
@farzonl: This is good example of
metabug
:-) But I did not look on each issue. Some of them may be ofmetabug
kind.