Jump to content

  • Log In with Google      Sign In   
  • Create Account


migrating from dx10 to 11 gives me an undebug-able error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 ucfchuck   Members   -  Reputation: 139

Like
0Likes
Like

Posted 13 December 2012 - 12:10 PM

I moved my code from using directx10 to 11 so i could use a compute shader to process the data on the gpu multiple times before rendering it. So i made the move and got all the explicit errors/exceptions out.

Now I am running into a "vshost32.exe has stopped working" and it gives me the option to debug but it then tells me " a debugger is attached to myprogram.vshost.exe but not configured to debug this unhandled exception. to debug this exception, detach the current debugger."

so i went digging, i set vs to break on all exceptions thrown, and turned on unmanaged debugging. when it hits the exception there is no available source code for me to see where any of this is happening it only gives me some point buried in the assembly, but it always seems to happen in an nvwgf2um.dll in the call stack.

> nvwgf2um.dll!09bbd565()
[Frames below may be incorrect and/or missing, no symbols loaded for nvwgf2um.dll]
nvwgf2um.dll!09b945fd()
nvwgf2um.dll!09d30f8b()
nvwgf2um.dll!09d12419()
nvwgf2um.dll!09cd82ac()
nvwgf2um.dll!09b68296()
nvwgf2um.dll!09b65b51()
nvwgf2um.dll!09c212f8()
nvwgf2um.dll!0a1de315()
nvwgf2um.dll!0a1de39f()
kernel32.dll!763a3677()
ntdll.dll!776c9f42()
ntdll.dll!776c9f15()

so i dug a little deeper and this seems to happen in bf3 quite a bit where people say that a newish release of the nvidia drivers are the culprit ad to just roll back the drivers. so i did and it did not help, so i installed the latest and again still having the same issue. so i went to laptopvideo2go and installed a modded one, still nvwgf2um.dll crashes.

anyone have any ideas? am i stuck waiting for an update from nvidia, or is it possibly something in my code i did wrong?

Sponsor:

#2 MJP   Moderators   -  Reputation: 10205

Like
2Likes
Like

Posted 13 December 2012 - 01:30 PM

Sometimes your code or your shader code can cause a crash in the driver. It's not particularly easy to track down...I would suggest that you start disabling things until it stops crashing so that you can narrow it down.

#3 ucfchuck   Members   -  Reputation: 139

Like
0Likes
Like

Posted 13 December 2012 - 03:53 PM

ok so im not sure i have really narrowed it down to this point as the try catch block does not catch the exception, but when i do not allow the texture to be written to, then it stops crashing. the map function is as follows,


try

{

// if everything is in order then send data to graphics memory.

if (pTexture != null)

{

DataBox mappedTex = null;

//assign and lock the resource

mappedTex = g_pd3dDevice.ImmediateContext.MapSubresource(pTexture, 0, pTexture.Description.Height * pTexture.Description.Width*4, D3D11.MapMode.WriteDiscard, D3D11.MapFlags.None);

// if unable to hold texture

if (!mappedTex.Data.CanWrite)

{ throw new InvalidOperationException("Cannot Write to the Texture"); }

// write new data to the texture

mappedTex.Data.WriteRange<byte>(NewData);

// unlock the resource

g_pd3dDevice.ImmediateContext.UnmapSubresource(pTexture, 0);

}

}

catch (Exception P)

{

MessageBox.Show("texheight = " + pTexture.Description.Height + " \n" + "texwidth = " + pTexture.Description.Width + "\n" + "data size = " + NewData.Length);

throw;

}




could this be some kind of threading issue with the ImmediateContext ? there was some issue with having to move from a datarectangle to a databox as well.


Edited by Michael Tanczos, 28 December 2012 - 12:30 AM.


#4 MJP   Moderators   -  Reputation: 10205

Like
0Likes
Like

Posted 13 December 2012 - 04:56 PM

I'm guessing this is a dynamic texture that you're mapping? Did you enable debug output when you created the device?

#5 ucfchuck   Members   -  Reputation: 139

Like
0Likes
Like

Posted 13 December 2012 - 06:56 PM

yes the texture was created with dynamic usage.


no i did not have the debug enabled, but now that i do, i am getting sehexceptions at random places, from the clear render target view, map, write, and unmap,

not in any specific order or consistent place, just literally at random from one of those places. though it is hitting a different exception much faster than it was before. with the debug on i get through about 50-100 frames before it throws the seh exceptions and crashes. weird that it would crash on new exceptions that didnt show up before?

Edited by ucfchuck, 13 December 2012 - 06:57 PM.


#6 MJP   Moderators   -  Reputation: 10205

Like
0Likes
Like

Posted 13 December 2012 - 08:29 PM

Do you get any messages in the native debug output stream? Normally the debug device will put errors and warnings there when you do something wrong.

#7 ucfchuck   Members   -  Reputation: 139

Like
0Likes
Like

Posted 14 December 2012 - 04:00 PM

D3D11: ERROR: ID3D11DeviceContext::DrawIndexed: Draw cannot be invoked while a bound Resource is currently mapped. The Resource bound at Pixel Shader Resource slot (0) is still mapped. [ EXECUTION ERROR #364: DEVICE_DRAW_BOUND_RESOURCE_MAPPED ]

D3D11: ERROR: ID3D11DeviceContext::Draw: Draw cannot be invoked while a bound Resource is currently mapped. The Resource bound at Pixel Shader Resource slot (0) is still mapped. [ EXECUTION ERROR #364: DEVICE_DRAW_BOUND_RESOURCE_MAPPED ]

D3D11: ERROR: ID3D11DeviceContext::DrawIndexed: Draw cannot be invoked while a bound Resource is currently mapped. The Resource bound at Pixel Shader Resource slot (0) is still mapped. [ EXECUTION ERROR #364: DEVICE_DRAW_BOUND_RESOURCE_MAPPED ]

D3D11: CORRUPTION: ID3D11DeviceContext::Unmap: Two threads were found to be executing functions associated with the same Device at the same time. This will cause corruption of memory. Appropriate thread synchronization needs to occur external to the Direct3D API. 2420 and 2432 are the implicated thread ids. [ MISCELLANEOUS CORRUPTION #28: CORRUPTED_MULTITHREADING ]

First-chance exception at 0x75a4c41f in WPControlPanel.exe: 0x0000087D: 0x87d.

D3D11: ERROR: ID3D11DeviceContext::Draw: Draw cannot be invoked while a bound Resource is currently mapped. The Resource bound at Pixel Shader Resource slot (0) is still mapped. [ EXECUTION ERROR #364: DEVICE_DRAW_BOUND_RESOURCE_MAPPED ]


so it is a threading issue. i have a draw function spinning on the main thread and a separate consumer thread trying to pull frames from a usb device as fast as possible which then loads it into the texture. this never was an issue with dx10, it seemed to just wait for one to let go of the resource, seems dx11 does not deal with multiple threads pulling a resource from the device context at the same time. hopefully this is the cause of both exceptions, i think i can just double buffer it into a separate texture and then copyresource on the draw call with a lock to minimize stall time.

Edited by ucfchuck, 14 December 2012 - 04:03 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS