VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_diff.c@ 16969

Last change on this file since 16969 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "state.h"
8#include "cr_error.h"
9
10void crStateDiffContext( CRContext *from, CRContext *to )
11{
12 CRbitvalue *bitID = from->bitid;
13 CRStateBits *sb = GetCurrentBits();
14
15 /*crDebug( "Diffing two contexts!" ); */
16
17 if (CHECKDIRTY(sb->transform.dirty, bitID))
18 {
19 crStateTransformDiff( &(sb->transform), bitID, from, to );
20 }
21 if (CHECKDIRTY(sb->pixel.dirty, bitID))
22 {
23 crStatePixelDiff( &(sb->pixel), bitID, from, to );
24 }
25 if (CHECKDIRTY(sb->viewport.dirty, bitID))
26 {
27 crStateViewportDiff( &(sb->viewport), bitID, from, to );
28 }
29 if (CHECKDIRTY(sb->fog.dirty, bitID))
30 {
31 crStateFogDiff( &(sb->fog), bitID, from, to );
32 }
33 if (CHECKDIRTY(sb->texture.dirty, bitID))
34 {
35 crStateTextureDiff( &(sb->texture), bitID, from, to );
36 }
37 if (CHECKDIRTY(sb->lists.dirty, bitID))
38 {
39 crStateListsDiff( &(sb->lists), bitID, from, to );
40 }
41 if (CHECKDIRTY(sb->buffer.dirty, bitID))
42 {
43 crStateBufferDiff( &(sb->buffer), bitID, from, to );
44 }
45#ifdef CR_ARB_vertex_buffer_object
46 if (CHECKDIRTY(sb->bufferobject.dirty, bitID))
47 {
48 crStateBufferObjectDiff( &(sb->bufferobject), bitID, from, to );
49 }
50#endif
51 if (CHECKDIRTY(sb->client.dirty, bitID))
52 {
53 crStateClientDiff(&(sb->client), bitID, from, to );
54 }
55 if (CHECKDIRTY(sb->hint.dirty, bitID))
56 {
57 crStateHintDiff( &(sb->hint), bitID, from, to );
58 }
59 if (CHECKDIRTY(sb->lighting.dirty, bitID))
60 {
61 crStateLightingDiff( &(sb->lighting), bitID, from, to );
62 }
63 if (CHECKDIRTY(sb->line.dirty, bitID))
64 {
65 crStateLineDiff( &(sb->line), bitID, from, to );
66 }
67 if (CHECKDIRTY(sb->occlusion.dirty, bitID))
68 {
69 crStateOcclusionDiff( &(sb->occlusion), bitID, from, to );
70 }
71 if (CHECKDIRTY(sb->point.dirty, bitID))
72 {
73 crStatePointDiff( &(sb->point), bitID, from, to );
74 }
75 if (CHECKDIRTY(sb->polygon.dirty, bitID))
76 {
77 crStatePolygonDiff( &(sb->polygon), bitID, from, to );
78 }
79 if (CHECKDIRTY(sb->program.dirty, bitID))
80 {
81 crStateProgramDiff( &(sb->program), bitID, from, to );
82 }
83 if (CHECKDIRTY(sb->stencil.dirty, bitID))
84 {
85 crStateStencilDiff( &(sb->stencil), bitID, from, to );
86 }
87 if (CHECKDIRTY(sb->eval.dirty, bitID))
88 {
89 crStateEvaluatorDiff( &(sb->eval), bitID, from, to );
90 }
91#ifdef CR_ARB_imaging
92 if (CHECKDIRTY(sb->imaging.dirty, bitID))
93 {
94 crStateImagingDiff( &(sb->imaging), bitID, from, to );
95 }
96#endif
97#if 0
98 if (CHECKDIRTY(sb->selection.dirty, bitID))
99 {
100 crStateSelectionDiff( &(sb->selection), bitID, from, to );
101 }
102#endif
103#ifdef CR_NV_register_combiners
104 if (CHECKDIRTY(sb->regcombiner.dirty, bitID) && to->extensions.NV_register_combiners)
105 {
106 crStateRegCombinerDiff( &(sb->regcombiner), bitID, from, to );
107 }
108#endif
109#ifdef CR_ARB_multisample
110 if (CHECKDIRTY(sb->multisample.dirty, bitID) &&
111 from->extensions.ARB_multisample)
112 {
113 crStateMultisampleDiff( &(sb->multisample), bitID, from, to );
114 }
115#endif
116 if (CHECKDIRTY(sb->current.dirty, bitID))
117 {
118 crStateCurrentDiff( &(sb->current), bitID, from, to );
119 }
120}
121
122void crStateSwitchContext( CRContext *from, CRContext *to )
123{
124 CRbitvalue *bitID = to->bitid;
125 CRStateBits *sb = GetCurrentBits();
126
127 if (CHECKDIRTY(sb->attrib.dirty, bitID))
128 {
129 crStateAttribSwitch(&(sb->attrib), bitID, from, to );
130 }
131 if (CHECKDIRTY(sb->transform.dirty, bitID))
132 {
133 crStateTransformSwitch( &(sb->transform), bitID, from, to );
134 }
135 if (CHECKDIRTY(sb->pixel.dirty, bitID))
136 {
137 crStatePixelSwitch(&(sb->pixel), bitID, from, to );
138 }
139 if (CHECKDIRTY(sb->viewport.dirty, bitID))
140 {
141 crStateViewportSwitch(&(sb->viewport), bitID, from, to );
142 }
143 if (CHECKDIRTY(sb->fog.dirty, bitID))
144 {
145 crStateFogSwitch(&(sb->fog), bitID, from, to );
146 }
147 if (CHECKDIRTY(sb->texture.dirty, bitID))
148 {
149 crStateTextureSwitch( &(sb->texture), bitID, from, to );
150 }
151 if (CHECKDIRTY(sb->lists.dirty, bitID))
152 {
153 crStateListsSwitch(&(sb->lists), bitID, from, to );
154 }
155 if (CHECKDIRTY(sb->buffer.dirty, bitID))
156 {
157 crStateBufferSwitch( &(sb->buffer), bitID, from, to );
158 }
159#ifdef CR_ARB_vertex_buffer_object
160 if (CHECKDIRTY(sb->bufferobject.dirty, bitID))
161 {
162 crStateBufferObjectSwitch( &(sb->bufferobject), bitID, from, to );
163 }
164#endif
165 if (CHECKDIRTY(sb->client.dirty, bitID))
166 {
167 crStateClientSwitch( &(sb->client), bitID, from, to );
168 }
169#if 0
170 if (CHECKDIRTY(sb->hint.dirty, bitID))
171 {
172 crStateHintSwitch( &(sb->hint), bitID, from, to );
173 }
174#endif
175 if (CHECKDIRTY(sb->lighting.dirty, bitID))
176 {
177 crStateLightingSwitch( &(sb->lighting), bitID, from, to );
178 }
179 if (CHECKDIRTY(sb->occlusion.dirty, bitID))
180 {
181 crStateOcclusionSwitch( &(sb->occlusion), bitID, from, to );
182 }
183 if (CHECKDIRTY(sb->line.dirty, bitID))
184 {
185 crStateLineSwitch( &(sb->line), bitID, from, to );
186 }
187 if (CHECKDIRTY(sb->point.dirty, bitID))
188 {
189 crStatePointSwitch( &(sb->point), bitID, from, to );
190 }
191 if (CHECKDIRTY(sb->polygon.dirty, bitID))
192 {
193 crStatePolygonSwitch( &(sb->polygon), bitID, from, to );
194 }
195 if (CHECKDIRTY(sb->program.dirty, bitID))
196 {
197 crStateProgramSwitch( &(sb->program), bitID, from, to );
198 }
199 if (CHECKDIRTY(sb->stencil.dirty, bitID))
200 {
201 crStateStencilSwitch( &(sb->stencil), bitID, from, to );
202 }
203 if (CHECKDIRTY(sb->eval.dirty, bitID))
204 {
205 crStateEvaluatorSwitch( &(sb->eval), bitID, from, to );
206 }
207#ifdef CR_ARB_imaging
208 if (CHECKDIRTY(sb->imaging.dirty, bitID))
209 {
210 crStateImagingSwitch( &(sb->imaging), bitID, from, to );
211 }
212#endif
213#if 0
214 if (CHECKDIRTY(sb->selection.dirty, bitID))
215 {
216 crStateSelectionSwitch( &(sb->selection), bitID, from, to );
217 }
218#endif
219#ifdef CR_NV_register_combiners
220 if (CHECKDIRTY(sb->regcombiner.dirty, bitID) && to->extensions.NV_register_combiners)
221 {
222 crStateRegCombinerSwitch( &(sb->regcombiner), bitID, from, to );
223 }
224#endif
225#ifdef CR_ARB_multisample
226 if (CHECKDIRTY(sb->multisample.dirty, bitID))
227 {
228 crStateMultisampleSwitch( &(sb->multisample), bitID, from, to );
229 }
230#endif
231#ifdef CR_ARB_multisample
232 if (CHECKDIRTY(sb->multisample.dirty, bitID))
233 {
234 crStateMultisampleSwitch(&(sb->multisample), bitID, from, to );
235 }
236#endif
237 if (CHECKDIRTY(sb->current.dirty, bitID))
238 {
239 crStateCurrentSwitch( &(sb->current), bitID, from, to );
240 }
241}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette