Jump to content
  • Advertisement
Sign in to follow this  
Martin Perry

DX11 [DX11] Compute Shader - shared memory problem

This topic is 2786 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have simple piece of code...

DecompressedShared is marked as groupshared, Decompressed is RWStructuredBuffer, lastDecompressedIndex is groupshared variable

uint index = 0;
for (uint j = lastDecompressedIndex; j < (lastDecompressedIndex + 2); j++)
Decompressed[j] = DecompressedShared[index];

Hovewer.. if I use code above, i got wrong result A | 0 | C | 0 ....
If I use this code instead:

Decompressed[lastDecompressedIndex + 0] = DecompressedShared[0];
Decompressed[lastDecompressedIndex + 1] = DecompressedShared[1];

I got correct result A | B | C | D ...

I dont understand it...huh.png

Share this post

Link to post
Share on other sites
You should check the assembly. I would bet that the compiler is going to do wacky things with that loop since it will have to re-load the value of lastDecompressedIndex for every loop iteration. I would try storing the value in a local variable so that it gets stored in a register, and see how that changes the resulting assembly code.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!