060997bfa43468ae99aa6ff2fe5c493b3bd5b815
[mesa.git] / src / mesa / pipe / i915simple / i915_context.h
1 /**************************************************************************
2 *
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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.
25 *
26 **************************************************************************/
27
28 #ifndef I915_CONTEXT_H
29 #define I915_CONTEXT_H
30
31
32 #include "pipe/p_context.h"
33 #include "pipe/p_state.h"
34
35 struct i915_context
36 {
37 struct pipe_context pipe;
38 struct i915_winsys *winsys;
39 struct draw_context *draw;
40
41 /* The most recent drawing state as set by the driver:
42 */
43 struct pipe_alpha_test_state alpha_test;
44 struct pipe_blend_state blend;
45 struct pipe_blend_color blend_color;
46 struct pipe_clear_color_state clear_color;
47 struct pipe_clip_state clip;
48 struct pipe_depth_state depth_test;
49 struct pipe_framebuffer_state framebuffer;
50 struct pipe_fs_state fs;
51 struct pipe_poly_stipple poly_stipple;
52 struct pipe_scissor_state scissor;
53 struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS];
54 struct pipe_setup_state setup;
55 struct pipe_stencil_state stencil;
56 struct pipe_texture_object *texture[PIPE_MAX_SAMPLERS];
57 struct pipe_viewport_state viewport;
58 GLuint dirty;
59
60 struct pipe_scissor_state cliprect;
61
62 };
63
64 #define I915_NEW_VIEWPORT 0x1
65 #define I915_NEW_SETUP 0x2
66 #define I915_NEW_FS 0x4
67 #define I915_NEW_BLEND 0x8
68 #define I915_NEW_CLIP 0x10
69 #define I915_NEW_SCISSOR 0x20
70 #define I915_NEW_STIPPLE 0x40
71 #define I915_NEW_FRAMEBUFFER 0x80
72 #define I915_NEW_ALPHA_TEST 0x100
73 #define I915_NEW_DEPTH_TEST 0x200
74 #define I915_NEW_SAMPLER 0x400
75 #define I915_NEW_TEXTURE 0x800
76 #define I915_NEW_STENCIL 0x1000
77
78
79 /***********************************************************************
80 * i915_prim_emit.c:
81 */
82 struct draw_stage *i915_draw_render_stage( struct i915_context *i915 );
83
84
85 /***********************************************************************
86 * i915_state_emit.c:
87 */
88 void i915_emit_hardware_state(struct i915_context *i915 );
89 unsigned *i915_passthrough_program( unsigned *dwords );
90
91
92
93 /***********************************************************************
94 * i915_clear.c:
95 */
96 void i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
97 GLuint clearValue);
98
99
100 /***********************************************************************
101 * i915_buffer.c:
102 */
103 void i915_init_buffer_functions( struct i915_context *i915 );
104 void i915_init_region_functions( struct i915_context *i915 );
105 void i915_init_surface_functions( struct i915_context *i915 );
106 void i915_init_state_functions( struct i915_context *i915 );
107
108
109
110 /***********************************************************************
111 * Inline conversion functions. These are better-typed than the
112 * macros used previously:
113 */
114 static INLINE struct i915_context *
115 i915_context( struct pipe_context *pipe )
116 {
117 return (struct i915_context *)pipe;
118 }
119
120
121
122 #endif