Commit 2810be9f authored by Danylo Piliaiev's avatar Danylo Piliaiev 💬
Browse files

freedreno/a6xx: fix point-coord origin handling

ir3_point_sprite() overrode the origin of a sprite coord,
we could just use a gallium helper instead.

Rename sprite_coord_mode into sprite_origin_upper_left,
which would be a better fit for a flag.

When deciding whether to take a fast path in
fd6_program_interp_state we should also take into
account sprite_origin_upper_left.

Delete ir3_point_sprite() since we removed the last
place it was used.

Fixes: a474d48e

 "freedreno/a6xx: use point-coord helper"
Signed-off-by: Danylo Piliaiev's avatarDanylo Piliaiev <dpiliaiev@igalia.com>
parent d93da730
......@@ -180,7 +180,8 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
},
.rasterflat = ctx->rasterizer->flatshade,
.sprite_coord_enable = ctx->rasterizer->sprite_coord_enable,
.sprite_coord_mode = ctx->rasterizer->sprite_coord_mode,
.sprite_origin_upper_left =
ctx->rasterizer->sprite_coord_mode == PIPE_SPRITE_COORD_UPPER_LEFT,
.primitive_restart = info->primitive_restart && info->index_size,
};
......
......@@ -92,7 +92,7 @@ struct fd6_emit {
enum fd_dirty_3d_state dirty;
uint32_t sprite_coord_enable; /* bitmask */
bool sprite_coord_mode;
bool sprite_origin_upper_left;
bool rasterflat;
bool no_decode_srgb;
bool primitive_restart;
......
......@@ -28,6 +28,7 @@
#include "pipe/p_state.h"
#include "util/u_string.h"
#include "util/u_memory.h"
#include "util/u_helpers.h"
#include "util/u_inlines.h"
#include "util/format/u_format.h"
#include "util/bitset.h"
......@@ -990,7 +991,8 @@ fd6_program_interp_state(struct fd6_emit *emit)
{
const struct fd6_program_state *state = fd6_emit_get_prog(emit);
if (!unlikely(emit->rasterflat || emit->sprite_coord_enable)) {
if (!unlikely(emit->rasterflat || emit->sprite_coord_enable ||
emit->sprite_origin_upper_left)) {
/* fastpath: */
return fd_ringbuffer_ref(state->interp_stateobj);
} else {
......@@ -998,7 +1000,7 @@ fd6_program_interp_state(struct fd6_emit *emit)
emit->ctx->batch->submit, 18 * 4, FD_RINGBUFFER_STREAMING);
emit_interp_state(ring, state->fs, emit->rasterflat,
emit->sprite_coord_mode, emit->sprite_coord_enable);
emit->sprite_origin_upper_left, emit->sprite_coord_enable);
return ring;
}
......@@ -1006,7 +1008,7 @@ fd6_program_interp_state(struct fd6_emit *emit)
static void
emit_interp_state(struct fd_ringbuffer *ring, struct ir3_shader_variant *fs,
bool rasterflat, bool sprite_coord_mode, uint32_t sprite_coord_enable)
bool rasterflat, bool sprite_origin_upper_left, uint32_t sprite_coord_enable)
{
uint32_t vinterp[8], vpsrepl[8];
......@@ -1035,14 +1037,13 @@ emit_interp_state(struct fd_ringbuffer *ring, struct ir3_shader_variant *fs,
}
}
bool coord_mode = sprite_coord_mode;
if (ir3_point_sprite(fs, j, sprite_coord_enable, &coord_mode)) {
if (util_varying_is_point_coord(fs->inputs[j].slot, sprite_coord_enable)) {
/* mask is two 2-bit fields, where:
* '01' -> S
* '10' -> T
* '11' -> 1 - T (flip mode)
*/
unsigned mask = coord_mode ? 0b1101 : 0b1001;
unsigned mask = sprite_origin_upper_left ? 0b1001 : 0b1101;
uint32_t loc = inloc;
if (compmask & 0x1) {
vpsrepl[loc / 16] |= ((mask >> 0) & 0x3) << ((loc % 16) * 2);
......
......@@ -50,24 +50,4 @@ void ir3_shader_state_delete(struct pipe_context *pctx, void *hwcso);
void ir3_prog_init(struct pipe_context *pctx);
void ir3_screen_init(struct pipe_screen *pscreen);
/**
* A helper to determine if a fs input 'i' is point/sprite coord, given
* the specified sprite_coord_enable mask
*/
static inline bool
ir3_point_sprite(const struct ir3_shader_variant *fs, int i,
uint32_t sprite_coord_enable, bool *coord_mode)
{
gl_varying_slot slot = fs->inputs[i].slot;
switch (slot) {
case VARYING_SLOT_PNTC:
*coord_mode = true;
return true;
case VARYING_SLOT_TEX0 ... VARYING_SLOT_TEX7:
return !!(sprite_coord_enable & BITFIELD_BIT(slot - VARYING_SLOT_TEX0));
default:
return false;
}
}
#endif /* IR3_GALLIUM_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment