Jump to content
  • Advertisement
Sign in to follow this  
Hodgman

ps_3_0 on ATI?

This topic is 4011 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've spent the past few days creating an 'uber shader' in HLSL (PS 3.0) for drawing pretty fonts using photoshop-style effects (bevel/stroke/gradient/drop shadow...). All of my code is contained in a .fx file. After I finished my shader, I checked it into the source repo only to find that now fonts don't appear at all on other team members PCs. I've traced this down to differences in graphics cards. I was developing using an "NVIDIA Quadro FX 3450/4000 SDI, 256MB", but the target hardware (which the other team members are using) is an "ATI Radeon X1650, 512MB". At the end of the project, all that matters is that my shader works on the x1650. Today I got an x1650 so I could try and fix this problem - but I can't get any PS 3.0 shaders to work at all!! DirectX compiles my fx files without complaint, but then nothing is rendered at all. The following FX file defines two techniques - both are identical except that one compiles using PS 2.0 and the other uses PS 3.0. The first one correctly renders flat green glyphs, but the second one doesn't render anything at all. Any hints/tips for debugging this situation would be greatly appreciated ;)
texture BaseMap
<
	string NTM = "base";
>;
sampler BaseSampler = sampler_state
{
	Texture = (BaseMap);
	MINFILTER = LINEAR;
	MIPFILTER = LINEAR;
	MAGFILTER = LINEAR;
};
float4x4 WorldViewProj : WORLDVIEWPROJECTION;
float4x4 ViewProj : VIEWPROJECTION;
float4x4 world_matrix : WORLD;

struct VS_OUTPUT
{
	float4 Pos:		POSITION;
	float4 Col:		COLOR;
	float2 Tex:		TEXCOORD0;
};

VS_OUTPUT VSMain_Regular( float4 inPos: POSITION, float2 inTex: TEXCOORD0, float4 inCol: COLOR )
{
	VS_OUTPUT Out;
	float4 worldPos;
	Out.Pos = mul(inPos, WorldViewProj);
	Out.Col = inCol;
	Out.Tex = inTex;
	return Out;
}

float4 PSMain_Regular( float2 inTex: TEXCOORD0, float4 inCol: COLOR0 ) : COLOR0
{
	float4	color = tex2D(BaseSampler, inTex) * inCol;
	color.rgb = float3(0,1,0);//DEBUG TEST
	return	color;
}

technique Font_Test_Working
{
	pass Single_Pass
	{
		ALPHABLENDENABLE = TRUE;
		ALPHATESTENABLE = TRUE;
		DESTBLEND = invsrcAlpha;
		SRCBLEND = srcAlpha;
		VertexShader = compile vs_1_1 VSMain_Regular();
		PixelShader = compile ps_2_0 PSMain_Regular();
	}
}

technique Font_Test_NOT_Working
{
	pass Single_Pass
	{
		ALPHABLENDENABLE = TRUE;
		ALPHATESTENABLE = TRUE;
		DESTBLEND = invsrcAlpha;
		SRCBLEND = srcAlpha;
		VertexShader = compile vs_1_1 VSMain_Regular();
		PixelShader = compile ps_3_0 PSMain_Regular();
	}
}

Share this post


Link to post
Share on other sites
Advertisement
The standard debugging approach is to run your application through PerfHUD and PIX to see if something is actually being rendering, but possibly transparent or with other invalid renderstates, or maybe being improperly transformed and clipped. Both of these tools are free, and it takes only a tiny code change to get your app to work with PerfHUD.

Share this post


Link to post
Share on other sites
Does the d3d debug runtime have anything for you? Also I seem to remember that you have to have a VS3.0 vertex shader if you're using a PS3.0 pixel shader.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zipster
The standard debugging approach is to run your application through PerfHUD and PIX to see if something is actually being rendering, but possibly transparent or with other invalid renderstates, or maybe being improperly transformed and clipped. Both of these tools are free, and it takes only a tiny code change to get your app to work with PerfHUD.

I just discovered PIX today - I hadn't used it before. I think it's going to come in handy in the future! PIX showed all my vertex data being transformed correctly, but no RGB data was written to the buffers...

Quote:
Original post by jamesw
Does the d3d debug runtime have anything for you? Also I seem to remember that you have to have a VS3.0 vertex shader if you're using a PS3.0 pixel shader.

Thank you!! compiling the VS using 3_0 fixed everything!


Thanks to both of you - and to anyone else having this problem, pair up your PS3 shaders with VS3 shaders!

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!