|
| 1 | +; RUN: not opt -S -dxil-resource-implicit-binding %s 2>&1 | FileCheck %s |
| 2 | + |
| 3 | +target triple = "dxil-pc-shadermodel6.6-compute" |
| 4 | + |
| 5 | +@A.str = private unnamed_addr constant [2 x i8] c"A\00", align 1 |
| 6 | +@B.str = private unnamed_addr constant [2 x i8] c"B\00", align 1 |
| 7 | +@C.str = private unnamed_addr constant [2 x i8] c"C\00", align 1 |
| 8 | + |
| 9 | +define void @test_simple_binding() { |
| 10 | + |
| 11 | +; StructuredBuffer<float> A[] : register(t1); |
| 12 | + %bufA = call target("dx.RawBuffer", float, 0, 0) |
| 13 | + @llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 -1, i32 0, i1 false, ptr @A.str) |
| 14 | + |
| 15 | +; StructuredBuffer<float> B[2]; // does not fit in space0 |
| 16 | + %bufB = call target("dx.RawBuffer", float, 0, 0) |
| 17 | + @llvm.dx.resource.handlefromimplicitbinding(i32 100, i32 0, i32 2, i32 0, i1 false, ptr @B.str) |
| 18 | + |
| 19 | +; StructuredBuffer<float> C; // ok |
| 20 | + %bufC = call target("dx.RawBuffer", float, 0, 0) |
| 21 | + @llvm.dx.resource.handlefromimplicitbinding(i32 200, i32 0, i32 1, i32 0, i1 false, ptr @C.str) |
| 22 | + |
| 23 | +; CHECK: error:{{.*}} resource B cannot be allocated |
| 24 | + |
| 25 | + ret void |
| 26 | +} |
0 commit comments