]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/COpenGLCoreCacheHandler.h
Reduce IrrCompileConfig usage to files that actually need it
[irrlicht.git] / source / Irrlicht / COpenGLCoreCacheHandler.h
1 // Copyright (C) 2015 Patryk Nadrowski\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_OGLCORE_CACHE_HANDLER_H_INCLUDED__\r
6 #define __C_OGLCORE_CACHE_HANDLER_H_INCLUDED__\r
7 \r
8 \r
9 #if defined(_IRR_COMPILE_WITH_OPENGL_) || defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_)\r
10 \r
11 #include "SMaterial.h"\r
12 #include "ITexture.h"\r
13 \r
14 namespace irr\r
15 {\r
16 namespace video\r
17 {\r
18 \r
19 enum ESetTextureActive\r
20 {\r
21         EST_ACTIVE_ALWAYS,              // texture unit always active after set call\r
22         EST_ACTIVE_ON_CHANGE    // texture unit only active after call when texture changed in cache\r
23 };\r
24 \r
25 \r
26 template <class TOpenGLDriver, class TOpenGLTexture>\r
27 class COpenGLCoreCacheHandler\r
28 {\r
29         class STextureCache\r
30         {\r
31         public:\r
32                 STextureCache(COpenGLCoreCacheHandler& cacheHandler, E_DRIVER_TYPE driverType, u32 textureCount) :\r
33                         CacheHandler(cacheHandler), DriverType(driverType), TextureCount(textureCount)\r
34                 {\r
35                         for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)\r
36                         {\r
37                                 Texture[i] = 0;\r
38                         }\r
39                 }\r
40 \r
41                 ~STextureCache()\r
42                 {\r
43                         clear();\r
44                 }\r
45 \r
46                 const TOpenGLTexture* operator[](int index) const\r
47                 {\r
48                         if (static_cast<u32>(index) < MATERIAL_MAX_TEXTURES)\r
49                                 return Texture[static_cast<u32>(index)];\r
50 \r
51                         return 0;\r
52                 }\r
53 \r
54                 const TOpenGLTexture* get(u32 index) const\r
55                 {\r
56                         if (index < MATERIAL_MAX_TEXTURES)\r
57                                 return Texture[index];\r
58 \r
59                         return 0;\r
60                 }\r
61 \r
62                 bool set(u32 index, const ITexture* texture, ESetTextureActive esa=EST_ACTIVE_ALWAYS)\r
63                 {\r
64                         bool status = false;\r
65 \r
66                         E_DRIVER_TYPE type = DriverType;\r
67 \r
68                         if (index < MATERIAL_MAX_TEXTURES && index < TextureCount)\r
69                         {\r
70                                 if ( esa == EST_ACTIVE_ALWAYS )\r
71                                         CacheHandler.setActiveTexture(GL_TEXTURE0 + index);\r
72 \r
73                                 const TOpenGLTexture* prevTexture = Texture[index];\r
74 \r
75                                 if (texture != prevTexture)\r
76                                 {\r
77                                         if ( esa == EST_ACTIVE_ON_CHANGE )\r
78                                                 CacheHandler.setActiveTexture(GL_TEXTURE0 + index);\r
79 \r
80                                         if (texture)\r
81                                         {\r
82                                                 type = texture->getDriverType();\r
83 \r
84                                                 if (type == DriverType)\r
85                                                 {\r
86                                                         texture->grab();\r
87 \r
88                                                         const TOpenGLTexture* curTexture = static_cast<const TOpenGLTexture*>(texture);\r
89                                                         const GLenum curTextureType = curTexture->getOpenGLTextureType();\r
90                                                         const GLenum prevTextureType = (prevTexture) ? prevTexture->getOpenGLTextureType() : curTextureType;\r
91 \r
92                                                         if (curTextureType != prevTextureType)\r
93                                                         {\r
94                                                                 glBindTexture(prevTextureType, 0);\r
95 \r
96 #if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )\r
97                                                                 glDisable(prevTextureType);\r
98                                                                 glEnable(curTextureType);\r
99 #endif\r
100                                                         }\r
101 #if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )\r
102                                                         else if (!prevTexture)\r
103                                                                 glEnable(curTextureType);\r
104 #endif\r
105 \r
106                                                         glBindTexture(curTextureType, static_cast<const TOpenGLTexture*>(texture)->getOpenGLTextureName());\r
107                                                 }\r
108                                                 else\r
109                                                 {\r
110                                                         texture = 0;\r
111 \r
112                                                         os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);\r
113                                                         os::Printer::log("Texture type", irr::core::stringc((int)type), ELL_ERROR);\r
114                                                         os::Printer::log("Driver (or cache handler) type", irr::core::stringc((int)DriverType), ELL_ERROR);\r
115                                                 }\r
116                                         }\r
117 \r
118                                         if (!texture && prevTexture)\r
119                                         {\r
120                                                 const GLenum prevTextureType = prevTexture->getOpenGLTextureType();\r
121 \r
122                                                 glBindTexture(prevTextureType, 0);\r
123 \r
124 #if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )\r
125                                                 glDisable(prevTextureType);\r
126 #endif\r
127                                         }\r
128 \r
129                                         Texture[index] = static_cast<const TOpenGLTexture*>(texture);\r
130 \r
131                                         if (prevTexture)\r
132                                                 prevTexture->drop();\r
133                                 }\r
134 \r
135                                 status = true;\r
136                         }\r
137 \r
138                         return (status && type == DriverType);\r
139                 }\r
140 \r
141                 void remove(ITexture* texture)\r
142                 {\r
143                         if (!texture)\r
144                                 return;\r
145 \r
146                         for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)\r
147                         {\r
148                                 if (Texture[i] == texture)\r
149                                 {\r
150                                         Texture[i] = 0;\r
151 \r
152                                         texture->drop();\r
153                                 }\r
154                         }\r
155                 }\r
156 \r
157                 void clear()\r
158                 {\r
159                         for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)\r
160                         {\r
161                                 if (Texture[i])\r
162                                 {\r
163                                         const TOpenGLTexture* prevTexture = Texture[i];\r
164 \r
165                                         Texture[i] = 0;\r
166 \r
167                                         prevTexture->drop();\r
168                                 }\r
169                         }\r
170                 }\r
171 \r
172         private:\r
173                 COpenGLCoreCacheHandler& CacheHandler;\r
174 \r
175                 E_DRIVER_TYPE DriverType;\r
176 \r
177                 const TOpenGLTexture* Texture[MATERIAL_MAX_TEXTURES];\r
178                 u32 TextureCount;\r
179         };\r
180 \r
181 public:\r
182         COpenGLCoreCacheHandler(TOpenGLDriver* driver) :\r
183                 Driver(driver),\r
184 #if defined(_MSC_VER)\r
185 #pragma warning(push)\r
186 #pragma warning(disable: 4355)  // Warning: "'this' : used in base member initializer list. ". It's OK, we don't use the reference in STextureCache constructor.\r
187 #endif\r
188                 TextureCache(STextureCache(*this, driver->getDriverType(), driver->getFeature().MaxTextureUnits)),\r
189 #if defined(_MSC_VER)\r
190 #pragma warning(pop)\r
191 #endif\r
192                 FrameBufferCount(0), BlendEquation(0), BlendSourceRGB(0),\r
193                 BlendDestinationRGB(0), BlendSourceAlpha(0), BlendDestinationAlpha(0), Blend(0), BlendEquationInvalid(false), BlendFuncInvalid(false), BlendInvalid(false),\r
194                 ColorMask(0), ColorMaskInvalid(false), CullFaceMode(GL_BACK), CullFace(false), DepthFunc(GL_LESS), DepthMask(true), DepthTest(false), FrameBufferID(0),\r
195                 ProgramID(0), ActiveTexture(GL_TEXTURE0), ViewportX(0), ViewportY(0)\r
196         {\r
197                 const COpenGLCoreFeature& feature = Driver->getFeature();\r
198 \r
199                 FrameBufferCount = core::max_(static_cast<GLuint>(1), static_cast<GLuint>(feature.MultipleRenderTarget));\r
200 \r
201                 BlendEquation = new GLenum[FrameBufferCount];\r
202                 BlendSourceRGB = new GLenum[FrameBufferCount];\r
203                 BlendDestinationRGB = new GLenum[FrameBufferCount];\r
204                 BlendSourceAlpha = new GLenum[FrameBufferCount];\r
205                 BlendDestinationAlpha = new GLenum[FrameBufferCount];\r
206                 Blend = new bool[FrameBufferCount];\r
207                 ColorMask = new u8[FrameBufferCount];\r
208 \r
209                 // Initial OpenGL values from specification.\r
210 \r
211                 if (feature.BlendOperation)\r
212                 {\r
213                         Driver->irrGlBlendEquation(GL_FUNC_ADD);\r
214                 }\r
215 \r
216                 for (u32 i = 0; i < FrameBufferCount; ++i)\r
217                 {\r
218                         BlendEquation[i] = GL_FUNC_ADD;\r
219 \r
220                         BlendSourceRGB[i] = GL_ONE;\r
221                         BlendDestinationRGB[i] = GL_ZERO;\r
222                         BlendSourceAlpha[i] = GL_ONE;\r
223                         BlendDestinationAlpha[i] = GL_ZERO;\r
224 \r
225                         Blend[i] = false;\r
226                         ColorMask[i] = ECP_ALL;\r
227                 }\r
228 \r
229                 glBlendFunc(GL_ONE, GL_ZERO);\r
230                 glDisable(GL_BLEND);\r
231 \r
232                 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);\r
233 \r
234                 glCullFace(CullFaceMode);\r
235                 glDisable(GL_CULL_FACE);\r
236 \r
237                 glDepthFunc(DepthFunc);\r
238                 glDepthMask(GL_TRUE);\r
239                 glDisable(GL_DEPTH_TEST);\r
240 \r
241                 Driver->irrGlActiveTexture(ActiveTexture);\r
242 \r
243 #if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )\r
244                 glDisable(GL_TEXTURE_2D);\r
245 #endif\r
246 \r
247                 const core::dimension2d<u32> ScreenSize = Driver->getScreenSize();\r
248                 ViewportWidth = ScreenSize.Width;\r
249                 ViewportHeight = ScreenSize.Height;\r
250                 glViewport(ViewportX, ViewportY, ViewportWidth, ViewportHeight);\r
251         }\r
252 \r
253         virtual ~COpenGLCoreCacheHandler()\r
254         {\r
255                 delete[] BlendEquation;\r
256                 delete[] BlendSourceRGB;\r
257                 delete[] BlendDestinationRGB;\r
258                 delete[] BlendSourceAlpha;\r
259                 delete[] BlendDestinationAlpha;\r
260                 delete[] Blend;\r
261 \r
262                 delete[] ColorMask;\r
263         }\r
264 \r
265         E_DRIVER_TYPE getDriverType() const\r
266         {\r
267                 return Driver->getDriverType();\r
268         }\r
269 \r
270         STextureCache& getTextureCache()\r
271         {\r
272                 return TextureCache;\r
273         }\r
274 \r
275         // Blending calls.\r
276 \r
277         void setBlendEquation(GLenum mode)\r
278         {\r
279                 if (BlendEquation[0] != mode || BlendEquationInvalid)\r
280                 {\r
281                         Driver->irrGlBlendEquation(mode);\r
282 \r
283                         for (GLuint i = 0; i < FrameBufferCount; ++i)\r
284                                 BlendEquation[i] = mode;\r
285 \r
286                         BlendEquationInvalid = false;\r
287                 }\r
288         }\r
289 \r
290         void setBlendEquationIndexed(GLuint index, GLenum mode)\r
291         {\r
292                 if (index < FrameBufferCount && BlendEquation[index] != mode)\r
293                 {\r
294                         Driver->irrGlBlendEquationIndexed(index, mode);\r
295 \r
296                         BlendEquation[index] = mode;\r
297                         BlendEquationInvalid = true;\r
298                 }\r
299         }\r
300 \r
301         void setBlendFunc(GLenum source, GLenum destination)\r
302         {\r
303                 if (BlendSourceRGB[0] != source || BlendDestinationRGB[0] != destination ||\r
304                         BlendSourceAlpha[0] != source || BlendDestinationAlpha[0] != destination ||\r
305                         BlendFuncInvalid)\r
306                 {\r
307                         glBlendFunc(source, destination);\r
308 \r
309                         for (GLuint i = 0; i < FrameBufferCount; ++i)\r
310                         {\r
311                                 BlendSourceRGB[i] = source;\r
312                                 BlendDestinationRGB[i] = destination;\r
313                                 BlendSourceAlpha[i] = source;\r
314                                 BlendDestinationAlpha[i] = destination;\r
315                         }\r
316 \r
317                         BlendFuncInvalid = false;\r
318                 }\r
319         }\r
320 \r
321         void setBlendFuncSeparate(GLenum sourceRGB, GLenum destinationRGB, GLenum sourceAlpha, GLenum destinationAlpha)\r
322         {\r
323                 if (sourceRGB != sourceAlpha || destinationRGB != destinationAlpha)\r
324                 {\r
325                         if (BlendSourceRGB[0] != sourceRGB || BlendDestinationRGB[0] != destinationRGB ||\r
326                                 BlendSourceAlpha[0] != sourceAlpha || BlendDestinationAlpha[0] != destinationAlpha ||\r
327                                 BlendFuncInvalid)\r
328                         {\r
329                                 Driver->irrGlBlendFuncSeparate(sourceRGB, destinationRGB, sourceAlpha, destinationAlpha);\r
330 \r
331                                 for (GLuint i = 0; i < FrameBufferCount; ++i)\r
332                                 {\r
333                                         BlendSourceRGB[i] = sourceRGB;\r
334                                         BlendDestinationRGB[i] = destinationRGB;\r
335                                         BlendSourceAlpha[i] = sourceAlpha;\r
336                                         BlendDestinationAlpha[i] = destinationAlpha;\r
337                                 }\r
338 \r
339                                 BlendFuncInvalid = false;\r
340                         }\r
341                 }\r
342                 else\r
343                 {\r
344                         setBlendFunc(sourceRGB, destinationRGB);\r
345                 }\r
346         }\r
347 \r
348         void setBlendFuncIndexed(GLuint index, GLenum source, GLenum destination)\r
349         {\r
350                 if (index < FrameBufferCount && (BlendSourceRGB[index] != source || BlendDestinationRGB[index] != destination ||\r
351                         BlendSourceAlpha[index] != source || BlendDestinationAlpha[index] != destination))\r
352                 {\r
353                         Driver->irrGlBlendFuncIndexed(index, source, destination);\r
354 \r
355                         BlendSourceRGB[index] = source;\r
356                         BlendDestinationRGB[index] = destination;\r
357                         BlendSourceAlpha[index] = source;\r
358                         BlendDestinationAlpha[index] = destination;\r
359                         BlendFuncInvalid = true;\r
360                 }\r
361         }\r
362 \r
363         void setBlendFuncSeparateIndexed(GLuint index, GLenum sourceRGB, GLenum destinationRGB, GLenum sourceAlpha, GLenum destinationAlpha)\r
364         {\r
365                 if (sourceRGB != sourceAlpha || destinationRGB != destinationAlpha)\r
366                 {\r
367                         if (index < FrameBufferCount && (BlendSourceRGB[index] != sourceRGB || BlendDestinationRGB[index] != destinationRGB ||\r
368                                 BlendSourceAlpha[index] != sourceAlpha || BlendDestinationAlpha[index] != destinationAlpha))\r
369                         {\r
370                                 Driver->irrGlBlendFuncSeparateIndexed(index, sourceRGB, destinationRGB, sourceAlpha, destinationAlpha);\r
371 \r
372                                 BlendSourceRGB[index] = sourceRGB;\r
373                                 BlendDestinationRGB[index] = destinationRGB;\r
374                                 BlendSourceAlpha[index] = sourceAlpha;\r
375                                 BlendDestinationAlpha[index] = destinationAlpha;\r
376                                 BlendFuncInvalid = true;\r
377                         }\r
378                 }\r
379                 else\r
380                 {\r
381                         setBlendFuncIndexed(index, sourceRGB, destinationRGB);\r
382                 }\r
383         }\r
384 \r
385         void setBlend(bool enable)\r
386         {\r
387                 if (Blend[0] != enable || BlendInvalid)\r
388                 {\r
389                         if (enable)\r
390                                 glEnable(GL_BLEND);\r
391                         else\r
392                                 glDisable(GL_BLEND);\r
393 \r
394                         for (GLuint i = 0; i < FrameBufferCount; ++i)\r
395                                 Blend[i] = enable;\r
396 \r
397                         BlendInvalid = false;\r
398                 }\r
399         }\r
400 \r
401         void setBlendIndexed(GLuint index, bool enable)\r
402         {\r
403                 if (index < FrameBufferCount && Blend[index] != enable)\r
404                 {\r
405                         if (enable)\r
406                                 Driver->irrGlEnableIndexed(GL_BLEND, index);\r
407                         else\r
408                                 Driver->irrGlDisableIndexed(GL_BLEND, index);\r
409 \r
410                         Blend[index] = enable;\r
411                         BlendInvalid = true;\r
412                 }\r
413         }\r
414 \r
415         // Color Mask.\r
416 \r
417         void getColorMask(u8& mask)\r
418         {\r
419                 mask = ColorMask[0];\r
420         }\r
421 \r
422         void setColorMask(u8 mask)\r
423         {\r
424                 if (ColorMask[0] != mask || ColorMaskInvalid)\r
425                 {\r
426                         glColorMask((mask & ECP_RED) ? GL_TRUE : GL_FALSE, (mask & ECP_GREEN) ? GL_TRUE : GL_FALSE, (mask & ECP_BLUE) ? GL_TRUE : GL_FALSE, (mask & ECP_ALPHA) ? GL_TRUE : GL_FALSE);\r
427 \r
428                         for (GLuint i = 0; i < FrameBufferCount; ++i)\r
429                                 ColorMask[i] = mask;\r
430 \r
431                         ColorMaskInvalid = false;\r
432                 }\r
433         }\r
434 \r
435         void setColorMaskIndexed(GLuint index, u8 mask)\r
436         {\r
437                 if (index < FrameBufferCount && ColorMask[index] != mask)\r
438                 {\r
439                         Driver->irrGlColorMaskIndexed(index, (mask & ECP_RED) ? GL_TRUE : GL_FALSE, (mask & ECP_GREEN) ? GL_TRUE : GL_FALSE, (mask & ECP_BLUE) ? GL_TRUE : GL_FALSE, (mask & ECP_ALPHA) ? GL_TRUE : GL_FALSE);\r
440 \r
441                         ColorMask[index] = mask;\r
442                         ColorMaskInvalid = true;\r
443                 }\r
444         }\r
445 \r
446         // Cull face calls.\r
447 \r
448         void setCullFaceFunc(GLenum mode)\r
449         {\r
450                 if (CullFaceMode != mode)\r
451                 {\r
452                         glCullFace(mode);\r
453                         CullFaceMode = mode;\r
454                 }\r
455         }\r
456 \r
457         void setCullFace(bool enable)\r
458         {\r
459                 if (CullFace != enable)\r
460                 {\r
461                         if (enable)\r
462                                 glEnable(GL_CULL_FACE);\r
463                         else\r
464                                 glDisable(GL_CULL_FACE);\r
465 \r
466                         CullFace = enable;\r
467                 }\r
468         }\r
469 \r
470         // Depth calls.\r
471 \r
472         void setDepthFunc(GLenum mode)\r
473         {\r
474                 if (DepthFunc != mode)\r
475                 {\r
476                         glDepthFunc(mode);\r
477                         DepthFunc = mode;\r
478                 }\r
479         }\r
480 \r
481         void getDepthMask(bool& depth)\r
482         {\r
483                 depth = DepthMask;\r
484         }\r
485 \r
486         void setDepthMask(bool enable)\r
487         {\r
488                 if (DepthMask != enable)\r
489                 {\r
490                         if (enable)\r
491                                 glDepthMask(GL_TRUE);\r
492                         else\r
493                                 glDepthMask(GL_FALSE);\r
494 \r
495                         DepthMask = enable;\r
496                 }\r
497         }\r
498 \r
499     void getDepthTest(bool& enable)\r
500     {\r
501         enable = DepthTest;\r
502     }\r
503 \r
504         void setDepthTest(bool enable)\r
505         {\r
506                 if (DepthTest != enable)\r
507                 {\r
508                         if (enable)\r
509                                 glEnable(GL_DEPTH_TEST);\r
510                         else\r
511                                 glDisable(GL_DEPTH_TEST);\r
512 \r
513                         DepthTest = enable;\r
514                 }\r
515         }\r
516 \r
517         // FBO calls.\r
518 \r
519         void getFBO(GLuint& frameBufferID) const\r
520         {\r
521                 frameBufferID = FrameBufferID;\r
522         }\r
523 \r
524         void setFBO(GLuint frameBufferID)\r
525         {\r
526                 if (FrameBufferID != frameBufferID)\r
527                 {\r
528                         Driver->irrGlBindFramebuffer(GL_FRAMEBUFFER, frameBufferID);\r
529                         FrameBufferID = frameBufferID;\r
530                 }\r
531         }\r
532 \r
533         // Shaders calls.\r
534 \r
535         void getProgram(GLuint& programID) const\r
536         {\r
537                 programID = ProgramID;\r
538         }\r
539 \r
540         void setProgram(GLuint programID)\r
541         {\r
542                 if (ProgramID != programID)\r
543                 {\r
544                         Driver->irrGlUseProgram(programID);\r
545                         ProgramID = programID;\r
546                 }\r
547         }\r
548 \r
549         // Texture calls.\r
550 \r
551         void getActiveTexture(GLenum& texture) const\r
552         {\r
553                 texture = ActiveTexture;\r
554         }\r
555 \r
556         void setActiveTexture(GLenum texture)\r
557         {\r
558                 if (ActiveTexture != texture)\r
559                 {\r
560                         Driver->irrGlActiveTexture(texture);\r
561                         ActiveTexture = texture;\r
562                 }\r
563         }\r
564 \r
565         // Viewport calls.\r
566 \r
567         void getViewport(GLint& viewportX, GLint& viewportY, GLsizei& viewportWidth, GLsizei& viewportHeight) const\r
568         {\r
569                 viewportX = ViewportX;\r
570                 viewportY = ViewportY;\r
571                 viewportWidth = ViewportWidth;\r
572                 viewportHeight = ViewportHeight;\r
573         }\r
574 \r
575         void setViewport(GLint viewportX, GLint viewportY, GLsizei viewportWidth, GLsizei viewportHeight)\r
576         {\r
577                 if (ViewportX != viewportX || ViewportY != viewportY || ViewportWidth != viewportWidth || ViewportHeight != viewportHeight)\r
578                 {\r
579                         glViewport(viewportX, viewportY, viewportWidth, viewportHeight);\r
580                         ViewportX = viewportX;\r
581                         ViewportY = viewportY;\r
582                         ViewportWidth = viewportWidth;\r
583                         ViewportHeight = viewportHeight;\r
584                 }\r
585         }\r
586 \r
587         //! Compare material to current cache and update it when there are differences\r
588         // Some material renderers do change the cache beyond the original material settings\r
589         // This corrects the material to represent the current cache state again.\r
590         void correctCacheMaterial(irr::video::SMaterial& material)\r
591         {\r
592                 // Fix textures which got removed\r
593                 for ( u32 i=0; i < MATERIAL_MAX_TEXTURES; ++i )\r
594                 {\r
595                         if ( material.TextureLayer[i].Texture && !TextureCache[i] )\r
596                         {\r
597                                 material.TextureLayer[i].Texture = 0;\r
598                         }\r
599                 }\r
600         }\r
601 \r
602 protected:\r
603         TOpenGLDriver* Driver;\r
604 \r
605         STextureCache TextureCache;\r
606 \r
607         GLuint FrameBufferCount;\r
608 \r
609         GLenum* BlendEquation;\r
610         GLenum* BlendSourceRGB;\r
611         GLenum* BlendDestinationRGB;\r
612         GLenum* BlendSourceAlpha;\r
613         GLenum* BlendDestinationAlpha;\r
614         bool* Blend;\r
615         bool BlendEquationInvalid;\r
616         bool BlendFuncInvalid;\r
617         bool BlendInvalid;\r
618 \r
619 \r
620         u8* ColorMask;\r
621         bool ColorMaskInvalid;\r
622 \r
623         GLenum CullFaceMode;\r
624         bool CullFace;\r
625 \r
626         GLenum DepthFunc;\r
627         bool DepthMask;\r
628         bool DepthTest;\r
629 \r
630         GLuint FrameBufferID;\r
631 \r
632         GLuint ProgramID;\r
633 \r
634         GLenum ActiveTexture;\r
635 \r
636         GLint ViewportX;\r
637         GLint ViewportY;\r
638         GLsizei ViewportWidth;\r
639         GLsizei ViewportHeight;\r
640 };\r
641 \r
642 }\r
643 }\r
644 \r
645 #endif\r
646 #endif\r