vrend: make evaluation of same_prog better optimizable

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
macos/master
Gert Wollny 4 years ago
parent 4b151fcc8a
commit 8ac253a42e
  1. 22
      src/vrend_renderer.c

@ -4421,8 +4421,6 @@ vrend_select_program(struct vrend_sub_context *sub_ctx, const struct pipe_draw_i
struct vrend_linked_shader_program *prog; struct vrend_linked_shader_program *prog;
bool fs_dirty, vs_dirty, gs_dirty, tcs_dirty, tes_dirty; bool fs_dirty, vs_dirty, gs_dirty, tcs_dirty, tes_dirty;
bool dual_src = util_blend_state_is_dual(&sub_ctx->blend_state, 0); bool dual_src = util_blend_state_is_dual(&sub_ctx->blend_state, 0);
bool same_prog;
bool new_program = false; bool new_program = false;
struct vrend_shader_selector **shaders = sub_ctx->shaders; struct vrend_shader_selector **shaders = sub_ctx->shaders;
@ -4473,19 +4471,13 @@ vrend_select_program(struct vrend_sub_context *sub_ctx, const struct pipe_draw_i
GLuint tcs_id = shaders[PIPE_SHADER_TESS_CTRL] ? shaders[PIPE_SHADER_TESS_CTRL]->current->id : 0; GLuint tcs_id = shaders[PIPE_SHADER_TESS_CTRL] ? shaders[PIPE_SHADER_TESS_CTRL]->current->id : 0;
GLuint tes_id = shaders[PIPE_SHADER_TESS_EVAL] ? shaders[PIPE_SHADER_TESS_EVAL]->current->id : 0; GLuint tes_id = shaders[PIPE_SHADER_TESS_EVAL] ? shaders[PIPE_SHADER_TESS_EVAL]->current->id : 0;
same_prog = true; bool same_prog = sub_ctx->prog &&
if (vs_id != sub_ctx->prog_ids[PIPE_SHADER_VERTEX]) vs_id == sub_ctx->prog_ids[PIPE_SHADER_VERTEX] &&
same_prog = false; fs_id == sub_ctx->prog_ids[PIPE_SHADER_FRAGMENT] &&
if (fs_id != sub_ctx->prog_ids[PIPE_SHADER_FRAGMENT]) gs_id == sub_ctx->prog_ids[PIPE_SHADER_GEOMETRY] &&
same_prog = false; tcs_id == sub_ctx->prog_ids[PIPE_SHADER_TESS_CTRL] &&
if (gs_id != sub_ctx->prog_ids[PIPE_SHADER_GEOMETRY]) tes_id == sub_ctx->prog_ids[PIPE_SHADER_TESS_EVAL] &&
same_prog = false; sub_ctx->prog->dual_src_linked == dual_src;
if (sub_ctx->prog && sub_ctx->prog->dual_src_linked != dual_src)
same_prog = false;
if (tcs_id != sub_ctx->prog_ids[PIPE_SHADER_TESS_CTRL])
same_prog = false;
if (tes_id != sub_ctx->prog_ids[PIPE_SHADER_TESS_EVAL])
same_prog = false;
if (!same_prog) { if (!same_prog) {
prog = lookup_shader_program(sub_ctx, vs_id, fs_id, gs_id, tcs_id, tes_id, dual_src); prog = lookup_shader_program(sub_ctx, vs_id, fs_id, gs_id, tcs_id, tes_id, dual_src);

Loading…
Cancel
Save