98e75f2d |
1 | void vbo_draw(); |
2 | |
3 | static GLenum cached_ActiveTexture_texture; |
4 | void inline cache_glActiveTexture (GLenum texture) |
5 | { |
6 | if(texture != cached_ActiveTexture_texture) |
7 | { |
8 | vbo_draw(); |
9 | glActiveTexture(texture); |
10 | cached_ActiveTexture_texture = texture; |
11 | } |
12 | } |
13 | #define glActiveTexture(texture) cache_glActiveTexture(texture) |
14 | |
15 | void inline cache_glBindTexture (GLenum target, GLuint texture) |
16 | { |
17 | vbo_draw(); |
18 | glBindTexture(target, texture); |
19 | } |
20 | #define glBindTexture(target, texture) cache_glBindTexture(target, texture) |
21 | |
22 | static GLenum cached_BlendEquation_mode; |
23 | void inline cache_glBlendEquation ( GLenum mode ) |
24 | { |
25 | if(mode != cached_BlendEquation_mode) |
26 | { |
27 | vbo_draw(); |
28 | glBlendEquation(mode); |
29 | cached_BlendEquation_mode = mode; |
30 | } |
31 | } |
32 | #define glBlendEquation(mode) cache_glBlendEquation(mode) |
33 | |
34 | static GLenum cached_BlendEquationSeparate_modeRGB; |
35 | static GLenum cached_BlendEquationSeparate_modeAlpha; |
36 | void inline cache_glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) |
37 | { |
38 | if(modeRGB != cached_BlendEquationSeparate_modeRGB || modeAlpha != cached_BlendEquationSeparate_modeAlpha) |
39 | { |
40 | vbo_draw(); |
41 | glBlendEquationSeparate(modeRGB, modeAlpha); |
42 | cached_BlendEquationSeparate_modeRGB = modeRGB; |
43 | cached_BlendEquationSeparate_modeAlpha = modeAlpha; |
44 | } |
45 | } |
46 | #define glBlendEquationSeparate(modeRGB, modeAlpha) cache_glBlendEquationSeparate(modeRGB, modeAlpha) |
47 | |
48 | static GLenum cached_BlendFunc_sfactor; |
49 | static GLenum cached_BlendFunc_dfactor; |
50 | void inline cache_glBlendFunc (GLenum sfactor, GLenum dfactor) |
51 | { |
52 | if(sfactor != cached_BlendFunc_sfactor || dfactor != cached_BlendFunc_dfactor) |
53 | { |
54 | vbo_draw(); |
55 | glBlendFunc(sfactor, dfactor); |
56 | cached_BlendFunc_sfactor = sfactor; |
57 | cached_BlendFunc_dfactor = dfactor; |
58 | } |
59 | } |
60 | #define glBlendFunc(sfactor, dfactor) cache_glBlendFunc(sfactor, dfactor) |
61 | |
62 | static GLenum cached_BlendFuncSeparate_srcRGB; |
63 | static GLenum cached_BlendFuncSeparate_dstRGB; |
64 | static GLenum cached_BlendFuncSeparate_srcAlpha; |
65 | static GLenum cached_BlendFuncSeparate_dstAlpha; |
66 | void inline cache_glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
67 | { |
68 | if(srcRGB != cached_BlendFuncSeparate_srcRGB || dstRGB != cached_BlendFuncSeparate_dstRGB || srcAlpha != cached_BlendFuncSeparate_srcAlpha || dstAlpha != cached_BlendFuncSeparate_dstAlpha) |
69 | { |
70 | vbo_draw(); |
71 | glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
72 | cached_BlendFuncSeparate_srcRGB = srcRGB; |
73 | cached_BlendFuncSeparate_dstRGB = dstRGB; |
74 | cached_BlendFuncSeparate_srcAlpha = srcAlpha; |
75 | cached_BlendFuncSeparate_dstAlpha = dstAlpha; |
76 | } |
77 | } |
78 | #define glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha) cache_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha) |
79 | |
80 | static GLclampf cached_ClearColor_red; |
81 | static GLclampf cached_ClearColor_green; |
82 | static GLclampf cached_ClearColor_blue; |
83 | static GLclampf cached_ClearColor_alpha; |
84 | void inline cache_glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
85 | { |
86 | if(red != cached_ClearColor_red || green != cached_ClearColor_green || blue != cached_ClearColor_blue || alpha != cached_ClearColor_alpha) |
87 | { |
88 | vbo_draw(); |
89 | glClearColor(red, green, blue, alpha); |
90 | cached_ClearColor_red = red; |
91 | cached_ClearColor_green = green; |
92 | cached_ClearColor_blue = blue; |
93 | cached_ClearColor_alpha = alpha; |
94 | } |
95 | } |
96 | #define glClearColor(red, green, blue, alpha) cache_glClearColor(red, green, blue, alpha) |
97 | |
98 | static GLclampf cached_ClearDepthf_depth; |
99 | void inline cache_glClearDepthf (GLclampf depth) |
100 | { |
101 | if(depth != cached_ClearDepthf_depth) |
102 | { |
103 | vbo_draw(); |
104 | glClearDepthf(depth); |
105 | cached_ClearDepthf_depth = depth; |
106 | } |
107 | } |
108 | #define glClearDepthf(depth) cache_glClearDepthf(depth) |
109 | |
110 | static GLenum cached_CullFace_mode; |
111 | void inline cache_glCullFace (GLenum mode) |
112 | { |
113 | if(mode != cached_CullFace_mode) |
114 | { |
115 | vbo_draw(); |
116 | glCullFace(mode); |
117 | cached_CullFace_mode = mode; |
118 | } |
119 | } |
120 | #define glCullFace(mode) cache_glCullFace(mode) |
121 | |
122 | static GLenum cached_DepthFunc_func; |
123 | void inline cache_glDepthFunc (GLenum func) |
124 | { |
125 | if(func != cached_DepthFunc_func) |
126 | { |
127 | vbo_draw(); |
128 | glDepthFunc(func); |
129 | cached_DepthFunc_func = func; |
130 | } |
131 | } |
132 | #define glDepthFunc(func) cache_glDepthFunc(func) |
133 | |
134 | static GLboolean cached_DepthMask_flag; |
135 | void inline cache_glDepthMask (GLboolean flag) |
136 | { |
137 | if(flag != cached_DepthMask_flag) |
138 | { |
139 | vbo_draw(); |
140 | glDepthMask(flag); |
141 | cached_DepthMask_flag = flag; |
142 | } |
143 | } |
144 | #define glDepthMask(flag) cache_glDepthMask(flag) |
145 | |
146 | static GLclampf cached_DepthRangef_zNear; |
147 | static GLclampf cached_DepthRangef_zFar; |
148 | void inline cache_glDepthRangef (GLclampf zNear, GLclampf zFar) |
149 | { |
150 | if(zNear != cached_DepthRangef_zNear || zFar != cached_DepthRangef_zFar) |
151 | { |
152 | vbo_draw(); |
153 | glDepthRangef(zNear, zFar); |
154 | cached_DepthRangef_zNear = zNear; |
155 | cached_DepthRangef_zFar = zFar; |
156 | } |
157 | } |
158 | #define glDepthRangef(zNear, zFar) cache_glDepthRangef(zNear, zFar) |
159 | |
160 | static bool cached_BLEND = false; |
161 | static bool cached_CULL_FACE = false; |
162 | static bool cached_DEPTH_TEST = false; |
163 | static bool cached_DITHER = false; |
164 | static bool cached_POLYGON_OFFSET_FILL = false; |
165 | static bool cached_SAMPLE_ALPHA_TO_COVERAGE = false; |
166 | static bool cached_SAMPLE_COVERAGE = false; |
167 | static bool cached_SCISSOR_TEST = false; |
168 | static bool cached_STENCIL_TEST = false; |
169 | void inline cache_glDisable (GLenum cap) |
170 | { |
171 | if(cap == GL_BLEND && cached_BLEND) |
172 | { |
173 | vbo_draw(); |
174 | glDisable(GL_BLEND); |
175 | cached_BLEND = false; |
176 | } |
177 | else if(cap == GL_CULL_FACE && cached_CULL_FACE) |
178 | { |
179 | vbo_draw(); |
180 | glDisable(GL_CULL_FACE); |
181 | cached_CULL_FACE = false; |
182 | } |
183 | else if(cap == GL_DEPTH_TEST && cached_DEPTH_TEST) |
184 | { |
185 | vbo_draw(); |
186 | glDisable(GL_DEPTH_TEST); |
187 | cached_DEPTH_TEST = false; |
188 | } |
189 | else if(cap == GL_DITHER && cached_DITHER) |
190 | { |
191 | vbo_draw(); |
192 | glDisable(GL_DITHER); |
193 | cached_DITHER = false; |
194 | } |
195 | else if(cap == GL_POLYGON_OFFSET_FILL && cached_POLYGON_OFFSET_FILL) |
196 | { |
197 | vbo_draw(); |
198 | glDisable(GL_POLYGON_OFFSET_FILL); |
199 | cached_POLYGON_OFFSET_FILL = false; |
200 | } |
201 | else if(cap == GL_SAMPLE_ALPHA_TO_COVERAGE && cached_SAMPLE_ALPHA_TO_COVERAGE) |
202 | { |
203 | vbo_draw(); |
204 | glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); |
205 | cached_SAMPLE_ALPHA_TO_COVERAGE = false; |
206 | } |
207 | else if(cap == GL_SAMPLE_COVERAGE && cached_SAMPLE_COVERAGE) |
208 | { |
209 | vbo_draw(); |
210 | glDisable(GL_SAMPLE_COVERAGE); |
211 | cached_SAMPLE_COVERAGE = false; |
212 | } |
213 | else if(cap == GL_SCISSOR_TEST && cached_SCISSOR_TEST) |
214 | { |
215 | vbo_draw(); |
216 | glDisable(GL_SCISSOR_TEST); |
217 | cached_SCISSOR_TEST = false; |
218 | } |
219 | else if(cap == GL_STENCIL_TEST && cached_STENCIL_TEST) |
220 | { |
221 | vbo_draw(); |
222 | glDisable(GL_STENCIL_TEST); |
223 | cached_STENCIL_TEST = false; |
224 | } |
225 | } |
226 | #define glDisable(cap) cache_glDisable(cap) |
227 | |
228 | void inline cache_glEnable (GLenum cap) |
229 | { |
230 | if(cap == GL_BLEND && !cached_BLEND) |
231 | { |
232 | vbo_draw(); |
233 | glEnable(GL_BLEND); |
234 | cached_BLEND = true; |
235 | } |
236 | else if(cap == GL_CULL_FACE && !cached_CULL_FACE) |
237 | { |
238 | vbo_draw(); |
239 | glEnable(GL_CULL_FACE); |
240 | cached_CULL_FACE = true; |
241 | } |
242 | else if(cap == GL_DEPTH_TEST && !cached_DEPTH_TEST) |
243 | { |
244 | vbo_draw(); |
245 | glEnable(GL_DEPTH_TEST); |
246 | cached_DEPTH_TEST = true; |
247 | } |
248 | else if(cap == GL_DITHER && !cached_DITHER) |
249 | { |
250 | vbo_draw(); |
251 | glEnable(GL_DITHER); |
252 | cached_DITHER = true; |
253 | } |
254 | else if(cap == GL_POLYGON_OFFSET_FILL && !cached_POLYGON_OFFSET_FILL) |
255 | { |
256 | vbo_draw(); |
257 | glEnable(GL_POLYGON_OFFSET_FILL); |
258 | cached_POLYGON_OFFSET_FILL = true; |
259 | } |
260 | else if(cap == GL_SAMPLE_ALPHA_TO_COVERAGE && !cached_SAMPLE_ALPHA_TO_COVERAGE) |
261 | { |
262 | vbo_draw(); |
263 | glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); |
264 | cached_SAMPLE_ALPHA_TO_COVERAGE = true; |
265 | } |
266 | else if(cap == GL_SAMPLE_COVERAGE && !cached_SAMPLE_COVERAGE) |
267 | { |
268 | vbo_draw(); |
269 | glEnable(GL_SAMPLE_COVERAGE); |
270 | cached_SAMPLE_COVERAGE = true; |
271 | } |
272 | else if(cap == GL_SCISSOR_TEST && !cached_SCISSOR_TEST) |
273 | { |
274 | vbo_draw(); |
275 | glEnable(GL_SCISSOR_TEST); |
276 | cached_SCISSOR_TEST = true; |
277 | } |
278 | else if(cap == GL_STENCIL_TEST && !cached_STENCIL_TEST) |
279 | { |
280 | vbo_draw(); |
281 | glEnable(GL_STENCIL_TEST); |
282 | cached_STENCIL_TEST = true; |
283 | } |
284 | } |
285 | #define glEnable(cap) cache_glEnable(cap) |
286 | |
287 | static GLenum cached_FrontFace_mode; |
288 | void inline cache_glFrontFace (GLenum mode) |
289 | { |
290 | if(mode != cached_FrontFace_mode) |
291 | { |
292 | vbo_draw(); |
293 | glFrontFace(mode); |
294 | cached_FrontFace_mode = mode; |
295 | } |
296 | } |
297 | #define glFrontFace(mode) cache_glFrontFace(mode) |
298 | |
299 | static GLfloat cached_PolygonOffset_factor; |
300 | static GLfloat cached_PolygonOffset_units; |
301 | void inline cache_glPolygonOffset (GLfloat factor, GLfloat units) |
302 | { |
303 | if(factor != cached_PolygonOffset_factor || units != cached_PolygonOffset_units) |
304 | { |
305 | vbo_draw(); |
306 | glPolygonOffset(factor, units); |
307 | cached_PolygonOffset_factor = factor; |
308 | cached_PolygonOffset_units = units; |
309 | } |
310 | } |
311 | #define glPolygonOffset(factor, units) cache_glPolygonOffset(factor, units) |
312 | |
313 | static GLint cached_Scissor_x; |
314 | static GLint cached_Scissor_y; |
315 | static GLsizei cached_Scissor_width; |
316 | static GLsizei cached_Scissor_height; |
317 | void inline cache_glScissor (GLint x, GLint y, GLsizei width, GLsizei height) |
318 | { |
319 | if(x != cached_Scissor_x || y != cached_Scissor_y || width != cached_Scissor_width || height != cached_Scissor_height) |
320 | { |
321 | vbo_draw(); |
322 | glScissor(x, y, width, height); |
323 | cached_Scissor_x = x; |
324 | cached_Scissor_y = y; |
325 | cached_Scissor_width = width; |
326 | cached_Scissor_height = height; |
327 | } |
328 | } |
329 | #define glScissor(x, y, width, height) cache_glScissor(x, y, width, height) |
330 | |
331 | static GLuint cached_UseProgram_program; |
332 | void inline cache_glUseProgram (GLuint program) |
333 | { |
334 | if(program != cached_UseProgram_program) |
335 | { |
336 | vbo_draw(); |
337 | glUseProgram(program); |
338 | cached_UseProgram_program = program; |
339 | } |
340 | } |
341 | #define glUseProgram(program) cache_glUseProgram(program) |
342 | |
343 | static GLint cached_Viewport_x; |
344 | static GLint cached_Viewport_y; |
345 | static GLsizei cached_Viewport_width; |
346 | static GLsizei cached_Viewport_height; |
347 | void inline cache_glViewport (GLint x, GLint y, GLsizei width, GLsizei height) |
348 | { |
349 | if(x != cached_Viewport_x || y != cached_Viewport_y || width != cached_Viewport_width || height != cached_Viewport_height) |
350 | { |
351 | vbo_draw(); |
352 | glViewport(x, y, width, height); |
353 | cached_Viewport_x = x; |
354 | cached_Viewport_y = y; |
355 | cached_Viewport_width = width; |
356 | cached_Viewport_height = height; |
357 | } |
358 | } |
359 | #define glViewport(x, y, width, height) cache_glViewport(x, y, width, height) |
360 | |