aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-10-05 16:09:55 -0400
committerJonathan Marek <[email protected]>2019-10-27 16:53:32 +0000
commit521cdde8fc5bcd8601910b16961398eb21365f6e (patch)
tree9f260e0b6372a7fcaf77fceb5d2578ce9d355054
parenta0c003007515e31c63e18f4a3c8abc86814143bf (diff)
freedreno/a2xx: use sysval for pointcoord
Fixes a problem with shaders using gl_PointCoord. Signed-off-by: Jonathan Marek <[email protected]> Reported-by: Fabio Estevam <[email protected]> Tested-by: Fabio Estevam <[email protected]> Reviewed-by: Rob Clark <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/a2xx/ir2_nir.c18
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c2
2 files changed, 9 insertions, 11 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
index 31c9add3b92..53a3c0a6649 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
@@ -504,12 +504,6 @@ load_input(struct ir2_context *ctx, nir_dest *dst, unsigned idx)
assert(slot >= 0);
switch (slot) {
- case VARYING_SLOT_PNTC:
- /* need to extract with abs */
- instr = instr_create_alu_dest(ctx, nir_op_mov, dst);
- instr->src[0] = ir2_src(ctx->f->inputs_count, IR2_SWIZZLE_ZW, IR2_SRC_INPUT);
- instr->src[0].abs = true;
- break;
case VARYING_SLOT_POS:
/* need to extract xy with abs and add tile offset on a20x
* zw from fragcoord input (w inverted in fragment shader)
@@ -638,6 +632,13 @@ emit_intrinsic(struct ir2_context *ctx, nir_intrinsic_instr *intr)
instr->src[0] = ir2_src(tmp->idx, 0, IR2_SRC_SSA);
instr->src[1] = ir2_zero(ctx);
break;
+ case nir_intrinsic_load_point_coord:
+ /* param.zw (note: abs might be needed like fragcoord in param.xy?) */
+ ctx->so->need_param = true;
+
+ instr = instr_create_alu_dest(ctx, nir_op_mov, &intr->dest);
+ instr->src[0] = ir2_src(ctx->f->inputs_count, IR2_SWIZZLE_ZW, IR2_SRC_INPUT);
+ break;
default:
compile_error(ctx, "unimplemented intr %d\n", intr->intrinsic);
break;
@@ -759,11 +760,6 @@ setup_input(struct ir2_context *ctx, nir_variable * in)
if (ctx->so->type != MESA_SHADER_FRAGMENT)
compile_error(ctx, "unknown shader type: %d\n", ctx->so->type);
- if (slot == VARYING_SLOT_PNTC) {
- so->need_param = true;
- return;
- }
-
n = ctx->f->inputs_count++;
/* half of fragcoord from param reg, half from a varying */
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index e10199d0a85..0584ace15cc 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -375,6 +375,8 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 0;
case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
return 1;
+ case PIPE_CAP_TGSI_FS_POINT_IS_SYSVAL:
+ return is_a2xx(screen);
case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
if (is_ir3(screen))