Merge branch '7.8'
[mesa.git] / src / gallium / auxiliary / draw / draw_context.c
index 18435af8482c23e62b8cae779f649d3cacd4bef0..5726444c9b7fe42518b66947cc588718f1c055bb 100644 (file)
@@ -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;
 }