draw_pipe.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  /*
00029   * Authors:
00030   *   Keith Whitwell <keith@tungstengraphics.com>
00031   */
00032 
00033 #ifndef DRAW_PIPE_H
00034 #define DRAW_PIPE_H
00035 
00036 #include "pipe/p_compiler.h"
00037 #include "draw_private.h"       /* for sizeof(vertex_header) */
00038 
00039 
00043 struct prim_header {
00044    float det;                 
00045    ushort flags;
00046    ushort pad;
00047    struct vertex_header *v[3];  
00048 };
00049 
00050 
00051 
00055 struct draw_stage
00056 {
00057    struct draw_context *draw;   
00059    struct draw_stage *next;     
00061    struct vertex_header **tmp;  
00062    unsigned nr_tmps;
00063 
00064    void (*point)( struct draw_stage *,
00065                   struct prim_header * );
00066 
00067    void (*line)( struct draw_stage *,
00068                  struct prim_header * );
00069 
00070    void (*tri)( struct draw_stage *,
00071                 struct prim_header * );
00072 
00073    void (*flush)( struct draw_stage *,
00074                   unsigned flags );
00075 
00076    void (*reset_stipple_counter)( struct draw_stage * );
00077 
00078    void (*destroy)( struct draw_stage * );
00079 };
00080 
00081 
00082 extern struct draw_stage *draw_unfilled_stage( struct draw_context *context );
00083 extern struct draw_stage *draw_twoside_stage( struct draw_context *context );
00084 extern struct draw_stage *draw_offset_stage( struct draw_context *context );
00085 extern struct draw_stage *draw_clip_stage( struct draw_context *context );
00086 extern struct draw_stage *draw_flatshade_stage( struct draw_context *context );
00087 extern struct draw_stage *draw_cull_stage( struct draw_context *context );
00088 extern struct draw_stage *draw_stipple_stage( struct draw_context *context );
00089 extern struct draw_stage *draw_wide_line_stage( struct draw_context *context );
00090 extern struct draw_stage *draw_wide_point_stage( struct draw_context *context );
00091 extern struct draw_stage *draw_validate_stage( struct draw_context *context );
00092 
00093 
00094 extern void draw_free_temp_verts( struct draw_stage *stage );
00095 extern boolean draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr );
00096 
00097 extern void draw_reset_vertex_ids( struct draw_context *draw );
00098 
00099 void draw_pipe_passthrough_tri(struct draw_stage *stage, struct prim_header *header);
00100 void draw_pipe_passthrough_line(struct draw_stage *stage, struct prim_header *header);
00101 void draw_pipe_passthrough_point(struct draw_stage *stage, struct prim_header *header);
00102 
00103 
00104 
00112 static INLINE struct vertex_header *
00113 dup_vert( struct draw_stage *stage,
00114           const struct vertex_header *vert,
00115           unsigned idx )
00116 {   
00117    struct vertex_header *tmp = stage->tmp[idx];
00118    const uint vsize = sizeof(struct vertex_header)
00119       + stage->draw->vs.num_vs_outputs * 4 * sizeof(float);
00120    memcpy(tmp, vert, vsize);
00121    tmp->vertex_id = UNDEFINED_VERTEX_ID;
00122    return tmp;
00123 }
00124 
00125 #endif

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