From 8bed497ee75a19a2d01b9f03c8fbc20b1f518d3a Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 12 Aug 2021 14:38:56 +0200 Subject: [PATCH] shader: Emit the correct swizzling when reading from clip_dist_temp Fixes: KHR-GL43.cull_distance.functional Signed-off-by: Gert Wollny Reviewed-by: Rohan Garg --- src/vrend_shader.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 78c017a..f03e135 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -3062,6 +3062,14 @@ void load_clipdist_fs(const struct dump_ctx *ctx, { char clip_indirect[32] = ""; + char swz[5] = { + get_swiz_char(src->Register.SwizzleX), + get_swiz_char(src->Register.SwizzleY), + get_swiz_char(src->Register.SwizzleZ), + get_swiz_char(src->Register.SwizzleW), + 0 + }; + int base_idx = ctx->inputs[input_idx].sid; /* With arrays enabled , but only when gl_ClipDistance or gl_CullDistance are emitted (>4) @@ -3072,9 +3080,9 @@ void load_clipdist_fs(const struct dump_ctx *ctx, snprintf(clip_indirect, 32, "%d + %d", src->Register.Index - offset, base_idx); if (gl_in) - strbuf_fmt(result, "%s(clip_dist_temp[%s])", stypeprefix, clip_indirect); + strbuf_fmt(result, "%s(clip_dist_temp[%s].%s)", stypeprefix, clip_indirect, swz); else - strbuf_fmt(result, "%s(clip_dist_temp[%s])", stypeprefix, clip_indirect); + strbuf_fmt(result, "%s(clip_dist_temp[%s].%s)", stypeprefix, clip_indirect, swz); }