X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fllvmpipe%2Flp_state_rasterizer.c;h=afd3e0b21c912c043a7672b41de020f3077e4c2d;hb=4418a493c2466e734e1ca5ace51535d1dbcf8a46;hp=4561c6b84560a40b12bc4d595d42121d476c3603;hpb=9053bb0d405db0b1a2a917317c7ec41e63b54f09;p=mesa.git diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index 4561c6b8456..afd3e0b21c9 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -29,34 +29,69 @@ #include "util/u_memory.h" #include "lp_context.h" #include "lp_state.h" +#include "lp_setup.h" #include "draw/draw_context.h" -void * +static void * llvmpipe_create_rasterizer_state(struct pipe_context *pipe, const struct pipe_rasterizer_state *rast) { + /* We do nothing special with rasterizer state. + * The CSO handle is just a pointer to a pipe_rasterizer_state object. + */ return mem_dup(rast, sizeof(*rast)); } -void llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, - void *setup) + + +static void +llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); + const struct pipe_rasterizer_state *rasterizer = + (const struct pipe_rasterizer_state *) handle; + + if (llvmpipe->rasterizer == rasterizer) + return; /* pass-through to draw module */ - draw_set_rasterizer_state(llvmpipe->draw, setup); + draw_set_rasterizer_state(llvmpipe->draw, rasterizer, handle); + + llvmpipe->rasterizer = rasterizer; - llvmpipe->rasterizer = (struct pipe_rasterizer_state *)setup; + /* Note: we can immediately set the triangle state here and + * not worry about binning because we handle culling during + * triangle setup, not when rasterizing the bins. + */ + if (llvmpipe->rasterizer) { + lp_setup_set_triangle_state( llvmpipe->setup, + llvmpipe->rasterizer->cull_face, + llvmpipe->rasterizer->front_ccw, + llvmpipe->rasterizer->scissor, + llvmpipe->rasterizer->gl_rasterization_rules); + lp_setup_set_flatshade_first( llvmpipe->setup, + llvmpipe->rasterizer->flatshade_first); + } llvmpipe->dirty |= LP_NEW_RASTERIZER; } -void llvmpipe_delete_rasterizer_state(struct pipe_context *pipe, - void *rasterizer) + +static void +llvmpipe_delete_rasterizer_state(struct pipe_context *pipe, + void *rasterizer) { FREE( rasterizer ); } + +void +llvmpipe_init_rasterizer_funcs(struct llvmpipe_context *llvmpipe) +{ + llvmpipe->pipe.create_rasterizer_state = llvmpipe_create_rasterizer_state; + llvmpipe->pipe.bind_rasterizer_state = llvmpipe_bind_rasterizer_state; + llvmpipe->pipe.delete_rasterizer_state = llvmpipe_delete_rasterizer_state; +}