Sign in to follow this  

Driver Stops Working On Calling Present After Shader Switch

This topic is 837 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

Greetings,

 

Ok, I am trying to turn ON and OFF tessellation at runtime by setting hull and domain shader to turn it ON and setting both of them to NULL to turn it OFF.

My code runs perfectly if I start my program with hull and domain shader set and also when I start my program with both of them set to NULL. Meaning without switching them in runtime they correctly.

This shader switching works without problem for, when I switch vertex shader, pixel shader, geometry shader at runtime.

But when I switch hull shader and domain shader in runtime and call swapchain->Present() function BOOOOM my windows says "Display Driver Stopped Working And Recovered" and the swapchain->Present() function returns this error code "0x887a0005" with message "The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action." So I did call device->GetDeviceRemovedReason () and it gives me this code "0x887a0006" and this message "The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application." and now I have no Idea what to do. Please help me

 

Thanks a million in advance

Share this post


Link to post
Share on other sites
Present isn't necessarily involved in your problem. Present is just the 'checkpoint' where D3D will check on the GPU and make sure it's still executing commands.

Either:
* one of your draw-calls has somehow crashed the driver. If so, you should try to make a minimal project that can reproduce this bug and send it to your GPU vendor so that they can fix their driver.
Or
* one of your draw calls is so slow that your framerate has dropped to 0.5fps, which causes Windows to *assume* that the driver has crashed, so it reboots the GPU on you :(

Either way, you might have to post some more code.

Share this post


Link to post
Share on other sites

Yes I do understand that nothing is wrong with Present(). I was just hoping if someone knows where the problem might be. I am happy to the post the code but I don't know which part. My project is down to minimum. Everything works like it should until I call Present()

Share this post


Link to post
Share on other sites

What GPU are you using? Do you have the latest drivers? What OS?

 

If you avoid calling present for 1000 frames (hack below), do you get the same error or a different one?

e.g. instead of   ...Present(...);, use something like

static int hack_counter = 0;
if( ++hack_counter > 1000 )
{
  hack_counter = 0;
  ...Present(...);
}

^^I'm hoping that this hack will intentionally cause the driver to crash from a timeout (Windows TDR) -- and maybe it will have a different error message. If so, you know that your problem isn't a TDR and is a different kind of driver bug.

 

If you're willing to share your code with nVidia/AMD/whoever your GPU maker is, then you can send them the smallest program that you can make which exhibits this bug. They'll have a forum for reports like that.

Edited by Hodgman

Share this post


Link to post
Share on other sites

I am using AMD HD 6850, latest driver, Windows 10 x64 fully updated

I had this same problem a few months ago in Windows 8.1 x64 different but latest of that time. But due to deadline I had to I to go for a complete application reset(Reinitialize all devices) a static shaders switching method to toggle hull and domain shaders ON and OFF.

Now since I have time, I have decided to do it the right way. Dynamic shader switching is more cooler so I want to do this way.

 

I tried your frame skipping Hack even when counter of 10000 and 50000 where the screen is truck for like 10 seconds. Unfortunately or fortunately since I don't know if this is good or bad It doesn't trigger intentional driver crash. I don't know much about how windows/AMD drivers handles graphics commands, but I think what you are trying to do will happen only if you give GPU a command and the GPU times out. I don't think the other way round of application timing out should trigger a crash.

 

I am open to share codes with anyone. But I honestly don't know how to approach AMD for it. I mean what forums should I look for. Do you know of any where AMD guys will help me?

Share this post


Link to post
Share on other sites

I really don't think so. I took a graphics debugger snap shot and all objects and state seems as they should be. I don't know for sure but I don't think a unset constant buffer or a resource full of garbage could ever crash a driver. I'll triple check anyways if you say so. Still anyways my engine doesn't touch anything except those two shader states while switching states. I have assigned switch on a keyboard button press which only does is change shader states and nothing else as shown below:

if (keyboard->Get(DIK_F1))
{
      context->HSSetShader(hullshader, 0, 0);
      context->DSSetShader(domainshader, 0, 0);
}
if (keyboard->Get(DIK_F2))
{
      context->HSSetShader(0, 0, 0);
      context->DSSetShader(0, 0, 0);
}

Share this post


Link to post
Share on other sites

Ok, Sorry guys I am an idiot. Problem solved. I was so stupid I was forgetting to switch IASetPrimitiveTopology from triangle list to patch list. This is the 20th time I am checking my code and after that found that sneaky little line the root of my problem.

Thank you everyone for helping me this far couldn't have done it without you. I was almost going to blame AMD for my fault and stupidity.

Next time I will not show laziness in posting codes. My engine has very high encapsulation so I was avoiding to unwrap all and post it here. I will not do that again.

 

Thanks again.

Share this post


Link to post
Share on other sites

This topic is 837 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