it seems that when I run some of the samples a few of the device checks fail, and the program wants to switch over to a software device, if I remove this line of code
if (caps.PixelShaderVersion < new Version(1,1)) return false;
the sample runs but all the meshes have lost there textures, how can I fix this
If your graphics card doesn't support pixel shaders in hardware then you'll experience exactly the issues you describe.
You can determine the level of pixel shader support with the DirectX Caps Viewer (in the DirectX Utilities group of the SDK). Under "Graphics Adapters" open the item for your graphics card, then open the D3D Device Types -> HAL -> Caps item.
In the list of capabilities on the right hand side, look for PixelShaderVersion, if the value of that cap is less than 1.0, then your graphics card does not support pixel shaders (or there is a problem with its installation).
nVidia GeForce 3 and ATI Radeon 8000 were the first cards to support pixel shaders, older cards don't support pixel shaders.
Beware that the GeForce 4 MX (and GO variant) does *not* support pixel shaders, the rest of the GeForce 4 range do however support them.
is there a programical way to fix this, in the sence of not all directX apps need pixalshaders, is there a way to change the code abit to allow these to still work
I guess my problem with this is that when ever you make changes like this you lose a base of players with game creating, not everyone is willing to update there graphics card with every addition of new technology.
Just a quick comment... it's for pretty much the exact reason you stated above that a lot of PC games/engines tend to have multiple rendering paths.
At least in my experience, it is one of the bigger challenges of engine writing - getting code that functions correctly across a wide spectrum of hardware is not easy
Yes, FX files are used with the D3DX Effects system.
An FX file can contain vertex and pixel shaders, but it can also contain fixed function pipeline code. If the sample uses effects, then to make it work on a card that doesn't support pixel shaders, it'll be easiest to add a new technique to the effect which achieves the same (or a similar) effect with SetTextureStageState.
Taking the CustomUI sample as an example, the pixel shader in its .fx file is very trivial, it simply samples a texture using the specified sampler parameters. The following is what the technique looks like using the fixed function pipeline:
To make the C# version of the CustomUI sample work with fixed function hardware, do the following:
1) copy the above technique to the end of the .fx file
2) change the effect.Technique = "RenderScene"; part of the OnFrameRender() method to effect.Technique = "RenderSceneNoPixelShader";
3) remove the check for the pixel shader version.
Less trivial pixel shaders will require much more work to re-code with the fixed function pipeline. Personally I'd bite the bullet and get a shader capable card, shaders are easier than the fixed function pipeline and also the way hardware and APIs like Direct3D are headed so you'll come up against similar problems more and more in the future.
now I havent checked the other samples but it seems where it is calling for the pixel shader is in the FX. file could this be where the pixel shader is called in
For the samples that definately don't use pixel shaders, removing that check should be enough. If the sample still doesn't work without the check, it's likely an indication that your graphics card doesn't support some other hardware feature required by the sample.
A pixel shader capable card usually has a better minimum feature set than a non pixel shader capable one - so the check in the sample may actually be to detect at least "DirectX 8" level hardware rather than pixel shader support.
For samples which do currently use pixel shaders, you'd have to rewrite the part of the sample that uses the pixel shader to use the old fixed function SetTextureStageState() calls to achieve the same result - for a simple single texture pixel shader, it would be pretty easy, but for a more complex shader, SetTextureStageState() often isn't expressive enough to easily achieve the same result (which is why it was superseded by pixel shaders in DirectX 8).
I guess my problem with this is that when ever you make changes like this you lose a base of players with game creating, not everyone is willing to update there graphics card with every addition of new technology. Thanks for the help and the explination was great. A++++++ reply
june sample issues
Cyberpro60
If your graphics card doesn't support pixel shaders in hardware then you'll experience exactly the issues you describe.
You can determine the level of pixel shader support with the DirectX Caps Viewer (in the DirectX Utilities group of the SDK). Under "Graphics Adapters" open the item for your graphics card, then open the D3D Device Types -> HAL -> Caps item.
In the list of capabilities on the right hand side, look for PixelShaderVersion, if the value of that cap is less than 1.0, then your graphics card does not support pixel shaders (or there is a problem with its installation).
nVidia GeForce 3 and ATI Radeon 8000 were the first cards to support pixel shaders, older cards don't support pixel shaders.
Beware that the GeForce 4 MX (and GO variant) does *not* support pixel shaders, the rest of the GeForce 4 range do however support them.
andykennaugh1062
kob_kob
Just a quick comment... it's for pretty much the exact reason you stated above that a lot of PC games/engines tend to have multiple rendering paths.
At least in my experience, it is one of the bigger challenges of engine writing - getting code that functions correctly across a wide spectrum of hardware is not easy
hth
Jack
CoderB0y
An FX file can contain vertex and pixel shaders, but it can also contain fixed function pipeline code. If the sample uses effects, then to make it work on a card that doesn't support pixel shaders, it'll be easiest to add a new technique to the effect which achieves the same (or a similar) effect with SetTextureStageState.
Taking the CustomUI sample as an example, the pixel shader in its .fx file is very trivial, it simply samples a texture using the specified sampler parameters. The following is what the technique looks like using the fixed function pipeline:
technique RenderSceneNoPixelShader
{
pass P0
{
VertexShader = compile vs_1_1 VertScene();
PixelShader = NULL;
Texture[0] = <sceneTexture>;
MinFilter[0] = LINEAR;
MagFilter[0] = LINEAR;
MipFilter[0] = POINT;
ColorOp[0] = SELECTARG1;
ColorArg1[0] = TEXTURE;
AlphaOp[0] = SELECTARG1;
AlphaArg1[0] = TEXTURE;
ColorOp[1] = DISABLE;
AlphaOp[1] = DISABLE;
}
}
To make the C# version of the CustomUI sample work with fixed function hardware, do the following:
1) copy the above technique to the end of the .fx file
2) change the effect.Technique = "RenderScene"; part of the OnFrameRender() method to effect.Technique = "RenderSceneNoPixelShader";
3) remove the check for the pixel shader version.
Less trivial pixel shaders will require much more work to re-code with the fixed function pipeline. Personally I'd bite the bullet and get a shader capable card, shaders are easier than the fixed function pipeline and also the way hardware and APIs like Direct3D are headed so you'll come up against similar problems more and more in the future.
sjm8
C&#35;TURK
A pixel shader capable card usually has a better minimum feature set than a non pixel shader capable one - so the check in the sample may actually be to detect at least "DirectX 8" level hardware rather than pixel shader support.
For samples which do currently use pixel shaders, you'd have to rewrite the part of the sample that uses the pixel shader to use the old fixed function SetTextureStageState() calls to achieve the same result - for a simple single texture pixel shader, it would be pretty easy, but for a more complex shader, SetTextureStageState() often isn't expressive enough to easily achieve the same result (which is why it was superseded by pixel shaders in DirectX 8).
jn4u
A++++++
reply