Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.3.2
-
None
-
Arch Linux
Description
When requesting a texture that is too big to reside in GPU memory the allocateStorage function fails to actually allocate storage on the GPU. However, at the end of this function the member storageAllocated is unconditionally set to true resulting in isStorageAllocated() returning true incorrectly.
Either this is intended or not. Depending on this there are several possibilities to fix this:
It is intended:
Give this behavior better documentation (e.g. the documentation on allocateStorage and isStorageAllocated should mention this)
In this case the documentation should also offer a solution to the problem like:
Check if the texture can be allocated before calling allocateStorage. (There could be a helper function QOpenGLTexture::canBeAllocated to make this easier)
A bit uglier would be to incorporate calling glGetError after allocateStorage (which would also require to clear the errors before the call) to see if the GL call succeeded.
It is not intended:
IMHO the best way would be to automatically check if the request can be fullfilled and if it can't raise an exception or at least let isStorageAllocated return false afterwards. However, the latter might be silently ignored.