p_state.h revision d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09b
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_constant_buffer {
126943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLfloat constant[PIPE_MAX_CONSTANT][4];
1278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint nr_constants;
1288e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
1298e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
13143d7c1fe9d2544b851afa2f1c1e245a63860e670Brianstruct pipe_fs_state {
1328c99f7ba61fcc95ef22d8ccd8cce3e31eaa67757Brian   GLbitfield inputs_read;		/* FRAG_ATTRIB_* */
13343d7c1fe9d2544b851afa2f1c1e245a63860e670Brian   const struct tgsi_token *tokens;
13443d7c1fe9d2544b851afa2f1c1e245a63860e670Brian   struct pipe_constant_buffer *constants; /* XXX temporary? */
13543d7c1fe9d2544b851afa2f1c1e245a63860e670Brian};
13643d7c1fe9d2544b851afa2f1c1e245a63860e670Brian
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};
2068f6b6eed35832733674372dea7bd5ce69a965c4eBrian
2078f6b6eed35832733674372dea7bd5ce69a965c4eBrian
20802a47549ad182d28d330063d4f452108e3a4b452Brian/**
20902a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state.
21002a47549ad182d28d330063d4f452108e3a4b452Brian */
211943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state
21202a47549ad182d28d330063d4f452108e3a4b452Brian{
213943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint wrap_s:3;        /**< PIPE_TEX_WRAP_x */
214943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint wrap_t:3;        /**< PIPE_TEX_WRAP_x */
215943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint wrap_r:3;        /**< PIPE_TEX_WRAP_x */
216943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint min_filter:3;    /**< PIPE_TEX_FILTER_x */
217943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell   GLuint mag_filter:1;    /**< PIPE_TEX_FILTER_LINEAR or _NEAREST */
218f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLuint compare:1;       /**< shadow/depth compare enabled? */
219f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLenum compare_mode:1;  /**< PIPE_TEX_COMPARE_x */
220f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLenum compare_func:3;  /**< PIPE_FUNC_x */
221f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian   GLfloat shadow_ambient; /**< shadow test fail color/intensity */
22202a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat min_lod;
22302a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat max_lod;
22402a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat lod_bias;
22502a47549ad182d28d330063d4f452108e3a4b452Brian#if 0 /* need these? */
22602a47549ad182d28d330063d4f452108e3a4b452Brian   GLint BaseLevel;     /**< min mipmap level, OpenGL 1.2 */
22702a47549ad182d28d330063d4f452108e3a4b452Brian   GLint MaxLevel;      /**< max mipmap level, OpenGL 1.2 */
228f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian   GLfloat border_color[4];
22902a47549ad182d28d330063d4f452108e3a4b452Brian#endif
23002a47549ad182d28d330063d4f452108e3a4b452Brian   GLfloat max_anisotropy;
23102a47549ad182d28d330063d4f452108e3a4b452Brian};
23202a47549ad182d28d330063d4f452108e3a4b452Brian
2335d69aeb0028f44d06093faede5c545908b0df89aBrian
234e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/***
23520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian *** Resource Objects
236e62cf5c69ab605b78324639f5455ac9921e68dbaBrian ***/
237e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
2382f245bce420c7a6c6928c4927d0f9a5701cde17fBrianstruct pipe_region
2392f245bce420c7a6c6928c4927d0f9a5701cde17fBrian{
2401d1b9e6be45e75ad12a01c82e3c0d55ff9da4183Keith Whitwell   void *buffer;    /**< driver private buffer handle */
24120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian
2422f245bce420c7a6c6928c4927d0f9a5701cde17fBrian   GLuint refcount; /**< Reference count for region */
2432f245bce420c7a6c6928c4927d0f9a5701cde17fBrian   GLuint cpp;      /**< bytes per pixel */
2442f245bce420c7a6c6928c4927d0f9a5701cde17fBrian   GLuint pitch;    /**< in pixels */
2452f245bce420c7a6c6928c4927d0f9a5701cde17fBrian   GLuint height;   /**< in pixels */
2462f245bce420c7a6c6928c4927d0f9a5701cde17fBrian   GLubyte *map;    /**< only non-NULL when region is actually mapped */
2472f245bce420c7a6c6928c4927d0f9a5701cde17fBrian   GLuint map_refcount;  /**< Reference count for mapping */
2482f245bce420c7a6c6928c4927d0f9a5701cde17fBrian
2492f245bce420c7a6c6928c4927d0f9a5701cde17fBrian   GLuint draw_offset; /**< Offset of drawing address within the region */
2502f245bce420c7a6c6928c4927d0f9a5701cde17fBrian};
2512f245bce420c7a6c6928c4927d0f9a5701cde17fBrian
25220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian
25320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/**
25420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * 2D surface.
25520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * May be a renderbuffer, texture mipmap level, etc.
25620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */
25720adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface
25820adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{
25920adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian   struct pipe_region *region;
26020adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian   GLuint format:5;            /**< PIPE_FORMAT_x */
26120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian   GLuint width, height;
26220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian
26320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian   void *rb;  /**< Ptr back to renderbuffer (temporary?) */
26420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian};
26520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian
26620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian
2675d69aeb0028f44d06093faede5c545908b0df89aBrian/**
268e62cf5c69ab605b78324639f5455ac9921e68dbaBrian * Texture object.
269e62cf5c69ab605b78324639f5455ac9921e68dbaBrian * Mipmap levels, cube faces, 3D slices can be accessed as surfaces.
2705d69aeb0028f44d06093faede5c545908b0df89aBrian */
2715d69aeb0028f44d06093faede5c545908b0df89aBrianstruct pipe_texture_object
2725d69aeb0028f44d06093faede5c545908b0df89aBrian{
273e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint type:2;      /**< PIPE_TEXTURE_x */
2745d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint format:5;    /**< PIPE_FORMAT_x */
2755d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint width:13;    /**< 13 bits = 8K max size */
2765d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint height:13;
2775d69aeb0028f44d06093faede5c545908b0df89aBrian   GLuint depth:13;
278e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   GLuint mipmapped:1;
279e62cf5c69ab605b78324639f5455ac9921e68dbaBrian
280e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** to access a 1D or 2D texture object as a surface */
281e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   struct pipe_surface *(*get_2d_surface)(struct pipe_texture_object *pto,
282e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                                          GLuint level);
283e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** to access a 3D texture object as a surface */
284e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   struct pipe_surface *(*get_3d_surface)(struct pipe_texture_object *pto,
285e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                                          GLuint level, GLuint slice);
286e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** to access a cube texture object as a surface */
287e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   struct pipe_surface *(*get_cube_surface)(struct pipe_texture_object *pto,
288e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                                            GLuint face, GLuint level);
289e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   /** when finished with surface: */
290e62cf5c69ab605b78324639f5455ac9921e68dbaBrian   void (*release_surface)(struct pipe_texture_object *pto,
291e62cf5c69ab605b78324639f5455ac9921e68dbaBrian                           struct pipe_surface *ps);
2925d69aeb0028f44d06093faede5c545908b0df89aBrian};
2935d69aeb0028f44d06093faede5c545908b0df89aBrian
2945d69aeb0028f44d06093faede5c545908b0df89aBrian
295d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian/**
296d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian * Describes the location of each texture image within a texture region.
297d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */
298d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrianstruct pipe_mipmap_level
299d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian{
300d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint level_offset;
301d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint width;
302d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint height;
303d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint depth;
304d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint nr_images;
305d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
306d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* Explicitly store the offset of each image for each cube face or
307d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    * depth value.  Pretty much have to accept that hardware formats
308d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    * are going to be so diverse that there is no unified way to
309d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    * compute the offsets of depth/cube images within a mipmap level,
310d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    * so have to store them as a lookup table:
311d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
312d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint *image_offset;
313d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian};
314d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
315d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrianstruct pipe_mipmap_tree
316d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian{
317d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* Effectively the key:
318d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
319d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLenum target;
320d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLenum internal_format;
321d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
322d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint first_level;
323d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint last_level;
324d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
325d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint width0, height0, depth0; /**< Level zero image dimensions */
326d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint cpp;
327d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLboolean compressed;
328d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
329d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* Derived from the above:
330d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
331d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint pitch;
332d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint depth_pitch;          /* per-image on i945? */
333d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint total_height;
334d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
335d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* Includes image offset tables:
336d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
337d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   struct pipe_mipmap_level level[MAX_TEXTURE_LEVELS];
338d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
339d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* The data is held here:
340d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
341d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   struct pipe_region *region;
342d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
343d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   /* These are also refcounted:
344d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian    */
345d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian   GLuint refcount;
346d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian};
347d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
348d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
349d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian
35095794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwellstruct pipe_buffer_handle;
35195794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell
35295794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell#define PIPE_BUFFER_FLAG_READ    0x1
35395794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell#define PIPE_BUFFER_FLAG_WRITE   0x2
35495794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell
35595794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell#define PIPE_BUFFER_USE_TEXTURE         0x1
35695794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell#define PIPE_BUFFER_USE_VERTEX_BUFFER   0x2
35795794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell#define PIPE_BUFFER_USE_INDEX_BUFFER    0x4
35895794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell#define PIPE_BUFFER_USE_RENDER_TARGET   0x8
35995794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell
36095794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell
36195794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell
36295794abec4bdc5cda9f2e7d139a70c3acf372fe3Keith Whitwell
3638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif
364