Mesa (staging/20.3): anv: fix calculation of buffer size in case dynamic size is used
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 10 20:41:43 UTC 2020
Module: Mesa
Branch: staging/20.3
Commit: 4ed130a32a02ce0b6643fcb3b57e0925d5be716f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ed130a32a02ce0b6643fcb3b57e0925d5be716f
Author: Tapani Pälli <tapani.palli at intel.com>
Date: Wed Nov 4 11:11:41 2020 +0200
anv: fix calculation of buffer size in case dynamic size is used
VK spec got clarification about the pSizes parameter.
Fixes set of new tests:
dEQP-VK.pipeline.extended_dynamic_state*with_offset*
v2: move offset subtract to be part of size calculation (Jason)
CC: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3871
Fixes: b9a05447a19 ("anv: dynamic vertex input binding stride and size support")
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7439>
(cherry picked from commit 5998a6543a6f3116b6c77ace4f9bcde382e90138)
---
.pick_status.json | 2 +-
src/intel/vulkan/genX_cmd_buffer.c | 19 +++++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 41bbd763462..d7729f0158e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
"description": "anv: fix calculation of buffer size in case dynamic size is used",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "b9a05447a1976101c04a02f5588c51de0b0f6573"
},
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 6fb09bba4d8..a9c49e0f592 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -3464,8 +3464,14 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
if (buffer) {
uint32_t stride = dynamic_stride ?
cmd_buffer->state.vertex_bindings[vb].stride : pipeline->vb[vb].stride;
- uint32_t size = dynamic_size ?
- cmd_buffer->state.vertex_bindings[vb].size : buffer->size;
+ /* From the Vulkan spec (vkCmdBindVertexBuffers2EXT):
+ *
+ * "If pname:pSizes is not NULL then pname:pSizes[i] specifies
+ * the bound size of the vertex buffer starting from the corresponding
+ * elements of pname:pBuffers[i] plus pname:pOffsets[i]."
+ */
+ UNUSED uint32_t size = dynamic_size ?
+ cmd_buffer->state.vertex_bindings[vb].size : buffer->size - offset;
state = (struct GENX(VERTEX_BUFFER_STATE)) {
.VertexBufferIndex = vb,
@@ -3482,9 +3488,14 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
.NullVertexBuffer = offset >= buffer->size,
#if GEN_GEN >= 8
- .BufferSize = size - offset
+ .BufferSize = size,
#else
- .EndAddress = anv_address_add(buffer->address, size - 1),
+ /* XXX: to handle dynamic offset for older gens we might want
+ * to modify Endaddress, but there are issues when doing so:
+ *
+ * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7439
+ */
+ .EndAddress = anv_address_add(buffer->address, buffer->size - 1),
#endif
};
} else {
More information about the mesa-commit
mailing list