Jump to content
  • Advertisement
Sign in to follow this  
Timptation

Effect file compiler error (SOLVED)

This topic is 3366 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm getting the error "error X4545: vs_1_1 target does not support texture lookups". When I try to bump up the version to 3_0, I get "error X4541: vertex shader must minimally write all four components of POSITION", which I AM doing. This vertex shader worked fine before I tried putting it into an effect file, so I don't know what to do here... I'd prefer to keep version 1_1 if possible (and since it worked outside of the effect file, i dont know why not) Can anyone help me get this to compile? Here is the effect file: (before anyone says it, i know these are basic shaders that i could use the fixed function pipeline for. I'm getting my first practice with shaders/effects) uniform matrix WorldMatrix; uniform matrix LightWorldMatrix; uniform matrix ViewProjMatrix; uniform vector AmbientMtrl; uniform vector DiffuseMtrl; uniform vector LightPosition; vector DiffuseLightIntensity = {0.6f, 0.6f, 0.6f, 1.0f}; vector AmbientLightIntensity = {0.3f, 0.3f, 0.3f, 1.0f}; extern texture dwarfTexture; sampler baseTex = sampler_state { Texture = (dwarfTexture); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; }; // VERTEX SHADER struct VS_INPUT { vector position : POSITION; vector normal : NORMAL; vector<float, 2> uv : TEXCOORD0; }; struct VS_OUTPUT { vector position : POSITION; vector diffuse : COLOR; vector<float, 2> uv : TEXCOORD0; }; VS_OUTPUT Main(VS_INPUT input) { VS_OUTPUT output = (VS_OUTPUT)0; output.uv.x = input.uv.x; output.uv.y = input.uv.y; input.position.w = 1.0f; output.position = mul(input.position, ViewProjMatrix); LightPosition.w = 1.0f; input.position = mul(input.position, WorldMatrix); LightPosition = LightPosition - input.position; input.normal.w = 0.0f; input.normal = mul(input.normal, WorldMatrix); LightPosition.w = 0.0f; float s = dot(LightPosition, input.normal); if( s < 0.0f ) s = 0.0f; output.diffuse = (AmbientMtrl * AmbientLightIntensity) + (s * (DiffuseLightIntensity * DiffuseMtrl)); return output; }; // END VERTEX SHADER // PIXEL SHADER struct PS_INPUT { vector diffuse : COLOR0; vector<float, 2> uv : TEXCOORD0; }; struct PS_OUTPUT { vector diffuse : COLOR0; }; PS_OUTPUT Main(PS_INPUT input) { // zero out ouput. PS_OUTPUT output = (PS_OUTPUT)0; // sample texture. vector base = tex2D(baseTex, input.uv); // combine texel color with light. output.diffuse = base * input.diffuse; return output; } // END PIXEL SHADER // TECHNIQUE technique T0 { pass P0 { vertexShader = compile vs_1_1 Main(); pixelShader = compile ps_2_0 Main(); sampler[0] = (baseTex); } } // END TECHNIQUE [Edited by - Timptation on May 29, 2009 4:18:58 PM]

Share this post


Link to post
Share on other sites
Advertisement
Try to change the name of your VertexShader function to MainVS and the PixelShader function to MainPS and it should work fine.
The only problem to compiling is that you are using the same name for two different functions...you CANNOT do this.

Share this post


Link to post
Share on other sites
Thank you for the fast reply sir! That was it. I probably should have caught that myself, the error just threw me off. Thanks a bunch!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!