mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 06:20:19 +01:00
vc4: Add support for the FACE semantic.
Fixes glsl-fs-frontfacing.
This commit is contained in:
parent
1bf2d17a60
commit
d7a0502a54
5 changed files with 24 additions and 1 deletions
|
|
@ -953,6 +953,19 @@ emit_fragment_input(struct vc4_compile *c, int attr,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
emit_face_input(struct vc4_compile *c, int attr)
|
||||
{
|
||||
c->inputs[attr * 4 + 0] = qir_FSUB(c,
|
||||
qir_uniform_f(c, 1.0),
|
||||
qir_FMUL(c,
|
||||
qir_ITOF(c, qir_FRAG_REV_FLAG(c)),
|
||||
qir_uniform_f(c, 2.0)));
|
||||
c->inputs[attr * 4 + 1] = qir_uniform_f(c, 0.0);
|
||||
c->inputs[attr * 4 + 2] = qir_uniform_f(c, 0.0);
|
||||
c->inputs[attr * 4 + 3] = qir_uniform_f(c, 1.0);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_tgsi_declaration(struct vc4_compile *c,
|
||||
struct tgsi_full_declaration *decl)
|
||||
|
|
@ -974,6 +987,8 @@ emit_tgsi_declaration(struct vc4_compile *c,
|
|||
if (decl->Semantic.Name ==
|
||||
TGSI_SEMANTIC_POSITION) {
|
||||
emit_fragcoord_input(c, i);
|
||||
} else if (decl->Semantic.Name == TGSI_SEMANTIC_FACE) {
|
||||
emit_face_input(c, i);
|
||||
} else if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC &&
|
||||
(c->fs_key->point_sprite_mask &
|
||||
(1 << decl->Semantic.Index))) {
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ static const struct qir_op_info qir_op_info[] = {
|
|||
[QOP_FRAG_Y] = { "frag_y", 1, 0 },
|
||||
[QOP_FRAG_Z] = { "frag_z", 1, 0 },
|
||||
[QOP_FRAG_W] = { "frag_w", 1, 0 },
|
||||
[QOP_FRAG_REV_FLAG] = { "frag_rev_flag", 1, 0 },
|
||||
|
||||
[QOP_TEX_S] = { "tex_s", 0, 2 },
|
||||
[QOP_TEX_T] = { "tex_t", 0, 2 },
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ enum qop {
|
|||
QOP_FRAG_Y,
|
||||
QOP_FRAG_Z,
|
||||
QOP_FRAG_W,
|
||||
QOP_FRAG_REV_FLAG,
|
||||
|
||||
QOP_UNPACK_8A,
|
||||
QOP_UNPACK_8B,
|
||||
|
|
@ -377,6 +378,7 @@ QIR_ALU0(FRAG_X)
|
|||
QIR_ALU0(FRAG_Y)
|
||||
QIR_ALU0(FRAG_Z)
|
||||
QIR_ALU0(FRAG_W)
|
||||
QIR_ALU0(FRAG_REV_FLAG)
|
||||
QIR_ALU0(TEX_RESULT)
|
||||
QIR_ALU0(TLB_COLOR_READ)
|
||||
QIR_NODST_1(TLB_Z_WRITE)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ enum qpu_raddr {
|
|||
QPU_R_ELEM_QPU = 38,
|
||||
QPU_R_NOP,
|
||||
QPU_R_XY_PIXEL_COORD = 41,
|
||||
QPU_R_MS_REV_FLAGS = 41,
|
||||
QPU_R_MS_REV_FLAGS = 42,
|
||||
QPU_R_VPM = 48,
|
||||
QPU_R_VPM_LD_BUSY,
|
||||
QPU_R_VPM_LD_WAIT,
|
||||
|
|
|
|||
|
|
@ -426,6 +426,11 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
|
|||
qpu_rb(QPU_R_XY_PIXEL_COORD)));
|
||||
break;
|
||||
|
||||
case QOP_FRAG_REV_FLAG:
|
||||
queue(c, qpu_a_ITOF(dst,
|
||||
qpu_rb(QPU_R_MS_REV_FLAGS)));
|
||||
break;
|
||||
|
||||
case QOP_FRAG_Z:
|
||||
case QOP_FRAG_W:
|
||||
/* QOP_FRAG_Z/W don't emit instructions, just allocate
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue