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 * Post-transform vertex format info. The vertex_info struct is used by
30 * the draw_vbuf code to emit hardware-specific vertex layouts into hw
42 #include "pipe/p_state.h"
46 * Vertex attribute emit modes
49 EMIT_OMIT
, /**< don't emit the attribute */
50 EMIT_ALL
, /**< emit whole post-xform vertex, w/ header */
52 EMIT_1F_PSIZE
, /**< insert constant point size */
56 EMIT_4UB
/**< XXX may need variations for RGBA vs BGRA, etc */
61 * Attribute interpolation mode
64 INTERP_NONE
, /**< never interpolate vertex header info */
65 INTERP_POS
, /**< special case for frag position */
73 * Information about hardware/rasterization vertex layout.
78 uint hwfmt
[4]; /**< hardware format info for this format */
79 enum interp_mode interp_mode
[PIPE_MAX_SHADER_INPUTS
];
80 enum attrib_emit emit
[PIPE_MAX_SHADER_INPUTS
]; /**< EMIT_x */
81 uint src_index
[PIPE_MAX_SHADER_INPUTS
]; /**< map to post-xform attribs */
82 uint size
; /**< total vertex size in dwords */
88 * Add another attribute to the given vertex_info object.
89 * \param src_index indicates which post-transformed vertex attrib slot
90 * corresponds to this attribute.
91 * \return slot in which the attribute was added
94 draw_emit_vertex_attr(struct vertex_info
*vinfo
,
95 enum attrib_emit emit
, enum interp_mode interp
,
98 const uint n
= vinfo
->num_attribs
;
99 assert(n
< PIPE_MAX_SHADER_INPUTS
);
100 vinfo
->emit
[n
] = emit
;
101 vinfo
->interp_mode
[n
] = interp
;
102 vinfo
->src_index
[n
] = src_index
;
103 vinfo
->num_attribs
++;
108 extern void draw_compute_vertex_size(struct vertex_info
*vinfo
);
111 #endif /* DRAW_VERTEX_H */