Closed ambrusc closed 9 months ago
Ah you also wrote a ticket. I replied in the PR :)
Weird, I could have sworn I added a comment to this ticket, but I can't find it anymore :D (maybe I closed the tab or something)...
Anyway:
Just want to let you know I just stumbled over the same problem when writing a new sample to test rendering into mipmaps. Apparently glTexImage2D() on a mipmap level with a nullptr for the data doesn't actually allocate storage for that mip level (except for mip level 0) which then causes framebuffer incomplete errors when trying to render into such a mipmlevel. Set GL_TEXTURE_MAX_LEVEL fixes the issue.
I've put the fix into a new PR (https://github.com/floooh/sokol/pull/924) which also adds more detailed error logging for the framebuffer completeness check (that's also why I closed your original PR, the actual fix is pretty much the same though, except that I always set GL_TEXTURE_MAX_LEVEL, also when there's only one mipmap (should be ok too).
...I now actually wonder if I can remove the SG_FILTER_NONE
enum item... I'll need to check that...
Closing as duplicate of https://github.com/floooh/sokol/issues/923
PS: thanks for investigating and reporting the issue, it's much appreciated, and apologies that I don't merge your PR.
Took me a while to figure this one out because I couldn't find any mipmap sample code other than the spline one, but a clue was that things were working correctly on Metal. Turns out the GL texture is considered incomplete if it has mipmaps and a mipmap sampler but the GL_TEXTURE_MAX_LEVEL tex parameter isn't set. Makes sense I think.
Fix and links to Khronos in #911.