3Dmigoto now open-source...
  13 / 143    
Yes, sorry, the Decompiler still has some bugs of course, especially on SM5.0 stuff where it gets pretty complicated with the syntax. In this case, the .Load error is that there should be a named variable as the first part of the .Load, like WorldMatrix.Load. Probably, not certain here. Usually what I'll do for situations like this is to hand-edit the Decompiled HLSL to make it match what is supposed to happen, and generate the same ASM as the original shader. Then go back later (sometimes) and fix the Decompiler to handle that scenario- especially if it happens a lot. DHR was looking at something similar in DR3, that has the same symptom. Does the ASM code have something like this? [code]// tbuffer WorldMatrix // { // // row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192 // // } [/code] If so, I looked at this for a bit, and I don't currently have an answer for the syntax required to make this compile. This is some sort of array within an matrix, and I have so far been unable to learn how that might be properly specified in the original HLSL. Do you have an HLSL or languages background? The goal for this shader is to sweet talk the fxc into compiling the right output by adding a proper WorldMatrix definition. It's not certain that it will translate back to .Load, but ld_indexable nearly always does that. Less sure about ld_indexable_buffer, and the docs are sketchy.
Yes, sorry, the Decompiler still has some bugs of course, especially on SM5.0 stuff where it gets pretty complicated with the syntax.

In this case, the .Load error is that there should be a named variable as the first part of the .Load, like WorldMatrix.Load. Probably, not certain here.

Usually what I'll do for situations like this is to hand-edit the Decompiled HLSL to make it match what is supposed to happen, and generate the same ASM as the original shader. Then go back later (sometimes) and fix the Decompiler to handle that scenario- especially if it happens a lot.



DHR was looking at something similar in DR3, that has the same symptom.

Does the ASM code have something like this?

// tbuffer WorldMatrix
// {
//
// row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192
//
// }

If so, I looked at this for a bit, and I don't currently have an answer for the syntax required to make this compile.

This is some sort of array within an matrix, and I have so far been unable to learn how that might be properly specified in the original HLSL.

Do you have an HLSL or languages background? The goal for this shader is to sweet talk the fxc into compiling the right output by adding a proper WorldMatrix definition.

It's not certain that it will translate back to .Load, but ld_indexable nearly always does that. Less sure about ld_indexable_buffer, and the docs are sketchy.

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 09/08/2014 01:40 AM   
Unfortunately I'm pretty amateur at coding and only coded on python for simple graphics. I only really understood half of your post but what it seems like is that it's unfixable at this moment as I do indeed have that line in the shader file. After further research, I'm guessing you have to turn the tbuffer into a cbuffer and put the definitions between the curly brackets at the beginning of the shader file.
Unfortunately I'm pretty amateur at coding and only coded on python for simple graphics. I only really understood half of your post but what it seems like is that it's unfixable at this moment as I do indeed have that line in the shader file.

After further research, I'm guessing you have to turn the tbuffer into a cbuffer and put the definitions between the curly brackets at the beginning of the shader file.

Posted 09/08/2014 01:51 AM   
Cool, no worries. Since you ran into it too, after I get the WatchDog problems fixed, I'll come back to this and figure out what it will take.
Cool, no worries. Since you ran into it too, after I get the WatchDog problems fixed, I'll come back to this and figure out what it will take.

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 09/08/2014 01:59 AM   
With Dead Rising 3.....Is the same issue i found, this issue is present in several shaders: HUD, lights. I have fix some lights (that don't have issues with that)...there are fixed with this code: position.x = depth * (position.w - convergence) through VS. I also helping with Watch Dog....so i prefer to focus in that game also.
With Dead Rising 3.....Is the same issue i found, this issue is present in several shaders: HUD, lights. I have fix some lights (that don't have issues with that)...there are fixed with this code: position.x = depth * (position.w - convergence) through VS.

I also helping with Watch Dog....so i prefer to focus in that game also.

MY WEB

Helix Mod - Making 3D Better

My 3D Screenshot Gallery

Like my fixes? you can donate to Paypal: dhr.donation@gmail.com

Posted 09/08/2014 11:49 AM   
[quote="DHR"]With Dead Rising 3.....Is the same issue I found, this issue is present in several shaders: HUD, lights. I have fix some lights (that don't have issues with that)...there are fixed with this code: position.x = depth * (position.w - convergence) through VS. I also helping with Watch Dog....so I prefer to focus in that game also.[/quote] How do you know you fixed it if the shaders didn't update? Or did you figure out a way to manually tweak it and make it work?
DHR said:With Dead Rising 3.....Is the same issue I found, this issue is present in several shaders: HUD, lights. I have fix some lights (that don't have issues with that)...there are fixed with this code: position.x = depth * (position.w - convergence) through VS.

I also helping with Watch Dog....so I prefer to focus in that game also.

How do you know you fixed it if the shaders didn't update? Or did you figure out a way to manually tweak it and make it work?

Posted 09/08/2014 07:39 PM   
[quote="DHR"] I have fix some lights (that don't have issues with that)[/quote] The others shaders with the issue i can't fix it, because there are decompiled wrong.
DHR said: I have fix some lights (that don't have issues with that)


The others shaders with the issue i can't fix it, because there are decompiled wrong.

MY WEB

Helix Mod - Making 3D Better

My 3D Screenshot Gallery

Like my fixes? you can donate to Paypal: dhr.donation@gmail.com

Posted 09/08/2014 08:07 PM   
I worked out the manual code fix for that broken shader, where it is using an array access. This one compiles to the same ASM. I'll fix this in the code at some point, but in the meantime, maybe hand-patching shaders you need will be good enough. [code]cbuffer cb0 : register(b0) { float4 cb0[199]; } cbuffer _Globals : register(b0) { float4 gClipPlane : packoffset(c192); float4 gInstanceAnimParameters : packoffset(c193); float4 gZPassNearZClamp : packoffset(c194); float4 gCameraPositionVS : packoffset(c195); float4 gEyeSpaceDepth : packoffset(c196); float4 gWorldCameraPosition : packoffset(c197); float4 gHalfPixelOffset : packoffset(c198); row_major float4x4 gCubemapFaceNormals : packoffset(c199); row_major float4x4 gCubeBlurMatrix : packoffset(c203); } cbuffer ProjectionViewMatrix : register(b1) { row_major float4x4 gProjectionViewMatrix : packoffset(c0); row_major float4x4 gPreviousProjViewMatrix : packoffset(c4); float4 gJittering : packoffset(c8); } // New tbuffer WorldMatrix : register(t114) { row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192 }; Texture2D<float4> StereoParams : register(t125); void main( float3 v0 : POSITION0, float2 v1 : TEXCOORD0, out float4 o0 : SV_Position0, out float4 o1 : COLOR0, out float2 o2 : TEXCOORD0) { float4 r0,r1,r2; uint4 bitmask; r0.xyzw = gWorldMatrix[0]._m00_m01_m02_m03; r1.xyz = v0.xyz; r1.w = 1.000000000e+000; r0.x = dot(r0.xyzw, r1.xyzw); r2.xyzw = gWorldMatrix[0]._m10_m11_m12_m13; r0.y = dot(r2.xyzw, r1.xyzw); r2.xyzw = gWorldMatrix[0]._m20_m21_m22_m23; r0.z = dot(r2.xyzw, r1.xyzw); r0.w = 1.000000000e+000; r1.x = dot(gProjectionViewMatrix._m00_m01_m02_m03, r0.xyzw); r1.y = dot(gProjectionViewMatrix._m10_m11_m12_m13, r0.xyzw); r1.z = dot(gProjectionViewMatrix._m30_m31_m32_m33, r0.xyzw); o0.z = dot(gProjectionViewMatrix._m20_m21_m22_m23, r0.xyzw); o0.xy = cb0[198].xy * r1.zz + r1.xy; o0.w = r1.z; o1.xyzw = float4(1.000000e+000,1.000000e+000,1.000000e+000,1.000000e+000); o2.xy = v1.xy; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // // Buffer Definitions: // // cbuffer $Globals // { // // float4 gClipPlane; // Offset: 3072 Size: 16 [unused] // float4 gInstanceAnimParameters; // Offset: 3088 Size: 16 [unused] // float4 gZPassNearZClamp; // Offset: 3104 Size: 16 [unused] // float4 gCameraPositionVS; // Offset: 3120 Size: 16 [unused] // float4 gEyeSpaceDepth; // Offset: 3136 Size: 16 [unused] // float4 gWorldCameraPosition; // Offset: 3152 Size: 16 [unused] // float4 gHalfPixelOffset; // Offset: 3168 Size: 16 // row_major float4x4 gCubemapFaceNormals;// Offset: 3184 Size: 64 [unused] // row_major float4x4 gCubeBlurMatrix;// Offset: 3248 Size: 64 [unused] // // } // // cbuffer ProjectionViewMatrix // { // // row_major float4x4 gProjectionViewMatrix;// Offset: 0 Size: 64 // row_major float4x4 gPreviousProjViewMatrix;// Offset: 64 Size: 64 [unused] // float4 gJittering; // Offset: 128 Size: 16 [unused] // // } // // tbuffer WorldMatrix // { // // row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192 // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // WorldMatrix tbuffer NA NA 114 1 // $Globals cbuffer NA NA 0 1 // ProjectionViewMatrix cbuffer NA NA 1 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // POSITION 0 xyz 0 NONE float xyz // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 POS float xyzw // COLOR 0 xyzw 1 NONE float xyzw // TEXCOORD 0 xy 2 NONE float xy // vs_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[199], immediateIndexed dcl_constantbuffer cb1[4], immediateIndexed dcl_resource_buffer (mixed,mixed,mixed,mixed) t114 dcl_input v0.xyz dcl_input v1.xy dcl_output_siv o0.xyzw, position dcl_output o1.xyzw dcl_output o2.xy dcl_temps 3 ld_indexable(buffer)(mixed,mixed,mixed,mixed) r0.xyzw, l(0, 0, 0, 0), t114.xyzw mov r1.xyz, v0.xyzx mov r1.w, l(1.000000) dp4 r0.x, r0.xyzw, r1.xyzw ld_indexable(buffer)(mixed,mixed,mixed,mixed) r2.xyzw, l(1, 1, 1, 1), t114.xyzw dp4 r0.y, r2.xyzw, r1.xyzw ld_indexable(buffer)(mixed,mixed,mixed,mixed) r2.xyzw, l(2, 2, 2, 2), t114.xyzw dp4 r0.z, r2.xyzw, r1.xyzw mov r0.w, l(1.000000) dp4 r1.x, cb1[0].xyzw, r0.xyzw dp4 r1.y, cb1[1].xyzw, r0.xyzw dp4 r1.z, cb1[3].xyzw, r0.xyzw dp4 o0.z, cb1[2].xyzw, r0.xyzw mad o0.xy, cb0[198].xyxx, r1.zzzz, r1.xyxx mov o0.w, r1.z mov o1.xyzw, l(1.000000,1.000000,1.000000,1.000000) mov o2.xy, v1.xyxx ret // Approximately 18 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] Let me know if that doesn't make sense.
I worked out the manual code fix for that broken shader, where it is using an array access. This one compiles to the same ASM.

I'll fix this in the code at some point, but in the meantime, maybe hand-patching shaders you need will be good enough.


cbuffer cb0 : register(b0)
{
float4 cb0[199];
}


cbuffer _Globals : register(b0)
{
float4 gClipPlane : packoffset(c192);
float4 gInstanceAnimParameters : packoffset(c193);
float4 gZPassNearZClamp : packoffset(c194);
float4 gCameraPositionVS : packoffset(c195);
float4 gEyeSpaceDepth : packoffset(c196);
float4 gWorldCameraPosition : packoffset(c197);
float4 gHalfPixelOffset : packoffset(c198);
row_major float4x4 gCubemapFaceNormals : packoffset(c199);
row_major float4x4 gCubeBlurMatrix : packoffset(c203);
}

cbuffer ProjectionViewMatrix : register(b1)
{
row_major float4x4 gProjectionViewMatrix : packoffset(c0);
row_major float4x4 gPreviousProjViewMatrix : packoffset(c4);
float4 gJittering : packoffset(c8);
}

// New
tbuffer WorldMatrix : register(t114)
{
row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192
};

Texture2D<float4> StereoParams : register(t125);

void main(
float3 v0 : POSITION0,
float2 v1 : TEXCOORD0,
out float4 o0 : SV_Position0,
out float4 o1 : COLOR0,
out float2 o2 : TEXCOORD0)
{
float4 r0,r1,r2;
uint4 bitmask;
r0.xyzw = gWorldMatrix[0]._m00_m01_m02_m03;
r1.xyz = v0.xyz;
r1.w = 1.000000000e+000;
r0.x = dot(r0.xyzw, r1.xyzw);
r2.xyzw = gWorldMatrix[0]._m10_m11_m12_m13;
r0.y = dot(r2.xyzw, r1.xyzw);
r2.xyzw = gWorldMatrix[0]._m20_m21_m22_m23;
r0.z = dot(r2.xyzw, r1.xyzw);
r0.w = 1.000000000e+000;
r1.x = dot(gProjectionViewMatrix._m00_m01_m02_m03, r0.xyzw);
r1.y = dot(gProjectionViewMatrix._m10_m11_m12_m13, r0.xyzw);
r1.z = dot(gProjectionViewMatrix._m30_m31_m32_m33, r0.xyzw);
o0.z = dot(gProjectionViewMatrix._m20_m21_m22_m23, r0.xyzw);
o0.xy = cb0[198].xy * r1.zz + r1.xy;
o0.w = r1.z;
o1.xyzw = float4(1.000000e+000,1.000000e+000,1.000000e+000,1.000000e+000);
o2.xy = v1.xy;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
// float4 gClipPlane; // Offset: 3072 Size: 16 [unused]
// float4 gInstanceAnimParameters; // Offset: 3088 Size: 16 [unused]
// float4 gZPassNearZClamp; // Offset: 3104 Size: 16 [unused]
// float4 gCameraPositionVS; // Offset: 3120 Size: 16 [unused]
// float4 gEyeSpaceDepth; // Offset: 3136 Size: 16 [unused]
// float4 gWorldCameraPosition; // Offset: 3152 Size: 16 [unused]
// float4 gHalfPixelOffset; // Offset: 3168 Size: 16
// row_major float4x4 gCubemapFaceNormals;// Offset: 3184 Size: 64 [unused]
// row_major float4x4 gCubeBlurMatrix;// Offset: 3248 Size: 64 [unused]
//
// }
//
// cbuffer ProjectionViewMatrix
// {
//
// row_major float4x4 gProjectionViewMatrix;// Offset: 0 Size: 64
// row_major float4x4 gPreviousProjViewMatrix;// Offset: 64 Size: 64 [unused]
// float4 gJittering; // Offset: 128 Size: 16 [unused]
//
// }
//
// tbuffer WorldMatrix
// {
//
// row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// WorldMatrix tbuffer NA NA 114 1
// $Globals cbuffer NA NA 0 1
// ProjectionViewMatrix cbuffer NA NA 1 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xyz 0 NONE float xyz
// TEXCOORD 0 xy 1 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float xyzw
// COLOR 0 xyzw 1 NONE float xyzw
// TEXCOORD 0 xy 2 NONE float xy
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[199], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_resource_buffer (mixed,mixed,mixed,mixed) t114
dcl_input v0.xyz
dcl_input v1.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_temps 3
ld_indexable(buffer)(mixed,mixed,mixed,mixed) r0.xyzw, l(0, 0, 0, 0), t114.xyzw
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
dp4 r0.x, r0.xyzw, r1.xyzw
ld_indexable(buffer)(mixed,mixed,mixed,mixed) r2.xyzw, l(1, 1, 1, 1), t114.xyzw
dp4 r0.y, r2.xyzw, r1.xyzw
ld_indexable(buffer)(mixed,mixed,mixed,mixed) r2.xyzw, l(2, 2, 2, 2), t114.xyzw
dp4 r0.z, r2.xyzw, r1.xyzw
mov r0.w, l(1.000000)
dp4 r1.x, cb1[0].xyzw, r0.xyzw
dp4 r1.y, cb1[1].xyzw, r0.xyzw
dp4 r1.z, cb1[3].xyzw, r0.xyzw
dp4 o0.z, cb1[2].xyzw, r0.xyzw
mad o0.xy, cb0[198].xyxx, r1.zzzz, r1.xyxx
mov o0.w, r1.z
mov o1.xyzw, l(1.000000,1.000000,1.000000,1.000000)
mov o2.xy, v1.xyxx
ret
// Approximately 18 instruction slots used

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



Let me know if that doesn't make sense.

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 10/10/2014 02:36 PM   
Just wanted to say thanks to this group for all the work you do to provide these community-supported tools to help enhance the 3D Vision experience. Cheers to you all.
Just wanted to say thanks to this group for all the work you do to provide these community-supported tools to help enhance the 3D Vision experience. Cheers to you all.

i7-6700k @ 4.5GHz, 2x 970 GTX SLI, 16GB DDR4 @ 3000mhz, MSI Gaming M7, Samsung 950 Pro m.2 SSD 512GB, 2x 1TB RAID 1, 850w EVGA, Corsair RGB 90 keyboard

Posted 10/10/2014 03:26 PM   
@bo3b I get the first part where you have to enter the [code]tbuffer WorldMatrix : register(t114) { row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192 };[/code] where the register corresponds to the slot in the asm version but with a t instead of a b. And I get that the error lies in the .Load part of the code as the wrapper doesn't decompile it properly. But how would I convert [code] r1.xyzw = .Load(r0.yyyy).xyzw;[/code] to the world coordinate version of it? edit: There were 3 .Load and I just replaced them with the gWorldMatrix[0] in an increasing manner (_m00_m01_m02_m03 first then _m10_m11_m12_m13 etc.) However that seems to work so far so it's all good. I disabled shadows and it seemed to work. The d3d11 log is actually pretty useful in figuring out what's going on, I should pay more attention to it.
@bo3b
I get the first part where you have to enter the
tbuffer WorldMatrix : register(t114)
{
row_major float3x4 gWorldMatrix[4];// Offset: 0 Size: 192
};

where the register corresponds to the slot in the asm version but with a t instead of a b. And I get that the error lies in the .Load part of the code as the wrapper doesn't decompile it properly. But how would I convert
r1.xyzw = .Load(r0.yyyy).xyzw;
to the world coordinate version of it?

edit: There were 3 .Load and I just replaced them with the gWorldMatrix[0] in an increasing manner (_m00_m01_m02_m03 first then _m10_m11_m12_m13 etc.) However that seems to work so far so it's all good. I disabled shadows and it seemed to work. The d3d11 log is actually pretty useful in figuring out what's going on, I should pay more attention to it.

Posted 10/10/2014 11:45 PM   
Yep, you are on the right track there. The .Load(r0.yyyy) is completely wrong, the Decompiler has a bug that generates that. There is an ASM 'ld' instruction which translates to .Load(), but this is an 'ld_indexable' which translates to an array access. Actually took me a couple of hours to figure out the difference. For these shaders, making them gWorldMaxtrix offsets is the right choice. Look at the ASM to see what the proper matrix access should be. If it's l(0,0,0,0), l(1,1,1,1), l(2,2,2,2) type, it will be just the first thre rows of the matrix. If it's something else like l(4,4,4,4) that will be a different level of the array. We had to also add the tbuffer WorldMatrix, because the Decompiler skipped that part (even with latest 0.92). It probably does not have tbuffer as an output, but might also be related to my ongoing Struct decompile problem. Pretty sure I just to add tbuffer to match cbuffer. The way that I know when these are right is to use FXC and recompile the code with an ASM output and compare that with the original ASM dump. For disabling them of course, the actual code doesn't have to be right, it can just be commented out. I've saved this one as a broken shader in the project, and I use those examples to drive fixes in the code base. There are hundreds of things to be fixed, but I use the games to drive the stuff that is higher priority, because at the end of the day, we don't really care how clunky it is- we just want game fixes.
Yep, you are on the right track there.

The .Load(r0.yyyy) is completely wrong, the Decompiler has a bug that generates that. There is an ASM 'ld' instruction which translates to .Load(), but this is an 'ld_indexable' which translates to an array access. Actually took me a couple of hours to figure out the difference.

For these shaders, making them gWorldMaxtrix offsets is the right choice. Look at the ASM to see what the proper matrix access should be. If it's l(0,0,0,0), l(1,1,1,1), l(2,2,2,2) type, it will be just the first thre rows of the matrix. If it's something else like l(4,4,4,4) that will be a different level of the array.

We had to also add the tbuffer WorldMatrix, because the Decompiler skipped that part (even with latest 0.92). It probably does not have tbuffer as an output, but might also be related to my ongoing Struct decompile problem. Pretty sure I just to add tbuffer to match cbuffer.


The way that I know when these are right is to use FXC and recompile the code with an ASM output and compare that with the original ASM dump.

For disabling them of course, the actual code doesn't have to be right, it can just be commented out.


I've saved this one as a broken shader in the project, and I use those examples to drive fixes in the code base. There are hundreds of things to be fixed, but I use the games to drive the stuff that is higher priority, because at the end of the day, we don't really care how clunky it is- we just want game fixes.

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 10/11/2014 02:33 AM   
[quote="ForgottenProdigy"]I tried hunting for the shaders responsible for shadows and they turned out to be different than the ones in the fix. The thing is I can't seem to find a similar shader that you guys fixed to apply here (unless I am not looking hard enough) Shader 1 [code] Texture2D<float4> StereoParams : register(t125); void main( float3 v0 : POSITION0, out float2 o0 : TEXCOORD0, out float4 o1 : SV_Position0) { o0.xy = v0.xy * float2(5.000000e-001,-5.000000e-001) + float2(5.000000e-001,5.000000e-001); o1.xy = v0.xy; o1.zw = float2(0.000000e+000,1.000000e+000); return; }[/code] Shader 2 [code] cbuffer Viewport : register(b0) { float4x4 _ViewRotProjectionMatrix : packoffset(c0); float4x4 _ViewProjectionMatrix : packoffset(c4); float4x4 _ProjectionMatrix : packoffset(c8); float4x4 _InvProjectionMatrix : packoffset(c12); float4x4 _InvProjectionMatrixDepth : packoffset(c16); float4x4 _DepthTextureTransform : packoffset(c20); float4x3 _ViewMatrix : packoffset(c24); float4x3 _InvViewMatrix : packoffset(c27); float4x4 _PreviousViewProjectionMatrix : packoffset(c30); float4 _CameraDistances : packoffset(c34); float4 _ViewportSize : packoffset(c35); float4 _CameraPosition_MaxStaticReflectionMipIndex : packoffset(c36); float4 _CameraDirection_MaxParaboloidReflectionMipIndex : packoffset(c37); float4 _ViewPoint_ExposureScale : packoffset(c38); float4 _FogColourVector_ExposedWhitePointOverExposureScale : packoffset(c39); float3 _SideFogColour : packoffset(c40); float3 _SunFogColourDelta : packoffset(c41); float3 _OppositeFogColourDelta : packoffset(c42); float4 _FogValues0 : packoffset(c43); float4 _FogValues1 : packoffset(c44); float4 _CameraNearPlaneSize : packoffset(c45); float4 _UncompressDepthWeights_ShadowProjDepthMinValue : packoffset(c46); float4 _UncompressDepthWeightsWS_ReflectionFadeTarget : packoffset(c47); float4 _WorldAmbientColourParams0 : packoffset(c48); float4 _WorldAmbientColourParams1 : packoffset(c49); float4 _WorldAmbientColourParams2 : packoffset(c50); float4 _GlobalWorldTextureParams : packoffset(c51); float4 _CullingCameraPosition_OneOverAutoExposureScale : packoffset(c52); float4 _AmbientSkyColour_ReflectionScaleStrength : packoffset(c53); float4 _AmbientGroundColour_ReflectionScaleDistanceMul : packoffset(c54); float4 _FacettedShadowCastParams : packoffset(c55); float4 _FSMClipPlanes : packoffset(c56); float2 _ReflectionGIControl : packoffset(c57); } cbuffer SceneGeometry : register(b1) { float4 _GeometryPickingID : packoffset(c0); float4 _GeometryUserData : packoffset(c1); float4 _MeshDecompression : packoffset(c2); float4 _UVDecompression : packoffset(c3); float3 _GeometryBBoxMax : packoffset(c4); float3 _GeometryBBoxMin : packoffset(c5); } Texture2D<float4> StereoParams : register(t125); void main( int4 v0 : position0, int4 v1 : texcoord2, float4 v2 : normal0, float4 v3 : colour1, float4 v4 : texcoord4, float4 v5 : texcoord5, float4 v6 : texcoord6, int4 v7 : texcoord7, out float2 o0 : SV_ClipDistance0, out float4 o1 : SV_Position0) { float4 r0,r1,r2,r3; uint4 bitmask; r0.xyz = v4.xyz; r1.x = v4.w; r1.y = v5.w; r1.z = v6.w; r2.xyzw = v7.xyzw; r1.xyw = r2.xyz + r1.xyz; r2.x = r2.w * 9.765923023e-004 + 3.200000000e+001; r0.w = r1.x; r2.yzw = v0.xyz; r2.yzw = r2.yzw * _MeshDecompression.yyy + _MeshDecompression.xxx; r2.xyz = r2.yzw * r2.xxx; r2.w = 1.000000000e+000; r0.z = dot(r2.xyzw, r0.xyzw); r3.w = r1.y; r3.xyz = v5.xyz; r0.x = dot(r2.xyzw, r3.xyzw); r1.xyz = v6.xyz; r0.y = dot(r2.xyzw, r1.xyzw); r0.xyz = -_CameraPosition_MaxStaticReflectionMipIndex.yzx + r0.xyz; r1.x = _ViewRotProjectionMatrix._m20 * r0.y + _ViewRotProjectionMatrix._m30; r1.y = _ViewRotProjectionMatrix._m21 * r0.y + _ViewRotProjectionMatrix._m31; r1.z = _ViewRotProjectionMatrix._m22 * r0.y + _ViewRotProjectionMatrix._m32; r2.xy = _ViewRotProjectionMatrix._m00_m10 * r0.zx; r3.x = r2.y; r3.yz = _ViewRotProjectionMatrix._m11_m01 * r0.xz; r0.xy = _ViewRotProjectionMatrix._m12_m02 * r0.xz; r2.y = r3.z; r3.z = r0.x; r2.z = r0.y; r0.xyz = r3.xyz + r1.xyz; r0.xyz = r2.xyz + r0.xyz; r0.z = max(r0.z, _UncompressDepthWeights_ShadowProjDepthMinValue.w); r0.z = r0.z * r0.z; r0.z = r0.z * r0.z; r0.w = r0.z * r0.z; r1.xyz = _FacettedShadowCastParams.xxx * r0.xyw; r0.x = dot(r0.xy, _FacettedShadowCastParams.zw); o1.w = _FacettedShadowCastParams.y + r0.x; o0.x = dot(r1.xy, _FSMClipPlanes.xy); o0.y = dot(r1.xy, _FSMClipPlanes.zw); o1.xyz = r1.xyz; return; } [/code] No mention of invProj or viewProj so it appears to be different than the fixed shaders. I don't get why though. I do want to mention that I played an hour or 2 and the fix seemed to work during that time with 1 or 2 lights being 2d. And one time when I started in the area I'm in the fix worked. The next couple of times it doesn't. They're both vertex shaders btw, I've also found a couple of pixel shaders but I've just corrected the "[i]ShadowMaskBlur__ShadowMaskTexture__SampObj___s[/i]" because it oddly had an extra "[i]_s[/i]" at the end.[/quote] Hope you don't mind my moving this topic over to this thread. No one will ever find the answer in the WD thread, and that's more of the end-user discussion. The problem here is that you are making the same mistake I did when I looked at shadows in this game. The shader that you and I found is not the right one. It disables the shadows, but that's sort of by accident, because what you found was the ShadowMask, not the actual shader creating the shadows. Disabling the mask makes them go away, so it's valid for that purpose, but you can't fix the shadows using the mask. You want to find the Light shaders instead, which project the light. Here are some helpful comments from Mike: [quote="mike_ar69"]It's not always obvious, but a few clues are: - There is a ShadowMap sampler in there somewhere - There is a SomethingXXXToShadow or SomethinXXXToLight matrix in there (or the reverse!) - A World Coordinate is contructed from EyePos or CamPos, and a 3-comp texcoord - There is an InvView or InvProjView in there (usually generating something in world coords) - Recognize that you may not see the word "shadow" in a shader that actually plots shadows. As noted above you often need to look for matrices with "light" in them. This makes more sense because these matrices do a coordinate transformation to the "view" of where the light source is that either casts shadows or enhances the light on a surface, say like a spotlight (very much the same as the View transformation moving to the POV of the camera).[/quote]
ForgottenProdigy said:I tried hunting for the shaders responsible for shadows and they turned out to be different than the ones in the fix. The thing is I can't seem to find a similar shader that you guys fixed to apply here (unless I am not looking hard enough)

Shader 1
Texture2D<float4> StereoParams : register(t125);

void main(
float3 v0 : POSITION0,
out float2 o0 : TEXCOORD0,
out float4 o1 : SV_Position0)
{
o0.xy = v0.xy * float2(5.000000e-001,-5.000000e-001) + float2(5.000000e-001,5.000000e-001);
o1.xy = v0.xy;
o1.zw = float2(0.000000e+000,1.000000e+000);
return;
}


Shader 2
cbuffer Viewport : register(b0)
{
float4x4 _ViewRotProjectionMatrix : packoffset(c0);
float4x4 _ViewProjectionMatrix : packoffset(c4);
float4x4 _ProjectionMatrix : packoffset(c8);
float4x4 _InvProjectionMatrix : packoffset(c12);
float4x4 _InvProjectionMatrixDepth : packoffset(c16);
float4x4 _DepthTextureTransform : packoffset(c20);
float4x3 _ViewMatrix : packoffset(c24);
float4x3 _InvViewMatrix : packoffset(c27);
float4x4 _PreviousViewProjectionMatrix : packoffset(c30);
float4 _CameraDistances : packoffset(c34);
float4 _ViewportSize : packoffset(c35);
float4 _CameraPosition_MaxStaticReflectionMipIndex : packoffset(c36);
float4 _CameraDirection_MaxParaboloidReflectionMipIndex : packoffset(c37);
float4 _ViewPoint_ExposureScale : packoffset(c38);
float4 _FogColourVector_ExposedWhitePointOverExposureScale : packoffset(c39);
float3 _SideFogColour : packoffset(c40);
float3 _SunFogColourDelta : packoffset(c41);
float3 _OppositeFogColourDelta : packoffset(c42);
float4 _FogValues0 : packoffset(c43);
float4 _FogValues1 : packoffset(c44);
float4 _CameraNearPlaneSize : packoffset(c45);
float4 _UncompressDepthWeights_ShadowProjDepthMinValue : packoffset(c46);
float4 _UncompressDepthWeightsWS_ReflectionFadeTarget : packoffset(c47);
float4 _WorldAmbientColourParams0 : packoffset(c48);
float4 _WorldAmbientColourParams1 : packoffset(c49);
float4 _WorldAmbientColourParams2 : packoffset(c50);
float4 _GlobalWorldTextureParams : packoffset(c51);
float4 _CullingCameraPosition_OneOverAutoExposureScale : packoffset(c52);
float4 _AmbientSkyColour_ReflectionScaleStrength : packoffset(c53);
float4 _AmbientGroundColour_ReflectionScaleDistanceMul : packoffset(c54);
float4 _FacettedShadowCastParams : packoffset(c55);
float4 _FSMClipPlanes : packoffset(c56);
float2 _ReflectionGIControl : packoffset(c57);
}

cbuffer SceneGeometry : register(b1)
{
float4 _GeometryPickingID : packoffset(c0);
float4 _GeometryUserData : packoffset(c1);
float4 _MeshDecompression : packoffset(c2);
float4 _UVDecompression : packoffset(c3);
float3 _GeometryBBoxMax : packoffset(c4);
float3 _GeometryBBoxMin : packoffset(c5);
}

Texture2D<float4> StereoParams : register(t125);

void main(
int4 v0 : position0,
int4 v1 : texcoord2,
float4 v2 : normal0,
float4 v3 : colour1,
float4 v4 : texcoord4,
float4 v5 : texcoord5,
float4 v6 : texcoord6,
int4 v7 : texcoord7,
out float2 o0 : SV_ClipDistance0,
out float4 o1 : SV_Position0)
{
float4 r0,r1,r2,r3;
uint4 bitmask;
r0.xyz = v4.xyz;
r1.x = v4.w;
r1.y = v5.w;
r1.z = v6.w;
r2.xyzw = v7.xyzw;
r1.xyw = r2.xyz + r1.xyz;
r2.x = r2.w * 9.765923023e-004 + 3.200000000e+001;
r0.w = r1.x;
r2.yzw = v0.xyz;
r2.yzw = r2.yzw * _MeshDecompression.yyy + _MeshDecompression.xxx;
r2.xyz = r2.yzw * r2.xxx;
r2.w = 1.000000000e+000;
r0.z = dot(r2.xyzw, r0.xyzw);
r3.w = r1.y;
r3.xyz = v5.xyz;
r0.x = dot(r2.xyzw, r3.xyzw);
r1.xyz = v6.xyz;
r0.y = dot(r2.xyzw, r1.xyzw);
r0.xyz = -_CameraPosition_MaxStaticReflectionMipIndex.yzx + r0.xyz;
r1.x = _ViewRotProjectionMatrix._m20 * r0.y + _ViewRotProjectionMatrix._m30;
r1.y = _ViewRotProjectionMatrix._m21 * r0.y + _ViewRotProjectionMatrix._m31;
r1.z = _ViewRotProjectionMatrix._m22 * r0.y + _ViewRotProjectionMatrix._m32;
r2.xy = _ViewRotProjectionMatrix._m00_m10 * r0.zx;
r3.x = r2.y;
r3.yz = _ViewRotProjectionMatrix._m11_m01 * r0.xz;
r0.xy = _ViewRotProjectionMatrix._m12_m02 * r0.xz;
r2.y = r3.z;
r3.z = r0.x;
r2.z = r0.y;
r0.xyz = r3.xyz + r1.xyz;
r0.xyz = r2.xyz + r0.xyz;
r0.z = max(r0.z, _UncompressDepthWeights_ShadowProjDepthMinValue.w);
r0.z = r0.z * r0.z;
r0.z = r0.z * r0.z;
r0.w = r0.z * r0.z;
r1.xyz = _FacettedShadowCastParams.xxx * r0.xyw;
r0.x = dot(r0.xy, _FacettedShadowCastParams.zw);
o1.w = _FacettedShadowCastParams.y + r0.x;
o0.x = dot(r1.xy, _FSMClipPlanes.xy);
o0.y = dot(r1.xy, _FSMClipPlanes.zw);
o1.xyz = r1.xyz;
return;
}

No mention of invProj or viewProj so it appears to be different than the fixed shaders. I don't get why though. I do want to mention that I played an hour or 2 and the fix seemed to work during that time with 1 or 2 lights being 2d. And one time when I started in the area I'm in the fix worked. The next couple of times it doesn't.

They're both vertex shaders btw, I've also found a couple of pixel shaders but I've just corrected the "ShadowMaskBlur__ShadowMaskTexture__SampObj___s" because it oddly had an extra "_s" at the end.

Hope you don't mind my moving this topic over to this thread. No one will ever find the answer in the WD thread, and that's more of the end-user discussion.

The problem here is that you are making the same mistake I did when I looked at shadows in this game. The shader that you and I found is not the right one. It disables the shadows, but that's sort of by accident, because what you found was the ShadowMask, not the actual shader creating the shadows. Disabling the mask makes them go away, so it's valid for that purpose, but you can't fix the shadows using the mask.

You want to find the Light shaders instead, which project the light. Here are some helpful comments from Mike:

mike_ar69 said:It's not always obvious, but a few clues are:
- There is a ShadowMap sampler in there somewhere
- There is a SomethingXXXToShadow or SomethinXXXToLight matrix in there (or the reverse!)
- A World Coordinate is contructed from EyePos or CamPos, and a 3-comp texcoord
- There is an InvView or InvProjView in there (usually generating something in world coords)
- Recognize that you may not see the word "shadow" in a shader that actually plots shadows. As noted above you often need to look for matrices with "light" in them. This makes more sense because these matrices do a coordinate transformation to the "view" of where the light source is that either casts shadows or enhances the light on a surface, say like a spotlight (very much the same as the View transformation moving to the POV of the camera).

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 10/13/2014 12:00 AM   
@bo3b Ah, that makes sense now, I see. But then, how would I go about finding the right shader if all of the ones that, when selected, disable the shadow are actually wrong ones? The only method I see then is to dump all the shaders then run a grep search for [i]InvView [/i]and [i]InvProjView[/i] and then work with those. Running an initial search based on keywords (InvView) and (ShadowMap) yielded 1000's of shaders so that can't be the way to do it.
@bo3b
Ah, that makes sense now, I see. But then, how would I go about finding the right shader if all of the ones that, when selected, disable the shadow are actually wrong ones? The only method I see then is to dump all the shaders then run a grep search for InvView and InvProjView and then work with those. Running an initial search based on keywords (InvView) and (ShadowMap) yielded 1000's of shaders so that can't be the way to do it.

Posted 10/13/2014 02:04 AM   
Yeah, this was a big eye-opener for me too. DHR showed me the way to do this was to hunt for a shader that disables all the [i]projected[/i] light in the area instead. You'll still see the ambient light, and it won't go completely dark, but it will darken. Make sure it's not the sky being blanked out. I can't pull up an example easily, but if you can't find one based on that suggestion let me know and I'll find a snapshot.
Yeah, this was a big eye-opener for me too. DHR showed me the way to do this was to hunt for a shader that disables all the projected light in the area instead.

You'll still see the ambient light, and it won't go completely dark, but it will darken. Make sure it's not the sky being blanked out. I can't pull up an example easily, but if you can't find one based on that suggestion let me know and I'll find a snapshot.

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 10/13/2014 04:17 AM   
[quote="ForgottenProdigy"]@bo3b Ah, that makes sense now, I see. But then, how would I go about finding the right shader if all of the ones that, when selected, disable the shadow are actually wrong ones? The only method I see then is to dump all the shaders then run a grep search for [i]InvView [/i]and [i]InvProjView[/i] and then work with those. Running an initial search based on keywords (InvView) and (ShadowMap) yielded 1000's of shaders so that can't be the way to do it. [/quote] You need to look for an example of matrices being *used*, otherwise you will just find the header declarations which are in most shaders (hence the 1000's of hits). For example look for "ViewProj._m00", or whatever the matrix of interest is; if you were looking for the CameraPosition you would probably search for "CameraPosition.xyz" for example.
ForgottenProdigy said:@bo3b
Ah, that makes sense now, I see. But then, how would I go about finding the right shader if all of the ones that, when selected, disable the shadow are actually wrong ones? The only method I see then is to dump all the shaders then run a grep search for InvView and InvProjView and then work with those. Running an initial search based on keywords (InvView) and (ShadowMap) yielded 1000's of shaders so that can't be the way to do it.

You need to look for an example of matrices being *used*, otherwise you will just find the header declarations which are in most shaders (hence the 1000's of hits). For example look for "ViewProj._m00", or whatever the matrix of interest is; if you were looking for the CameraPosition you would probably search for "CameraPosition.xyz" for example.

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

Posted 10/13/2014 02:24 PM   
I'm having an issue with a shader not being decompiled correctly using 3Dmigoto v0.94 and v0.82: The log file shows: [code]C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(35,13-34): warning X3206: 'Sample': implicit truncation of vector type C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,32): error X3000: syntax error: unexpected token ',' C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: 'SampleCmpLevelZero': no matching 0 parameter intrinsic method C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: Possible intrinsic methods are: C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: Texture2D<float4>.SampleCmpLevelZero(SamplerComparisonState, float2|half2|min10float2|min16float2, float1|half1|min10float1|min16float1) C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: Texture2D<float4>.SampleCmpLevelZero(SamplerComparisonState, float2|half2|min10float2|min16float2, float1|half1|min10float1|min16float1, int2)[/code] And here's the unedited pixel shader. I marked the 2 lines that have the errors. df1735a3dd2c2299-ps_replace.txt: [code]Texture2D<float4> t1 : register(t1); Texture2D<float4> t0 : register(t0); SamplerState s1 : register(s1); SamplerState s0 : register(s0); cbuffer cb2 : register(b2) { float4 cb2[4]; } cbuffer cb1 : register(b1) { float4 cb1[25]; } cbuffer cb0 : register(b0) { float4 cb0[8]; } Texture2D<float4> StereoParams : register(t125); void main( float4 v0 : SV_POSITION0, float2 v1 : TEXCOORD0, float3 v2 : TEXCOORD1, out float4 o0 : SV_Target0) { float4 r0,r1,r2,r3,r4; uint4 bitmask; r0.xyzw = t0.Sample(s0, v1.xyxx).xyzw; //------------------------ERROR r0.x = cb0[7].x * r0.x + cb0[7].y; r0.x = 1.000000e+000 / r0.x; r0.yzw = v2.xyz * r0.xxx; r0.x = 1.000000000e+000 + -r0.x; r1.xy = float2(1.000000e+000,2.550000e+002) * r0.xx; r1.xy = frac(r1.xy); r2.xyzw = cb2[1].xyzw * r0.zzzz; r2.xyzw = cb2[0].xyzw * r0.yyyy + r2.xyzw; r0.xyzw = cb2[2].xyzw * r0.wwww + r2.xyzw; r0.xyzw = cb2[3].xyzw + r0.xyzw; r2.xyz = -cb1[0].xyz + r0.xyz; r2.x = dot(r2.xyz, r2.xyz); r3.xyz = -cb1[1].xyz + r0.xyz; r2.y = dot(r3.xyz, r3.xyz); r3.xyz = -cb1[2].xyz + r0.xyz; r2.z = dot(r3.xyz, r3.xyz); r3.xyz = -cb1[3].xyz + r0.xyz; r2.w = dot(r3.xyz, r3.xyz); r2.x = r2.x < cb1[4].x; r2.y = r2.y < cb1[4].y; r2.z = r2.z < cb1[4].z; r2.w = r2.w < cb1[4].w; r3.xyz = r2.xyz ? float3(-1.000000e+000,-1.000000e+000,-1.000000e+000) : float3(-0.000000e+000,-0.000000e+000,-0.000000e+000); r2.x = r2.x ? 1 : 0; r2.y = r2.y ? 1 : 0; r2.z = r2.z ? 1 : 0; r2.w = r2.w ? 1 : 0; r2.yzw = r2.yzw + r3.xyz; r2.yzw = max(r2.yzw, float3(0.000000e+000,0.000000e+000,0.000000e+000)); r3.xyz = cb1[13].xyz * r0.yyy; r3.xyz = cb1[12].xyz * r0.xxx + r3.xyz; r3.xyz = cb1[14].xyz * r0.zzz + r3.xyz; r3.xyz = cb1[15].xyz * r0.www + r3.xyz; r3.xyz = r3.xyz * r2.yyy; r4.xyz = cb1[9].xyz * r0.yyy; r4.xyz = cb1[8].xyz * r0.xxx + r4.xyz; r4.xyz = cb1[10].xyz * r0.zzz + r4.xyz; r4.xyz = cb1[11].xyz * r0.www + r4.xyz; r3.xyz = r4.xyz * r2.xxx + r3.xyz; r4.xyz = cb1[17].xyz * r0.yyy; r4.xyz = cb1[16].xyz * r0.xxx + r4.xyz; r4.xyz = cb1[18].xyz * r0.zzz + r4.xyz; r4.xyz = cb1[19].xyz * r0.www + r4.xyz; r2.xyz = r4.xyz * r2.zzz + r3.xyz; r3.xyz = cb1[21].xyz * r0.yyy; r3.xyz = cb1[20].xyz * r0.xxx + r3.xyz; r0.xyz = cb1[22].xyz * r0.zzz + r3.xyz; r0.xyz = cb1[23].xyz * r0.www + r0.xyz; r0.xyz = r0.xyz * r2.www + r2.xyz; r0.x = t1.SampleCmpLevelZero(, r0.xyxx, r0.z).x; //------------------------ERROR r0.y = 1.000000000e+000 + -cb1[24].x; o0.x = r0.x * r0.y + cb1[24].x; o0.z = -r1.y * 3.921568859e-003 + r1.x; o0.w = r1.y; o0.y = 1.000000000e+000; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) D3D Shader Disassembler // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float // TEXCOORD 0 xy 1 NONE float xy // TEXCOORD 1 xyz 2 NONE float xyz // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Target 0 xyzw 0 TARGET float xyzw // ps_4_0 dcl_constantbuffer cb0[8], immediateIndexed dcl_constantbuffer cb1[25], immediateIndexed dcl_constantbuffer cb2[4], immediateIndexed dcl_sampler s0, mode_default dcl_sampler s1, mode_comparison dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t1 dcl_input_ps linear v1.xy dcl_input_ps linear v2.xyz dcl_output o0.xyzw dcl_temps 5 sample r0.xyzw, v1.xyxx, t0.xyzw, s0 mad r0.x, cb0[7].x, r0.x, cb0[7].y div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x mul r0.yzw, r0.xxxx, v2.xxyz add r0.x, -r0.x, l(1.000000) mul r1.xy, r0.xxxx, l(1.000000, 255.000000, 0.000000, 0.000000) frc r1.xy, r1.xyxx mul r2.xyzw, r0.zzzz, cb2[1].xyzw mad r2.xyzw, cb2[0].xyzw, r0.yyyy, r2.xyzw mad r0.xyzw, cb2[2].xyzw, r0.wwww, r2.xyzw add r0.xyzw, r0.xyzw, cb2[3].xyzw add r2.xyz, r0.xyzx, -cb1[0].xyzx dp3 r2.x, r2.xyzx, r2.xyzx add r3.xyz, r0.xyzx, -cb1[1].xyzx dp3 r2.y, r3.xyzx, r3.xyzx add r3.xyz, r0.xyzx, -cb1[2].xyzx dp3 r2.z, r3.xyzx, r3.xyzx add r3.xyz, r0.xyzx, -cb1[3].xyzx dp3 r2.w, r3.xyzx, r3.xyzx lt r2.xyzw, r2.xyzw, cb1[4].xyzw movc r3.xyz, r2.xyzx, l(-1.000000,-1.000000,-1.000000,0), l(-0.000000,-0.000000,-0.000000,0) and r2.xyzw, r2.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000) add r2.yzw, r3.xxyz, r2.yyzw max r2.yzw, r2.yyzw, l(0.000000, 0.000000, 0.000000, 0.000000) mul r3.xyz, r0.yyyy, cb1[13].xyzx mad r3.xyz, cb1[12].xyzx, r0.xxxx, r3.xyzx mad r3.xyz, cb1[14].xyzx, r0.zzzz, r3.xyzx mad r3.xyz, cb1[15].xyzx, r0.wwww, r3.xyzx mul r3.xyz, r2.yyyy, r3.xyzx mul r4.xyz, r0.yyyy, cb1[9].xyzx mad r4.xyz, cb1[8].xyzx, r0.xxxx, r4.xyzx mad r4.xyz, cb1[10].xyzx, r0.zzzz, r4.xyzx mad r4.xyz, cb1[11].xyzx, r0.wwww, r4.xyzx mad r3.xyz, r4.xyzx, r2.xxxx, r3.xyzx mul r4.xyz, r0.yyyy, cb1[17].xyzx mad r4.xyz, cb1[16].xyzx, r0.xxxx, r4.xyzx mad r4.xyz, cb1[18].xyzx, r0.zzzz, r4.xyzx mad r4.xyz, cb1[19].xyzx, r0.wwww, r4.xyzx mad r2.xyz, r4.xyzx, r2.zzzz, r3.xyzx mul r3.xyz, r0.yyyy, cb1[21].xyzx mad r3.xyz, cb1[20].xyzx, r0.xxxx, r3.xyzx mad r0.xyz, cb1[22].xyzx, r0.zzzz, r3.xyzx mad r0.xyz, cb1[23].xyzx, r0.wwww, r0.xyzx mad r0.xyz, r0.xyzx, r2.wwww, r2.xyzx sample_c_lz r0.x, r0.xyxx, t1.xxxx, s1, r0.z add r0.y, -cb1[24].x, l(1.000000) mad o0.x, r0.x, r0.y, cb1[24].x mad o0.z, -r1.y, l(0.003922), r1.x mov o0.w, r1.y mov o0.y, l(1.000000) ret // Approximately 0 instruction slots used [/code] Here's the full log file:
I'm having an issue with a shader not being decompiled correctly using 3Dmigoto v0.94 and v0.82:

The log file shows:
C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(35,13-34): warning X3206: 'Sample': implicit truncation of vector type
C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,32): error X3000: syntax error: unexpected token ','
C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: 'SampleCmpLevelZero': no matching 0 parameter intrinsic method
C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: Possible intrinsic methods are:
C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: Texture2D<float4>.SampleCmpLevelZero(SamplerComparisonState, float2|half2|min10float2|min16float2, float1|half1|min10float1|min16float1)
C:\Program Files (x86)\Steam\steamapps\common\The Golf Club\wrapper1349(85,10-47): error X3013: Texture2D<float4>.SampleCmpLevelZero(SamplerComparisonState, float2|half2|min10float2|min16float2, float1|half1|min10float1|min16float1, int2)


And here's the unedited pixel shader. I marked the 2 lines that have the errors.

df1735a3dd2c2299-ps_replace.txt:
Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s1 : register(s1);

SamplerState s0 : register(s0);

cbuffer cb2 : register(b2)
{
float4 cb2[4];
}

cbuffer cb1 : register(b1)
{
float4 cb1[25];
}

cbuffer cb0 : register(b0)
{
float4 cb0[8];
}


Texture2D<float4> StereoParams : register(t125);

void main(
float4 v0 : SV_POSITION0,
float2 v1 : TEXCOORD0,
float3 v2 : TEXCOORD1,
out float4 o0 : SV_Target0)
{
float4 r0,r1,r2,r3,r4;
uint4 bitmask;
r0.xyzw = t0.Sample(s0, v1.xyxx).xyzw; //------------------------ERROR
r0.x = cb0[7].x * r0.x + cb0[7].y;
r0.x = 1.000000e+000 / r0.x;
r0.yzw = v2.xyz * r0.xxx;
r0.x = 1.000000000e+000 + -r0.x;
r1.xy = float2(1.000000e+000,2.550000e+002) * r0.xx;
r1.xy = frac(r1.xy);
r2.xyzw = cb2[1].xyzw * r0.zzzz;
r2.xyzw = cb2[0].xyzw * r0.yyyy + r2.xyzw;
r0.xyzw = cb2[2].xyzw * r0.wwww + r2.xyzw;
r0.xyzw = cb2[3].xyzw + r0.xyzw;
r2.xyz = -cb1[0].xyz + r0.xyz;
r2.x = dot(r2.xyz, r2.xyz);
r3.xyz = -cb1[1].xyz + r0.xyz;
r2.y = dot(r3.xyz, r3.xyz);
r3.xyz = -cb1[2].xyz + r0.xyz;
r2.z = dot(r3.xyz, r3.xyz);
r3.xyz = -cb1[3].xyz + r0.xyz;
r2.w = dot(r3.xyz, r3.xyz);
r2.x = r2.x < cb1[4].x;
r2.y = r2.y < cb1[4].y;
r2.z = r2.z < cb1[4].z;
r2.w = r2.w < cb1[4].w;
r3.xyz = r2.xyz ? float3(-1.000000e+000,-1.000000e+000,-1.000000e+000) : float3(-0.000000e+000,-0.000000e+000,-0.000000e+000);
r2.x = r2.x ? 1 : 0;
r2.y = r2.y ? 1 : 0;
r2.z = r2.z ? 1 : 0;
r2.w = r2.w ? 1 : 0;
r2.yzw = r2.yzw + r3.xyz;
r2.yzw = max(r2.yzw, float3(0.000000e+000,0.000000e+000,0.000000e+000));
r3.xyz = cb1[13].xyz * r0.yyy;
r3.xyz = cb1[12].xyz * r0.xxx + r3.xyz;
r3.xyz = cb1[14].xyz * r0.zzz + r3.xyz;
r3.xyz = cb1[15].xyz * r0.www + r3.xyz;
r3.xyz = r3.xyz * r2.yyy;
r4.xyz = cb1[9].xyz * r0.yyy;
r4.xyz = cb1[8].xyz * r0.xxx + r4.xyz;
r4.xyz = cb1[10].xyz * r0.zzz + r4.xyz;
r4.xyz = cb1[11].xyz * r0.www + r4.xyz;
r3.xyz = r4.xyz * r2.xxx + r3.xyz;
r4.xyz = cb1[17].xyz * r0.yyy;
r4.xyz = cb1[16].xyz * r0.xxx + r4.xyz;
r4.xyz = cb1[18].xyz * r0.zzz + r4.xyz;
r4.xyz = cb1[19].xyz * r0.www + r4.xyz;
r2.xyz = r4.xyz * r2.zzz + r3.xyz;
r3.xyz = cb1[21].xyz * r0.yyy;
r3.xyz = cb1[20].xyz * r0.xxx + r3.xyz;
r0.xyz = cb1[22].xyz * r0.zzz + r3.xyz;
r0.xyz = cb1[23].xyz * r0.www + r0.xyz;
r0.xyz = r0.xyz * r2.www + r2.xyz;
r0.x = t1.SampleCmpLevelZero(, r0.xyxx, r0.z).x; //------------------------ERROR
r0.y = 1.000000000e+000 + -cb1[24].x;
o0.x = r0.x * r0.y + cb1[24].x;
o0.z = -r1.y * 3.921568859e-003 + r1.x;
o0.w = r1.y;
o0.y = 1.000000000e+000;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float xy
// TEXCOORD 1 xyz 2 NONE float xyz
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_4_0
dcl_constantbuffer cb0[8], immediateIndexed
dcl_constantbuffer cb1[25], immediateIndexed
dcl_constantbuffer cb2[4], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_comparison
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_temps 5
sample r0.xyzw, v1.xyxx, t0.xyzw, s0
mad r0.x, cb0[7].x, r0.x, cb0[7].y
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mul r0.yzw, r0.xxxx, v2.xxyz
add r0.x, -r0.x, l(1.000000)
mul r1.xy, r0.xxxx, l(1.000000, 255.000000, 0.000000, 0.000000)
frc r1.xy, r1.xyxx
mul r2.xyzw, r0.zzzz, cb2[1].xyzw
mad r2.xyzw, cb2[0].xyzw, r0.yyyy, r2.xyzw
mad r0.xyzw, cb2[2].xyzw, r0.wwww, r2.xyzw
add r0.xyzw, r0.xyzw, cb2[3].xyzw
add r2.xyz, r0.xyzx, -cb1[0].xyzx
dp3 r2.x, r2.xyzx, r2.xyzx
add r3.xyz, r0.xyzx, -cb1[1].xyzx
dp3 r2.y, r3.xyzx, r3.xyzx
add r3.xyz, r0.xyzx, -cb1[2].xyzx
dp3 r2.z, r3.xyzx, r3.xyzx
add r3.xyz, r0.xyzx, -cb1[3].xyzx
dp3 r2.w, r3.xyzx, r3.xyzx
lt r2.xyzw, r2.xyzw, cb1[4].xyzw
movc r3.xyz, r2.xyzx, l(-1.000000,-1.000000,-1.000000,0), l(-0.000000,-0.000000,-0.000000,0)
and r2.xyzw, r2.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
add r2.yzw, r3.xxyz, r2.yyzw
max r2.yzw, r2.yyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r3.xyz, r0.yyyy, cb1[13].xyzx
mad r3.xyz, cb1[12].xyzx, r0.xxxx, r3.xyzx
mad r3.xyz, cb1[14].xyzx, r0.zzzz, r3.xyzx
mad r3.xyz, cb1[15].xyzx, r0.wwww, r3.xyzx
mul r3.xyz, r2.yyyy, r3.xyzx
mul r4.xyz, r0.yyyy, cb1[9].xyzx
mad r4.xyz, cb1[8].xyzx, r0.xxxx, r4.xyzx
mad r4.xyz, cb1[10].xyzx, r0.zzzz, r4.xyzx
mad r4.xyz, cb1[11].xyzx, r0.wwww, r4.xyzx
mad r3.xyz, r4.xyzx, r2.xxxx, r3.xyzx
mul r4.xyz, r0.yyyy, cb1[17].xyzx
mad r4.xyz, cb1[16].xyzx, r0.xxxx, r4.xyzx
mad r4.xyz, cb1[18].xyzx, r0.zzzz, r4.xyzx
mad r4.xyz, cb1[19].xyzx, r0.wwww, r4.xyzx
mad r2.xyz, r4.xyzx, r2.zzzz, r3.xyzx
mul r3.xyz, r0.yyyy, cb1[21].xyzx
mad r3.xyz, cb1[20].xyzx, r0.xxxx, r3.xyzx
mad r0.xyz, cb1[22].xyzx, r0.zzzz, r3.xyzx
mad r0.xyz, cb1[23].xyzx, r0.wwww, r0.xyzx
mad r0.xyz, r0.xyzx, r2.wwww, r2.xyzx
sample_c_lz r0.x, r0.xyxx, t1.xxxx, s1, r0.z
add r0.y, -cb1[24].x, l(1.000000)
mad o0.x, r0.x, r0.y, cb1[24].x
mad o0.z, -r1.y, l(0.003922), r1.x
mov o0.w, r1.y
mov o0.y, l(1.000000)
ret
// Approximately 0 instruction slots used


Here's the full log file:
Attachments

d3d11_log.txt.jpg

Dual boot Win 7 x64 & Win 10 (1809) | Geforce Drivers 417.35

Posted 10/27/2014 02:45 AM   
  13 / 143    
Scroll To Top