Sign in to follow this  

[SlimDX] GetTechniqueByIndex returns Invalid result

This topic is 2840 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

Hi, I get following error, maybe you can help or have seen it before:
failed: E_FAIL: An undetermined error occurred (-2147467259)
	SlimDX.Direct3D10.Direct3D10Exception: E_FAIL: An undetermined error occurred (-2147467259)
	at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
	at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
	at SlimDX.Direct3D10.EffectPass.get_Description()
I have turned the debug level up to the maximum. The effect seems to be fine, I don't get any errors from looking at its properties while debugging and there was no compilation error either. But the call to... GetTechniqueByIndex(0) and GetPassByIndex(0) ...does not return valid results! (their properties like "description" throw an exception). This is how I create my shader:
Effect shaderCompiled = Effect.FromString(
			    Device,
			    shaderCode, 
		            "fx_4_0",
			    ShaderFlags.Debug,
			    EffectFlags.None,
					null,
				  null,
					out compilationError);

this is the shader: (code from axiverse.com)
					struct VS_IN
					{
						float4 pos : POSITION;
						float4 col : COLOR;
					};

					struct PS_IN
					{
						float4 pos : SV_POSITION;
						float4 col : COLOR;
					};

					PS_IN VS( VS_IN input )
					{
						PS_IN output = (PS_IN)0;
						
						output.pos = input.pos;
						output.col = input.col;
						
						return output;
					}

					float4 PS( PS_IN input ) : SV_Target
					{
						return input.col;
					}

					technique10 Render
					{
						pass P0
						{
							SetGeometryShader( 0 );
							SetVertexShader( CompileShader( vs_4_0, VS() ) );
							SetPixelShader( CompileShader( ps_4_0, PS() ) );
						}
					}


Thanks for any help!

Share this post


Link to post
Share on other sites
No, I create my shader from a string inside the application. I posted the code I use. Maybe a bit unclear, but thats how it looks exactly in my code:


string shaderCode = @"
struct VS_IN etc etc...
";


I also enabled "unmanaged code debugging" with no effect. I enabled maximum validation and such, but I saw that those settings in the control panel only seem to apply to DirectX9 anyway. Well that was unrelated..I just wan't to highlight what I already tried to resolve that, and that it's a lot :)

In fact, I have copy pasted the minitriangle sample into my test project, and everything works. (even with my shader code).
I had to refactor these steps (like device creation and such) into different classes and methods obviously, and now it throws this strange error, albeit all positive return codes.

Also a strange thing that appeared almost at the same time but probably / hopefully is unrelated: My debugger takes forever to step into methods, and even stops at times for no apparent reason.

[Edited by - Meai on March 2, 2010 9:14:25 AM]

Share this post


Link to post
Share on other sites
Have you tried to output your shader to a file, and then compile it with the shader compiler "fxc", you can found in the DX-SDK utilities? It should throw some exceptions, if your fx is not correct. If the compiler sais nothing, and the size of the output file is something about 100 (fx5_0) or 124 (fx4_0) bytes, then the format of the input file is wrong -> see @ mike popolski, he mentioned the unicode thing.

Share this post


Link to post
Share on other sites
Thank you for all your help, I'm very sorry for wasting your time! I in fact used a wrong string for my shader compilation because an engine method parameter didn't (and still doesnt) return the correct shader. Still strange that I didn't get any shader compilation errors in the out parameter of Effect::FromString()though ? It was basically a string with senseless information.
(it contained the string "<DefaultShader>" instead of the actual shader code)

edit: btw, I realized what the reason for my super slow debugging was: unmanaged code debugging as suggested by the FAQ on the Slimdx website. I was not able to see any differences, but I'll look into what that actually should have done :)

[Edited by - Meai on March 3, 2010 4:37:29 AM]

Share this post


Link to post
Share on other sites

This topic is 2840 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.

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