shader_info: convert textures_used to a bitset.

For now keep it a bitset of 1 32-bit dword.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9456>
This commit is contained in:
Dave Airlie
2021-03-08 15:23:31 +10:00
parent c55bd4b68d
commit 8027a7ba8a
28 changed files with 51 additions and 54 deletions

View File

@@ -230,14 +230,13 @@ record_textures_used(struct shader_info *info,
/* Structs have been lowered already, so get_aoa_size is sufficient. */ /* Structs have been lowered already, so get_aoa_size is sufficient. */
const unsigned size = const unsigned size =
glsl_type_is_array(var->type) ? glsl_get_aoa_size(var->type) : 1; glsl_type_is_array(var->type) ? glsl_get_aoa_size(var->type) : 1;
unsigned mask = ((1ull << MAX2(size, 1)) - 1) << var->data.binding;
info->textures_used |= mask; BITSET_SET_RANGE(info->textures_used, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
if (op == nir_texop_txf || if (op == nir_texop_txf ||
op == nir_texop_txf_ms || op == nir_texop_txf_ms ||
op == nir_texop_txf_ms_mcs) op == nir_texop_txf_ms_mcs)
info->textures_used_by_txf |= mask; BITSET_SET_RANGE(info->textures_used_by_txf, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
} }
static bool static bool

View File

@@ -165,10 +165,10 @@ typedef struct shader_info {
uint64_t patch_outputs_accessed_indirectly; uint64_t patch_outputs_accessed_indirectly;
/** Bitfield of which textures are used */ /** Bitfield of which textures are used */
uint32_t textures_used; BITSET_DECLARE(textures_used, 32);
/** Bitfield of which textures are used by texelFetch() */ /** Bitfield of which textures are used by texelFetch() */
uint32_t textures_used_by_txf; BITSET_DECLARE(textures_used_by_txf, 32);
/** Bitfield of which images are used */ /** Bitfield of which images are used */
uint32_t images_used; uint32_t images_used;

View File

@@ -3405,7 +3405,7 @@ emit_instructions(struct ir3_context *ctx)
* it is write-only we don't have to count it, but after lowering derefs * it is write-only we don't have to count it, but after lowering derefs
* is too late to compact indices for that. * is too late to compact indices for that.
*/ */
ctx->so->num_samp = util_last_bit(ctx->s->info.textures_used) + ctx->s->info.num_images; ctx->so->num_samp = BITSET_LAST_BIT(ctx->s->info.textures_used) + ctx->s->info.num_images;
/* Save off clip+cull information. Note that in OpenGL clip planes may /* Save off clip+cull information. Note that in OpenGL clip planes may
* be individually enabled/disabled, so we can't use the * be individually enabled/disabled, so we can't use the

View File

@@ -340,8 +340,7 @@ build_bindless(nir_builder *b, nir_deref_instr *deref, bool is_sampler,
const struct glsl_type *glsl_type = glsl_without_array(var->type); const struct glsl_type *glsl_type = glsl_without_array(var->type);
uint32_t idx = var->data.index * 2; uint32_t idx = var->data.index * 2;
b->shader->info.textures_used |= BITSET_SET_RANGE(b->shader->info.textures_used, idx * 2, ((idx * 2) + (bind_layout->array_size * 2)) - 1);
((1ull << (bind_layout->array_size * 2)) - 1) << (idx * 2);
/* D24S8 workaround: stencil of D24S8 will be sampled as uint */ /* D24S8 workaround: stencil of D24S8 will be sampled as uint */
if (glsl_get_sampler_result_type(glsl_type) == GLSL_TYPE_UINT) if (glsl_get_sampler_result_type(glsl_type) == GLSL_TYPE_UINT)

View File

@@ -134,7 +134,7 @@ nir_lower_pstipple_fs(struct nir_shader *shader,
tex_var->data.explicit_binding = true; tex_var->data.explicit_binding = true;
tex_var->data.how_declared = nir_var_hidden; tex_var->data.how_declared = nir_var_hidden;
shader->info.textures_used |= (1 << binding); BITSET_SET(shader->info.textures_used, binding);
state.stip_tex = tex_var; state.stip_tex = tex_var;
nir_foreach_function(function, shader) { nir_foreach_function(function, shader) {

View File

@@ -403,7 +403,7 @@ ntt_setup_uniforms(struct ntt_compile *c)
} }
for (int i = 0; i < PIPE_MAX_SAMPLERS; i++) { for (int i = 0; i < PIPE_MAX_SAMPLERS; i++) {
if (c->s->info.textures_used & (1 << i)) if (BITSET_TEST(c->s->info.textures_used, i))
ureg_DECL_sampler(c->ureg, i); ureg_DECL_sampler(c->ureg, i);
} }
} }

View File

@@ -801,9 +801,9 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
info->samplers_declared = sampler_mask; info->samplers_declared = sampler_mask;
info->file_max[TGSI_FILE_SAMPLER] = util_last_bit(info->samplers_declared) - 1; info->file_max[TGSI_FILE_SAMPLER] = util_last_bit(info->samplers_declared) - 1;
info->file_max[TGSI_FILE_SAMPLER_VIEW] = util_last_bit(nir->info.textures_used) - 1; info->file_max[TGSI_FILE_SAMPLER_VIEW] = BITSET_LAST_BIT(nir->info.textures_used) - 1;
info->file_mask[TGSI_FILE_SAMPLER] = info->samplers_declared; info->file_mask[TGSI_FILE_SAMPLER] = info->samplers_declared;
info->file_mask[TGSI_FILE_SAMPLER_VIEW] = nir->info.textures_used; info->file_mask[TGSI_FILE_SAMPLER_VIEW] = nir->info.textures_used[0];
info->file_max[TGSI_FILE_IMAGE] = util_last_bit(info->images_declared) - 1; info->file_max[TGSI_FILE_IMAGE] = util_last_bit(info->images_declared) - 1;
info->file_mask[TGSI_FILE_IMAGE] = info->images_declared; info->file_mask[TGSI_FILE_IMAGE] = info->images_declared;

View File

@@ -1274,12 +1274,11 @@ get_sampler_var(struct ttn_compile *c, int binding,
c->num_samplers = MAX2(c->num_samplers, binding + 1); c->num_samplers = MAX2(c->num_samplers, binding + 1);
/* Record textures used */ /* Record textures used */
unsigned mask = 1 << binding; BITSET_SET(c->build.shader->info.textures_used, binding);
c->build.shader->info.textures_used |= mask;
if (op == nir_texop_txf || if (op == nir_texop_txf ||
op == nir_texop_txf_ms || op == nir_texop_txf_ms ||
op == nir_texop_txf_ms_mcs) op == nir_texop_txf_ms_mcs)
c->build.shader->info.textures_used_by_txf |= mask; BITSET_SET(c->build.shader->info.textures_used_by_txf, binding);
} }
return var; return var;

View File

@@ -822,8 +822,8 @@ iris_setup_binding_table(const struct gen_device_info *devinfo,
bt->sizes[IRIS_SURFACE_GROUP_CS_WORK_GROUPS] = 1; bt->sizes[IRIS_SURFACE_GROUP_CS_WORK_GROUPS] = 1;
} }
bt->sizes[IRIS_SURFACE_GROUP_TEXTURE] = util_last_bit(info->textures_used); bt->sizes[IRIS_SURFACE_GROUP_TEXTURE] = BITSET_LAST_BIT(info->textures_used);
bt->used_mask[IRIS_SURFACE_GROUP_TEXTURE] = info->textures_used; bt->used_mask[IRIS_SURFACE_GROUP_TEXTURE] = info->textures_used[0];
bt->sizes[IRIS_SURFACE_GROUP_IMAGE] = info->num_images; bt->sizes[IRIS_SURFACE_GROUP_IMAGE] = info->num_images;
@@ -2570,8 +2570,8 @@ bind_shader_state(struct iris_context *ice,
const struct shader_info *old_info = iris_get_shader_info(ice, stage); const struct shader_info *old_info = iris_get_shader_info(ice, stage);
const struct shader_info *new_info = ish ? &ish->nir->info : NULL; const struct shader_info *new_info = ish ? &ish->nir->info : NULL;
if ((old_info ? util_last_bit(old_info->textures_used) : 0) != if ((old_info ? BITSET_LAST_BIT(old_info->textures_used) : 0) !=
(new_info ? util_last_bit(new_info->textures_used) : 0)) { (new_info ? BITSET_LAST_BIT(new_info->textures_used) : 0)) {
ice->state.stage_dirty |= IRIS_STAGE_DIRTY_SAMPLER_STATES_VS << stage; ice->state.stage_dirty |= IRIS_STAGE_DIRTY_SAMPLER_STATES_VS << stage;
} }

View File

@@ -89,7 +89,7 @@ resolve_sampler_views(struct iris_context *ice,
bool *draw_aux_buffer_disabled, bool *draw_aux_buffer_disabled,
bool consider_framebuffer) bool consider_framebuffer)
{ {
uint32_t views = info ? (shs->bound_sampler_views & info->textures_used) : 0; uint32_t views = info ? (shs->bound_sampler_views & info->textures_used[0]) : 0;
while (views) { while (views) {
const int i = u_bit_scan(&views); const int i = u_bit_scan(&views);

View File

@@ -2100,7 +2100,7 @@ iris_upload_sampler_states(struct iris_context *ice, gl_shader_stage stage)
/* We assume gallium frontends will call pipe->bind_sampler_states() /* We assume gallium frontends will call pipe->bind_sampler_states()
* if the program's number of textures changes. * if the program's number of textures changes.
*/ */
unsigned count = info ? util_last_bit(info->textures_used) : 0; unsigned count = info ? BITSET_LAST_BIT(info->textures_used) : 0;
if (!count) if (!count)
return; return;

View File

@@ -690,7 +690,7 @@ static void si_check_render_feedback(struct si_context *sctx)
si_check_render_feedback_images(sctx, &sctx->images[i], si_check_render_feedback_images(sctx, &sctx->images[i],
u_bit_consecutive(0, info->base.num_images)); u_bit_consecutive(0, info->base.num_images));
si_check_render_feedback_textures(sctx, &sctx->samplers[i], si_check_render_feedback_textures(sctx, &sctx->samplers[i],
info->base.textures_used); info->base.textures_used[0]);
} }
si_check_render_feedback_resident_images(sctx); si_check_render_feedback_resident_images(sctx);

View File

@@ -837,7 +837,7 @@ static bool si_check_needs_implicit_sync(struct si_context *sctx)
*/ */
struct si_shader_info *info = &sctx->cs_shader_state.program->sel.info; struct si_shader_info *info = &sctx->cs_shader_state.program->sel.info;
struct si_samplers *samplers = &sctx->samplers[PIPE_SHADER_COMPUTE]; struct si_samplers *samplers = &sctx->samplers[PIPE_SHADER_COMPUTE];
unsigned mask = samplers->enabled_mask & info->base.textures_used; unsigned mask = samplers->enabled_mask & info->base.textures_used[0];
while (mask) { while (mask) {
int i = u_bit_scan(&mask); int i = u_bit_scan(&mask);

View File

@@ -791,7 +791,7 @@ static void si_dump_descriptors(struct si_context *sctx, gl_shader_stage stage,
if (info) { if (info) {
enabled_constbuf = u_bit_consecutive(0, info->base.num_ubos); enabled_constbuf = u_bit_consecutive(0, info->base.num_ubos);
enabled_shaderbuf = u_bit_consecutive(0, info->base.num_ssbos); enabled_shaderbuf = u_bit_consecutive(0, info->base.num_ssbos);
enabled_samplers = info->base.textures_used; enabled_samplers = info->base.textures_used[0];
enabled_images = u_bit_consecutive(0, info->base.num_images); enabled_images = u_bit_consecutive(0, info->base.num_images);
} else { } else {
enabled_constbuf = enabled_constbuf =

View File

@@ -2663,7 +2663,7 @@ bool si_gfx_resources_check_encrypted(struct si_context *sctx)
si_buffer_resources_check_encrypted(sctx, &sctx->const_and_shader_buffers[i]); si_buffer_resources_check_encrypted(sctx, &sctx->const_and_shader_buffers[i]);
use_encrypted_bo |= use_encrypted_bo |=
si_sampler_views_check_encrypted(sctx, &sctx->samplers[i], si_sampler_views_check_encrypted(sctx, &sctx->samplers[i],
current_shader->cso->info.base.textures_used); current_shader->cso->info.base.textures_used[0]);
use_encrypted_bo |= si_image_views_check_encrypted(sctx, &sctx->images[i], use_encrypted_bo |= si_image_views_check_encrypted(sctx, &sctx->images[i],
u_bit_consecutive(0, current_shader->cso->info.base.num_images)); u_bit_consecutive(0, current_shader->cso->info.base.num_images));
} }
@@ -2743,7 +2743,7 @@ bool si_compute_resources_check_encrypted(struct si_context *sctx)
* or all writable buffers are encrypted. * or all writable buffers are encrypted.
*/ */
return si_buffer_resources_check_encrypted(sctx, &sctx->const_and_shader_buffers[sh]) || return si_buffer_resources_check_encrypted(sctx, &sctx->const_and_shader_buffers[sh]) ||
si_sampler_views_check_encrypted(sctx, &sctx->samplers[sh], info->base.textures_used) || si_sampler_views_check_encrypted(sctx, &sctx->samplers[sh], info->base.textures_used[0]) ||
si_image_views_check_encrypted(sctx, &sctx->images[sh], u_bit_consecutive(0, info->base.num_images)) || si_image_views_check_encrypted(sctx, &sctx->images[sh], u_bit_consecutive(0, info->base.num_images)) ||
si_buffer_resources_check_encrypted(sctx, &sctx->internal_bindings); si_buffer_resources_check_encrypted(sctx, &sctx->internal_bindings);
} }

View File

@@ -820,7 +820,7 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
ctx->num_const_buffers = info->base.num_ubos; ctx->num_const_buffers = info->base.num_ubos;
ctx->num_shader_buffers = info->base.num_ssbos; ctx->num_shader_buffers = info->base.num_ssbos;
ctx->num_samplers = util_last_bit(info->base.textures_used); ctx->num_samplers = BITSET_LAST_BIT(info->base.textures_used);
ctx->num_images = info->base.num_images; ctx->num_images = info->base.num_images;
si_llvm_init_resource_callbacks(ctx); si_llvm_init_resource_callbacks(ctx);

View File

@@ -1612,8 +1612,8 @@ static bool si_all_vs_resources_read_only(struct si_context *sctx, struct pipe_r
} }
/* Samplers. */ /* Samplers. */
if (vs->info.base.textures_used) { if (vs->info.base.textures_used[0]) {
unsigned num_samplers = util_last_bit(vs->info.base.textures_used); unsigned num_samplers = BITSET_LAST_BIT(vs->info.base.textures_used);
for (unsigned i = 0; i < num_samplers; i++) { for (unsigned i = 0; i < num_samplers; i++) {
struct pipe_sampler_view *view = sctx->samplers[PIPE_SHADER_VERTEX].views[i]; struct pipe_sampler_view *view = sctx->samplers[PIPE_SHADER_VERTEX].views[i];

View File

@@ -2621,7 +2621,7 @@ void si_get_active_slot_masks(const struct si_shader_info *info, uint64_t *const
/* two 8-byte images share one 16-byte slot */ /* two 8-byte images share one 16-byte slot */
num_images = align(info->base.num_images, 2); num_images = align(info->base.num_images, 2);
num_msaa_images = align(util_last_bit(info->base.msaa_images), 2); num_msaa_images = align(util_last_bit(info->base.msaa_images), 2);
num_samplers = util_last_bit(info->base.textures_used); num_samplers = BITSET_LAST_BIT(info->base.textures_used);
/* The layout is: sb[last] ... sb[0], cb[0] ... cb[last] */ /* The layout is: sb[last] ... sb[0], cb[0] ... cb[last] */
start = si_get_shaderbuf_slot(num_shaderbufs - 1); start = si_get_shaderbuf_slot(num_shaderbufs - 1);

View File

@@ -111,7 +111,9 @@ clover_nir_lower_images(nir_shader *shader)
} }
} }
shader->info.num_textures = num_rd_images; shader->info.num_textures = num_rd_images;
shader->info.textures_used = (1 << num_rd_images) - 1; BITSET_ZERO(shader->info.textures_used);
if (num_rd_images)
BITSET_SET_RANGE(shader->info.textures_used, 0, num_rd_images - 1);
shader->info.num_images = num_wr_images; shader->info.num_images = num_wr_images;
nir_builder b; nir_builder b;

View File

@@ -154,7 +154,7 @@ static void lower_vri_instr_tex(struct nir_builder *b,
lower_vri_instr_tex_deref(tex, nir_tex_src_sampler_deref, b->shader->info.stage, layout); lower_vri_instr_tex_deref(tex, nir_tex_src_sampler_deref, b->shader->info.stage, layout);
tex_value = lower_vri_instr_tex_deref(tex, nir_tex_src_texture_deref, b->shader->info.stage, layout); tex_value = lower_vri_instr_tex_deref(tex, nir_tex_src_texture_deref, b->shader->info.stage, layout);
if (tex_value >= 0) if (tex_value >= 0)
b->shader->info.textures_used |= (1 << tex_value); BITSET_SET(b->shader->info.textures_used, tex_value);
} }
static nir_ssa_def *lower_vri_instr(struct nir_builder *b, static nir_ssa_def *lower_vri_instr(struct nir_builder *b,

View File

@@ -214,9 +214,9 @@ _mesa_meta_compile_and_link_program(struct gl_context *ctx,
* around this bad interaction. This is a bit fragile as it may break * around this bad interaction. This is a bit fragile as it may break
* if you re-run the pass that gathers this info, but we probably won't... * if you re-run the pass that gathers this info, but we probably won't...
*/ */
fp->info.textures_used_by_txf = 0; BITSET_ZERO(fp->info.textures_used_by_txf);
if (fp->nir) if (fp->nir)
fp->nir->info.textures_used_by_txf = 0; BITSET_ZERO(fp->nir->info.textures_used_by_txf);
_mesa_meta_use_program(ctx, sh_prog); _mesa_meta_use_program(ctx, sh_prog);

View File

@@ -478,11 +478,9 @@ mark_textures_used_for_txf(BITSET_WORD *used_for_txf,
if (!prog) if (!prog)
return; return;
uint32_t mask = prog->info.textures_used_by_txf; unsigned s;
while (mask) { BITSET_FOREACH_SET(s, prog->info.textures_used_by_txf, 32)
int s = u_bit_scan(&mask);
BITSET_SET(used_for_txf, prog->SamplerUnits[s]); BITSET_SET(used_for_txf, prog->SamplerUnits[s]);
}
} }
/** /**
@@ -851,15 +849,15 @@ brw_prepare_drawing(struct gl_context *ctx,
* index. * index.
*/ */
brw->wm.base.sampler_count = brw->wm.base.sampler_count =
util_last_bit(ctx->FragmentProgram._Current->info.textures_used); BITSET_LAST_BIT(ctx->FragmentProgram._Current->info.textures_used);
brw->gs.base.sampler_count = ctx->GeometryProgram._Current ? brw->gs.base.sampler_count = ctx->GeometryProgram._Current ?
util_last_bit(ctx->GeometryProgram._Current->info.textures_used) : 0; BITSET_LAST_BIT(ctx->GeometryProgram._Current->info.textures_used) : 0;
brw->tes.base.sampler_count = ctx->TessEvalProgram._Current ? brw->tes.base.sampler_count = ctx->TessEvalProgram._Current ?
util_last_bit(ctx->TessEvalProgram._Current->info.textures_used) : 0; BITSET_LAST_BIT(ctx->TessEvalProgram._Current->info.textures_used) : 0;
brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ? brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?
util_last_bit(ctx->TessCtrlProgram._Current->info.textures_used) : 0; BITSET_LAST_BIT(ctx->TessCtrlProgram._Current->info.textures_used) : 0;
brw->vs.base.sampler_count = brw->vs.base.sampler_count =
util_last_bit(ctx->VertexProgram._Current->info.textures_used); BITSET_LAST_BIT(ctx->VertexProgram._Current->info.textures_used);
brw_prepare_render(brw); brw_prepare_render(brw);

View File

@@ -183,8 +183,8 @@ brw_nir_lower_resources(nir_shader *nir, struct gl_shader_program *shader_prog,
{ {
NIR_PASS_V(nir, brw_nir_lower_uniforms, nir->options->lower_to_scalar); NIR_PASS_V(nir, brw_nir_lower_uniforms, nir->options->lower_to_scalar);
NIR_PASS_V(prog->nir, gl_nir_lower_samplers, shader_prog); NIR_PASS_V(prog->nir, gl_nir_lower_samplers, shader_prog);
prog->info.textures_used = prog->nir->info.textures_used; BITSET_COPY(prog->info.textures_used, prog->nir->info.textures_used);
prog->info.textures_used_by_txf = prog->nir->info.textures_used_by_txf; BITSET_COPY(prog->info.textures_used_by_txf, prog->nir->info.textures_used_by_txf);
NIR_PASS_V(prog->nir, brw_nir_lower_image_load_store, devinfo, NULL); NIR_PASS_V(prog->nir, brw_nir_lower_image_load_store, devinfo, NULL);

View File

@@ -1173,13 +1173,13 @@ update_stage_texture_surfaces(struct brw_context *brw,
else else
surf_offset += stage_state->prog_data->binding_table.plane_start[plane]; surf_offset += stage_state->prog_data->binding_table.plane_start[plane];
unsigned num_samplers = util_last_bit(prog->info.textures_used); unsigned num_samplers = BITSET_LAST_BIT(prog->info.textures_used);
for (unsigned s = 0; s < num_samplers; s++) { for (unsigned s = 0; s < num_samplers; s++) {
surf_offset[s] = 0; surf_offset[s] = 0;
if (prog->info.textures_used & (1 << s)) { if (BITSET_TEST(prog->info.textures_used, s)) {
const unsigned unit = prog->SamplerUnits[s]; const unsigned unit = prog->SamplerUnits[s];
const bool used_by_txf = prog->info.textures_used_by_txf & (1 << s); const bool used_by_txf = BITSET_TEST(prog->info.textures_used_by_txf, s);
struct gl_texture_object *obj = ctx->Texture.Unit[unit]._Current; struct gl_texture_object *obj = ctx->Texture.Unit[unit]._Current;
struct brw_texture_object *iobj = brw_texture_object(obj); struct brw_texture_object *iobj = brw_texture_object(obj);

View File

@@ -106,7 +106,7 @@ update_textures(struct st_context *st,
struct pipe_context *pipe = st->pipe; struct pipe_context *pipe = st->pipe;
const GLuint old_max = st->state.num_sampler_views[shader_stage]; const GLuint old_max = st->state.num_sampler_views[shader_stage];
GLbitfield samplers_used = prog->SamplersUsed; GLbitfield samplers_used = prog->SamplersUsed;
GLbitfield texel_fetch_samplers = prog->info.textures_used_by_txf; GLbitfield texel_fetch_samplers = prog->info.textures_used_by_txf[0];
GLbitfield free_slots = ~prog->SamplersUsed; GLbitfield free_slots = ~prog->SamplersUsed;
GLbitfield external_samplers_used = prog->ExternalSamplersUsed; GLbitfield external_samplers_used = prog->ExternalSamplersUsed;
GLuint unit; GLuint unit;

View File

@@ -968,8 +968,8 @@ st_nir_lower_samplers(struct pipe_screen *screen, nir_shader *nir,
NIR_PASS_V(nir, gl_nir_lower_samplers, shader_program); NIR_PASS_V(nir, gl_nir_lower_samplers, shader_program);
if (prog) { if (prog) {
prog->info.textures_used = nir->info.textures_used; BITSET_COPY(prog->info.textures_used, nir->info.textures_used);
prog->info.textures_used_by_txf = nir->info.textures_used_by_txf; BITSET_COPY(prog->info.textures_used_by_txf, nir->info.textures_used_by_txf);
prog->info.images_used = nir->info.images_used; prog->info.images_used = nir->info.images_used;
} }
} }

View File

@@ -4868,7 +4868,7 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
{ {
v->samplers_used = 0; v->samplers_used = 0;
v->images_used = 0; v->images_used = 0;
prog->info.textures_used_by_txf = 0; BITSET_ZERO(prog->info.textures_used_by_txf);
foreach_in_list(glsl_to_tgsi_instruction, inst, &v->instructions) { foreach_in_list(glsl_to_tgsi_instruction, inst, &v->instructions) {
if (inst->info->is_tex) { if (inst->info->is_tex) {
@@ -4882,7 +4882,7 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
st_translate_texture_target(inst->tex_target, inst->tex_shadow); st_translate_texture_target(inst->tex_target, inst->tex_shadow);
if (inst->op == TGSI_OPCODE_TXF || inst->op == TGSI_OPCODE_TXF_LZ) { if (inst->op == TGSI_OPCODE_TXF || inst->op == TGSI_OPCODE_TXF_LZ) {
prog->info.textures_used_by_txf |= 1u << idx; BITSET_SET(prog->info.textures_used_by_txf, idx);
} }
} }
} }

View File

@@ -129,7 +129,7 @@ lower_tex_src_plane_block(nir_builder *b, lower_tex_src_state *state, nir_block
tex->texture_index = tex->sampler_index = tex->texture_index = tex->sampler_index =
state->sampler_map[y_samp][plane[0].i32 - 1]; state->sampler_map[y_samp][plane[0].i32 - 1];
state->shader->info.textures_used |= 1u << tex->texture_index; BITSET_SET(state->shader->info.textures_used, tex->texture_index);
/* For drivers using PIPE_CAP_NIR_SAMPLERS_AS_DEREF, we need /* For drivers using PIPE_CAP_NIR_SAMPLERS_AS_DEREF, we need
* to reference the correct sampler nir variable. * to reference the correct sampler nir variable.