Mesa (staging/20.1): radv: Fix handling of attribs 16-31.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 19 00:40:26 UTC 2020
Module: Mesa
Branch: staging/20.1
Commit: 902a3c6971be254fef2b29f2ef6ee8f5b167905f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=902a3c6971be254fef2b29f2ef6ee8f5b167905f
Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date: Sun Aug 9 00:51:15 2020 +0200
radv: Fix handling of attribs 16-31.
We really need to update the enum for consistency, but that involves
a bunch of GL & bitfield work which is error-prone, so since this is
a fix for stable lets do the simple things.
Confirmed that nothing in radv/aco/nir/spirv uses MAX_VERT_ATTRIB
except the one thing I bumped.
CC: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6120>
(cherry picked from commit f038b3a136175c0afcc6545b886238a7b5dcf515)
---
.pick_status.json | 2 +-
src/amd/vulkan/radv_shader.h | 4 +++-
src/amd/vulkan/radv_shader_info.c | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index adc9aef6e06..6cc9af47b16 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -85,7 +85,7 @@
"description": "radv: Fix handling of attribs 16-31.",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index 5b4a61ab336..864ef8b9215 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -35,6 +35,8 @@
#include "nir/nir.h"
#include "vulkan/vulkan.h"
+#define RADV_VERT_ATTRIB_MAX MAX2(VERT_ATTRIB_MAX, VERT_ATTRIB_GENERIC0 + MAX_VERTEX_ATTRIBS)
+
struct radv_device;
struct radv_shader_module {
@@ -249,7 +251,7 @@ struct radv_shader_info {
bool is_ngg_passthrough;
struct {
uint64_t ls_outputs_written;
- uint8_t input_usage_mask[VERT_ATTRIB_MAX];
+ uint8_t input_usage_mask[RADV_VERT_ATTRIB_MAX];
uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
bool has_vertex_buffers; /* needs vertex buffers and base/start */
bool needs_draw_id;
diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c
index c7e26ba176f..c570ded99f4 100644
--- a/src/amd/vulkan/radv_shader_info.c
+++ b/src/amd/vulkan/radv_shader_info.c
@@ -403,7 +403,7 @@ gather_info_input_decl_vs(const nir_shader *nir, const nir_variable *var,
unsigned attrib_count = glsl_count_attribute_slots(var->type, true);
int idx = var->data.location;
- if (idx >= VERT_ATTRIB_GENERIC0 && idx <= VERT_ATTRIB_GENERIC15)
+ if (idx >= VERT_ATTRIB_GENERIC0 && idx < VERT_ATTRIB_GENERIC0 + MAX_VERTEX_ATTRIBS)
info->vs.has_vertex_buffers = true;
for (unsigned i = 0; i < attrib_count; ++i) {
More information about the mesa-commit
mailing list