aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_scan.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-04-07 12:19:56 -0500
committerNicolai Hähnle <[email protected]>2016-04-07 13:15:05 -0500
commit4bfcc86bf977ac18465c7be0a0fa14354b18d7c6 (patch)
tree6d4f21b162449b19192986195e05a33051277081 /src/gallium/auxiliary/tgsi/tgsi_scan.c
parentcc39879989a1f24c232a7d1b7037c4d3fcff2ce2 (diff)
tgsi/scan: add an assert for the size of the samplers_declared bitfield
The literal 1 is a (signed) int, and shifting into the sign bit is undefined in C, so change occurences of 1 to 1u. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_scan.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index d90fb1d68df..c5ef16810a2 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -464,7 +464,8 @@ scan_declaration(struct tgsi_shader_info *info,
}
}
} else if (file == TGSI_FILE_SAMPLER) {
- info->samplers_declared |= 1 << reg;
+ STATIC_ASSERT(sizeof(info->samplers_declared) * 8 >= PIPE_MAX_SAMPLERS);
+ info->samplers_declared |= 1u << reg;
} else if (file == TGSI_FILE_SAMPLER_VIEW) {
unsigned target = fulldecl->SamplerView.Resource;
assert(target < TGSI_TEXTURE_UNKNOWN);