From ece89c4d647d5041868e0fbfee6479c9325fd7ae Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 16 Mar 2016 17:16:25 +1000 Subject: [PATCH] renderer: check valid consts outside loop This just moves a check outside the loop, as this is a bit of a hotpath. --- src/vrend_renderer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 4c4d5af..77c79f2 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -2789,11 +2789,11 @@ void vrend_draw_vbo(struct vrend_context *ctx, vrend_use_program(ctx, ctx->sub->prog->id); for (shader_type = PIPE_SHADER_VERTEX; shader_type <= ctx->sub->last_shader_idx; shader_type++) { - if (ctx->sub->prog->const_locs[shader_type] && (ctx->sub->const_dirty[shader_type] || new_program)) { - int nc; - nc = ctx->sub->shaders[shader_type]->sinfo.num_consts; - for (i = 0; i < nc; i++) { - if (ctx->sub->prog->const_locs[shader_type][i] != -1 && ctx->sub->consts[shader_type].consts) + if (ctx->sub->consts[shader_type].consts && + ctx->sub->prog->const_locs[shader_type] && + (ctx->sub->const_dirty[shader_type] || new_program)) { + for (i = 0; i < ctx->sub->shaders[shader_type]->sinfo.num_consts; i++) { + if (ctx->sub->prog->const_locs[shader_type][i] != -1) glUniform4uiv(ctx->sub->prog->const_locs[shader_type][i], 1, &ctx->sub->consts[shader_type].consts[i * 4]); } ctx->sub->const_dirty[shader_type] = false;