mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-27 17:40:43 +00:00
zink: enable tgsi texcoord pipe cap
this requires some modifications to the ntv slot remapping, as we definitely don't want to reserve another 25% of the available slots for the (deprecated) texcoord varyings now we remap VARYING_SLOT_TEX[n] to the last available slots, which lets us avoid needing to do permanent reservation, and we check to make sure that we haven't seen the corresponding texcoord varying any time we emit a non-texcoord varying in that slot Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5551>
This commit is contained in:
parent
05362b075f
commit
5e9cd64f70
@ -36,15 +36,15 @@ static unsigned slot_pack_map[] = {
|
||||
[VARYING_SLOT_COL0] = 0, /* input/output */
|
||||
[VARYING_SLOT_COL1] = 1, /* input/output */
|
||||
[VARYING_SLOT_FOGC] = 2, /* input/output */
|
||||
/* TEX0-7 are translated to VAR0-7 by nir, so we don't need to reserve */
|
||||
[VARYING_SLOT_TEX0] = UINT_MAX, /* input/output */
|
||||
[VARYING_SLOT_TEX1] = UINT_MAX,
|
||||
[VARYING_SLOT_TEX2] = UINT_MAX,
|
||||
[VARYING_SLOT_TEX3] = UINT_MAX,
|
||||
[VARYING_SLOT_TEX4] = UINT_MAX,
|
||||
[VARYING_SLOT_TEX5] = UINT_MAX,
|
||||
[VARYING_SLOT_TEX6] = UINT_MAX,
|
||||
[VARYING_SLOT_TEX7] = UINT_MAX,
|
||||
/* TEX0-7 are deprecated, so we put them at the end of the range and hope nobody uses them all */
|
||||
[VARYING_SLOT_TEX0] = VARYING_SLOT_VAR0 - 1, /* input/output */
|
||||
[VARYING_SLOT_TEX1] = VARYING_SLOT_VAR0 - 2,
|
||||
[VARYING_SLOT_TEX2] = VARYING_SLOT_VAR0 - 3,
|
||||
[VARYING_SLOT_TEX3] = VARYING_SLOT_VAR0 - 4,
|
||||
[VARYING_SLOT_TEX4] = VARYING_SLOT_VAR0 - 5,
|
||||
[VARYING_SLOT_TEX5] = VARYING_SLOT_VAR0 - 6,
|
||||
[VARYING_SLOT_TEX6] = VARYING_SLOT_VAR0 - 7,
|
||||
[VARYING_SLOT_TEX7] = VARYING_SLOT_VAR0 - 8,
|
||||
|
||||
/* PointSize is builtin */
|
||||
[VARYING_SLOT_PSIZ] = UINT_MAX,
|
||||
@ -122,6 +122,9 @@ struct ntv_context {
|
||||
SpvId loop_break, loop_cont;
|
||||
|
||||
SpvId front_face_var, instance_id_var, vertex_id_var;
|
||||
#ifndef NDEBUG
|
||||
bool seen_texcoord[8]; //whether we've seen a VARYING_SLOT_TEX[n] this pass
|
||||
#endif
|
||||
};
|
||||
|
||||
static SpvId
|
||||
@ -284,6 +287,28 @@ get_glsl_type(struct ntv_context *ctx, const struct glsl_type *type)
|
||||
unreachable("we shouldn't get here, I think...");
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
handle_slot(struct ntv_context *ctx, unsigned slot)
|
||||
{
|
||||
unsigned orig = slot;
|
||||
if (slot < VARYING_SLOT_VAR0) {
|
||||
#ifndef NDEBUG
|
||||
if (slot >= VARYING_SLOT_TEX0 && slot <= VARYING_SLOT_TEX7)
|
||||
ctx->seen_texcoord[slot - VARYING_SLOT_TEX0] = true;
|
||||
#endif
|
||||
slot = slot_pack_map[slot];
|
||||
if (slot == UINT_MAX)
|
||||
debug_printf("unhandled varying slot: %s\n", gl_varying_slot_name(orig));
|
||||
} else {
|
||||
slot -= VARYING_SLOT_VAR0 - NTV_MIN_RESERVED_SLOTS;
|
||||
assert(slot <= VARYING_SLOT_VAR0 - 8 ||
|
||||
!ctx->seen_texcoord[VARYING_SLOT_VAR0 - slot - 1]);
|
||||
|
||||
}
|
||||
assert(slot < VARYING_SLOT_VAR0);
|
||||
return slot;
|
||||
}
|
||||
|
||||
#define HANDLE_EMIT_BUILTIN(SLOT, BUILTIN) \
|
||||
case VARYING_SLOT_##SLOT: \
|
||||
spirv_builder_emit_builtin(&ctx->builder, var_id, SpvBuiltIn##BUILTIN); \
|
||||
@ -316,13 +341,7 @@ emit_input(struct ntv_context *ctx, struct nir_variable *var)
|
||||
HANDLE_EMIT_BUILTIN(FACE, FrontFacing);
|
||||
|
||||
default:
|
||||
if (slot < VARYING_SLOT_VAR0) {
|
||||
slot = slot_pack_map[slot];
|
||||
if (slot == UINT_MAX)
|
||||
debug_printf("unhandled varying slot: %s\n", gl_varying_slot_name(var->data.location));
|
||||
} else
|
||||
slot -= VARYING_SLOT_VAR0 - NTV_MIN_RESERVED_SLOTS;
|
||||
assert(slot < VARYING_SLOT_VAR0);
|
||||
slot = handle_slot(ctx, slot);
|
||||
spirv_builder_emit_location(&ctx->builder, var_id, slot);
|
||||
}
|
||||
} else {
|
||||
@ -378,17 +397,8 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var)
|
||||
break;
|
||||
|
||||
default:
|
||||
if (slot < VARYING_SLOT_VAR0) {
|
||||
slot = slot_pack_map[slot];
|
||||
if (slot == UINT_MAX)
|
||||
debug_printf("unhandled varying slot: %s\n", gl_varying_slot_name(var->data.location));
|
||||
} else
|
||||
slot -= VARYING_SLOT_VAR0 - NTV_MIN_RESERVED_SLOTS;
|
||||
assert(slot < VARYING_SLOT_VAR0);
|
||||
slot = handle_slot(ctx, slot);
|
||||
spirv_builder_emit_location(&ctx->builder, var_id, slot);
|
||||
/* non-builtins get location incremented by VARYING_SLOT_VAR0 in vtn, so
|
||||
* use driver_location for non-builtins with defined slots to avoid overlap
|
||||
*/
|
||||
}
|
||||
ctx->outputs[var->data.location] = var_id;
|
||||
ctx->so_output_gl_types[var->data.location] = var->type;
|
||||
@ -895,6 +905,8 @@ emit_so_info(struct ntv_context *ctx, unsigned max_output_location,
|
||||
if (max_output_location >= VARYING_SLOT_VAR0)
|
||||
location = max_output_location - VARYING_SLOT_VAR0 + 1 + i;
|
||||
assert(location < VARYING_SLOT_VAR0);
|
||||
assert(location <= VARYING_SLOT_VAR0 - 8 ||
|
||||
!ctx->seen_texcoord[VARYING_SLOT_VAR0 - location - 1]);
|
||||
spirv_builder_emit_location(&ctx->builder, var_id, location);
|
||||
|
||||
/* note: gl_ClipDistance[4] can the 0-indexed member of VARYING_SLOT_CLIP_DIST1 here,
|
||||
|
@ -95,6 +95,7 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
|
||||
switch (param) {
|
||||
case PIPE_CAP_NPOT_TEXTURES:
|
||||
case PIPE_CAP_TGSI_TEXCOORD:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
|
||||
|
Loading…
Reference in New Issue
Block a user