[Mesa-dev] [PATCH 13/14] i965/meta: Setup vertices for fast clear without core vbo support
Topi Pohjolainen
topi.pohjolainen at intel.com
Thu Feb 25 09:46:18 UTC 2016
Meta operations will setup vertices directly instead of interfering
with core content vertex buffer object state.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94181
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_context.c | 2 +
src/mesa/drivers/dri/i965/brw_meta_fast_clear.c | 57 +++++++++++++------------
2 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 31b6b2a..e8c81c6 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -54,6 +54,7 @@
#include "brw_compiler.h"
#include "brw_draw.h"
#include "brw_state.h"
+#include "brw_meta_util.h"
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
@@ -952,6 +953,7 @@ brwCreateContext(gl_api api,
}
brw_init_state(brw);
+ brw_meta_init(brw);
intelInitExtensions(ctx);
diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
index 488fa6c..6a7cf4e 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
@@ -56,6 +56,7 @@
#include "intel_batchbuffer.h"
#include "brw_blorp.h"
+#include "brw_meta_util.h"
struct brw_fast_clear_state {
struct gl_buffer_object *buf_obj;
@@ -176,6 +177,21 @@ brw_meta_fast_clear_free(struct brw_context *brw)
_mesa_make_current(NULL, NULL, NULL);
}
+static void
+set_render_buffers_state(struct brw_context *brw)
+{
+ struct gl_context *ctx = &brw->ctx;
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) {
+ struct intel_renderbuffer *irb =
+ intel_renderbuffer(fb->_ColorDrawBuffers[i]);
+
+ if (irb)
+ brw_render_cache_set_add_bo(brw, irb->mt->bo);
+ }
+}
+
struct rect {
int x0, y0, x1, y1;
};
@@ -184,41 +200,26 @@ static void
brw_draw_rectlist(struct brw_context *brw, struct rect *rect, int num_instances)
{
struct gl_context *ctx = &brw->ctx;
- struct brw_fast_clear_state *clear = brw->fast_clear_state;
- int start = 0, count = 3;
- struct _mesa_prim prim;
- float verts[6];
-
- verts[0] = rect->x1;
- verts[1] = rect->y1;
- verts[2] = rect->x0;
- verts[3] = rect->y1;
- verts[4] = rect->x0;
- verts[5] = rect->y0;
-
- /* upload new vertex data */
- _mesa_buffer_data(ctx, clear->buf_obj, GL_NONE, sizeof(verts), verts,
- GL_DYNAMIC_DRAW, __func__);
if (ctx->NewState)
_mesa_update_state(ctx);
- vbo_bind_arrays(ctx);
+ brw_workaround_depthstencil_alignment(brw, 0);
+
+retry:
+ brw_meta_begin(brw, 3 * 1024 /* estimated_max_batch_usage */);
+
+ brw_meta_pipeline_upload(brw, rect->x0, rect->y0, rect->x1, rect->y1);
+
+ brw_meta_draw_rect(brw, num_instances);
- memset(&prim, 0, sizeof prim);
- prim.begin = 1;
- prim.end = 1;
- prim.mode = BRW_PRIM_OFFSET + _3DPRIM_RECTLIST;
- prim.num_instances = num_instances;
- prim.start = start;
- prim.count = count;
+ if (!brw_meta_end(brw))
+ goto retry;
- /* Make sure our internal prim value doesn't clash with a valid GL value. */
- assert(!_mesa_is_valid_prim_mode(ctx, prim.mode));
+ if (brw->ctx.NewDriverState)
+ brw_render_state_finished(brw);
- brw_draw_prims(ctx, &prim, 1, NULL,
- GL_TRUE, start, start + count - 1,
- NULL, 0, NULL);
+ set_render_buffers_state(brw);
}
static void
--
2.5.0
More information about the mesa-dev
mailing list