I'm working on a webgl scene that involves big textures. I have been querying to determine the largest texture size supported by a given device as follows:
var gl = document.createElement('canvas').getContext('webgl')
console.log(gl.getParameter(gl.MAX_TEXTURE_SIZE))
On my 2015 Macbook Pro, I can use a texture at the returned size just fine. On a 2015 MacBook Air, however, when I try to pass a texture of the returned size as a uniform to my shaders, I get an error:
[.WebGL-0x7fcb4489200]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION :
glGenerateMipmap <- error from previous GL command
If I use instead a texture that's size gl.getParameter(gl.MAX_TEXTURE_SIZE)/2
however, the MacBook Air renders the scene just fine and there's no error.
Is it possible the MacBook Air has mis-reported its gl capabilities? Or am I trying to determine the max texture size incorrectly? My goal is to query for the largest texture supported by the current browser device. Any suggestions others can offer on how best to achieve this goal would be entirely welcome!
I observed the behavior above in Chrome 78 and Safari 13.