From 8c67989fc5d45a28b182cd394b2b13a15230f3fa Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 22 Jul 2019 11:05:17 +0200 Subject: [PATCH] shader: Emit swizzle based on write mask for MAX and MIN ops This is needed for emulating GL_ARB/EXT_DEPTH_CLAMP on GLES hosts that don't support it. Related #108 Signed-off-by: Gert Wollny Reviewed-by: Gurchetan Singh --- src/vrend_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 3593329..921e493 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -4679,13 +4679,13 @@ iter_instruction(struct tgsi_iterate_context *iter, case TGSI_OPCODE_DMAX: case TGSI_OPCODE_IMAX: case TGSI_OPCODE_UMAX: - emit_buff(ctx, "%s = %s(%s(max(%s, %s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1]); + emit_buff(ctx, "%s = %s(%s(max(%s, %s))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], writemask); break; case TGSI_OPCODE_MIN: case TGSI_OPCODE_DMIN: case TGSI_OPCODE_IMIN: case TGSI_OPCODE_UMIN: - emit_buff(ctx, "%s = %s(%s(min(%s, %s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1]); + emit_buff(ctx, "%s = %s(%s(min(%s, %s))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], writemask); break; case TGSI_OPCODE_ABS: case TGSI_OPCODE_IABS: