Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   Reverse engineering compiled HLSL shaders? (https://forum.exetools.com/showthread.php?t=19576)

jonwil 07-03-2020 14:26

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...

ian 07-03-2020 19:06

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

floaters 09-05-2020 02:00

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


All times are GMT +8. The time now is 14:10.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX