The maximum number of textures in WebGL?

I know that in WebGL there is a limit of 8 textures.

My question is, is the 8 limit global, or is it wise for the shader / program?

If it depends on the size of the shader / program, does this mean that when I load the textures into the uniform of one shader, can I start reusing these slots for other shaders? Say I used TEXTURE0for one shape, can I use TEXTURE0in another shape?

+4
source share
1 answer

The limit is for a call with an appeal. When you make a draw call and call a specific shader program, you are limited by the limit, but your next draw call can use completely different textures in the same animation frame.

In addition, 8 is the minimum guarantee. Systems must support at least eight to be considered compatible with WebGL. But nicer graphics cards support more than eight. You can request the maximum number of image textures for the platform on which you are:

var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);

You can also search for vertex textures:

gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS)

Or a combination of the two:

gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)

, WebGL ( , ), , ( "" Shader → Max Texture Units).

WebGL, . MAX_TEXTURE_IMAGE_UNITS , 16 , 95%.

+10

Source: https://habr.com/ru/post/1663127/


All Articles