[Mesa-dev] [PATCH 1/7] util/pstipple: stronger guard against no free samplers

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


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

When hasFixedUnit is false, polygon stippling 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/util/u_pstipple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c
index bcbe2a2..52aec80 100644
--- a/src/gallium/auxiliary/util/u_pstipple.c
+++ b/src/gallium/auxiliary/util/u_pstipple.c
@@ -268,7 +268,7 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx)
 
    /* find free texture sampler */
    pctx->freeSampler = free_bit(pctx->samplersUsed);
-   if (pctx->freeSampler >= PIPE_MAX_SAMPLERS)
+   if (pctx->freeSampler < 0 || pctx->freeSampler >= PIPE_MAX_SAMPLERS)
       pctx->freeSampler = PIPE_MAX_SAMPLERS - 1;
 
    if (pctx->wincoordInput < 0)
-- 
2.5.0



More information about the mesa-dev mailing list