Problem: When import gpu;offscreen=gpu.types.GPUOffScreen(100, 100) is run in the Python Console, and then the window is closed, Blender will crash. (in debug builds due to an assertion)
Possible Solutions:
- Ignore the problem, it is only in a debug build only anyway. Pretty sure that would cause other problems later...
- Free all framebuffers in the GPU_context_discard similar to the vaos. Would also have to update the Python objects, otherwise they think the framebuffers still exist.
- Keep track of the GPUOffScreen objects that are "owned" by Python and free them before the context is discarded.
- You could think that Pythons garbage collection solves this, but it doesn't... (think multiple windows; Python is "closed" after the opengl context is freed)
I talked with @Clément Foucault (fclem) about it and we decided to go with option 3 for now. So this is what this patch implements.
I'm fully aware that this is not a super nice solution and if someone has a better idea, please let me know!
Problems:
- Using WITH_PYTHON does not work as I expected. Apparentely the GPU library is build without WITH_PYTHON even when Blender in general is compiled with Python. I don't know enough about cmake etc. to be able to understand this yet.