Mesa (staging/21.3): st: Fix 64-bit vertex attrib index for TGSI path
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Oct 18 20:57:13 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: e66da3a99612ce275f055151168891dfd6d5f704
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e66da3a99612ce275f055151168891dfd6d5f704
Author: Neha Bhende <bhenden at vmware.com>
Date: Thu Oct 14 09:37:21 2021 -0700
st: Fix 64-bit vertex attrib index for TGSI path
Patch 77c2b022a0c5 removed lowering of 64-bit vertex attribs to 32bits.
This has thrown TGSI translation off the guard for 64bit attrib.
This lead to fail/crash of 1000+ piglit tests.
This patch basically fixes 64 bit attrib index for TGSI shader by adding placeholder
for second part of a double attribute.
It fixes all regressed piglit tests.
A big help from Charmaine to fix this regression
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Fixes: 77c2b022a0c5 ("st/mesa: remove lowering of 64-bit vertex attribs to 32 bits")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13363>
(cherry picked from commit be6d584de43966ee58bf1fcac156ebf8040081d1)
---
.pick_status.json | 2 +-
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 6b53e0ac7c8..0164897c39d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
"description": "st: Fix 64-bit vertex attrib index for TGSI path",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "77c2b022a0c52d84b289bc836f30ce186a374d0d"
},
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a7e7c78c340..dcbdb096deb 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6650,7 +6650,7 @@ st_translate_program(
glsl_to_tgsi_visitor *program,
const struct gl_program *proginfo,
GLuint numInputs,
- const ubyte inputMapping[],
+ const ubyte attrToIndex[],
const ubyte inputSlotToAttr[],
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
@@ -6666,6 +6666,7 @@ st_translate_program(
struct gl_program_constants *prog_const =
&ctx->Const.Program[program->shader->Stage];
enum pipe_error ret = PIPE_OK;
+ uint8_t inputMapping[VARYING_SLOT_TESS_MAX] = {0};
assert(numInputs <= ARRAY_SIZE(t->inputs));
assert(numOutputs <= ARRAY_SIZE(t->outputs));
@@ -6683,6 +6684,27 @@ st_translate_program(
ASSERT_BITFIELD_SIZE(glsl_to_tgsi_instruction, op,
(enum tgsi_opcode) (TGSI_OPCODE_LAST - 1));
+ if (proginfo->DualSlotInputs != 0) {
+ /* adjust attrToIndex to include placeholder for second
+ * part of a double attribute
+ */
+ numInputs = 0;
+ for (unsigned attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
+ if ((proginfo->info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
+ inputMapping[attr] = numInputs++;
+
+ if ((proginfo->DualSlotInputs & BITFIELD64_BIT(attr)) != 0) {
+ /* add placeholder for second part of a double attribute */
+ numInputs++;
+ }
+ }
+ }
+ inputMapping[VERT_ATTRIB_EDGEFLAG] = numInputs;
+ }
+ else {
+ memcpy(inputMapping, attrToIndex, sizeof(inputMapping));
+ }
+
t = CALLOC_STRUCT(st_translate);
if (!t) {
ret = PIPE_ERROR_OUT_OF_MEMORY;
More information about the mesa-commit
mailing list