Skip to content

Implement the NonUniformResourceIndex HLSL Function #99206

@farzonl

Description

@farzonl
  • Implement NonUniformResourceIndex clang builtin,
  • Link NonUniformResourceIndex clang builtin with hlsl_intrinsics.h
  • Add sema checks for NonUniformResourceIndex to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for NonUniformResourceIndex to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/NonUniformResourceIndex.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/NonUniformResourceIndex-errors.hlsl
  • Create the int_spv_NonUniformResourceIndex intrinsic in IntrinsicsSPIRV.td
  • In SPIRVInstructionSelector.cpp create the NonUniformResourceIndex lowering and map it to int_spv_NonUniformResourceIndex in SPIRVInstructionSelector::selectIntrinsic.
  • Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/NonUniformResourceIndex.ll

DirectX

There were no DXIL opcodes found for NonUniformResourceIndex.

SPIR-V

OpCopyObject:

Description:

Make a copy of Operand. There are no pointer dereferences involved.

Result Type must equal Operand type. Result Type can be any type
except OpTypeVoid.

Word Count Opcode Results Operands

4

83

<id>
Result Type

Result <id>

<id>
Operand

Test Case(s)

Example 1

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

export float4 fn(float4 p1) {
    return NonUniformResourceIndex(p1);
}

HLSL:

Syntax

any<> NonUniformResourceIndex(any<> index);

Type Description

Name Template Type Component Type Size
ret scalar, vector, or matrix bool, float, or int any
index scalar, vector, or matrix bool, float, or int any

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 6 and higher shader models yes

Shader Stages

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    HLSLHLSL Language Supportbackend:SPIR-Vbot:HLSLmetaissueIssue to collect references to a group of similar or related issues.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions