sp_context.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 /* Authors:  Keith Whitwell <keith@tungstengraphics.com>
00029  */
00030 
00031 #ifndef SP_CONTEXT_H
00032 #define SP_CONTEXT_H
00033 
00034 #include "pipe/p_context.h"
00035 #include "pipe/p_defines.h"
00036 
00037 #include "draw/draw_vertex.h"
00038 
00039 #include "sp_quad.h"
00040 
00041 
00046 #define USE_DRAW_STAGE_PSTIPPLE 1
00047 
00048 /* Number of threads working on individual quads.
00049  * Setting to 1 disables this feature.
00050  */
00051 #define SP_NUM_QUAD_THREADS 1
00052 
00053 struct softpipe_winsys;
00054 struct softpipe_vbuf_render;
00055 struct draw_context;
00056 struct draw_stage;
00057 struct softpipe_tile_cache;
00058 struct sp_fragment_shader;
00059 struct sp_vertex_shader;
00060 
00061 
00062 struct softpipe_context {
00063    struct pipe_context pipe;  
00065    /* The most recent drawing state as set by the driver:
00066     */
00067    const struct pipe_blend_state   *blend;
00068    const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
00069    const struct pipe_depth_stencil_alpha_state   *depth_stencil;
00070    const struct pipe_rasterizer_state *rasterizer;
00071    const struct sp_fragment_shader *fs;
00072    const struct sp_vertex_shader *vs;
00073 
00074    struct pipe_blend_color blend_color;
00075    struct pipe_clip_state clip;
00076    struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
00077    struct pipe_framebuffer_state framebuffer;
00078    struct pipe_poly_stipple poly_stipple;
00079    struct pipe_scissor_state scissor;
00080    struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
00081    struct pipe_viewport_state viewport;
00082    struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
00083    struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
00084    unsigned dirty;
00085 
00086    unsigned num_samplers;
00087    unsigned num_textures;
00088    unsigned num_vertex_elements;
00089    unsigned num_vertex_buffers;
00090 
00091    boolean no_rast;
00092 
00093    /* Counter for occlusion queries.  Note this supports overlapping
00094     * queries.
00095     */
00096    uint64 occlusion_count;
00097 
00098    /*
00099     * Mapped vertex buffers
00100     */
00101    ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS];
00102    
00104    void *mapped_constants[PIPE_SHADER_TYPES];
00105 
00107    struct vertex_info vertex_info;
00108    struct vertex_info vertex_info_vbuf;
00109 
00110    int psize_slot;
00111 
00112    unsigned reduced_api_prim;  
00114 #if 0
00115    /* Stipple derived state:
00116     */
00117    ubyte stipple_masks[16][16];
00118 #endif
00119 
00121    struct pipe_scissor_state cliprect;
00122 
00123    unsigned line_stipple_counter;
00124 
00126    struct {
00127       struct quad_stage *polygon_stipple;
00128       struct quad_stage *earlyz;
00129       struct quad_stage *shade;
00130       struct quad_stage *alpha_test;
00131       struct quad_stage *stencil_test;
00132       struct quad_stage *depth_test;
00133       struct quad_stage *occlusion;
00134       struct quad_stage *coverage;
00135       struct quad_stage *blend;
00136       struct quad_stage *colormask;
00137       struct quad_stage *output;
00138 
00139       struct quad_stage *first; 
00140    } quad[SP_NUM_QUAD_THREADS];
00141 
00143    struct draw_context *draw;
00144    struct draw_stage *setup;
00145    struct draw_stage *vbuf;
00146    struct softpipe_vbuf_render *vbuf_render;
00147 
00148    struct softpipe_tile_cache *cbuf_cache[PIPE_MAX_COLOR_BUFS];
00149    struct softpipe_tile_cache *zsbuf_cache;
00150 
00151    struct softpipe_tile_cache *tex_cache[PIPE_MAX_SAMPLERS];
00152 
00153    int use_sse : 1;
00154    int dump_fs : 1;
00155 };
00156 
00157 
00158 static INLINE struct softpipe_context *
00159 softpipe_context( struct pipe_context *pipe )
00160 {
00161    return (struct softpipe_context *)pipe;
00162 }
00163 
00164 #endif /* SP_CONTEXT_H */
00165 

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