vrend: Fix calculation of dual_src

Telegram (Android App) shows high cpu usage under
virgl. It turns out when the guest send blend_mode
via alpha_src_factor, BLEND_SOFTLIGHT (0x9) would be
treated as PIPE_BLENDFACTOR_SRC1_COLOR (0x9). The
dual_src didn't match dual_src_linked and virgl keeps
linking the same program.

Fix the logic to calculate dual_src to make it as close
as possible to calculate dual_src_linked.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Lepton Wu 3 years ago
parent 3b393c1171
commit 00b2cb688c
  1. 3
      src/vrend_renderer.c

@ -4693,6 +4693,9 @@ 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 tes_id = shaders[PIPE_SHADER_TESS_EVAL] ? shaders[PIPE_SHADER_TESS_EVAL]->current->id : 0;
if (shaders[PIPE_SHADER_FRAGMENT]->current->sel->sinfo.num_outputs <= 1)
dual_src = false;
bool same_prog = sub_ctx->prog &&
vs_id == sub_ctx->prog_ids[PIPE_SHADER_VERTEX] &&
fs_id == sub_ctx->prog_ids[PIPE_SHADER_FRAGMENT] &&

Loading…
Cancel
Save