summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2017-07-14 13:26:24 +0200
committerLucas Stach <[email protected]>2017-07-14 17:19:42 +0200
commit1d05cec205100f13b2fda18fdd27c6f0eebf6422 (patch)
tree7bf421d4a74e649e841e32a3cb876dc03ddecd83
parentbb2498a7f69790e22492fb949a1bd14b83cf19c7 (diff)
etnaviv: reset indexed rendering information when not rendering indexed
A dangling bo object would result in memory corruption while loading a level in ioquake3_opengl2. Fixes: 330d0607ed60 (gallium: remove pipe_index_buffer and set_index_buffer) Suggested-by: Lucas Stach <[email protected]> Signed-off-by: Wladimir J. van der Laan <[email protected]> Reviewed-by: Lucas Stach <[email protected]>
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_context.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index e7590954c74..2ca09ce3219 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -192,13 +192,18 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.offset = index_offset;
ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.flags = ETNA_RELOC_READ;
ctx->index_buffer.FE_INDEX_STREAM_CONTROL = translate_index_size(info->index_size);
- ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER;
if (!ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo) {
BUG("Unsupported or no index buffer");
return;
}
+ } else {
+ ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo = 0;
+ ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.offset = 0;
+ ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.flags = 0;
+ ctx->index_buffer.FE_INDEX_STREAM_CONTROL = 0;
}
+ ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER;
struct etna_shader_key key = {};
struct etna_surface *cbuf = etna_surface(pfb->cbufs[0]);