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 14:44:30 +1000
commitf7322c97fd734e44f86fe5eb17afcc78cff6897b (patch)
tree799c37888829baa97fedea2a3d0eb751ba6d18bc
parent5a062e4b647a14170237b5cfcb8ce0816076c24c (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 ce8cb99..3f1c399 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -2048,8 +2048,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)
@@ -2060,8 +2060,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)
@@ -2084,8 +2084,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);
}
@@ -2361,7 +2363,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);
}
@@ -2371,7 +2373,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 &&