Jump to content

  • Log In with Google      Sign In   
  • Create Account


Simple shader invalid call


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Headkaze   Members   -  Reputation: 583

Like
0Likes
Like

Posted 22 February 2013 - 02:33 AM

I have a pretty simple shader that binds a couple of textures for transition effects.
float Progress;

texture Input1;
sampler Input1Sampler = sampler_state
{
	Texture = <Input1>;
};
texture Input2;
sampler Input2Sampler = sampler_state
{
	Texture = <Input2>;
};


float4 Blinds(float2 uv)
{
	if (frac(uv.y * 5.0f) < Progress)
	{
		return (tex2D(Input2Sampler, uv));
	}
	else
	{
		return (tex2D(Input1Sampler, uv));
	}
}

//--------------------------------------------------------------------------------------
// Pixel Shader
//--------------------------------------------------------------------------------------
float4 main(float2 uv : TEXCOORD) : COLOR
{
	return (Blinds(uv));
}


technique BlindsTransition
{
	pass BlindsTransition
	{
		VertexShader = null;
		PixelShader = compile ps_2_0 main();
	}
}
Here is my implementation in SlimDX (DirectX 9)
m_effect.Technique = "BlindsTransition";
m_effect.SetValue<float>("Progress", 1.0f);
m_effect.SetTexture("Input1", m_screenTexture1.DXTexture);
m_effect.SetTexture("Input2", m_screenTexture2.DXTexture);
m_effect.CommitChanges();

m_effect.Begin();
m_effect.BeginPass(0);

m_bottomQuad.Render(device);

m_effect.EndPass();
m_effect.End();
I get a "D3DERR_INVALIDCALL: Invalid call (-2005530516)" at the line "m_effect.SetValue<float>("Progress", 1.0f);" with the following stack trace.
SlimDX.Direct3D9.Direct3D9Exception occurred
  Message="D3DERR_INVALIDCALL: Invalid call (-2005530516)"
  Source="SlimDX"
  StackTrace:
       at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
       at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
       at SlimDX.Direct3D9.Effect.set_Technique(EffectHandle value)
       at DXSplitScreen.Render(Device device) in ...Engine\DXSplitScreen.cs:line 252
       at DXRenderer.RenderMiddle() in ...Rendering\DXRenderer.cs:line 451
       at DXRenderer.Render() in ...Rendering\DXRenderer.cs:line 186
  InnerException: 

Edited by Headkaze, 22 February 2013 - 02:38 AM.


Sponsor:

#2 Headkaze   Members   -  Reputation: 583

Like
0Likes
Like

Posted 22 February 2013 - 06:59 AM

The strange thing is if I remove the line

 

m_effect.Technique = "BlindsTransition";

 

then I can get the two textures fading into each other by setting the "Progress" variable. Adding that line back in and it fails. Why?



#3 Headkaze   Members   -  Reputation: 583

Like
0Likes
Like

Posted 22 February 2013 - 07:04 AM

Nevermind, I was actually loading the wrong shader!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS