p_state.h revision 50eb29ed9492a34db4ba53f1f28a2868b808955a
18e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/**************************************************************************
28e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
38e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
48e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * All Rights Reserved.
58e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
68e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
78e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * copy of this software and associated documentation files (the
88e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * "Software"), to deal in the Software without restriction, including
98e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to
128e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * the following conditions:
138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * The above copyright notice and this permission notice (including the
158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * next paragraph) shall be included in all copies or substantial portions
168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * of the Software.
178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
208e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
248e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell **************************************************************************/
278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
28f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian
29f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/**
30f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Abstract graphics pipe state objects.
31f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian *
32f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Basic notes:
33f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian *   1. Want compact representations, so we use bitfields.
34f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian *   2. Put bitfields before other (GLfloat) fields.
35f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */
36f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian
37f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian
38943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#ifndef PIPE_STATE_H
39943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#define PIPE_STATE_H
408e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
4140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell#include "p_compiler.h"
421c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer#include "p_defines.h"
4354fc80ab31f89520d3119196bfa9c6332b35fe2fBrian#include "p_format.h"
4413682d959ddacde1ce65843aa8c5b43dc9017b32Brian
4513682d959ddacde1ce65843aa8c5b43dc9017b32Brian/**
4613682d959ddacde1ce65843aa8c5b43dc9017b32Brian * Implementation limits
4713682d959ddacde1ce65843aa8c5b43dc9017b32Brian */
4813682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_SAMPLERS     8
4913682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_CLIP_PLANES  6
5013682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_CONSTANT    32
51279ffe3f163fd6a5e7bfa108db14c81acbb06eceBrian#define PIPE_ATTRIB_MAX      32
52f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian#define PIPE_MAX_COLOR_BUFS   8
5340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell#define PIPE_MAX_TEXTURE_LEVELS  16
5463a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian#define PIPE_MAX_FEEDBACK_ATTRIBS 16
5537cf13ed9a429c755f121daa1776b1b30a985ab3Brian#define PIPE_MAX_SHADER_INPUTS 16
5637cf13ed9a429c755f121daa1776b1b30a985ab3Brian#define PIPE_MAX_SHADER_OUTPUTS 16
5713682d959ddacde1ce65843aa8c5b43dc9017b32Brian
5813682d959ddacde1ce65843aa8c5b43dc9017b32Brian
5950eb29ed9492a34db4ba53f1f28a2868b808955aBrian/* fwd decls */
60e62cf5c69ab605b78324639f5455ac9921e68dbaBrianstruct pipe_surface;
6150eb29ed9492a34db4ba53f1f28a2868b808955aBrianstruct pipe_winsys;
62e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
63bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian/* opaque type */
64bec2230514ad2e8e52625ecb339fcadfabffd4dfBrianstruct pipe_buffer_handle;
65bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian
66e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
6713682d959ddacde1ce65843aa8c5b43dc9017b32Brian
68f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/**
69294401814d1d89cc731de1c22c25333aa5d59374Zack Rusin * Primitive (point/line/tri) rasterization info
70f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */
71294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinstruct pipe_rasterizer_state
72f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{
7340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned flatshade:1;
7440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned light_twoside:1;
7540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned front_winding:2;  /**< PIPE_WINDING_x */
7640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned cull_mode:2;      /**< PIPE_WINDING_x */
7740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned fill_cw:2;        /**< PIPE_POLYGON_MODE_x */
7840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned fill_ccw:2;       /**< PIPE_POLYGON_MODE_x */
7940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned offset_cw:1;
8040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned offset_ccw:1;
8140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned scissor:1;
8240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned poly_smooth:1;
8340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned poly_stipple_enable:1;
8440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned point_smooth:1;
85cd4d732773e06e462e78b8f5bc9f3f1552a198acBrian   unsigned point_sprite:1;
86beefc6011bce9e99cb46430186de1c13f027cb05Brian   unsigned point_size_per_vertex:1; /**< size computed in vertex shader */
8740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned multisample:1;         /* XXX maybe more ms state in future */
8840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned line_smooth:1;
8940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned line_stipple_enable:1;
9040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned line_stipple_factor:8;  /**< [1..256] actually */
9140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned line_stipple_pattern:16;
92f361edae5d495254f4bc27473bf24b1ac7d5af06Brian   unsigned bypass_clipping:1;
93017f862de1f857bca29f09794539aaf411014f13Brian   unsigned origin_lower_left:1;  /**< Is (0,0) the lower-left corner? */
9440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell
9540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float line_width;
9640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float point_size;           /**< used when no per-vertex size */
9740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float offset_units;
9840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float offset_scale;
991b4852345954af9b582b03a91a3d8399b8fb0e92Brian   ubyte sprite_coord_mode[PIPE_MAX_SHADER_OUTPUTS]; /**< PIPE_SPRITE_COORD_ */
1008e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1018e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
10263a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian
103943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_poly_stipple {
10440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned stipple[32];
1058e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1068e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1078e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
108ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_viewport_state {
10940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float scale[4];
11040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float translate[4];
1118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1128e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
11350eb29ed9492a34db4ba53f1f28a2868b808955aBrian
114ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_scissor_state {
11540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned minx:16;
11640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned miny:16;
11740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned maxx:16;
11840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned maxy:16;
1198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1208e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
12150eb29ed9492a34db4ba53f1f28a2868b808955aBrian
122943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_clip_state {
12340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float ucp[PIPE_MAX_CLIP_PLANES][4];
12440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned nr;
1258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1274824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
128c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian/**
129c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian * Constants for vertex/fragment shaders
130c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian */
131943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_constant_buffer {
132c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian   struct pipe_buffer_handle *buffer;
133c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian   unsigned size;    /** in bytes */
1348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1358e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
137de653b4c9bddcec46f3ddf411ec082dd178d7b38Brianstruct pipe_shader_state {
13843d7c1fe9d2544b851afa2f1c1e245a63860e670Brian   const struct tgsi_token *tokens;
13937cf13ed9a429c755f121daa1776b1b30a985ab3Brian   ubyte num_inputs;
14037cf13ed9a429c755f121daa1776b1b30a985ab3Brian   ubyte num_outputs;
141e785f190f0d49f0367f7468c22b77962d0f14ea0Brian   ubyte input_map[PIPE_MAX_SHADER_INPUTS]; /* XXX this may be temporary */
142f69b5c56feb60791bad27d491ee9592238d4efb0Brian   ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */
143f69b5c56feb60791bad27d491ee9592238d4efb0Brian   ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
144f69b5c56feb60791bad27d491ee9592238d4efb0Brian   ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */
145f69b5c56feb60791bad27d491ee9592238d4efb0Brian   ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
14643d7c1fe9d2544b851afa2f1c1e245a63860e670Brian};
14743d7c1fe9d2544b851afa2f1c1e245a63860e670Brian
14850eb29ed9492a34db4ba53f1f28a2868b808955aBrian
149bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwellstruct pipe_depth_stencil_alpha_state
1508f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{
151d6ac959833a8e40a27907940969c622692f749b1Zack Rusin   struct {
15250eb29ed9492a34db4ba53f1f28a2868b808955aBrian      unsigned enabled:1;         /**< depth test enabled? */
15350eb29ed9492a34db4ba53f1f28a2868b808955aBrian      unsigned writemask:1;       /**< allow depth buffer writes? */
15450eb29ed9492a34db4ba53f1f28a2868b808955aBrian      unsigned func:3;            /**< depth test func (PIPE_FUNC_x) */
15550eb29ed9492a34db4ba53f1f28a2868b808955aBrian      unsigned occlusion_count:1; /**< do occlusion counting? */
156d6ac959833a8e40a27907940969c622692f749b1Zack Rusin   } depth;
157d6ac959833a8e40a27907940969c622692f749b1Zack Rusin   struct {
158bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      unsigned enabled:1;
159bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      unsigned func:3;     /**< PIPE_FUNC_x */
160bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      unsigned fail_op:3;  /**< PIPE_STENCIL_OP_x */
161bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */
162bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */
163bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      ubyte ref_value;
164bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      ubyte value_mask;
165bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      ubyte write_mask;
16650eb29ed9492a34db4ba53f1f28a2868b808955aBrian   } stencil[2];           /**< [0] = front, [1] = back */
167bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell   struct {
168bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell      unsigned enabled:1;
16950eb29ed9492a34db4ba53f1f28a2868b808955aBrian      unsigned func:3;     /**< PIPE_FUNC_x */
17050eb29ed9492a34db4ba53f1f28a2868b808955aBrian      float ref;           /**< reference value */
171bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell   } alpha;
172493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian};
1738f2888758129b0a40d71fa4ce10d606b4bcf7631Brian
174bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell
175493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brianstruct pipe_blend_state {
17640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned blend_enable:1;
1778e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
17840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned rgb_func:3;          /**< PIPE_BLEND_x */
17940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned rgb_src_factor:5;    /**< PIPE_BLENDFACTOR_x */
18040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned rgb_dst_factor:5;    /**< PIPE_BLENDFACTOR_x */
1818e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
18240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned alpha_func:3;        /**< PIPE_BLEND_x */
18340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned alpha_src_factor:5;  /**< PIPE_BLENDFACTOR_x */
18440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned alpha_dst_factor:5;  /**< PIPE_BLENDFACTOR_x */
1858e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
18640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned logicop_enable:1;
18740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned logicop_func:4;      /**< PIPE_LOGICOP_x */
18886352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian
18940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned colormask:4;         /**< bitmask of PIPE_MASK_R/G/B/A */
19040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned dither:1;
1918e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1928e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
19350eb29ed9492a34db4ba53f1f28a2868b808955aBrian
194943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_blend_color {
19540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float color[4];
1968e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1978e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
19850eb29ed9492a34db4ba53f1f28a2868b808955aBrian
1998f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state
2008f6b6eed35832733674372dea7bd5ce69a965c4eBrian{
201f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian   /** multiple colorbuffers for multiple render targets */
20240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned num_cbufs;
203f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian   struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
204f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian
2058f6b6eed35832733674372dea7bd5ce69a965c4eBrian   struct pipe_surface *zbuf;      /**< Z buffer */
2068f6b6eed35832733674372dea7bd5ce69a965c4eBrian   struct pipe_surface *sbuf;      /**< Stencil buffer */
2078f6b6eed35832733674372dea7bd5ce69a965c4eBrian};
2088f6b6eed35832733674372dea7bd5ce69a965c4eBrian
2098f6b6eed35832733674372dea7bd5ce69a965c4eBrian
21002a47549ad182d28d330063d4f452108e3a4b452Brian/**
21102a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state.
21202a47549ad182d28d330063d4f452108e3a4b452Brian */
213943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state
21402a47549ad182d28d330063d4f452108e3a4b452Brian{
21540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned wrap_s:3;        /**< PIPE_TEX_WRAP_x */
21640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned wrap_t:3;        /**< PIPE_TEX_WRAP_x */
21740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned wrap_r:3;        /**< PIPE_TEX_WRAP_x */
21840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned min_img_filter:2;    /**< PIPE_TEX_FILTER_x */
21940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned min_mip_filter:2;    /**< PIPE_TEX_MIPFILTER_x */
22040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned mag_img_filter:2;    /**< PIPE_TEX_FILTER_x */
22140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned compare:1;       /**< shadow/depth compare enabled? */
22240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned compare_mode:1;  /**< PIPE_TEX_COMPARE_x */
22340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned compare_func:3;  /**< PIPE_FUNC_x */
224369eefc34c8d7acdb881ea5b0516406d71344fc4Brian   unsigned normalized_coords:1;  /**< Are coords normalized to [0,1]? */
22540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float shadow_ambient; /**< shadow test fail color/intensity */
22640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float min_lod;
22740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float max_lod;
22840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float lod_bias;
22902a47549ad182d28d330063d4f452108e3a4b452Brian#if 0 /* need these? */
23040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   int BaseLevel;     /**< min mipmap level, OpenGL 1.2 */
23140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   int MaxLevel;      /**< max mipmap level, OpenGL 1.2 */
23202a47549ad182d28d330063d4f452108e3a4b452Brian#endif
233d45dd5672ae60f1f49648725974693bf4ebf4bf8Brian   float border_color[4];
23440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   float max_anisotropy;
23502a47549ad182d28d330063d4f452108e3a4b452Brian};
23602a47549ad182d28d330063d4f452108e3a4b452Brian
2375d69aeb0028f44d06093faede5c545908b0df89aBrian
23820adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/**
239b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer * 2D surface.  This is basically a view into a memory buffer.
24020adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * May be a renderbuffer, texture mipmap level, etc.
24120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */
24220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface
24320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{
244b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer   struct pipe_buffer_handle *buffer; /**< driver private buffer handle */
245b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer   ubyte *map;    /**< only non-NULL when surface is actually mapped */
246b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer   unsigned map_refcount;  /**< Reference count for mapping */
24754fc80ab31f89520d3119196bfa9c6332b35fe2fBrian   enum pipe_format format;      /**< PIPE_FORMAT_x */
24811a80160fd60d1eb1541b49128c659526a5d8ac8Michel Dänzer   unsigned cpp;                 /**< bytes per pixel */
24940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned width, height;
25011a80160fd60d1eb1541b49128c659526a5d8ac8Michel Dänzer   unsigned pitch;               /**< in pixels */
251b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer   unsigned offset;              /**< offset from start of buffer, in bytes */
25240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned refcount;
2537d1a04e499564212a2a9aace12b05f424a357d3fBrian   struct pipe_winsys *winsys;   /**< winsys which owns/created the surface */
25420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian};
25520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian
25620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian
2575d69aeb0028f44d06093faede5c545908b0df89aBrian/**
258753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer * Texture. Represents one or several texture images on one or several mipmap
259753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer * levels.
260d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */
261753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzerstruct pipe_texture
262753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer{
263d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* Effectively the key:
264d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
2651c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer   enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
2661c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer   enum pipe_format format;         /**< PIPE_FORMAT_x */
26788723b2fc84628c1bc1e0008b88602b85e8668beMichel Dänzer
26840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned first_level;
26940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned last_level;
270d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
271753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer   unsigned width[PIPE_MAX_TEXTURE_LEVELS];
272753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer   unsigned height[PIPE_MAX_TEXTURE_LEVELS];
273753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer   unsigned depth[PIPE_MAX_TEXTURE_LEVELS];
27440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned cpp;
275d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
27640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned compressed:1;
277d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
278d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* These are also refcounted:
279d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
28040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned refcount;
281d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian};
282d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
283d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
2846e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/**
2856e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * A vertex buffer.  Typically, all the vertex data/attributes for
2866e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * drawing something will be in one buffer.  But it's also possible, for
2876e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * example, to put colors in one buffer and texcoords in another.
2886e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */
2898269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_buffer
2908269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{
2916e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   unsigned pitch:11;    /**< stride to same attrib in next vertex, in bytes */
2926e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   unsigned max_index;   /**< number of vertices in this buffer */
2936e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
2946e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   struct pipe_buffer_handle *buffer;  /**< the actual buffer */
2958269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell};
2968269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell
2978269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell
2986e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/**
2996e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * Information to describe a vertex attribute (position, color, etc)
3006e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */
3018269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_element
3028269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{
3036e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   /** Offset of this attribute, in bytes, from the start of the vertex */
3046e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   unsigned src_offset:11;
3056e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian
3066e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does
3076e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian    * this attribute live in?
3086e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian    */
3096e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian   unsigned vertex_buffer_index:5;
310c31416971e4eac148f8e82d6c4392bd6f9cbc05dKeith Whitwell   unsigned nr_components:3;
311c31416971e4eac148f8e82d6c4392bd6f9cbc05dKeith Whitwell
31254fc80ab31f89520d3119196bfa9c6332b35fe2fBrian   enum pipe_format src_format; 	   /**< PIPE_FORMAT_* */
3138269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell};
3148269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell
3158269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell
3168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif
317