[Mesa-dev] [PATCH 2/7] draw/aaline: stronger guard against no free samplers

Nicolai Hähnle nhaehnle at gmail.com
Wed Apr 6 22:46:58 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Line anti-aliasing will fail when there is no free sampler available. Make
the corresponding guard more robust in preparation of raising
PIPE_MAX_SAMPLERS to 32.
---
 src/gallium/auxiliary/draw/draw_pipe_aaline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index cd9ee54..740aaa8 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -210,7 +210,7 @@ aa_transform_prolog(struct tgsi_transform_context *ctx)
 
    /* find free sampler */
    aactx->freeSampler = free_bit(aactx->samplersUsed);
-   if (aactx->freeSampler >= PIPE_MAX_SAMPLERS)
+   if (aactx->freeSampler < 0 || aactx->freeSampler >= PIPE_MAX_SAMPLERS)
       aactx->freeSampler = PIPE_MAX_SAMPLERS - 1;
 
    /* find two free temp regs */
-- 
2.5.0



More information about the mesa-dev mailing list