-
Notifications
You must be signed in to change notification settings - Fork 19
Various fixes / improvements to the old FX9 decompiler #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Now the disassembler can execute the index shader to choose the default shader array element when writing out technique passes
which contains descriptive names instead of registers
mainly for correct handling of write masks
So it can be passed directly to string.Format
|
Thanks a lot for this PR, it's extremely useful for a project I'm currently working on to decompile some DX9 shader bytecode. The output is the best I've seen so far and makes it much easier to understand what's going on. |
You're welcome, and thanks for the compliment, I feel so happy when reading them xD
You can try to fix them yourself, just remember to run the unit tests after the changes (currently my version passes 992 out of 1008 test cases in |
|
Got it thanks ! I'm not super familiar with shaders but hopefully I should be able to study your code and add the missing instructions (I think it's the saturate one that wasn't implemented in my case). I'll make a PR when I have the time, thanks again for your great work ! |
|
@lanyizi , can I disassemble a shader in this format? |
|
@Albeoris from what I see, that file is already disassembled, isn't it?
However, there are existing projects like AssetRipper which should be able to extract many types of Unity Assets, including shaders IIRC. I suggest you to take a look at those projects, they also have a Discord channel. |
|
@lanyizi , yeah. As far as I understand, this is the format of precompiled shaders that used older versions of Unity. Judging by the instructions, this is HLSL: |
|
Hello! @lanyizi I noticed that you made a pull request for a DirectX9 Shader Decompiler at GitHub, and I was wondering if you could maybe help with this? I'm currently attempting to Decompile a Shader for Guitar Hero: World Tour on PC but I get this traceback whenever I try to decompile it, I would appreciate the help if you can since it would be really great to have this Shader fixed, thank you and have a great day! System.NotImplementedException: Saturate, PartialPrecision |
|
Update: I was looking at the shader's assembly and I noticed that it had an odd assembly line that's most likely not supported by your decompiler.... from HairShader_0_ps0.fxc 'dp3_sat_pp r1.w, r1, r2' These three assembly lines uses '_sat_pp' in their file, and it's mostly likely a combination of PartialPrecision and Saturate. |
AsmMatchesFxcpasses! (Failing disassembly tests #9)DX9Tests, 992 cases have succeeded, only 16 cases have failed (mainly because there are still some unimplemented instructions).The
HlslAsthas been broken by me (mainly because I don't know how to let its nodes to support relative addressing), soHlslWriter'sdoAstAnalysisoption will no longer work, but in my opinion that won't be a big deal since you're working on a new common IR design anyway ;)c0 c1 c2RegisterState.CtabOverride(since preshader would overwrite constant buffer)