1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 /* Authors: Keith Whitwell <keith@tungstengraphics.com>
36 #include "pipe/p_state.h"
37 #include "pipe/p_context.h"
42 struct softpipe_surface
;
54 #define G_NEW_VIEWPORT 0x1
55 #define G_NEW_SETUP 0x2
57 #define G_NEW_BLEND 0x8
58 #define G_NEW_POINT 0x10
59 #define G_NEW_CLIP 0x20
60 #define G_NEW_SCISSOR 0x40
61 #define G_NEW_STIPPLE 0x80
62 #define G_NEW_FRAMEBUFFER 0x100
63 #define G_NEW_ALPHA_TEST 0x200
64 #define G_NEW_DEPTH_TEST 0x400
67 struct softpipe_context
{
68 struct pipe_context pipe
;
71 /* The most recent drawing state as set by the driver:
73 struct pipe_framebuffer_state framebuffer
;
74 struct pipe_viewport viewport
;
75 struct pipe_setup_state setup
;
76 struct pipe_fs_state fs
;
77 struct pipe_blend_state blend
;
78 struct pipe_alpha_test_state alpha_test
;
79 struct pipe_clip_state clip
;
80 struct pipe_clear_color_state clear_color
;
81 struct pipe_point_state point
;
82 struct pipe_scissor_rect scissor
;
83 struct pipe_poly_stipple poly_stipple
;
86 /* Clip derived state:
91 /* Setup derived state. TODO: this should be passed in the program
92 * tokens as parameters to DECL instructions.
94 * For now we just set colors to CONST on flatshade, textures to
95 * perspective always and everything else to linear.
97 enum interp_mode interp
[VF_ATTRIB_MAX
];
100 /* FS + setup derived state:
102 GLuint fp_attr_to_slot
[VF_ATTRIB_MAX
];
103 GLuint vf_attr_to_slot
[VF_ATTRIB_MAX
];
105 GLuint nr_frag_attrs
;
111 /* Stipple derived state:
113 GLubyte stipple_masks
[16][16];
116 /* The software clipper/setup engine.
119 struct prim_stage
*setup
;
120 struct prim_stage
*unfilled
;
121 struct prim_stage
*twoside
;
122 struct prim_stage
*clip
;
123 struct prim_stage
*flatshade
;
124 struct prim_stage
*offset
;
125 struct prim_stage
*cull
;
127 struct prim_stage
*first
;
134 * Software quad rendering pipeline
137 struct quad_stage
*shade
;
138 struct quad_stage
*depth_test
;
139 struct quad_stage
*blend
;
140 struct quad_stage
*output
;
142 struct quad_stage
*first
; /**< points to one of the above stages */
147 struct draw_context
*draw
;
153 static INLINE
struct softpipe_context
*
154 softpipe_context( struct pipe_context
*pipe
)
156 return (struct softpipe_context
*)pipe
;