Cleaned shader code up

Matched RwD3D9GetTransform in 1.01 and 3.0 EXEs
This commit is contained in:
Silent 2014-11-28 18:32:19 +01:00
parent 80f652762a
commit 49ddc29312
3 changed files with 3128 additions and 3133 deletions

File diff suppressed because it is too large Load diff

View file

@ -13,24 +13,22 @@ struct VS_OUTPUT
float4 Color : COLOR0; float4 Color : COLOR0;
}; };
float4x4 viewProjMatrix : register(c0); float2 fEnvVars : register(c0);
float2 fEnvVars : register(c4); float4 AmbientLight : register(c1);
float4 AmbientLight : register(c5); float4x4 world : register(c2);
float4x4 world : register(c6); float4x4 view : register(c6);
float4x4 view : register(c10); float4x4 proj : register(c10);
float4x4 proj : register(c14);
VS_OUTPUT NVC_vertex_shader( in VS_INPUT In ) VS_OUTPUT NVC_vertex_shader( in VS_INPUT In )
{ {
VS_OUTPUT Out; VS_OUTPUT Out;
// Out.Position = mul(In.Position, viewProjMatrix);
Out.Position = mul(proj, mul(view, mul(world, In.Position))); Out.Position = mul(proj, mul(view, mul(world, In.Position)));
Out.Texture = In.Texture; Out.Texture = In.Texture;
Out.Color.rgb = (In.DayColor.rgb * (1.0-fEnvVars[0]) + In.NightColor.rgb * fEnvVars[0]) + AmbientLight.rgb; Out.Color = lerp(In.DayColor, In.NightColor, fEnvVars[0]);
Out.Color.a = In.DayColor.a * (255.0/128.0) * fEnvVars[1]; Out.Color.rgb += AmbientLight.rgb;
//Out.Color.rgb = In.DayColor.rgb + AmbientLight.rgb; Out.Color.a *= (255.0/128.0) * fEnvVars[1];
Out.Color = saturate(Out.Color); Out.Color = saturate(Out.Color);
return Out; return Out;

View file

@ -1,6 +1,10 @@
#if 0 #if 0
// //
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // 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
//
// //
// Parameters: // Parameters:
// //
@ -15,39 +19,39 @@
// //
// Name Reg Size // Name Reg Size
// ------------ ----- ---- // ------------ ----- ----
// fEnvVars c4 1 // fEnvVars c0 1
// AmbientLight c5 1 // AmbientLight c1 1
// world c6 4 // world c2 4
// view c10 4 // view c6 4
// proj c14 4 // proj c10 4
// //
vs_2_0 vs_2_0
def c0, 1, 0, 0, 0 def c14, 1.9921875, 0, 1, 0
dcl_position v0 dcl_position v0
dcl_texcoord v1 dcl_texcoord v1
dcl_color v2 dcl_color v2
dcl_color1 v3 dcl_color1 v3
mul r0, v0.y, c7 mul r0, v0.y, c3
mad r0, c6, v0.x, r0 mad r0, c2, v0.x, r0
mad r0, c8, v0.z, r0 mad r0, c4, v0.z, r0
mad r0, c9, v0.w, r0 mad r0, c5, v0.w, r0
mul r1, r0.y, c7
mad r1, c6, r0.x, r1
mad r1, c8, r0.z, r1
mad r0, c9, r0.w, r1
mul r1, r0.y, c11 mul r1, r0.y, c11
mad r1, c10, r0.x, r1 mad r1, c10, r0.x, r1
mad r1, c12, r0.z, r1 mad r1, c12, r0.z, r1
mad r0, c13, r0.w, r1 mad oPos, c13, r0.w, r1
mul r1, r0.y, c15 mov r0, v3
mad r1, c14, r0.x, r1 add r0, -r0, v2
mad r1, c16, r0.z, r1 mad r0, c0.x, r0, v3
mad oPos, c17, r0.w, r1 mul r0.w, r0.w, c0.y
mov r0.x, c0.x add r1.xyz, r0, c1
add r0.x, r0.x, -c4.x mul r1.w, r0.w, c14.x
mul r0.yzw, v2.xxyz, c4.x max r0, r1, c14.y
mad r0.xyz, v3, r0.x, r0.yzww min oD0, r0, c14.z
add r0.xyz, r0, c5
mul r0.w, v3.w, c4.y
max r0, r0, c0.y
min oD0, r0, c0.x
mov oT0.xy, v1 mov oT0.xy, v1
// approximately 21 instruction slots used // approximately 21 instruction slots used
@ -62,21 +66,21 @@ const BYTE g_vs20_NVC_vertex_shader[] =
5, 0, 0, 0, 28, 0, 5, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
223, 0, 0, 0, 128, 0, 223, 0, 0, 0, 128, 0,
0, 0, 2, 0, 5, 0, 0, 0, 2, 0, 1, 0,
1, 0, 22, 0, 144, 0, 1, 0, 6, 0, 144, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
160, 0, 0, 0, 2, 0, 160, 0, 0, 0, 2, 0,
4, 0, 1, 0, 18, 0, 0, 0, 1, 0, 2, 0,
172, 0, 0, 0, 0, 0, 172, 0, 0, 0, 0, 0,
0, 0, 188, 0, 0, 0, 0, 0, 188, 0, 0, 0,
2, 0, 14, 0, 4, 0, 2, 0, 10, 0, 4, 0,
58, 0, 196, 0, 0, 0, 42, 0, 196, 0, 0, 0,
0, 0, 0, 0, 212, 0, 0, 0, 0, 0, 212, 0,
0, 0, 2, 0, 10, 0, 0, 0, 2, 0, 6, 0,
4, 0, 42, 0, 196, 0, 4, 0, 26, 0, 196, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
217, 0, 0, 0, 2, 0, 217, 0, 0, 0, 2, 0,
6, 0, 4, 0, 26, 0, 2, 0, 4, 0, 10, 0,
196, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, 0,
0, 0, 65, 109, 98, 105, 0, 0, 65, 109, 98, 105,
101, 110, 116, 76, 105, 103, 101, 110, 116, 76, 105, 103,
@ -101,12 +105,12 @@ const BYTE g_vs20_NVC_vertex_shader[] =
83, 76, 32, 83, 104, 97, 83, 76, 32, 83, 104, 97,
100, 101, 114, 32, 67, 111, 100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114, 109, 112, 105, 108, 101, 114,
32, 54, 46, 51, 46, 57, 32, 57, 46, 50, 57, 46,
54, 48, 48, 46, 49, 54, 57, 53, 50, 46, 51, 49,
51, 56, 52, 0, 81, 0, 49, 49, 0, 171, 81, 0,
0, 5, 0, 0, 15, 160, 0, 5, 14, 0, 15, 160,
0, 0, 128, 63, 0, 0, 0, 0, 255, 63, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63,
0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 31, 0,
0, 2, 0, 0, 0, 128, 0, 2, 0, 0, 0, 128,
0, 0, 15, 144, 31, 0, 0, 0, 15, 144, 31, 0,
@ -117,64 +121,64 @@ const BYTE g_vs20_NVC_vertex_shader[] =
0, 2, 10, 0, 1, 128, 0, 2, 10, 0, 1, 128,
3, 0, 15, 144, 5, 0, 3, 0, 15, 144, 5, 0,
0, 3, 0, 0, 15, 128, 0, 3, 0, 0, 15, 128,
0, 0, 85, 144, 7, 0, 0, 0, 85, 144, 3, 0,
228, 160, 4, 0, 0, 4, 228, 160, 4, 0, 0, 4,
0, 0, 15, 128, 6, 0, 0, 0, 15, 128, 2, 0,
228, 160, 0, 0, 0, 144, 228, 160, 0, 0, 0, 144,
0, 0, 228, 128, 4, 0, 0, 0, 228, 128, 4, 0,
0, 4, 0, 0, 15, 128, 0, 4, 0, 0, 15, 128,
8, 0, 228, 160, 0, 0, 4, 0, 228, 160, 0, 0,
170, 144, 0, 0, 228, 128, 170, 144, 0, 0, 228, 128,
4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0,
15, 128, 9, 0, 228, 160, 15, 128, 5, 0, 228, 160,
0, 0, 255, 144, 0, 0, 0, 0, 255, 144, 0, 0,
228, 128, 5, 0, 0, 3, 228, 128, 5, 0, 0, 3,
1, 0, 15, 128, 0, 0, 1, 0, 15, 128, 0, 0,
85, 128, 11, 0, 228, 160, 85, 128, 7, 0, 228, 160,
4, 0, 0, 4, 1, 0, 4, 0, 0, 4, 1, 0,
15, 128, 10, 0, 228, 160, 15, 128, 6, 0, 228, 160,
0, 0, 0, 128, 1, 0, 0, 0, 0, 128, 1, 0,
228, 128, 4, 0, 0, 4, 228, 128, 4, 0, 0, 4,
1, 0, 15, 128, 12, 0, 1, 0, 15, 128, 8, 0,
228, 160, 0, 0, 170, 128, 228, 160, 0, 0, 170, 128,
1, 0, 228, 128, 4, 0, 1, 0, 228, 128, 4, 0,
0, 4, 0, 0, 15, 128, 0, 4, 0, 0, 15, 128,
13, 0, 228, 160, 0, 0, 9, 0, 228, 160, 0, 0,
255, 128, 1, 0, 228, 128, 255, 128, 1, 0, 228, 128,
5, 0, 0, 3, 1, 0, 5, 0, 0, 3, 1, 0,
15, 128, 0, 0, 85, 128, 15, 128, 0, 0, 85, 128,
15, 0, 228, 160, 4, 0, 11, 0, 228, 160, 4, 0,
0, 4, 1, 0, 15, 128, 0, 4, 1, 0, 15, 128,
14, 0, 228, 160, 0, 0, 10, 0, 228, 160, 0, 0,
0, 128, 1, 0, 228, 128, 0, 128, 1, 0, 228, 128,
4, 0, 0, 4, 1, 0, 4, 0, 0, 4, 1, 0,
15, 128, 16, 0, 228, 160, 15, 128, 12, 0, 228, 160,
0, 0, 170, 128, 1, 0, 0, 0, 170, 128, 1, 0,
228, 128, 4, 0, 0, 4, 228, 128, 4, 0, 0, 4,
0, 0, 15, 192, 17, 0, 0, 0, 15, 192, 13, 0,
228, 160, 0, 0, 255, 128, 228, 160, 0, 0, 255, 128,
1, 0, 228, 128, 1, 0, 1, 0, 228, 128, 1, 0,
0, 2, 0, 0, 1, 128, 0, 2, 0, 0, 15, 128,
0, 0, 0, 160, 2, 0, 3, 0, 228, 144, 2, 0,
0, 3, 0, 0, 1, 128,
0, 0, 0, 128, 4, 0,
0, 161, 5, 0, 0, 3,
0, 0, 14, 128, 2, 0,
144, 144, 4, 0, 0, 160,
4, 0, 0, 4, 0, 0,
7, 128, 3, 0, 228, 144,
0, 0, 0, 128, 0, 0,
249, 128, 2, 0, 0, 3,
0, 0, 7, 128, 0, 0,
228, 128, 5, 0, 228, 160,
5, 0, 0, 3, 0, 0,
8, 128, 3, 0, 255, 144,
4, 0, 85, 160, 11, 0,
0, 3, 0, 0, 15, 128, 0, 3, 0, 0, 15, 128,
0, 0, 228, 128, 0, 0, 0, 0, 228, 129, 2, 0,
228, 144, 4, 0, 0, 4,
0, 0, 15, 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, 85, 160, 10, 0, 0, 3,
0, 0, 15, 208, 0, 0, 0, 0, 15, 208, 0, 0,
228, 128, 0, 0, 0, 160, 228, 128, 14, 0, 170, 160,
1, 0, 0, 2, 0, 0, 1, 0, 0, 2, 0, 0,
3, 224, 1, 0, 228, 144, 3, 224, 1, 0, 228, 144,
255, 255, 0, 0 255, 255, 0, 0