mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
panfrost: Implement gl_FrontFacing
Interestingly, this requires no compiler changes. It's just exposed as a special varying. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
f3e15122d4
commit
e913986868
4 changed files with 27 additions and 0 deletions
|
|
@ -144,6 +144,12 @@ panfrost_shader_compile(struct panfrost_context *ctx, struct mali_shader_meta *m
|
|||
v.swizzle = default_vec2_swizzle;
|
||||
|
||||
state->reads_point_coord = true;
|
||||
} else if (location == VARYING_SLOT_FACE) {
|
||||
v.index = 4;
|
||||
v.format = MALI_R32I;
|
||||
v.swizzle = default_vec1_swizzle;
|
||||
|
||||
state->reads_face = true;
|
||||
} else {
|
||||
v.index = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -516,6 +516,12 @@ panfrost_emit_point_coord(union mali_attr *slot)
|
|||
slot->stride = slot->size = slot->shift = slot->extra_flags = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_emit_front_face(union mali_attr *slot)
|
||||
{
|
||||
slot->elements = MALI_VARYING_FRONT_FACING | MALI_ATTR_INTERNAL;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_emit_varying_descriptor(
|
||||
struct panfrost_context *ctx,
|
||||
|
|
@ -618,11 +624,20 @@ panfrost_emit_varying_descriptor(
|
|||
ctx->payload_tiler.primitive_size.pointer =
|
||||
panfrost_emit_varyings(ctx, &varyings[idx++],
|
||||
2, vertex_count);
|
||||
} else if (fs->reads_face) {
|
||||
/* Dummy to advance index */
|
||||
++idx;
|
||||
}
|
||||
|
||||
if (fs->reads_point_coord) {
|
||||
/* Special descriptor */
|
||||
panfrost_emit_point_coord(&varyings[idx++]);
|
||||
} else if (fs->reads_face) {
|
||||
++idx;
|
||||
}
|
||||
|
||||
if (fs->reads_face) {
|
||||
panfrost_emit_front_face(&varyings[idx++]);
|
||||
}
|
||||
|
||||
mali_ptr varyings_p = panfrost_upload_transient(ctx, &varyings, idx * sizeof(union mali_attr));
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ struct panfrost_shader_state {
|
|||
bool can_discard;
|
||||
bool writes_point_size;
|
||||
bool reads_point_coord;
|
||||
bool reads_face;
|
||||
|
||||
struct mali_attr_meta varyings[PIPE_MAX_ATTRIBS];
|
||||
gl_varying_slot varyings_loc[PIPE_MAX_ATTRIBS];
|
||||
|
|
|
|||
|
|
@ -168,6 +168,11 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|||
case PIPE_CAP_GENERATE_MIPMAP:
|
||||
return 1;
|
||||
|
||||
/* We would prefer varyings */
|
||||
case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
|
||||
case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_SEAMLESS_CUBE_MAP:
|
||||
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue