"Unrecognized shader version" and other fun

Started by
2 comments, last by vs322 15 years, 11 months ago
Hello Gamedev I am getting 3 reacquiring errors in my project which hopefully are all related. These all show up in the debug output, but my program runs just how it should (no crashing or odd artifacts.) I get: Assertion failure! (h:\gfx_sdk_dgt_sdk\windows\directx\dxg\active\compiler\mid\cbaseprogram.cpp 637): uRangeMin < m_uInsts && uRangeMax <= m_uInsts about 50 times at start up, I believe that they are posted when: D3DXCreateEffectFromFile(pd3dDevice, "FXgamemap.fx", NULL,NULL,D3DXSHADER_DEBUG, 0, &pFX, &errors); is called. After this string of identical errors I get: D3DX: Unrecognized shader version 3 times. my shaders are compiled like : vertexShader = compile vs_2_0 TransformVSC2TextureRot(); and do work. And finally: Assertion failure! (h:\gfx_sdk_dgt_sdk\windows\directx\dxg\active\d3dx9\mesh\tri3mesh.inl 2627): (iHead == cVertices) || (rgfXCoords[rgiXOrder[iTail]] - rgfXCoords[rgiXOrder[iHead]]) > fEpsilon I am not sure what causes this but it gets posted to the output in the thousands. BTW none of the variables or files are from my code in the above errors. I am using vs8 (express) and the August 07 DxSDK. I have seen other posts about the first two issues I am having, but they don't seem to have concrete answers, and "Unrecognized shader version" gets a surprisingly small amount of results on google. Any help would be great.
Advertisement
What encoding are your .fx files in? Bit of a long shot, but I've had the compiler catch fire by accidentally storing it in some obscure codepage and character set.

Also, you don't have any SM1 shaders in your effect file do you? Later D3DX compilers don't support SM1 anymore, so that can manifest itself as 'unrecognised shader version'.

Depending on your debug level/settings you can usually get rid of the internal assert messages.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

I'm just editing the .fx file in vc8- I took a look at them in crimson editor after your suggestion, looks normal to me.

I guess that just suppressing the assertion failures is the way to go as it isn't really affecting my program, but these errors may crop up again if I just move on.

Even if someone out there doesn't have an answer it would be interesting to see if other people have gotten some of these errors and what they tried to do to fix it.

Edit: quick update: turning off shader debuggin in the directx control pannle gets rid of 2 of the errors:
Assertion failure! (h:\gfx_sdk_dgt_sdk\windows\directx\dxg\active\d3dx9\mesh\tri3mesh.inl 2627): (iHead == cVertices) || (rgfXCoords[rgiXOrder[iTail]] - rgfXCoords[rgiXOrder[iHead]]) > fEpsilon 


still remains. and there is nothing I can finds online about it. It also doesn't seem to have any effect on the meshes in my game/program at all, anyone else encounter it?

[Edited by - vs322 on May 15, 2008 6:17:30 AM]
Ok- so I now know that all 3 errors are because of my shader, and since they work, and don't crash anything I have moved on. But as it is probably the same with a lot of you when something isn't quite right: I want to know why.

Well I am not expecting it, but if some one wants to look over my shader code it would be great.
//FX file for DXGameMap//FX paramsuniform extern float4x4 gWVP;uniform extern texture gTexMain;uniform extern texture gTexOverlayTop;uniform extern texture gTexGridOverlay;uniform extern float gCircleXCenter;uniform extern float gCircleZCenter;uniform extern float gFRot;uniform extern float3 gLightVec;uniform extern float3 gCamPos;uniform extern float gLightPower;//======================Structuresstruct OutputVS2Text{	float4 posH : POSITION0;	float4 color : COLOR0;	float2 tex0    : TEXCOORD0;	float2 tex1    : TEXCOORD1;	float3 normalW : TEXCOORD2;	float3 posW	   : TEXCOORD3;};//=====================Sampler states====================================================================sampler TextureTop = sampler_state{	Texture = <gTexMain>;	MinFilter = Anisotropic;	MagFilter = LINEAR;	MipFilter = LINEAR;	MaxAnisotropy = 8;		AddressU  = WRAP;    AddressV  = WRAP;};sampler TextureGridOverlayTop = sampler_state{	Texture = <gTexGridOverlay>;	MinFilter = Anisotropic;	MagFilter = LINEAR;	MipFilter = LINEAR;	MaxAnisotropy = 8;		AddressU  = WRAP;    AddressV  = WRAP;};sampler TextureTopOverlay = sampler_state{	Texture = <gTexOverlayTop>;	MinFilter = Anisotropic;	MagFilter = LINEAR;	MipFilter = LINEAR;	MaxAnisotropy = 8;	AddressU  = BORDER;    AddressV  = BORDER;	BorderColor = 0x00000000;};//======================Functions=====================================================================float4 LightCalc(float3 Normal){	float3 FakeColor = float3(1.0f,1.0f,1.0f);	float s = max(dot(gLightVec, Normal),0.0f);	float fAmbient = 0.2;	return (float4(s*FakeColor, 1.0f)*(1.0f-fAmbient))+fAmbient;	//return float4(1.0f,1.0f,1.0f,1.0f);}float4 SpotLightCalc(float3 Normal, float3 pos){	float3 lightvec = normalize(gLightVec - pos);	float3 FakeColor = float3(1.0f,1.0f,1.0f);	float s = max(dot(Normal,lightvec),0.0f);	float fAmbient = 0.2;	return (float4(s*FakeColor, 1.0f)*(1.0f-fAmbient))+fAmbient;	//return float4(1.0f,1.0f,1.0f,1.0f);}float4 SpectralCalc(float3 Normal, float3 pos){	float3 lightvec = normalize(gLightVec - pos);	float3 toEye = normalize(gCamPos - pos);	float3 r = reflect(-normalize(lightvec), Normal);	return (pow(max(dot(r,toEye),0.0f), 16.00f))*0.4f;;	//return float4(0.0f,0.0f,0.0f,0.0f);}float LessThanZed(float fHiIn){	if(fHiIn > 0.0f)		return 1.0f;	else		return max((4.0f-abs(fHiIn))*0.25f,0.0f);}//======================Vertex shaders===================================================================================================OutputVS2Text TransformVSC2Texture(float3 posL : POSITION0, float2 tex0: TEXCOORD0){	OutputVS2Text outVS = (OutputVS2Text)0;	outVS.posH = mul(float4(posL, 1.0f), gWVP);	//outVS.color = float4(1.0f, 1.0f, 1.0f, 1.0f);	outVS.color = float4(1.0f,1.0f,1.0f,1.0f);	outVS.tex0 = tex0;	outVS.tex1 = float2((posL.x+0.5f-gCircleXCenter),-(posL.z+0.5f-gCircleZCenter-1.0f));	return outVS;}OutputVS2Text TransformVSC2TextureRot(float3 posL : POSITION0, float2 tex0: TEXCOORD0){	OutputVS2Text outVS = (OutputVS2Text)0;	outVS.posH = mul(float4(posL, 1.0f), gWVP);	float2 TextCenter =float2(gCircleXCenter, gCircleZCenter);	float2 texX;	float2 poswoffset=posL.xz-TextCenter;	float fRad = radians(gFRot);	texX.x = ((cos(fRad)*(poswoffset.x) - sin(fRad)*(-poswoffset.y)))+0.5f; //  x' = cos(theta)*x - sin(theta)*y 	texX.y = (((sin(fRad)*(poswoffset.x) + cos(fRad)*(-poswoffset.y)))+0.5f); //y' = sin(theta)*x + cos(theta)*y	outVS.color = float4(1.0f, 1.0f, 1.0f, 1.0f);	outVS.tex0 = tex0;	outVS.tex1 = float2((texX.x),(texX.y));	return outVS;}OutputVS2Text TransformVSC(float3 posL : POSITION0, float2 tex0: TEXCOORD0){	OutputVS2Text outVS = (OutputVS2Text)0;	outVS.posH = mul(float4(posL, 1.0f), gWVP);	outVS.color = float4(1.0f,1.0f,1.0f, 1.0f);	outVS.tex0 = tex0;	return outVS;}OutputVS2Text TransPlusLight(float3 posL : POSITION0, float2 tex0: TEXCOORD0, float3 norm : NORMAL0){	OutputVS2Text outVS = (OutputVS2Text)0;	outVS.posH = mul(float4(posL, 1.0f), gWVP);	outVS.color = LightCalc(normalize(norm));	outVS.tex0 = tex0;	return outVS;}OutputVS2Text TransPlusRangedLight(float3 posL : POSITION0, float2 tex0: TEXCOORD0, float3 norm : NORMAL0){	OutputVS2Text outVS = (OutputVS2Text)0;	outVS.posH = mul(float4(posL, 1.0f), gWVP);	float fDistMod =distance(outVS.posH,mul(float4(gCamPos, 1.0f), gWVP).xyz);	float fLightPow = min(1.0f, gLightPower/(fDistMod*fDistMod));	outVS.color = LightCalc(normalize(norm))* fLightPow;	outVS.tex0 = tex0;	return outVS;}OutputVS2Text TransformPhongPrep(float3 posL : POSITION0, float2 tex0: TEXCOORD0, float3 norm : NORMAL0){	OutputVS2Text outVS = (OutputVS2Text)0;	outVS.posH = mul(float4(posL, 1.0f), gWVP);	outVS.color = float4(1.0f,1.0f,1.0f, 1.0f);	outVS.normalW = norm;	outVS.posW = posL;//mul(float4(posL, 1.0f), gWVP).xyz;	outVS.tex0 = tex0;	return outVS;}OutputVS2Text TransformPhongPrepGrid(float3 posL : POSITION0, float2 tex0: TEXCOORD0, float3 norm : NORMAL0){	OutputVS2Text outVS = (OutputVS2Text)0;	outVS.tex1 = posL.xz+0.5f;	outVS.tex1.y = - outVS.tex1.y;	outVS.posH = mul(float4(posL, 1.0f), gWVP);	outVS.color = float4(1.0f,1.0f,1.0f, 1.0f);	outVS.normalW = norm;	outVS.posW = mul(float4(posL, 1.0f), gWVP).xyz;	outVS.tex0 = tex0;	return outVS;}//===========================Pixel shaders===================================================================================float4 TexturePSLight(float3 tex0: TEXCOORD0, float3 normalW : TEXCOORD2, float3 posW : TEXCOORD3) : COLOR{		float4 litCol = (LightCalc(normalW));	float4 textCol = tex2D(TextureTop, tex0.xy);	//float fDistMod =distance(posW,gCamPos);	//float fLightPow = min(1.0f, 100/(fDistMod*fDistMod));	return (textCol * ((litCol)+SpectralCalc(normalW, posW)));// *LessThanZed(posW.y)*fLightPow;}float4 TexturePSLightGrid(float3 tex0: TEXCOORD0,float3 tex1: TEXCOORD1, float3 normalW : TEXCOORD2, float3 posW : TEXCOORD3) : COLOR{		normalW = normalize(normalW);	float4 litCol = (LightCalc(normalW));	float4 textCol = tex2D(TextureTop, tex0.xy);	float3 c0 = float3(textCol.xyz * litCol.xyz);	float4 c1 = tex2D(TextureGridOverlayTop, tex1).rgba;	//return c1;	return float4((c0*(1.0f-c1.a))+(c1.rgb*c1.a), 1.0f);}float4 TexturePS(float4 c : COLOR0, float3 tex0: TEXCOORD0) : COLOR{	float4 textCol = tex2D(TextureTop, tex0.xy);	return textCol*c;}float4 TextureBlendPS(float4 c : COLOR0, float2 tex0: TEXCOORD0, float2 tex1: TEXCOORD1) : COLOR{	float3 c0 = (tex2D(TextureTop, tex0).rgb)*c.rgb;	float4 c1 = tex2D(TextureTopOverlay, tex1).rgba;	return float4((c0*(1.0f-c1[3]))+(c1.rgb*c1[3]), 1.0f);}//=========================  Techniques =====================================================technique MapNoCircle{	pass P0	{		vertexShader = compile vs_2_0 TransformPhongPrep();		pixelShader = compile ps_2_0 TexturePSLight();		FillMode = Solid;	}}technique MapMethod{	/*	pass P0	{		vertexShader = compile vs_2_0 TransformPhongPrepGrid();		pixelShader = compile ps_2_0 TexturePSLightGrid();		FillMode = Solid;	}	*/	/*	pass P0	{		vertexShader = compile vs_2_0 TransPlusRangedLight();		pixelShader = compile ps_2_0 TexturePS();	}	*/	/*	pass P0	{		vertexShader = compile vs_2_0 TransPlusLight();		pixelShader = compile ps_2_0 TexturePS();	}	*/		pass P0	{		vertexShader = compile vs_2_0 TransformVSC2TextureRot();		pixelShader = compile ps_2_0 TextureBlendPS();		FillMode = Solid;	}	}

This topic is closed to new replies.

Advertisement