diff --git a/test/Basic/matrix_single_subscript_load.test b/test/Basic/matrix_single_subscript_load.test new file mode 100644 index 00000000..096febc6 --- /dev/null +++ b/test/Basic/matrix_single_subscript_load.test @@ -0,0 +1,71 @@ +#--- source.hlsl +RWBuffer In : register(u0); +RWBuffer Out : register(u1); + +[numthreads(1,1,1)] +void main() { + int4x4 A = int4x4(In[0], In[1], In[2], + In[3], In[4], In[5], + In[6], In[7], In[8], + In[9], In[10], In[11], + In[12], In[13], In[14], + In[15]); + + for (int i = 0; i < 4; i++) { + int4 B; + if (i % 2 == 0) + B = A[i]; + else if (i % 3 == 0) + B = A[i].abgr; + else + B.grab = A[i]; + for (int j = 0; j < 4; j++) { + Out[i*4 + j] = B[j]; + } + } +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In + Format: Int32 + Data: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + - Name: Out + Format: Int32 + FillSize: 64 + - Name: ExpectedOut + Format: Int32 + Data: [ 1, 2, 3, 4, 6, 5, 8, 7, 9, 10, 11, 12, 16, 15, 14, 13 ] +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut +DescriptorSets: + - Resources: + - Name: In + Kind: RWBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 +... +#--- end + +# XFAIL: Clang +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Basic/matrix_single_subscript_store.test b/test/Basic/matrix_single_subscript_store.test new file mode 100644 index 00000000..82309f70 --- /dev/null +++ b/test/Basic/matrix_single_subscript_store.test @@ -0,0 +1,71 @@ +#--- source.hlsl +RWBuffer In : register(u0); +RWBuffer Out : register(u1); + +[numthreads(1,1,1)] +void main() { + int4 vec = int4(In[0], In[1], In[2], + In[3]); + int4x4 A; + for(int i = 0; i < 4; i++) { + if(i % 2 == 0) + A[i].rbag = vec; + // A[3] is exactly In Buffer + else if(i % 3 == 0) + A[i] = vec; + // A[1] is reverse In Buffer + else + A[i] = vec.abgr; + } + const uint COLS = 4; + for(int i = 0; i < 16; i++) { + uint row = i / COLS; + uint col = i % COLS; + Out[i] = A[row][col]; + } +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In + Format: Int32 + Data: [ 1, 2, 3, 4] + - Name: Out + Format: Int32 + FillSize: 64 + - Name: ExpectedOut + Format: Int32 + Data: [ 1, 4, 2, 3, 4, 3, 2, 1, 1, 4, 2, 3, 1, 2, 3, 4 ] +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut +DescriptorSets: + - Resources: + - Name: In + Kind: RWBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 +... +#--- end + +# XFAIL: Clang +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o