3Dmigoto now open-source...
  24 / 141    
I'll go ahead and give the new version a try. And thanks for the instructions. It's been a while since I last posted, so I guess I should have mentioned again that I had already managed to figure out how to disable the shaders using iniparameters, but the issue is that once I mark the shader it becomes white. If I were looking to just disable the shader that wouldn't be an issue, but since I want to toggle it on/off that's not very ideal. I also expect that will affect any shaders that I try to fix. From the code provided, any idea what's causing the shader to have it's color changed? You mentioned before it could be a decompiler related error.
I'll go ahead and give the new version a try.

And thanks for the instructions. It's been a while since I last posted, so I guess I should have mentioned again that I had already managed to figure out how to disable the shaders using iniparameters, but the issue is that once I mark the shader it becomes white. If I were looking to just disable the shader that wouldn't be an issue, but since I want to toggle it on/off that's not very ideal. I also expect that will affect any shaders that I try to fix. From the code provided, any idea what's causing the shader to have it's color changed? You mentioned before it could be a decompiler related error.

3D Gaming Rig: CPU: i7 7700K @ 4.9Ghz | Mobo: Asus Maximus Hero VIII | RAM: Corsair Dominator 16GB | GPU: 2 x GTX 1080 Ti SLI | 3xSSDs for OS and Apps, 2 x HDD's for 11GB storage | PSU: Seasonic X-1250 M2| Case: Corsair C70 | Cooling: Corsair H115i Hydro cooler | Displays: Asus PG278QR, BenQ XL2420TX & BenQ HT1075 | OS: Windows 10 Pro + Windows 7 dual boot

Like my fixes? Dontations can be made to: www.paypal.me/DShanz or rshannonca@gmail.com
Like electronic music? Check out: www.soundcloud.com/dj-ryan-king

Posted 05/22/2015 06:49 AM   
Just tried the update, and unfortunately I'm getting a crash on startup :/ Did not see anything meaningful in the log, but perhaps someone here might [code] D3D11 DLL starting init - Sat May 23 01:25:22 2015 ----------- d3dx.ini settings ----------- [Logging] calls=1 input=1 [System] [Device] [Stereo] [Rendering] override_directory=X:\SteamLibrary\steamapps\common\killingfloor2\Binaries\Win64\ShaderFixes cache_directory=X:\SteamLibrary\steamapps\common\killingfloor2\Binaries\Win64\ShaderCache use_criticalsection=1 rasterizer_disable_scissor=1 dump_usage=1 ... missing automatic ini section [Hunting] hunting=1 marking_mode=0 toggle_hunting=INSERT next_pixelshader=VK_NUMPAD2 previous_pixelshader=VK_NUMPAD1 mark_pixelshader=VK_NUMPAD3 take_screenshot=VK_SNAPSHOT next_indexbuffer=VK_NUMPAD8 previous_indexbuffer=VK_NUMPAD7 mark_indexbuffer=VK_NUMPAD9 next_vertexshader=VK_NUMPAD5 previous_vertexshader=VK_NUMPAD4 mark_vertexshader=VK_NUMPAD6 next_rendertarget=VK_MULTIPLY previous_rendertarget=VK_DIVIDE mark_rendertarget=VK_SUBTRACT done_hunting=VK_ADD reload_fixes=VK_F10 repeat_rate=6 [Constants] x=0.00 y=0.00 z=0.00 w=0.00 Hooked_LoadLibraryExW switching to original dll: original_nvapi64.dll to C:\Windows\system32\nvapi64.dll. *** D3D11 DLL successfully initialized. *** Trying to load original_d3d11.dll Hooked_LoadLibraryExW switching to original dll: original_d3d11.dll to C:\Windows\system32\d3d11.dll. D3D11CreateDevice called with adapter = 0000000000000000 Hooked_CreateDXGIFactory1 called with riid: IDXGIFactory calling original CreateDXGIFactory1 API CreateDXGIFactory1 returned factory = 000000000B300BD0, result = 0 HackerDXGIFactory1::EnumAdapters1(class HackerDXGIFactory1) called: adapter #0 requested returns adapter: NVIDIA GeForce GTX 780, sysmem=0, vidmem=-1162149888, flags=0 returns result = 0, handle = 0000000006EE2250 Replaced Hooked_LoadLibraryExW for: C:\Windows\system32\nvapi64.dll to nvapi64.dll. Replaced Hooked_LoadLibraryExW for: C:\Windows\system32\nvapi64.dll to nvapi64.dll. HackerUnknown::Release(class HackerDXGIFactory1), counter=1, this=000000000B2FE4A0 created NVAPI stereo handle. Handle = 00000000070A2800 creating stereo parameter texture. stereo texture created, handle = 000000000B3AB410 creating stereo parameter resource view. stereo texture resource view created, handle = 000000000347F1D0. creating .ini constant parameter texture. IniParam texture created, handle = 000000000B3ABA90 creating IniParam resource view. Iniparams resource view created, handle = 000000000347FA10. HackerDevice 000000000348F330 created to wrap 0000000007016918 HackerContext 000000000B3DC820 created to wrap 0000000006FB2840 returns result = 0, device handle = 0000000007016918, device wrapper = 000000000348F330, context handle = 0000000006FB2840, context wrapper = 000000000B3DC820 created HackerDXGIDevice wrapper = 000000000054ECD0 of 00000000070163A8 HackerDXGIDevice::GetAdapter(class HackerDXGIDevice) called with: 000000000054ECC8 created HackerDXGIAdapter wrapper = 000000000B3A63D0 of 0000000006EE2250 returns result = 0 HackerDXGIAdapter::GetDesc(class HackerDXGIAdapter) called returns adapter: NVIDIA GeForce GTX 780, sysmem=0, vidmem=-1162149888 HackerUnknown::Release(class HackerDXGIAdapter), counter=2, this=000000000B3A63D0 Hooked_CreateDXGIFactory called with riid: IDXGIFactory calling original CreateDXGIFactory API CreateDXGIFactory returned factory = 00000000070BFD80, result = 0 HackerDXGIFactory::EnumAdapters(class HackerDXGIFactory) adapter 0 requested created HackerDXGIAdapter wrapper = 000000000B3A6490 of 000000000B400F50 returns result = 0 HackerDXGIAdapter::GetDesc(class HackerDXGIAdapter) called returns adapter: NVIDIA GeForce GTX 780, sysmem=0, vidmem=-1162149888 D3D11CreateDevice called with adapter = 000000000B3A6490 HackerDXGIObject::GetPrivateData(class HackerDXGIAdapter) called with GUID: {1D6AD054-FB2F-4000-B3AB-E873A9131A7C} returns result = 887a0002 HackerUnknown::AddRef(class HackerDXGIAdapter), counter=2, this=000000000B3A6490 HackerDXGIObject::GetPrivateData(class HackerDXGIAdapter) called with GUID: [/code]
Just tried the update, and unfortunately I'm getting a crash on startup :/

Did not see anything meaningful in the log, but perhaps someone here might

D3D11 DLL starting init  -  Sat May 23 01:25:22 2015


----------- d3dx.ini settings -----------
[Logging]
calls=1
input=1
[System]
[Device]
[Stereo]
[Rendering]
override_directory=X:\SteamLibrary\steamapps\common\killingfloor2\Binaries\Win64\ShaderFixes
cache_directory=X:\SteamLibrary\steamapps\common\killingfloor2\Binaries\Win64\ShaderCache
use_criticalsection=1
rasterizer_disable_scissor=1
dump_usage=1
... missing automatic ini section
[Hunting]
hunting=1
marking_mode=0
toggle_hunting=INSERT
next_pixelshader=VK_NUMPAD2
previous_pixelshader=VK_NUMPAD1
mark_pixelshader=VK_NUMPAD3
take_screenshot=VK_SNAPSHOT
next_indexbuffer=VK_NUMPAD8
previous_indexbuffer=VK_NUMPAD7
mark_indexbuffer=VK_NUMPAD9
next_vertexshader=VK_NUMPAD5
previous_vertexshader=VK_NUMPAD4
mark_vertexshader=VK_NUMPAD6
next_rendertarget=VK_MULTIPLY
previous_rendertarget=VK_DIVIDE
mark_rendertarget=VK_SUBTRACT
done_hunting=VK_ADD
reload_fixes=VK_F10
repeat_rate=6
[Constants]
x=0.00
y=0.00
z=0.00
w=0.00
Hooked_LoadLibraryExW switching to original dll: original_nvapi64.dll to C:\Windows\system32\nvapi64.dll.

*** D3D11 DLL successfully initialized. ***

Trying to load original_d3d11.dll
Hooked_LoadLibraryExW switching to original dll: original_d3d11.dll to C:\Windows\system32\d3d11.dll.


D3D11CreateDevice called with adapter = 0000000000000000
Hooked_CreateDXGIFactory1 called with riid: IDXGIFactory
calling original CreateDXGIFactory1 API
CreateDXGIFactory1 returned factory = 000000000B300BD0, result = 0
HackerDXGIFactory1::EnumAdapters1(class HackerDXGIFactory1) called: adapter #0 requested
returns adapter: NVIDIA GeForce GTX 780, sysmem=0, vidmem=-1162149888, flags=0
returns result = 0, handle = 0000000006EE2250
Replaced Hooked_LoadLibraryExW for: C:\Windows\system32\nvapi64.dll to nvapi64.dll.
Replaced Hooked_LoadLibraryExW for: C:\Windows\system32\nvapi64.dll to nvapi64.dll.
HackerUnknown::Release(class HackerDXGIFactory1), counter=1, this=000000000B2FE4A0
created NVAPI stereo handle. Handle = 00000000070A2800
creating stereo parameter texture.
stereo texture created, handle = 000000000B3AB410
creating stereo parameter resource view.
stereo texture resource view created, handle = 000000000347F1D0.
creating .ini constant parameter texture.
IniParam texture created, handle = 000000000B3ABA90
creating IniParam resource view.
Iniparams resource view created, handle = 000000000347FA10.
HackerDevice 000000000348F330 created to wrap 0000000007016918
HackerContext 000000000B3DC820 created to wrap 0000000006FB2840
returns result = 0, device handle = 0000000007016918, device wrapper = 000000000348F330, context handle = 0000000006FB2840, context wrapper = 000000000B3DC820

created HackerDXGIDevice wrapper = 000000000054ECD0 of 00000000070163A8
HackerDXGIDevice::GetAdapter(class HackerDXGIDevice) called with: 000000000054ECC8
created HackerDXGIAdapter wrapper = 000000000B3A63D0 of 0000000006EE2250
returns result = 0
HackerDXGIAdapter::GetDesc(class HackerDXGIAdapter) called
returns adapter: NVIDIA GeForce GTX 780, sysmem=0, vidmem=-1162149888
HackerUnknown::Release(class HackerDXGIAdapter), counter=2, this=000000000B3A63D0
Hooked_CreateDXGIFactory called with riid: IDXGIFactory
calling original CreateDXGIFactory API
CreateDXGIFactory returned factory = 00000000070BFD80, result = 0
HackerDXGIFactory::EnumAdapters(class HackerDXGIFactory) adapter 0 requested
created HackerDXGIAdapter wrapper = 000000000B3A6490 of 000000000B400F50
returns result = 0
HackerDXGIAdapter::GetDesc(class HackerDXGIAdapter) called
returns adapter: NVIDIA GeForce GTX 780, sysmem=0, vidmem=-1162149888


D3D11CreateDevice called with adapter = 000000000B3A6490
HackerDXGIObject::GetPrivateData(class HackerDXGIAdapter) called with GUID: {1D6AD054-FB2F-4000-B3AB-E873A9131A7C}
returns result = 887a0002
HackerUnknown::AddRef(class HackerDXGIAdapter), counter=2, this=000000000B3A6490
HackerDXGIObject::GetPrivateData(class HackerDXGIAdapter) called with GUID:

3D Gaming Rig: CPU: i7 7700K @ 4.9Ghz | Mobo: Asus Maximus Hero VIII | RAM: Corsair Dominator 16GB | GPU: 2 x GTX 1080 Ti SLI | 3xSSDs for OS and Apps, 2 x HDD's for 11GB storage | PSU: Seasonic X-1250 M2| Case: Corsair C70 | Cooling: Corsair H115i Hydro cooler | Displays: Asus PG278QR, BenQ XL2420TX & BenQ HT1075 | OS: Windows 10 Pro + Windows 7 dual boot

Like my fixes? Dontations can be made to: www.paypal.me/DShanz or rshannonca@gmail.com
Like electronic music? Check out: www.soundcloud.com/dj-ryan-king

Posted 05/23/2015 05:46 AM   
What are your system specs? If you can add them to your signature, that makes things easier for everyone. If you are running Win7, the latest version 1.1.8 needs the Evil update KB2670838. Version 1.0.1 is the most stable released version. If you are on Win8/8.1, the OS doesn't work well with 3D.
What are your system specs? If you can add them to your signature, that makes things easier for everyone.

If you are running Win7, the latest version 1.1.8 needs the Evil update KB2670838. Version 1.0.1 is the most stable released version. If you are on Win8/8.1, the OS doesn't work well with 3D.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/23/2015 08:51 AM   
Crap, yeah, I specifically made it a point to mention that I had checked and confirmed I had the "evil" update installed, and somehow managed to forget to do that. Even tried to reinstall it. I've added my system to my sig to fill in the rest. I think I was on v1.0.1 before I tried installing the new version with the overlay, and even then I was still having the shaders turn white after marking. Just did some additional testing, and I was able to install the 3DMigoto 1.1.8 32bit version on another game (Strike Suit Inifinity) and that work perfectly, overlay and all. Marking shaders had no undesirable effect there. Just tried reinstalling the 64bit version on Killing Floor 2, and still crashing, so maybe it has something to do with that particular version. Not sure what other 64 bit DX11 games I might have, but if I can think of any I'll test it there and see.
Crap, yeah, I specifically made it a point to mention that I had checked and confirmed I had the "evil" update installed, and somehow managed to forget to do that. Even tried to reinstall it. I've added my system to my sig to fill in the rest. I think I was on v1.0.1 before I tried installing the new version with the overlay, and even then I was still having the shaders turn white after marking.

Just did some additional testing, and I was able to install the 3DMigoto 1.1.8 32bit version on another game (Strike Suit Inifinity) and that work perfectly, overlay and all. Marking shaders had no undesirable effect there. Just tried reinstalling the 64bit version on Killing Floor 2, and still crashing, so maybe it has something to do with that particular version. Not sure what other 64 bit DX11 games I might have, but if I can think of any I'll test it there and see.

3D Gaming Rig: CPU: i7 7700K @ 4.9Ghz | Mobo: Asus Maximus Hero VIII | RAM: Corsair Dominator 16GB | GPU: 2 x GTX 1080 Ti SLI | 3xSSDs for OS and Apps, 2 x HDD's for 11GB storage | PSU: Seasonic X-1250 M2| Case: Corsair C70 | Cooling: Corsair H115i Hydro cooler | Displays: Asus PG278QR, BenQ XL2420TX & BenQ HT1075 | OS: Windows 10 Pro + Windows 7 dual boot

Like my fixes? Dontations can be made to: www.paypal.me/DShanz or rshannonca@gmail.com
Like electronic music? Check out: www.soundcloud.com/dj-ryan-king

Posted 05/24/2015 01:17 AM   
Sorry for the slow response here. The shaders going white after marking is a sign that the Decompiler introduced a flaw in the shader after marking. The CopyOnMark function takes a given shader that you mark, Decompiles it, then recompiles it, and makes it the active shader. The reason I do that is for this exact purpose- to see if the Decompile has introduced any problems. This will be game/shader dependent, and in this case it clearly does. So next step is to provide us the shader code including the Asm at the bottom of the shader so we can take a look and see what went wrong. We sometimes hand-fix these sorts of problems as it's usually quicker. If it's something that seems common, I'll usually dig further to fix the underylying bug.
Sorry for the slow response here. The shaders going white after marking is a sign that the Decompiler introduced a flaw in the shader after marking.

The CopyOnMark function takes a given shader that you mark, Decompiles it, then recompiles it, and makes it the active shader. The reason I do that is for this exact purpose- to see if the Decompile has introduced any problems.

This will be game/shader dependent, and in this case it clearly does.


So next step is to provide us the shader code including the Asm at the bottom of the shader so we can take a look and see what went wrong.

We sometimes hand-fix these sorts of problems as it's usually quicker. If it's something that seems common, I'll usually dig further to fix the underylying bug.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/27/2015 12:05 AM   
Thanks for getting back to me on this, and all good on the response time, I'm sure your time is spread thin as is and a valuable commodity! I have provided the shader code for 4 various shaders in post #344: https://forums.geforce.com/default/topic/685657/3d-vision/3dmigoto-now-open-source-/post/4536269/#4536269 Are those sufficient enough for us to determine the issue, and any sort of pattern involved? Work/progress will be fairly slow, so as long as it's not overly complicated I wont have any issue with doing manual fixes on the issue, although if it's an easy enough bug to squash, all the better! LMK if you need any other info or dumps using other settings in the d3dx.ini file (although I should mention now that one prerequisite for getting the previous versions of 3DM to work for me was to ensure export_hlsl was set to 0, otherwise it crashed on startup).
Thanks for getting back to me on this, and all good on the response time, I'm sure your time is spread thin as is and a valuable commodity!

I have provided the shader code for 4 various shaders in post #344: https://forums.geforce.com/default/topic/685657/3d-vision/3dmigoto-now-open-source-/post/4536269/#4536269

Are those sufficient enough for us to determine the issue, and any sort of pattern involved? Work/progress will be fairly slow, so as long as it's not overly complicated I wont have any issue with doing manual fixes on the issue, although if it's an easy enough bug to squash, all the better! LMK if you need any other info or dumps using other settings in the d3dx.ini file (although I should mention now that one prerequisite for getting the previous versions of 3DM to work for me was to ensure export_hlsl was set to 0, otherwise it crashed on startup).

3D Gaming Rig: CPU: i7 7700K @ 4.9Ghz | Mobo: Asus Maximus Hero VIII | RAM: Corsair Dominator 16GB | GPU: 2 x GTX 1080 Ti SLI | 3xSSDs for OS and Apps, 2 x HDD's for 11GB storage | PSU: Seasonic X-1250 M2| Case: Corsair C70 | Cooling: Corsair H115i Hydro cooler | Displays: Asus PG278QR, BenQ XL2420TX & BenQ HT1075 | OS: Windows 10 Pro + Windows 7 dual boot

Like my fixes? Dontations can be made to: www.paypal.me/DShanz or rshannonca@gmail.com
Like electronic music? Check out: www.soundcloud.com/dj-ryan-king

Posted 05/27/2015 12:41 AM   
OK, sorry I didn't connect the dots that those are the white affect shaders. (too many games ;->) Those 4 shaders are short and sweet, and I don't think the Decompiler will generate those with an error. All of those instructions are well trodden ground. To simplify, let's just take one shader and make it work first. Are you certain that the shader in question is the one that causes the problem? For example, pull the shader out of the folder, launch the game, and look for a glitch. If it's there, that shader is not it. While the game is running, drop the shader in question back into ShaderFixes, and hit F10 to reload it live. If it glitches right then- then it is in fact the right problem. Please try that experiment and let me know if you are certain this is the shader.
OK, sorry I didn't connect the dots that those are the white affect shaders. (too many games ;->) Those 4 shaders are short and sweet, and I don't think the Decompiler will generate those with an error. All of those instructions are well trodden ground.

To simplify, let's just take one shader and make it work first.

Are you certain that the shader in question is the one that causes the problem? For example, pull the shader out of the folder, launch the game, and look for a glitch. If it's there, that shader is not it. While the game is running, drop the shader in question back into ShaderFixes, and hit F10 to reload it live. If it glitches right then- then it is in fact the right problem.

Please try that experiment and let me know if you are certain this is the shader.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/27/2015 12:55 AM   
Update- definitely a Decompiler bug here. I took a quick look at the first shader in your post, and it definitely generates wrong code. Change the variable from 'bDecompressSceneColor' to the next variable of 'InverseGamma', and that will generate identical code. [code]cbuffer _Globals : register(b0) { float4x4 ScreenToWorldMatrix : packoffset(c0); bool bDecompressSceneColor : packoffset(c4); float InverseGamma : packoffset(c4.y); } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : COLOR0, float4 v1 : COLOR1, float4 v2 : TEXCOORD0, float4 v3 : TEXCOORD1, out float4 o0 : SV_Target0) { float4 r0; uint4 bitmask, uiDest; float4 fDest; r0.xyzw = v0.xyzw * v3.xyzw + v2.xyzw; r0.xyz = saturate(r0.xyz); o0.w = v1.w * r0.w; r0.xyz = log2(r0.xyz); r0.xyz = InverseGamma * r0.xyz; // <--- o0.xyz = exp2(r0.xyz); return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // // Buffer Definitions: // // cbuffer $Globals // { // // float4x4 ScreenToWorldMatrix; // Offset: 0 Size: 64 [unused] // bool bDecompressSceneColor; // Offset: 64 Size: 4 [unused] // float InverseGamma; // Offset: 68 Size: 4 // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // $Globals cbuffer NA NA 0 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // COLOR 0 xyzw 0 NONE float xyzw // COLOR 1 xyzw 1 NONE float w // TEXCOORD 0 xyzw 2 NONE float xyzw // TEXCOORD 1 xyzw 3 NONE float xyzw // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Target 0 xyzw 0 TARGET float xyzw // ps_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[5], immediateIndexed dcl_input_ps linear v0.xyzw dcl_input_ps linear v1.w dcl_input_ps linear v2.xyzw dcl_input_ps linear v3.xyzw dcl_output o0.xyzw dcl_temps 1 mad r0.xyzw, v0.xyzw, v3.xyzw, v2.xyzw mov_sat r0.xyz, r0.xyzx mul o0.w, r0.w, v1.w log r0.xyz, r0.xyzx mul r0.xyz, r0.xyzx, cb0[4].yyyy exp o0.xyz, r0.xyzx ret // Approximately 7 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] Shader 2 and 4 have the same problem, and same manual fix should work. Shader 3 does not have any bugs, and generates identical code.
Update- definitely a Decompiler bug here. I took a quick look at the first shader in your post, and it definitely generates wrong code.

Change the variable from 'bDecompressSceneColor' to the next variable of 'InverseGamma', and that will generate identical code.

cbuffer _Globals : register(b0)
{
float4x4 ScreenToWorldMatrix : packoffset(c0);
bool bDecompressSceneColor : packoffset(c4);
float InverseGamma : packoffset(c4.y);
}

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : COLOR0,
float4 v1 : COLOR1,
float4 v2 : TEXCOORD0,
float4 v3 : TEXCOORD1,
out float4 o0 : SV_Target0)
{
float4 r0;
uint4 bitmask, uiDest;
float4 fDest;

r0.xyzw = v0.xyzw * v3.xyzw + v2.xyzw;
r0.xyz = saturate(r0.xyz);
o0.w = v1.w * r0.w;
r0.xyz = log2(r0.xyz);
r0.xyz = InverseGamma * r0.xyz; // <---
o0.xyz = exp2(r0.xyz);
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
// float4x4 ScreenToWorldMatrix; // Offset: 0 Size: 64 [unused]
// bool bDecompressSceneColor; // Offset: 64 Size: 4 [unused]
// float InverseGamma; // Offset: 68 Size: 4
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals cbuffer NA NA 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR 0 xyzw 0 NONE float xyzw
// COLOR 1 xyzw 1 NONE float w
// TEXCOORD 0 xyzw 2 NONE float xyzw
// TEXCOORD 1 xyzw 3 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[5], immediateIndexed
dcl_input_ps linear v0.xyzw
dcl_input_ps linear v1.w
dcl_input_ps linear v2.xyzw
dcl_input_ps linear v3.xyzw
dcl_output o0.xyzw
dcl_temps 1
mad r0.xyzw, v0.xyzw, v3.xyzw, v2.xyzw
mov_sat r0.xyz, r0.xyzx
mul o0.w, r0.w, v1.w
log r0.xyz, r0.xyzx
mul r0.xyz, r0.xyzx, cb0[4].yyyy
exp o0.xyz, r0.xyzx
ret
// Approximately 7 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/



Shader 2 and 4 have the same problem, and same manual fix should work.

Shader 3 does not have any bugs, and generates identical code.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/27/2015 01:25 AM   
Well I'll be... You're absolutely right on the money, down to the one shader not being an issue. I sure as Hell wouldn't have been able to pick that out, especially as quickly as that! So you managed to figure that out by comparing the HLSL at the top vs the ASM code at the bottom, and figured out where the inconsistency was? Guess that's why you have the ASM code there in the first place :D Cheers, now I can finally get started on hunting some actually broken shaders! I'm sure I'll be returning for more expertise in the near future. Thanks again!
Well I'll be... You're absolutely right on the money, down to the one shader not being an issue. I sure as Hell wouldn't have been able to pick that out, especially as quickly as that! So you managed to figure that out by comparing the HLSL at the top vs the ASM code at the bottom, and figured out where the inconsistency was? Guess that's why you have the ASM code there in the first place :D

Cheers, now I can finally get started on hunting some actually broken shaders! I'm sure I'll be returning for more expertise in the near future.

Thanks again!

3D Gaming Rig: CPU: i7 7700K @ 4.9Ghz | Mobo: Asus Maximus Hero VIII | RAM: Corsair Dominator 16GB | GPU: 2 x GTX 1080 Ti SLI | 3xSSDs for OS and Apps, 2 x HDD's for 11GB storage | PSU: Seasonic X-1250 M2| Case: Corsair C70 | Cooling: Corsair H115i Hydro cooler | Displays: Asus PG278QR, BenQ XL2420TX & BenQ HT1075 | OS: Windows 10 Pro + Windows 7 dual boot

Like my fixes? Dontations can be made to: www.paypal.me/DShanz or rshannonca@gmail.com
Like electronic music? Check out: www.soundcloud.com/dj-ryan-king

Posted 05/27/2015 03:04 AM   
Yup, that's why I added that original ASM section, so that I can quickly diff the compiled output from the fxc compiler and see what it looks like relative to the orignial. As an example diff, here is the comparison of the first one, where the Decompiler clearly misfired. [url]https://www.diffchecker.com/h388b9wf[/url] That's just for edification, I'm not expecting people to learn how to hand-fix this HLSL code, and I use these examples to drive bug fixes for the Decompiler. I added your shader here to the project for a future look.
Yup, that's why I added that original ASM section, so that I can quickly diff the compiled output from the fxc compiler and see what it looks like relative to the orignial. As an example diff, here is the comparison of the first one, where the Decompiler clearly misfired.

https://www.diffchecker.com/h388b9wf

That's just for edification, I'm not expecting people to learn how to hand-fix this HLSL code, and I use these examples to drive bug fixes for the Decompiler. I added your shader here to the project for a future look.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/27/2015 03:57 AM   
New update is out with the fixes that DarkStarSword made to the Decompiler to better handle int and uint vartypes when no header information is available. Also wired up Flugan's Assembler to the game load sequence, so you can now edit asm text shaders instead. The reason to do this is for shaders like the Witcher3 ones that have no header information. The only way to get the right code back out is to stay in assembly. It's pretty rough and ready and the moment, only works at game load, not on F10 or Mark just yet. Set the export_shaders=1 to get the Asm text shaders in the ShaderCache folder. Hash ids will match with HLSL variants. When you find a shader that needs help, you can manually move the shader into the ShaderFixes folder. If an HLSL shader is there, it takes precedence, so make sure you only have the asm one. Check the log for errors by looking for your hash id. Barely tested, but I successfully disabled the shadows in Witcher3 with a 'mov o0, l(0,0,0,0)' instruction. https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.10.zip
New update is out with the fixes that DarkStarSword made to the Decompiler to better handle int and uint vartypes when no header information is available.

Also wired up Flugan's Assembler to the game load sequence, so you can now edit asm text shaders instead. The reason to do this is for shaders like the Witcher3 ones that have no header information. The only way to get the right code back out is to stay in assembly.

It's pretty rough and ready and the moment, only works at game load, not on F10 or Mark just yet.

Set the export_shaders=1 to get the Asm text shaders in the ShaderCache folder. Hash ids will match with HLSL variants. When you find a shader that needs help, you can manually move the shader into the ShaderFixes folder. If an HLSL shader is there, it takes precedence, so make sure you only have the asm one.

Check the log for errors by looking for your hash id.


Barely tested, but I successfully disabled the shadows in Witcher3 with a 'mov o0, l(0,0,0,0)' instruction.


https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.10.zip

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/27/2015 02:35 PM   
[quote="bo3b"]New update is out with the fixes that DarkStarSword made to the Decompiler to better handle int and uint vartypes when no header information is available. Also wired up Flugan's Assembler to the game load sequence, so you can now edit asm text shaders instead. The reason to do this is for shaders like the Witcher3 ones that have no header information. The only way to get the right code back out is to stay in assembly. It's pretty rough and ready and the moment, only works at game load, not on F10 or Mark just yet. Set the export_shaders=1 to get the Asm text shaders in the ShaderCache folder. Hash ids will match with HLSL variants. When you find a shader that needs help, you can manually move the shader into the ShaderFixes folder. If an HLSL shader is there, it takes precedence, so make sure you only have the asm one. Check the log for errors by looking for your hash id. Barely tested, but I successfully disabled the shadows in Witcher3 with a 'mov o0, l(0,0,0,0)' instruction. https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.10.zip[/quote] Hi bo3b - I am not home yet so can't try any of this, but does this mean that the ground reflections shader can be fixed this way?
bo3b said:New update is out with the fixes that DarkStarSword made to the Decompiler to better handle int and uint vartypes when no header information is available.

Also wired up Flugan's Assembler to the game load sequence, so you can now edit asm text shaders instead. The reason to do this is for shaders like the Witcher3 ones that have no header information. The only way to get the right code back out is to stay in assembly.

It's pretty rough and ready and the moment, only works at game load, not on F10 or Mark just yet.

Set the export_shaders=1 to get the Asm text shaders in the ShaderCache folder. Hash ids will match with HLSL variants. When you find a shader that needs help, you can manually move the shader into the ShaderFixes folder. If an HLSL shader is there, it takes precedence, so make sure you only have the asm one.

Check the log for errors by looking for your hash id.


Barely tested, but I successfully disabled the shadows in Witcher3 with a 'mov o0, l(0,0,0,0)' instruction.


https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.10.zip


Hi bo3b - I am not home yet so can't try any of this, but does this mean that the ground reflections shader can be fixed this way?

Rig: Intel i7-8700K @4.7GHz, 16Gb Ram, SSD, GTX 1080Ti, Win10x64, Asus VG278

Posted 05/27/2015 04:10 PM   
Looking at how a HLSL fix looks in ASM by disassembling the compiled bin. Good to know if attempting a ASM fix. I find it interesting to compare: ASM: [code] vs_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[2], immediateIndexed dcl_resource_texture1d (float,float,float,float) t120 dcl_resource_texture2d (float,float,float,float) t125 dcl_input v0.xyzw dcl_output_siv o0.xyzw, position dcl_temps 1 dp4 r0.x, v0.xyzw, cb0[0].xyzw ld_indexable(texture2d)(float,float,float,float) r0.y, l(0, 0, 0, 0), t125.yxzw ld_indexable(texture1d)(float,float,float,float) r0.z, l(0, 0, 0, 0), t120.yzxw mad o0.x, -r0.y, r0.z, r0.x dp4 o0.y, v0.xyzw, cb0[1].xyzw mov o0.zw, l(0,0,0,1.000000) ret [/code] HLSL: [code] //HUD cbuffer Constants : register(b0) { float4 mvp[2] : packoffset(c0); } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : SV_Position0, out float4 o0 : SV_Position0) { o0.x = dot(v0.xyzw, mvp[0].xyzw); o0.y = dot(v0.xyzw, mvp[1].xyzw); o0.zw = float2(0.000000e+000,1.000000e+000); float4 stereo = StereoParams.Load(0); float4 params = IniParams.Load(0); o0.x -= stereo.x*(params.x); return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vs_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[2], immediateIndexed dcl_input v0.xyzw dcl_output_siv o0.xyzw, position dp4 o0.x, v0.xyzw, cb0[0].xyzw dp4 o0.y, v0.xyzw, cb0[1].xyzw mov o0.zw, l(0,0,0,1.000000) ret // Approximately 4 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code]
Looking at how a HLSL fix looks in ASM by disassembling the compiled bin.
Good to know if attempting a ASM fix.

I find it interesting to compare:

ASM:
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[2], immediateIndexed
dcl_resource_texture1d (float,float,float,float) t120
dcl_resource_texture2d (float,float,float,float) t125
dcl_input v0.xyzw
dcl_output_siv o0.xyzw, position
dcl_temps 1
dp4 r0.x, v0.xyzw, cb0[0].xyzw
ld_indexable(texture2d)(float,float,float,float) r0.y, l(0, 0, 0, 0), t125.yxzw
ld_indexable(texture1d)(float,float,float,float) r0.z, l(0, 0, 0, 0), t120.yzxw
mad o0.x, -r0.y, r0.z, r0.x
dp4 o0.y, v0.xyzw, cb0[1].xyzw
mov o0.zw, l(0,0,0,1.000000)
ret


HLSL:
//HUD
cbuffer Constants : register(b0)
{
float4 mvp[2] : packoffset(c0);
}

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : SV_Position0,
out float4 o0 : SV_Position0)
{
o0.x = dot(v0.xyzw, mvp[0].xyzw);
o0.y = dot(v0.xyzw, mvp[1].xyzw);
o0.zw = float2(0.000000e+000,1.000000e+000);

float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
o0.x -= stereo.x*(params.x);

return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[2], immediateIndexed
dcl_input v0.xyzw
dcl_output_siv o0.xyzw, position
dp4 o0.x, v0.xyzw, cb0[0].xyzw
dp4 o0.y, v0.xyzw, cb0[1].xyzw
mov o0.zw, l(0,0,0,1.000000)
ret
// Approximately 4 instruction slots used
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

Thanks to everybody using my assembler it warms my heart.
To have a critical piece of code that everyone can enjoy!
What more can you ask for?

donations: ulfjalmbrant@hotmail.com

Posted 05/27/2015 06:44 PM   
[quote="mike_ar69"][quote="bo3b"]New update is out with the fixes that DarkStarSword made to the Decompiler to better handle int and uint vartypes when no header information is available. Also wired up Flugan's Assembler to the game load sequence, so you can now edit asm text shaders instead. The reason to do this is for shaders like the Witcher3 ones that have no header information. The only way to get the right code back out is to stay in assembly. It's pretty rough and ready and the moment, only works at game load, not on F10 or Mark just yet. Set the export_shaders=1 to get the Asm text shaders in the ShaderCache folder. Hash ids will match with HLSL variants. When you find a shader that needs help, you can manually move the shader into the ShaderFixes folder. If an HLSL shader is there, it takes precedence, so make sure you only have the asm one. Check the log for errors by looking for your hash id. Barely tested, but I successfully disabled the shadows in Witcher3 with a 'mov o0, l(0,0,0,0)' instruction. https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.10.zip[/quote] Hi bo3b - I am not home yet so can't try any of this, but does this mean that the ground reflections shader can be fixed this way?[/quote] Yep. Should work. I'm working on finishing the integration to the full workflow, including F10 reload and CopyOnMark because those are seriously valuable. After that's working I can take a look at the reflection shader. The sequence shown by Flugan there is what we'll use for shaders in Asm. Very much the same as HelixMod. t125 is StereoParams, t120 is IniParams. When I get a chance I'll document the Prime Directive on the wiki for this style. [code]dcl_resource_texture1d (float,float,float,float) t120 dcl_resource_texture2d (float,float,float,float) t125 ... ld_indexable(texture2d)(float,float,float,float) r35.xyzw, l(0, 0, 0, 0), t125.xyzw ld_indexable(texture1d)(float,float,float,float) r30.xyzw, l(0, 0, 0, 0), t120.zyzw [/code]
mike_ar69 said:
bo3b said:New update is out with the fixes that DarkStarSword made to the Decompiler to better handle int and uint vartypes when no header information is available.

Also wired up Flugan's Assembler to the game load sequence, so you can now edit asm text shaders instead. The reason to do this is for shaders like the Witcher3 ones that have no header information. The only way to get the right code back out is to stay in assembly.

It's pretty rough and ready and the moment, only works at game load, not on F10 or Mark just yet.

Set the export_shaders=1 to get the Asm text shaders in the ShaderCache folder. Hash ids will match with HLSL variants. When you find a shader that needs help, you can manually move the shader into the ShaderFixes folder. If an HLSL shader is there, it takes precedence, so make sure you only have the asm one.

Check the log for errors by looking for your hash id.


Barely tested, but I successfully disabled the shadows in Witcher3 with a 'mov o0, l(0,0,0,0)' instruction.

https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.10.zip

Hi bo3b - I am not home yet so can't try any of this, but does this mean that the ground reflections shader can be fixed this way?

Yep. Should work. I'm working on finishing the integration to the full workflow, including F10 reload and CopyOnMark because those are seriously valuable. After that's working I can take a look at the reflection shader.

The sequence shown by Flugan there is what we'll use for shaders in Asm. Very much the same as HelixMod.

t125 is StereoParams, t120 is IniParams. When I get a chance I'll document the Prime Directive on the wiki for this style.

dcl_resource_texture1d (float,float,float,float) t120
dcl_resource_texture2d (float,float,float,float) t125
...
ld_indexable(texture2d)(float,float,float,float) r35.xyzw, l(0, 0, 0, 0), t125.xyzw
ld_indexable(texture1d)(float,float,float,float) r30.xyzw, l(0, 0, 0, 0), t120.zyzw

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/28/2015 12:54 AM   
Latest update to Version 1.1.12: [url]https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.12.zip[/url] Edit: switch link to 1.1.12. This version includes the F10 reload, so that you can now edit Asm files in ShaderFixes, and load them live in the game without having to quit. Right now it also generates some junk xxxx_reasm.txt files which we are using to validate the assembler. We'll turn this off once it all seems to be working and we no longer need them. After thinking through the use case model, I did not add Asm generation to CopyOnMark. I think it makes more sense for the Asm case to generate files in ShaderCache (w/ export_shaders=1), and in cases where Asm is desirable, copy the file from ShaderCache to ShaderFixes and load there. The reason to do it this way is otherwise you wind up with two files in the ShaderFixes folder, one HLSL, one Asm. Depending upon the scenario, you might edit one or the other file and expect a change, leading to confusion. Let's try this approach to start with, and if it doesn't seem to work in practice, we'll change it.
Latest update to Version 1.1.12:

https://github.com/bo3b/3Dmigoto/releases/download/0.99.50-alpha/3Dmigoto-1.1.12.zip

Edit: switch link to 1.1.12.


This version includes the F10 reload, so that you can now edit Asm files in ShaderFixes, and load them live in the game without having to quit.

Right now it also generates some junk xxxx_reasm.txt files which we are using to validate the assembler. We'll turn this off once it all seems to be working and we no longer need them.


After thinking through the use case model, I did not add Asm generation to CopyOnMark. I think it makes more sense for the Asm case to generate files in ShaderCache (w/ export_shaders=1), and in cases where Asm is desirable, copy the file from ShaderCache to ShaderFixes and load there.

The reason to do it this way is otherwise you wind up with two files in the ShaderFixes folder, one HLSL, one Asm. Depending upon the scenario, you might edit one or the other file and expect a change, leading to confusion.

Let's try this approach to start with, and if it doesn't seem to work in practice, we'll change it.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

Posted 05/29/2015 12:26 PM   
  24 / 141    
Scroll To Top