The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL 2D renderer losing Render-to-Textures on Windows when to
Eric Wing
Guest

I'm using the SDL 2D renderer. I've discovered that when I toggle
between fullscreen and windowed mode, I lose all my textures that were
created with render-to-texture. But the regular textures seem to
survive, and render-to-textures that are recreated will correctly
display.

I'm wondering if this is related to the recent thread:
[D3D9]Cannot recreate streaming texture

I'm just using defaults with the SDL 2D renderer. I didn't request
anything. I don't even know what is being used behind the scenes to
render in this case. This is regular Windows, not WinRT.

This only happens on Windows. Mac and Linux don't have any problems
with this. (Though, minor digression: On Mac, there is a few second
delay on launch where the image is not resized to fit the whole
screen...I would love to know the cause of that.) Here are some
prebuilt binaries that can demonstrate the issue.

Hit Alt-Enter or Ctrl-F to toggle fullscreen. (Use Cmd instead of Alt on Mac.)

Windows (Windows 7+ 64-bit)
zip: http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrCWindows.zip
installer: http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrC-1.0.0-win64.exe

Mac
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrCMac.zip

Linux (64-bit, SteamOS runtime compliant)
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrC-0.1.1-Linux.tar.gz


Source code is here. It is a little lengthy and not fully cleaned up,
but you should be able to verify if I'm not doing anything wrong.
https://bitbucket.org/ewing/flappyblurrrc

(If you are curious, I will write a formal tutorial for this in the
coming months. This is part of a new initiative to launch a new
commercial SDK that uses and embraces (instead of hides) SDL as the
foundation.)

Thanks,
Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL 2D renderer losing Render-to-Textures on Windows when to
Jonas Kulla
Guest

2014-11-21 1:32 GMT+01:00 Eric Wing:
Quote:
I'm using the SDL 2D renderer. I've discovered that when I toggle
between fullscreen and windowed mode, I lose all my textures that were
created with render-to-texture. But the regular textures seem to
survive, and render-to-textures that are recreated will correctly
display.

I'm wondering if this is related to the recent thread:
[D3D9]Cannot recreate streaming texture

I'm just using defaults with the SDL 2D renderer. I didn't request
anything. I don't even know what is being used behind the scenes to
render in this case. This is regular Windows, not WinRT.

This only happens on Windows. Mac and Linux don't have any problems
with this. (Though, minor digression: On Mac, there is a few second
delay on launch where the image is not resized to fit the whole
screen...I would love to know the cause of that.) Here are some
prebuilt binaries that can demonstrate the issue.

Hit Alt-Enter or Ctrl-F to toggle fullscreen. (Use Cmd instead of Alt on Mac.)

Windows (Windows 7+ 64-bit)
zip: http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrCWindows.zip
installer: http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrC-1.0.0-win64.exe

Mac
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrCMac.zip

Linux (64-bit, SteamOS runtime compliant)
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrC-0.1.1-Linux.tar.gz


Source code is here. It is a little lengthy and not fully cleaned up,
but you should be able to verify if I'm not doing anything wrong.
https://bitbucket.org/ewing/flappyblurrrc

(If you are curious, I will write a formal tutorial for this in the
coming months. This is part of a new initiative to launch a new
commercial SDK that uses and embraces (instead of hides) SDL as the
foundation.)

Thanks,
Eric


In Direct3D it is possible for the rendering context (or "device") to be "lost". You might be
familiar with this concept from mobile programming, where an EGL context may be lost
as well, at least on older Android versions I think. In D3D this usually results in all allocated
resources being lost (such as textures), but one can place textures whose contents are

static and filled from RAM into a "managed pool", meaning D3D will automatically save

a copy of the contents you upload in RAM, and on a lost device, refill the texture with it.

I believe SDL puts textures that are not render targets in this pool by default. Textures

that can be rendered to however obviously can't have their contents saved inside RAM,

and as such cannot be placed into the managed pool, so their contents are completely
gone when the device is lost. You can read more on this topic here:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb174714%28v=vs.85%29.aspx


Note that desktop GL has no concept of lost contexts, so the easiest solution would be
to always use the GL render backend on Windows (there's a hint for that I believe).


(Disclaimer: I have absolutely no clue about windows or D3D programming, so I might

just have blabbered nonsense. Hopefully someone will correct me).