zink/spirv: alias var0 on tex0 etc instead
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 23 Jul 2019 15:55:51 +0000 (17:55 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:48 +0000 (08:51 +0000)
This fixes Quake3, and is more in line with directx semantics.

Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index 96f1f5433213952e364f0c56bbb72529d72c52b3..73b817bf4d446bdc602e08bd193a21c86a828163 100644 (file)
@@ -235,7 +235,9 @@ emit_input(struct ntv_context *ctx, struct nir_variable *var)
    if (ctx->stage == MESA_SHADER_FRAGMENT) {
       if (var->data.location >= VARYING_SLOT_VAR0)
          spirv_builder_emit_location(&ctx->builder, var_id,
-                                     var->data.location - VARYING_SLOT_VAR0);
+                                     var->data.location -
+                                     VARYING_SLOT_VAR0 +
+                                     VARYING_SLOT_TEX0);
       else if ((var->data.location >= VARYING_SLOT_COL0 &&
                 var->data.location <= VARYING_SLOT_TEX7) ||
                var->data.location == VARYING_SLOT_BFC0 ||
@@ -291,7 +293,9 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var)
    if (ctx->stage == MESA_SHADER_VERTEX) {
       if (var->data.location >= VARYING_SLOT_VAR0)
          spirv_builder_emit_location(&ctx->builder, var_id,
-                                     var->data.location - VARYING_SLOT_VAR0);
+                                     var->data.location -
+                                     VARYING_SLOT_VAR0 +
+                                     VARYING_SLOT_TEX0);
       else if ((var->data.location >= VARYING_SLOT_COL0 &&
                 var->data.location <= VARYING_SLOT_TEX7) ||
                var->data.location == VARYING_SLOT_BFC0 ||