Merge the lp-surface-tiling branch into master.
[mesa.git] / src / gallium / drivers / llvmpipe / lp_context.c
index 383e4b0614d29bc61d46c06b806de0e9ebff1264..e63720c99ab6a0c75ae045d33848cc5d45b64f2b 100644 (file)
 #include "lp_context.h"
 #include "lp_flush.h"
 #include "lp_perf.h"
-#include "lp_screen.h"
 #include "lp_state.h"
 #include "lp_surface.h"
 #include "lp_query.h"
 #include "lp_setup.h"
 
 
-
+#define USE_DRAW_LLVM 0
 
 
 static void llvmpipe_destroy( struct pipe_context *pipe )
@@ -78,35 +77,18 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
 
    for (i = 0; i < Elements(llvmpipe->constants); i++) {
       if (llvmpipe->constants[i]) {
-         pipe_buffer_reference(&llvmpipe->constants[i], NULL);
+         pipe_resource_reference(&llvmpipe->constants[i], NULL);
       }
    }
 
    align_free( llvmpipe );
 }
 
-static unsigned int
-llvmpipe_is_texture_referenced( struct pipe_context *pipe,
-                               struct pipe_texture *texture,
-                               unsigned face, unsigned level)
-{
-   struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
-
-   return lp_setup_is_texture_referenced(llvmpipe->setup, texture);
-}
-
-static unsigned int
-llvmpipe_is_buffer_referenced( struct pipe_context *pipe,
-                              struct pipe_buffer *buf)
-{
-   return PIPE_UNREFERENCED;
-}
 
 struct pipe_context *
 llvmpipe_create_context( struct pipe_screen *screen, void *priv )
 {
    struct llvmpipe_context *llvmpipe;
-   struct llvmpipe_screen *llvmscreen = llvmpipe_screen(screen);
 
    llvmpipe = align_malloc(sizeof(struct llvmpipe_context), 16);
    if (!llvmpipe)
@@ -173,16 +155,18 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
    llvmpipe->pipe.clear = llvmpipe_clear;
    llvmpipe->pipe.flush = llvmpipe_flush;
 
-   llvmpipe->pipe.is_texture_referenced = llvmpipe_is_texture_referenced;
-   llvmpipe->pipe.is_buffer_referenced = llvmpipe_is_buffer_referenced;
 
    llvmpipe_init_query_funcs( llvmpipe );
-   llvmpipe_init_context_texture_funcs( &llvmpipe->pipe );
+   llvmpipe_init_context_resource_funcs( &llvmpipe->pipe );
 
    /*
     * Create drawing context and plug our rendering stage into it.
     */
-   llvmpipe->draw = draw_create_with_llvm(llvmscreen->engine);
+#if USE_DRAW_LLVM
+   llvmpipe->draw = draw_create_with_llvm();
+#else
+   llvmpipe->draw = draw_create();
+#endif
    if (!llvmpipe->draw)
       goto fail;
 
@@ -200,6 +184,10 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
    draw_install_aaline_stage(llvmpipe->draw, &llvmpipe->pipe);
    draw_install_aapoint_stage(llvmpipe->draw, &llvmpipe->pipe);
 
+   /* convert points and lines into triangles: */
+   draw_wide_point_threshold(llvmpipe->draw, 0.0);
+   draw_wide_line_threshold(llvmpipe->draw, 0.0);
+
 #if USE_DRAW_STAGE_PSTIPPLE
    /* Do polygon stipple w/ texture map + frag prog? */
    draw_install_pstipple_stage(llvmpipe->draw, &llvmpipe->pipe);