Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AndresTraks/HlslDecompiler

Repository files navigation

HlslDecompiler

Decompiles Shader Model 3.0 shaders into HLSL code

Usage

HlslDecompiler [--ast] [--print] 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, simplifying it and compiling to HLSL:

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

About

Decompiles Shader Model 1–4 shaders into HLSL code (work in progress)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /