1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 * \brief Primitive rasterization/rendering (points, lines)
31 * \author Keith Whitwell <keith@tungstengraphics.com>
35 #include "lp_context.h"
37 #include "lp_quad_pipe.h"
40 #include "draw/draw_context.h"
41 #include "draw/draw_private.h"
42 #include "draw/draw_vertex.h"
43 #include "pipe/p_shader_tokens.h"
44 #include "pipe/p_thread.h"
45 #include "util/u_math.h"
46 #include "util/u_memory.h"
51 /* Stubs for lines & points for now:
54 llvmpipe_setup_point(struct setup_context
*setup
,
60 llvmpipe_setup_line(struct setup_context
*setup
,
67 /* Called after statechange, before emitting primitives. If binning
68 * is active, this function should store relevant state in the binning
72 * - current fragment shader function
73 * - bound constant buffer contents
78 * Basically everything needed at some point in the future to
79 * rasterize triangles for the current state.
81 * Additionally this will set up the state needed for the rasterizer
82 * to process and bin incoming triangles. That would include such
89 void setup_prepare( struct setup_context
*setup
)
91 struct llvmpipe_context
*lp
= setup
->llvmpipe
;
94 llvmpipe_update_derived(lp
);
97 lp
->quad
.first
->begin( lp
->quad
.first
);
99 if (lp
->reduced_api_prim
== PIPE_PRIM_TRIANGLES
&&
100 lp
->rasterizer
->fill_cw
== PIPE_POLYGON_MODE_FILL
&&
101 lp
->rasterizer
->fill_ccw
== PIPE_POLYGON_MODE_FILL
) {
102 /* we'll do culling */
103 setup
->winding
= lp
->rasterizer
->cull_mode
;
106 /* 'draw' will do culling */
107 setup
->winding
= PIPE_WINDING_NONE
;
110 setup_prepare_tri( setup
->llvmpipe
);
115 void setup_destroy_context( struct setup_context
*setup
)
122 * Create a new primitive setup/render stage.
124 struct setup_context
*setup_create_context( struct llvmpipe_context
*llvmpipe
)
126 struct setup_context
*setup
= CALLOC_STRUCT(setup_context
);
129 setup
->llvmpipe
= llvmpipe
;