summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/freedreno/freedreno_draw.c
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2013-10-25 15:33:09 -0400
committerRob Clark <robclark@freedesktop.org>2013-10-29 16:49:43 -0400
commit2bc1fc2fb61897ab188f4a7150233827747827ff (patch)
treec7a66a18ae8c6042b47f4ef81f17b2b3e9a7dc6b /src/gallium/drivers/freedreno/freedreno_draw.c
parentb88191708816872a0bc93decec0507d797cd4018 (diff)
freedreno: emulated unsupported primitive types
Use u_primconvert to convert unsupported primitives into supported primitive plus index buffer. Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_draw.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index c00595f7d82..0069438c87d 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -39,25 +39,6 @@
#include "freedreno_util.h"
-static enum pc_di_primtype
-mode2primtype(unsigned mode)
-{
- switch (mode) {
- case PIPE_PRIM_POINTS: return DI_PT_POINTLIST_A2XX;
- case PIPE_PRIM_LINES: return DI_PT_LINELIST;
- case PIPE_PRIM_LINE_STRIP: return DI_PT_LINESTRIP;
- case PIPE_PRIM_TRIANGLES: return DI_PT_TRILIST;
- case PIPE_PRIM_TRIANGLE_STRIP: return DI_PT_TRISTRIP;
- case PIPE_PRIM_TRIANGLE_FAN: return DI_PT_TRIFAN;
- case PIPE_PRIM_QUADS: return DI_PT_QUADLIST;
- case PIPE_PRIM_QUAD_STRIP: return DI_PT_QUADSTRIP;
- case PIPE_PRIM_POLYGON: return DI_PT_POLYGON;
- }
- DBG("unsupported mode: (%s) %d", u_prim_name(mode), mode);
- assert(0);
- return DI_PT_NONE;
-}
-
static enum pc_di_index_size
size2indextype(unsigned index_size)
{
@@ -97,7 +78,7 @@ fd_draw_emit(struct fd_context *ctx, const struct pipe_draw_info *info)
src_sel = DI_SRC_SEL_AUTO_INDEX;
}
- fd_draw(ctx, mode2primtype(info->mode), src_sel, info->count,
+ fd_draw(ctx, ctx->primtypes[info->mode], src_sel, info->count,
idx_type, idx_size, idx_offset, idx_bo);
}
@@ -115,6 +96,14 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
return;
}
+ /* emulate unsupported primitives: */
+ if (!fd_supported_prim(ctx, info->mode)) {
+ util_primconvert_save_index_buffer(ctx->primconvert, &ctx->indexbuf);
+ util_primconvert_save_rasterizer_state(ctx->primconvert, ctx->rasterizer);
+ util_primconvert_draw_vbo(ctx->primconvert, info);
+ return;
+ }
+
ctx->needs_flush = true;
/*