p_state.h revision 4824c342c864e870251a7d343c95e51274e50d23
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
418e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#include "mtypes.h"
428e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
438e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
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
5313682d959ddacde1ce65843aa8c5b43dc9017b32Brian
5413682d959ddacde1ce65843aa8c5b43dc9017b32Brian
55e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/* fwd decl */
56e62cf5c69ab605b78324639f5455ac9921e68dbaBrianstruct pipe_surface;
57e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
58e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
59e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/***
60e62cf5c69ab605b78324639f5455ac9921e68dbaBrian *** State objects
61e62cf5c69ab605b78324639f5455ac9921e68dbaBrian ***/
62e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
6313682d959ddacde1ce65843aa8c5b43dc9017b32Brian
64f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/**
65f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Primitive (point/line/tri) setup info
66f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */
67f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brianstruct pipe_setup_state
68f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{
698e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint flatshade:1;
708e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint light_twoside:1;
718e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
72f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLuint front_winding:2;  /**< PIPE_WINDING_x */
738e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
74f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLuint cull_mode:2;      /**< PIPE_WINDING_x */
758e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
76f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLuint fill_cw:2;        /**< PIPE_POLYGON_MODE_x */
77f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLuint fill_ccw:2;       /**< PIPE_POLYGON_MODE_x */
788e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
798e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint offset_cw:1;
808e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint offset_ccw:1;
818e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
828e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint scissor:1;
831be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian
84f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLuint poly_smooth:1;
851be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian   GLuint poly_stipple_enable:1;
861be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian
871be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian   GLuint line_smooth:1;
881be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian   GLuint line_stipple_enable:1;
891be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian
901be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian   GLuint point_smooth:1;
918e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
9286352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian   GLuint multisample:1;         /* XXX maybe more ms state in future */
9386352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian
94a813f654872380547faf67fba75fa30792f87ea6Brian   GLubyte line_stipple_factor;  /**< [1..256] actually */
951be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian   GLushort line_stipple_pattern;
961be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian   GLfloat line_width;
971be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian   GLfloat point_size;           /**< used when no per-vertex size */
988e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLfloat offset_units;
998e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLfloat offset_scale;
1008e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1018e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
102943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_poly_stipple {
1038e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint stipple[32];
1048e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1058e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1068e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
107ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_viewport_state {
1088e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLfloat scale[4];
1098e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLfloat translate[4];
1108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
112ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_scissor_state {
1138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLshort minx;
1148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLshort miny;
1158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLshort maxx;
1168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLshort maxy;
1178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
119943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_clip_state {
120943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLfloat ucp[PIPE_MAX_CLIP_PLANES][4];
1218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint nr;
1228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1244824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
125943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_fs_state {
1264824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLuint inputs_read;		/* FRAG_ATTRIB_* */
1274824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   const struct tgsi_token *tokens;
1284824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
1298e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
131943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_constant_buffer {
132943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLfloat constant[PIPE_MAX_CONSTANT][4];
1338e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint nr_constants;
1348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1358e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
137943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_depth_state
1388f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{
1398f2888758129b0a40d71fa4ce10d606b4bcf7631Brian   GLuint enabled:1;   /**< depth test enabled? */
1408f2888758129b0a40d71fa4ce10d606b4bcf7631Brian   GLuint writemask:1; /**< allow depth buffer writes? */
141493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian   GLuint func:3;      /**< depth test func (PIPE_FUNC_x) */
142563479552e2f491fb94e7fac5772f3c72cee962aBrian   GLuint occlusion_count:1; /**< XXX move this elsewhere? */
1438f2888758129b0a40d71fa4ce10d606b4bcf7631Brian   GLfloat clear;      /**< Clear value in [0,1] (XXX correct place?) */
1448f2888758129b0a40d71fa4ce10d606b4bcf7631Brian};
1458f2888758129b0a40d71fa4ce10d606b4bcf7631Brian
146493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brianstruct pipe_alpha_test_state {
147493ed9fc11a2bf272a2c1e9e5a072e4f02b46554Brian   GLuint enabled:1;
148493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian   GLuint func:3;    /**< PIPE_FUNC_x */
149493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian   GLfloat ref;      /**< reference value */
150493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian};
1518f2888758129b0a40d71fa4ce10d606b4bcf7631Brian
152493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brianstruct pipe_blend_state {
153493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian   GLuint blend_enable:1;
1548e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1558754b59667f8196eb884113ef1427b0792de47fdBrian   GLuint rgb_func:3;          /**< PIPE_BLEND_x */
1568754b59667f8196eb884113ef1427b0792de47fdBrian   GLuint rgb_src_factor:5;    /**< PIPE_BLENDFACTOR_x */
1578754b59667f8196eb884113ef1427b0792de47fdBrian   GLuint rgb_dst_factor:5;    /**< PIPE_BLENDFACTOR_x */
1588e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1598754b59667f8196eb884113ef1427b0792de47fdBrian   GLuint alpha_func:3;        /**< PIPE_BLEND_x */
1608754b59667f8196eb884113ef1427b0792de47fdBrian   GLuint alpha_src_factor:5;  /**< PIPE_BLENDFACTOR_x */
1618754b59667f8196eb884113ef1427b0792de47fdBrian   GLuint alpha_dst_factor:5;  /**< PIPE_BLENDFACTOR_x */
1628e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
163493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian   GLuint logicop_enable:1;
1648754b59667f8196eb884113ef1427b0792de47fdBrian   GLuint logicop_func:4;      /**< PIPE_LOGICOP_x */
16586352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian
16686352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian   GLuint colormask:4;         /**< bitmask of PIPE_MASK_R/G/B/A */
16786352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian   GLuint dither:1;
1688e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1698e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
170943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_blend_color {
171493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian   GLfloat color[4];
1728e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1738e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
17473f96c51052bf5233191d852ef463462306bf1d5Brianstruct pipe_clear_color_state
17573f96c51052bf5233191d852ef463462306bf1d5Brian{
17673f96c51052bf5233191d852ef463462306bf1d5Brian   GLfloat color[4];
17773f96c51052bf5233191d852ef463462306bf1d5Brian};
17873f96c51052bf5233191d852ef463462306bf1d5Brian
179943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_stencil_state {
180008fb50174fb6717f3b71836427bc6be4e44613cBrian   GLuint front_enabled:1;
181493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian   GLuint front_func:3;     /**< PIPE_FUNC_x */
182943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint front_fail_op:3;  /**< PIPE_STENCIL_OP_x */
183943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint front_zpass_op:3; /**< PIPE_STENCIL_OP_x */
184943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint front_zfail_op:3; /**< PIPE_STENCIL_OP_x */
185008fb50174fb6717f3b71836427bc6be4e44613cBrian   GLuint back_enabled:1;
186e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint back_func:3;      /**< PIPE_FUNC_x */
187e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint back_fail_op:3;   /**< PIPE_STENCIL_OP_x */
188e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint back_zpass_op:3;  /**< PIPE_STENCIL_OP_x */
189e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint back_zfail_op:3;  /**< PIPE_STENCIL_OP_x */
190e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLubyte ref_value[2];    /**< [0] = front, [1] = back */
191cbe4dbef8e8e9ff29d64ca588e81c2bb079d99f1Brian   GLubyte value_mask[2];
192cbe4dbef8e8e9ff29d64ca588e81c2bb079d99f1Brian   GLubyte write_mask[2];
193cbe4dbef8e8e9ff29d64ca588e81c2bb079d99f1Brian   GLubyte clear_value;
194008fb50174fb6717f3b71836427bc6be4e44613cBrian};
195008fb50174fb6717f3b71836427bc6be4e44613cBrian
196008fb50174fb6717f3b71836427bc6be4e44613cBrian
1978f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state
1988f6b6eed35832733674372dea7bd5ce69a965c4eBrian{
199f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian   /** multiple colorbuffers for multiple render targets */
200f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian   GLuint num_cbufs;
201f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian   struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
202f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian
2038f6b6eed35832733674372dea7bd5ce69a965c4eBrian   struct pipe_surface *zbuf;      /**< Z buffer */
2048f6b6eed35832733674372dea7bd5ce69a965c4eBrian   struct pipe_surface *sbuf;      /**< Stencil buffer */
2058f6b6eed35832733674372dea7bd5ce69a965c4eBrian   struct pipe_surface *abuf;      /**< Accum buffer */
2068f6b6eed35832733674372dea7bd5ce69a965c4eBrian};
2078f6b6eed35832733674372dea7bd5ce69a965c4eBrian
2088f6b6eed35832733674372dea7bd5ce69a965c4eBrian
20902a47549ad182d28d330063d4f452108e3a4b452Brian/**
21002a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state.
21102a47549ad182d28d330063d4f452108e3a4b452Brian */
212943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state
21302a47549ad182d28d330063d4f452108e3a4b452Brian{
214943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint wrap_s:3;        /**< PIPE_TEX_WRAP_x */
215943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint wrap_t:3;        /**< PIPE_TEX_WRAP_x */
216943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint wrap_r:3;        /**< PIPE_TEX_WRAP_x */
217943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint min_filter:3;    /**< PIPE_TEX_FILTER_x */
218943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint mag_filter:1;    /**< PIPE_TEX_FILTER_LINEAR or _NEAREST */
219f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLuint compare:1;       /**< shadow/depth compare enabled? */
220f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLenum compare_mode:1;  /**< PIPE_TEX_COMPARE_x */
221f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLenum compare_func:3;  /**< PIPE_FUNC_x */
222f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLfloat shadow_ambient; /**< shadow test fail color/intensity */
22302a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat min_lod;
22402a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat max_lod;
22502a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat lod_bias;
22602a47549ad182d28d330063d4f452108e3a4b452Brian#if 0 /* need these? */
22702a47549ad182d28d330063d4f452108e3a4b452Brian   GLint BaseLevel;     /**< min mipmap level, OpenGL 1.2 */
22802a47549ad182d28d330063d4f452108e3a4b452Brian   GLint MaxLevel;      /**< max mipmap level, OpenGL 1.2 */
229f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian   GLfloat border_color[4];
23002a47549ad182d28d330063d4f452108e3a4b452Brian#endif
23102a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat max_anisotropy;
23202a47549ad182d28d330063d4f452108e3a4b452Brian};
23302a47549ad182d28d330063d4f452108e3a4b452Brian
2345d69aeb0028f44d06093faede5c545908b0df89aBrian
235e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/***
236e62cf5c69ab605b78324639f5455ac9921e68dbaBrian *** Non-state Objects
237e62cf5c69ab605b78324639f5455ac9921e68dbaBrian ***/
238e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
239e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
240e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/**
241e62cf5c69ab605b78324639f5455ac9921e68dbaBrian * A mappable buffer (vertex data, pixel data, etc)
242e62cf5c69ab605b78324639f5455ac9921e68dbaBrian */
243e62cf5c69ab605b78324639f5455ac9921e68dbaBrianstruct pipe_buffer
244e62cf5c69ab605b78324639f5455ac9921e68dbaBrian{
245d523a04853fe9924d8dbf86da08019d17d4f58efBrian   void (*buffer_data)(struct pipe_buffer *pb, GLuint size, const void *src);
246d523a04853fe9924d8dbf86da08019d17d4f58efBrian   void (*buffer_sub_data)(struct pipe_buffer *pb, GLuint offset, GLuint size,
247d523a04853fe9924d8dbf86da08019d17d4f58efBrian                           const void *src);
248e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   void *(*map)(struct pipe_buffer *pb, GLuint access_mode);
249e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   void (*unmap)(struct pipe_buffer *pb);
250e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   void *ptr;        /**< address, only valid while mapped */
251e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint mode;      /**< PIPE_MAP_x, only valid while mapped */
252e62cf5c69ab605b78324639f5455ac9921e68dbaBrian};
253e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
254e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
255e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/**
256e62cf5c69ab605b78324639f5455ac9921e68dbaBrian * 2D surface.
257e62cf5c69ab605b78324639f5455ac9921e68dbaBrian * May be a renderbuffer, texture mipmap level, etc.
258e62cf5c69ab605b78324639f5455ac9921e68dbaBrian */
259e62cf5c69ab605b78324639f5455ac9921e68dbaBrianstruct pipe_surface
260e62cf5c69ab605b78324639f5455ac9921e68dbaBrian{
261e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   struct pipe_buffer buffer;  /**< surfaces can be mapped */
262e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint format:5;            /**< PIPE_FORMAT_x */
263e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint width, height;
264e62cf5c69ab605b78324639f5455ac9921e68dbaBrian#if 0
265e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLubyte *ptr;
266e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLint stride;
267e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint cpp;
268e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint format;
269e62cf5c69ab605b78324639f5455ac9921e68dbaBrian#endif
270e62cf5c69ab605b78324639f5455ac9921e68dbaBrian};
271e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
272e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
2735d69aeb0028f44d06093faede5c545908b0df89aBrian/**
274e62cf5c69ab605b78324639f5455ac9921e68dbaBrian * Texture object.
275e62cf5c69ab605b78324639f5455ac9921e68dbaBrian * Mipmap levels, cube faces, 3D slices can be accessed as surfaces.
2765d69aeb0028f44d06093faede5c545908b0df89aBrian */
2775d69aeb0028f44d06093faede5c545908b0df89aBrianstruct pipe_texture_object
2785d69aeb0028f44d06093faede5c545908b0df89aBrian{
279e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint type:2;      /**< PIPE_TEXTURE_x */
2805d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint format:5;    /**< PIPE_FORMAT_x */
2815d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint width:13;    /**< 13 bits = 8K max size */
2825d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint height:13;
2835d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint depth:13;
284e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint mipmapped:1;
285e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
286e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** to access a 1D or 2D texture object as a surface */
287e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   struct pipe_surface *(*get_2d_surface)(struct pipe_texture_object *pto,
288e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                                          GLuint level);
289e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** to access a 3D texture object as a surface */
290e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   struct pipe_surface *(*get_3d_surface)(struct pipe_texture_object *pto,
291e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                                          GLuint level, GLuint slice);
292e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** to access a cube texture object as a surface */
293e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   struct pipe_surface *(*get_cube_surface)(struct pipe_texture_object *pto,
294e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                                            GLuint face, GLuint level);
295e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** when finished with surface: */
296e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   void (*release_surface)(struct pipe_texture_object *pto,
297e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                           struct pipe_surface *ps);
2985d69aeb0028f44d06093faede5c545908b0df89aBrian};
2995d69aeb0028f44d06093faede5c545908b0df89aBrian
3005d69aeb0028f44d06093faede5c545908b0df89aBrian
3018e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif
302