• Advertisement
Sign in to follow this  

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

This topic is 2898 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 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
Advertisement
"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.

Share this post


Link to post
Share on other sites
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
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
Sign in to follow this  

  • Advertisement