summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Herbst <git@karolherbst.de>2023-08-02 15:34:29 +0200
committerKarol Herbst <git@karolherbst.de>2023-08-05 00:39:34 +0200
commit286e58b8d8adaeee79b6b38009df6cdc12f9f741 (patch)
tree416fde4fef8bf1350519f6ec3e0dc6b32633ee0b
parentf5c41c4b78f330d6dde690f7443408d5453781a3 (diff)
nv50/ir: convert system values to gl_system_value
Signed-off-by: Karol Herbst <git@karolherbst.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24447>
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_program.c6
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_program.c8
-rw-r--r--src/nouveau/codegen/nv50_ir_driver.h3
-rw-r--r--src/nouveau/codegen/nv50_ir_from_nir.cpp15
-rw-r--r--src/nouveau/codegen/nv50_ir_target_nv50.cpp10
-rw-r--r--src/nouveau/vulkan/nvk_shader.c8
6 files changed, 19 insertions, 31 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index 523b2a74302..f38b98d6905 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -64,14 +64,14 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info_out *info)
for (i = 0; i < info->numSysVals; ++i) {
switch (info->sv[i].sn) {
- case TGSI_SEMANTIC_INSTANCEID:
+ case SYSTEM_VALUE_INSTANCE_ID:
prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_INSTANCE_ID;
continue;
- case TGSI_SEMANTIC_VERTEXID:
+ case SYSTEM_VALUE_VERTEX_ID:
prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID;
prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID_DRAW_ARRAYS_ADD_START;
continue;
- case TGSI_SEMANTIC_PRIMID:
+ case SYSTEM_VALUE_PRIMITIVE_ID:
prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_PRIMITIVE_ID;
break;
default:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index 20e418264cb..b8c9278fb80 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -242,16 +242,16 @@ nvc0_vtgp_gen_header(struct nvc0_program *vp, struct nv50_ir_prog_info_out *info
for (i = 0; i < info->numSysVals; ++i) {
switch (info->sv[i].sn) {
- case TGSI_SEMANTIC_PRIMID:
+ case SYSTEM_VALUE_PRIMITIVE_ID:
vp->hdr[5] |= 1 << 24;
break;
- case TGSI_SEMANTIC_INSTANCEID:
+ case SYSTEM_VALUE_INSTANCE_ID:
vp->hdr[10] |= 1 << 30;
break;
- case TGSI_SEMANTIC_VERTEXID:
+ case SYSTEM_VALUE_VERTEX_ID:
vp->hdr[10] |= 1 << 31;
break;
- case TGSI_SEMANTIC_TESSCOORD:
+ case SYSTEM_VALUE_TESS_COORD:
/* We don't have the mask, nor the slots populated. While this could
* be achieved, the vast majority of the time if either of the coords
* are read, then both will be read.
diff --git a/src/nouveau/codegen/nv50_ir_driver.h b/src/nouveau/codegen/nv50_ir_driver.h
index 34b73a36a2d..ab13e603a26 100644
--- a/src/nouveau/codegen/nv50_ir_driver.h
+++ b/src/nouveau/codegen/nv50_ir_driver.h
@@ -23,6 +23,7 @@
#ifndef __NV50_IR_DRIVER_H__
#define __NV50_IR_DRIVER_H__
+#include "compiler/shader_enums.h"
#include "util/macros.h"
#include "util/blob.h"
@@ -57,7 +58,7 @@ struct nv50_ir_varying
struct nv50_ir_sysval
{
- uint8_t sn; /* TGSI semantic name */
+ gl_system_value sn;
uint8_t slot[4]; /* for nv50: native slots for xyzw (addresses in 32-bit words) */
};
diff --git a/src/nouveau/codegen/nv50_ir_from_nir.cpp b/src/nouveau/codegen/nv50_ir_from_nir.cpp
index ca021f40103..2e442b7fc1e 100644
--- a/src/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -905,20 +905,6 @@ bool Converter::assignSlots() {
uint8_t i;
BITSET_FOREACH_SET(i, nir->info.system_values_read, SYSTEM_VALUE_MAX) {
switch (i) {
- case SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID:
- case SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL:
- case SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE:
- case SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID:
- case SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL:
- case SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE:
- case SYSTEM_VALUE_BASE_GLOBAL_INVOCATION_ID:
- continue;
- default:
- info_out->sv[info_out->numSysVals].sn = tgsi_get_sysval_semantic(i);
- break;
- }
-
- switch (i) {
case SYSTEM_VALUE_VERTEX_ID:
info_out->io.vertexId = info_out->numSysVals;
break;
@@ -929,6 +915,7 @@ bool Converter::assignSlots() {
break;
}
+ info_out->sv[info_out->numSysVals].sn = (gl_system_value)i;
info_out->numSysVals += 1;
}
diff --git a/src/nouveau/codegen/nv50_ir_target_nv50.cpp b/src/nouveau/codegen/nv50_ir_target_nv50.cpp
index 7cb89d38d3c..0b086469662 100644
--- a/src/nouveau/codegen/nv50_ir_target_nv50.cpp
+++ b/src/nouveau/codegen/nv50_ir_target_nv50.cpp
@@ -601,15 +601,15 @@ recordLocationSysVal(uint16_t *locs, uint8_t *masks,
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;
+ case SYSTEM_VALUE_FRAG_COORD: locs[SV_POSITION] = addr; break;
+ case SYSTEM_VALUE_INSTANCE_ID: locs[SV_INSTANCE_ID] = addr; break;
+ case SYSTEM_VALUE_VERTEX_ID: locs[SV_VERTEX_ID] = addr; break;
+ case SYSTEM_VALUE_PRIMITIVE_ID: locs[SV_PRIMITIVE_ID] = addr; break;
default:
break;
}
// TODO is this even hit?
- if (var->sn == TGSI_SEMANTIC_POSITION && masks)
+ if (var->sn == SYSTEM_VALUE_FRAG_COORD && masks)
masks[0] = 0;
}
diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c
index 5e929fb6b58..b693ba5e568 100644
--- a/src/nouveau/vulkan/nvk_shader.c
+++ b/src/nouveau/vulkan/nvk_shader.c
@@ -751,16 +751,16 @@ nvk_vtgp_gen_header(struct nvk_shader *vs, struct nv50_ir_prog_info_out *info)
for (i = 0; i < info->numSysVals; ++i) {
switch (info->sv[i].sn) {
- case TGSI_SEMANTIC_PRIMID:
+ case SYSTEM_VALUE_PRIMITIVE_ID:
vs->hdr[5] |= 1 << 24;
break;
- case TGSI_SEMANTIC_INSTANCEID:
+ case SYSTEM_VALUE_INSTANCE_ID:
vs->hdr[10] |= 1 << 30;
break;
- case TGSI_SEMANTIC_VERTEXID:
+ case SYSTEM_VALUE_VERTEX_ID:
vs->hdr[10] |= 1 << 31;
break;
- case TGSI_SEMANTIC_TESSCOORD:
+ case SYSTEM_VALUE_TESS_COORD:
/* We don't have the mask, nor the slots populated. While this could
* be achieved, the vast majority of the time if either of the coords
* are read, then both will be read.