Home | History | Annotate | Download | only in libGLESv2
      1 //
      2 // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 
      7 // Context.h: Defines the gl::Context class, managing all GL state and performing
      8 // rendering operations. It is the GLES2 specific implementation of EGLContext.
      9 
     10 #ifndef LIBGLESV2_CONTEXT_H_
     11 #define LIBGLESV2_CONTEXT_H_
     12 
     13 #include <GLES3/gl3.h>
     14 #include <GLES3/gl3ext.h>
     15 #include <GLES2/gl2.h>
     16 #include <GLES2/gl2ext.h>
     17 #include <EGL/egl.h>
     18 
     19 #include <string>
     20 #include <set>
     21 #include <map>
     22 #include <unordered_map>
     23 #include <array>
     24 
     25 #include "common/angleutils.h"
     26 #include "common/RefCountObject.h"
     27 #include "libGLESv2/HandleAllocator.h"
     28 #include "libGLESv2/angletypes.h"
     29 #include "libGLESv2/Constants.h"
     30 #include "libGLESv2/VertexAttribute.h"
     31 
     32 namespace rx
     33 {
     34 class Renderer;
     35 }
     36 
     37 namespace egl
     38 {
     39 class Surface;
     40 }
     41 
     42 namespace gl
     43 {
     44 class Shader;
     45 class Program;
     46 class ProgramBinary;
     47 class Texture;
     48 class Texture2D;
     49 class TextureCubeMap;
     50 class Texture3D;
     51 class Texture2DArray;
     52 class Framebuffer;
     53 class FramebufferAttachment;
     54 class RenderbufferStorage;
     55 class Colorbuffer;
     56 class Depthbuffer;
     57 class Stencilbuffer;
     58 class DepthStencilbuffer;
     59 class FenceNV;
     60 class FenceSync;
     61 class Query;
     62 class ResourceManager;
     63 class Buffer;
     64 class VertexAttribute;
     65 class VertexArray;
     66 class Sampler;
     67 class TransformFeedback;
     68 
     69 // Helper structure to store all raw state
     70 struct State
     71 {
     72     ColorF colorClearValue;
     73     GLclampf depthClearValue;
     74     int stencilClearValue;
     75 
     76     RasterizerState rasterizer;
     77     bool scissorTest;
     78     Rectangle scissor;
     79 
     80     BlendState blend;
     81     ColorF blendColor;
     82     bool sampleCoverage;
     83     GLclampf sampleCoverageValue;
     84     bool sampleCoverageInvert;
     85 
     86     DepthStencilState depthStencil;
     87     GLint stencilRef;
     88     GLint stencilBackRef;
     89 
     90     GLfloat lineWidth;
     91 
     92     GLenum generateMipmapHint;
     93     GLenum fragmentShaderDerivativeHint;
     94 
     95     Rectangle viewport;
     96     float zNear;
     97     float zFar;
     98 
     99     unsigned int activeSampler;   // Active texture unit selector - GL_TEXTURE0
    100     BindingPointer<Buffer> arrayBuffer;
    101     GLuint readFramebuffer;
    102     GLuint drawFramebuffer;
    103     BindingPointer<FramebufferAttachment> renderbuffer;
    104     GLuint currentProgram;
    105 
    106     VertexAttribCurrentValueData vertexAttribCurrentValues[MAX_VERTEX_ATTRIBS]; // From glVertexAttrib
    107     unsigned int vertexArray;
    108 
    109     BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
    110     GLuint samplers[IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
    111 
    112     typedef std::map< GLenum, BindingPointer<Query> > ActiveQueryMap;
    113     ActiveQueryMap activeQueries;
    114 
    115     BindingPointer<Buffer> genericUniformBuffer;
    116     OffsetBindingPointer<Buffer> uniformBuffers[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
    117 
    118     BindingPointer<TransformFeedback> transformFeedback;
    119     BindingPointer<Buffer> genericTransformFeedbackBuffer;
    120     OffsetBindingPointer<Buffer> transformFeedbackBuffers[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
    121 
    122     BindingPointer<Buffer> copyReadBuffer;
    123     BindingPointer<Buffer> copyWriteBuffer;
    124 
    125     PixelUnpackState unpack;
    126     PixelPackState pack;
    127 };
    128 
    129 class Context
    130 {
    131   public:
    132     Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
    133 
    134     virtual ~Context();
    135 
    136     void makeCurrent(egl::Surface *surface);
    137 
    138     virtual void markContextLost();
    139     bool isContextLost();
    140 
    141     // State manipulation
    142     void setCap(GLenum cap, bool enabled);
    143     bool getCap(GLenum cap);
    144 
    145     void setClearColor(float red, float green, float blue, float alpha);
    146 
    147     void setClearDepth(float depth);
    148 
    149     void setClearStencil(int stencil);
    150 
    151     void setRasterizerDiscard(bool enabled);
    152     bool isRasterizerDiscardEnabled() const;
    153 
    154     void setCullFace(bool enabled);
    155     bool isCullFaceEnabled() const;
    156 
    157     void setCullMode(GLenum mode);
    158 
    159     void setFrontFace(GLenum front);
    160 
    161     void setDepthTest(bool enabled);
    162     bool isDepthTestEnabled() const;
    163 
    164     void setDepthFunc(GLenum depthFunc);
    165 
    166     void setDepthRange(float zNear, float zFar);
    167 
    168     void setBlend(bool enabled);
    169     bool isBlendEnabled() const;
    170 
    171     void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
    172     void setBlendColor(float red, float green, float blue, float alpha);
    173     void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
    174 
    175     void setStencilTest(bool enabled);
    176     bool isStencilTestEnabled() const;
    177 
    178     void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
    179     void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
    180     void setStencilWritemask(GLuint stencilWritemask);
    181     void setStencilBackWritemask(GLuint stencilBackWritemask);
    182     void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
    183     void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
    184 
    185     void setPolygonOffsetFill(bool enabled);
    186     bool isPolygonOffsetFillEnabled() const;
    187 
    188     void setPolygonOffsetParams(GLfloat factor, GLfloat units);
    189 
    190     void setSampleAlphaToCoverage(bool enabled);
    191     bool isSampleAlphaToCoverageEnabled() const;
    192 
    193     void setSampleCoverage(bool enabled);
    194     bool isSampleCoverageEnabled() const;
    195 
    196     void setSampleCoverageParams(GLclampf value, bool invert);
    197 
    198     void setScissorTest(bool enabled);
    199     bool isScissorTestEnabled() const;
    200 
    201     void setDither(bool enabled);
    202     bool isDitherEnabled() const;
    203 
    204     void setLineWidth(GLfloat width);
    205 
    206     void setGenerateMipmapHint(GLenum hint);
    207     void setFragmentShaderDerivativeHint(GLenum hint);
    208 
    209     void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
    210 
    211     void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
    212     void getScissorParams(GLint *x, GLint *y, GLsizei *width, GLsizei *height);
    213 
    214     void setColorMask(bool red, bool green, bool blue, bool alpha);
    215     void setDepthMask(bool mask);
    216 
    217     void setActiveSampler(unsigned int active);
    218 
    219     GLuint getReadFramebufferHandle() const;
    220     GLuint getDrawFramebufferHandle() const;
    221     GLuint getRenderbufferHandle() const;
    222     GLuint getVertexArrayHandle() const;
    223     GLuint getSamplerHandle(GLuint textureUnit) const;
    224     unsigned int getActiveSampler() const;
    225 
    226     GLuint getArrayBufferHandle() const;
    227 
    228     bool isQueryActive() const;
    229     const Query *getActiveQuery(GLenum target) const;
    230     GLuint getActiveQueryId(GLenum target) const;
    231 
    232     void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
    233     const VertexAttribute &getVertexAttribState(unsigned int attribNum) const;
    234     const VertexAttribCurrentValueData &getVertexAttribCurrentValue(unsigned int attribNum) const;
    235     void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
    236                               bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
    237     const void *getVertexAttribPointer(unsigned int attribNum) const;
    238 
    239     void setUnpackAlignment(GLint alignment);
    240     GLint getUnpackAlignment() const;
    241     const PixelUnpackState &getUnpackState() const;
    242 
    243     void setPackAlignment(GLint alignment);
    244     GLint getPackAlignment() const;
    245     const PixelPackState &getPackState() const;
    246 
    247     void setPackReverseRowOrder(bool reverseRowOrder);
    248     bool getPackReverseRowOrder() const;
    249 
    250     // These create  and destroy methods are merely pass-throughs to
    251     // ResourceManager, which owns these object types
    252     GLuint createBuffer();
    253     GLuint createShader(GLenum type);
    254     GLuint createProgram();
    255     GLuint createTexture();
    256     GLuint createRenderbuffer();
    257     GLuint createSampler();
    258     GLuint createTransformFeedback();
    259     GLsync createFenceSync(GLenum condition);
    260 
    261     void deleteBuffer(GLuint buffer);
    262     void deleteShader(GLuint shader);
    263     void deleteProgram(GLuint program);
    264     void deleteTexture(GLuint texture);
    265     void deleteRenderbuffer(GLuint renderbuffer);
    266     void deleteSampler(GLuint sampler);
    267     void deleteTransformFeedback(GLuint transformFeedback);
    268     void deleteFenceSync(GLsync fenceSync);
    269 
    270     // Framebuffers are owned by the Context, so these methods do not pass through
    271     GLuint createFramebuffer();
    272     void deleteFramebuffer(GLuint framebuffer);
    273 
    274     // NV Fences are owned by the Context.
    275     GLuint createFenceNV();
    276     void deleteFenceNV(GLuint fence);
    277 
    278     // Queries are owned by the Context;
    279     GLuint createQuery();
    280     void deleteQuery(GLuint query);
    281 
    282     // Vertex arrays are owned by the Context
    283     GLuint createVertexArray();
    284     void deleteVertexArray(GLuint vertexArray);
    285 
    286     void bindArrayBuffer(GLuint buffer);
    287     void bindElementArrayBuffer(GLuint buffer);
    288     void bindTexture2D(GLuint texture);
    289     void bindTextureCubeMap(GLuint texture);
    290     void bindTexture3D(GLuint texture);
    291     void bindTexture2DArray(GLuint texture);
    292     void bindReadFramebuffer(GLuint framebuffer);
    293     void bindDrawFramebuffer(GLuint framebuffer);
    294     void bindRenderbuffer(GLuint renderbuffer);
    295     void bindVertexArray(GLuint vertexArray);
    296     void bindSampler(GLuint textureUnit, GLuint sampler);
    297     void bindGenericUniformBuffer(GLuint buffer);
    298     void bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
    299     void bindGenericTransformFeedbackBuffer(GLuint buffer);
    300     void bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
    301     void bindCopyReadBuffer(GLuint buffer);
    302     void bindCopyWriteBuffer(GLuint buffer);
    303     void bindPixelPackBuffer(GLuint buffer);
    304     void bindPixelUnpackBuffer(GLuint buffer);
    305     void useProgram(GLuint program);
    306     void linkProgram(GLuint program);
    307     void setProgramBinary(GLuint program, const void *binary, GLint length);
    308     void bindTransformFeedback(GLuint transformFeedback);
    309 
    310     void beginQuery(GLenum target, GLuint query);
    311     void endQuery(GLenum target);
    312 
    313     void setFramebufferZero(Framebuffer *framebuffer);
    314 
    315     void setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
    316 
    317     void setVertexAttribf(GLuint index, const GLfloat values[4]);
    318     void setVertexAttribu(GLuint index, const GLuint values[4]);
    319     void setVertexAttribi(GLuint index, const GLint values[4]);
    320     void setVertexAttribDivisor(GLuint index, GLuint divisor);
    321 
    322     void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
    323     void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
    324     GLint getSamplerParameteri(GLuint sampler, GLenum pname);
    325     GLfloat getSamplerParameterf(GLuint sampler, GLenum pname);
    326 
    327     Buffer *getBuffer(GLuint handle);
    328     FenceNV *getFenceNV(GLuint handle);
    329     FenceSync *getFenceSync(GLsync handle) const;
    330     Shader *getShader(GLuint handle) const;
    331     Program *getProgram(GLuint handle) const;
    332     Texture *getTexture(GLuint handle);
    333     Framebuffer *getFramebuffer(GLuint handle) const;
    334     FramebufferAttachment *getRenderbuffer(GLuint handle);
    335     VertexArray *getVertexArray(GLuint handle) const;
    336     Sampler *getSampler(GLuint handle) const;
    337     Query *getQuery(GLuint handle, bool create, GLenum type);
    338     TransformFeedback *getTransformFeedback(GLuint handle) const;
    339 
    340     Buffer *getTargetBuffer(GLenum target) const;
    341     Buffer *getArrayBuffer();
    342     Buffer *getElementArrayBuffer() const;
    343     ProgramBinary *getCurrentProgramBinary();
    344 
    345     Texture *getTargetTexture(GLenum target) const;
    346     Texture2D *getTexture2D() const;
    347     TextureCubeMap *getTextureCubeMap() const;
    348     Texture3D *getTexture3D() const;
    349     Texture2DArray *getTexture2DArray() const;
    350 
    351     Buffer *getGenericUniformBuffer();
    352     Buffer *getGenericTransformFeedbackBuffer();
    353     Buffer *getCopyReadBuffer();
    354     Buffer *getCopyWriteBuffer();
    355     Buffer *getPixelPackBuffer();
    356     Buffer *getPixelUnpackBuffer();
    357     Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
    358 
    359     Framebuffer *getTargetFramebuffer(GLenum target) const;
    360     GLuint getTargetFramebufferHandle(GLenum target) const;
    361     Framebuffer *getReadFramebuffer();
    362     Framebuffer *getDrawFramebuffer();
    363     VertexArray *getCurrentVertexArray() const;
    364     TransformFeedback *getCurrentTransformFeedback() const;
    365 
    366     bool isSampler(GLuint samplerName) const;
    367 
    368     void getBooleanv(GLenum pname, GLboolean *params);
    369     void getFloatv(GLenum pname, GLfloat *params);
    370     void getIntegerv(GLenum pname, GLint *params);
    371     void getInteger64v(GLenum pname, GLint64 *params);
    372 
    373     bool getIndexedIntegerv(GLenum target, GLuint index, GLint *data);
    374     bool getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data);
    375 
    376     bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
    377     bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
    378 
    379     void clear(GLbitfield mask);
    380     void clearBufferfv(GLenum buffer, int drawbuffer, const float *values);
    381     void clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values);
    382     void clearBufferiv(GLenum buffer, int drawbuffer, const int *values);
    383     void clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil);
    384 
    385     void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
    386     void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
    387     void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances);
    388     void sync(bool block);   // flush/finish
    389 
    390     void recordInvalidEnum();
    391     void recordInvalidValue();
    392     void recordInvalidOperation();
    393     void recordOutOfMemory();
    394     void recordInvalidFramebufferOperation();
    395 
    396     GLenum getError();
    397     GLenum getResetStatus();
    398     virtual bool isResetNotificationEnabled();
    399 
    400     virtual int getClientVersion() const;
    401 
    402     int getMajorShaderModel() const;
    403     float getMaximumPointSize() const;
    404     unsigned int getMaximumCombinedTextureImageUnits() const;
    405     unsigned int getMaximumCombinedUniformBufferBindings() const;
    406     int getMaximumRenderbufferDimension() const;
    407     int getMaximum2DTextureDimension() const;
    408     int getMaximumCubeTextureDimension() const;
    409     int getMaximum3DTextureDimension() const;
    410     int getMaximum2DArrayTextureLayers() const;
    411     int getMaximum2DTextureLevel() const;
    412     int getMaximumCubeTextureLevel() const;
    413     int getMaximum3DTextureLevel() const;
    414     int getMaximum2DArrayTextureLevel() const;
    415     unsigned int getMaximumRenderTargets() const;
    416     GLsizei getMaxSupportedSamples() const;
    417     GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
    418     GLsizei getNumSampleCounts(GLenum internalFormat) const;
    419     void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
    420     unsigned int getMaxTransformFeedbackBufferBindings() const;
    421     GLintptr getUniformBufferOffsetAlignment() const;
    422     const char *getCombinedExtensionsString() const;
    423     const char *getExtensionString(const GLuint index) const;
    424     unsigned int getNumExtensions() const;
    425     const char *getRendererString() const;
    426     bool supportsEventQueries() const;
    427     bool supportsOcclusionQueries() const;
    428     bool supportsBGRATextures() const;
    429     bool supportsDXT1Textures() const;
    430     bool supportsDXT3Textures() const;
    431     bool supportsDXT5Textures() const;
    432     bool supportsFloat32Textures() const;
    433     bool supportsFloat32LinearFilter() const;
    434     bool supportsFloat32RenderableTextures() const;
    435     bool supportsFloat16Textures() const;
    436     bool supportsFloat16LinearFilter() const;
    437     bool supportsFloat16RenderableTextures() const;
    438     bool supportsLuminanceTextures() const;
    439     bool supportsLuminanceAlphaTextures() const;
    440     bool supportsRGTextures() const;
    441     bool supportsDepthTextures() const;
    442     bool supports32bitIndices() const;
    443     bool supportsNonPower2Texture() const;
    444     bool supportsInstancing() const;
    445     bool supportsTextureFilterAnisotropy() const;
    446     bool supportsPBOs() const;
    447 
    448     void getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type);
    449 
    450     float getTextureMaxAnisotropy() const;
    451 
    452     void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
    453                          GLbitfield mask, GLenum filter);
    454 
    455     void invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
    456                                GLint x, GLint y, GLsizei width, GLsizei height);
    457 
    458     bool hasMappedBuffer(GLenum target) const;
    459 
    460     rx::Renderer *getRenderer() { return mRenderer; }
    461 
    462   private:
    463     DISALLOW_COPY_AND_ASSIGN(Context);
    464 
    465     // TODO: std::array may become unavailable using older versions of GCC
    466     typedef std::array<unsigned int, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS> FramebufferTextureSerialArray;
    467 
    468     bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
    469     void applyState(GLenum drawMode);
    470     void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
    471     void applyTextures(SamplerType shaderType, Texture *textures[], TextureType *textureTypes, SamplerState *samplers,
    472                        size_t textureCount, const FramebufferTextureSerialArray& framebufferSerials,
    473                        size_t framebufferSerialCount);
    474     bool applyUniformBuffers();
    475     bool applyTransformFeedbackBuffers();
    476     void markTransformFeedbackUsage();
    477 
    478     void detachBuffer(GLuint buffer);
    479     void detachTexture(GLuint texture);
    480     void detachFramebuffer(GLuint framebuffer);
    481     void detachRenderbuffer(GLuint renderbuffer);
    482     void detachVertexArray(GLuint vertexArray);
    483     void detachTransformFeedback(GLuint transformFeedback);
    484     void detachSampler(GLuint sampler);
    485 
    486     void generateSwizzles(Texture *textures[], size_t count);
    487     size_t getCurrentTexturesAndSamplerStates(ProgramBinary *programBinary, SamplerType type, Texture **outTextures,
    488                                               TextureType *outTextureTypes, SamplerState *outSamplers);
    489     Texture *getIncompleteTexture(TextureType type);
    490 
    491     bool skipDraw(GLenum drawMode);
    492 
    493     void initExtensionString();
    494     void initRendererString();
    495 
    496     size_t getBoundFramebufferTextureSerials(FramebufferTextureSerialArray *outSerialArray);
    497 
    498     rx::Renderer *const mRenderer;
    499 
    500     int mClientVersion;
    501 
    502     State mState;
    503 
    504     BindingPointer<Texture2D> mTexture2DZero;
    505     BindingPointer<TextureCubeMap> mTextureCubeMapZero;
    506     BindingPointer<Texture3D> mTexture3DZero;
    507     BindingPointer<Texture2DArray> mTexture2DArrayZero;
    508 
    509     typedef std::unordered_map<GLuint, Framebuffer*> FramebufferMap;
    510     FramebufferMap mFramebufferMap;
    511     HandleAllocator mFramebufferHandleAllocator;
    512 
    513     typedef std::unordered_map<GLuint, FenceNV*> FenceNVMap;
    514     FenceNVMap mFenceNVMap;
    515     HandleAllocator mFenceNVHandleAllocator;
    516 
    517     typedef std::unordered_map<GLuint, Query*> QueryMap;
    518     QueryMap mQueryMap;
    519     HandleAllocator mQueryHandleAllocator;
    520 
    521     typedef std::unordered_map<GLuint, VertexArray*> VertexArrayMap;
    522     VertexArrayMap mVertexArrayMap;
    523     HandleAllocator mVertexArrayHandleAllocator;
    524 
    525     BindingPointer<TransformFeedback> mTransformFeedbackZero;
    526     typedef std::unordered_map<GLuint, TransformFeedback*> TransformFeedbackMap;
    527     TransformFeedbackMap mTransformFeedbackMap;
    528     HandleAllocator mTransformFeedbackAllocator;
    529 
    530     std::vector<std::string> mExtensionStringList;
    531     const char *mCombinedExtensionsString;
    532     const char *mRendererString;
    533 
    534     BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
    535 
    536     // Recorded errors
    537     bool mInvalidEnum;
    538     bool mInvalidValue;
    539     bool mInvalidOperation;
    540     bool mOutOfMemory;
    541     bool mInvalidFramebufferOperation;
    542 
    543     // Current/lost context flags
    544     bool mHasBeenCurrent;
    545     bool mContextLost;
    546     GLenum mResetStatus;
    547     GLenum mResetStrategy;
    548     bool mRobustAccess;
    549 
    550     BindingPointer<ProgramBinary> mCurrentProgramBinary;
    551     Framebuffer *mBoundDrawFramebuffer;
    552 
    553     int mMajorShaderModel;
    554     float mMaximumPointSize;
    555     bool mSupportsVertexTexture;
    556     bool mSupportsNonPower2Texture;
    557     bool mSupportsInstancing;
    558     int  mMaxViewportDimension;
    559     int  mMaxRenderbufferDimension;
    560     int  mMax2DTextureDimension;
    561     int  mMaxCubeTextureDimension;
    562     int  mMax3DTextureDimension;
    563     int  mMax2DArrayTextureLayers;
    564     int  mMax2DTextureLevel;
    565     int  mMaxCubeTextureLevel;
    566     int  mMax3DTextureLevel;
    567     int  mMax2DArrayTextureLevel;
    568     float mMaxTextureAnisotropy;
    569     bool mSupportsEventQueries;
    570     bool mSupportsOcclusionQueries;
    571     bool mSupportsBGRATextures;
    572     bool mSupportsDXT1Textures;
    573     bool mSupportsDXT3Textures;
    574     bool mSupportsDXT5Textures;
    575     bool mSupportsFloat32Textures;
    576     bool mSupportsFloat32LinearFilter;
    577     bool mSupportsFloat32RenderableTextures;
    578     bool mSupportsFloat16Textures;
    579     bool mSupportsFloat16LinearFilter;
    580     bool mSupportsFloat16RenderableTextures;
    581     bool mSupportsLuminanceTextures;
    582     bool mSupportsLuminanceAlphaTextures;
    583     bool mSupportsRGTextures;
    584     bool mSupportsDepthTextures;
    585     bool mSupports32bitIndices;
    586     bool mSupportsTextureFilterAnisotropy;
    587     bool mSupportsPBOs;
    588     int mNumCompressedTextureFormats;
    589 
    590     ResourceManager *mResourceManager;
    591 };
    592 }
    593 
    594 #endif   // INCLUDE_CONTEXT_H_
    595