I have problem with my shader on NVIDIA cards. On AMD it's working right.
Shader Builder exported CODE:
//ROOT
//PSParts
//VSParts
//Samplers
sampler sLod23ColorGround : register(s0);
sampler sLod23BumpGround : register(s1);
sampler sTG0 : register(s2);
sampler sTG1 : register(s3);
sampler sTG2 : register(s4);
sampler sTG3 : register(s5);
sampler sTG4 : register(s6);
//Constants
float4x4 mZERO : register(c0);
float4 fvTIME : register(c4);
float4 fvGS : register(c5);
float4 fvGSD : register(c6);
float4 fvGSDFT : register(c7);
float4 fvGSSHA0 : register(c8);
float4 fvGSSHA0Lim : register(c9);
float4 fvGSSHA1 : register(c10);
float4 fvGSSHA1Lim : register(c11);
float4 fvGSSHARDist : register(c12);
float4 fvGSDir : register(c13);
float4 fvGSTar : register(c14);
float4 fvGSSHARDir : register(c15);
float4 fvGSContFade : register(c16);
float4 fvGSGroundFade : register(c17);
float4 fvGSGroundRockFade : register(c18);
float4 fvGSWindFade : register(c19);
float4 fvGSRainGlobals : register(c20);
float4 fvGSTarget : register(c21);
float4 fvGSSky_Dist : register(c22);
float4 fvGSSky_Dist_Up : register(c23);
float4 fvGSSky_Dist_Proc : register(c24);
float4 fvGSSkyFade : register(c25);
float4 fvGSGroundModColor : register(c26);
float4 fvGSGroundModBump : register(c27);
float4 fvGSStaticDistStart : register(c28);
float4 fvGSShaTerrainAll : register(c29);
float4 fvGSShaCloudAll : register(c30);
float4 fvTAA : register(c31);
float4 fvSunColor : register(c32);
float4 fvSunCorona : register(c33);
float4 fvSunCorona2 : register(c34);
float4 fvSunCoronaDown : register(c35);
float4 fvTFC : register(c36);
float4 fvTFF : register(c37);
float4 fvTFFSS : register(c38);
float4 fvTFFSE : register(c39);
float4 fvTFFFlow : register(c40);
float4 fvSkyColor : register(c41);
float4 fvCloudColor : register(c42);
float4 fvTAARain : register(c43);
float4 fvSunColorRain : register(c44);
float4 fvSunCoronaRain : register(c45);
float4 fvSunCorona2Rain : register(c46);
float4 fvSunCoronaDownRain : register(c47);
float4 fvTFCRain : register(c48);
float4 fvTFFRain : register(c49);
float4 fvTFFSSRain : register(c50);
float4 fvTFFSERain : register(c51);
float4 fvTFFFlowRain : register(c52);
float4 fvSkyColorRain : register(c53);
float4 fvCloudColorRain : register(c54);
float4 fvA0 : register(c55);
float4 fvA0R : register(c56);
float4 fvD0 : register(c57);
float4 fvD0R : register(c58);
float4 fvS0 : register(c59);
float4 fvS0R : register(c60);
float4 fvLADV0 : register(c61);
float4 fvLADV0R : register(c62);
float4 fvLP0 : register(c63);
float4 fvLP02 : register(c64);
float4x4 mLP0 : register(c65);
float4 fvA0Water : register(c69);
float4 fvA0RWater : register(c70);
float4 fvD0Water : register(c71);
float4 fvD0RWater : register(c72);
float4 fvS0Water : register(c73);
float4 fvS0RWater : register(c74);
float4 fvLADV0Water : register(c75);
float4 fvLADV0RWater : register(c76);
float4 fvCamScreen : register(c77);
float4 fvCamScreenSet : register(c78);
float4x4 mCamInvM : register(c79);
float4x4 mCamWM : register(c83);
float4x4 mCamProjM : register(c87);
float4 fvCamEP : register(c91);
float4x4 mVC1 : register(c92);
float4 fvEPDir : register(c96);
float4x4 mV : register(c97);
float4x4 mVP : register(c101);
float4x4 mVC : register(c105);
float4 fvEP : register(c109);
float4 fvEPD : register(c110);
float4 fvDist : register(c111);
float4 fvCross : register(c112);
float4 fvTACM0 : register(c113);
float4 fvTMM0 : register(c114);
float4 fvTRV0 : register(c115);
float4 fvTRM0 : register(c116);
float4 fvTALM0 : register(c117);
float4 fvTALMS0 : register(c118);
float4 fvTACM1 : register(c119);
float4 fvTMM1 : register(c120);
float4 fvTRV1 : register(c121);
float4 fvTRM1 : register(c122);
float4 fvTALM1 : register(c123);
float4 fvTALMS1 : register(c124);
float4 fvTACM2 : register(c125);
float4 fvTMM2 : register(c126);
float4 fvTRV2 : register(c127);
float4 fvTRM2 : register(c128);
float4 fvTALM2 : register(c129);
float4 fvTALMS2 : register(c130);
float4 fvTACM3 : register(c131);
float4 fvTMM3 : register(c132);
float4 fvTRV3 : register(c133);
float4 fvTRM3 : register(c134);
float4 fvTALM3 : register(c135);
float4 fvTALMS3 : register(c136);
float4 fvTACM4 : register(c137);
float4 fvTMM4 : register(c138);
float4 fvTRV4 : register(c139);
float4 fvTRM4 : register(c140);
float4 fvTALM4 : register(c141);
float4 fvTALMS4 : register(c142);
//VS_Structs
//VS_LigthtDirCount - Shaders VS structs
//SPDef_VS_Structs_Ground3_Test_Out - Shaders VS structs
struct SPDef_VS_Structs_Ground3_Test_Out
{
//Position
float4 Position : POSITION;
//VNormal
float3 VNormal : TEXCOORD0;
//V Color
float4 VColor : TEXCOORD1;
//Position2
float3 Position2 : TEXCOORD2;
};
//VS_SIMPLE_GroundLod3_BT_IN - Shaders VS structs
struct VS_SIMPLE_GroundLod3_BT_IN
{
//Position
float4 Position : POSITION;
//Normal
float3 Normal : NORMAL;
//Texcoord Color map coord
float2 Texcoord : TEXCOORD0;
//Tangent
float3 Tangent : TEXCOORD1;
//Binormal
float3 Binormal : TEXCOORD2;
//VColor
float4 VColor : TEXCOORD3;
};
//VS_Shaders
//VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test
SPDef_VS_Structs_Ground3_Test_Out VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test(VS_SIMPLE_GroundLod3_BT_IN Input)
{
SPDef_VS_Structs_Ground3_Test_Out Out;
//------------------ BODY START ------------------
// Put shader code here
//VS MIX INCLUDES
//SMPartsVSInitType_GroundLod3 - Shader Mixing
//OK INCLUDE VSPart_Include(SMPartsVSInitType_GroundLod3);
//SMPartsVSInitType_GroundLod3 - Shader Mixing
VS_LigthtDirCount LightDir;
float4 Position;
float3 fvNormal;
float3 fvTangent;
float3 fvBinormal;
float3 fvOP;
float4 VColor;
//SMPartsVSReadStream_GroundLod3_BT_IN - Shader Mixing
//OK INCLUDE VSPart_Include(SMPartsVSReadStream_GroundLod3_BT_IN);
//SMPartsVSReadStream_GroundLod3_BT_IN - Shader Mixing
Position = Input.Position;
fvNormal = Input.Normal;
fvTangent = Input.Tangent;
fvBinormal = Input.Binormal;
VColor = Input.VColor;
//SMPartsVSFinalTransformation_GroundLod3 - Shader Mixing
//OK INCLUDE VSPart_Include(SMPartsVSFinalTransformation_GroundLod3);
//SMPartsVSFinalTransformation_GroundLod3 - Shader Mixing
fvNormal = mul(fvNormal,mV);
fvTangent = mul(fvTangent,mV);
fvBinormal = mul(fvBinormal,mV);
fvOP=mul(Position,mV);
Position=mul(Position,mVP);
//SMPartsVSReturn_GroundLod3_Test - Shader Mixing
//OK INCLUDE VSPart_Include(SMPartsVSReturn_GroundLod3_Test);
//SMPartsVSReturn_GroundLod3_Test - Shader Mixing
Out.Position = Position;
Out.VNormal = fvNormal;
Out.VColor = VColor;
Out.Position2 = fvOP;
//Out.VColor=float4(0.5,0.5,0.5,0.5);
//Out.Binormal = fvBinormal;
//Out.Tangent = fvTangent;
//------------------ BODY END ------------------
return(Out);
};
//PS_Structs
//PS_SIMPLE_4_COLOR_OUT - Shaders VS structs
struct PS_SIMPLE_4_COLOR_OUT
{
//Color0
float4 Color0 : COLOR0;
//Color1
float4 Color1 : COLOR1;
//Color2
float4 Color2 : COLOR2;
//Color3
float4 Color3 : COLOR3;
};
//SPDef_PS_Structs_Ground3_Test_IN - Shaders VS structs
struct SPDef_PS_Structs_Ground3_Test_IN
{
//VNormal
float3 VNormal : TEXCOORD0;
//V Color
float4 VColor : TEXCOORD1;
//Position2
float3 Position2 : TEXCOORD2;
//Screen position
float2 PosVPos : VPOS;
};
//PS_Shaders
//PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test
PS_SIMPLE_4_COLOR_OUT PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test(SPDef_PS_Structs_Ground3_Test_IN Input)
{
PS_SIMPLE_4_COLOR_OUT OutS;
float4 Out;
//------------------ BODY START ------------------
// Put shader code here
//PS MIX INCLUDES
//SMPartsPSInitializeType_GroundLod3Test - Shader Mixing
//OK INCLUDE PSPart_Include(SMPartsPSInitializeType_GroundLod3Test);
//SMPartsPSInitializeType_GroundLod3Test - Shader Mixing
OutS.Color0 = Input.VColor;
OutS.Color1 = float4(Input.Position2,0);
OutS.Color2 = float4(Input.VNormal,1);
OutS.Color3 = float4(0,0,1,0);
//------------------ BODY END ------------------
return(OutS);
};
//TechniquesSquad
//DefSH_CompilationsAdv_GroundLod2_To_4_Ground3Test
// Tech_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test_DefaultMixsVS_Groun3_Test
technique Tech_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test_DefaultMixsVS_Groun3_Test
{
pass Pass_0
{
VertexShader = compile vs_3_0 VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test();
PixelShader = compile ps_3_0 PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test();
}
}
Problem is, that this shader doesnt work on NVIDIA an i Don't know why. If i make vs to ps shader shorter one value less - disable NORMAL and use all values from stream it works. But if i do not read one of input value in ps shader it's stops working. STOP WORKING means restarting NVIDIA card drivers. Input stream looks like that:
public static readonly VertexElement[] Declarator = new VertexElement[]
{
new VertexElement( 0, 0, DeclarationType.Float3,
DeclarationMethod.Default, DeclarationUsage.Position, 0 ),
new VertexElement( 0, 12, DeclarationType.Float3,
DeclarationMethod.Default, DeclarationUsage.Normal, 0 ),
new VertexElement( 0, 24, DeclarationType.Float2,
DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0 ),
new VertexElement( 0, 32, DeclarationType.Float3,
DeclarationMethod.Default, DeclarationUsage.TextureCoordinate , 1 ),
new VertexElement( 0, 44, DeclarationType.Float3,
DeclarationMethod.Default, DeclarationUsage.TextureCoordinate , 2 ),
new VertexElement( 0, 56, DeclarationType.Float4,
DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 3),
VertexElement.VertexDeclarationEnd
};
Shader compiler output here:
//listing of all techniques and passes with embedded asm listings
technique Tech_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test_DefaultMixsVS_Groun3_Test
{
pass Pass_0
{
vertexshader =
asm {
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4x4 mV;
// float4x4 mVP;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// mV c97 3
// mVP c101 4
//
vs_3_0
dcl_position v0 // Input<0,1,2,3>
dcl_normal v1 // Input<4,5,6>
dcl_texcoord3 v2 // Input<15,16,17,18>
dcl_position o0
dcl_texcoord o1.xyz
dcl_texcoord1 o2
dcl_texcoord2 o3.xyz
#line 290 "D:\@Fotu\2008\Media\Editor\data\FotuRoot\ShadersStudio\ShaderParts\PrecompiledEffect\DefSH_CompilationsAdv_GroundLod2_To_4.fx"
dp3 o1.x, v1, c97 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<4>
dp3 o1.y, v1, c98 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<5>
dp3 o1.z, v1, c99 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<6>
#line 293
dp4 o3.x, v0, c97 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<11>
dp4 o3.y, v0, c98 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<12>
dp4 o3.z, v0, c99 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<13>
dp4 o0.x, v0, c101 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<0>
dp4 o0.y, v0, c102 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<1>
dp4 o0.z, v0, c103 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<2>
dp4 o0.w, v0, c104 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<3>
#line 285
mov o2, v2 // ::VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test<7,8,9,10>
// approximately 11 instruction slots used
};
pixelshader =
asm {
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
ps_3_0
def c0, 0, 1, 0, 0
dcl_texcoord v0.xyz // Input<0,1,2>
dcl_texcoord1 v1 // Input<3,4,5,6>
dcl_texcoord2 v2.xyz // Input<7,8,9>
#line 631 "D:\@Fotu\2008\Media\Editor\data\FotuRoot\ShadersStudio\ShaderParts\PrecompiledEffect\DefSH_CompilationsAdv_GroundLod2_To_4.fx"
mov oC0, v1 // ::PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test<0,1,2,3>
mov oC1.xyz, v2 // ::PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test<4,5,6>
mov oC1.w, c0.x // ::PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test<7>
mov oC2.xyz, v0 // ::PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test<8,9,10>
mov oC2.w, c0.y // ::PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test<11>
mov oC3, c0.xxyx // ::PS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixs_GroundLods_GroundLod3_Test<12,13,14,15>
// approximately 6 instruction slots used
};
}
}
Soo, please some ideas what to do. I checked all setting , and it looks ok. all HW caps etc. Do I miss something?
Result of engine on AMD : http://www.youtube.com/watch?v=8fyVTrj_pLs and I hope on NVIDIA will be same soon :-)
VS_DefSH_CompilationsAdv_GroundLod2_To_4_Cond_WithoutWind_Cond_Light1_DefaultMixsVS_Groun3_Test. What? :) – Laurent Couvidou Dec 21 '12 at 14:39