vrend: Don't crash when no feat_dual_src_blend

When there is no feat_dual_src_blend, avoid calling glBindFragDataLocationIndexed.
Otherwise epoxy could crash the whole process when this function is not available.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Lepton Wu 5 years ago committed by Gert Wollny
parent ec76a36521
commit fc43ff62a5
  1. 3
      src/virgl_hw.h
  2. 14
      src/vrend_renderer.c

@ -555,7 +555,8 @@ enum virgl_ctx_errors {
VIRGL_ERROR_GL_ANY_SAMPLES_PASSED,
VIRGL_ERROR_CTX_ILLEGAL_FORMAT,
VIRGL_ERROR_CTX_ILLEGAL_SAMPLER_VIEW_TARGET,
VIRGL_ERROR_CTX_TRANSFER_IOV_BOUNDS
VIRGL_ERROR_CTX_TRANSFER_IOV_BOUNDS,
VIRGL_ERROR_CTX_ILLEGAL_DUAL_SRC_BLEND
};
#define VIRGL_RESOURCE_Y_0_TOP (1 << 0)

@ -1525,12 +1525,18 @@ static struct vrend_linked_shader_program *add_shader_program(struct vrend_conte
if (fs->sel->sinfo.num_outputs > 1) {
if (util_blend_state_is_dual(&ctx->sub->blend_state, 0)) {
glBindFragDataLocationIndexed(prog_id, 0, 0, "fsout_c0");
glBindFragDataLocationIndexed(prog_id, 0, 1, "fsout_c1");
if (has_feature(feat_dual_src_blend)) {
glBindFragDataLocationIndexed(prog_id, 0, 0, "fsout_c0");
glBindFragDataLocationIndexed(prog_id, 0, 1, "fsout_c1");
} else {
report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_DUAL_SRC_BLEND, 0);
}
sprog->dual_src_linked = true;
} else {
glBindFragDataLocationIndexed(prog_id, 0, 0, "fsout_c0");
glBindFragDataLocationIndexed(prog_id, 1, 0, "fsout_c1");
if (has_feature(feat_dual_src_blend)) {
glBindFragDataLocationIndexed(prog_id, 0, 0, "fsout_c0");
glBindFragDataLocationIndexed(prog_id, 1, 0, "fsout_c1");
}
sprog->dual_src_linked = false;
}
} else

Loading…
Cancel
Save