fo_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 FO_CONTEXT_H
00032 #define FO_CONTEXT_H
00033 
00034 #include "pipe/p_state.h"
00035 #include "pipe/p_context.h"
00036 
00037 
00038 
00039 #define FO_NEW_VIEWPORT        0x1
00040 #define FO_NEW_RASTERIZER      0x2
00041 #define FO_NEW_FRAGMENT_SHADER 0x4
00042 #define FO_NEW_BLEND           0x8
00043 #define FO_NEW_CLIP            0x10
00044 #define FO_NEW_SCISSOR         0x20
00045 #define FO_NEW_STIPPLE         0x40
00046 #define FO_NEW_FRAMEBUFFER     0x80
00047 #define FO_NEW_ALPHA_TEST      0x100
00048 #define FO_NEW_DEPTH_STENCIL   0x200
00049 #define FO_NEW_SAMPLER         0x400
00050 #define FO_NEW_TEXTURE         0x800
00051 #define FO_NEW_VERTEX          0x2000
00052 #define FO_NEW_VERTEX_SHADER   0x4000
00053 #define FO_NEW_BLEND_COLOR     0x8000
00054 #define FO_NEW_CLEAR_COLOR     0x10000
00055 #define FO_NEW_VERTEX_BUFFER   0x20000
00056 #define FO_NEW_VERTEX_ELEMENT  0x40000
00057 
00058 
00059 
00060 #define FO_HW 0
00061 #define FO_SW 1
00062 
00063 struct fo_state {
00064    void *sw_state;
00065    void *hw_state;
00066 };
00067 struct failover_context {
00068    struct pipe_context pipe;  
00071    /* The most recent drawing state as set by the driver:
00072     */
00073    const struct fo_state     *blend;
00074    const struct fo_state     *sampler[PIPE_MAX_SAMPLERS];
00075    const struct fo_state     *depth_stencil;
00076    const struct fo_state     *rasterizer;
00077    const struct fo_state     *fragment_shader;
00078    const struct fo_state     *vertex_shader;
00079 
00080    struct pipe_blend_color blend_color;
00081    struct pipe_clip_state clip;
00082    struct pipe_framebuffer_state framebuffer;
00083    struct pipe_poly_stipple poly_stipple;
00084    struct pipe_scissor_state scissor;
00085    struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
00086    struct pipe_viewport_state viewport;
00087    struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
00088    struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
00089 
00090    uint num_vertex_buffers;
00091    uint num_vertex_elements;
00092 
00093    void *sw_sampler_state[PIPE_MAX_SAMPLERS];
00094    void *hw_sampler_state[PIPE_MAX_SAMPLERS];
00095 
00096    unsigned dirty;
00097 
00098    unsigned num_samplers;
00099    unsigned num_textures;
00100 
00101    unsigned mode;
00102    struct pipe_context *hw;
00103    struct pipe_context *sw;
00104 };
00105 
00106 
00107 
00108 void failover_init_state_functions( struct failover_context *failover );
00109 void failover_state_emit( struct failover_context *failover );
00110 
00111 static INLINE struct failover_context *
00112 failover_context( struct pipe_context *pipe )
00113 {
00114    return (struct failover_context *)pipe;
00115 }
00116 
00117 
00118 #endif /* FO_CONTEXT_H */

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