june sample issues
if (caps.PixelShaderVersion <new Version(1,1))returnfalse; |
the sample runs but all the meshes have lost there textures, how can I fix this?
if (caps.PixelShaderVersion <new Version(1,1))returnfalse; |
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.
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).
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>; ColorOp[0] = SELECTARG1; |
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.
Smacker wrote:
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.