• Advertisement
Sign in to follow this  

Simple shader invalid call

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

Share this post


Link to post
Share on other sites
Advertisement

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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement