aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-02-17 02:21:29 +0100
committerMarek Olšák <[email protected]>2017-02-25 00:03:09 +0100
commite78ccee9335ed677a6bf4597083954646760dadd (patch)
tree03c93475a566f50680990c55ba0ca9f735ee4a20 /src/gallium/drivers/svga
parent7fff5b77f12174610d82d0c14da19fd8e81c92db (diff)
svga: implement user index buffers
Reviewed-by: Brian Paul <[email protected]> Tested-by: Brian Paul <[email protected]> (VMware driver only)
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_draw.c13
-rw-r--r--src/gallium/drivers/svga/svga_screen.c2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
index c51c0b27915..bbd44304950 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -25,6 +25,7 @@
#include "util/u_format.h"
+#include "util/u_helpers.h"
#include "util/u_inlines.h"
#include "util/u_prim.h"
#include "util/u_prim_restart.h"
@@ -194,6 +195,14 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
svga->curr.rast->templ.cull_face == PIPE_FACE_FRONT_AND_BACK)
goto done;
+ /* Upload a user index buffer. */
+ struct pipe_index_buffer ibuffer_saved = {};
+ if (info->indexed && svga->curr.ib.user_buffer &&
+ !util_save_and_upload_index_buffer(pipe, info, &svga->curr.ib,
+ &ibuffer_saved)) {
+ return;
+ }
+
/*
* Mark currently bound target surfaces as dirty
* doesn't really matter if it is done before drawing.
@@ -277,8 +286,10 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
}
done:
+ if (info->indexed && ibuffer_saved.user_buffer)
+ pipe->set_index_buffer(pipe, &ibuffer_saved);
+
SVGA_STATS_TIME_POP(svga_sws(svga));
-;
}
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index f9dfcd21585..8af66b7caad 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -182,6 +182,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_NPOT_TEXTURES:
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
+ case PIPE_CAP_USER_INDEX_BUFFERS:
return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
return 1;
@@ -213,7 +214,6 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
return 0;
case PIPE_CAP_USER_VERTEX_BUFFERS:
- case PIPE_CAP_USER_INDEX_BUFFERS:
return 0;
case PIPE_CAP_USER_CONSTANT_BUFFERS:
return 1;