[Mesa-dev] [PATCH 3/5] mesa: Use the Elements macro for the sampler index assert in validate_samplers().

Henri Verbeet hverbeet at gmail.com
Sun Jul 3 16:00:27 PDT 2011


This is probably nicer if the array size ever changes.
---
 src/mesa/main/shaderapi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index cb02e43..8df25c3 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1050,7 +1050,7 @@ validate_samplers(const struct gl_program *prog, char *errMsg)
       gl_texture_index target;
       GLint sampler = _mesa_ffs(samplersUsed) - 1;
       assert(sampler >= 0);
-      assert(sampler < MAX_TEXTURE_IMAGE_UNITS);
+      assert(sampler < Elements(prog->SamplerUnits));
       unit = prog->SamplerUnits[sampler];
       target = prog->SamplerTargets[sampler];
       if (targetUsed[unit] != -1 && targetUsed[unit] != (int) target) {
-- 
1.7.2.5



More information about the mesa-dev mailing list