Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-03-2020, 14:26
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 323
Rept. Given: 2
Rept. Rcvd 19 Times in 7 Posts
Thanks Given: 1
Thanks Rcvd at 41 Times in 26 Posts
jonwil Reputation: 19
Reverse engineering compiled HLSL shaders?

Anyone got any tips (or tools or other things) for reverse engineering compiled D3D HLSL shaders (in this case shader model 5.0 shaders)
More specifically, tools that can decompile such shaders or references on how to turn the ASM back into something easier to understand...

Last edited by jonwil; 07-03-2020 at 14:46.
Reply With Quote
  #2  
Old 07-03-2020, 19:06
ian ian is offline
Friend
 
Join Date: Jul 2019
Posts: 28
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 27
Thanks Rcvd at 37 Times in 15 Posts
ian Reputation: 1
FXDIS is a simple Win32 command-line tool written in C/C++ with the MIT license forked from the relatively new (and experimental) Mesa "D3D1X" module.
This tool can disassemble Shader Model 4/5 binary shaders created by Microsoft's DirectX v10/11 shader compiler.
Download Link
Reply With Quote
  #3  
Old 09-05-2020, 02:00
floaters floaters is offline
Friend
 
Join Date: Apr 2018
Posts: 8
Rept. Given: 0
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 6
Thanks Rcvd at 6 Times in 3 Posts
floaters Reputation: 1
I've had a look at FXDIS once but found it not working/crashing with not so trivial shaders. Also it only outputs assembly and no hlsl, so the result is not that easy to read for something more complex.

Another way is if you can manage to convert the byte code to SPIR-V somehow. There are many great tools to analyze and even decompile SPIR-V back to HLSL and GLSL:

SPIRV Cross
SPIRV Viewer

There is a way to convert DXIL (shader model 6) to SPIRV with dxil-spirv

And a way to upgrade d3d byte code to shader model 6 with DirectXShaderCompiler

So a way to decompile to GLSL/HLSL is there, but a lot of intermediate steps where things could fail. Good luck
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT +8. The time now is 00:49.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX
( 1998 - 2020 )