Jump to content
  • Advertisement
Sign in to follow this  
Diltsman

DirectX 10 program crashes my video drivers

This topic is 3536 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!