From a99bde785237551dd35c493223e5ad937bb34a52 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 14 Jan 2022 12:50:25 +0100 Subject: [PATCH] vrend: Cleanup use of glBindFragDataLocationIndexed With GLES we always set the correct binding if dual source blend is disabled, with OpenGL we still have to do this to handle outputs that might be optimized away. v2: Fix comment (Yiwei Zhang) Signed-off-by: Gert Wollny Reviewed-by: Yiwei Zhang --- src/vrend_renderer.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index c38dbce..07e21e5 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1667,19 +1667,16 @@ static struct vrend_linked_shader_program *add_shader_program(struct vrend_sub_c } else { vrend_report_context_error(sub_ctx->parent, VIRGL_ERROR_CTX_ILLEGAL_DUAL_SRC_BLEND, 0); } - } else if (has_feature(feat_dual_src_blend)) { + } else if (!vrend_state.use_gles && has_feature(feat_dual_src_blend)) { + /* On GLES without dual source blending we emit the layout directly in the shader + * so there is no need to define the binding here */ for (int i = 0; i < fs->sel->sinfo.num_outputs; ++i) { if (fs->sel->sinfo.fs_output_layout[i] >= 0) { char buf[64]; snprintf(buf, sizeof(buf), "fsout_c%d", fs->sel->sinfo.fs_output_layout[i]); - if (!vrend_state.use_gles) - glBindFragDataLocationIndexed(prog_id, fs->sel->sinfo.fs_output_layout[i], 0, buf); - else - glBindFragDataLocationIndexedEXT(prog_id, fs->sel->sinfo.fs_output_layout[i], 0, buf); + glBindFragDataLocationIndexed(prog_id, fs->sel->sinfo.fs_output_layout[i], 0, buf); } } - } else { - vrend_report_context_error(sub_ctx->parent, VIRGL_ERROR_CTX_UNSUPPORTED_FUNCTION, 0); } } else sprog->dual_src_linked = false;