Skip to main content
gamedev.net
🔒 Locked

Effect file compiler error (SOLVED)

Started by Timptation May 29, 2009 at 3:43 PM 1 replies 2.2k views
Original Post
Timptation
Timptation
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 uv : TEXCOORD0; }; struct VS_OUTPUT { vector position : POSITION; vector diffuse : COLOR; vector 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 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]
feal87
feal87
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.
Timptation
Timptation
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!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.