diff --git a/test/Feature/RawBuffers/ByteAddressBuffers.test b/test/Feature/ByteAddressBuffer/ByteAddressBuffers.test similarity index 100% rename from test/Feature/RawBuffers/ByteAddressBuffers.test rename to test/Feature/ByteAddressBuffer/ByteAddressBuffers.test diff --git a/test/Feature/ByteAddressBuffer/GetDimensions.test b/test/Feature/ByteAddressBuffer/GetDimensions.test new file mode 100644 index 000000000..917b9784b --- /dev/null +++ b/test/Feature/ByteAddressBuffer/GetDimensions.test @@ -0,0 +1,87 @@ +#--- source.hlsl + +// This test checks that we will get the expected values from invoking +// `GetDimension`s on typed buffers RWBuffer and Buffer. + +ByteAddressBuffer A : register(t0); +RWByteAddressBuffer B : register(u1); + +[[vk::binding(10)]] +RWBuffer Out : register(u10); + +[numthreads(1,1,1)] +void main() { + uint dim; + + A.GetDimensions(dim); + Out[0] = dim; + + B.GetDimensions(dim); + Out[1] = dim; +} + +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [4, 1, 1] + +Buffers: + - Name: A + Format: Int32 + Data: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ] + + - Name: B + Format: Hex32 + Data: [ 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700 ] + + - Name: Out + Format: Int32 + ZeroInitSize: 8 + + - Name: ExpectedOut + Format: Int32 + Data: [ 56, 28 ] + +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut + +DescriptorSets: + - Resources: + - Name: A + Kind: ByteAddressBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + + - Name: B + Kind: RWByteAddressBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 10 + Space: 0 + VulkanBinding: + Binding: 10 +... +#--- end + +# Unimplemented https://github.com/llvm/wg-hlsl/issues/126 +# XFAIL: Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Feature/RawBuffers/GetDimensions-compute.test b/test/Feature/StructuredBuffer/GetDimensions.test similarity index 70% rename from test/Feature/RawBuffers/GetDimensions-compute.test rename to test/Feature/StructuredBuffer/GetDimensions.test index ed38440b2..ac0b6151a 100644 --- a/test/Feature/RawBuffers/GetDimensions-compute.test +++ b/test/Feature/StructuredBuffer/GetDimensions.test @@ -14,13 +14,14 @@ struct S { }; StructuredBuffer A : register(t0); -RWStructuredBuffer B : register(u0); -AppendStructuredBuffer C : register(u1); -ConsumeStructuredBuffer D : register(u2); +RWStructuredBuffer B : register(u1); +AppendStructuredBuffer C : register(u2); +ConsumeStructuredBuffer D : register(u3); -RWBuffer Out : register(u0, space1); +[[vk::binding(10)]] +RWBuffer Out : register(u10); -[numthreads(4,1,1)] +[numthreads(1,1,1)] void main() { uint numStructs, stride; int i = 0; @@ -75,6 +76,16 @@ Buffers: Format: Int32 ZeroInitSize: 32 + - Name: ExpectedOut + Format: Int32 + Data: [ 1, 16, 4, 8, 2, 16, 2, 8 ] + +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut + DescriptorSets: - Resources: - Name: A @@ -82,40 +93,47 @@ DescriptorSets: DirectXBinding: Register: 0 Space: 0 + VulkanBinding: + Binding: 0 - Name: B Kind: RWStructuredBuffer DirectXBinding: - Register: 0 + Register: 1 Space: 0 + VulkanBinding: + Binding: 1 - Name: C Kind: RWStructuredBuffer DirectXBinding: - Register: 1 + Register: 2 Space: 0 + VulkanBinding: + Binding: 2 - Name: D Kind: RWStructuredBuffer DirectXBinding: - Register: 2 + Register: 3 Space: 0 + VulkanBinding: + Binding: 3 - Name: Out Kind: RWBuffer DirectXBinding: - Register: 0 - Space: 1 + Register: 10 + Space: 0 + VulkanBinding: + Binding: 10 + ... #--- end -# UNSUPPORTED: Clang -# UNSUPPORTED: Vulkan +# Unimplemented https://github.com/llvm/wg-hlsl/issues/126 +# XFAIL: Clang # RUN: split-file %s %t # RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl -# RUN: %offloader %t/pipeline.yaml %t.o | FileCheck %s - -# CHECK: - Name: Out -# CHECK-NEXT: Format: Int32 -# CHECK-NEXT: Data: [ 1, 16, 4, 8, 2, 16, 2, 8 ] +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Feature/TypedBuffer/GetDimensions.test b/test/Feature/TypedBuffer/GetDimensions.test new file mode 100644 index 000000000..ae577f26a --- /dev/null +++ b/test/Feature/TypedBuffer/GetDimensions.test @@ -0,0 +1,91 @@ +#--- source.hlsl + +// This test checks that we will get the expected values from invoking +// `GetDimension`s on typed buffers RWBuffer and Buffer. + +Buffer A : register(t0); +RWBuffer B : register(u1); + +[[vk::binding(10)]] +RWBuffer Out : register(u10); + +[numthreads(1,1,1)] +void main() { + uint dim; + + A.GetDimensions(dim); + Out[0] = dim; + + B.GetDimensions(dim); + Out[1] = dim; +} + +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [4, 1, 1] + +Buffers: + - Name: A + Format: Int32 + Data: [ 0, 1, 2, 3, 4, 5, 6, 7 ] + + - Name: B + Format: Float32 + Data: [ 0.1, 1.1, 2.2, 3.3, 4.4 ] + + - Name: Out + Format: Int32 + ZeroInitSize: 8 + + - Name: ExpectedOut + Format: Int32 + Data: [ 8, 5 ] + +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut + +DescriptorSets: + - Resources: + - Name: A + Kind: Buffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + + - Name: B + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 10 + Space: 0 + VulkanBinding: + Binding: 10 + +... +#--- end + +# Bug https://github.com/llvm/offload-test-suite/issues/469 +# XFAIL: DXC && Vulkan + +# Unimplemented https://github.com/llvm/wg-hlsl/issues/126 +# XFAIL: Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o