Created attachment 83259 [details] texstorage_fail.c, shows the problems as they appear to user code There appears to be problems with proxy textures and the texture storage functions. I identified three separate issues: - The calculation (_mesa_get_tex_max_num_levels() in teximage.c) that checks how many mipmap levels a texture could have has not been written to check proxy textures as well. - The error checking in the storage functions checks if a non-zero texture has been bound. Proxy textures don't care about that but the check makes glTexStorage*() fail when they should not. As far as I know, you cannot bind a proxy texture to anything so this makes glTexStorage*() always fail for a proxy texture. - The use of glTexStorage*() on a proxy texture makes the texture immutable. This is not normally detectable by the users (because it is a proxy texture) but the immutability flag makes further glTexStorage*() calls fail. This last issue cannot be seen until the two previous issues are fixed. I would not be surprised if there were more issues with proxy textures lurking here, given that it looks like these functions were not tested with proxy textures. I'm attaching three patches that I used to make things work for me. I also attached a short testing program that shows how user code would see these problems.
Created attachment 83260 [details] patch 1/3
Created attachment 83261 [details] patch 2/3
Created attachment 83262 [details] patch 3/3
The patches look good to me. Reviewed-by: Brian Paul <brianp@vmware.com> Do you need me to commit them for you?
Yeah, I think so. This is the first time I've ever submitted any patches to mesa.
Created attachment 83319 [details] [review] patch 1/1 I discovered another proxy texture related bug with multisampling textures. glGetTexLevelParameteriv() would fail for GL_PROXY_TEXTURE_2D_MULTISAMPLE and GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY because one of the error checking functions seems to be blissfully unaware these targets exist. I attached another patch to fix this one. This is technically a different bug to the texture storage proxy texture bugs but since we are on the topic of proxy textures, I attached this one here.
(In reply to comment #6) > Created attachment 83319 [details] [review] [review] > patch 1/1 > > I discovered another proxy texture related bug with multisampling textures. > glGetTexLevelParameteriv() would fail for GL_PROXY_TEXTURE_2D_MULTISAMPLE > and GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY because one of the error checking > functions seems to be blissfully unaware these targets exist. I attached > another patch to fix this one. > > This is technically a different bug to the texture storage proxy texture > bugs but since we are on the topic of proxy textures, I attached this one > here. Thanks. That patch looks good too. I've pushed these to master. Closing this bug now.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.