Sign in to follow this  

DirectX 10 program crashes my video drivers

This topic is 3316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When my program only cleared the screen it worked perfectly. Now that I am trying to draw a single point to the screen I get an error message saying:
Quote:
Display driver stopped responding and has recovered Display driver nvlddmkm stopped responding and has successfully recovered.
I have gone over my shaders and vertex layouts and they are EXACTLY the same as an earlier program I wrote that does work. My code for initializing things is shown below.
[source lang=cpp]
    ID3D10Blob * shader = NULL;
    HRESULT hr = NULL;
    if(FAILED(hr = D3D10CompileShader(Point::sm_vertexShader.c_str(), Point::sm_vertexShader.size(), NULL,
        NULL, NULL, "VS", "vs_4_0", 0x0, &shader, NULL)))
    {
        std::stringstream temp;
        temp << "D3D10CompileShader failed with HRESULT=" << std::hex << hr;
        throw std::runtime_error(temp.str());
    }
    if(FAILED(hr = device->CreateInputLayout(Point::sm_vertexLayout,
        sizeof(Point::sm_vertexLayout)/sizeof(Point::sm_vertexLayout[0]),
        shader->GetBufferPointer(), shader->GetBufferSize(), &Point::sm_inputLayout)))
    {
        shader->Release();
        std::stringstream temp;
        temp << "CreateInputLayout failed with HRESULT=" << std::hex << hr;
        throw std::runtime_error(temp.str());
    }
    if(FAILED(hr = device->CreateVertexShader(shader->GetBufferPointer(), shader->GetBufferSize(), &Point::sm_compiledVertexShader)))
    {
        shader->Release();
        std::stringstream temp;
        temp << "CreateVertexShader failed with HRESULT=" << std::hex << hr;
        throw std::runtime_error(temp.str());
    }
    shader->Release();

    if(FAILED(hr = D3D10CompileShader(Point::sm_pixelShader.c_str(), Point::sm_pixelShader.size(), NULL,
        NULL, NULL, "PS", "ps_4_0", 0x0, &shader, NULL)))
    {
        std::stringstream temp;
        temp << "D3D10CompileShader failed with HRESULT=" << std::hex << hr;
        throw std::runtime_error(temp.str());
    }
    if(FAILED(hr = device->CreatePixelShader(shader->GetBufferPointer(), shader->GetBufferSize(), &Point::sm_compiledPixelShader)))
    {
        shader->Release();
        std::stringstream temp;
        temp << "CreatePixelShader failed with HRESULT=" << std::hex << hr;
        throw std::runtime_error(temp.str());
    }
    shader->Release();

I'm certain that my problem is something really stupid, but I don't know enough to figure out what I am doing wrong. I would appreciate any suggestions as to how to fix this or improve my code.

Share this post


Link to post
Share on other sites
Have you tried creating your device with the debug flag? It will enable the debug layer and will produce output in your debugger if you're using the API wrongly. Also, make sure you're using WHQL drivers, beta drivers may have stability issues.

Share this post


Link to post
Share on other sites
Ugh. That helped me figure out the problem. I have now added code so that it will compile with debug mode on when I try to compile a project in debug (in VS2005) in the future. Hopefully I will avoid looking like an idiot like this again.

Share this post


Link to post
Share on other sites

This topic is 3316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this