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: 330d0607ed (gallium: remove pipe_index_buffer and set_index_buffer)
Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
This commit is contained in:
Wladimir J. van der Laan 2017-07-14 13:26:24 +02:00 committed by Lucas Stach
parent bb2498a7f6
commit 1d05cec205
1 changed files with 6 additions and 1 deletions

View File

@ -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]);