1 // SwiftShader Software Renderer
\r
3 // Copyright(c) 2005-2013 TransGaming Inc.
\r
5 // All rights reserved. No part of this software may be copied, distributed, transmitted,
\r
6 // transcribed, stored in a retrieval system, translated into any human or computer
\r
7 // language by any means, or disclosed to third parties without the explicit written
\r
8 // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
\r
9 // or implied, including but not limited to any patent rights, are granted to you.
\r
12 // Context.h: Defines the Context class, managing all GL state and performing
\r
13 // rendering operations. It is the GLES2 specific implementation of EGLContext.
\r
15 #ifndef LIBGLESV2_CONTEXT_H_
\r
16 #define LIBGLESV2_CONTEXT_H_
\r
18 #include "libEGL/Context.hpp"
\r
19 #include "ResourceManager.h"
\r
20 #include "common/NameSpace.hpp"
\r
21 #include "common/Object.hpp"
\r
22 #include "Image.hpp"
\r
23 #include "Renderer/Sampler.hpp"
\r
24 #include "TransformFeedback.h"
\r
27 #include <GLES2/gl2.h>
\r
28 #include <GLES2/gl2ext.h>
\r
29 #include <GLES3/gl3.h>
\r
31 #include <EGL/egl.h>
\r
45 struct TranslatedAttribute;
\r
46 struct TranslatedIndexData;
\r
55 class TextureCubeMap;
\r
56 class TextureExternal;
\r
59 class RenderbufferStorage;
\r
62 class StreamingIndexBuffer;
\r
63 class Stencilbuffer;
\r
64 class DepthStencilbuffer;
\r
65 class VertexDataManager;
\r
66 class IndexDataManager;
\r
74 MAX_VERTEX_ATTRIBS = 16,
\r
75 MAX_UNIFORM_VECTORS = 256, // Device limit
\r
76 MAX_VERTEX_UNIFORM_VECTORS = VERTEX_UNIFORM_VECTORS - 3, // Reserve space for gl_DepthRange
\r
77 MAX_VARYING_VECTORS = 10,
\r
78 MAX_TEXTURE_IMAGE_UNITS = TEXTURE_IMAGE_UNITS,
\r
79 MAX_VERTEX_TEXTURE_IMAGE_UNITS = VERTEX_TEXTURE_IMAGE_UNITS,
\r
80 MAX_COMBINED_TEXTURE_IMAGE_UNITS = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS,
\r
81 MAX_FRAGMENT_UNIFORM_VECTORS = FRAGMENT_UNIFORM_VECTORS - 3, // Reserve space for gl_DepthRange
\r
82 MAX_DRAW_BUFFERS = 1,
\r
83 MAX_ELEMENT_INDEX = 0x7FFFFFFF,
\r
84 MAX_ELEMENTS_INDICES = 0x7FFFFFFF,
\r
85 MAX_ELEMENTS_VERTICES = 0x7FFFFFFF
\r
88 const GLenum compressedTextureFormats[] =
\r
92 GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
\r
93 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
\r
94 GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
\r
95 GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
\r
97 #if (GL_ES_VERSION_3_0)
\r
98 GL_COMPRESSED_R11_EAC,
\r
99 GL_COMPRESSED_SIGNED_R11_EAC,
\r
100 GL_COMPRESSED_RG11_EAC,
\r
101 GL_COMPRESSED_SIGNED_RG11_EAC,
\r
102 GL_COMPRESSED_RGB8_ETC2,
\r
103 GL_COMPRESSED_SRGB8_ETC2,
\r
104 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
\r
105 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
\r
106 GL_COMPRESSED_RGBA8_ETC2_EAC,
\r
107 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
\r
111 const GLint NUM_COMPRESSED_TEXTURE_FORMATS = sizeof(compressedTextureFormats) / sizeof(compressedTextureFormats[0]);
\r
113 const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
\r
114 const float ALIASED_LINE_WIDTH_RANGE_MAX = 1.0f;
\r
115 const float ALIASED_POINT_SIZE_RANGE_MIN = 0.125f;
\r
116 const float ALIASED_POINT_SIZE_RANGE_MAX = 8192.0f;
\r
117 const float MAX_TEXTURE_MAX_ANISOTROPY = 16.0f;
\r
121 QUERY_ANY_SAMPLES_PASSED,
\r
122 QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE,
\r
135 // Helper structure describing a single vertex attribute
\r
136 class VertexAttribute
\r
139 VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mDivisor(0), mPointer(NULL), mArrayEnabled(false)
\r
141 mCurrentValue[0].f = 0.0f;
\r
142 mCurrentValue[1].f = 0.0f;
\r
143 mCurrentValue[2].f = 0.0f;
\r
144 mCurrentValue[3].f = 1.0f;
\r
145 mCurrentValueType = ValueUnion::FloatType;
\r
148 int typeSize() const
\r
152 case GL_BYTE: return mSize * sizeof(GLbyte);
\r
153 case GL_UNSIGNED_BYTE: return mSize * sizeof(GLubyte);
\r
154 case GL_SHORT: return mSize * sizeof(GLshort);
\r
155 case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
\r
156 case GL_FIXED: return mSize * sizeof(GLfixed);
\r
157 case GL_FLOAT: return mSize * sizeof(GLfloat);
\r
158 default: UNREACHABLE(); return mSize * sizeof(GLfloat);
\r
162 GLsizei stride() const
\r
164 return mStride ? mStride : typeSize();
\r
167 inline float getCurrentValue(int i) const
\r
169 switch(mCurrentValueType)
\r
171 case ValueUnion::FloatType: return mCurrentValue[i].f;
\r
172 case ValueUnion::IntType: return static_cast<float>(mCurrentValue[i].i);
\r
173 case ValueUnion::UIntType: return static_cast<float>(mCurrentValue[i].ui);
\r
174 default: UNREACHABLE(); return mCurrentValue[i].f;
\r
178 inline GLint getCurrentValueI(int i) const
\r
180 switch(mCurrentValueType)
\r
182 case ValueUnion::FloatType: return static_cast<GLint>(mCurrentValue[i].f);
\r
183 case ValueUnion::IntType: return mCurrentValue[i].i;
\r
184 case ValueUnion::UIntType: return static_cast<GLint>(mCurrentValue[i].ui);
\r
185 default: UNREACHABLE(); return mCurrentValue[i].i;
\r
189 inline GLuint getCurrentValueUI(int i) const
\r
191 switch(mCurrentValueType)
\r
193 case ValueUnion::FloatType: return static_cast<GLuint>(mCurrentValue[i].f);
\r
194 case ValueUnion::IntType: return static_cast<GLuint>(mCurrentValue[i].i);
\r
195 case ValueUnion::UIntType: return mCurrentValue[i].ui;
\r
196 default: UNREACHABLE(); return mCurrentValue[i].ui;
\r
200 inline void setCurrentValue(const GLfloat *values)
\r
202 mCurrentValue[0].f = values[0];
\r
203 mCurrentValue[1].f = values[1];
\r
204 mCurrentValue[2].f = values[2];
\r
205 mCurrentValue[3].f = values[3];
\r
206 mCurrentValueType = ValueUnion::FloatType;
\r
209 inline void setCurrentValue(const GLint *values)
\r
211 mCurrentValue[0].i = values[0];
\r
212 mCurrentValue[1].i = values[1];
\r
213 mCurrentValue[2].i = values[2];
\r
214 mCurrentValue[3].i = values[3];
\r
215 mCurrentValueType = ValueUnion::IntType;
\r
218 inline void setCurrentValue(const GLuint *values)
\r
220 mCurrentValue[0].ui = values[0];
\r
221 mCurrentValue[1].ui = values[1];
\r
222 mCurrentValue[2].ui = values[2];
\r
223 mCurrentValue[3].ui = values[3];
\r
224 mCurrentValueType = ValueUnion::UIntType;
\r
227 // From glVertexAttribPointer
\r
231 GLsizei mStride; // 0 means natural stride
\r
232 GLuint mDivisor; // From glVertexAttribDivisor
\r
236 const void *mPointer;
\r
240 gl::BindingPointer<Buffer> mBoundBuffer; // Captured when glVertexAttribPointer is called.
\r
242 bool mArrayEnabled; // From glEnable/DisableVertexAttribArray
\r
246 enum Type { FloatType, IntType, UIntType };
\r
252 ValueUnion mCurrentValue[4]; // From glVertexAttrib
\r
253 ValueUnion::Type mCurrentValueType;
\r
256 typedef VertexAttribute VertexAttributeArray[MAX_VERTEX_ATTRIBS];
\r
258 // Helper structure to store all raw state
\r
261 Color colorClearValue;
\r
262 GLclampf depthClearValue;
\r
263 int stencilClearValue;
\r
271 GLenum sourceBlendRGB;
\r
272 GLenum destBlendRGB;
\r
273 GLenum sourceBlendAlpha;
\r
274 GLenum destBlendAlpha;
\r
275 GLenum blendEquationRGB;
\r
276 GLenum blendEquationAlpha;
\r
279 GLenum stencilFunc;
\r
281 GLuint stencilMask;
\r
282 GLenum stencilFail;
\r
283 GLenum stencilPassDepthFail;
\r
284 GLenum stencilPassDepthPass;
\r
285 GLuint stencilWritemask;
\r
286 GLenum stencilBackFunc;
\r
287 GLint stencilBackRef;
\r
288 GLuint stencilBackMask;
\r
289 GLenum stencilBackFail;
\r
290 GLenum stencilBackPassDepthFail;
\r
291 GLenum stencilBackPassDepthPass;
\r
292 GLuint stencilBackWritemask;
\r
293 bool polygonOffsetFill;
\r
294 GLfloat polygonOffsetFactor;
\r
295 GLfloat polygonOffsetUnits;
\r
296 bool sampleAlphaToCoverage;
\r
297 bool sampleCoverage;
\r
298 GLclampf sampleCoverageValue;
\r
299 bool sampleCoverageInvert;
\r
302 bool primitiveRestartFixedIndex;
\r
303 bool rasterizerDiscard;
\r
307 GLenum generateMipmapHint;
\r
308 GLenum fragmentShaderDerivativeHint;
\r
312 GLsizei viewportWidth;
\r
313 GLsizei viewportHeight;
\r
319 GLsizei scissorWidth;
\r
320 GLsizei scissorHeight;
\r
323 bool colorMaskGreen;
\r
324 bool colorMaskBlue;
\r
325 bool colorMaskAlpha;
\r
328 unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0
\r
329 gl::BindingPointer<Buffer> arrayBuffer;
\r
330 gl::BindingPointer<Buffer> copyReadBuffer;
\r
331 gl::BindingPointer<Buffer> copyWriteBuffer;
\r
332 gl::BindingPointer<Buffer> pixelPackBuffer;
\r
333 gl::BindingPointer<Buffer> pixelUnpackBuffer;
\r
334 gl::BindingPointer<Buffer> uniformBuffer;
\r
336 GLuint readFramebuffer;
\r
337 GLuint drawFramebuffer;
\r
338 gl::BindingPointer<Renderbuffer> renderbuffer;
\r
339 GLuint currentProgram;
\r
340 GLuint vertexArray;
\r
341 GLuint transformFeedback;
\r
342 gl::BindingPointer<Sampler> sampler[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
\r
344 VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
\r
345 gl::BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS];
\r
346 gl::BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
\r
348 GLint unpackAlignment;
\r
349 GLint packAlignment;
\r
352 class Context : public egl::Context
\r
355 Context(const egl::Config *config, const Context *shareContext, EGLint clientVersion);
\r
357 virtual void makeCurrent(egl::Surface *surface);
\r
358 virtual EGLint getClientVersion() const;
\r
360 void markAllStateDirty();
\r
362 // State manipulation
\r
363 void setClearColor(float red, float green, float blue, float alpha);
\r
364 void setClearDepth(float depth);
\r
365 void setClearStencil(int stencil);
\r
367 void setCullFace(bool enabled);
\r
368 bool isCullFaceEnabled() const;
\r
369 void setCullMode(GLenum mode);
\r
370 void setFrontFace(GLenum front);
\r
372 void setDepthTest(bool enabled);
\r
373 bool isDepthTestEnabled() const;
\r
374 void setDepthFunc(GLenum depthFunc);
\r
375 void setDepthRange(float zNear, float zFar);
\r
377 void setBlend(bool enabled);
\r
378 bool isBlendEnabled() const;
\r
379 void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
\r
380 void setBlendColor(float red, float green, float blue, float alpha);
\r
381 void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
\r
383 void setStencilTest(bool enabled);
\r
384 bool isStencilTestEnabled() const;
\r
385 void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
\r
386 void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
\r
387 void setStencilWritemask(GLuint stencilWritemask);
\r
388 void setStencilBackWritemask(GLuint stencilBackWritemask);
\r
389 void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
\r
390 void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
\r
392 void setPolygonOffsetFill(bool enabled);
\r
393 bool isPolygonOffsetFillEnabled() const;
\r
394 void setPolygonOffsetParams(GLfloat factor, GLfloat units);
\r
396 void setSampleAlphaToCoverage(bool enabled);
\r
397 bool isSampleAlphaToCoverageEnabled() const;
\r
398 void setSampleCoverage(bool enabled);
\r
399 bool isSampleCoverageEnabled() const;
\r
400 void setSampleCoverageParams(GLclampf value, bool invert);
\r
402 void setDither(bool enabled);
\r
403 bool isDitherEnabled() const;
\r
405 void setPrimitiveRestartFixedIndex(bool enabled);
\r
406 bool isPrimitiveRestartFixedIndexEnabled() const;
\r
408 void setRasterizerDiscard(bool enabled);
\r
409 bool isRasterizerDiscardEnabled() const;
\r
411 void setLineWidth(GLfloat width);
\r
413 void setGenerateMipmapHint(GLenum hint);
\r
414 void setFragmentShaderDerivativeHint(GLenum hint);
\r
416 void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
\r
418 void setScissorTest(bool enabled);
\r
419 bool isScissorTestEnabled() const;
\r
420 void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
\r
422 void setColorMask(bool red, bool green, bool blue, bool alpha);
\r
423 void setDepthMask(bool mask);
\r
425 void setActiveSampler(unsigned int active);
\r
427 GLuint getReadFramebufferName() const;
\r
428 GLuint getDrawFramebufferName() const;
\r
429 GLuint getRenderbufferName() const;
\r
431 GLuint getActiveQuery(GLenum target) const;
\r
433 GLuint getArrayBufferName() const;
\r
435 void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
\r
436 void setVertexAttribDivisor(unsigned int attribNum, GLuint divisor);
\r
437 const VertexAttribute &getVertexAttribState(unsigned int attribNum) const;
\r
438 void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
\r
439 bool normalized, GLsizei stride, const void *pointer);
\r
440 const void *getVertexAttribPointer(unsigned int attribNum) const;
\r
442 const VertexAttributeArray &getVertexArrayAttributes();
\r
443 // Context attribute current values can be queried independently from VAO current values
\r
444 const VertexAttributeArray &getCurrentVertexAttributes();
\r
446 void setUnpackAlignment(GLint alignment);
\r
447 GLint getUnpackAlignment() const;
\r
449 void setPackAlignment(GLint alignment);
\r
450 GLint getPackAlignment() const;
\r
452 // These create and destroy methods are merely pass-throughs to
\r
453 // ResourceManager, which owns these object types
\r
454 GLuint createBuffer();
\r
455 GLuint createShader(GLenum type);
\r
456 GLuint createProgram();
\r
457 GLuint createTexture();
\r
458 GLuint createRenderbuffer();
\r
460 void deleteBuffer(GLuint buffer);
\r
461 void deleteShader(GLuint shader);
\r
462 void deleteProgram(GLuint program);
\r
463 void deleteTexture(GLuint texture);
\r
464 void deleteRenderbuffer(GLuint renderbuffer);
\r
466 // Framebuffers are owned by the Context, so these methods do not pass through
\r
467 GLuint createFramebuffer();
\r
468 void deleteFramebuffer(GLuint framebuffer);
\r
470 // Fences are owned by the Context
\r
471 GLuint createFence();
\r
472 void deleteFence(GLuint fence);
\r
474 // Queries are owned by the Context
\r
475 GLuint createQuery();
\r
476 void deleteQuery(GLuint query);
\r
478 // Vertex arrays are owned by the Context
\r
479 GLuint createVertexArray();
\r
480 void deleteVertexArray(GLuint array);
\r
482 // Transform feedbacks are owned by the Context
\r
483 GLuint createTransformFeedback();
\r
484 void deleteTransformFeedback(GLuint transformFeedback);
\r
486 // Samplers are owned by the Context
\r
487 GLuint createSampler();
\r
488 void deleteSampler(GLuint sampler);
\r
490 void bindArrayBuffer(GLuint buffer);
\r
491 void bindElementArrayBuffer(GLuint buffer);
\r
492 void bindCopyReadBuffer(GLuint buffer);
\r
493 void bindCopyWriteBuffer(GLuint buffer);
\r
494 void bindPixelPackBuffer(GLuint buffer);
\r
495 void bindPixelUnpackBuffer(GLuint buffer);
\r
496 void bindTransformFeedbackBuffer(GLuint buffer);
\r
497 void bindUniformBuffer(GLuint buffer);
\r
498 void bindTexture2D(GLuint texture);
\r
499 void bindTextureCubeMap(GLuint texture);
\r
500 void bindTextureExternal(GLuint texture);
\r
501 void bindTexture3D(GLuint texture);
\r
502 void bindReadFramebuffer(GLuint framebuffer);
\r
503 void bindDrawFramebuffer(GLuint framebuffer);
\r
504 void bindRenderbuffer(GLuint renderbuffer);
\r
505 bool bindVertexArray(GLuint array);
\r
506 bool bindTransformFeedback(GLuint transformFeedback);
\r
507 bool bindSampler(GLuint unit, GLuint sampler);
\r
508 void useProgram(GLuint program);
\r
510 void beginQuery(GLenum target, GLuint query);
\r
511 void endQuery(GLenum target);
\r
513 void setFramebufferZero(Framebuffer *framebuffer);
\r
515 void setRenderbufferStorage(RenderbufferStorage *renderbuffer);
\r
517 void setVertexAttrib(GLuint index, const GLfloat *values);
\r
518 void setVertexAttrib(GLuint index, const GLint *values);
\r
519 void setVertexAttrib(GLuint index, const GLuint *values);
\r
521 Buffer *getBuffer(GLuint handle) const;
\r
522 Fence *getFence(GLuint handle) const;
\r
523 Shader *getShader(GLuint handle) const;
\r
524 Program *getProgram(GLuint handle) const;
\r
525 virtual Texture *getTexture(GLuint handle) const;
\r
526 Framebuffer *getFramebuffer(GLuint handle) const;
\r
527 virtual Renderbuffer *getRenderbuffer(GLuint handle) const;
\r
528 Query *getQuery(GLuint handle) const;
\r
529 VertexArray *getVertexArray(GLuint array) const;
\r
530 VertexArray *getCurrentVertexArray() const;
\r
531 TransformFeedback *getTransformFeedback(GLuint transformFeedback) const;
\r
532 TransformFeedback *getTransformFeedback() const;
\r
533 Sampler *getSampler(GLuint sampler) const;
\r
535 Buffer *getArrayBuffer() const;
\r
536 Buffer *getElementArrayBuffer() const;
\r
537 Buffer *getCopyReadBuffer() const;
\r
538 Buffer *getCopyWriteBuffer() const;
\r
539 Buffer *getPixelPackBuffer() const;
\r
540 Buffer *getPixelUnpackBuffer() const;
\r
541 Buffer *getUniformBuffer() const;
\r
542 bool getBuffer(GLenum target, es2::Buffer **buffer) const;
\r
543 Program *getCurrentProgram() const;
\r
544 Texture2D *getTexture2D() const;
\r
545 Texture3D *getTexture3D() const;
\r
546 TextureCubeMap *getTextureCubeMap() const;
\r
547 TextureExternal *getTextureExternal() const;
\r
548 Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
\r
549 Framebuffer *getReadFramebuffer() const;
\r
550 Framebuffer *getDrawFramebuffer() const;
\r
552 bool getFloatv(GLenum pname, GLfloat *params) const;
\r
553 bool getIntegerv(GLenum pname, GLint *params) const;
\r
554 bool getBooleanv(GLenum pname, GLboolean *params) const;
\r
555 bool getTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param) const;
\r
557 bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) const;
\r
559 bool hasZeroDivisor() const;
\r
561 void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
\r
562 void clear(GLbitfield mask);
\r
563 void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount = 1);
\r
564 void drawElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount = 1);
\r
568 void recordInvalidEnum();
\r
569 void recordInvalidValue();
\r
570 void recordInvalidOperation();
\r
571 void recordOutOfMemory();
\r
572 void recordInvalidFramebufferOperation();
\r
576 static int getSupportedMultiSampleDepth(sw::Format format, int requested);
\r
578 void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
\r
579 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
\r
582 virtual void bindTexImage(egl::Surface *surface);
\r
583 virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
\r
584 virtual egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
\r
586 Device *getDevice();
\r
588 const GLubyte* getExtensions(GLuint index, GLuint* numExt = nullptr) const;
\r
591 virtual ~Context();
\r
593 bool applyRenderTarget();
\r
594 void applyState(GLenum drawMode);
\r
595 GLenum applyVertexBuffer(GLint base, GLint first, GLsizei count, GLsizei instanceId);
\r
596 GLenum applyIndexBuffer(const void *indices, GLuint start, GLuint end, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
\r
597 void applyShaders();
\r
598 void applyTextures();
\r
599 void applyTextures(sw::SamplerType type);
\r
600 void applyTexture(sw::SamplerType type, int sampler, Texture *texture);
\r
602 void detachBuffer(GLuint buffer);
\r
603 void detachTexture(GLuint texture);
\r
604 void detachFramebuffer(GLuint framebuffer);
\r
605 void detachRenderbuffer(GLuint renderbuffer);
\r
607 bool cullSkipsDraw(GLenum drawMode);
\r
608 bool isTriangleMode(GLenum drawMode);
\r
610 Query *createQuery(GLuint handle, GLenum type);
\r
612 const EGLint clientVersion;
\r
613 const egl::Config *const mConfig;
\r
617 gl::BindingPointer<Texture2D> mTexture2DZero;
\r
618 gl::BindingPointer<Texture3D> mTexture3DZero;
\r
619 gl::BindingPointer<TextureCubeMap> mTextureCubeMapZero;
\r
620 gl::BindingPointer<TextureExternal> mTextureExternalZero;
\r
622 typedef std::map<GLint, Framebuffer*> FramebufferMap;
\r
623 FramebufferMap mFramebufferMap;
\r
624 gl::NameSpace mFramebufferNameSpace;
\r
626 typedef std::map<GLint, Fence*> FenceMap;
\r
627 FenceMap mFenceMap;
\r
628 gl::NameSpace mFenceNameSpace;
\r
630 typedef std::map<GLint, Query*> QueryMap;
\r
631 QueryMap mQueryMap;
\r
632 gl::NameSpace mQueryNameSpace;
\r
634 typedef std::map<GLint, VertexArray*> VertexArrayMap;
\r
635 VertexArrayMap mVertexArrayMap;
\r
636 gl::NameSpace mVertexArrayNameSpace;
\r
638 typedef std::map<GLint, TransformFeedback*> TransformFeedbackMap;
\r
639 TransformFeedbackMap mTransformFeedbackMap;
\r
640 gl::NameSpace mTransformFeedbackNameSpace;
\r
642 typedef std::map<GLint, Sampler*> SamplerMap;
\r
643 SamplerMap mSamplerMap;
\r
644 gl::NameSpace mSamplerNameSpace;
\r
646 VertexDataManager *mVertexDataManager;
\r
647 IndexDataManager *mIndexDataManager;
\r
651 bool mInvalidValue;
\r
652 bool mInvalidOperation;
\r
654 bool mInvalidFramebufferOperation;
\r
656 bool mHasBeenCurrent;
\r
658 unsigned int mAppliedProgramSerial;
\r
660 // state caching flags
\r
661 bool mDepthStateDirty;
\r
662 bool mMaskStateDirty;
\r
663 bool mPixelPackingStateDirty;
\r
664 bool mBlendStateDirty;
\r
665 bool mStencilStateDirty;
\r
666 bool mPolygonOffsetStateDirty;
\r
667 bool mSampleStateDirty;
\r
668 bool mFrontFaceDirty;
\r
669 bool mDitherStateDirty;
\r
672 ResourceManager *mResourceManager;
\r
676 #endif // INCLUDE_CONTEXT_H_
\r