summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-05-21 12:22:35 +1000
committerDave Airlie <airlied@redhat.com>2018-06-05 12:51:59 +1000
commit9d4b1c60d085ded50e502c7103907cc559c4a42b (patch)
tree375ff60de444d8460b793d6790946eae06900ab7
parenta06909a7c6f8b7cc3fe8a0efe418155bc366f366 (diff)
move clipdist swizzle to new api
-rw-r--r--src/vrend_shader.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 2cc209e..b73bd2b 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -2056,8 +2056,8 @@ static void
create_swizzled_clipdist(struct dump_ctx *ctx,
char *result,
const struct tgsi_full_src_register *src,
- int input_idx,
- bool gl_in,
+ int sid,
+ int direction,
const char *stypeprefix,
const char *prefix,
const char *arrayname)
@@ -2068,8 +2068,8 @@ create_swizzled_clipdist(struct dump_ctx *ctx,
int num_culls = has_prev_vals ? ctx->key->prev_stage_num_cull_out : 0;
int num_clips = has_prev_vals ? ctx->key->prev_stage_num_clip_out : ctx->num_in_clip_dist;
for (unsigned cc = 0; cc < 4; cc++) {
- const char *cc_name = ctx->inputs[input_idx].glsl_name;
- idx = ctx->inputs[input_idx].sid * 4;
+ const char *cc_name = "gl_ClipDistance";
+ idx = sid * 4;
if (cc == 0)
idx += src->Register.SwizzleX;
else if (cc == 1)
@@ -2092,8 +2092,10 @@ create_swizzled_clipdist(struct dump_ctx *ctx,
if (idx >= ctx->key->prev_stage_num_clip_out)
idx = 0;
}
- if (gl_in)
+ if (direction == -1)
snprintf(clipdistvec[cc], 64, "%sgl_in%s.%s[%d]", prefix, arrayname, cc_name, idx);
+ else if (direction == 1)
+ snprintf(clipdistvec[cc], 64, "%sgl_out%s.%s[%d]", prefix, arrayname, cc_name, idx);
else
snprintf(clipdistvec[cc], 64, "%s%s%s[%d]", prefix, arrayname, cc_name, idx);
}
@@ -2369,7 +2371,7 @@ get_source_info(struct dump_ctx *ctx,
else if (ctx->inputs[j].glsl_gl_block) {
/* GS input clipdist requires a conversion */
if (ctx->inputs[j].name == TGSI_SEMANTIC_CLIPDIST) {
- create_swizzled_clipdist(ctx, srcs[i], src, j, true, get_string(stypeprefix), prefix, arrayname);
+ create_swizzled_clipdist(ctx, srcs[i], src, ctx->inputs[j].sid, -1, stypeprefix, prefix, arrayname);
} else {
snprintf(srcs[i], 255, "%s(vec4(%sgl_in%s.%s)%s)", get_string(stypeprefix), prefix, arrayname, ctx->inputs[j].glsl_name, swizzle);
}
@@ -2379,7 +2381,7 @@ get_source_info(struct dump_ctx *ctx,
else if (ctx->inputs[j].name == TGSI_SEMANTIC_FACE)
snprintf(srcs[i], 255, "%s(%s ? 1.0 : -1.0)", get_string(stypeprefix), ctx->inputs[j].glsl_name);
else if (ctx->inputs[j].name == TGSI_SEMANTIC_CLIPDIST) {
- create_swizzled_clipdist(ctx, srcs[i], src, j, false, get_string(stypeprefix), prefix, arrayname);
+ create_swizzled_clipdist(ctx, srcs[i], src, j, 0, stypeprefix, prefix, arrayname);
} else {
enum vrend_type_qualifier srcstypeprefix = stypeprefix;
if (stype == TGSI_TYPE_UNSIGNED &&