int buffer;
unsigned index, target, type;
- /* only first 32 regs will appear in this bitfield */
- info->file_mask[file] |= (1 << reg);
+ /*
+ * only first 32 regs will appear in this bitfield, if larger
+ * bits will wrap around.
+ */
+ info->file_mask[file] |= (1u << (reg & 31));
info->file_count[file]++;
info->file_max[file] = MAX2(info->file_max[file], (int)reg);
if (shader->info.base.file_max[TGSI_FILE_SAMPLER_VIEW] != -1) {
key->nr_sampler_views = shader->info.base.file_max[TGSI_FILE_SAMPLER_VIEW] + 1;
for(i = 0; i < key->nr_sampler_views; ++i) {
- if(shader->info.base.file_mask[TGSI_FILE_SAMPLER_VIEW] & (1 << i)) {
+ /*
+ * Note sview may exceed what's representable by file_mask.
+ * This will still work, the only downside is that not actually
+ * used views may be included in the shader key.
+ */
+ if(shader->info.base.file_mask[TGSI_FILE_SAMPLER_VIEW] & (1u << (i & 31))) {
lp_sampler_static_texture_state(&key->state[i].texture_state,
lp->sampler_views[PIPE_SHADER_FRAGMENT][i]);
}
key.nr_sampler_views =
info.base.file_max[TGSI_FILE_SAMPLER_VIEW] + 1;
for (unsigned i = 0; i < key.nr_sampler_views; i++) {
- if (info.base.file_mask[TGSI_FILE_SAMPLER_VIEW] & (1 << i)) {
+ if (info.base.file_mask[TGSI_FILE_SAMPLER_VIEW] & (1u << (i & 31))) {
const struct pipe_sampler_view *view =
ctx->sampler_views[shader_type][i];
lp_sampler_static_texture_state(