aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/zink/nir_to_spirv
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-07-22 16:16:40 +0200
committerErik Faye-Lund <[email protected]>2019-10-28 08:51:48 +0000
commit67a9749adac7cd3f204e9b00389f03d083fbed5a (patch)
tree72ab336958f13f02b6b92517fc3d4dc9e91d5f98 /src/gallium/drivers/zink/nir_to_spirv
parent1f3d2b9f801dc6cd5c58bba5c6b9d0bbe5e302d2 (diff)
zink/spirv: alias generic varyings on non-generic ones
This gets rid of the nasty location-allocation hack. Acked-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/zink/nir_to_spirv')
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 8e34b629a07..2f75d5b70fa 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -35,7 +35,6 @@ struct ntv_context {
SpvId GLSL_std_450;
gl_shader_stage stage;
- int var_location;
SpvId ubos[128];
size_t num_ubos;
@@ -234,11 +233,13 @@ emit_input(struct ntv_context *ctx, struct nir_variable *var)
spirv_builder_emit_name(&ctx->builder, var_id, var->name);
if (ctx->stage == MESA_SHADER_FRAGMENT) {
- if (var->data.location >= VARYING_SLOT_VAR0 ||
- (var->data.location >= VARYING_SLOT_COL0 &&
- var->data.location <= VARYING_SLOT_TEX7)) {
+ if (var->data.location >= VARYING_SLOT_VAR0)
spirv_builder_emit_location(&ctx->builder, var_id,
- ctx->var_location++);
+ var->data.location - VARYING_SLOT_VAR0);
+ else if (var->data.location >= VARYING_SLOT_COL0 &&
+ var->data.location <= VARYING_SLOT_TEX7) {
+ spirv_builder_emit_location(&ctx->builder, var_id,
+ var->data.location);
} else {
switch (var->data.location) {
case VARYING_SLOT_POS:
@@ -286,11 +287,13 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var)
if (ctx->stage == MESA_SHADER_VERTEX) {
- if (var->data.location >= VARYING_SLOT_VAR0 ||
- (var->data.location >= VARYING_SLOT_COL0 &&
- var->data.location <= VARYING_SLOT_TEX7)) {
+ if (var->data.location >= VARYING_SLOT_VAR0)
+ spirv_builder_emit_location(&ctx->builder, var_id,
+ var->data.location - VARYING_SLOT_VAR0);
+ else if (var->data.location >= VARYING_SLOT_COL0 &&
+ var->data.location <= VARYING_SLOT_TEX7) {
spirv_builder_emit_location(&ctx->builder, var_id,
- ctx->var_location++);
+ var->data.location);
} else {
switch (var->data.location) {
case VARYING_SLOT_POS: