Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | // Context.h: Defines the gl::Context class, managing all GL state and performing |
michael@0 | 8 | // rendering operations. It is the GLES2 specific implementation of EGLContext. |
michael@0 | 9 | |
michael@0 | 10 | #ifndef LIBGLESV2_CONTEXT_H_ |
michael@0 | 11 | #define LIBGLESV2_CONTEXT_H_ |
michael@0 | 12 | |
michael@0 | 13 | #define GL_APICALL |
michael@0 | 14 | #include <GLES2/gl2.h> |
michael@0 | 15 | #include <GLES2/gl2ext.h> |
michael@0 | 16 | #define EGLAPI |
michael@0 | 17 | #include <EGL/egl.h> |
michael@0 | 18 | |
michael@0 | 19 | #include <string> |
michael@0 | 20 | #include <map> |
michael@0 | 21 | #ifdef _MSC_VER |
michael@0 | 22 | #include <hash_map> |
michael@0 | 23 | #else |
michael@0 | 24 | #include <unordered_map> |
michael@0 | 25 | #endif |
michael@0 | 26 | |
michael@0 | 27 | #include "common/angleutils.h" |
michael@0 | 28 | #include "common/RefCountObject.h" |
michael@0 | 29 | #include "libGLESv2/HandleAllocator.h" |
michael@0 | 30 | #include "libGLESv2/angletypes.h" |
michael@0 | 31 | #include "libGLESv2/Constants.h" |
michael@0 | 32 | |
michael@0 | 33 | namespace rx |
michael@0 | 34 | { |
michael@0 | 35 | class Renderer; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | namespace egl |
michael@0 | 39 | { |
michael@0 | 40 | class Display; |
michael@0 | 41 | class Surface; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | namespace gl |
michael@0 | 45 | { |
michael@0 | 46 | class Shader; |
michael@0 | 47 | class Program; |
michael@0 | 48 | class ProgramBinary; |
michael@0 | 49 | class Texture; |
michael@0 | 50 | class Texture2D; |
michael@0 | 51 | class TextureCubeMap; |
michael@0 | 52 | class Framebuffer; |
michael@0 | 53 | class Renderbuffer; |
michael@0 | 54 | class RenderbufferStorage; |
michael@0 | 55 | class Colorbuffer; |
michael@0 | 56 | class Depthbuffer; |
michael@0 | 57 | class Stencilbuffer; |
michael@0 | 58 | class DepthStencilbuffer; |
michael@0 | 59 | class Fence; |
michael@0 | 60 | class Query; |
michael@0 | 61 | class ResourceManager; |
michael@0 | 62 | class Buffer; |
michael@0 | 63 | |
michael@0 | 64 | enum QueryType |
michael@0 | 65 | { |
michael@0 | 66 | QUERY_ANY_SAMPLES_PASSED, |
michael@0 | 67 | QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE, |
michael@0 | 68 | |
michael@0 | 69 | QUERY_TYPE_COUNT |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | // Helper structure describing a single vertex attribute |
michael@0 | 73 | class VertexAttribute |
michael@0 | 74 | { |
michael@0 | 75 | public: |
michael@0 | 76 | VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0) |
michael@0 | 77 | { |
michael@0 | 78 | mCurrentValue[0] = 0.0f; |
michael@0 | 79 | mCurrentValue[1] = 0.0f; |
michael@0 | 80 | mCurrentValue[2] = 0.0f; |
michael@0 | 81 | mCurrentValue[3] = 1.0f; |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | int typeSize() const |
michael@0 | 85 | { |
michael@0 | 86 | switch (mType) |
michael@0 | 87 | { |
michael@0 | 88 | case GL_BYTE: return mSize * sizeof(GLbyte); |
michael@0 | 89 | case GL_UNSIGNED_BYTE: return mSize * sizeof(GLubyte); |
michael@0 | 90 | case GL_SHORT: return mSize * sizeof(GLshort); |
michael@0 | 91 | case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort); |
michael@0 | 92 | case GL_FIXED: return mSize * sizeof(GLfixed); |
michael@0 | 93 | case GL_FLOAT: return mSize * sizeof(GLfloat); |
michael@0 | 94 | default: UNREACHABLE(); return mSize * sizeof(GLfloat); |
michael@0 | 95 | } |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | GLsizei stride() const |
michael@0 | 99 | { |
michael@0 | 100 | return mStride ? mStride : typeSize(); |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | // From glVertexAttribPointer |
michael@0 | 104 | GLenum mType; |
michael@0 | 105 | GLint mSize; |
michael@0 | 106 | bool mNormalized; |
michael@0 | 107 | GLsizei mStride; // 0 means natural stride |
michael@0 | 108 | |
michael@0 | 109 | union |
michael@0 | 110 | { |
michael@0 | 111 | const void *mPointer; |
michael@0 | 112 | intptr_t mOffset; |
michael@0 | 113 | }; |
michael@0 | 114 | |
michael@0 | 115 | BindingPointer<Buffer> mBoundBuffer; // Captured when glVertexAttribPointer is called. |
michael@0 | 116 | |
michael@0 | 117 | bool mArrayEnabled; // From glEnable/DisableVertexAttribArray |
michael@0 | 118 | float mCurrentValue[4]; // From glVertexAttrib |
michael@0 | 119 | unsigned int mDivisor; |
michael@0 | 120 | }; |
michael@0 | 121 | |
michael@0 | 122 | // Helper structure to store all raw state |
michael@0 | 123 | struct State |
michael@0 | 124 | { |
michael@0 | 125 | Color colorClearValue; |
michael@0 | 126 | GLclampf depthClearValue; |
michael@0 | 127 | int stencilClearValue; |
michael@0 | 128 | |
michael@0 | 129 | RasterizerState rasterizer; |
michael@0 | 130 | bool scissorTest; |
michael@0 | 131 | Rectangle scissor; |
michael@0 | 132 | |
michael@0 | 133 | BlendState blend; |
michael@0 | 134 | Color blendColor; |
michael@0 | 135 | bool sampleCoverage; |
michael@0 | 136 | GLclampf sampleCoverageValue; |
michael@0 | 137 | bool sampleCoverageInvert; |
michael@0 | 138 | |
michael@0 | 139 | DepthStencilState depthStencil; |
michael@0 | 140 | GLint stencilRef; |
michael@0 | 141 | GLint stencilBackRef; |
michael@0 | 142 | |
michael@0 | 143 | GLfloat lineWidth; |
michael@0 | 144 | |
michael@0 | 145 | GLenum generateMipmapHint; |
michael@0 | 146 | GLenum fragmentShaderDerivativeHint; |
michael@0 | 147 | |
michael@0 | 148 | Rectangle viewport; |
michael@0 | 149 | float zNear; |
michael@0 | 150 | float zFar; |
michael@0 | 151 | |
michael@0 | 152 | unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0 |
michael@0 | 153 | BindingPointer<Buffer> arrayBuffer; |
michael@0 | 154 | BindingPointer<Buffer> elementArrayBuffer; |
michael@0 | 155 | GLuint readFramebuffer; |
michael@0 | 156 | GLuint drawFramebuffer; |
michael@0 | 157 | BindingPointer<Renderbuffer> renderbuffer; |
michael@0 | 158 | GLuint currentProgram; |
michael@0 | 159 | |
michael@0 | 160 | VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS]; |
michael@0 | 161 | BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS]; |
michael@0 | 162 | BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT]; |
michael@0 | 163 | |
michael@0 | 164 | GLint unpackAlignment; |
michael@0 | 165 | GLint packAlignment; |
michael@0 | 166 | bool packReverseRowOrder; |
michael@0 | 167 | }; |
michael@0 | 168 | |
michael@0 | 169 | class Context |
michael@0 | 170 | { |
michael@0 | 171 | public: |
michael@0 | 172 | Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess); |
michael@0 | 173 | |
michael@0 | 174 | ~Context(); |
michael@0 | 175 | |
michael@0 | 176 | void makeCurrent(egl::Surface *surface); |
michael@0 | 177 | |
michael@0 | 178 | virtual void markContextLost(); |
michael@0 | 179 | bool isContextLost(); |
michael@0 | 180 | |
michael@0 | 181 | // State manipulation |
michael@0 | 182 | void setClearColor(float red, float green, float blue, float alpha); |
michael@0 | 183 | |
michael@0 | 184 | void setClearDepth(float depth); |
michael@0 | 185 | |
michael@0 | 186 | void setClearStencil(int stencil); |
michael@0 | 187 | |
michael@0 | 188 | void setCullFace(bool enabled); |
michael@0 | 189 | bool isCullFaceEnabled() const; |
michael@0 | 190 | |
michael@0 | 191 | void setCullMode(GLenum mode); |
michael@0 | 192 | |
michael@0 | 193 | void setFrontFace(GLenum front); |
michael@0 | 194 | |
michael@0 | 195 | void setDepthTest(bool enabled); |
michael@0 | 196 | bool isDepthTestEnabled() const; |
michael@0 | 197 | |
michael@0 | 198 | void setDepthFunc(GLenum depthFunc); |
michael@0 | 199 | |
michael@0 | 200 | void setDepthRange(float zNear, float zFar); |
michael@0 | 201 | |
michael@0 | 202 | void setBlend(bool enabled); |
michael@0 | 203 | bool isBlendEnabled() const; |
michael@0 | 204 | |
michael@0 | 205 | void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha); |
michael@0 | 206 | void setBlendColor(float red, float green, float blue, float alpha); |
michael@0 | 207 | void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation); |
michael@0 | 208 | |
michael@0 | 209 | void setStencilTest(bool enabled); |
michael@0 | 210 | bool isStencilTestEnabled() const; |
michael@0 | 211 | |
michael@0 | 212 | void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask); |
michael@0 | 213 | void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask); |
michael@0 | 214 | void setStencilWritemask(GLuint stencilWritemask); |
michael@0 | 215 | void setStencilBackWritemask(GLuint stencilBackWritemask); |
michael@0 | 216 | void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass); |
michael@0 | 217 | void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass); |
michael@0 | 218 | |
michael@0 | 219 | void setPolygonOffsetFill(bool enabled); |
michael@0 | 220 | bool isPolygonOffsetFillEnabled() const; |
michael@0 | 221 | |
michael@0 | 222 | void setPolygonOffsetParams(GLfloat factor, GLfloat units); |
michael@0 | 223 | |
michael@0 | 224 | void setSampleAlphaToCoverage(bool enabled); |
michael@0 | 225 | bool isSampleAlphaToCoverageEnabled() const; |
michael@0 | 226 | |
michael@0 | 227 | void setSampleCoverage(bool enabled); |
michael@0 | 228 | bool isSampleCoverageEnabled() const; |
michael@0 | 229 | |
michael@0 | 230 | void setSampleCoverageParams(GLclampf value, bool invert); |
michael@0 | 231 | |
michael@0 | 232 | void setScissorTest(bool enabled); |
michael@0 | 233 | bool isScissorTestEnabled() const; |
michael@0 | 234 | |
michael@0 | 235 | void setDither(bool enabled); |
michael@0 | 236 | bool isDitherEnabled() const; |
michael@0 | 237 | |
michael@0 | 238 | void setLineWidth(GLfloat width); |
michael@0 | 239 | |
michael@0 | 240 | void setGenerateMipmapHint(GLenum hint); |
michael@0 | 241 | void setFragmentShaderDerivativeHint(GLenum hint); |
michael@0 | 242 | |
michael@0 | 243 | void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height); |
michael@0 | 244 | |
michael@0 | 245 | void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height); |
michael@0 | 246 | |
michael@0 | 247 | void setColorMask(bool red, bool green, bool blue, bool alpha); |
michael@0 | 248 | void setDepthMask(bool mask); |
michael@0 | 249 | |
michael@0 | 250 | void setActiveSampler(unsigned int active); |
michael@0 | 251 | |
michael@0 | 252 | GLuint getReadFramebufferHandle() const; |
michael@0 | 253 | GLuint getDrawFramebufferHandle() const; |
michael@0 | 254 | GLuint getRenderbufferHandle() const; |
michael@0 | 255 | |
michael@0 | 256 | GLuint getArrayBufferHandle() const; |
michael@0 | 257 | |
michael@0 | 258 | GLuint getActiveQuery(GLenum target) const; |
michael@0 | 259 | |
michael@0 | 260 | void setEnableVertexAttribArray(unsigned int attribNum, bool enabled); |
michael@0 | 261 | const VertexAttribute &getVertexAttribState(unsigned int attribNum); |
michael@0 | 262 | void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type, |
michael@0 | 263 | bool normalized, GLsizei stride, const void *pointer); |
michael@0 | 264 | const void *getVertexAttribPointer(unsigned int attribNum) const; |
michael@0 | 265 | |
michael@0 | 266 | void setUnpackAlignment(GLint alignment); |
michael@0 | 267 | GLint getUnpackAlignment() const; |
michael@0 | 268 | |
michael@0 | 269 | void setPackAlignment(GLint alignment); |
michael@0 | 270 | GLint getPackAlignment() const; |
michael@0 | 271 | |
michael@0 | 272 | void setPackReverseRowOrder(bool reverseRowOrder); |
michael@0 | 273 | bool getPackReverseRowOrder() const; |
michael@0 | 274 | |
michael@0 | 275 | // These create and destroy methods are merely pass-throughs to |
michael@0 | 276 | // ResourceManager, which owns these object types |
michael@0 | 277 | GLuint createBuffer(); |
michael@0 | 278 | GLuint createShader(GLenum type); |
michael@0 | 279 | GLuint createProgram(); |
michael@0 | 280 | GLuint createTexture(); |
michael@0 | 281 | GLuint createRenderbuffer(); |
michael@0 | 282 | |
michael@0 | 283 | void deleteBuffer(GLuint buffer); |
michael@0 | 284 | void deleteShader(GLuint shader); |
michael@0 | 285 | void deleteProgram(GLuint program); |
michael@0 | 286 | void deleteTexture(GLuint texture); |
michael@0 | 287 | void deleteRenderbuffer(GLuint renderbuffer); |
michael@0 | 288 | |
michael@0 | 289 | // Framebuffers are owned by the Context, so these methods do not pass through |
michael@0 | 290 | GLuint createFramebuffer(); |
michael@0 | 291 | void deleteFramebuffer(GLuint framebuffer); |
michael@0 | 292 | |
michael@0 | 293 | // Fences are owned by the Context. |
michael@0 | 294 | GLuint createFence(); |
michael@0 | 295 | void deleteFence(GLuint fence); |
michael@0 | 296 | |
michael@0 | 297 | // Queries are owned by the Context; |
michael@0 | 298 | GLuint createQuery(); |
michael@0 | 299 | void deleteQuery(GLuint query); |
michael@0 | 300 | |
michael@0 | 301 | void bindArrayBuffer(GLuint buffer); |
michael@0 | 302 | void bindElementArrayBuffer(GLuint buffer); |
michael@0 | 303 | void bindTexture2D(GLuint texture); |
michael@0 | 304 | void bindTextureCubeMap(GLuint texture); |
michael@0 | 305 | void bindReadFramebuffer(GLuint framebuffer); |
michael@0 | 306 | void bindDrawFramebuffer(GLuint framebuffer); |
michael@0 | 307 | void bindRenderbuffer(GLuint renderbuffer); |
michael@0 | 308 | void useProgram(GLuint program); |
michael@0 | 309 | void linkProgram(GLuint program); |
michael@0 | 310 | void setProgramBinary(GLuint program, const void *binary, GLint length); |
michael@0 | 311 | |
michael@0 | 312 | void beginQuery(GLenum target, GLuint query); |
michael@0 | 313 | void endQuery(GLenum target); |
michael@0 | 314 | |
michael@0 | 315 | void setFramebufferZero(Framebuffer *framebuffer); |
michael@0 | 316 | |
michael@0 | 317 | void setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples); |
michael@0 | 318 | |
michael@0 | 319 | void setVertexAttrib(GLuint index, const GLfloat *values); |
michael@0 | 320 | void setVertexAttribDivisor(GLuint index, GLuint divisor); |
michael@0 | 321 | |
michael@0 | 322 | Buffer *getBuffer(GLuint handle); |
michael@0 | 323 | Fence *getFence(GLuint handle); |
michael@0 | 324 | Shader *getShader(GLuint handle); |
michael@0 | 325 | Program *getProgram(GLuint handle); |
michael@0 | 326 | Texture *getTexture(GLuint handle); |
michael@0 | 327 | Framebuffer *getFramebuffer(GLuint handle); |
michael@0 | 328 | Renderbuffer *getRenderbuffer(GLuint handle); |
michael@0 | 329 | Query *getQuery(GLuint handle, bool create, GLenum type); |
michael@0 | 330 | |
michael@0 | 331 | Buffer *getArrayBuffer(); |
michael@0 | 332 | Buffer *getElementArrayBuffer(); |
michael@0 | 333 | ProgramBinary *getCurrentProgramBinary(); |
michael@0 | 334 | Texture2D *getTexture2D(); |
michael@0 | 335 | TextureCubeMap *getTextureCubeMap(); |
michael@0 | 336 | Texture *getSamplerTexture(unsigned int sampler, TextureType type); |
michael@0 | 337 | Framebuffer *getReadFramebuffer(); |
michael@0 | 338 | Framebuffer *getDrawFramebuffer(); |
michael@0 | 339 | |
michael@0 | 340 | bool getFloatv(GLenum pname, GLfloat *params); |
michael@0 | 341 | bool getIntegerv(GLenum pname, GLint *params); |
michael@0 | 342 | bool getBooleanv(GLenum pname, GLboolean *params); |
michael@0 | 343 | |
michael@0 | 344 | bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams); |
michael@0 | 345 | |
michael@0 | 346 | void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels); |
michael@0 | 347 | void clear(GLbitfield mask); |
michael@0 | 348 | void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances); |
michael@0 | 349 | void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances); |
michael@0 | 350 | void sync(bool block); // flush/finish |
michael@0 | 351 | |
michael@0 | 352 | void recordInvalidEnum(); |
michael@0 | 353 | void recordInvalidValue(); |
michael@0 | 354 | void recordInvalidOperation(); |
michael@0 | 355 | void recordOutOfMemory(); |
michael@0 | 356 | void recordInvalidFramebufferOperation(); |
michael@0 | 357 | |
michael@0 | 358 | GLenum getError(); |
michael@0 | 359 | GLenum getResetStatus(); |
michael@0 | 360 | virtual bool isResetNotificationEnabled(); |
michael@0 | 361 | |
michael@0 | 362 | int getMajorShaderModel() const; |
michael@0 | 363 | float getMaximumPointSize() const; |
michael@0 | 364 | unsigned int getMaximumCombinedTextureImageUnits() const; |
michael@0 | 365 | int getMaximumRenderbufferDimension() const; |
michael@0 | 366 | int getMaximumTextureDimension() const; |
michael@0 | 367 | int getMaximumCubeTextureDimension() const; |
michael@0 | 368 | int getMaximumTextureLevel() const; |
michael@0 | 369 | unsigned int getMaximumRenderTargets() const; |
michael@0 | 370 | GLsizei getMaxSupportedSamples() const; |
michael@0 | 371 | const char *getExtensionString() const; |
michael@0 | 372 | const char *getRendererString() const; |
michael@0 | 373 | bool supportsEventQueries() const; |
michael@0 | 374 | bool supportsOcclusionQueries() const; |
michael@0 | 375 | bool supportsBGRATextures() const; |
michael@0 | 376 | bool supportsDXT1Textures() const; |
michael@0 | 377 | bool supportsDXT3Textures() const; |
michael@0 | 378 | bool supportsDXT5Textures() const; |
michael@0 | 379 | bool supportsFloat32Textures() const; |
michael@0 | 380 | bool supportsFloat32LinearFilter() const; |
michael@0 | 381 | bool supportsFloat32RenderableTextures() const; |
michael@0 | 382 | bool supportsFloat16Textures() const; |
michael@0 | 383 | bool supportsFloat16LinearFilter() const; |
michael@0 | 384 | bool supportsFloat16RenderableTextures() const; |
michael@0 | 385 | bool supportsLuminanceTextures() const; |
michael@0 | 386 | bool supportsLuminanceAlphaTextures() const; |
michael@0 | 387 | bool supportsDepthTextures() const; |
michael@0 | 388 | bool supports32bitIndices() const; |
michael@0 | 389 | bool supportsNonPower2Texture() const; |
michael@0 | 390 | bool supportsInstancing() const; |
michael@0 | 391 | bool supportsTextureFilterAnisotropy() const; |
michael@0 | 392 | |
michael@0 | 393 | bool getCurrentReadFormatType(GLenum *format, GLenum *type); |
michael@0 | 394 | |
michael@0 | 395 | float getTextureMaxAnisotropy() const; |
michael@0 | 396 | |
michael@0 | 397 | void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, |
michael@0 | 398 | GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
michael@0 | 399 | GLbitfield mask); |
michael@0 | 400 | |
michael@0 | 401 | private: |
michael@0 | 402 | DISALLOW_COPY_AND_ASSIGN(Context); |
michael@0 | 403 | |
michael@0 | 404 | bool applyRenderTarget(GLenum drawMode, bool ignoreViewport); |
michael@0 | 405 | void applyState(GLenum drawMode); |
michael@0 | 406 | void applyShaders(); |
michael@0 | 407 | void applyTextures(); |
michael@0 | 408 | void applyTextures(SamplerType type); |
michael@0 | 409 | |
michael@0 | 410 | void detachBuffer(GLuint buffer); |
michael@0 | 411 | void detachTexture(GLuint texture); |
michael@0 | 412 | void detachFramebuffer(GLuint framebuffer); |
michael@0 | 413 | void detachRenderbuffer(GLuint renderbuffer); |
michael@0 | 414 | |
michael@0 | 415 | Texture *getIncompleteTexture(TextureType type); |
michael@0 | 416 | |
michael@0 | 417 | bool skipDraw(GLenum drawMode); |
michael@0 | 418 | |
michael@0 | 419 | void initExtensionString(); |
michael@0 | 420 | void initRendererString(); |
michael@0 | 421 | |
michael@0 | 422 | rx::Renderer *const mRenderer; |
michael@0 | 423 | |
michael@0 | 424 | State mState; |
michael@0 | 425 | |
michael@0 | 426 | BindingPointer<Texture2D> mTexture2DZero; |
michael@0 | 427 | BindingPointer<TextureCubeMap> mTextureCubeMapZero; |
michael@0 | 428 | |
michael@0 | 429 | #ifndef HASH_MAP |
michael@0 | 430 | # ifdef _MSC_VER |
michael@0 | 431 | # define HASH_MAP stdext::hash_map |
michael@0 | 432 | # else |
michael@0 | 433 | # define HASH_MAP std::unordered_map |
michael@0 | 434 | # endif |
michael@0 | 435 | #endif |
michael@0 | 436 | |
michael@0 | 437 | typedef HASH_MAP<GLuint, Framebuffer*> FramebufferMap; |
michael@0 | 438 | FramebufferMap mFramebufferMap; |
michael@0 | 439 | HandleAllocator mFramebufferHandleAllocator; |
michael@0 | 440 | |
michael@0 | 441 | typedef HASH_MAP<GLuint, Fence*> FenceMap; |
michael@0 | 442 | FenceMap mFenceMap; |
michael@0 | 443 | HandleAllocator mFenceHandleAllocator; |
michael@0 | 444 | |
michael@0 | 445 | typedef HASH_MAP<GLuint, Query*> QueryMap; |
michael@0 | 446 | QueryMap mQueryMap; |
michael@0 | 447 | HandleAllocator mQueryHandleAllocator; |
michael@0 | 448 | |
michael@0 | 449 | const char *mExtensionString; |
michael@0 | 450 | const char *mRendererString; |
michael@0 | 451 | |
michael@0 | 452 | BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT]; |
michael@0 | 453 | |
michael@0 | 454 | // Recorded errors |
michael@0 | 455 | bool mInvalidEnum; |
michael@0 | 456 | bool mInvalidValue; |
michael@0 | 457 | bool mInvalidOperation; |
michael@0 | 458 | bool mOutOfMemory; |
michael@0 | 459 | bool mInvalidFramebufferOperation; |
michael@0 | 460 | |
michael@0 | 461 | // Current/lost context flags |
michael@0 | 462 | bool mHasBeenCurrent; |
michael@0 | 463 | bool mContextLost; |
michael@0 | 464 | GLenum mResetStatus; |
michael@0 | 465 | GLenum mResetStrategy; |
michael@0 | 466 | bool mRobustAccess; |
michael@0 | 467 | |
michael@0 | 468 | BindingPointer<ProgramBinary> mCurrentProgramBinary; |
michael@0 | 469 | Framebuffer *mBoundDrawFramebuffer; |
michael@0 | 470 | |
michael@0 | 471 | int mMajorShaderModel; |
michael@0 | 472 | float mMaximumPointSize; |
michael@0 | 473 | bool mSupportsVertexTexture; |
michael@0 | 474 | bool mSupportsNonPower2Texture; |
michael@0 | 475 | bool mSupportsInstancing; |
michael@0 | 476 | int mMaxViewportDimension; |
michael@0 | 477 | int mMaxRenderbufferDimension; |
michael@0 | 478 | int mMaxTextureDimension; |
michael@0 | 479 | int mMaxCubeTextureDimension; |
michael@0 | 480 | int mMaxTextureLevel; |
michael@0 | 481 | float mMaxTextureAnisotropy; |
michael@0 | 482 | bool mSupportsEventQueries; |
michael@0 | 483 | bool mSupportsOcclusionQueries; |
michael@0 | 484 | bool mSupportsBGRATextures; |
michael@0 | 485 | bool mSupportsDXT1Textures; |
michael@0 | 486 | bool mSupportsDXT3Textures; |
michael@0 | 487 | bool mSupportsDXT5Textures; |
michael@0 | 488 | bool mSupportsFloat32Textures; |
michael@0 | 489 | bool mSupportsFloat32LinearFilter; |
michael@0 | 490 | bool mSupportsFloat32RenderableTextures; |
michael@0 | 491 | bool mSupportsFloat16Textures; |
michael@0 | 492 | bool mSupportsFloat16LinearFilter; |
michael@0 | 493 | bool mSupportsFloat16RenderableTextures; |
michael@0 | 494 | bool mSupportsLuminanceTextures; |
michael@0 | 495 | bool mSupportsLuminanceAlphaTextures; |
michael@0 | 496 | bool mSupportsDepthTextures; |
michael@0 | 497 | bool mSupports32bitIndices; |
michael@0 | 498 | bool mSupportsTextureFilterAnisotropy; |
michael@0 | 499 | int mNumCompressedTextureFormats; |
michael@0 | 500 | |
michael@0 | 501 | ResourceManager *mResourceManager; |
michael@0 | 502 | }; |
michael@0 | 503 | } |
michael@0 | 504 | |
michael@0 | 505 | #endif // INCLUDE_CONTEXT_H_ |