Skip to content

Decompiles Shader Model 3.0 shaders into HLSL code (work in progress)

License

Notifications You must be signed in to change notification settings

AndresTraks/HlslDecompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3aaa264 · Jan 26, 2025
Jan 26, 2025
Jan 26, 2025
Jan 26, 2025
Jun 23, 2022
May 8, 2021
Dec 15, 2024
Apr 28, 2021
Jul 21, 2018
Jan 19, 2025
Dec 8, 2024
Apr 11, 2021

Repository files navigation

HlslDecompiler

Decompiles Shader Model 3.0 shaders into HLSL code

Usage

HlslDecompiler [--ast] shader.fxc

The program will output the assembly listing in shader.asm, e.g.

ps_3_0
def c0, 1, 0, 2, 0
dcl_texcoord v0.xz
mov oC0.x, -v0.z_abs
mad oC0.yzw, v0.xxx, c0.xyy, c0.yxz

and the decompiled HLSL code in shader.fx:

float4 main(float3 texcoord : TEXCOORD) : COLOR
{
	float4 o;

	o.x = -abs(texcoord.z);
	o.yzw = texcoord.xxx * float3(1, 0, 0) + float3(0, 1, 2);

	return o;
}

With the --ast option, the program will attempt generate more readable HLSL. It does this by taking the shader bytecode, constructing an abstract syntax tree, simplyfying it and compiling to HLSL:

float4 main(float3 texcoord : TEXCOORD) : COLOR
{
	return float4(-abs(texcoord.z), texcoord.x, 1, 2);
}

About

Decompiles Shader Model 3.0 shaders into HLSL code (work in progress)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published