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>
34 #include "pipe/p_state.h"
35 #include "pipe/p_context.h"
39 #define FO_NEW_VIEWPORT 0x1
40 #define FO_NEW_RASTERIZER 0x2
41 #define FO_NEW_FRAGMENT_SHADER 0x4
42 #define FO_NEW_BLEND 0x8
43 #define FO_NEW_CLIP 0x10
44 #define FO_NEW_SCISSOR 0x20
45 #define FO_NEW_STIPPLE 0x40
46 #define FO_NEW_FRAMEBUFFER 0x80
47 #define FO_NEW_ALPHA_TEST 0x100
48 #define FO_NEW_DEPTH_STENCIL 0x200
49 #define FO_NEW_SAMPLER 0x400
50 #define FO_NEW_SAMPLER_VIEW 0x800
51 #define FO_NEW_VERTEX 0x2000
52 #define FO_NEW_VERTEX_SHADER 0x4000
53 #define FO_NEW_BLEND_COLOR 0x8000
54 #define FO_NEW_STENCIL_REF 0x10000
55 #define FO_NEW_CLEAR_COLOR 0x20000
56 #define FO_NEW_VERTEX_BUFFER 0x40000
57 #define FO_NEW_VERTEX_ELEMENT 0x80000
58 #define FO_NEW_SAMPLE_MASK 0x100000
70 struct fo_sampler_view
{
71 struct pipe_sampler_view base
;
72 struct pipe_sampler_view
*sw
;
73 struct pipe_sampler_view
*hw
;
76 struct failover_context
{
77 struct pipe_context pipe
; /**< base class */
80 /* The most recent drawing state as set by the driver:
82 const struct fo_state
*blend
;
83 const struct fo_state
*sampler
[PIPE_MAX_SAMPLERS
];
84 const struct fo_state
*vertex_samplers
[PIPE_MAX_VERTEX_SAMPLERS
];
85 const struct fo_state
*depth_stencil
;
86 const struct fo_state
*rasterizer
;
87 const struct fo_state
*fragment_shader
;
88 const struct fo_state
*vertex_shader
;
89 const struct fo_state
*vertex_elements
;
91 struct pipe_blend_color blend_color
;
92 struct pipe_stencil_ref stencil_ref
;
93 struct pipe_clip_state clip
;
95 struct pipe_framebuffer_state framebuffer
;
96 struct pipe_poly_stipple poly_stipple
;
97 struct pipe_scissor_state scissor
;
98 struct pipe_viewport_state viewport
;
99 struct pipe_vertex_buffer vertex_buffers
[PIPE_MAX_ATTRIBS
];
101 uint num_vertex_buffers
;
103 void *sw_sampler_state
[PIPE_MAX_SAMPLERS
];
104 void *hw_sampler_state
[PIPE_MAX_SAMPLERS
];
105 void *sw_vertex_sampler_state
[PIPE_MAX_VERTEX_SAMPLERS
];
106 void *hw_vertex_sampler_state
[PIPE_MAX_VERTEX_SAMPLERS
];
108 struct fo_sampler_view
*fragment_sampler_views
[PIPE_MAX_SAMPLERS
];
109 struct fo_sampler_view
*vertex_sampler_views
[PIPE_MAX_VERTEX_SAMPLERS
];
110 unsigned num_fragment_sampler_views
;
111 unsigned num_vertex_sampler_views
;
115 unsigned num_samplers
;
116 unsigned num_vertex_samplers
;
119 struct pipe_context
*hw
;
120 struct pipe_context
*sw
;
125 void failover_init_state_functions( struct failover_context
*failover
);
126 void failover_state_emit( struct failover_context
*failover
);
128 static INLINE
struct failover_context
*
129 failover_context( struct pipe_context
*pipe
)
131 return (struct failover_context
*)pipe
;
134 /* Internal functions
137 failover_set_constant_buffer(struct pipe_context
*pipe
,
138 uint shader
, uint index
,
139 struct pipe_resource
*resource
);
142 #endif /* FO_CONTEXT_H */