Sign in to follow this  

VPOS in DX10?

This topic is 3790 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’m porting some code from DX9 to DX10. In DX9 I used an input semantic to the pixel shader called VPOS which informed me of the position of the fragment I was writing to. After reading the documentation I got the impression that this functionality was still around but when I tried to implement it I got this message: f:\Programing\MyEngine\MyEngine.fx(397,7): D3D10EffectCompiler: ERROR: No valid VertexShader-PixelShader combination could be found in Technique CreateRSM, Pass P0 (this is an issue because the GeometryShader is always NULL). I used the same code as I had used in DX9 (float2 ScreenPos : VPOS). Can I do something to solve this? Thanks
CREATE_RSM_PS_OUT CreateRSM_PS( CREATE_RSM_VS_OUT Input, float2 ScreenPos : VPOS)
{
	CREATE_RSM_PS_OUT Output;
	
	Output.Direction.xyz = normalize( Input.LightDir);
	Output.Direction.w = 0.0f;
	Output.Position = Input.LightPos;
	Output.Color = g_MeshTexture.Sample( MeshTextureSampler, Input.TextureUV);
	
	return Output;
}

technique10 CreateRSM
{
	pass P0
	{       
		SetVertexShader( CompileShader( vs_4_0, CreateRSM_VS()));
		SetGeometryShader( NULL);
		SetPixelShader( CompileShader( ps_4_0, CreateRSM_PS()));
	}
}


Share this post


Link to post
Share on other sites
Try SV_POSITION instead.

Under D3D9 you couldn't use POSITION directly so you had a special-case VPOS for SM3 paths, which is a bit clunky really. With D3D10 they've simplified things and there's just the single semantic to rule them all [smile]

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
Try SV_POSITION instead.

Under D3D9 you couldn't use POSITION directly so you had a special-case VPOS for SM3 paths, which is a bit clunky really. With D3D10 they've simplified things and there's just the single semantic to rule them all [smile]

hth
Jack


If you want to use SV_POSITION in the same way as VPOS then you have to transform the world position on the VS side with some orthogonal projection matrix, or am I wrong? I think VPOS in DX9 was convenient.

Share this post


Link to post
Share on other sites

SV_POSITION in a pixel shader gives you the coordinates of the pixel in the render target (offset by 0.5).

Its kindof confusing that SV_POSITION in a pixel shader != SV_POSITION from the vertex shader, but thats how they did it.

Share this post


Link to post
Share on other sites

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