sp_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 /* Authors:  Keith Whitwell <keith@tungstengraphics.com>
00029  */
00030 
00031 #ifndef SP_STATE_H
00032 #define SP_STATE_H
00033 
00034 #include "pipe/p_state.h"
00035 #include "tgsi/tgsi_scan.h"
00036 
00037 
00038 #define SP_NEW_VIEWPORT      0x1
00039 #define SP_NEW_RASTERIZER    0x2
00040 #define SP_NEW_FS            0x4
00041 #define SP_NEW_BLEND         0x8
00042 #define SP_NEW_CLIP          0x10
00043 #define SP_NEW_SCISSOR       0x20
00044 #define SP_NEW_STIPPLE       0x40
00045 #define SP_NEW_FRAMEBUFFER   0x80
00046 #define SP_NEW_DEPTH_STENCIL_ALPHA 0x100
00047 #define SP_NEW_CONSTANTS     0x200
00048 #define SP_NEW_SAMPLER       0x400
00049 #define SP_NEW_TEXTURE       0x800
00050 #define SP_NEW_VERTEX        0x1000
00051 #define SP_NEW_VS            0x2000
00052 #define SP_NEW_QUERY         0x4000
00053 
00054 
00055 struct tgsi_sampler;
00056 struct tgsi_exec_machine;
00057 struct vertex_info;
00058 
00059 
00065 struct sp_fragment_shader {
00066    struct pipe_shader_state shader;
00067 
00068    struct tgsi_shader_info info;
00069 
00070    void (*prepare)( const struct sp_fragment_shader *shader,
00071                     struct tgsi_exec_machine *machine,
00072                     struct tgsi_sampler *samplers);
00073 
00074    /* Run the shader - this interface will get cleaned up in the
00075     * future:
00076     */
00077    unsigned (*run)( const struct sp_fragment_shader *shader,
00078                     struct tgsi_exec_machine *machine,
00079                     struct quad_header *quad );
00080 
00081 
00082    void (*delete)( struct sp_fragment_shader * );
00083 };
00084 
00085 
00087 struct sp_vertex_shader {
00088    struct pipe_shader_state shader;  /* Note: this field not actually used */
00089    struct draw_vertex_shader *draw_data;
00090 };
00091 
00092 
00093 
00094 void *
00095 softpipe_create_blend_state(struct pipe_context *,
00096                             const struct pipe_blend_state *);
00097 void softpipe_bind_blend_state(struct pipe_context *,
00098                                void *);
00099 void softpipe_delete_blend_state(struct pipe_context *,
00100                                  void *);
00101 
00102 void *
00103 softpipe_create_sampler_state(struct pipe_context *,
00104                               const struct pipe_sampler_state *);
00105 void softpipe_bind_sampler_states(struct pipe_context *, unsigned, void **);
00106 void softpipe_delete_sampler_state(struct pipe_context *, void *);
00107 
00108 void *
00109 softpipe_create_depth_stencil_state(struct pipe_context *,
00110                                     const struct pipe_depth_stencil_alpha_state *);
00111 void softpipe_bind_depth_stencil_state(struct pipe_context *, void *);
00112 void softpipe_delete_depth_stencil_state(struct pipe_context *, void *);
00113 
00114 void *
00115 softpipe_create_rasterizer_state(struct pipe_context *,
00116                                  const struct pipe_rasterizer_state *);
00117 void softpipe_bind_rasterizer_state(struct pipe_context *, void *);
00118 void softpipe_delete_rasterizer_state(struct pipe_context *, void *);
00119 
00120 void softpipe_set_framebuffer_state( struct pipe_context *,
00121                              const struct pipe_framebuffer_state * );
00122 
00123 void softpipe_set_blend_color( struct pipe_context *pipe,
00124                                const struct pipe_blend_color *blend_color );
00125 
00126 void softpipe_set_clip_state( struct pipe_context *,
00127                              const struct pipe_clip_state * );
00128 
00129 void softpipe_set_constant_buffer(struct pipe_context *,
00130                                   uint shader, uint index,
00131                                   const struct pipe_constant_buffer *buf);
00132 
00133 void *softpipe_create_fs_state(struct pipe_context *,
00134                                const struct pipe_shader_state *);
00135 void softpipe_bind_fs_state(struct pipe_context *, void *);
00136 void softpipe_delete_fs_state(struct pipe_context *, void *);
00137 void *softpipe_create_vs_state(struct pipe_context *,
00138                                const struct pipe_shader_state *);
00139 void softpipe_bind_vs_state(struct pipe_context *, void *);
00140 void softpipe_delete_vs_state(struct pipe_context *, void *);
00141 
00142 void softpipe_set_polygon_stipple( struct pipe_context *,
00143                                   const struct pipe_poly_stipple * );
00144 
00145 void softpipe_set_scissor_state( struct pipe_context *,
00146                                  const struct pipe_scissor_state * );
00147 
00148 void softpipe_set_sampler_textures( struct pipe_context *,
00149                                     unsigned num,
00150                                     struct pipe_texture ** );
00151 
00152 void softpipe_set_viewport_state( struct pipe_context *,
00153                                   const struct pipe_viewport_state * );
00154 
00155 void softpipe_set_vertex_elements(struct pipe_context *,
00156                                   unsigned count,
00157                                   const struct pipe_vertex_element *);
00158 
00159 void softpipe_set_vertex_buffers(struct pipe_context *,
00160                                  unsigned count,
00161                                  const struct pipe_vertex_buffer *);
00162 
00163 
00164 void softpipe_update_derived( struct softpipe_context *softpipe );
00165 
00166 
00167 boolean softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
00168                              unsigned start, unsigned count);
00169 
00170 boolean softpipe_draw_elements(struct pipe_context *pipe,
00171                                struct pipe_buffer *indexBuffer,
00172                                unsigned indexSize,
00173                                unsigned mode, unsigned start, unsigned count);
00174 boolean
00175 softpipe_draw_range_elements(struct pipe_context *pipe,
00176                              struct pipe_buffer *indexBuffer,
00177                              unsigned indexSize,
00178                              unsigned min_index,
00179                              unsigned max_index,
00180                              unsigned mode, unsigned start, unsigned count);
00181 
00182 void
00183 softpipe_set_edgeflags(struct pipe_context *pipe, const unsigned *edgeflags);
00184 
00185 
00186 void
00187 softpipe_map_surfaces(struct softpipe_context *sp);
00188 
00189 void
00190 softpipe_unmap_surfaces(struct softpipe_context *sp);
00191 
00192 void
00193 softpipe_map_texture_surfaces(struct softpipe_context *sp);
00194 
00195 void
00196 softpipe_unmap_texture_surfaces(struct softpipe_context *sp);
00197 
00198 
00199 struct vertex_info *
00200 softpipe_get_vertex_info(struct softpipe_context *softpipe);
00201 
00202 struct vertex_info *
00203 softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe);
00204 
00205 
00206 #endif

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