summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c64
1 files changed, 52 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 18435af848..02abddf149 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -38,6 +38,9 @@
#include "draw_vs.h"
#include "draw_gs.h"
+#if HAVE_LLVM
+#include "gallivm/lp_bld_init.h"
+#endif
struct draw_context *draw_create( struct pipe_context *pipe )
{
@@ -45,6 +48,32 @@ struct draw_context *draw_create( struct pipe_context *pipe )
if (draw == NULL)
goto fail;
+#if HAVE_LLVM
+ lp_build_init();
+ assert(lp_build_engine);
+ draw->engine = lp_build_engine;
+#endif
+
+ if (!draw_init(draw))
+ goto fail;
+
+ draw->pipe = pipe;
+
+ return draw;
+
+fail:
+ draw_destroy( draw );
+ return NULL;
+}
+
+boolean draw_init(struct draw_context *draw)
+{
+ /*
+ * Note that several functions compute the clipmask of the predefined
+ * formats with hardcoded formulas instead of using these. So modifications
+ * here must be reflected there too.
+ */
+
ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 );
ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 );
ASSIGN_4V( draw->plane[2], 0, -1, 0, 1 );
@@ -58,35 +87,31 @@ struct draw_context *draw_create( struct pipe_context *pipe )
if (!draw_pipeline_init( draw ))
- goto fail;
+ return FALSE;
if (!draw_pt_init( draw ))
- goto fail;
+ return FALSE;
if (!draw_vs_init( draw ))
- goto fail;
+ return FALSE;
if (!draw_gs_init( draw ))
- goto fail;
-
- draw->pipe = pipe;
-
- return draw;
+ return FALSE;
-fail:
- draw_destroy( draw );
- return NULL;
+ return TRUE;
}
void draw_destroy( struct draw_context *draw )
{
- struct pipe_context *pipe = draw->pipe;
+ struct pipe_context *pipe;
int i, j;
if (!draw)
return;
+ pipe = draw->pipe;
+
/* free any rasterizer CSOs that we may have created.
*/
for (i = 0; i < 2; i++) {
@@ -280,6 +305,17 @@ draw_wide_point_threshold(struct draw_context *draw, float threshold)
/**
+ * Should the draw module handle point->quad conversion for drawing sprites?
+ */
+void
+draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite)
+{
+ draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+ draw->pipeline.wide_point_sprites = draw_sprite;
+}
+
+
+/**
* Tells the draw module to draw lines with triangles if their width
* is greater than this threshold.
*/
@@ -432,12 +468,14 @@ void draw_set_render( struct draw_context *draw,
void
draw_set_mapped_element_buffer_range( struct draw_context *draw,
unsigned eltSize,
+ int eltBias,
unsigned min_index,
unsigned max_index,
const void *elements )
{
draw->pt.user.elts = elements;
draw->pt.user.eltSize = eltSize;
+ draw->pt.user.eltBias = eltBias;
draw->pt.user.min_index = min_index;
draw->pt.user.max_index = max_index;
}
@@ -446,10 +484,12 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw,
void
draw_set_mapped_element_buffer( struct draw_context *draw,
unsigned eltSize,
+ int eltBias,
const void *elements )
{
draw->pt.user.elts = elements;
draw->pt.user.eltSize = eltSize;
+ draw->pt.user.eltBias = eltBias;
draw->pt.user.min_index = 0;
draw->pt.user.max_index = 0xffffffff;
}