A basic test pixel shader outputs solid red, but when rendering in hardware the color of the model is solid white.
I use ps_1_1 for this and have no errors except the wrong color. I thought the compiler would complain if it could not implament the shader on the currently selected graphics card, and not simply skip the shader step. If this wrong
The only error is that the pixelshader is aparently not run. instead every pixel defaults to white. The models I render are as they should be. just wrong color.
Perhaps my problem sounds familiar In advance thanks for any help I can get.
My card is an ancient Geforce 2 mx 400
I create my device like this
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect=SwapEffect.Discard;
presentParams.EnableAutoDepthStencil = true;
presentParams.AutoDepthStencilFormat = DepthFormat.D16;
Device newDevice = new Device(0, DeviceType.Hardware, pictureBox1.Handle ,
CreateFlags.SoftwareVertexProcessing , presentParams);
And I create my effect like this
string compilerErrors;
Effect effect = Effect.FromFile(device, fileName, null, null,null, ShaderFlags.None, null, out compilerErrors);

How does hardware fail? Silently?
vitagoni
I've not personally tried it, but I'd bet that the debug output will scream and shout at you
Try enabling the debug runtimes and ramping up the output (See the NeXe article here) and seeing what it complains about. It's always a good idea to do this even if you think things are working fine - at least you can be sure that you're correct...
hth
Jack
Richard Meyers
public bool CheckShaderSupport()
{
Version v1_1 = new Version(1,1); // check version is at least shader 1.1
// retrieve the device caps
Caps caps = Manager.GetDeviceCaps(0, DeviceType.Hardware);
// check the supported shader version
if ((caps.VertexShaderVersion >= v1_1) && (caps.PixelShaderVersion >= v1_1))
{
return true;
}
return false;
}
Millercentral
I was just under the impresion that I would get a failure when compiling my effect if the hardware device didnt suport pixel shaders. It seems that it just falls back to fixed shader without any warning.
buzzsaw
pomone
but my errors are all of the form
An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidCallException' occurred in microsoft.directx.direct3d.dll
Additional information: Error in the application.
I have only one microsoft.directx etc. classlibrary to reference.
Did i neglect to install something during the sdk installation
Bob Hicks
You can also try using vs_3_sw/ps_3_sw, the pixel shader performance will be a lot slower (vertex shader isn't too bad sinces its per vertex) but you still get some hardware features instead of having everything run in software (ref).