2 * Copyright 2009 VMware, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include "pipe/p_compiler.h"
34 typedef void (*u_translate_func
)( const void *in
,
38 typedef void (*u_generate_func
)( unsigned nr
,
42 /* Return codes describe the translate/generate operation. Caller may
43 * be able to reuse translated indices under some circumstances.
45 #define U_TRANSLATE_ERROR -1
46 #define U_TRANSLATE_NORMAL 1
47 #define U_TRANSLATE_MEMCPY 2
48 #define U_GENERATE_LINEAR 3
49 #define U_GENERATE_REUSABLE 4
50 #define U_GENERATE_ONE_OFF 5
53 void u_index_init( void );
55 int u_index_translator( unsigned hw_mask
,
57 unsigned in_index_size
,
59 unsigned in_pv
, /* API */
60 unsigned out_pv
, /* hardware */
62 unsigned *out_index_size
,
64 u_translate_func
*out_translate
);
66 /* Note that even when generating it is necessary to know what the
67 * API's PV is, as the indices generated will depend on whether it is
68 * the same as hardware or not, and in the case of triangle strips,
69 * whether it is first or last.
71 int u_index_generator( unsigned hw_mask
,
75 unsigned in_pv
, /* API */
76 unsigned out_pv
, /* hardware */
78 unsigned *out_index_size
,
80 u_generate_func
*out_generate
);
83 void u_unfilled_init( void );
85 int u_unfilled_translator( unsigned prim
,
86 unsigned in_index_size
,
88 unsigned unfilled_mode
,
90 unsigned *out_index_size
,
92 u_translate_func
*out_translate
);
94 int u_unfilled_generator( unsigned prim
,
97 unsigned unfilled_mode
,
99 unsigned *out_index_size
,
101 u_generate_func
*out_generate
);