Question about GSK, GPU resources loss
Hi, I'm in the process of collecting all informations for a Direct3D GSK renderer.
There's one thing actually which I'm unsure about: resource loss. See https://docs.microsoft.com/en-us/windows/uwp/gaming/handling-device-lost-scenarios
Direct3D has the concept of GPU resources loss (also called "context loss"). That is, at any time the GPU memory could be reset. This can happen either:
- When the user changes (downgrades or updates) the graphics driver.
- If the graphics driver detects an error, it can issue a reset. Then the GPU is reset to a clean state and the driver is restarted
Typically you see a blank screen just for 1 second and everything continues normally.
Lost textures are rendered all-black. Of course, that's not a problem for transient textures (any texture that is re-created at each frame).
Now, resource loss is not a prerogative of Direct3D. Android has a similar concept. A foreground app is able to allocate all the GL textures it wants. Then, when the user switches to another app, Android can destroy your textures to make room for more GPU memory for the new foreground app. It is then your responsibility to re-create all lost textures when you gain the foreground state.
Regarding MESA on Linux, this normally does not happen. Because MESA has no support for graphics driver error recovery. Anyway, probably it could happen with USB DisplayLink GPUs? What happens if I run an application on behalf of a discrete USB GPU and then I unplug the GPU?
It would be ideal for GdkTexture to not have a data-providing method, but a data-providing signal. For example "snapshot". Then the application connects to that signal a data-providing callback function, which can be called at any time.