From 75c1ae09193c6c3cc2f057acf65a075bc3d93764 Mon Sep 17 00:00:00 2001 From: Lepton Wu Date: Thu, 27 Aug 2020 16:49:30 -0700 Subject: [PATCH] shader: Skip explicit location for dual_src_blend If host support dual_src_blend extension, it's possible we need to call glBindFragDataLocationIndexed to set fragment output location. We can't explicitly set it in GLSL in such cases. Fixes: b17ba74 ("shader: Add layout qualifier to fragment shader outputs") Signed-off-by: Lepton Wu Reviewed-by: David Riley --- src/vrend_renderer.c | 1 + src/vrend_shader.c | 3 ++- src/vrend_shader.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 9c34530..28172e1 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -6237,6 +6237,7 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de grctx->shader_cfg.has_es31_compat = has_feature(feat_gles31_compatibility); grctx->shader_cfg.has_conservative_depth = has_feature(feat_conservative_depth); grctx->shader_cfg.use_integer = vrend_state.use_integer; + grctx->shader_cfg.has_dual_src_blend = has_feature(feat_dual_src_blend); vrend_renderer_create_sub_ctx(grctx, 0); vrend_renderer_set_sub_ctx(grctx, 0); diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 1396ce6..0124fb4 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -6336,7 +6336,8 @@ static void emit_ios_fs(struct dump_ctx *ctx) char prefix[64] = ""; if (ctx->cfg->use_gles && - ctx->outputs[i].name == TGSI_SEMANTIC_COLOR) + ctx->outputs[i].name == TGSI_SEMANTIC_COLOR && + !ctx->cfg->has_dual_src_blend) sprintf(prefix, "layout(location = %d)", ctx->outputs[i].sid); emit_ios_generic(ctx, io_out, prefix, &ctx->outputs[i], diff --git a/src/vrend_shader.h b/src/vrend_shader.h index 284cf13..9f199c4 100644 --- a/src/vrend_shader.h +++ b/src/vrend_shader.h @@ -169,6 +169,7 @@ struct vrend_shader_cfg { bool has_es31_compat; bool has_conservative_depth; bool use_integer; + bool has_dual_src_blend; }; struct vrend_context;