i965: Use info->textures_used instead of prog->SamplersUsed.

prog->SamplersUsed is set by the linker when validating resource limits,
while info->textures_used is gathered after NIR optimizations, which may
have eliminated some unused surfaces.

This may let us skip some work.

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Kenneth Graunke
2019-02-10 19:53:40 -08:00
parent 59ae985631
commit 3eedc8f7b1
2 changed files with 7 additions and 7 deletions

View File

@@ -815,15 +815,15 @@ brw_prepare_drawing(struct gl_context *ctx,
* index.
*/
brw->wm.base.sampler_count =
util_last_bit(ctx->FragmentProgram._Current->SamplersUsed);
util_last_bit(ctx->FragmentProgram._Current->info.textures_used);
brw->gs.base.sampler_count = ctx->GeometryProgram._Current ?
util_last_bit(ctx->GeometryProgram._Current->SamplersUsed) : 0;
util_last_bit(ctx->GeometryProgram._Current->info.textures_used) : 0;
brw->tes.base.sampler_count = ctx->TessEvalProgram._Current ?
util_last_bit(ctx->TessEvalProgram._Current->SamplersUsed) : 0;
util_last_bit(ctx->TessEvalProgram._Current->info.textures_used) : 0;
brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?
util_last_bit(ctx->TessCtrlProgram._Current->SamplersUsed) : 0;
util_last_bit(ctx->TessCtrlProgram._Current->info.textures_used) : 0;
brw->vs.base.sampler_count =
util_last_bit(ctx->VertexProgram._Current->SamplersUsed);
util_last_bit(ctx->VertexProgram._Current->info.textures_used);
intel_prepare_render(brw);

View File

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