Description
- Implement
WorldRayOrigin
clang builtin, - Link
WorldRayOrigin
clang builtin withhlsl_intrinsics.h
- Add sema checks for
WorldRayOrigin
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
- Add codegen for
WorldRayOrigin
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
- Add codegen tests to
clang/test/CodeGenHLSL/builtins/WorldRayOrigin.hlsl
- Add sema tests to
clang/test/SemaHLSL/BuiltIns/WorldRayOrigin-errors.hlsl
- Create the
int_dx_WorldRayOrigin
intrinsic inIntrinsicsDirectX.td
- Create the
DXILOpMapping
ofint_dx_WorldRayOrigin
to147
inDXIL.td
- Create the
WorldRayOrigin.ll
andWorldRayOrigin_errors.ll
tests inllvm/test/CodeGen/DirectX/
- Create the
int_spv_WorldRayOrigin
intrinsic inIntrinsicsSPIRV.td
- In SPIRVInstructionSelector.cpp create the
WorldRayOrigin
lowering and map it toint_spv_WorldRayOrigin
inSPIRVInstructionSelector::selectIntrinsic
. - Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WorldRayOrigin.ll
DirectX
DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
---|---|---|---|
147 | WorldRayOrigin | 6.3 | ('library', 'intersection', 'anyhit', 'closesthit', 'miss') |
SPIR-V
Description
WorldRayOriginKHR
A variable decorated with the WorldRayOriginKHR
decoration will
specify the origin of the ray being processed, in world space. The value
is the parameter passed into the pipeline trace ray instruction.
Valid Usage
-
VUID-WorldRayOriginKHR-WorldRayOriginKHR-04431
TheWorldRayOriginKHR
decoration must be used only within the
IntersectionKHR
,AnyHitKHR
,ClosestHitKHR
, or
MissKHR
Execution
Model
-
VUID-WorldRayOriginKHR-WorldRayOriginKHR-04432
The variable decorated withWorldRayOriginKHR
must be declared
using theInput
Storage
Class
-
VUID-WorldRayOriginKHR-WorldRayOriginKHR-04433
The variable decorated withWorldRayOriginKHR
must be declared
as a three-component vector of 32-bit floating-point values
Test Case(s)
Example 1
//dxc WorldRayOrigin_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float3 fn() {
return WorldRayOrigin();
}
SPIRV Example(s):
Example 2
//dxc WorldRayOrigin_spirv_test.hlsl -T lib_6_8 -E fn -enable-16bit-types -spirv -fspv-target-env=universal1.5 -fcgl -O0
[shader("intersection")]
void fn() {
float3 ret = WorldRayOrigin();
}
HLSL:
The world-space origin of the current ray.
Syntax
float3 WorldRayOrigin();
Remarks
This function can be called from the following raytracing shader types:
See also
Metadata
Metadata
Assignees
Type
Projects
Status