Sign in to follow this  
feal87

Effect framework problem

Recommended Posts

I'm trying to compile a rather simple shader and i'm encountering a strange problem with the DX10 effects framework.
float4 PS( float4 Colore : COLOR ) : SV_Target 
{ 
	return Colore;
}

#ifdef DX9
technique Render 
{	
	pass P0	
	{ 
		SetVertexShader( CompileShader( vs_3_0, VS() ) );
		SetPixelShader( CompileShader( ps_3_0, PS() ) );
		ZEnable = FALSE;
		AlphaBlendEnable = true;
		SrcBlend = 5; 
		DestBlend = 6; 
		BlendOp = ADD; 
		SrcBlendAlpha = 5; 
		DestBlendAlpha = 6;
		BlendOpAlpha = ADD;
	}
}
#else
technique10 Render 
{	
	pass P0	
	{ 
		SetGeometryShader( 0 ); 
		SetVertexShader( CompileShader( vs_4_0, VS() ) );	
		SetPixelShader( CompileShader( ps_4_0, PS() ) );
		SetDepthStencilState( DisableDepth, 0 );
		SetBlendState( PaintBlending, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );		
	}
}
#endif

This simple code do work on FXC (target ps_4_0) and do not work on the effect framework. (If I add a variable with SV_POSITION as semantic, it start to work again.) Please note that this same code works fine on either FXC AND the effect framework for DX9. Any clue?

Share this post


Link to post
Share on other sites
Is this your complete fx file? If so, where is your VS() function?

Also, formally, the pixel shader does expect a SV_POSITION variable as an input parameter. You don't have to use it yourself in the function, if you don't need it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nik02
Is this your complete fx file? If so, where is your VS() function?

Also, formally, the pixel shader does expect a SV_POSITION variable as an input parameter. You don't have to use it yourself in the function, if you don't need it.


That is not the complete fx file obviously.
Anyway I want to know the reason in DX9 it works, in DX10 with FXC it works, but with the effect framework in DX10 don't. Just that, its curiosity, not particular need. :D

Share this post


Link to post
Share on other sites
IIRC D3D9 is more lenient if you omit the position semantic from pixel shader input parameters; this is due to the fact that the shader stages are logically separate and therefore not very tightly bound.

In D3D10, the input signature of a shader must be a strict, same-order subset of (or exactly same as) the output signature of the previous shader stage. This is required, because in D3D10 hardware, the I/O registers are physically shared. Because the vertex shader has to output at least the position register, the pixel shader also has to have at least the matching input position register.

Note that D3D10 hardware is capable of emulating legacy register copying when using D3D9 API (or earlier) but D3D10 API does not allow this due to performance reasons.

Have you tested that the effect, compiled with FXC and without the position semantic, can actually be set to a D3D10 device?

Share this post


Link to post
Share on other sites

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