diff options
author | Jason Ekstrand <[email protected]> | 2016-04-07 16:56:34 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-04-07 16:56:34 -0700 |
commit | e26a978773ba8fbff04cd2ab3342fcb02e90c06e (patch) | |
tree | 303f7d5e47f2b11ad2edf7ed0f82e90620646df9 /src/gallium/auxiliary/util/u_pstipple.c | |
parent | 15895bf777bd5f68a197506fdeaced28aa440622 (diff) | |
parent | 1cd19ebc4a892ada69f9085892441c00674b2764 (diff) |
Merge remote-tracking branch 'public/master' into vulkan
Diffstat (limited to 'src/gallium/auxiliary/util/u_pstipple.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_pstipple.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c index bcbe2a25b25..3ae8923f953 100644 --- a/src/gallium/auxiliary/util/u_pstipple.c +++ b/src/gallium/auxiliary/util/u_pstipple.c @@ -204,7 +204,7 @@ pstip_transform_decl(struct tgsi_transform_context *ctx, if (decl->Declaration.File == TGSI_FILE_SAMPLER) { uint i; for (i = decl->Range.First; i <= decl->Range.Last; i++) { - pctx->samplersUsed |= 1 << i; + pctx->samplersUsed |= 1u << i; } } else if (decl->Declaration.File == pctx->wincoordFile) { @@ -266,9 +266,11 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx) int texTemp; int sampIdx; + STATIC_ASSERT(sizeof(pctx->samplersUsed) * 8 >= PIPE_MAX_SAMPLERS); + /* 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) |