p_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 #ifndef PIPE_CONTEXT_H
00029 #define PIPE_CONTEXT_H
00030 
00031 #include "p_state.h"
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038    
00039 struct pipe_screen;
00040 struct pipe_fence_handle;
00041 struct pipe_state_cache;
00042 struct pipe_query;
00043 
00044 
00051 struct pipe_context {
00052    struct pipe_winsys *winsys;
00053    struct pipe_screen *screen;
00054 
00055    void *priv;  
00056    void *draw;  
00058    void (*destroy)( struct pipe_context * );
00059 
00060    
00061    /* Possible interface for setting edgeflags.  These aren't really
00062     * vertex elements, so don't fit there.
00063     */
00064    void (*set_edgeflags)( struct pipe_context *,
00065                           const unsigned *bitfield );
00066 
00067 
00072    boolean (*draw_arrays)( struct pipe_context *pipe,
00073                            unsigned mode, unsigned start, unsigned count);
00074 
00075    boolean (*draw_elements)( struct pipe_context *pipe,
00076                              struct pipe_buffer *indexBuffer,
00077                              unsigned indexSize,
00078                              unsigned mode, unsigned start, unsigned count);
00079 
00080    /* XXX: this is (probably) a temporary entrypoint, as the range
00081     * information should be available from the vertex_buffer state.
00082     * Using this to quickly evaluate a specialized path in the draw
00083     * module.
00084     */
00085    boolean (*draw_range_elements)( struct pipe_context *pipe,
00086                                    struct pipe_buffer *indexBuffer,
00087                                    unsigned indexSize,
00088                                    unsigned minIndex,
00089                                    unsigned maxIndex,
00090                                    unsigned mode, 
00091                                    unsigned start, 
00092                                    unsigned count);
00100    struct pipe_query *(*create_query)( struct pipe_context *pipe,
00101                                               unsigned query_type );
00102 
00103    void (*destroy_query)(struct pipe_context *pipe,
00104                          struct pipe_query *q);
00105 
00106    void (*begin_query)(struct pipe_context *pipe, struct pipe_query *q);
00107    void (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
00108 
00109    boolean (*get_query_result)(struct pipe_context *pipe, 
00110                                struct pipe_query *q,
00111                                boolean wait,
00112                                uint64 *result);
00119    void * (*create_blend_state)(struct pipe_context *,
00120                                 const struct pipe_blend_state *);
00121    void   (*bind_blend_state)(struct pipe_context *, void *);
00122    void   (*delete_blend_state)(struct pipe_context *, void  *);
00123 
00124    void * (*create_sampler_state)(struct pipe_context *,
00125                                   const struct pipe_sampler_state *);
00126    void   (*bind_sampler_states)(struct pipe_context *, unsigned num, void **);
00127    void   (*delete_sampler_state)(struct pipe_context *, void *);
00128 
00129    void * (*create_rasterizer_state)(struct pipe_context *,
00130                                      const struct pipe_rasterizer_state *);
00131    void   (*bind_rasterizer_state)(struct pipe_context *, void *);
00132    void   (*delete_rasterizer_state)(struct pipe_context *, void *);
00133 
00134    void * (*create_depth_stencil_alpha_state)(struct pipe_context *,
00135                                         const struct pipe_depth_stencil_alpha_state *);
00136    void   (*bind_depth_stencil_alpha_state)(struct pipe_context *, void *);
00137    void   (*delete_depth_stencil_alpha_state)(struct pipe_context *, void *);
00138 
00139    void * (*create_fs_state)(struct pipe_context *,
00140                              const struct pipe_shader_state *);
00141    void   (*bind_fs_state)(struct pipe_context *, void *);
00142    void   (*delete_fs_state)(struct pipe_context *, void *);
00143 
00144    void * (*create_vs_state)(struct pipe_context *,
00145                              const struct pipe_shader_state *);
00146    void   (*bind_vs_state)(struct pipe_context *, void *);
00147    void   (*delete_vs_state)(struct pipe_context *, void *);
00154    void (*set_blend_color)( struct pipe_context *,
00155                             const struct pipe_blend_color * );
00156 
00157    void (*set_clip_state)( struct pipe_context *,
00158                            const struct pipe_clip_state * );
00159 
00160    void (*set_constant_buffer)( struct pipe_context *,
00161                                 uint shader, uint index,
00162                                 const struct pipe_constant_buffer *buf );
00163 
00164    void (*set_framebuffer_state)( struct pipe_context *,
00165                                   const struct pipe_framebuffer_state * );
00166 
00167    void (*set_polygon_stipple)( struct pipe_context *,
00168                                 const struct pipe_poly_stipple * );
00169 
00170    void (*set_scissor_state)( struct pipe_context *,
00171                               const struct pipe_scissor_state * );
00172 
00173    void (*set_viewport_state)( struct pipe_context *,
00174                                const struct pipe_viewport_state * );
00175 
00176    void (*set_sampler_textures)( struct pipe_context *,
00177                                  unsigned num_textures,
00178                                  struct pipe_texture ** );
00179 
00180    void (*set_vertex_buffers)( struct pipe_context *,
00181                                unsigned num_buffers,
00182                                const struct pipe_vertex_buffer * );
00183 
00184    void (*set_vertex_elements)( struct pipe_context *,
00185                                 unsigned num_elements,
00186                                 const struct pipe_vertex_element * );
00194    void (*surface_copy)(struct pipe_context *pipe,
00195                         boolean do_flip,
00196                         struct pipe_surface *dest,
00197                         unsigned destx, unsigned desty,
00198                         struct pipe_surface *src, /* don't make this const - 
00199                                                      need to map/unmap */
00200                         unsigned srcx, unsigned srcy,
00201                         unsigned width, unsigned height);
00202 
00203    void (*surface_fill)(struct pipe_context *pipe,
00204                         struct pipe_surface *dst,
00205                         unsigned dstx, unsigned dsty,
00206                         unsigned width, unsigned height,
00207                         unsigned value);
00208 
00209    void (*clear)(struct pipe_context *pipe, 
00210                  struct pipe_surface *ps,
00211                  unsigned clearValue);
00216    void (*flush)( struct pipe_context *pipe,
00217                   unsigned flags,
00218                   struct pipe_fence_handle **fence );
00219 };
00220 
00221 
00222 #ifdef __cplusplus
00223 }
00224 #endif
00225 
00226 #endif /* PIPE_CONTEXT_H */

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