Mesa (master): etnaviv: add support for user index buffers
Marek Olšák
mareko at kemper.freedesktop.org
Fri Feb 24 23:15:13 UTC 2017
Module: Mesa
Branch: master
Commit: 19c51e072b6fa614bc9c0f379bf462acd94c5431
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=19c51e072b6fa614bc9c0f379bf462acd94c5431
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Feb 17 01:59:48 2017 +0100
etnaviv: add support for user index buffers
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/gallium/drivers/etnaviv/etnaviv_context.c | 12 ++++++++++++
src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 5566e0e..dfd9e1f 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -47,6 +47,7 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_blitter.h"
+#include "util/u_helpers.h"
#include "util/u_memory.h"
#include "util/u_prim.h"
#include "util/u_upload_mgr.h"
@@ -137,6 +138,15 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
return;
}
+ /* Upload a user index buffer. */
+ struct pipe_index_buffer ibuffer_saved = {};
+ if (info->indexed && ctx->index_buffer.ib.user_buffer &&
+ !util_save_and_upload_index_buffer(pctx, info, &ctx->index_buffer.ib,
+ &ibuffer_saved)) {
+ BUG("Index buffer upload failed.");
+ return;
+ }
+
if (info->indexed && !ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo) {
BUG("Unsupported or no index buffer");
return;
@@ -211,6 +221,8 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
etna_resource(ctx->framebuffer.cbuf->texture)->seqno++;
if (ctx->framebuffer.zsbuf)
etna_resource(ctx->framebuffer.zsbuf->texture)->seqno++;
+ if (info->indexed && ibuffer_saved.user_buffer)
+ pctx->set_index_buffer(pctx, &ibuffer_saved);
}
static void
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index ccfa0d8..d00f5d0 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -136,6 +136,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_USER_CONSTANT_BUFFERS:
case PIPE_CAP_TGSI_TEXCOORD:
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
+ case PIPE_CAP_USER_INDEX_BUFFERS:
return 1;
/* Memory */
@@ -180,7 +181,6 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
case PIPE_CAP_USER_VERTEX_BUFFERS:
- case PIPE_CAP_USER_INDEX_BUFFERS:
case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
More information about the mesa-commit
mailing list