• Advertisement
Sign in to follow this  

Error on getting Value from Effect10

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

After all my troubles about Fonts, i've decided to skip this argument. Now i'm trying with primitives and shaders. Here is my simple shader that i've created for the application.
float Increment	:	CVALUE;

struct VS_INPUT
{
	float4 Pos	:	POSITION;
	float4 Col	:	COLOR;
};

struct PS_INPUT
{
	float4 Pos	:	SV_POSITION;
	float4 Col	:	COLOR;
};

PS_INPUT vs_main(VS_INPUT input)
{
	PS_INPUT Out = (PS_INPUT)0;
	Out.Pos = input.Pos;
	Out.Col = input.Col;
	
	return Out;
	
}

float4 ps_main(PS_INPUT input)	:	SV_TARGET
{
	return (input.Col + Increment);
}

technique10	Position
{
	Pass PositionRendering
	{
        SetVertexShader( CompileShader( vs_4_0, vs_main() ) );
        SetGeometryShader(NULL);
        SetPixelShader( CompileShader( ps_4_0, ps_main() ) );
	}
}
Now in my application, i use ID3DXEffect interface to manage the shader code. My intentions are to change continuosly triangle's color, and so i've tried this code
        f += 0.1f;
	shader->GetVariableBySemantic("CVALUE")->AsScalar()->SetFloat(f);

	shader->GetTechniqueByIndex(0)->GetPassByIndex(0)->Apply(0);
	float z = 0;
	HRESULT hr =      shader->GetVariableBySemantic("CVALUE")->AsScalar()->GetFloat(&z);
Now the setFloat functions works correcly, but wher i try to get value from shader, i receive an E_FAIL. Anyway, the effect does not work: the triangle has got every time the same color, while the color should change and finally arrive to white, right? Thank you for the help.

Share this post


Link to post
Share on other sites
Advertisement
Nothing.

Anyway, i've found a solution: using GetValueFromIndex it works.
I do not know why it does not accept semantics and by name.

Share this post


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

  • Advertisement