diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2019-09-23 20:37:39 -0700 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2019-10-02 09:41:27 -0400 |
commit | 9bc34d54db6ecd82cbb1d4709a32bd2cd3249ff6 (patch) | |
tree | 5fed721d297d36904091b3dc7b9c87a713c50d28 /src/gallium | |
parent | f7338bfe1f50efc17e409389ec44c91a56f09d84 (diff) |
iris: Fix iris_rebind_buffer() for VBOs with non-zero offsets.
We can't just check for the BO base address, we need to check for the
full address including any offset we may have applied. When updating
the address, we need to include the offset again.
Fixes: 5ad0c88dbe3 ("iris: Replace buffer backing storage and rebind to update addresses.")
(cherry picked from commit 309924c3c927b6f167d9306ecd7270076c7dc3ea)
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 3a6715f4048..80967191866 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -819,6 +819,8 @@ struct iris_vertex_buffer_state { /** The resource to source vertex data from. */ struct pipe_resource *resource; + + int offset; }; struct iris_depth_buffer_state { @@ -2808,6 +2810,8 @@ iris_set_vertex_buffers(struct pipe_context *ctx, pipe_resource_reference(&state->resource, buffer->buffer.resource); struct iris_resource *res = (void *) state->resource; + state->offset = (int) buffer->buffer_offset; + if (res) { ice->state.bound_vertex_buffers |= 1ull << (start_slot + i); res->bind_history |= PIPE_BIND_VERTEX_BUFFER; @@ -5681,8 +5685,8 @@ iris_rebind_buffer(struct iris_context *ice, STATIC_ASSERT(GENX(VERTEX_BUFFER_STATE_BufferStartingAddress_bits) == 64); uint64_t *addr = (uint64_t *) &state->state[1]; - if (*addr == old_address) { - *addr = res->bo->gtt_offset; + if (*addr == old_address + state->offset) { + *addr = res->bo->gtt_offset + state->offset; ice->state.dirty |= IRIS_DIRTY_VERTEX_BUFFERS; } } |