Advertisement Jump to content
Sign in to follow this  
zolwik

HLSL compiler bug?

This topic is 1878 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 had a problem reading data with compute shader from const buffer - shader read garbage. What seemed confusing - graphic diagnostics from VS 2013 showed correct data in the buffer. After hours of pain I checked shader disassemble and found out that const buffer I register to slot 1 IS SOMEHOW MOVED TO SLOT 0! The const buffer from slot 0 got cut out, just because I don't use it in that particular function. When I switched const buffer registers - it started to work as I expected.

 

I suppose compiler should not change const buffer slots?

 

 

Shader cbuffers:

cbuffer Region : register( c0 )
{
	RegionData _region;
};

cbuffer Phase : register( c1 )  <- SLOT 1 !!!
{
	PhaseData _phase;
};

Disassemble of bindings:

Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384

// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Pingpong                              UAV    uint         buf    3        1
// Phase                             cbuffer      NA          NA    0        1  <- SLOT 0!!!

<...>

      cs_5_0
      dcl_globalFlags refactoringAllowed
      dcl_constantbuffer cb0[1], immediateIndexed    <- cb0!!!
      dcl_uav_typed_buffer (uint,uint,uint,uint) u3
      dcl_temps 1
      dcl_thread_group 1, 1, 1

<...>
Edited by zolwik

Share this post


Link to post
Share on other sites
Advertisement
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!