Skip to content

[spirv] Fix issues of RWByteAddressBuffer in the InitList#3145

Merged
jaebaek merged 1 commit intomicrosoft:masterfrom
jiaolu:master
Oct 1, 2020
Merged

[spirv] Fix issues of RWByteAddressBuffer in the InitList#3145
jaebaek merged 1 commit intomicrosoft:masterfrom
jiaolu:master

Conversation

@jiaolu
Copy link
Copy Markdown
Contributor

@jiaolu jiaolu commented Sep 18, 2020

RWByteAddressBuffer object in the initList should be handled like
OpaqueType RWBuffer or Texture2D.

@AppVeyorBot
Copy link
Copy Markdown

@ehsannas ehsannas self-requested a review September 18, 2020 15:12
@ehsannas ehsannas changed the title Fix issues of RWByteAddressBuffer in the InitList [spirv] Fix issues of RWByteAddressBuffer in the InitList Sep 18, 2020
@ehsannas ehsannas added the spirv Work related to SPIR-V label Sep 18, 2020
@jaebaek jaebaek self-requested a review September 30, 2020 17:17
@jaebaek jaebaek self-assigned this Sep 30, 2020
Copy link
Copy Markdown
Collaborator

@jaebaek jaebaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add the following code?

diff --git a/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp b/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp
index 5baa27086..660d4243c 100644
--- a/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp
+++ b/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp
@@ -983,6 +983,11 @@ TEST_F(FileTest, RWByteAddressBufferAtomicMethods) {
   runFileTest("method.rw-byte-address-buffer.atomic.hlsl");
 }
 
+TEST_F(FileTest, InitializeListRWByteAddressBuffer) {
+  runFileTest("initializelist.rwbyteaddressbuffer.hlsl", Expect::Success,
+              /* runValidation */ false);
+}
+
 // For Buffer/RWBuffer methods
 TEST_F(FileTest, BufferLoad) { runFileTest("method.buffer.load.hlsl"); }
 TEST_F(FileTest, BufferGetDimensions) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have to use the following code for this unit test.

// Run: %dxc -T cs_6_0 -E main
RWBuffer<int> buffer1 : register(u1);
RWByteAddressBuffer buffer2 : register(u2);

// CHECK: [[Resource:%\w+]] = OpTypeStruct %type_RWByteAddressBuffer %uint
struct Resource {
  RWByteAddressBuffer rwbuffer;
  uint offset;
};

[numthreads(8, 1, 1)]
void main(uint globalId : SV_DispatchThreadID,
          uint localId  : SV_GroupThreadID,
          uint groupId  : SV_GroupID) {
// CHECK: [[buffer2:%\w+]] = OpVariable %_ptr_Uniform_type_RWByteAddressBuffer Uniform
  Resource resourceInfo2 = {buffer2, 2};
// CHECK: OpCompositeConstruct [[Resource]] [[buffer2]] %uint_2
  buffer1[0] = resourceInfo2.rwbuffer.Load(0);
}

RWByteAddressBuffer object in the initList should be handled like
OpaqueType RWBuffer or Texture2D.
@AppVeyorBot
Copy link
Copy Markdown

@jaebaek jaebaek merged commit 1450ea8 into microsoft:master Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spirv Work related to SPIR-V

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants