mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 03:20:09 +01:00
nv50/ir: use own info struct for sys vals
This makes it more obvious what's actually needed by the driver and allows us to drop some code in the nir to nvir step. Signed-off-by: Karol Herbst <git@karolherbst.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24447>
This commit is contained in:
parent
8c62b3938a
commit
f5c41c4b78
4 changed files with 29 additions and 12 deletions
|
|
@ -55,6 +55,12 @@ struct nv50_ir_varying
|
|||
uint8_t si; /* TGSI semantic index */
|
||||
};
|
||||
|
||||
struct nv50_ir_sysval
|
||||
{
|
||||
uint8_t sn; /* TGSI semantic name */
|
||||
uint8_t slot[4]; /* for nv50: native slots for xyzw (addresses in 32-bit words) */
|
||||
};
|
||||
|
||||
#ifndef NDEBUG
|
||||
# define NV50_IR_DEBUG_BASIC (1 << 0)
|
||||
# define NV50_IR_DEBUG_VERBOSE (2 << 0)
|
||||
|
|
@ -150,7 +156,7 @@ struct nv50_ir_prog_info_out
|
|||
void *fixupData;
|
||||
} bin;
|
||||
|
||||
struct nv50_ir_varying sv[NV50_CODEGEN_MAX_VARYINGS];
|
||||
struct nv50_ir_sysval sv[NV50_CODEGEN_MAX_VARYINGS];
|
||||
struct nv50_ir_varying in[NV50_CODEGEN_MAX_VARYINGS];
|
||||
struct nv50_ir_varying out[NV50_CODEGEN_MAX_VARYINGS];
|
||||
uint8_t numInputs;
|
||||
|
|
|
|||
|
|
@ -915,24 +915,16 @@ bool Converter::assignSlots() {
|
|||
continue;
|
||||
default:
|
||||
info_out->sv[info_out->numSysVals].sn = tgsi_get_sysval_semantic(i);
|
||||
info_out->sv[info_out->numSysVals].si = 0;
|
||||
info_out->sv[info_out->numSysVals].input = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case SYSTEM_VALUE_VERTEX_ID:
|
||||
info_out->sv[info_out->numSysVals].input = 1;
|
||||
info_out->io.vertexId = info_out->numSysVals;
|
||||
break;
|
||||
case SYSTEM_VALUE_INSTANCE_ID:
|
||||
info_out->sv[info_out->numSysVals].input = 1;
|
||||
info_out->io.instanceId = info_out->numSysVals;
|
||||
break;
|
||||
case SYSTEM_VALUE_TESS_LEVEL_INNER:
|
||||
case SYSTEM_VALUE_TESS_LEVEL_OUTER:
|
||||
info_out->sv[info_out->numSysVals].patch = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -955,8 +955,8 @@ nv50_ir_prog_info_out_print(struct nv50_ir_prog_info_out *info_out)
|
|||
if (info_out->numSysVals) {
|
||||
INFO(" \"sv\":[\n");
|
||||
for (i = 0; i < info_out->numSysVals; i++) {
|
||||
INFO(" {\"id\":\"%d\", \"sn\":\"%d\", \"si\":\"%d\"}\n",
|
||||
info_out->sv[i].id, info_out->sv[i].sn, info_out->sv[i].si);
|
||||
INFO(" {\"sn\":\"%d\"}\n",
|
||||
info_out->sv[i].sn);
|
||||
}
|
||||
INFO("\n ],\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,6 +594,25 @@ recordLocation(uint16_t *locs, uint8_t *masks,
|
|||
masks[0] = var->mask;
|
||||
}
|
||||
|
||||
static void
|
||||
recordLocationSysVal(uint16_t *locs, uint8_t *masks,
|
||||
const struct nv50_ir_sysval *var)
|
||||
{
|
||||
uint16_t addr = var->slot[0] * 4;
|
||||
|
||||
switch (var->sn) {
|
||||
case TGSI_SEMANTIC_POSITION: locs[SV_POSITION] = addr; break;
|
||||
case TGSI_SEMANTIC_INSTANCEID: locs[SV_INSTANCE_ID] = addr; break;
|
||||
case TGSI_SEMANTIC_VERTEXID: locs[SV_VERTEX_ID] = addr; break;
|
||||
case TGSI_SEMANTIC_PRIMID: locs[SV_PRIMITIVE_ID] = addr; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// TODO is this even hit?
|
||||
if (var->sn == TGSI_SEMANTIC_POSITION && masks)
|
||||
masks[0] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
TargetNV50::parseDriverInfo(const struct nv50_ir_prog_info *info,
|
||||
const struct nv50_ir_prog_info_out *info_out)
|
||||
|
|
@ -604,7 +623,7 @@ TargetNV50::parseDriverInfo(const struct nv50_ir_prog_info *info,
|
|||
for (i = 0; i < info_out->numInputs; ++i)
|
||||
recordLocation(sysvalLocation, &wposMask, &info_out->in[i]);
|
||||
for (i = 0; i < info_out->numSysVals; ++i)
|
||||
recordLocation(sysvalLocation, NULL, &info_out->sv[i]);
|
||||
recordLocationSysVal(sysvalLocation, NULL, &info_out->sv[i]);
|
||||
|
||||
if (sysvalLocation[SV_POSITION] >= 0x200) {
|
||||
// not assigned by driver, but we need it internally
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue