p_state.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  * 
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  * 
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  * 
00026  **************************************************************************/
00027 
00028 
00038 #ifndef PIPE_STATE_H
00039 #define PIPE_STATE_H
00040 
00041 #include "p_compiler.h"
00042 #include "p_defines.h"
00043 #include "p_format.h"
00044 
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00050 
00054 #define PIPE_MAX_ATTRIBS          32
00055 #define PIPE_MAX_CLIP_PLANES       6
00056 #define PIPE_MAX_COLOR_BUFS        8
00057 #define PIPE_MAX_CONSTANT         32
00058 #define PIPE_MAX_SAMPLERS         16
00059 #define PIPE_MAX_SHADER_INPUTS    16
00060 #define PIPE_MAX_SHADER_OUTPUTS   16
00061 #define PIPE_MAX_TEXTURE_LEVELS   16
00062 
00063 
00064 /* fwd decls */
00065 struct pipe_screen;
00066 struct pipe_surface;
00067 struct pipe_winsys;
00068 
00069 
00070 
00075 struct pipe_buffer
00076 {
00077    unsigned alignment;
00078    unsigned usage;
00079    unsigned size;
00080 
00082    unsigned refcount;
00083 };
00084 
00085 
00089 struct pipe_rasterizer_state
00090 {
00091    unsigned flatshade:1;
00092    unsigned light_twoside:1;
00093    unsigned front_winding:2;  
00094    unsigned cull_mode:2;      
00095    unsigned fill_cw:2;        
00096    unsigned fill_ccw:2;       
00097    unsigned offset_cw:1;
00098    unsigned offset_ccw:1;
00099    unsigned scissor:1;
00100    unsigned poly_smooth:1;
00101    unsigned poly_stipple_enable:1;
00102    unsigned point_smooth:1;
00103    unsigned point_sprite:1;
00104    unsigned point_size_per_vertex:1; 
00105    unsigned multisample:1;         /* XXX maybe more ms state in future */
00106    unsigned line_smooth:1;
00107    unsigned line_stipple_enable:1;
00108    unsigned line_stipple_factor:8;  
00109    unsigned line_stipple_pattern:16;
00110    unsigned line_last_pixel:1;
00111    unsigned bypass_clipping:1;
00112    unsigned bypass_vs:1; 
00114    unsigned origin_lower_left:1;  
00115    unsigned flatshade_first:1;   
00116    unsigned gl_rasterization_rules:1; 
00118    float line_width;
00119    float point_size;           
00120    float point_size_min;        /* XXX - temporary, will go away */
00121    float point_size_max;        /* XXX - temporary, will go away */
00122    float offset_units;
00123    float offset_scale;
00124    ubyte sprite_coord_mode[PIPE_MAX_SHADER_OUTPUTS]; 
00125 };
00126 
00127 
00128 struct pipe_poly_stipple
00129 {
00130    unsigned stipple[32];
00131 };
00132 
00133 
00134 struct pipe_viewport_state
00135 {
00136    float scale[4];
00137    float translate[4];
00138 };
00139 
00140 
00141 struct pipe_scissor_state
00142 {
00143    unsigned minx:16;
00144    unsigned miny:16;
00145    unsigned maxx:16;
00146    unsigned maxy:16;
00147 };
00148 
00149 
00150 struct pipe_clip_state
00151 {
00152    float ucp[PIPE_MAX_CLIP_PLANES][4];
00153    unsigned nr;
00154 };
00155 
00156 
00160 struct pipe_constant_buffer
00161 {
00162    struct pipe_buffer *buffer;
00163    unsigned size;    
00164 };
00165 
00166 
00167 struct pipe_shader_state
00168 {
00169    const struct tgsi_token *tokens;
00170 };
00171 
00172 
00173 struct pipe_depth_state {
00174    unsigned enabled:1;         
00175    unsigned writemask:1;       
00176    unsigned func:3;            
00177    unsigned occlusion_count:1; 
00178 };
00179 
00180 
00181 struct pipe_stencil_state {
00182    unsigned enabled:1;  
00183    unsigned func:3;     
00184    unsigned fail_op:3;  
00185    unsigned zpass_op:3; 
00186    unsigned zfail_op:3; 
00187    ubyte ref_value;    
00188    ubyte value_mask;
00189    ubyte write_mask;
00190 };
00191 
00192 
00193 struct pipe_alpha_state {
00194    unsigned enabled:1;
00195    unsigned func:3;     
00196    float ref;           
00197 };
00198 
00199 
00200 struct pipe_depth_stencil_alpha_state
00201 {
00202    struct pipe_depth_state depth;
00203    struct pipe_stencil_state stencil[2]; 
00204    struct pipe_alpha_state alpha;
00205 };
00206 
00207 
00208 struct pipe_blend_state
00209 {
00210    unsigned blend_enable:1;
00211 
00212    unsigned rgb_func:3;          
00213    unsigned rgb_src_factor:5;    
00214    unsigned rgb_dst_factor:5;    
00216    unsigned alpha_func:3;        
00217    unsigned alpha_src_factor:5;  
00218    unsigned alpha_dst_factor:5;  
00220    unsigned logicop_enable:1;
00221    unsigned logicop_func:4;      
00223    unsigned colormask:4;         
00224    unsigned dither:1;
00225 };
00226 
00227 
00228 struct pipe_blend_color
00229 {
00230    float color[4];
00231 };
00232 
00233 
00234 struct pipe_framebuffer_state
00235 {
00236    unsigned width, height;
00237 
00239    unsigned num_cbufs;
00240    struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
00241 
00242    struct pipe_surface *zsbuf;      
00243 };
00244 
00245 
00249 struct pipe_sampler_state
00250 {
00251    unsigned wrap_s:3;            
00252    unsigned wrap_t:3;            
00253    unsigned wrap_r:3;            
00254    unsigned min_img_filter:2;    
00255    unsigned min_mip_filter:2;    
00256    unsigned mag_img_filter:2;    
00257    unsigned compare_mode:1;      
00258    unsigned compare_func:3;      
00259    unsigned normalized_coords:1; 
00260    unsigned prefilter:4;         
00261    float shadow_ambient;         
00262    float lod_bias;               
00263    float min_lod, max_lod;       
00264    float border_color[4];
00265    float max_anisotropy;
00266 };
00267 
00268 
00273 struct pipe_surface
00274 {
00275    struct pipe_buffer *buffer;   
00276    enum pipe_format format;      
00277    unsigned status;              
00278    unsigned clear_value;         
00279    unsigned width;               
00280    unsigned height;              
00281    struct pipe_format_block block;
00282    unsigned nblocksx;            
00283    unsigned nblocksy;            
00284    unsigned stride;              
00285    unsigned layout;              
00286    unsigned offset;              
00287    unsigned refcount;
00288    unsigned usage;               
00290    struct pipe_winsys *winsys;   
00292    struct pipe_texture *texture; 
00293    unsigned face;
00294    unsigned level;
00295    unsigned zslice;
00296 };
00297 
00298 
00302 struct pipe_texture
00303 { 
00304    enum pipe_texture_target target; 
00305    enum pipe_format format;         
00307    unsigned width[PIPE_MAX_TEXTURE_LEVELS];
00308    unsigned height[PIPE_MAX_TEXTURE_LEVELS];
00309    unsigned depth[PIPE_MAX_TEXTURE_LEVELS];
00310 
00311    struct pipe_format_block block;
00312    unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; 
00313    unsigned nblocksy[PIPE_MAX_TEXTURE_LEVELS]; 
00315    unsigned last_level:8;    
00316    unsigned compressed:1;
00317 
00318    unsigned nr_samples:8;          
00320    unsigned tex_usage;          /* PIPE_TEXTURE_USAGE_* */
00321 
00322    /* These are also refcounted:
00323     */
00324    unsigned refcount;
00325 
00326    struct pipe_screen *screen; 
00327 };
00328 
00329 
00335 struct pipe_vertex_buffer
00336 {
00337    unsigned pitch;    
00338    unsigned max_index;   
00339    unsigned buffer_offset;  
00340    struct pipe_buffer *buffer;  
00341 };
00342 
00343 
00347 struct pipe_vertex_element
00348 {
00350    unsigned src_offset;
00351 
00355    unsigned vertex_buffer_index:8;
00356    unsigned nr_components:8;
00357  
00358    enum pipe_format src_format;            
00359 };
00360 
00361 
00362 #ifdef __cplusplus
00363 }
00364 #endif
00365    
00366 #endif

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4