Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hopefully this will clear up some of your confusion, I used an older version of the spec. for simplicity, newer versions have two additional stages (tessellation control / evaluation) so the discussion is a little more complicated.</p> <h2><a href="http://www.opengl.org/registry/doc/glspec33.core.20100311.pdf" rel="nofollow">OpenGL 3.3 (Core Profile)</a> - 2.11. Vertex Shaders - pp. 80</h2> <blockquote> <p>Texture Access</p> <blockquote> <p>Shaders have the ability to do a lookup into a texture map. The maximum number of texture image units available to vertex, geometry, or fragment shaders are respectively the values of the implementation-dependent constants <code>GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS</code>, <code>GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS</code>, and <code>GL_MAX_TEXTURE_IMAGE_UNITS</code>. The vertex shader, geometry shader, and fragment shader combined cannot use more than the value of <code>GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS</code> texture image units. If more than one of the vertex shader, geometry shader, and fragment processing stage access the same texture image unit, each such access counts separately against the <code>GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS</code> limit.</p> </blockquote> </blockquote> <p>The limit is imposed based on the number of unique samplers used in each stage. Two sampler uniforms with different names but which reference the same texture unit are effectively the same as far as usage determination is concerned. Usage refers to doing something like <code>texture (sampler, coords)</code>, if that was not already obvious. Merely declaring a sampler and assigning it a value is not going to bring you any closer to the implementation-defined limit, you actually have to <strong><em>use</em></strong> the sampler at run-time and if it has the same value as another used sampler in the same stage it does not count.</p> <p>As for using the same texture object multiple times, no this is not what the <code>GL_MAX_..._IMAGE_UNITS</code> limit is all about. You could bind the same texture to all 48 texture units (minimum implementation requirement in GL3.3 - this effectively mandates at least 16 textures per-stage) if you wanted, this limit refers to the number of different samplers you use (again, see above) in a shader stage. You might actually want to bind the same texture to multiple texture units if you need to use it once with nearest neighbor filtering and another time with linear or a different wrap state.</p> <p>If you want to know what behavior to expect on all drivers/hardware, always consult the formal OpenGL specification. I cherry picked the relevant information for you, but it would do you well to learn how to search through it for important details in the future. Every specification since OpenGL 1.0 is freely available from: <a href="http://www.opengl.org/registry/" rel="nofollow">http://www.opengl.org/registry/</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload