From: Kenneth Graunke Date: Mon, 11 Feb 2019 03:53:40 +0000 (-0800) Subject: i965: Use info->textures_used instead of prog->SamplersUsed. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3eedc8f7b144c6bc21301a551763a53884c60fa1;p=mesa.git 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 --- diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index c3102e3fef8..40bcf82ae8d 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index b067a174056..ece3197a858 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -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;