Rename HLSL resource-related intrinsics to be consistent with the naming conventions discussed in [wg-hlsl:0014]. This is an entirely mechanical change, consisting of the following commands and automated formatting. ```sh git grep -l handle.fromBinding | xargs perl -pi -e \ 's/(dx|spv)(.)handle.fromBinding/$1$2resource$2handlefrombinding/g' git grep -l typedBufferLoad_checkbit | xargs perl -pi -e \ 's/(dx|spv)(.)typedBufferLoad_checkbit/$1$2resource$2loadchecked$2typedbuffer/g' git grep -l typedBufferLoad | xargs perl -pi -e \ 's/(dx|spv)(.)typedBufferLoad/$1$2resource$2load$2typedbuffer/g' git grep -l typedBufferStore | xargs perl -pi -e \ 's/(dx|spv)(.)typedBufferStore/$1$2resource$2store$2typedbuffer/g' git grep -l bufferUpdateCounter | xargs perl -pi -e \ 's/(dx|spv)(.)bufferUpdateCounter/$1$2resource$2updatecounter/g' git grep -l cast_handle | xargs perl -pi -e \ 's/(dx|spv)(.)cast.handle/$1$2resource$2casthandle/g' ``` [wg-hlsl:0014]: https://github.com/llvm/wg-hlsl/blob/main/proposals/0014-consistent-naming-for-dx-intrinsics.md
49 lines
1.7 KiB
LLVM
49 lines
1.7 KiB
LLVM
; RUN: opt -S -passes=dxil-translate-metadata %s | FileCheck %s
|
|
|
|
target triple = "dxil-pc-shadermodel6.6-compute"
|
|
|
|
%struct.S = type { <4 x float>, <4 x i32> }
|
|
|
|
define void @test() {
|
|
; Buffer<float4>
|
|
%float4 = call target("dx.TypedBuffer", <4 x float>, 0, 0, 0)
|
|
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, i1 false)
|
|
; CHECK: %TypedBuffer = type { <4 x float> }
|
|
|
|
; Buffer<int>
|
|
%int = call target("dx.TypedBuffer", i32, 0, 0, 1)
|
|
@llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 1, i32 0, i1 false)
|
|
; CHECK: %TypedBuffer.0 = type { i32 }
|
|
|
|
; Buffer<uint3>
|
|
%uint3 = call target("dx.TypedBuffer", <3 x i32>, 0, 0, 0)
|
|
@llvm.dx.resource.handlefrombinding(i32 0, i32 2, i32 1, i32 0, i1 false)
|
|
; CHECK: %TypedBuffer.1 = type { <3 x i32> }
|
|
|
|
; StructuredBuffer<S>
|
|
%struct0 = call target("dx.RawBuffer", %struct.S, 0, 0)
|
|
@llvm.dx.resource.handlefrombinding(i32 0, i32 10, i32 1, i32 0, i1 true)
|
|
; CHECK: %StructuredBuffer = type { %struct.S }
|
|
|
|
; ByteAddressBuffer
|
|
%byteaddr = call target("dx.RawBuffer", i8, 0, 0)
|
|
@llvm.dx.resource.handlefrombinding(i32 0, i32 20, i32 1, i32 0, i1 false)
|
|
; CHECK: %ByteAddressBuffer = type { i32 }
|
|
|
|
ret void
|
|
}
|
|
|
|
; CHECK: @[[T0:.*]] = external constant %TypedBuffer
|
|
; CHECK-NEXT: @[[T1:.*]] = external constant %TypedBuffer.0
|
|
; CHECK-NEXT: @[[T2:.*]] = external constant %TypedBuffer.1
|
|
; CHECK-NEXT: @[[S0:.*]] = external constant %StructuredBuffer
|
|
; CHECK-NEXT: @[[B0:.*]] = external constant %ByteAddressBuffer
|
|
|
|
; CHECK: !{i32 0, ptr @[[T0]], !""
|
|
; CHECK: !{i32 1, ptr @[[T1]], !""
|
|
; CHECK: !{i32 2, ptr @[[T2]], !""
|
|
; CHECK: !{i32 3, ptr @[[S0]], !""
|
|
; CHECK: !{i32 4, ptr @[[B0]], !""
|
|
|
|
attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
|