From f4514ad6b2a2bfca9ed7dea1fad9beeaedcc0363 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 29 Nov 2014 18:34:36 +0100 Subject: [PATCH] Changed nvc and dual pass code. --- SAFix/SilentPatchSA.cpp | 8 ++--- SilentPatch/nvc.fx | 5 ++- SilentPatch/nvc.h | 72 ++++++++++++++++++----------------------- 3 files changed, 38 insertions(+), 47 deletions(-) diff --git a/SAFix/SilentPatchSA.cpp b/SAFix/SilentPatchSA.cpp index 74bbaae..84510fc 100644 --- a/SAFix/SilentPatchSA.cpp +++ b/SAFix/SilentPatchSA.cpp @@ -382,15 +382,15 @@ RpAtomic* TwoPassAlphaRender(RpAtomic* atomic) int nZWrite; int nAlphaBlending; - RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha); +// RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha); RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite); RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending); RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction); // 1st pass RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE); - RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(255)); - RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONEQUAL)); +// RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(255)); + RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONGREATEREQUAL)); atomic = AtomicDefaultRenderCallBack(atomic); @@ -404,7 +404,7 @@ RpAtomic* TwoPassAlphaRender(RpAtomic* atomic) AtomicDefaultRenderCallBack(atomic); } - RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(nPushedAlpha)); +// RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(nPushedAlpha)); RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(nAlphaFunction)); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast(nZWrite)); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending)); diff --git a/SilentPatch/nvc.fx b/SilentPatch/nvc.fx index 331b164..3ea8b4f 100644 --- a/SilentPatch/nvc.fx +++ b/SilentPatch/nvc.fx @@ -26,9 +26,8 @@ VS_OUTPUT NVC_vertex_shader( in VS_INPUT In ) Out.Position = mul(proj, mul(view, mul(world, In.Position))); Out.Texture = In.Texture; - Out.Color = lerp(In.DayColor, In.NightColor, fEnvVars[0]); - Out.Color.rgb += AmbientLight.rgb; - Out.Color.a *= (255.0/128.0) * fEnvVars[1]; + Out.Color.rgb = lerp(In.DayColor, In.NightColor, fEnvVars[0]).rgb + AmbientLight.rgb; + Out.Color.a = In.NightColor.a * fEnvVars[1]; Out.Color = saturate(Out.Color); return Out; diff --git a/SilentPatch/nvc.h b/SilentPatch/nvc.h index d5d24ba..98af506 100644 --- a/SilentPatch/nvc.h +++ b/SilentPatch/nvc.h @@ -1,10 +1,6 @@ #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h -// ..\SilentPatch\nvc.fx -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -27,7 +23,7 @@ // vs_2_0 - def c14, 1.9921875, 0, 1, 0 + def c14, 0, 1, 0, 0 dcl_position v0 dcl_texcoord v1 dcl_color v2 @@ -44,17 +40,16 @@ mad r1, c10, r0.x, r1 mad r1, c12, r0.z, r1 mad oPos, c13, r0.w, r1 - mov r0, v3 - add r0, -r0, v2 - mad r0, c0.x, r0, v3 - mul r0.w, r0.w, c0.y - add r1.xyz, r0, c1 - mul r1.w, r0.w, c14.x - max r0, r1, c14.y - min oD0, r0, c14.z + mov r0.xyz, v3 + add r0.xyz, -r0, v2 + mad r0.xyz, c0.x, r0, v3 + add r0.xyz, r0, c1 + mul r0.w, v2.w, c0.y + max r0, r0, c14.x + min oD0, r0, c14.y mov oT0.xy, v1 -// approximately 21 instruction slots used +// approximately 20 instruction slots used #endif const BYTE g_vs20_NVC_vertex_shader[] = @@ -105,12 +100,12 @@ const BYTE g_vs20_NVC_vertex_shader[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 81, 0, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 14, 0, 15, 160, - 0, 0, 255, 63, 0, 0, - 0, 0, 0, 0, 128, 63, + 0, 0, 0, 0, 0, 0, + 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 144, 31, 0, @@ -158,28 +153,25 @@ const BYTE g_vs20_NVC_vertex_shader[] = 0, 0, 15, 192, 13, 0, 228, 160, 0, 0, 255, 128, 1, 0, 228, 128, 1, 0, - 0, 2, 0, 0, 15, 128, + 0, 2, 0, 0, 7, 128, 3, 0, 228, 144, 2, 0, - 0, 3, 0, 0, 15, 128, + 0, 3, 0, 0, 7, 128, 0, 0, 228, 129, 2, 0, 228, 144, 4, 0, 0, 4, - 0, 0, 15, 128, 0, 0, + 0, 0, 7, 128, 0, 0, 0, 160, 0, 0, 228, 128, - 3, 0, 228, 144, 5, 0, - 0, 3, 0, 0, 8, 128, - 0, 0, 255, 128, 0, 0, - 85, 160, 2, 0, 0, 3, - 1, 0, 7, 128, 0, 0, - 228, 128, 1, 0, 228, 160, - 5, 0, 0, 3, 1, 0, - 8, 128, 0, 0, 255, 128, - 14, 0, 0, 160, 11, 0, - 0, 3, 0, 0, 15, 128, - 1, 0, 228, 128, 14, 0, - 85, 160, 10, 0, 0, 3, - 0, 0, 15, 208, 0, 0, - 228, 128, 14, 0, 170, 160, - 1, 0, 0, 2, 0, 0, - 3, 224, 1, 0, 228, 144, - 255, 255, 0, 0 + 3, 0, 228, 144, 2, 0, + 0, 3, 0, 0, 7, 128, + 0, 0, 228, 128, 1, 0, + 228, 160, 5, 0, 0, 3, + 0, 0, 8, 128, 2, 0, + 255, 144, 0, 0, 85, 160, + 11, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 14, 0, 0, 160, 10, 0, + 0, 3, 0, 0, 15, 208, + 0, 0, 228, 128, 14, 0, + 85, 160, 1, 0, 0, 2, + 0, 0, 3, 224, 1, 0, + 228, 144, 255, 255, 0, 0 };