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

Implement the WorldToObject4x3 HLSL Function #99200

Open
12 tasks
Tracked by #99235
farzonl opened this issue Jul 16, 2024 · 0 comments
Open
12 tasks
Tracked by #99235

Implement the WorldToObject4x3 HLSL Function #99200

farzonl opened this issue Jul 16, 2024 · 0 comments
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.

Comments

@farzonl
Copy link
Member

farzonl commented Jul 16, 2024

  • Implement WorldToObject4x3 clang builtin,
  • Link WorldToObject4x3 clang builtin with hlsl_intrinsics.h
  • Add sema checks for WorldToObject4x3 to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for WorldToObject4x3 to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/WorldToObject4x3.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/WorldToObject4x3-errors.hlsl
  • Create the int_dx_WorldToObject4x3 intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_WorldToObject4x3 to 152 in DXIL.td
  • Create the WorldToObject4x3.ll and WorldToObject4x3_errors.ll tests in llvm/test/CodeGen/DirectX/
  • Create the int_spv_WorldToObject4x3 intrinsic in IntrinsicsSPIRV.td
  • In SPIRVInstructionSelector.cpp create the WorldToObject4x3 lowering and map it to int_spv_WorldToObject4x3 in SPIRVInstructionSelector::selectIntrinsic.
  • Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WorldToObject4x3.ll

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
152 WorldToObject 6.3 ('library', 'intersection', 'anyhit', 'closesthit')

SPIR-V

WorldToObjectKHR

Short Description

WorldToObjectKHR - Transformation matrix from world to object space

Description

WorldToObjectKHR
A variable decorated with the WorldToObjectKHR decoration will
contain the current world-to-object transformation matrix, which is
determined by the instance of the current intersection.

Valid Usage


  • VUID-WorldToObjectKHR-WorldToObjectKHR-04434

    The WorldToObjectKHR decoration must be used only within the
    IntersectionKHR , AnyHitKHR , or ClosestHitKHR
    Execution Model


  • VUID-WorldToObjectKHR-WorldToObjectKHR-04435

    The variable decorated with WorldToObjectKHR must be declared
    using the Input Storage Class


  • VUID-WorldToObjectKHR-WorldToObjectKHR-04436

    The variable decorated with WorldToObjectKHR must be declared
    as a matrix with four columns of three-component vectors of 32-bit
    floating-point values

Test Case(s)

Example 1

//dxc WorldToObject4x3_test.hlsl -T lib_6_8 -enable-16bit-types -O0

export float4x3 fn() {
    return WorldToObject4x3();
}

SPIRV Example(s):

Example 2

//dxc WorldToObject4x3_spirv_test.hlsl -T lib_6_8 -E fn -enable-16bit-types -spirv -fspv-target-env=universal1.5 -fcgl -O0

[shader("intersection")]
void fn() {
float4x3 	ret = WorldToObject4x3();
}

HLSL:

A matrix for transforming from world-space to object-space. Object-space refers to the space of the current bottom-level acceleration structure.

Syntax

float4x3 WorldToObject4x3();

Remarks

The matrix is a transposition of WorldToObject3x4 matrix.

This function can be called from the following raytracing shader types:

See also

Direct3D 12 Raytracing HLSL Reference

@farzonl farzonl added backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues. labels Jul 16, 2024
@damyanp damyanp moved this to Ready in HLSL Support Oct 30, 2024
@damyanp damyanp moved this from Ready to Planning in HLSL Support Oct 30, 2024
@damyanp damyanp moved this from Planning to Designing in HLSL Support Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.
Projects
Status: Designing
Development

No branches or pull requests

1 participant