nv50/ir/nir: add workaround for double vertex attribs
authorKarol Herbst <kherbst@redhat.com>
Sun, 14 Jun 2020 09:46:46 +0000 (11:46 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 22 Jun 2020 11:41:31 +0000 (11:41 +0000)
Gallium adjusts the vertrix attrib types for doubles, but can run out of
bounds this way. As the slot is counted from 0 anyway, just fix it.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Tested-by: Ben Skeggs <bskeggs@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5512>

src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp

index 90ce9ebd2ebc7654c3ef6db81dbfb1dbb23f879f..81aa7af63ba922bc1fbcd7b6463179ef2cd2003d 100644 (file)
@@ -989,6 +989,8 @@ bool Converter::assignSlots() {
             info->numPatchConstants = MAX2(info->numPatchConstants, index + slots);
          break;
       case Program::TYPE_VERTEX:
+         if (slot >= VERT_ATTRIB_GENERIC0)
+            slot = VERT_ATTRIB_GENERIC0 + vary;
          vert_attrib_to_tgsi_semantic((gl_vert_attrib)slot, &name, &index);
          switch (name) {
          case TGSI_SEMANTIC_EDGEFLAG: