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.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 18435af848..5726444c9b 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -45,6 +45,26 @@ struct draw_context *draw_create( struct pipe_context *pipe )
if (draw == NULL)
goto fail;
+ 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,24 +78,18 @@ 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;
+ return FALSE;
- draw->pipe = pipe;
-
- return draw;
-
-fail:
- draw_destroy( draw );
- return NULL;
+ return TRUE;
}