summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-03-25 19:16:54 +0200
committerMathias Fröhlich <[email protected]>2018-03-31 06:32:12 +0200
commit4db9d83a2dd5611776577bacdbdbf483b6bea937 (patch)
tree15550207bf5e29c43ff5ac92cbb9b3313c5fa36a /src
parentfca1550550793f0a1156ad795445e2242c1fea9b (diff)
i965: Push down the gl_vertex_array inputs into i965.
Let the i965 backend have its own gl_vertex_array array and basically reimplement the way _vbo_draw works. Note that brw_draw_indirect_prims calls brw_draw_prims internally and gets its update to Array._DrawArray by this way. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h4
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c23
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.h1
4 files changed, 23 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 2e961a1ef6e..01a3e16583d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -284,6 +284,7 @@ brw_init_driver_functions(struct brw_context *brw,
functions->GetString = intel_get_string;
functions->UpdateState = intel_update_state;
+ brw_init_draw_functions(functions);
intelInitTextureFuncs(functions);
intelInitTextureImageFuncs(functions);
intelInitTextureCopyImageFuncs(functions);
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 177273c3645..f049d086492 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -36,6 +36,7 @@
#include <stdbool.h>
#include "main/macros.h"
#include "main/mtypes.h"
+#include "vbo/vbo.h"
#include "brw_structs.h"
#include "brw_pipe_control.h"
#include "compiler/brw_compiler.h"
@@ -954,6 +955,9 @@ struct brw_context
* These bitfields indicate which workarounds are needed.
*/
uint8_t attrib_wa_flags[VERT_ATTRIB_MAX];
+
+ /* For the initial pushdown, keep the list of vbo inputs. */
+ struct vbo_inputs draw_arrays;
} vb;
struct {
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 0d1ae8982cb..5f52404bd6e 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -34,6 +34,7 @@
#include "main/macros.h"
#include "main/transformfeedback.h"
#include "main/framebuffer.h"
+#include "main/varray.h"
#include "tnl/tnl.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
@@ -941,11 +942,16 @@ brw_draw_prims(struct gl_context *ctx,
{
unsigned i;
struct brw_context *brw = brw_context(ctx);
- const struct gl_vertex_array *arrays = ctx->Array._DrawArrays;
+ const struct gl_vertex_array *arrays;
int predicate_state = brw->predicate.state;
struct brw_transform_feedback_object *xfb_obj =
(struct brw_transform_feedback_object *) gl_xfb_obj;
+ /* The initial pushdown of the inputs array into the drivers */
+ _mesa_set_drawing_arrays(ctx, brw->vb.draw_arrays.inputs);
+ arrays = ctx->Array._DrawArrays;
+ _vbo_update_inputs(ctx, &brw->vb.draw_arrays);
+
if (!brw_check_conditional_render(brw))
return;
@@ -1075,14 +1081,19 @@ brw_draw_indirect_prims(struct gl_context *ctx,
}
void
-brw_draw_init(struct brw_context *brw)
+brw_init_draw_functions(struct dd_function_table *functions)
{
- struct gl_context *ctx = &brw->ctx;
-
/* Register our drawing function:
*/
- vbo_set_draw_func(ctx, brw_draw_prims);
- vbo_set_indirect_draw_func(ctx, brw_draw_indirect_prims);
+ functions->Draw = brw_draw_prims;
+ functions->DrawIndirect = brw_draw_indirect_prims;
+}
+
+void
+brw_draw_init(struct brw_context *brw)
+{
+ /* Keep our list of gl_vertex_array inputs */
+ _vbo_init_inputs(&brw->vb.draw_arrays);
for (int i = 0; i < VERT_ATTRIB_MAX; i++)
brw->vb.inputs[i].buffer = -1;
diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h
index c3a972c2765..c74a2536aa1 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.h
+++ b/src/mesa/drivers/dri/i965/brw_draw.h
@@ -55,6 +55,7 @@ void brw_draw_prims(struct gl_context *ctx,
unsigned stream,
struct gl_buffer_object *indirect );
+void brw_init_draw_functions(struct dd_function_table *functions);
void brw_draw_init( struct brw_context *brw );
void brw_draw_destroy( struct brw_context *brw );