Question

I have a very annoying problem at the following lines of code:

try{
  mSwapChain.Present(0, PresentFlags.None);    //AccessViolationException, caught by debugger
}catch(Exception Ex){
  throw Ex;  //Debugstop here, but not reached
}

//DeviceContext: SharpDX.Direct3D11.DeviceContext
//mVertexBinding: SharpDX.Direct3D11.VertexBufferBinding

DeviceContext.InputAssembler.SetVertexBuffers(0, mVertexBinding);
DeviceContext.Draw(mNumVertices, 0);

My program runs a timer which raises an event, if it is raised and i'm not rendering at this time, the program forces a rendercall. There runs another timer + mouse events at the same time, updating matrices, vertices, buffers and stuff - but while rendering, all those update functions are locked - but only until DeviceContext.Draw(mNumVertices, 0); is reached, after this, the syncing object gets unlocked.

My question now - can the access violation be raised if VertexBufferBinding is changed between Draw(..) and SwapChain.Present(..) ? Or is it copied ? And, secound one - why can't i catch this access violation? It's always an "Unhandled exception".

Edit: Strange thing is, that the access violation only appears on my Work Notebook (Core i5, Intel HD 3000 & Radeon 6490M) but not on my Home Laptop (Core i7, Intel HD 3000 & NVidia GeForce 540M).

Was it helpful?

Solution

After much testing, it points out that this problem must be caused by the amd dynamic switchable graphics option - with integrated or maximum graphics forced, the exception does not appear, so maybe it is when the amd driver changes the gpu setting for the application - like docs says, "gpu will be dynamically switched if more power is required". So it wasn't because i updated some matrices or vertices, it was because of the more power my program needs when this operations are done (it is a little cad/modelling program with hierarchical geometry - when A1 is updated, AX to AZ have to be recalculated too).

And, maybe, it happens not on an NVidia System, because the gpu is not dynamically switched - it is set at application startup time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top