RenderTargetCube and switch fullscreen

Hi !
I’ve started to implement shadows for omnilights.
To see what happens i draw all the 6 faces into rectangles onscreen. All is ok with the dev 1189.

One problem arose with the latest dev build 1191. After the update yesterday, when i switched from windowed to fullscreen, it throwed an AccessViolationException in SharpDx on the GetData Method:
(rtc is the RenderTargetCube, initialized, not null etc.)
(cface is a Texture2D, initialized, not null etc.)

cface.SetData<byte>(data); //Fille the texture with the face of the cube```

I save you the next 5 faces as it crashes on one randomly, but always on the GetData. When I switch to fullscreen or revert to windowed, on the first or second or fifth time.

If I switch back to dev 1189 it does not crash. Has anyone an idea ?
Do I get the face's content the wrong way for the fullscreen mode ?

<img src='/uploads/default/original/2X/5/57cac680a5016c94da9df38142b77ac11fd374c0.jpg'>

It seems to be ok with 1197 which i got from teamcity in artifacts. But with 1191 it always ends up crashing.

Well with the latest dev version (1202) the problem comes back.

To go fullscreen I do:

this.Window.IsBorderless = true;
this._GFX_GraphicsDevMgr.ToggleFullScreen();
this._GFX_GraphicsDevMgr.ApplyChanges();

As I want a true fullscreen.

I’ve not touched HardwareModeSwitch os it has its default value.

Did I do something wrong to switch fullscreen ?
It happens on a nvidia620 card, and a 670M as well as a nvidia 980Ti

If I remove
this.Window.IsBorderless = true;
then no problem happens, or at least less often (at the 3rd switch instead of the first one).
It may have happened with previous versions of MG from the 1189, but it is the first I implemented fullscreen with.

EDIT: What GetRenderTargetView(int arrayslice) is for ? It returns a RenderTargetView which is a “lower level”: member of SharpDX.

How can I draw Cube’s faces without GetData ? No moe .GetTexture(); in monogame whereas there was one in XNA…

EDIT2: My bad… I was using data
byte[] data = new byte[cface.Width * cface.Height * 32]; //8 bytes per ColorWriteChannels, 4 channel
but as my RenderTargetCube is Vector2 format, it should have been 16 instead of 32:
byte[] data = new byte[cface.Width * cface.Height * 16]

But the problem is still there…

You shouldn’t need to set IsBorderless to true and ToggleFullScreen calls ApplyChanges, so the only thing you need to do is call ToggleFullScreen. Still, these issues should be addressed, GetData should just work. My guess is that the GraphicsDevice is lost. MonoGame doesn’t handle that as nicely as XNA at this point. I think we need to check if the device is lost in the game loop somewhere and try to recreate a GraphicsDevice if necessary…
What kind of errors do you get?

There is no GetTexture anymore in RenderTarget2D or RenderTargetCube in XNA 4.0. RenderTarget2D inherits from Texture2D and RenderTargetCube is a TextureCube, so you don’t have to do anything to get the texture since it is the texture. Shawn explains this in a blog post Shawn Hargreaves Blog Index

I get a AccessViolationException in SharpDx.
I can’t know it the device is lost as i don’t have a dual screen configuration or I’ll have to wait tomorrow at work.

There is no GetTexture anymore in RenderTarget2D or RenderTargetCube in XNA 4.0. RenderTarget2D inherits from Texture2D and RenderTargetCube is a TextureCube, so you don’t have to do anything to get the texture since it is the texture. Shawn explains this in a blog post Shawn Hargreaves Blog Index

Is it equivalent to calling a spritebatch’s draw on a rendertargetcube will draw all 6 faces ? As it is what I need, this would do the trick.

Maybe linked to this ?