Sign in to follow this  
Mathy

[SlimDX] Can't load shader? Unexpected token?

Recommended Posts

Mathy    104
I'm trying to load a shader through Effect.LoadFromString. However, it returns the following error: SlimDX.CompilationException: C:\Users\Mathy\Programming\Miscellaneous\Morbus2D2\Morbus2D2\bin\Debug\memory(25,6): error X3000: syntax error: unexpected token 'VertexShader' ---> SlimDX.Direct3D9.Direct3D9Exception: E_FAIL: An undetermined error occurred (-2147467259) Now, the shader-code is: float4x4 worldViewProjection : WORLDVIEWPROJ; float4x4 worldMatrix : WORLD; texture texture0; sampler2D texSampler0 : TEXUNIT0 = sampler_state { Texture = (texture0); MIPFILTER = LINEAR; MAGFILTER = LINEAR; MINFILTER = LINEAR; }; struct a2v { float4 position : POSITION0; float2 tex0 : TEXCOORD0; }; struct v2p { float4 position : POSITION0; float2 tex0 : TEXCOORD0; }; struct p2f { float4 color : COLOR0; }; void VertexShader( in a2v IN, out v2p OUT ) { OUT.position = mul(IN.position, worldViewProjection); OUT.tex0 = IN.tex0; } void PixelShader( in v2p IN, out p2f OUT ) { OUT.color = tex2D(texSampler0, IN.tex0); } technique diffuse { pass p0 { vertexshader = compile vs_1_1 VertexShader(); pixelshader = compile ps_1_0 PixelShader(); } } What am I doing wrong? Managed DirectX can load it just fine it seems.

Share this post


Link to post
Share on other sites
Mathy    104
Quote:
Original post by MJP
"VertexShader" and "PixelShader" are reserved keywords for the effect format, so you can't use those to name your functions.

Also, please use "source" or "code" tags when posting code.


Okay, now it says that ps_1_0 is no longer supported?

Share this post


Link to post
Share on other sites
jpetrie    13159
Quote:

Okay, now it says that ps_1_0 is no longer supported?

Becuase ps_1_0 is no longer supported. Try ps_2_0 if your card supports it, otherwise ps_1_4.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this