How does hardware fail? Silently?

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);

 



Answer this question

How does hardware fail? Silently?

  • vitagoni

    It seems that it just falls back to fixed shader without any warning.

    I've not personally tried it, but I'd bet that the debug output will scream and shout at you Smile

    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

    There is a small section of code in the SDK Docs that might help you to work out if the card supports the shaders that you are using.


    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

    Thanks. I did test now and have no sort of pixel shader on my card. Time to go and get a new one it seems.

    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

    Sorry. I forgot to mention that when using a reference device and doing all the shading in software, It works as suposed. Corrent but slow.
  • pomone

    I have turned on debugging in controlpanel/directx
    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

     Thomas Greenleaf wrote:
    Thanks. I did test now and have no sort of pixel shader on my card. Time to go and get a new one it seems.


    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).

  • How does hardware fail? Silently?