From 4f74b379aa05e133cdd19865662eceacee4f63f4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 31 Aug 2016 14:49:41 -0600 Subject: svga: implement an index buffer translation cache Some OpenGL apps, like Cinebench R15, have many glDrawElements(GL_QUADS) calls. Since we don't directly support quads we have to convert these calls into GL_TRIANGLES which involves generating a new index buffer. This patch saves the new/translated index buffer in the hope that it can be reused for a later draw call. Cinebench R15 increases by about 20% with this change. The NobelClinician Viewer app also hits this code. Tested with full piglit run. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_resource_buffer.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gallium/drivers/svga/svga_resource_buffer.h') diff --git a/src/gallium/drivers/svga/svga_resource_buffer.h b/src/gallium/drivers/svga/svga_resource_buffer.h index daf9c18a95a..69075888892 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.h +++ b/src/gallium/drivers/svga/svga_resource_buffer.h @@ -192,6 +192,17 @@ struct svga_buffer unsigned size; /**< Approximate size in bytes */ boolean dirty; /**< Need to do a readback before mapping? */ + + /** In some cases we try to keep the results of the translate_indices() + * function from svga_draw_elements.c + */ + struct { + enum pipe_prim_type orig_prim, new_prim; + struct pipe_resource *buffer; + unsigned index_size; + unsigned offset; /**< first index */ + unsigned count; /**< num indices */ + } translated_indices; }; -- cgit v1.2.3