[Bf-committers] EGL_CONTEXT_LOST and GL_ARB_create_context_robustness

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Aug 1 04:57:33 CEST 2013


On Thu, Aug 1, 2013 at 3:44 AM, Jason Wilkins <jason.a.wilkins at gmail.com> wrote:
> It is difficult to answer these questions right now since I'm not
> completely familiar with where the original pixel data is kept.
>
> By "acquire the resource", I mean generate an ID and then set it to the
> state that is needed. So for textures it would mean generating a texture
> ID, loading the pixels, and then setting up the texture properties.
>
> And yes, it is a problem if GPUtexture doesn't contain enough information
> to recreate the texture.  I actually ran into this problem with the shader
> export function when porting it to ES.  ES does not allow you to read the
> texture data (it doesn't save a copy).  As a quick fix I save that data in
> the GPUtexture so that it can be copied.  (With the intention that I
> revisit that code later for a better solution).
>
> If we do not want to save pixel data for every GPUtexture then we need a
> callback function that understands how to reload the data from disk or
> regenerate it procedurally.  Then that function could be used to reacquire
> the texture, instead of the brute force method of saving the pixels.
>
> Note that desktop OpenGL already has to keep this data around, so it isn't
> like saving this data on ES is using "extra" memory.  It is memory that is
> already wasted on the desktop.
>
> If we get this working on ES however, we could use the desktop version of
> this extension and stop wasting that memory if we use "smart" functions
> that reacquire textures by loading them from disk or recompute them.

Ok, well I think we should try to avoid have the extra copy in CPU
memory then, it's not so hard to do this. Recreating the data doesn't
need any callback that can do it, we can just keep it simple: on
context loss free all data and set everything to 0/NULL in the owner.
Just make a stupid function that loops over all owners of OpenGL data
like GPU_free_images. Then the owner can always check if it needs some
resource and create it if needed, which is already what it does in
most cases anyway.

Brecht.


More information about the Bf-committers mailing list