Jump to content
  • Advertisement
Sign in to follow this  
CortexDragon

DX12 How do you view the asm code of your hlsl code?

Recommended Posts

How do you view the assembly code of your hlsl code?

I am using visual studio 2017 and an nvidia graphics card.

I tried looking in the visual studio graphics analyzer ("debug - graphics - start graphics debugging" from visual studio opens that) but where I would expect it to be it says "Enable GPU disassembly via View->Options->Graphics Diagnostics->Enable gather of GPU Disassembly.
The vsglog must be re-opened for this change to take effect."

However that isnt an option you can select.

 

I would actually prefer a way to view the asm without having to capture a frame, as my program doesnt do well in the visual studio graphics analyzer

When I try to playback a captured frame I get "An error has occured. Playback of your application may be incomplete (HRESULT = 0x00630000)"

However I am able to play back captured frames of the microsoft samples, but I am still not able to see asm code with them.

Edited by CortexDragon

Share this post


Link to post
Share on other sites
Advertisement

How do you compile your HLSL code? 

I use FXC.EXE, the command line tool. You can call it with "/?",  if I remember correctly, to see all the options. I output the compiled binary for the game to use and also the ASM in a text file in case I want to view it later. 

You can also choose your optimisation level and whether to embed debug information into the binary or not -- when trying to get visual debuggers working it's best to compile your shaders in that mode. 

Share this post


Link to post
Share on other sites

Like Hodgman, I will usually use FXC if I want  to see the bytecode for a shader. FXC can also disassemble a shader that's saved as a binary file.

RenderDoc also works well if you want to see shaders from a running program. 

Share this post


Link to post
Share on other sites

Thankyou everyone - the FXC.exe worked perfectly to make the assembly code.

Previously I had just been using the D3DCompileFromFile function to compile my hlsl.

 

Share this post


Link to post
Share on other sites

Be careful about optimizing the directx bytecode. Optimization to it usually does not translate well to the final uCode of vendors and may even give the driver compiler a harder time.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!