3Dmigoto now open-source...
  38 / 141    
[quote="DarkStarSword"][quote]Pressing F10 only fixes the problem.[/quote]Hmmm, that's an interesting data point. Pressing F10 will destroy all temporary and cached resources/views that 3DMigoto has created and recreate them... I wonder if the cached view is causing issues... Looks like I have Dirt 3 in my library, so I can take a look at this later. [/quote] This is fixed in 3DMigoto 1.2.12 - it was indeed due to 3DMigoto using a stale cached view: https://github.com/bo3b/3Dmigoto/releases/tag/1.2.12
DarkStarSword said:
Pressing F10 only fixes the problem.
Hmmm, that's an interesting data point. Pressing F10 will destroy all temporary and cached resources/views that 3DMigoto has created and recreate them... I wonder if the cached view is causing issues... Looks like I have Dirt 3 in my library, so I can take a look at this later.


This is fixed in 3DMigoto 1.2.12 - it was indeed due to 3DMigoto using a stale cached view:


https://github.com/bo3b/3Dmigoto/releases/tag/1.2.12

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 11/29/2015 05:01 AM   
Wow, you are quick in fixing bugs. You said you are gonna try Dirt 3, so maybe it's the time to fix the missing decompiler scenario when the float4x4 type has an initialised value as a matrix, but getting only the first row of data as an array, and then the rest of cbuffers after that are missing. That occurs in around 10-20% of Dirt's pixel shaders. [code] ... float devVal : packoffset(c63.w); float intensity : packoffset(c64); float2 decodeLUTIDim : packoffset(c64.y); float4x4 colorXForm : packoffset(c65) = float4x4(1,0,0,0); //here it stops processing the cbuffers inits SamplerState sampler0_s : register(s0); Texture2D<float4> sampler0 : register(t0); ... [/code] [code] ... float devVal : packoffset(c63.w); float intensity : packoffset(c64); float2 decodeLUTIDim : packoffset(c64.y); float4x4 colorXForm : packoffset(c65) = {{1,0,0,0},{0,1,0,0,},{0,0,1,0,},{0,0,0,1}}; //manual correction starts here float4x4 colorXFormBloom : packoffset(c69) = {{1,0,0,0},{0,1,0,0,},{0,0,1,0,},{0,0,0,1}}; float4 paletteWeight : packoffset(c73); float4 focalParams : packoffset(c74); float dofBlurScale : packoffset(c75.x) = 0x40400000 ; float dofDebugOverlay : packoffset(c75.y) = 0x00000000; float4x4 interferenceParams : packoffset(c76); float2 interferenceVelocityDecode : packoffset(c80); } SamplerState sampler0_s : register(s0); Texture2D<float4> sampler0 : register(t0); ... [/code] If it's going to take longer time to implement than I spend on fixing them manually don't bother please :) Edit: Here is the MS compiler output of that part [code] // float devVal; // Offset: 1020 Size: 4 [unused] // float intensity; // Offset: 1024 Size: 4 [unused] // float2 decodeLUTIDim; // Offset: 1028 Size: 8 [unused] // float4x4 colorXForm; // Offset: 1040 Size: 64 [unused] // = 0x3f800000 0x00000000 0x00000000 0x00000000 // 0x00000000 0x3f800000 0x00000000 0x00000000 // 0x00000000 0x00000000 0x3f800000 0x00000000 // 0x00000000 0x00000000 0x00000000 0x3f800000 // float4x4 colorXFormBloom; // Offset: 1104 Size: 64 [unused] // = 0x3f800000 0x00000000 0x00000000 0x00000000 // 0x00000000 0x3f800000 0x00000000 0x00000000 // 0x00000000 0x00000000 0x3f800000 0x00000000 // 0x00000000 0x00000000 0x00000000 0x3f800000 // float4 paletteWeight; // Offset: 1168 Size: 16 [unused] // float4 focalParams; // Offset: 1184 Size: 16 [unused] // float dofBlurScale; // Offset: 1200 Size: 4 [unused] // = 0x40400000 // float dofDebugOverlay; // Offset: 1204 Size: 4 [unused] // = 0x00000000 // float4x4 interferenceParams; // Offset: 1216 Size: 64 [unused] // float2 interferenceVelocityDecode; // Offset: 1280 Size: 8 [unused] [/code]
Wow, you are quick in fixing bugs. You said you are gonna try Dirt 3, so maybe it's the time to fix the missing decompiler scenario when the float4x4 type has an initialised value as a matrix, but getting only the first row of data as an array, and then the rest of cbuffers after that are missing. That occurs in around 10-20% of Dirt's pixel shaders.

...
float devVal : packoffset(c63.w);
float intensity : packoffset(c64);
float2 decodeLUTIDim : packoffset(c64.y);
float4x4 colorXForm : packoffset(c65) = float4x4(1,0,0,0); //here it stops processing the cbuffers inits
SamplerState sampler0_s : register(s0);
Texture2D<float4> sampler0 : register(t0);
...


...
float devVal : packoffset(c63.w);
float intensity : packoffset(c64);
float2 decodeLUTIDim : packoffset(c64.y);
float4x4 colorXForm : packoffset(c65) = {{1,0,0,0},{0,1,0,0,},{0,0,1,0,},{0,0,0,1}}; //manual correction starts here
float4x4 colorXFormBloom : packoffset(c69) = {{1,0,0,0},{0,1,0,0,},{0,0,1,0,},{0,0,0,1}};
float4 paletteWeight : packoffset(c73);
float4 focalParams : packoffset(c74);
float dofBlurScale : packoffset(c75.x) = 0x40400000 ;
float dofDebugOverlay : packoffset(c75.y) = 0x00000000;
float4x4 interferenceParams : packoffset(c76);
float2 interferenceVelocityDecode : packoffset(c80);
}

SamplerState sampler0_s : register(s0);
Texture2D<float4> sampler0 : register(t0);
...


If it's going to take longer time to implement than I spend on fixing them manually don't bother please :)

Edit:
Here is the MS compiler output of that part

//   float devVal;                      // Offset: 1020 Size:     4 [unused]
// float intensity; // Offset: 1024 Size: 4 [unused]
// float2 decodeLUTIDim; // Offset: 1028 Size: 8 [unused]
// float4x4 colorXForm; // Offset: 1040 Size: 64 [unused]
// = 0x3f800000 0x00000000 0x00000000 0x00000000
// 0x00000000 0x3f800000 0x00000000 0x00000000
// 0x00000000 0x00000000 0x3f800000 0x00000000
// 0x00000000 0x00000000 0x00000000 0x3f800000
// float4x4 colorXFormBloom; // Offset: 1104 Size: 64 [unused]
// = 0x3f800000 0x00000000 0x00000000 0x00000000
// 0x00000000 0x3f800000 0x00000000 0x00000000
// 0x00000000 0x00000000 0x3f800000 0x00000000
// 0x00000000 0x00000000 0x00000000 0x3f800000
// float4 paletteWeight; // Offset: 1168 Size: 16 [unused]
// float4 focalParams; // Offset: 1184 Size: 16 [unused]
// float dofBlurScale; // Offset: 1200 Size: 4 [unused]
// = 0x40400000
// float dofDebugOverlay; // Offset: 1204 Size: 4 [unused]
// = 0x00000000
// float4x4 interferenceParams; // Offset: 1216 Size: 64 [unused]
// float2 interferenceVelocityDecode; // Offset: 1280 Size: 8 [unused]

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 11/29/2015 11:00 AM   
[code]// float4x4 colorXForm; // Offset: 1040 Size: 64 [unused] // = 0x3f800000 0x00000000 0x00000000 0x00000000 // 0x00000000 0x3f800000 0x00000000 0x00000000 // 0x00000000 0x00000000 0x3f800000 0x00000000 // 0x00000000 0x00000000 0x00000000 0x3f800000 [/code] Hmmm... Yeah, that's a known problem, and this is the second game that is suffering from this problem that I know of, so I'll push this up higher on my list.
//   float4x4 colorXForm;               // Offset: 1040 Size:    64 [unused]
// = 0x3f800000 0x00000000 0x00000000 0x00000000
// 0x00000000 0x3f800000 0x00000000 0x00000000
// 0x00000000 0x00000000 0x3f800000 0x00000000
// 0x00000000 0x00000000 0x00000000 0x3f800000


Hmmm... Yeah, that's a known problem, and this is the second game that is suffering from this problem that I know of, so I'll push this up higher on my list.

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 11/29/2015 12:46 PM   
Great to hear that Bo3b!
Great to hear that Bo3b!

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 11/30/2015 02:57 AM   
I think I may have found a bug in the decompiler. Please kindly take a look at the below shader code. After saving the water shader all the masking is gone. [code] cbuffer _Globals : register(b0) { float HDRRange : packoffset(c29); float2 AmbientLightMapScale : packoffset(c29.y); float4 normalParams1 : packoffset(c30); float4 normalParams2 : packoffset(c31); float4 normalParams3 : packoffset(c32); float4 normalParams4 : packoffset(c33); float timer : packoffset(c34); float3 shoreColour : packoffset(c34.y); float4 shoreParams1 : packoffset(c35); float3 shoreParams2 : packoffset(c36); float4 screenProj : packoffset(c37); float4 fresnelParams : packoffset(c38); float4 horizonColour : packoffset(c39); float4 nadirColour : packoffset(c40); float4 interactiveParams1 : packoffset(c41); float4 interactiveParams5 : packoffset(c42); float4 waterShadowBlend : packoffset(c43); float4 decodeParam : packoffset(c44); float4 sparkleParams : packoffset(c45); float4 sparkleParams2 : packoffset(c46); float blendValue : packoffset(c47); float4 specularParams : packoffset(c48); float4 waveParams : packoffset(c49); float4 interactiveParams2 : packoffset(c50); float4 interactiveParams3 : packoffset(c51); float4 interactiveParams4 : packoffset(c52); } cbuffer RenderTargetConstantBuffer : register(b2) { float4 viewportDimensions : packoffset(c0); } cbuffer CameraParamsConstantBuffer : register(b3) { float4x4 projection : packoffset(c0); float4x4 viewProjection : packoffset(c4); row_major float3x4 view : packoffset(c8); row_major float3x4 viewI : packoffset(c11); float3 eyePositionWS : packoffset(c14); float4x4 inverseProj : packoffset(c15); bool leftEye : packoffset(c19); bool padding3[3] : packoffset(c20); } cbuffer PerFrameConstantBuffer : register(b1) { float4 colorBufferEncodingParams : packoffset(c0); float4 envMapEncodingParams : packoffset(c1); float4 velocityEncodingParams : packoffset(c2); float4 snowEffectsParam2 : packoffset(c3); float4 sunDirectionAndTime : packoffset(c4); float4 sunColour : packoffset(c5); float4 skylightColour : packoffset(c6); float4 ambientOcclusionScales : packoffset(c7); float4 backlightColour : packoffset(c8); float4 specularScales : packoffset(c9); float3 specularDirection : packoffset(c10); float4 specularColourAndMultiplier : packoffset(c11); float4 fogColour : packoffset(c12); float4 fogParams : packoffset(c13); float4 hazeParams : packoffset(c14); float4 hazeParams2 : packoffset(c15); float4 nightLightmapParam1 : packoffset(c16); float4 nightLightmapParam2 : packoffset(c17); float4 wetLightingParam : packoffset(c18); float4 snowEffectsParam : packoffset(c19); float4 ambientColour : packoffset(c20); float4 shadowBlend : packoffset(c21); float4 maskParams : packoffset(c22); float4 deferredSpecularParams : packoffset(c23); } SamplerState TWaterRippleMap_s : register(s0); SamplerState TPreviousWaterRippleMap_s : register(s1); SamplerState TNormalMap_s : register(s2); SamplerState DepthMap_s : register(s3); SamplerState ReflectionMap_s : register(s4); SamplerState ReflectionMap2_s : register(s5); SamplerState TMaskMap_s : register(s6); SamplerState TWaveFront_s : register(s7); SamplerState TShadowMask_s : register(s10); Texture2D<float4> DepthMap : register(t0); Texture2D<float4> TWaterRippleMap : register(t1); Texture2D<float4> TPreviousWaterRippleMap : register(t2); Texture2D<float4> TNormalMap : register(t3); Texture2D<float4> ReflectionMap : register(t4); Texture2D<float4> ReflectionMap2 : register(t5); Texture2D<float4> TShadowMask : register(t6); Texture2D<float4> TMaskMap : register(t7); Texture2D<float4> TWaveFront : register(t8); Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : SV_Position0, float4 v1 : COLOR1, float4 v2 : TEXCOORD0, float4 v3 : TEXCOORD1, float4 v4 : TEXCOORD2, float4 v5 : TEXCOORD3, float4 v6 : TEXCOORD4, float4 v7 : TEXCOORD5, float4 v8 : TEXCOORD6, float4 v9 : TEXCOORD7, out float4 o0 : SV_Target0) { float4 r0,r1,r2,r3,r4,r5; uint4 bitmask, uiDest; float4 fDest; r0.xy = TWaterRippleMap.Sample(TWaterRippleMap_s, v9.xy).yz; r0.zw = TPreviousWaterRippleMap.Sample(TPreviousWaterRippleMap_s, v9.xy).yz; r0.xy = r0.xy + -r0.zw; r0.xy = blendValue * r0.xy + r0.zw; r0.xy = float2(0.00196078443,0.00196078443) + r0.xy; r0.xy = r0.xy * float2(2,2) + float2(-1,-1); r1.xy = v8.xy / v8.ww; r1.z = 1 + -r1.y; r0.z = DepthMap.Sample(DepthMap_s, r1.xz).x; r0.z = screenProj.z + r0.z; r0.z = screenProj.w / r0.z; r0.w = v9.z + -r0.z; r0.z = -v9.z + r0.z; r0.z = saturate(waveParams.w * abs(r0.z)); r1.y = 0.100000001 + r0.w; r0.w = dot(r0.ww, interactiveParams1.zz); r1.w = 0 < r1.y; r1.y = r1.y < 0; r1.y = ((int)r1.y ? -1 : 0) + ((int)r1.w ? 1 : 0); r1.y = (int)r1.y; r1.y = saturate(r1.y); r1.w = min(0, -r0.w); r0.w = saturate(r0.w); r0.w = max(r1.y, r0.w); r1.w = exp2(r1.w); r1.w = 1 + -r1.w; r1.y = max(r1.y, r1.w); r0.xy = r1.yy * r0.xy; r2.xy = interactiveParams5.xx * r0.xy; r0.xy = interactiveParams1.xx * r0.xy; r0.xy = max(float2(-1,-1), r0.xy); r0.xy = min(float2(1,1), r0.xy); r0.xy = interactiveParams1.yy * r0.xy; r3.xyzw = specularParams.wwww * normalParams2.xxyy; r3.xyzw = r2.xyxy / r3.xyzw; r2.xy = r2.xy / normalParams2.zz; r2.xy = v6.xy + r2.xy; r2.xyz = TNormalMap.Sample(TNormalMap_s, r2.xy).xyz; r2.xyz = r2.xzy * float3(2,2,2) + float3(-1,-1,-1); r3.xyzw = v5.xyzw + r3.xyzw; r4.xyz = TNormalMap.Sample(TNormalMap_s, r3.zw).xyz; r3.xyz = TNormalMap.Sample(TNormalMap_s, r3.xy).xyz; r3.xyz = r3.xzy * float3(2,2,2) + float3(-1,-1,-1); r4.xyz = r4.xzy * float3(2,2,2) + float3(-1,-1,-1); r4.xyz = normalParams3.yyy * r4.xyz; r3.xyz = normalParams3.xxx * r3.xyz + r4.xyz; r2.xyz = normalParams3.zzz * r2.xyz + r3.xyz; r2.xz = r0.xy * r2.yy + r2.xz; r0.x = dot(r2.xyz, r2.xyz); r0.x = rsqrt(r0.x); r2.xyz = r2.xyz * r0.xxx; r2.xyz = normalParams3.www * r2.xyz; r3.xyz = -eyePositionWS.xyz + v7.xyz; r0.x = dot(r3.xyz, r3.xyz); r0.y = sqrt(r0.x); r0.x = saturate(r0.x * shadowBlend.x + shadowBlend.y); r3.xyz = r3.xyz / r0.yyy; r0.y = -sparkleParams2.z + r0.y; r1.w = dot(r3.xyz, r2.xyz); r1.w = saturate(1 + r1.w); r3.xyz = -nadirColour.xyz + horizonColour.xyz; r3.xyz = r1.www * r3.xyz + nadirColour.xyz; r4.xyz = shoreColour.xyz + -r3.xyz; r3.xyz = v4.www * r4.xyz + r3.xyz; r2.y = saturate(maskParams.w); r2.w = 1 + -r2.y; r0.x = r2.w * r0.x; r4.y = v8.w + -v8.y; r4.zw = maskParams.xx * viewportDimensions.zw; r4.x = v8.x; r4.xy = v8.ww * r4.zw + r4.xy; r4.xy = r4.xy / v8.ww; r4.xyzw = TShadowMask.Sample(TShadowMask_s, r4.xy).xyzw; r2.w = 1 + -r4.x; r2.w = r2.y * r2.w + r4.x; r3.w = 1 + -r2.w; r0.x = r0.x * r3.w + r2.w; r2.w = 1 + -r0.x; r0.x = r0.z * r2.w + r0.x; r4.xyz = maskParams.www * r4.yzw + -r0.xxx; r4.xyz = r2.yyy * r4.xyz + r0.xxx; r5.xyz = r4.xyz * r3.xyz; r3.xyz = -r3.xyz * r4.xyz + shoreParams2.zzz; r4.xyzw = normalParams4.xyzw + v7.xzxz; r4.xyzw = sparkleParams2.xxxx * r4.xyzw; r4.xyzw = specularParams.wwww * r4.xyzw; r4.xyzw = float4(0.0500000007,0.0500000007,0.0500000007,0.0500000007) * r4.xyzw; r0.x = TMaskMap.Sample(TMaskMap_s, r4.xy).x; r0.z = TMaskMap.Sample(TMaskMap_s, r4.zw).z; r0.x = r0.x + r0.z; r4.xyzw = shoreParams1.xyzw + v7.xzxz; r4.xyzw = shoreParams2.xxyy * r4.xyzw; r4.xyzw = float4(0.0500000007,0.0500000007,0.0500000007,0.0500000007) * r4.xyzw; r2.yw = TWaveFront.Sample(TWaveFront_s, r4.xy).yz; r4.xy = TWaveFront.Sample(TWaveFront_s, r4.zw).yz; r0.z = r4.y + r2.w; r2.y = r4.x * r2.y; r0.z = v4.w * r0.z; r0.z = r0.x * r0.z; r2.w = r2.y * r0.z; r0.z = -r2.y * r0.z + 1; r3.xyz = r2.www * r3.xyz + r5.xyz; r2.y = interactiveParams4.z * 0.300000012; r2.w = interactiveParams4.w * 0.300000012 + -r2.y; r2.y = r1.w * r2.w + r2.y; r1.w = log2(r1.w); r1.w = fresnelParams.z * r1.w; r1.w = exp2(r1.w); r1.xz = saturate(r2.xz * r2.yy + r1.xz); r2.xyzw = ReflectionMap.Sample(ReflectionMap_s, r1.xz).xyzw; r4.xyzw = ReflectionMap2.Sample(ReflectionMap2_s, r1.xz).xyzw; r2.xyzw = leftEye ? r2.xyzw : r4.xyzw; r4.xyz = colorBufferEncodingParams.yyy * r2.xyz; r2.xyz = r2.xyz * colorBufferEncodingParams.www + float3(1,1,1); r2.xyz = r4.xyz / r2.xyz; r2.xyz = r2.xyz + -r3.xyz; r1.x = fresnelParams.y + -fresnelParams.x; r1.x = r1.w * r1.x + fresnelParams.x; r1.x = r1.x * r2.w; r1.x = r1.x * r0.z; r1.xzw = r1.xxx * r2.xyz + r3.xyz; r2.x = sparkleParams2.w + -sparkleParams2.z; r0.y = saturate(r0.y / r2.x); r0.y = 1 + -r0.y; r0.y = sparkleParams.x * r0.y; r0.x = r0.y * r0.x; r2.xy = sparkleParams.yy * v7.zx; r2.xy = float2(0.0500000007,0.0500000007) * r2.xy; r2.zw = waveParams.xy * timer; r3.xy = r2.zw * normalParams1.ww + r2.yx; r2.xy = r2.zw * normalParams2.ww + r2.xy; r0.y = TMaskMap.Sample(TMaskMap_s, r2.xy).y; r2.x = TMaskMap.Sample(TMaskMap_s, r3.xy).y; r0.x = r2.x * r0.x; r0.x = r0.x * r0.y; r0.xyz = r0.xxx * r0.zzz + r1.xzw; r0.xyz = r0.xyz * v1.www + v1.xyz; r1.xzw = colorBufferEncodingParams.zzz * r0.xyz; r0.xyz = r0.xyz * colorBufferEncodingParams.xxx + float3(1,1,1); o0.xyz = r1.xzw / r0.xyz; r0.x = saturate(v9.w); r0.x = min(r0.x, r1.y); o0.w = r0.x * r0.w; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // using 3Dmigoto v1.2.12 on Mon Nov 30 20:25:18 2015 // // // Buffer Definitions: // // cbuffer $Globals // { // // float HDRRange; // Offset: 464 Size: 4 [unused] // float2 AmbientLightMapScale; // Offset: 468 Size: 8 [unused] // float4 normalParams1; // Offset: 480 Size: 16 // float4 normalParams2; // Offset: 496 Size: 16 // float4 normalParams3; // Offset: 512 Size: 16 // float4 normalParams4; // Offset: 528 Size: 16 // float timer; // Offset: 544 Size: 4 // float3 shoreColour; // Offset: 548 Size: 12 // float4 shoreParams1; // Offset: 560 Size: 16 // float3 shoreParams2; // Offset: 576 Size: 12 // float4 screenProj; // Offset: 592 Size: 16 // float4 fresnelParams; // Offset: 608 Size: 16 // float4 horizonColour; // Offset: 624 Size: 16 // float4 nadirColour; // Offset: 640 Size: 16 // float4 interactiveParams1; // Offset: 656 Size: 16 // float4 interactiveParams5; // Offset: 672 Size: 16 // float4 waterShadowBlend; // Offset: 688 Size: 16 [unused] // float4 decodeParam; // Offset: 704 Size: 16 [unused] // float4 sparkleParams; // Offset: 720 Size: 16 // float4 sparkleParams2; // Offset: 736 Size: 16 // float blendValue; // Offset: 752 Size: 4 // float4 specularParams; // Offset: 768 Size: 16 // float4 waveParams; // Offset: 784 Size: 16 // float4 interactiveParams2; // Offset: 800 Size: 16 [unused] // float4 interactiveParams3; // Offset: 816 Size: 16 [unused] // float4 interactiveParams4; // Offset: 832 Size: 16 // // } // // cbuffer RenderTargetConstantBuffer // { // // float4 viewportDimensions; // Offset: 0 Size: 16 // // } // // cbuffer CameraParamsConstantBuffer // { // // float4x4 projection; // Offset: 0 Size: 64 [unused] // float4x4 viewProjection; // Offset: 64 Size: 64 [unused] // row_major float3x4 view; // Offset: 128 Size: 48 [unused] // row_major float3x4 viewI; // Offset: 176 Size: 48 [unused] // float3 eyePositionWS; // Offset: 224 Size: 12 // float4x4 inverseProj; // Offset: 240 Size: 64 [unused] // bool leftEye; // Offset: 304 Size: 4 // bool padding3[3]; // Offset: 320 Size: 36 [unused] // // } // // cbuffer PerFrameConstantBuffer // { // // float4 colorBufferEncodingParams; // Offset: 0 Size: 16 // float4 envMapEncodingParams; // Offset: 16 Size: 16 [unused] // float4 velocityEncodingParams; // Offset: 32 Size: 16 [unused] // float4 snowEffectsParam2; // Offset: 48 Size: 16 [unused] // float4 sunDirectionAndTime; // Offset: 64 Size: 16 [unused] // float4 sunColour; // Offset: 80 Size: 16 [unused] // float4 skylightColour; // Offset: 96 Size: 16 [unused] // float4 ambientOcclusionScales; // Offset: 112 Size: 16 [unused] // float4 backlightColour; // Offset: 128 Size: 16 [unused] // float4 specularScales; // Offset: 144 Size: 16 [unused] // float3 specularDirection; // Offset: 160 Size: 12 [unused] // float4 specularColourAndMultiplier;// Offset: 176 Size: 16 [unused] // float4 fogColour; // Offset: 192 Size: 16 [unused] // float4 fogParams; // Offset: 208 Size: 16 [unused] // float4 hazeParams; // Offset: 224 Size: 16 [unused] // float4 hazeParams2; // Offset: 240 Size: 16 [unused] // float4 nightLightmapParam1; // Offset: 256 Size: 16 [unused] // float4 nightLightmapParam2; // Offset: 272 Size: 16 [unused] // float4 wetLightingParam; // Offset: 288 Size: 16 [unused] // float4 snowEffectsParam; // Offset: 304 Size: 16 [unused] // float4 ambientColour; // Offset: 320 Size: 16 [unused] // float4 shadowBlend; // Offset: 336 Size: 16 // float4 maskParams; // Offset: 352 Size: 16 // float4 deferredSpecularParams; // Offset: 368 Size: 16 [unused] // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // TWaterRippleMap sampler NA NA 0 1 // TPreviousWaterRippleMap sampler NA NA 1 1 // TNormalMap sampler NA NA 2 1 // DepthMap sampler NA NA 3 1 // ReflectionMap sampler NA NA 4 1 // ReflectionMap2 sampler NA NA 5 1 // TMaskMap sampler NA NA 6 1 // TWaveFront sampler NA NA 7 1 // TShadowMask sampler NA NA 10 1 // DepthMap texture float4 2d 0 1 // TWaterRippleMap texture float4 2d 1 1 // TPreviousWaterRippleMap texture float4 2d 2 1 // TNormalMap texture float4 2d 3 1 // ReflectionMap texture float4 2d 4 1 // ReflectionMap2 texture float4 2d 5 1 // TShadowMask texture float4 2d 6 1 // TMaskMap texture float4 2d 7 1 // TWaveFront texture float4 2d 8 1 // $Globals cbuffer NA NA 0 1 // PerFrameConstantBuffer cbuffer NA NA 1 1 // RenderTargetConstantBuffer cbuffer NA NA 2 1 // CameraParamsConstantBuffer cbuffer NA NA 3 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 POS float // COLOR 1 xyzw 1 NONE float xyzw // TEXCOORD 0 xyzw 2 NONE float // TEXCOORD 1 xyzw 3 NONE float // TEXCOORD 2 xyzw 4 NONE float w // TEXCOORD 3 xyzw 5 NONE float xyzw // TEXCOORD 4 xyzw 6 NONE float xy // TEXCOORD 5 xyz 7 NONE float xyz // TEXCOORD 6 xyzw 8 NONE float xy w // TEXCOORD 7 xyzw 9 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[53], immediateIndexed dcl_constantbuffer cb2[1], immediateIndexed dcl_constantbuffer cb3[20], immediateIndexed dcl_constantbuffer cb1[23], immediateIndexed dcl_sampler s0, mode_default dcl_sampler s1, mode_default dcl_sampler s2, mode_default dcl_sampler s3, mode_default dcl_sampler s4, mode_default dcl_sampler s5, mode_default dcl_sampler s6, mode_default dcl_sampler s7, mode_default dcl_sampler s10, mode_default dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t1 dcl_resource_texture2d (float,float,float,float) t2 dcl_resource_texture2d (float,float,float,float) t3 dcl_resource_texture2d (float,float,float,float) t4 dcl_resource_texture2d (float,float,float,float) t5 dcl_resource_texture2d (float,float,float,float) t6 dcl_resource_texture2d (float,float,float,float) t7 dcl_resource_texture2d (float,float,float,float) t8 dcl_input_ps linear v1.xyzw dcl_input_ps linear centroid v4.w dcl_input_ps linear centroid v5.xyzw dcl_input_ps linear centroid v6.xy dcl_input_ps linear centroid v7.xyz dcl_input_ps linear v8.xyw dcl_input_ps linear centroid v9.xyzw dcl_output o0.xyzw dcl_temps 6 sample_indexable(texture2d)(float,float,float,float) r0.xy, v9.xyxx, t1.yzxw, s0 sample_indexable(texture2d)(float,float,float,float) r0.zw, v9.xyxx, t2.xwyz, s1 add r0.xy, -r0.zwzz, r0.xyxx mad r0.xy, cb0[47].xxxx, r0.xyxx, r0.zwzz add r0.xy, r0.xyxx, l(0.00196078443, 0.00196078443, 0.000000, 0.000000) mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000) div r1.xy, v8.xyxx, v8.wwww add r1.z, -r1.y, l(1.000000) sample_indexable(texture2d)(float,float,float,float) r0.z, r1.xzxx, t0.yzxw, s3 add r0.z, r0.z, cb0[37].z div r0.z, cb0[37].w, r0.z add r0.w, -r0.z, v9.z add r0.z, r0.z, -v9.z mul_sat r0.z, |r0.z|, cb0[49].w add r1.y, r0.w, l(0.100000) dp2 r0.w, r0.wwww, cb0[41].zzzz lt r1.w, l(0.000000), r1.y lt r1.y, r1.y, l(0.000000) iadd r1.y, -r1.y, r1.w itof r1.y, r1.y mov_sat r1.y, r1.y min r1.w, -r0.w, l(0.000000) mov_sat r0.w, r0.w max r0.w, r0.w, r1.y exp r1.w, r1.w add r1.w, -r1.w, l(1.000000) max r1.y, r1.w, r1.y mul r0.xy, r0.xyxx, r1.yyyy mul r2.xy, r0.xyxx, cb0[42].xxxx mul r0.xy, r0.xyxx, cb0[41].xxxx max r0.xy, r0.xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000) min r0.xy, r0.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000) mul r0.xy, r0.xyxx, cb0[41].yyyy mul r3.xyzw, cb0[31].xxyy, cb0[48].wwww div r3.xyzw, r2.xyxy, r3.xyzw div r2.xy, r2.xyxx, cb0[31].zzzz add r2.xy, r2.xyxx, v6.xyxx sample_indexable(texture2d)(float,float,float,float) r2.xyz, r2.xyxx, t3.xyzw, s2 mad r2.xyz, r2.xzyx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000) add r3.xyzw, r3.xyzw, v5.xyzw sample_indexable(texture2d)(float,float,float,float) r4.xyz, r3.zwzz, t3.xyzw, s2 sample_indexable(texture2d)(float,float,float,float) r3.xyz, r3.xyxx, t3.xyzw, s2 mad r3.xyz, r3.xzyx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000) mad r4.xyz, r4.xzyx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000) mul r4.xyz, r4.xyzx, cb0[32].yyyy mad r3.xyz, cb0[32].xxxx, r3.xyzx, r4.xyzx mad r2.xyz, cb0[32].zzzz, r2.xyzx, r3.xyzx mad r2.xz, r0.xxyx, r2.yyyy, r2.xxzx dp3 r0.x, r2.xyzx, r2.xyzx rsq r0.x, r0.x mul r2.xyz, r0.xxxx, r2.xyzx mul r2.xyz, r2.xyzx, cb0[32].wwww add r3.xyz, v7.xyzx, -cb3[14].xyzx dp3 r0.x, r3.xyzx, r3.xyzx sqrt r0.y, r0.x mad_sat r0.x, r0.x, cb1[21].x, cb1[21].y div r3.xyz, r3.xyzx, r0.yyyy add r0.y, r0.y, -cb0[46].z dp3 r1.w, r3.xyzx, r2.xyzx add_sat r1.w, r1.w, l(1.000000) add r3.xyz, cb0[39].xyzx, -cb0[40].xyzx mad r3.xyz, r1.wwww, r3.xyzx, cb0[40].xyzx add r4.xyz, -r3.xyzx, cb0[34].yzwy mad r3.xyz, v4.wwww, r4.xyzx, r3.xyzx mov_sat r2.y, cb1[22].w add r2.w, -r2.y, l(1.000000) mul r0.x, r0.x, r2.w add r4.y, -v8.y, v8.w mul r4.zw, cb2[0].zzzw, cb1[22].xxxx mov r4.x, v8.x mad r4.xy, v8.wwww, r4.zwzz, r4.xyxx div r4.xy, r4.xyxx, v8.wwww sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyxx, t6.xyzw, s10 add r2.w, -r4.x, l(1.000000) mad r2.w, r2.y, r2.w, r4.x add r3.w, -r2.w, l(1.000000) mad r0.x, r0.x, r3.w, r2.w add r2.w, -r0.x, l(1.000000) mad r0.x, r0.z, r2.w, r0.x mad r4.xyz, cb1[22].wwww, r4.yzwy, -r0.xxxx mad r4.xyz, r2.yyyy, r4.xyzx, r0.xxxx mul r5.xyz, r3.xyzx, r4.xyzx mad r3.xyz, -r3.xyzx, r4.xyzx, cb0[36].zzzz add r4.xyzw, v7.xzxz, cb0[33].xyzw mul r4.xyzw, r4.xyzw, cb0[46].xxxx mul r4.xyzw, r4.xyzw, cb0[48].wwww mul r4.xyzw, r4.xyzw, l(0.050000, 0.050000, 0.050000, 0.050000) sample_indexable(texture2d)(float,float,float,float) r0.x, r4.xyxx, t7.xyzw, s6 sample_indexable(texture2d)(float,float,float,float) r0.z, r4.zwzz, t7.xyzw, s6 add r0.x, r0.z, r0.x add r4.xyzw, v7.xzxz, cb0[35].xyzw mul r4.xyzw, r4.xyzw, cb0[36].xxyy mul r4.xyzw, r4.xyzw, l(0.050000, 0.050000, 0.050000, 0.050000) sample_indexable(texture2d)(float,float,float,float) r2.yw, r4.xyxx, t8.xywz, s7 sample_indexable(texture2d)(float,float,float,float) r4.xy, r4.zwzz, t8.yzxw, s7 add r0.z, r2.w, r4.y mul r2.y, r2.y, r4.x mul r0.z, r0.z, v4.w mul r0.z, r0.z, r0.x mul r2.w, r0.z, r2.y mad r0.z, -r2.y, r0.z, l(1.000000) mad r3.xyz, r2.wwww, r3.xyzx, r5.xyzx mul r2.y, l(0.300000), cb0[52].z mad r2.w, cb0[52].w, l(0.300000), -r2.y mad r2.y, r1.w, r2.w, r2.y log r1.w, r1.w mul r1.w, r1.w, cb0[38].z exp r1.w, r1.w mad_sat r1.xz, r2.xxzx, r2.yyyy, r1.xxzx sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r1.xzxx, t4.xyzw, s4 sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r1.xzxx, t5.xyzw, s5 movc r2.xyzw, cb3[19].xxxx, r2.xyzw, r4.xyzw mul r4.xyz, r2.xyzx, cb1[0].yyyy mad r2.xyz, r2.xyzx, cb1[0].wwww, l(1.000000, 1.000000, 1.000000, 0.000000) div r2.xyz, r4.xyzx, r2.xyzx add r2.xyz, -r3.xyzx, r2.xyzx add r1.x, -cb0[38].x, cb0[38].y mad r1.x, r1.w, r1.x, cb0[38].x mul r1.x, r2.w, r1.x mul r1.x, r0.z, r1.x mad r1.xzw, r1.xxxx, r2.xxyz, r3.xxyz add r2.x, -cb0[46].z, cb0[46].w div_sat r0.y, r0.y, r2.x add r0.y, -r0.y, l(1.000000) mul r0.y, r0.y, cb0[45].x mul r0.x, r0.x, r0.y mul r2.xy, v7.zxzz, cb0[45].yyyy mul r2.xy, r2.xyxx, l(0.050000, 0.050000, 0.000000, 0.000000) mul r2.zw, cb0[34].xxxx, cb0[49].xxxy mad r3.xy, r2.zwzz, cb0[30].wwww, r2.yxyy mad r2.xy, r2.zwzz, cb0[31].wwww, r2.xyxx sample_indexable(texture2d)(float,float,float,float) r0.y, r2.xyxx, t7.xyzw, s6 sample_indexable(texture2d)(float,float,float,float) r2.x, r3.xyxx, t7.yxzw, s6 mul r0.x, r0.x, r2.x mul r0.x, r0.y, r0.x mad r0.xyz, r0.xxxx, r0.zzzz, r1.xzwx mad r0.xyz, r0.xyzx, v1.wwww, v1.xyzx mul r1.xzw, r0.xxyz, cb1[0].zzzz mad r0.xyz, r0.xyzx, cb1[0].xxxx, l(1.000000, 1.000000, 1.000000, 0.000000) div o0.xyz, r1.xzwx, r0.xyzx mov_sat r0.x, v9.w min r0.x, r1.y, r0.x mul o0.w, r0.w, r0.x ret // Approximately 144 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] Here are the screenshots before and after pressing 3 on the numpad. [img]http://i.imgur.com/HfwcgUJ.jpg[/img] [img]http://i.imgur.com/5Gdj8aC.jpg[/img] what is even funnier the artiffacts are random, sometimes the masking is gone, sometimes the color of reflections gets darker.
I think I may have found a bug in the decompiler. Please kindly take a look at the below shader code. After saving the water shader all the masking is gone.

cbuffer _Globals : register(b0)
{
float HDRRange : packoffset(c29);
float2 AmbientLightMapScale : packoffset(c29.y);
float4 normalParams1 : packoffset(c30);
float4 normalParams2 : packoffset(c31);
float4 normalParams3 : packoffset(c32);
float4 normalParams4 : packoffset(c33);
float timer : packoffset(c34);
float3 shoreColour : packoffset(c34.y);
float4 shoreParams1 : packoffset(c35);
float3 shoreParams2 : packoffset(c36);
float4 screenProj : packoffset(c37);
float4 fresnelParams : packoffset(c38);
float4 horizonColour : packoffset(c39);
float4 nadirColour : packoffset(c40);
float4 interactiveParams1 : packoffset(c41);
float4 interactiveParams5 : packoffset(c42);
float4 waterShadowBlend : packoffset(c43);
float4 decodeParam : packoffset(c44);
float4 sparkleParams : packoffset(c45);
float4 sparkleParams2 : packoffset(c46);
float blendValue : packoffset(c47);
float4 specularParams : packoffset(c48);
float4 waveParams : packoffset(c49);
float4 interactiveParams2 : packoffset(c50);
float4 interactiveParams3 : packoffset(c51);
float4 interactiveParams4 : packoffset(c52);
}

cbuffer RenderTargetConstantBuffer : register(b2)
{
float4 viewportDimensions : packoffset(c0);
}

cbuffer CameraParamsConstantBuffer : register(b3)
{
float4x4 projection : packoffset(c0);
float4x4 viewProjection : packoffset(c4);
row_major float3x4 view : packoffset(c8);
row_major float3x4 viewI : packoffset(c11);
float3 eyePositionWS : packoffset(c14);
float4x4 inverseProj : packoffset(c15);
bool leftEye : packoffset(c19);
bool padding3[3] : packoffset(c20);
}

cbuffer PerFrameConstantBuffer : register(b1)
{
float4 colorBufferEncodingParams : packoffset(c0);
float4 envMapEncodingParams : packoffset(c1);
float4 velocityEncodingParams : packoffset(c2);
float4 snowEffectsParam2 : packoffset(c3);
float4 sunDirectionAndTime : packoffset(c4);
float4 sunColour : packoffset(c5);
float4 skylightColour : packoffset(c6);
float4 ambientOcclusionScales : packoffset(c7);
float4 backlightColour : packoffset(c8);
float4 specularScales : packoffset(c9);
float3 specularDirection : packoffset(c10);
float4 specularColourAndMultiplier : packoffset(c11);
float4 fogColour : packoffset(c12);
float4 fogParams : packoffset(c13);
float4 hazeParams : packoffset(c14);
float4 hazeParams2 : packoffset(c15);
float4 nightLightmapParam1 : packoffset(c16);
float4 nightLightmapParam2 : packoffset(c17);
float4 wetLightingParam : packoffset(c18);
float4 snowEffectsParam : packoffset(c19);
float4 ambientColour : packoffset(c20);
float4 shadowBlend : packoffset(c21);
float4 maskParams : packoffset(c22);
float4 deferredSpecularParams : packoffset(c23);
}
SamplerState TWaterRippleMap_s : register(s0);
SamplerState TPreviousWaterRippleMap_s : register(s1);
SamplerState TNormalMap_s : register(s2);
SamplerState DepthMap_s : register(s3);
SamplerState ReflectionMap_s : register(s4);
SamplerState ReflectionMap2_s : register(s5);
SamplerState TMaskMap_s : register(s6);
SamplerState TWaveFront_s : register(s7);
SamplerState TShadowMask_s : register(s10);
Texture2D<float4> DepthMap : register(t0);
Texture2D<float4> TWaterRippleMap : register(t1);
Texture2D<float4> TPreviousWaterRippleMap : register(t2);
Texture2D<float4> TNormalMap : register(t3);
Texture2D<float4> ReflectionMap : register(t4);
Texture2D<float4> ReflectionMap2 : register(t5);
Texture2D<float4> TShadowMask : register(t6);
Texture2D<float4> TMaskMap : register(t7);
Texture2D<float4> TWaveFront : register(t8);

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

void main(
float4 v0 : SV_Position0,
float4 v1 : COLOR1,
float4 v2 : TEXCOORD0,
float4 v3 : TEXCOORD1,
float4 v4 : TEXCOORD2,
float4 v5 : TEXCOORD3,
float4 v6 : TEXCOORD4,
float4 v7 : TEXCOORD5,
float4 v8 : TEXCOORD6,
float4 v9 : TEXCOORD7,
out float4 o0 : SV_Target0)
{
float4 r0,r1,r2,r3,r4,r5;
uint4 bitmask, uiDest;
float4 fDest;

r0.xy = TWaterRippleMap.Sample(TWaterRippleMap_s, v9.xy).yz;
r0.zw = TPreviousWaterRippleMap.Sample(TPreviousWaterRippleMap_s, v9.xy).yz;
r0.xy = r0.xy + -r0.zw;
r0.xy = blendValue * r0.xy + r0.zw;
r0.xy = float2(0.00196078443,0.00196078443) + r0.xy;
r0.xy = r0.xy * float2(2,2) + float2(-1,-1);
r1.xy = v8.xy / v8.ww;
r1.z = 1 + -r1.y;
r0.z = DepthMap.Sample(DepthMap_s, r1.xz).x;
r0.z = screenProj.z + r0.z;
r0.z = screenProj.w / r0.z;
r0.w = v9.z + -r0.z;
r0.z = -v9.z + r0.z;
r0.z = saturate(waveParams.w * abs(r0.z));
r1.y = 0.100000001 + r0.w;
r0.w = dot(r0.ww, interactiveParams1.zz);
r1.w = 0 < r1.y;
r1.y = r1.y < 0;
r1.y = ((int)r1.y ? -1 : 0) + ((int)r1.w ? 1 : 0);
r1.y = (int)r1.y;
r1.y = saturate(r1.y);
r1.w = min(0, -r0.w);
r0.w = saturate(r0.w);
r0.w = max(r1.y, r0.w);
r1.w = exp2(r1.w);
r1.w = 1 + -r1.w;
r1.y = max(r1.y, r1.w);
r0.xy = r1.yy * r0.xy;
r2.xy = interactiveParams5.xx * r0.xy;
r0.xy = interactiveParams1.xx * r0.xy;
r0.xy = max(float2(-1,-1), r0.xy);
r0.xy = min(float2(1,1), r0.xy);
r0.xy = interactiveParams1.yy * r0.xy;
r3.xyzw = specularParams.wwww * normalParams2.xxyy;
r3.xyzw = r2.xyxy / r3.xyzw;
r2.xy = r2.xy / normalParams2.zz;
r2.xy = v6.xy + r2.xy;
r2.xyz = TNormalMap.Sample(TNormalMap_s, r2.xy).xyz;
r2.xyz = r2.xzy * float3(2,2,2) + float3(-1,-1,-1);
r3.xyzw = v5.xyzw + r3.xyzw;
r4.xyz = TNormalMap.Sample(TNormalMap_s, r3.zw).xyz;
r3.xyz = TNormalMap.Sample(TNormalMap_s, r3.xy).xyz;
r3.xyz = r3.xzy * float3(2,2,2) + float3(-1,-1,-1);
r4.xyz = r4.xzy * float3(2,2,2) + float3(-1,-1,-1);
r4.xyz = normalParams3.yyy * r4.xyz;
r3.xyz = normalParams3.xxx * r3.xyz + r4.xyz;
r2.xyz = normalParams3.zzz * r2.xyz + r3.xyz;
r2.xz = r0.xy * r2.yy + r2.xz;
r0.x = dot(r2.xyz, r2.xyz);
r0.x = rsqrt(r0.x);
r2.xyz = r2.xyz * r0.xxx;
r2.xyz = normalParams3.www * r2.xyz;
r3.xyz = -eyePositionWS.xyz + v7.xyz;
r0.x = dot(r3.xyz, r3.xyz);
r0.y = sqrt(r0.x);
r0.x = saturate(r0.x * shadowBlend.x + shadowBlend.y);
r3.xyz = r3.xyz / r0.yyy;
r0.y = -sparkleParams2.z + r0.y;
r1.w = dot(r3.xyz, r2.xyz);
r1.w = saturate(1 + r1.w);
r3.xyz = -nadirColour.xyz + horizonColour.xyz;
r3.xyz = r1.www * r3.xyz + nadirColour.xyz;
r4.xyz = shoreColour.xyz + -r3.xyz;
r3.xyz = v4.www * r4.xyz + r3.xyz;
r2.y = saturate(maskParams.w);
r2.w = 1 + -r2.y;
r0.x = r2.w * r0.x;
r4.y = v8.w + -v8.y;
r4.zw = maskParams.xx * viewportDimensions.zw;
r4.x = v8.x;
r4.xy = v8.ww * r4.zw + r4.xy;
r4.xy = r4.xy / v8.ww;
r4.xyzw = TShadowMask.Sample(TShadowMask_s, r4.xy).xyzw;
r2.w = 1 + -r4.x;
r2.w = r2.y * r2.w + r4.x;
r3.w = 1 + -r2.w;
r0.x = r0.x * r3.w + r2.w;
r2.w = 1 + -r0.x;
r0.x = r0.z * r2.w + r0.x;
r4.xyz = maskParams.www * r4.yzw + -r0.xxx;
r4.xyz = r2.yyy * r4.xyz + r0.xxx;
r5.xyz = r4.xyz * r3.xyz;
r3.xyz = -r3.xyz * r4.xyz + shoreParams2.zzz;
r4.xyzw = normalParams4.xyzw + v7.xzxz;
r4.xyzw = sparkleParams2.xxxx * r4.xyzw;
r4.xyzw = specularParams.wwww * r4.xyzw;
r4.xyzw = float4(0.0500000007,0.0500000007,0.0500000007,0.0500000007) * r4.xyzw;
r0.x = TMaskMap.Sample(TMaskMap_s, r4.xy).x;
r0.z = TMaskMap.Sample(TMaskMap_s, r4.zw).z;
r0.x = r0.x + r0.z;
r4.xyzw = shoreParams1.xyzw + v7.xzxz;
r4.xyzw = shoreParams2.xxyy * r4.xyzw;
r4.xyzw = float4(0.0500000007,0.0500000007,0.0500000007,0.0500000007) * r4.xyzw;
r2.yw = TWaveFront.Sample(TWaveFront_s, r4.xy).yz;
r4.xy = TWaveFront.Sample(TWaveFront_s, r4.zw).yz;
r0.z = r4.y + r2.w;
r2.y = r4.x * r2.y;
r0.z = v4.w * r0.z;
r0.z = r0.x * r0.z;
r2.w = r2.y * r0.z;
r0.z = -r2.y * r0.z + 1;
r3.xyz = r2.www * r3.xyz + r5.xyz;
r2.y = interactiveParams4.z * 0.300000012;
r2.w = interactiveParams4.w * 0.300000012 + -r2.y;
r2.y = r1.w * r2.w + r2.y;
r1.w = log2(r1.w);
r1.w = fresnelParams.z * r1.w;
r1.w = exp2(r1.w);
r1.xz = saturate(r2.xz * r2.yy + r1.xz);
r2.xyzw = ReflectionMap.Sample(ReflectionMap_s, r1.xz).xyzw;
r4.xyzw = ReflectionMap2.Sample(ReflectionMap2_s, r1.xz).xyzw;
r2.xyzw = leftEye ? r2.xyzw : r4.xyzw;
r4.xyz = colorBufferEncodingParams.yyy * r2.xyz;
r2.xyz = r2.xyz * colorBufferEncodingParams.www + float3(1,1,1);
r2.xyz = r4.xyz / r2.xyz;
r2.xyz = r2.xyz + -r3.xyz;
r1.x = fresnelParams.y + -fresnelParams.x;
r1.x = r1.w * r1.x + fresnelParams.x;
r1.x = r1.x * r2.w;
r1.x = r1.x * r0.z;
r1.xzw = r1.xxx * r2.xyz + r3.xyz;
r2.x = sparkleParams2.w + -sparkleParams2.z;
r0.y = saturate(r0.y / r2.x);
r0.y = 1 + -r0.y;
r0.y = sparkleParams.x * r0.y;
r0.x = r0.y * r0.x;
r2.xy = sparkleParams.yy * v7.zx;
r2.xy = float2(0.0500000007,0.0500000007) * r2.xy;
r2.zw = waveParams.xy * timer;
r3.xy = r2.zw * normalParams1.ww + r2.yx;
r2.xy = r2.zw * normalParams2.ww + r2.xy;
r0.y = TMaskMap.Sample(TMaskMap_s, r2.xy).y;
r2.x = TMaskMap.Sample(TMaskMap_s, r3.xy).y;
r0.x = r2.x * r0.x;
r0.x = r0.x * r0.y;
r0.xyz = r0.xxx * r0.zzz + r1.xzw;
r0.xyz = r0.xyz * v1.www + v1.xyz;
r1.xzw = colorBufferEncodingParams.zzz * r0.xyz;
r0.xyz = r0.xyz * colorBufferEncodingParams.xxx + float3(1,1,1);
o0.xyz = r1.xzw / r0.xyz;
r0.x = saturate(v9.w);
r0.x = min(r0.x, r1.y);
o0.w = r0.x * r0.w;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// using 3Dmigoto v1.2.12 on Mon Nov 30 20:25:18 2015
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
// float HDRRange; // Offset: 464 Size: 4 [unused]
// float2 AmbientLightMapScale; // Offset: 468 Size: 8 [unused]
// float4 normalParams1; // Offset: 480 Size: 16
// float4 normalParams2; // Offset: 496 Size: 16
// float4 normalParams3; // Offset: 512 Size: 16
// float4 normalParams4; // Offset: 528 Size: 16
// float timer; // Offset: 544 Size: 4
// float3 shoreColour; // Offset: 548 Size: 12
// float4 shoreParams1; // Offset: 560 Size: 16
// float3 shoreParams2; // Offset: 576 Size: 12
// float4 screenProj; // Offset: 592 Size: 16
// float4 fresnelParams; // Offset: 608 Size: 16
// float4 horizonColour; // Offset: 624 Size: 16
// float4 nadirColour; // Offset: 640 Size: 16
// float4 interactiveParams1; // Offset: 656 Size: 16
// float4 interactiveParams5; // Offset: 672 Size: 16
// float4 waterShadowBlend; // Offset: 688 Size: 16 [unused]
// float4 decodeParam; // Offset: 704 Size: 16 [unused]
// float4 sparkleParams; // Offset: 720 Size: 16
// float4 sparkleParams2; // Offset: 736 Size: 16
// float blendValue; // Offset: 752 Size: 4
// float4 specularParams; // Offset: 768 Size: 16
// float4 waveParams; // Offset: 784 Size: 16
// float4 interactiveParams2; // Offset: 800 Size: 16 [unused]
// float4 interactiveParams3; // Offset: 816 Size: 16 [unused]
// float4 interactiveParams4; // Offset: 832 Size: 16
//
// }
//
// cbuffer RenderTargetConstantBuffer
// {
//
// float4 viewportDimensions; // Offset: 0 Size: 16
//
// }
//
// cbuffer CameraParamsConstantBuffer
// {
//
// float4x4 projection; // Offset: 0 Size: 64 [unused]
// float4x4 viewProjection; // Offset: 64 Size: 64 [unused]
// row_major float3x4 view; // Offset: 128 Size: 48 [unused]
// row_major float3x4 viewI; // Offset: 176 Size: 48 [unused]
// float3 eyePositionWS; // Offset: 224 Size: 12
// float4x4 inverseProj; // Offset: 240 Size: 64 [unused]
// bool leftEye; // Offset: 304 Size: 4
// bool padding3[3]; // Offset: 320 Size: 36 [unused]
//
// }
//
// cbuffer PerFrameConstantBuffer
// {
//
// float4 colorBufferEncodingParams; // Offset: 0 Size: 16
// float4 envMapEncodingParams; // Offset: 16 Size: 16 [unused]
// float4 velocityEncodingParams; // Offset: 32 Size: 16 [unused]
// float4 snowEffectsParam2; // Offset: 48 Size: 16 [unused]
// float4 sunDirectionAndTime; // Offset: 64 Size: 16 [unused]
// float4 sunColour; // Offset: 80 Size: 16 [unused]
// float4 skylightColour; // Offset: 96 Size: 16 [unused]
// float4 ambientOcclusionScales; // Offset: 112 Size: 16 [unused]
// float4 backlightColour; // Offset: 128 Size: 16 [unused]
// float4 specularScales; // Offset: 144 Size: 16 [unused]
// float3 specularDirection; // Offset: 160 Size: 12 [unused]
// float4 specularColourAndMultiplier;// Offset: 176 Size: 16 [unused]
// float4 fogColour; // Offset: 192 Size: 16 [unused]
// float4 fogParams; // Offset: 208 Size: 16 [unused]
// float4 hazeParams; // Offset: 224 Size: 16 [unused]
// float4 hazeParams2; // Offset: 240 Size: 16 [unused]
// float4 nightLightmapParam1; // Offset: 256 Size: 16 [unused]
// float4 nightLightmapParam2; // Offset: 272 Size: 16 [unused]
// float4 wetLightingParam; // Offset: 288 Size: 16 [unused]
// float4 snowEffectsParam; // Offset: 304 Size: 16 [unused]
// float4 ambientColour; // Offset: 320 Size: 16 [unused]
// float4 shadowBlend; // Offset: 336 Size: 16
// float4 maskParams; // Offset: 352 Size: 16
// float4 deferredSpecularParams; // Offset: 368 Size: 16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// TWaterRippleMap sampler NA NA 0 1
// TPreviousWaterRippleMap sampler NA NA 1 1
// TNormalMap sampler NA NA 2 1
// DepthMap sampler NA NA 3 1
// ReflectionMap sampler NA NA 4 1
// ReflectionMap2 sampler NA NA 5 1
// TMaskMap sampler NA NA 6 1
// TWaveFront sampler NA NA 7 1
// TShadowMask sampler NA NA 10 1
// DepthMap texture float4 2d 0 1
// TWaterRippleMap texture float4 2d 1 1
// TPreviousWaterRippleMap texture float4 2d 2 1
// TNormalMap texture float4 2d 3 1
// ReflectionMap texture float4 2d 4 1
// ReflectionMap2 texture float4 2d 5 1
// TShadowMask texture float4 2d 6 1
// TMaskMap texture float4 2d 7 1
// TWaveFront texture float4 2d 8 1
// $Globals cbuffer NA NA 0 1
// PerFrameConstantBuffer cbuffer NA NA 1 1
// RenderTargetConstantBuffer cbuffer NA NA 2 1
// CameraParamsConstantBuffer cbuffer NA NA 3 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float
// COLOR 1 xyzw 1 NONE float xyzw
// TEXCOORD 0 xyzw 2 NONE float
// TEXCOORD 1 xyzw 3 NONE float
// TEXCOORD 2 xyzw 4 NONE float w
// TEXCOORD 3 xyzw 5 NONE float xyzw
// TEXCOORD 4 xyzw 6 NONE float xy
// TEXCOORD 5 xyz 7 NONE float xyz
// TEXCOORD 6 xyzw 8 NONE float xy w
// TEXCOORD 7 xyzw 9 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[53], immediateIndexed
dcl_constantbuffer cb2[1], immediateIndexed
dcl_constantbuffer cb3[20], immediateIndexed
dcl_constantbuffer cb1[23], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_sampler s5, mode_default
dcl_sampler s6, mode_default
dcl_sampler s7, mode_default
dcl_sampler s10, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t8
dcl_input_ps linear v1.xyzw
dcl_input_ps linear centroid v4.w
dcl_input_ps linear centroid v5.xyzw
dcl_input_ps linear centroid v6.xy
dcl_input_ps linear centroid v7.xyz
dcl_input_ps linear v8.xyw
dcl_input_ps linear centroid v9.xyzw
dcl_output o0.xyzw
dcl_temps 6
sample_indexable(texture2d)(float,float,float,float) r0.xy, v9.xyxx, t1.yzxw, s0
sample_indexable(texture2d)(float,float,float,float) r0.zw, v9.xyxx, t2.xwyz, s1
add r0.xy, -r0.zwzz, r0.xyxx
mad r0.xy, cb0[47].xxxx, r0.xyxx, r0.zwzz
add r0.xy, r0.xyxx, l(0.00196078443, 0.00196078443, 0.000000, 0.000000)
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
div r1.xy, v8.xyxx, v8.wwww
add r1.z, -r1.y, l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r0.z, r1.xzxx, t0.yzxw, s3
add r0.z, r0.z, cb0[37].z
div r0.z, cb0[37].w, r0.z
add r0.w, -r0.z, v9.z
add r0.z, r0.z, -v9.z
mul_sat r0.z, |r0.z|, cb0[49].w
add r1.y, r0.w, l(0.100000)
dp2 r0.w, r0.wwww, cb0[41].zzzz
lt r1.w, l(0.000000), r1.y
lt r1.y, r1.y, l(0.000000)
iadd r1.y, -r1.y, r1.w
itof r1.y, r1.y
mov_sat r1.y, r1.y
min r1.w, -r0.w, l(0.000000)
mov_sat r0.w, r0.w
max r0.w, r0.w, r1.y
exp r1.w, r1.w
add r1.w, -r1.w, l(1.000000)
max r1.y, r1.w, r1.y
mul r0.xy, r0.xyxx, r1.yyyy
mul r2.xy, r0.xyxx, cb0[42].xxxx
mul r0.xy, r0.xyxx, cb0[41].xxxx
max r0.xy, r0.xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000)
min r0.xy, r0.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r0.xy, r0.xyxx, cb0[41].yyyy
mul r3.xyzw, cb0[31].xxyy, cb0[48].wwww
div r3.xyzw, r2.xyxy, r3.xyzw
div r2.xy, r2.xyxx, cb0[31].zzzz
add r2.xy, r2.xyxx, v6.xyxx
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r2.xyxx, t3.xyzw, s2
mad r2.xyz, r2.xzyx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
add r3.xyzw, r3.xyzw, v5.xyzw
sample_indexable(texture2d)(float,float,float,float) r4.xyz, r3.zwzz, t3.xyzw, s2
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r3.xyxx, t3.xyzw, s2
mad r3.xyz, r3.xzyx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r4.xyz, r4.xzyx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mul r4.xyz, r4.xyzx, cb0[32].yyyy
mad r3.xyz, cb0[32].xxxx, r3.xyzx, r4.xyzx
mad r2.xyz, cb0[32].zzzz, r2.xyzx, r3.xyzx
mad r2.xz, r0.xxyx, r2.yyyy, r2.xxzx
dp3 r0.x, r2.xyzx, r2.xyzx
rsq r0.x, r0.x
mul r2.xyz, r0.xxxx, r2.xyzx
mul r2.xyz, r2.xyzx, cb0[32].wwww
add r3.xyz, v7.xyzx, -cb3[14].xyzx
dp3 r0.x, r3.xyzx, r3.xyzx
sqrt r0.y, r0.x
mad_sat r0.x, r0.x, cb1[21].x, cb1[21].y
div r3.xyz, r3.xyzx, r0.yyyy
add r0.y, r0.y, -cb0[46].z
dp3 r1.w, r3.xyzx, r2.xyzx
add_sat r1.w, r1.w, l(1.000000)
add r3.xyz, cb0[39].xyzx, -cb0[40].xyzx
mad r3.xyz, r1.wwww, r3.xyzx, cb0[40].xyzx
add r4.xyz, -r3.xyzx, cb0[34].yzwy
mad r3.xyz, v4.wwww, r4.xyzx, r3.xyzx
mov_sat r2.y, cb1[22].w
add r2.w, -r2.y, l(1.000000)
mul r0.x, r0.x, r2.w
add r4.y, -v8.y, v8.w
mul r4.zw, cb2[0].zzzw, cb1[22].xxxx
mov r4.x, v8.x
mad r4.xy, v8.wwww, r4.zwzz, r4.xyxx
div r4.xy, r4.xyxx, v8.wwww
sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyxx, t6.xyzw, s10
add r2.w, -r4.x, l(1.000000)
mad r2.w, r2.y, r2.w, r4.x
add r3.w, -r2.w, l(1.000000)
mad r0.x, r0.x, r3.w, r2.w
add r2.w, -r0.x, l(1.000000)
mad r0.x, r0.z, r2.w, r0.x
mad r4.xyz, cb1[22].wwww, r4.yzwy, -r0.xxxx
mad r4.xyz, r2.yyyy, r4.xyzx, r0.xxxx
mul r5.xyz, r3.xyzx, r4.xyzx
mad r3.xyz, -r3.xyzx, r4.xyzx, cb0[36].zzzz
add r4.xyzw, v7.xzxz, cb0[33].xyzw
mul r4.xyzw, r4.xyzw, cb0[46].xxxx
mul r4.xyzw, r4.xyzw, cb0[48].wwww
mul r4.xyzw, r4.xyzw, l(0.050000, 0.050000, 0.050000, 0.050000)
sample_indexable(texture2d)(float,float,float,float) r0.x, r4.xyxx, t7.xyzw, s6
sample_indexable(texture2d)(float,float,float,float) r0.z, r4.zwzz, t7.xyzw, s6
add r0.x, r0.z, r0.x
add r4.xyzw, v7.xzxz, cb0[35].xyzw
mul r4.xyzw, r4.xyzw, cb0[36].xxyy
mul r4.xyzw, r4.xyzw, l(0.050000, 0.050000, 0.050000, 0.050000)
sample_indexable(texture2d)(float,float,float,float) r2.yw, r4.xyxx, t8.xywz, s7
sample_indexable(texture2d)(float,float,float,float) r4.xy, r4.zwzz, t8.yzxw, s7
add r0.z, r2.w, r4.y
mul r2.y, r2.y, r4.x
mul r0.z, r0.z, v4.w
mul r0.z, r0.z, r0.x
mul r2.w, r0.z, r2.y
mad r0.z, -r2.y, r0.z, l(1.000000)
mad r3.xyz, r2.wwww, r3.xyzx, r5.xyzx
mul r2.y, l(0.300000), cb0[52].z
mad r2.w, cb0[52].w, l(0.300000), -r2.y
mad r2.y, r1.w, r2.w, r2.y
log r1.w, r1.w
mul r1.w, r1.w, cb0[38].z
exp r1.w, r1.w
mad_sat r1.xz, r2.xxzx, r2.yyyy, r1.xxzx
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r1.xzxx, t4.xyzw, s4
sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r1.xzxx, t5.xyzw, s5
movc r2.xyzw, cb3[19].xxxx, r2.xyzw, r4.xyzw
mul r4.xyz, r2.xyzx, cb1[0].yyyy
mad r2.xyz, r2.xyzx, cb1[0].wwww, l(1.000000, 1.000000, 1.000000, 0.000000)
div r2.xyz, r4.xyzx, r2.xyzx
add r2.xyz, -r3.xyzx, r2.xyzx
add r1.x, -cb0[38].x, cb0[38].y
mad r1.x, r1.w, r1.x, cb0[38].x
mul r1.x, r2.w, r1.x
mul r1.x, r0.z, r1.x
mad r1.xzw, r1.xxxx, r2.xxyz, r3.xxyz
add r2.x, -cb0[46].z, cb0[46].w
div_sat r0.y, r0.y, r2.x
add r0.y, -r0.y, l(1.000000)
mul r0.y, r0.y, cb0[45].x
mul r0.x, r0.x, r0.y
mul r2.xy, v7.zxzz, cb0[45].yyyy
mul r2.xy, r2.xyxx, l(0.050000, 0.050000, 0.000000, 0.000000)
mul r2.zw, cb0[34].xxxx, cb0[49].xxxy
mad r3.xy, r2.zwzz, cb0[30].wwww, r2.yxyy
mad r2.xy, r2.zwzz, cb0[31].wwww, r2.xyxx
sample_indexable(texture2d)(float,float,float,float) r0.y, r2.xyxx, t7.xyzw, s6
sample_indexable(texture2d)(float,float,float,float) r2.x, r3.xyxx, t7.yxzw, s6
mul r0.x, r0.x, r2.x
mul r0.x, r0.y, r0.x
mad r0.xyz, r0.xxxx, r0.zzzz, r1.xzwx
mad r0.xyz, r0.xyzx, v1.wwww, v1.xyzx
mul r1.xzw, r0.xxyz, cb1[0].zzzz
mad r0.xyz, r0.xyzx, cb1[0].xxxx, l(1.000000, 1.000000, 1.000000, 0.000000)
div o0.xyz, r1.xzwx, r0.xyzx
mov_sat r0.x, v9.w
min r0.x, r1.y, r0.x
mul o0.w, r0.w, r0.x
ret
// Approximately 144 instruction slots used

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


Here are the screenshots before and after pressing 3 on the numpad.

Image

Image

what is even funnier the artiffacts are random, sometimes the masking is gone, sometimes the color of reflections gets darker.

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 11/30/2015 08:30 PM   
@Oomek: Yup, that looks like a bug alright. :-> This one looks to be a missing "centroid" specifier on the input parameters. We aren't presently parsing those, and it's on my list. Change the input header info by adding the "centroid" keyword as shown here: [code]void main( float4 v0 : SV_Position0, float4 v1 : COLOR1, float4 v2 : TEXCOORD0, float4 v3 : TEXCOORD1, centroid float4 v4 : TEXCOORD2, // Decompiler bug, missing 'centroid' keyword. centroid float4 v5 : TEXCOORD3, centroid float4 v6 : TEXCOORD4, centroid float4 v7 : TEXCOORD5, float4 v8 : TEXCOORD6, centroid float4 v9 : TEXCOORD7, out float4 o0 : SV_Target0) [/code] After making that change, here is the diff that I use to see problems in the Decompile/Compile process. This one is pretty clean, so I'd expect this to work properly with that manual fix. [url]https://www.diffchecker.com/pa0rbs9e[/url]
@Oomek: Yup, that looks like a bug alright. :->

This one looks to be a missing "centroid" specifier on the input parameters. We aren't presently parsing those, and it's on my list.

Change the input header info by adding the "centroid" keyword as shown here:

void main( 
float4 v0 : SV_Position0,
float4 v1 : COLOR1,
float4 v2 : TEXCOORD0,
float4 v3 : TEXCOORD1,
centroid float4 v4 : TEXCOORD2, // Decompiler bug, missing 'centroid' keyword.
centroid float4 v5 : TEXCOORD3,
centroid float4 v6 : TEXCOORD4,
centroid float4 v7 : TEXCOORD5,
float4 v8 : TEXCOORD6,
centroid float4 v9 : TEXCOORD7,
out float4 o0 : SV_Target0)



After making that change, here is the diff that I use to see problems in the Decompile/Compile process. This one is pretty clean, so I'd expect this to work properly with that manual fix.

https://www.diffchecker.com/pa0rbs9e

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 12/01/2015 04:22 AM   
Thanks for the tip :)
Thanks for the tip :)

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 12/01/2015 10:01 AM   
Hi guys, Would it be possible to add the ability to store shaders in subfolders? It would tremendously help in managing my growing collection of shaders.
Hi guys, Would it be possible to add the ability to store shaders in subfolders? It would tremendously help in managing my growing collection of shaders.

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 12/01/2015 07:05 PM   
[quote="Oomek"]Hi guys, Would it be possible to add the ability to store shaders in subfolders? It would tremendously help in managing my growing collection of shaders.[/quote] Not easily. Volnaiskra had the same request, but in thinking about it at that time, it would greatly increase the complexity of loading the shaders and having to manage conflicts. There are other external tools that can manage the grouping for you, in whatever way you like. I use these all the time. The best thing to do is to use [i]comments [/i]in your shader code. In general, I strongly press people to add comments, because of a long history of software development. Comments are not optional, you can never understand the "why" question from code alone. In our case here, if you add a comment tag at the header of your file, like "Shadows", "Gravel", anything you'd like to group by, then you can find these afterwards by using the search option in Explorer. Open ShaderFixes, top right corner, search for "Gravel". All shaders with that keyword shown. This also allows you the flexibility of having multiple categories for a single shader. "Gravel" AND "Shadows", which folders would not allow. If you use external version control software like Git, you can organize them however you want, with implicit or explicit categories. This is worth doing for version control alone. I still think comments are slightly better than external buckets, but using both is a very powerful setup. If that doesn't seem good enough, make a stronger case for folders and we will consider it. (or if you you really just gotta have it- open source, make a pull request. We won't deny anything people build.)
Oomek said:Hi guys, Would it be possible to add the ability to store shaders in subfolders? It would tremendously help in managing my growing collection of shaders.

Not easily. Volnaiskra had the same request, but in thinking about it at that time, it would greatly increase the complexity of loading the shaders and having to manage conflicts.

There are other external tools that can manage the grouping for you, in whatever way you like. I use these all the time.

The best thing to do is to use comments in your shader code. In general, I strongly press people to add comments, because of a long history of software development. Comments are not optional, you can never understand the "why" question from code alone.

In our case here, if you add a comment tag at the header of your file, like "Shadows", "Gravel", anything you'd like to group by, then you can find these afterwards by using the search option in Explorer. Open ShaderFixes, top right corner, search for "Gravel". All shaders with that keyword shown.

This also allows you the flexibility of having multiple categories for a single shader. "Gravel" AND "Shadows", which folders would not allow.


If you use external version control software like Git, you can organize them however you want, with implicit or explicit categories. This is worth doing for version control alone.

I still think comments are slightly better than external buckets, but using both is a very powerful setup.


If that doesn't seem good enough, make a stronger case for folders and we will consider it. (or if you you really just gotta have it- open source, make a pull request. We won't deny anything people build.)

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 12/02/2015 01:24 AM   
I would never have thought it could be that hard to do. My code is well comented so it's not a problem for me to know what the specific shader does, it's rather the annoyance of opening each time every shader one by one (so far around 50) to find the one I want to edit. WOW, I've just realized renaming the shader files IS actually allowed :) I renamed one shader to: 1f4a8b792a97b0f3-ps_replace-STREAKS-MOD.txt and it's still loading, BUT... there is a catch, renamed shaders are not loading when the game starts, only when I press reload_fixes. If adding folder support is troublesome for you, maybe you could allow to load also renamed shaders when the game starts. What do you think? How much hastle would that be?
I would never have thought it could be that hard to do.

My code is well comented so it's not a problem for me to know what the specific shader does, it's rather the annoyance of opening each time every shader one by one (so far around 50) to find the one I want to edit.

WOW, I've just realized renaming the shader files IS actually allowed :)

I renamed one shader to: 1f4a8b792a97b0f3-ps_replace-STREAKS-MOD.txt and it's still loading,
BUT...
there is a catch, renamed shaders are not loading when the game starts, only when I press reload_fixes.

If adding folder support is troublesome for you, maybe you could allow to load also renamed shaders when the game starts. What do you think? How much hastle would that be?

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 12/02/2015 02:34 AM   
[quote="Oomek"]I would never have thought it could be that hard to do. My code is well comented so it's not a problem for me to know what the specific shader does, it's rather the annoyance of opening each time every shader one by one (so far around 50) to find the one I want to edit. WOW, I've just realized renaming the shader files IS actually allowed :) I renamed one shader to: 1f4a8b792a97b0f3-ps_replace-STREAKS-MOD.txt and it's still loading, BUT... there is a catch, renamed shaders are not loading when the game starts, only when I press reload_fixes. If adding folder support is troublesome for you, maybe you could allow to load also renamed shaders when the game starts. What do you think? How much hastle would that be?[/quote] That conflicts with other shaderhacker's workflow. A lot of people will rename a shader to get it out of the way, specifically make it not load. The reason appending works there is probably an introduced bug when we added ASM support. The file name matching used to be really strict to avoid confusing accidents. Strict and clear is better than lax, because when it's all super flexible, and you run into a problem, it's really hard and time consuming to figure out what went wrong. I didn't say it was hard coding-wise, it's hard to make a system that works for everyone that isn't insanely complex. As a general rule I try to encourage not adding changes that make the code flow even harder than it already is- especially if there are offline workarounds that are probably superior. There was an earlier mode for example that would load out of ShaderCache as well. Then we had a whole series of questions and problems because people had files in both places, and which took precedence, and which was invisible. Think through the edge cases, and I think you will not be as sure. It's a balance though, we want to support people as much as possible. If they are already commented, why don't you use the text search in the Explorer window? [img]https://forums.geforce.com/cmd/default/download-comment-attachment/63774/[/img]
Oomek said:I would never have thought it could be that hard to do.

My code is well comented so it's not a problem for me to know what the specific shader does, it's rather the annoyance of opening each time every shader one by one (so far around 50) to find the one I want to edit.

WOW, I've just realized renaming the shader files IS actually allowed :)

I renamed one shader to: 1f4a8b792a97b0f3-ps_replace-STREAKS-MOD.txt and it's still loading,
BUT...
there is a catch, renamed shaders are not loading when the game starts, only when I press reload_fixes.

If adding folder support is troublesome for you, maybe you could allow to load also renamed shaders when the game starts. What do you think? How much hastle would that be?

That conflicts with other shaderhacker's workflow. A lot of people will rename a shader to get it out of the way, specifically make it not load.

The reason appending works there is probably an introduced bug when we added ASM support. The file name matching used to be really strict to avoid confusing accidents. Strict and clear is better than lax, because when it's all super flexible, and you run into a problem, it's really hard and time consuming to figure out what went wrong.

I didn't say it was hard coding-wise, it's hard to make a system that works for everyone that isn't insanely complex. As a general rule I try to encourage not adding changes that make the code flow even harder than it already is- especially if there are offline workarounds that are probably superior.

There was an earlier mode for example that would load out of ShaderCache as well. Then we had a whole series of questions and problems because people had files in both places, and which took precedence, and which was invisible. Think through the edge cases, and I think you will not be as sure.

It's a balance though, we want to support people as much as possible.


If they are already commented, why don't you use the text search in the Explorer window?

Image

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 12/02/2015 03:15 AM   
[quote="Oomek"]Hi guys, Would it be possible to add the ability to store shaders in subfolders? It would tremendously help in managing my growing collection of shaders.[/quote]NAK! We want to avoid doing anything that needs to walk the directory heirachy when a shader is loaded (that includes subdirectories and it includes wildcards*) - the ShaderFixes folder can easily have thousands or more shaders, which can make searching it take multiple seconds *every time a new shader is used by he game*. On the other hand, if we know the exact path and filename we are looking for, we can completely avoid this overhead and load a shader in a matter of milliseconds (plus compile time). [quote="Oomek"]WOW, I've just realized renaming the shader files IS actually allowed :) I renamed one shader to: 1f4a8b792a97b0f3-ps_replace-STREAKS-MOD.txt and it's still loading, BUT... there is a catch, renamed shaders are not loading when the game starts, only when I press reload_fixes. If adding folder support is troublesome for you, maybe you could allow to load also renamed shaders when the game starts. What do you think? How much hastle would that be?[/quote]* The only reason your renamed version worked on F10 reload is that reload has to walk the directory anyway and uses a wildcard to do so. The fact that it picked up your renamed file is a bug - do not rely on this behaviour, as it is quite likely it will be fixed in the next version now that we know about it. The only way we could make this work, is if we preloaded every shader present when the game was launched, so we only have to pay the cost of the directory walk once. This would however cost us having to compile and load all shaders up front, including those the game will never end up using, and that would significantly increase the load time of the game (ever updated the timestamps on every shader and pressed F10? Takes a while right? And that's only reloading the ones the game has used *so far*). You could maybe get tricky here and cache the file listing but not load the shaders, but there's already a piece of software on the system that does exactly that, and it's called an operating system.
Oomek said:Hi guys, Would it be possible to add the ability to store shaders in subfolders? It would tremendously help in managing my growing collection of shaders.
NAK!

We want to avoid doing anything that needs to walk the directory heirachy when a shader is loaded (that includes subdirectories and it includes wildcards*) - the ShaderFixes folder can easily have thousands or more shaders, which can make searching it take multiple seconds *every time a new shader is used by he game*. On the other hand, if we know the exact path and filename we are looking for, we can completely avoid this overhead and load a shader in a matter of milliseconds (plus compile time).

Oomek said:WOW, I've just realized renaming the shader files IS actually allowed :)

I renamed one shader to: 1f4a8b792a97b0f3-ps_replace-STREAKS-MOD.txt and it's still loading,
BUT...
there is a catch, renamed shaders are not loading when the game starts, only when I press reload_fixes.

If adding folder support is troublesome for you, maybe you could allow to load also renamed shaders when the game starts. What do you think? How much hastle would that be?
* The only reason your renamed version worked on F10 reload is that reload has to walk the directory anyway and uses a wildcard to do so. The fact that it picked up your renamed file is a bug - do not rely on this behaviour, as it is quite likely it will be fixed in the next version now that we know about it.



The only way we could make this work, is if we preloaded every shader present when the game was launched, so we only have to pay the cost of the directory walk once. This would however cost us having to compile and load all shaders up front, including those the game will never end up using, and that would significantly increase the load time of the game (ever updated the timestamps on every shader and pressed F10? Takes a while right? And that's only reloading the ones the game has used *so far*). You could maybe get tricky here and cache the file listing but not load the shaders, but there's already a piece of software on the system that does exactly that, and it's called an operating system.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 12/02/2015 03:44 AM   
Here's another suggestion that occurred to me for sorting and organizing shaders. Use Shortcuts. We don't walk into subdirectories, or any folders, so you can make a set of folders how you like. Then, copy shortcuts into that folder for the shaders you want organized into a given folder. You can do them en-masse using the alt-key drag. Would that do the job for you?
Here's another suggestion that occurred to me for sorting and organizing shaders. Use Shortcuts.

We don't walk into subdirectories, or any folders, so you can make a set of folders how you like. Then, copy shortcuts into that folder for the shaders you want organized into a given folder. You can do them en-masse using the alt-key drag.

Would that do the job for you?

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 12/02/2015 04:59 AM   
[quote="bo3b"]@Oomek: Yup, that looks like a bug alright. :-> This one looks to be a missing "centroid" specifier on the input parameters. We aren't presently parsing those, and it's on my list. Change the input header info by adding the "centroid" keyword as shown here: [code]void main( float4 v0 : SV_Position0, float4 v1 : COLOR1, float4 v2 : TEXCOORD0, float4 v3 : TEXCOORD1, centroid float4 v4 : TEXCOORD2, // Decompiler bug, missing 'centroid' keyword. centroid float4 v5 : TEXCOORD3, centroid float4 v6 : TEXCOORD4, centroid float4 v7 : TEXCOORD5, float4 v8 : TEXCOORD6, centroid float4 v9 : TEXCOORD7, out float4 o0 : SV_Target0) [/code] After making that change, here is the diff that I use to see problems in the Decompile/Compile process. This one is pretty clean, so I'd expect this to work properly with that manual fix. [url]https://www.diffchecker.com/pa0rbs9e[/url] [/quote] Fixed in version 1.1.13. All interpolation modifiers are passed back to the HLSL. Not certain this works in all scenarios, only tested one game. Worked correctly for 'linear centroid' variant. Let us know if you see problems, especially things that don't compile because of this.
bo3b said:@Oomek: Yup, that looks like a bug alright. :->

This one looks to be a missing "centroid" specifier on the input parameters. We aren't presently parsing those, and it's on my list.

Change the input header info by adding the "centroid" keyword as shown here:

void main( 
float4 v0 : SV_Position0,
float4 v1 : COLOR1,
float4 v2 : TEXCOORD0,
float4 v3 : TEXCOORD1,
centroid float4 v4 : TEXCOORD2, // Decompiler bug, missing 'centroid' keyword.
centroid float4 v5 : TEXCOORD3,
centroid float4 v6 : TEXCOORD4,
centroid float4 v7 : TEXCOORD5,
float4 v8 : TEXCOORD6,
centroid float4 v9 : TEXCOORD7,
out float4 o0 : SV_Target0)



After making that change, here is the diff that I use to see problems in the Decompile/Compile process. This one is pretty clean, so I'd expect this to work properly with that manual fix.

https://www.diffchecker.com/pa0rbs9e

Fixed in version 1.1.13.

All interpolation modifiers are passed back to the HLSL. Not certain this works in all scenarios, only tested one game. Worked correctly for 'linear centroid' variant.

Let us know if you see problems, especially things that don't compile because of this.

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 12/02/2015 05:05 AM   
Yep, we could probably make shortcuts work. We'd have to be a little careful as we would have to check the target of the shortcut when reloading shaders, not the shortcut itself*. * Insert my usual rant here about the broken design of windows shortcuts compared to the way every other OS of note does the equivalent thing**. The fact that we have to add more code to make them work is testament to the broken design. I would suggest that it should be easy to write a batch file to update all the shortcuts, but it appears that there is no command line tool to do that in Windows. +1 fodder added to my usual rant for the future ;-p ** to be fair, it appears that Windows now does support symbolic links if using NTFS, however unlike other OSs that have supported them since the 1970s, their existence is still relatively new to Windows, so a lot of software that actually does need to be aware of them cannot cope with them (e.g. the .zip file format doesn't support them, so unless we want to distribute the fixes as .tar.gz and confuse all the users...), and they won't work for anyone using FAT.
Yep, we could probably make shortcuts work. We'd have to be a little careful as we would have to check the target of the shortcut when reloading shaders, not the shortcut itself*.

* Insert my usual rant here about the broken design of windows shortcuts compared to the way every other OS of note does the equivalent thing**. The fact that we have to add more code to make them work is testament to the broken design.

I would suggest that it should be easy to write a batch file to update all the shortcuts, but it appears that there is no command line tool to do that in Windows. +1 fodder added to my usual rant for the future ;-p

** to be fair, it appears that Windows now does support symbolic links if using NTFS, however unlike other OSs that have supported them since the 1970s, their existence is still relatively new to Windows, so a lot of software that actually does need to be aware of them cannot cope with them (e.g. the .zip file format doesn't support them, so unless we want to distribute the fixes as .tar.gz and confuse all the users...), and they won't work for anyone using FAT.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 12/02/2015 05:23 AM   
  38 / 141    
Scroll To Top