We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3928 - SDL_HideWindow will also suspend rendering
Summary: SDL_HideWindow will also suspend rendering
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: don't know
Hardware: x86_64 Linux
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-29 02:08 UTC by Ellie
Modified: 2018-02-07 18:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ellie 2017-10-29 02:08:57 UTC
SDL_HideWindow will also suspend rendering with SDL_RenderPresent(). I planned to use a hidden window for offscreen rendering (the main window is handled by something else than SDL and has no OpenGL context) but due to this problem I can't. It'd be nice if there was a way to make this work without being forced to have an additional useless window visible.
Comment 1 Ellie 2017-10-29 02:11:18 UTC
I forgot to mention what I'm actually doing: I'm using SDL_RenderReadPixels to extract the pixels after rendering a frame, and with the hidden window I simply get a pitch black texture instead of the actual image. If I change nothing else except commenting the line that hides the window, everything works fine and I can extract the proper image.
Comment 2 Ellie 2017-12-27 12:09:47 UTC
Anyone?

I need off-screen rendering in a couple of places, and this makes it really challenging ot use SDL2 for that purpose.

Any sort of feedback on whether this is unavoidable per design or a fixable bug would already be nice, because if there is no hope this ever gets addressed I'll have to look into other options than SDL2.
Comment 3 Sam Lantinga 2018-01-03 18:01:49 UTC
Ryan, can you take a look at this? Is there something we need to set to allow off-screen rendering?
Comment 4 Ryan C. Gordon 2018-01-04 18:50:00 UTC
Does this work if you use a render target instead of rendering directly to the hidden window?

--ryan.
Comment 5 Ellie 2018-01-04 21:19:50 UTC
I didn't try render targets, because the API doesn't appear to support SDL_TEXTUREACCESS_TARGET and SDL_TEXTUREACCESS_STREAMING at the same time since they are enumerations and not flags. Therefore, I'd either need a way to combine SDL_TEXTUREACCESS_TARGET and SDL_TEXTUREACCESS_STREAMING on one SDL_Texture, or I have no other way than to rely on SDL_RenderReadPixels() to get the end result again, which is what I used in the end. Did I miss something so that I can do this with render targets without using OpenGL code myself?
Comment 6 Ryan C. Gordon 2018-02-02 03:26:31 UTC
So my suspicion is that X11 won't render to an unmapped window; hiding a window unmaps it. You might be able to place the window entirely offscreen (at like, position -10000,-10000) to get around this, but I haven't tried.

That being said: SDL_RenderReadPixels() works from render targets, and you don't need to mark them as streaming. I _think_ these will work even if the window is unmapped.

--ryan.
Comment 7 Ryan C. Gordon 2018-02-07 18:27:50 UTC
Going to close this as WONTFIX for now. If you try any of these things (moving the window way offscreen or a render target) and nothing works, we can brainstorm some more.

--ryan.