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 **************************************************************************/
30 * Keith Whitwell <keith@tungstengraphics.com>
36 #include "pipe/p_compiler.h"
38 typedef unsigned (*pt_elt_func
)( const void *elts
, unsigned idx
);
40 struct draw_pt_middle_end
;
43 /* We use the top couple of bits in the vertex fetch index to convey a
44 * little API information. This limits the number of vertices we can
45 * address to only 1 billion -- if that becomes a problem, these could
46 * be moved out & passed separately.
48 #define DRAW_PT_EDGEFLAG (1<<30)
49 #define DRAW_PT_RESET_STIPPLE (1<<31)
50 #define DRAW_PT_FLAG_MASK (3<<30)
53 /* The "front end" - prepare sets of fetch, draw elements for the
56 * Currenly one version of this:
57 * - vcache - catchall implementation, decomposes to TRI/LINE/POINT prims
59 * - varray, varray_split
60 * - velement, velement_split
62 * Currenly only using the vcache version.
64 struct draw_pt_front_end
{
65 void (*prepare
)( struct draw_pt_front_end
*,
67 struct draw_pt_middle_end
*,
70 void (*run
)( struct draw_pt_front_end
*,
75 void (*finish
)( struct draw_pt_front_end
* );
76 void (*destroy
)( struct draw_pt_front_end
* );
80 /* The "middle end" - prepares actual hardware vertices for the
83 * Currently two versions of this:
84 * - fetch, vertex shade, cliptest, prim-pipeline
85 * - fetch, emit (ie passthrough)
87 * - fetch, vertex shade, cliptest, maybe-pipeline, maybe-emit
88 * - fetch, vertex shade, emit
90 * Currenly only using the passthrough version.
92 struct draw_pt_middle_end
{
93 void (*prepare
)( struct draw_pt_middle_end
*,
97 void (*run
)( struct draw_pt_middle_end
*,
98 const unsigned *fetch_elts
,
100 const ushort
*draw_elts
,
101 unsigned draw_count
);
103 void (*finish
)( struct draw_pt_middle_end
* );
104 void (*destroy
)( struct draw_pt_middle_end
* );
108 /* The "back end" - supplied by the driver, defined in draw_vbuf.h.
110 * Not sure whether to wrap the prim pipeline up as an alternate
111 * backend. Would be a win for everything except pure passthrough
119 pt_elt_func
draw_pt_elt_func( struct draw_context
*draw
);
120 const void *draw_pt_elt_ptr( struct draw_context
*draw
,
125 struct draw_pt_front_end
*draw_pt_vcache( struct draw_context
*draw
);
126 struct draw_pt_middle_end
*draw_pt_fetch_emit( struct draw_context
*draw
);
127 struct draw_pt_middle_end
*draw_pt_fetch_pipeline( struct draw_context
*draw
);
128 struct draw_pt_middle_end
*draw_pt_fetch_pipeline_or_emit(struct draw_context
*draw
);