freedreno/a5xx: use point-coord helper

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5595>
This commit is contained in:
Rob Clark 2020-06-22 08:45:13 -07:00 committed by Marge Bot
parent a474d48e17
commit 3e8c6312c7
1 changed files with 25 additions and 33 deletions

View File

@ -610,40 +610,32 @@ fd5_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring,
} }
} }
gl_varying_slot slot = s[FS].v->inputs[j].slot; bool coord_mode = emit->sprite_coord_mode;
if (ir3_point_sprite(s[FS].v, j, emit->sprite_coord_enable, &coord_mode)) {
/* since we don't enable PIPE_CAP_TGSI_TEXCOORD: */ /* mask is two 2-bit fields, where:
if (slot >= VARYING_SLOT_VAR0) { * '01' -> S
unsigned texmask = 1 << (slot - VARYING_SLOT_VAR0); * '10' -> T
/* Replace the .xy coordinates with S/T from the point sprite. Set * '11' -> 1 - T (flip mode)
* interpolation bits for .zw such that they become .01
*/ */
if (emit->sprite_coord_enable & texmask) { unsigned mask = coord_mode ? 0b1101 : 0b1001;
/* mask is two 2-bit fields, where: uint32_t loc = inloc;
* '01' -> S if (compmask & 0x1) {
* '10' -> T vpsrepl[loc / 16] |= ((mask >> 0) & 0x3) << ((loc % 16) * 2);
* '11' -> 1 - T (flip mode) loc++;
*/ }
unsigned mask = emit->sprite_coord_mode ? 0b1101 : 0b1001; if (compmask & 0x2) {
uint32_t loc = inloc; vpsrepl[loc / 16] |= ((mask >> 2) & 0x3) << ((loc % 16) * 2);
if (compmask & 0x1) { loc++;
vpsrepl[loc / 16] |= ((mask >> 0) & 0x3) << ((loc % 16) * 2); }
loc++; if (compmask & 0x4) {
} /* .z <- 0.0f */
if (compmask & 0x2) { vinterp[loc / 16] |= 0b10 << ((loc % 16) * 2);
vpsrepl[loc / 16] |= ((mask >> 2) & 0x3) << ((loc % 16) * 2); loc++;
loc++; }
} if (compmask & 0x8) {
if (compmask & 0x4) { /* .w <- 1.0f */
/* .z <- 0.0f */ vinterp[loc / 16] |= 0b11 << ((loc % 16) * 2);
vinterp[loc / 16] |= 0b10 << ((loc % 16) * 2); loc++;
loc++;
}
if (compmask & 0x8) {
/* .w <- 1.0f */
vinterp[loc / 16] |= 0b11 << ((loc % 16) * 2);
loc++;
}
} }
} }
} }