Module: Mesa
Branch: master
Commit: f3cccd05d9f6e9d05c18d1a3a5f9eb863e4f264b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3cccd05d9f6e9d05c18d1a3a5f9eb863e4f264b

Author: Samuel Pitoiset <[email protected]>
Date:   Wed Dec 18 13:29:39 2019 +0100

radv/gfx10: fix the out-of-bounds check for vertex descriptors

When stride is 0, it should check against the offset not the index.

This fixes black character models with Beat Saber and missing snow
with Dragon Quest.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2233
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1975
Cc: <[email protected]>
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3147>

---

 src/amd/vulkan/radv_cmd_buffer.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 0c62eacf05c..1a7d59bc053 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2415,8 +2415,12 @@ radv_flush_vertex_descriptors(struct radv_cmd_buffer 
*cmd_buffer,
                                  S_008F0C_DST_SEL_W(V_008F0C_SQ_SEL_W);
 
                        if 
(cmd_buffer->device->physical_device->rad_info.chip_class >= GFX10) {
+                               /* OOB_SELECT chooses the out-of-bounds check:
+                                * - 1: index >= NUM_RECORDS (Structured)
+                                * - 3: offset >= NUM_RECORDS (Raw)
+                                */
                                desc[3] |= 
S_008F0C_FORMAT(V_008F0C_IMG_FORMAT_32_UINT) |
-                                          S_008F0C_OOB_SELECT(1) |
+                                          S_008F0C_OOB_SELECT(stride ? 1 : 3) |
                                           S_008F0C_RESOURCE_LEVEL(1);
                        } else {
                                desc[3] |= 
S_008F0C_NUM_FORMAT(V_008F0C_BUF_NUM_FORMAT_UINT) |

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to