mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
nvk: Handle zero-size index and vertex buffers pre-Turing
According to the nouveau GL driver, this should be the addres of the last byte, not the byte after the end. The calculation will overflow if range is 0 so we need to handle that special. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
7c096786ca
commit
ade334a807
1 changed files with 5 additions and 2 deletions
|
|
@ -1406,7 +1406,8 @@ nvk_CmdBindIndexBuffer(VkCommandBuffer commandBuffer,
|
|||
P_NVC597_SET_INDEX_BUFFER_SIZE_A(p, range >> 32);
|
||||
P_NVC597_SET_INDEX_BUFFER_SIZE_B(p, range);
|
||||
} else {
|
||||
uint64_t limit = addr + range;
|
||||
/* TODO: What about robust zero-size buffers? */
|
||||
const uint64_t limit = range > 0 ? addr + range - 1 : 0;
|
||||
P_MTHD(p, NV9097, SET_INDEX_BUFFER_C);
|
||||
P_NV9097_SET_INDEX_BUFFER_C(p, limit >> 32);
|
||||
P_NV9097_SET_INDEX_BUFFER_D(p, limit);
|
||||
|
|
@ -1430,7 +1431,9 @@ nvk_cmd_bind_vertex_buffer(struct nvk_cmd_buffer *cmd, uint32_t vb_idx,
|
|||
P_NVC597_SET_VERTEX_STREAM_SIZE_A(p, vb_idx, addr_range.range >> 32);
|
||||
P_NVC597_SET_VERTEX_STREAM_SIZE_B(p, vb_idx, addr_range.range);
|
||||
} else {
|
||||
uint64_t limit = addr_range.addr + addr_range.range - 1;
|
||||
/* TODO: What about robust zero-size buffers? */
|
||||
const uint64_t limit = addr_range.range > 0 ?
|
||||
addr_range.addr + addr_range.range - 1 : 0;
|
||||
P_MTHD(p, NV9097, SET_VERTEX_STREAM_LIMIT_A_A(vb_idx));
|
||||
P_NV9097_SET_VERTEX_STREAM_LIMIT_A_A(p, vb_idx, limit >> 32);
|
||||
P_NV9097_SET_VERTEX_STREAM_LIMIT_A_B(p, vb_idx, limit);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue