freedreno/a2xx: use sysval for pointcoord
authorJonathan Marek <jonathan@marek.ca>
Sat, 5 Oct 2019 20:09:55 +0000 (16:09 -0400)
committerJonathan Marek <jonathan@marek.ca>
Sun, 27 Oct 2019 16:53:32 +0000 (16:53 +0000)
Fixes a problem with shaders using gl_PointCoord.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reported-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/a2xx/ir2_nir.c
src/gallium/drivers/freedreno/freedreno_screen.c

index 31c9add3b92ef80de95e3ca22adf6d5ca1793776..53a3c0a664915e6ebc8c006cf45327196c4b1ee2 100644 (file)
@@ -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 */
index e10199d0a85bedfc3b52b31c9129071d9b5078e7..0584ace15cc03590c79125c5e3d6b55c3e3ff48e 100644 (file)
@@ -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))