renderer: check valid consts outside loop

This just moves a check outside the loop, as this is a bit of
a hotpath.
macos/master
Dave Airlie 9 years ago
parent 45b30efaac
commit ece89c4d64
  1. 10
      src/vrend_renderer.c

@ -2789,11 +2789,11 @@ void vrend_draw_vbo(struct vrend_context *ctx,
vrend_use_program(ctx, ctx->sub->prog->id); vrend_use_program(ctx, ctx->sub->prog->id);
for (shader_type = PIPE_SHADER_VERTEX; shader_type <= ctx->sub->last_shader_idx; shader_type++) { 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)) { if (ctx->sub->consts[shader_type].consts &&
int nc; ctx->sub->prog->const_locs[shader_type] &&
nc = ctx->sub->shaders[shader_type]->sinfo.num_consts; (ctx->sub->const_dirty[shader_type] || new_program)) {
for (i = 0; i < nc; i++) { for (i = 0; i < ctx->sub->shaders[shader_type]->sinfo.num_consts; i++) {
if (ctx->sub->prog->const_locs[shader_type][i] != -1 && ctx->sub->consts[shader_type].consts) 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]); 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; ctx->sub->const_dirty[shader_type] = false;

Loading…
Cancel
Save