[Resolved]On which cards is ps_2_a supported and how do I detect it using the caps

Started by
13 comments, last by CadeF 18 years, 1 month ago
Hey everyone, I have 2 questions. 1 - On which non-SM3 cards is ps_2_a supported? (Cards which do not support ps_3_0 but support ps_2_a) 2 - Using the device caps like so, Dim DevCaps As Direct3D.Caps = Direct3D.Manager.GetDeviceCaps(DeviceIndex, DeviceType.Hardware) Dim TempCaps As udt_AgrDX_DeviceCaps TempCaps.intPixelShaderVersionMajor = DevCaps.PixelShaderVersion.Major TempCaps.intPixelShaderVersionMinor = DevCaps.PixelShaderVersion.Minor TempCaps.intVertexShaderVersionMajor = DevCaps.VertexShaderVersion.Major TempCaps.intVertexShaderVersionMinor = DevCaps.VertexShaderVersion.Build What would the PixelShaderVersion.Minor be? Or would the difference between 2.0 and 2.a be in .MinorRevision? Thanks :) [Edited by - CadeF on March 15, 2006 5:27:32 AM]
Advertisement
I've not got any 2a or 2b hardware to test it against, but I don't think the core runtime will actually report it as anything other than 2.0 - it's the caps bits that reveal the real information.

You probably want to look at the ps_2_x page in the SDK documentation.

In particular, check out the D3DPSHADERCAPS2_0::Caps - only 2a has predication, and the docs state that if that field is non-zero then predication is supported.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Which cards support 2.0b?
Would it be possible, to use a hlsl shader and compile, a simple color out shader from ps_1_0 to ps_3_0 and see at which shader does it kick me out? If this works, I guess that this is the most accurate method, if it's possible.

Thanks
PS 2.A is supported from all GeForce FX cards (all used NV3X GPUs)
PS 2.B is supported from all Radeon X700,X800,X850. (based on R(V)4XX GPUs)

You can use D3DXGetPixelShaderProfile to find the highest Shade profile that your card supports. Be careful because 2.B includes 2.0 and 1.X but not 2.A.

If you want to check the profile without the help of D3DX you need to check the PS20Caps.

For 2.A it have to report as minimum
- At least 22 temp registers
- Arbitrary source swizzle.
- Gradient instructions: dsx, dsy.
- Predication.
- No dependent texture read limit.
- No limit for the number of texture instructions.

2.B needs:
- 32 temp registers
- No limit for the number of texture instructions

In both case NumInstructionSlots need to be 512.

As both profiles are 2.X profiles the reported shader version is still 2.0.
Here is one way to check shader support at runtime:

	D3DCAPS9 d3dcaps;	m_d3d-&gt;GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps);	if(d3dcaps.VertexShaderVersion &lt; D3DVS_VERSION(2, 0))		MessageBox(m_hWnd, "no vs 2 0 support.", "", MB_OK);	else		MessageBox(m_hWnd, "vs 2.0 supported.", "", MB_OK);	if(d3dcaps.PixelShaderVersion &lt; D3DPS_VERSION(2, 0))		MessageBox(m_hWnd, "no ps 2 0 support.", "", MB_OK);	else		MessageBox(m_hWnd, "ps 2 0 supported.", "", MB_OK);
Okay, now I've got a very stupid problem.

float4 ps( float4 diffuse : COLOR0 ) : COLOR0
{
return diffuse;
}
technique testshader
{
pass p0
{
pixelshader = compile ps_3_0 ps();
}
}

Lets say I'm using this to test for ps_3_0 support, rendering it to a 1x1 render target, to test if ps 3.0 is supported. Now, the thing is I need to test it with a ps version my card cannot support, but I have a sm 3 card.

So, what error can I expect if I had a sm 2 card?
Quote:Original post by CadeF
So, what error can I expect if I had a sm 2 card?
I would imagine that either Set**Shader() will return D3DERR_INVALIDCALL or the corresponding Draw**() call will fail.

Although, you can check for all but 2 of the shader models via the D3DCAPS9 in the way that Thergothon posted. It's only the differentiation between 2a and 2b - and that (as I posted) should be found from a non-zero caps bit.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

I think I'll stay with the easy, simple foolproof method of testing if each PS version can render ;)

Can someone with a SM2 card please test this for me?
Link
Just run, then exit it (if you click start, nothing will happen since I cut out all un-needed files) and paste the log here. Required MDX DLL versions are 1.0.2902 and 1.0.2907

Example log -

Shader tests
Shaders - True
PS3 - True
PS2_b - True
PS2_a - True
PS2 - True
PS1_4 - True
PS1 - True
Device - NVIDIA GeForce 7800 GTX
DirectX driver - nv4_disp.dll 6.14.10.8198
Shader Model - SM_3

Thanks :)
15.03.2006 12:03:23 ------------------------------
15.03.2006 12:03:23 Started
15.03.2006 12:03:27 Shader tests
15.03.2006 12:03:27 Shaders - True
15.03.2006 12:03:27 PS3 - True
15.03.2006 12:03:27 PS2_b - True
15.03.2006 12:03:27 PS2_a - True
15.03.2006 12:03:27 PS2 - True
15.03.2006 12:03:27 PS1_4 - True
15.03.2006 12:03:27 PS1 - True
15.03.2006 12:03:29 Device - NVIDIA GeForce FX 5200
15.03.2006 12:03:29 DirectX driver - nv4_disp.dll 6.14.10.8040
15.03.2006 12:03:29 Shader Model - SM_Unknown
15.03.2006 12:03:29 Scripting.Lua.Init

Looks like it need some more work. ;)
I'm sure the shader is compiled to ps_3_0 when dissassembled, it is ps.3.0

The code I use to test is
Private Function TestSM(ByVal testFX As Microsoft.DirectX.Direct3D.Effect, ByVal SMTest As String) As Boolean

Try
testFX.Technique = SMTest
testFX.Begin(Microsoft.DirectX.Direct3D.FX.None)
testFX.BeginPass(0)
DXRender2DBox(0, 0, 32, 32, Color.White.ToArgb, 0)
testFX.EndPass()
testFX.End()
Return True
Catch
End Try

Try
testFX.EndPass()
testFX.End()
Catch
End Try

Return False
End Function

Which returns either true or false, in the log file, after the test name. I don't know how your FX 5200 can run all the tests. Oddly, it returns no PS and VS in the log file (WriteLog("Shader Model - " & DXGetShaderModel(PS, VS & " (PS " & PS & ", VS " & VS & ")").ToString)). Can you please also post the PS and VS showed on the dialog box?

This topic is closed to new replies.

Advertisement