1 // 2 // Copyright (c) 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 // State.h: Defines the State class, encapsulating raw GL state 8 9 #ifndef LIBANGLE_STATE_H_ 10 #define LIBANGLE_STATE_H_ 11 12 #include <bitset> 13 #include <memory> 14 15 #include "common/Color.h" 16 #include "common/angleutils.h" 17 #include "common/bitset_utils.h" 18 #include "libANGLE/Debug.h" 19 #include "libANGLE/Program.h" 20 #include "libANGLE/ProgramPipeline.h" 21 #include "libANGLE/RefCountObject.h" 22 #include "libANGLE/Renderbuffer.h" 23 #include "libANGLE/Sampler.h" 24 #include "libANGLE/Texture.h" 25 #include "libANGLE/TransformFeedback.h" 26 #include "libANGLE/Version.h" 27 #include "libANGLE/VertexAttribute.h" 28 #include "libANGLE/angletypes.h" 29 30 namespace gl 31 { 32 class Query; 33 class VertexArray; 34 class Context; 35 struct Caps; 36 37 class State : public OnAttachmentDirtyReceiver, angle::NonCopyable 38 { 39 public: 40 State(); 41 ~State() override; 42 43 void initialize(const Context *context, 44 bool debug, 45 bool bindGeneratesResource, 46 bool clientArraysEnabled, 47 bool robustResourceInit, 48 bool programBinaryCacheEnabled); 49 void reset(const Context *context); 50 51 // State chunk getters 52 const RasterizerState &getRasterizerState() const; 53 const BlendState &getBlendState() const; 54 const DepthStencilState &getDepthStencilState() const; 55 56 // Clear behavior setters & state parameter block generation function 57 void setColorClearValue(float red, float green, float blue, float alpha); 58 void setDepthClearValue(float depth); 59 void setStencilClearValue(int stencil); 60 getColorClearValue()61 const ColorF &getColorClearValue() const { return mColorClearValue; } getDepthClearValue()62 float getDepthClearValue() const { return mDepthClearValue; } getStencilClearValue()63 int getStencilClearValue() const { return mStencilClearValue; } 64 65 // Write mask manipulation 66 void setColorMask(bool red, bool green, bool blue, bool alpha); 67 void setDepthMask(bool mask); 68 69 // Discard toggle & query 70 bool isRasterizerDiscardEnabled() const; 71 void setRasterizerDiscard(bool enabled); 72 73 // Primitive restart 74 bool isPrimitiveRestartEnabled() const; 75 void setPrimitiveRestart(bool enabled); 76 77 // Face culling state manipulation 78 bool isCullFaceEnabled() const; 79 void setCullFace(bool enabled); 80 void setCullMode(CullFaceMode mode); 81 void setFrontFace(GLenum front); 82 83 // Depth test state manipulation 84 bool isDepthTestEnabled() const; 85 void setDepthTest(bool enabled); 86 void setDepthFunc(GLenum depthFunc); 87 void setDepthRange(float zNear, float zFar); 88 float getNearPlane() const; 89 float getFarPlane() const; 90 91 // Blend state manipulation 92 bool isBlendEnabled() const; 93 void setBlend(bool enabled); 94 void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha); 95 void setBlendColor(float red, float green, float blue, float alpha); 96 void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation); 97 const ColorF &getBlendColor() const; 98 99 // Stencil state maniupulation 100 bool isStencilTestEnabled() const; 101 void setStencilTest(bool enabled); 102 void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask); 103 void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask); 104 void setStencilWritemask(GLuint stencilWritemask); 105 void setStencilBackWritemask(GLuint stencilBackWritemask); 106 void setStencilOperations(GLenum stencilFail, 107 GLenum stencilPassDepthFail, 108 GLenum stencilPassDepthPass); 109 void setStencilBackOperations(GLenum stencilBackFail, 110 GLenum stencilBackPassDepthFail, 111 GLenum stencilBackPassDepthPass); 112 GLint getStencilRef() const; 113 GLint getStencilBackRef() const; 114 115 // Depth bias/polygon offset state manipulation 116 bool isPolygonOffsetFillEnabled() const; 117 void setPolygonOffsetFill(bool enabled); 118 void setPolygonOffsetParams(GLfloat factor, GLfloat units); 119 120 // Multisample coverage state manipulation 121 bool isSampleAlphaToCoverageEnabled() const; 122 void setSampleAlphaToCoverage(bool enabled); 123 bool isSampleCoverageEnabled() const; 124 void setSampleCoverage(bool enabled); 125 void setSampleCoverageParams(GLclampf value, bool invert); 126 GLfloat getSampleCoverageValue() const; 127 bool getSampleCoverageInvert() const; 128 129 // Multisample mask state manipulation. 130 bool isSampleMaskEnabled() const; 131 void setSampleMaskEnabled(bool enabled); 132 void setSampleMaskParams(GLuint maskNumber, GLbitfield mask); 133 GLbitfield getSampleMaskWord(GLuint maskNumber) const; 134 GLuint getMaxSampleMaskWords() const; 135 136 // Multisampling/alpha to one manipulation. 137 void setSampleAlphaToOne(bool enabled); 138 bool isSampleAlphaToOneEnabled() const; 139 void setMultisampling(bool enabled); 140 bool isMultisamplingEnabled() const; 141 142 // Scissor test state toggle & query 143 bool isScissorTestEnabled() const; 144 void setScissorTest(bool enabled); 145 void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height); 146 const Rectangle &getScissor() const; 147 148 // Dither state toggle & query 149 bool isDitherEnabled() const; 150 void setDither(bool enabled); 151 152 // Generic state toggle & query 153 void setEnableFeature(GLenum feature, bool enabled); 154 bool getEnableFeature(GLenum feature) const; 155 156 // Line width state setter 157 void setLineWidth(GLfloat width); 158 float getLineWidth() const; 159 160 // Hint setters 161 void setGenerateMipmapHint(GLenum hint); 162 void setFragmentShaderDerivativeHint(GLenum hint); 163 164 // GL_CHROMIUM_bind_generates_resource 165 bool isBindGeneratesResourceEnabled() const; 166 167 // GL_ANGLE_client_arrays 168 bool areClientArraysEnabled() const; 169 170 // Viewport state setter/getter 171 void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height); 172 const Rectangle &getViewport() const; 173 174 // Texture binding & active texture unit manipulation 175 void setActiveSampler(unsigned int active); 176 unsigned int getActiveSampler() const; 177 void setSamplerTexture(const Context *context, GLenum type, Texture *texture); 178 Texture *getTargetTexture(GLenum target) const; 179 Texture *getSamplerTexture(unsigned int sampler, GLenum type) const; 180 GLuint getSamplerTextureId(unsigned int sampler, GLenum type) const; 181 void detachTexture(const Context *context, const TextureMap &zeroTextures, GLuint texture); 182 void initializeZeroTextures(const Context *context, const TextureMap &zeroTextures); 183 184 // Sampler object binding manipulation 185 void setSamplerBinding(const Context *context, GLuint textureUnit, Sampler *sampler); 186 GLuint getSamplerId(GLuint textureUnit) const; 187 Sampler *getSampler(GLuint textureUnit) const; 188 void detachSampler(const Context *context, GLuint sampler); 189 190 // Renderbuffer binding manipulation 191 void setRenderbufferBinding(const Context *context, Renderbuffer *renderbuffer); 192 GLuint getRenderbufferId() const; 193 Renderbuffer *getCurrentRenderbuffer() const; 194 void detachRenderbuffer(const Context *context, GLuint renderbuffer); 195 196 // Framebuffer binding manipulation 197 void setReadFramebufferBinding(Framebuffer *framebuffer); 198 void setDrawFramebufferBinding(Framebuffer *framebuffer); 199 Framebuffer *getTargetFramebuffer(GLenum target) const; 200 Framebuffer *getReadFramebuffer() const; 201 Framebuffer *getDrawFramebuffer() const; 202 bool removeReadFramebufferBinding(GLuint framebuffer); 203 bool removeDrawFramebufferBinding(GLuint framebuffer); 204 205 // Vertex array object binding manipulation 206 void setVertexArrayBinding(VertexArray *vertexArray); 207 GLuint getVertexArrayId() const; 208 VertexArray *getVertexArray() const; 209 bool removeVertexArrayBinding(GLuint vertexArray); 210 211 // Program binding manipulation 212 void setProgram(const Context *context, Program *newProgram); 213 Program *getProgram() const; 214 215 // Transform feedback object (not buffer) binding manipulation 216 void setTransformFeedbackBinding(const Context *context, TransformFeedback *transformFeedback); 217 TransformFeedback *getCurrentTransformFeedback() const; 218 bool isTransformFeedbackActiveUnpaused() const; 219 bool removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback); 220 221 // Query binding manipulation 222 bool isQueryActive(const GLenum type) const; 223 bool isQueryActive(Query *query) const; 224 void setActiveQuery(const Context *context, GLenum target, Query *query); 225 GLuint getActiveQueryId(GLenum target) const; 226 Query *getActiveQuery(GLenum target) const; 227 228 // Program Pipeline binding manipulation 229 void setProgramPipelineBinding(const Context *context, ProgramPipeline *pipeline); 230 void detachProgramPipeline(const Context *context, GLuint pipeline); 231 232 //// Typed buffer binding point manipulation //// 233 void setBufferBinding(const Context *context, BufferBinding target, Buffer *buffer); 234 Buffer *getTargetBuffer(BufferBinding target) const; 235 void setIndexedBufferBinding(const Context *context, 236 BufferBinding target, 237 GLuint index, 238 Buffer *buffer, 239 GLintptr offset, 240 GLsizeiptr size); 241 242 const OffsetBindingPointer<Buffer> &getIndexedUniformBuffer(size_t index) const; 243 const OffsetBindingPointer<Buffer> &getIndexedAtomicCounterBuffer(size_t index) const; 244 const OffsetBindingPointer<Buffer> &getIndexedShaderStorageBuffer(size_t index) const; 245 246 // Detach a buffer from all bindings 247 void detachBuffer(const Context *context, GLuint bufferName); 248 249 // Vertex attrib manipulation 250 void setEnableVertexAttribArray(unsigned int attribNum, bool enabled); 251 void setElementArrayBuffer(const Context *context, Buffer *buffer); 252 void setVertexAttribf(GLuint index, const GLfloat values[4]); 253 void setVertexAttribu(GLuint index, const GLuint values[4]); 254 void setVertexAttribi(GLuint index, const GLint values[4]); 255 void setVertexAttribPointer(const Context *context, 256 unsigned int attribNum, 257 Buffer *boundBuffer, 258 GLint size, 259 GLenum type, 260 bool normalized, 261 bool pureInteger, 262 GLsizei stride, 263 const void *pointer); 264 void setVertexAttribDivisor(const Context *context, GLuint index, GLuint divisor); 265 const VertexAttribCurrentValueData &getVertexAttribCurrentValue(size_t attribNum) const; 266 const std::vector<VertexAttribCurrentValueData> &getVertexAttribCurrentValues() const; 267 const void *getVertexAttribPointer(unsigned int attribNum) const; 268 void bindVertexBuffer(const Context *context, 269 GLuint bindingIndex, 270 Buffer *boundBuffer, 271 GLintptr offset, 272 GLsizei stride); 273 void setVertexAttribFormat(GLuint attribIndex, 274 GLint size, 275 GLenum type, 276 bool normalized, 277 bool pureInteger, 278 GLuint relativeOffset); 279 void setVertexAttribBinding(const Context *context, GLuint attribIndex, GLuint bindingIndex); 280 void setVertexBindingDivisor(GLuint bindingIndex, GLuint divisor); 281 282 // Pixel pack state manipulation 283 void setPackAlignment(GLint alignment); 284 GLint getPackAlignment() const; 285 void setPackReverseRowOrder(bool reverseRowOrder); 286 bool getPackReverseRowOrder() const; 287 void setPackRowLength(GLint rowLength); 288 GLint getPackRowLength() const; 289 void setPackSkipRows(GLint skipRows); 290 GLint getPackSkipRows() const; 291 void setPackSkipPixels(GLint skipPixels); 292 GLint getPackSkipPixels() const; 293 const PixelPackState &getPackState() const; 294 PixelPackState &getPackState(); 295 296 // Pixel unpack state manipulation 297 void setUnpackAlignment(GLint alignment); 298 GLint getUnpackAlignment() const; 299 void setUnpackRowLength(GLint rowLength); 300 GLint getUnpackRowLength() const; 301 void setUnpackImageHeight(GLint imageHeight); 302 GLint getUnpackImageHeight() const; 303 void setUnpackSkipImages(GLint skipImages); 304 GLint getUnpackSkipImages() const; 305 void setUnpackSkipRows(GLint skipRows); 306 GLint getUnpackSkipRows() const; 307 void setUnpackSkipPixels(GLint skipPixels); 308 GLint getUnpackSkipPixels() const; 309 const PixelUnpackState &getUnpackState() const; 310 PixelUnpackState &getUnpackState(); 311 312 // Debug state 313 const Debug &getDebug() const; 314 Debug &getDebug(); 315 316 // CHROMIUM_framebuffer_mixed_samples coverage modulation 317 void setCoverageModulation(GLenum components); 318 GLenum getCoverageModulation() const; 319 320 // CHROMIUM_path_rendering 321 void loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix); 322 const GLfloat *getPathRenderingMatrix(GLenum which) const; 323 void setPathStencilFunc(GLenum func, GLint ref, GLuint mask); 324 325 GLenum getPathStencilFunc() const; 326 GLint getPathStencilRef() const; 327 GLuint getPathStencilMask() const; 328 329 // GL_EXT_sRGB_write_control 330 void setFramebufferSRGB(bool sRGB); 331 bool getFramebufferSRGB() const; 332 333 // State query functions 334 void getBooleanv(GLenum pname, GLboolean *params); 335 void getFloatv(GLenum pname, GLfloat *params); 336 void getIntegerv(const Context *context, GLenum pname, GLint *params); 337 void getPointerv(GLenum pname, void **params) const; 338 void getIntegeri_v(GLenum target, GLuint index, GLint *data); 339 void getInteger64i_v(GLenum target, GLuint index, GLint64 *data); 340 void getBooleani_v(GLenum target, GLuint index, GLboolean *data); 341 342 bool hasMappedBuffer(BufferBinding target) const; isRobustResourceInitEnabled()343 bool isRobustResourceInitEnabled() const { return mRobustResourceInit; } 344 345 // Sets the dirty bit for the program executable. 346 void onProgramExecutableChange(Program *program); 347 348 enum DirtyBitType 349 { 350 DIRTY_BIT_SCISSOR_TEST_ENABLED, 351 DIRTY_BIT_SCISSOR, 352 DIRTY_BIT_VIEWPORT, 353 DIRTY_BIT_DEPTH_RANGE, 354 DIRTY_BIT_BLEND_ENABLED, 355 DIRTY_BIT_BLEND_COLOR, 356 DIRTY_BIT_BLEND_FUNCS, 357 DIRTY_BIT_BLEND_EQUATIONS, 358 DIRTY_BIT_COLOR_MASK, 359 DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED, 360 DIRTY_BIT_SAMPLE_COVERAGE_ENABLED, 361 DIRTY_BIT_SAMPLE_COVERAGE, 362 DIRTY_BIT_SAMPLE_MASK_ENABLED, 363 DIRTY_BIT_SAMPLE_MASK, 364 DIRTY_BIT_DEPTH_TEST_ENABLED, 365 DIRTY_BIT_DEPTH_FUNC, 366 DIRTY_BIT_DEPTH_MASK, 367 DIRTY_BIT_STENCIL_TEST_ENABLED, 368 DIRTY_BIT_STENCIL_FUNCS_FRONT, 369 DIRTY_BIT_STENCIL_FUNCS_BACK, 370 DIRTY_BIT_STENCIL_OPS_FRONT, 371 DIRTY_BIT_STENCIL_OPS_BACK, 372 DIRTY_BIT_STENCIL_WRITEMASK_FRONT, 373 DIRTY_BIT_STENCIL_WRITEMASK_BACK, 374 DIRTY_BIT_CULL_FACE_ENABLED, 375 DIRTY_BIT_CULL_FACE, 376 DIRTY_BIT_FRONT_FACE, 377 DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED, 378 DIRTY_BIT_POLYGON_OFFSET, 379 DIRTY_BIT_RASTERIZER_DISCARD_ENABLED, 380 DIRTY_BIT_LINE_WIDTH, 381 DIRTY_BIT_PRIMITIVE_RESTART_ENABLED, 382 DIRTY_BIT_CLEAR_COLOR, 383 DIRTY_BIT_CLEAR_DEPTH, 384 DIRTY_BIT_CLEAR_STENCIL, 385 DIRTY_BIT_UNPACK_STATE, 386 DIRTY_BIT_UNPACK_BUFFER_BINDING, 387 DIRTY_BIT_PACK_STATE, 388 DIRTY_BIT_PACK_BUFFER_BINDING, 389 DIRTY_BIT_DITHER_ENABLED, 390 DIRTY_BIT_GENERATE_MIPMAP_HINT, 391 DIRTY_BIT_SHADER_DERIVATIVE_HINT, 392 DIRTY_BIT_READ_FRAMEBUFFER_BINDING, 393 DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING, 394 DIRTY_BIT_RENDERBUFFER_BINDING, 395 DIRTY_BIT_VERTEX_ARRAY_BINDING, 396 DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING, 397 DIRTY_BIT_PROGRAM_BINDING, 398 DIRTY_BIT_PROGRAM_EXECUTABLE, 399 // TODO(jmadill): Fine-grained dirty bits for each texture/sampler. 400 DIRTY_BIT_TEXTURE_BINDINGS, 401 DIRTY_BIT_SAMPLER_BINDINGS, 402 DIRTY_BIT_MULTISAMPLING, 403 DIRTY_BIT_SAMPLE_ALPHA_TO_ONE, 404 DIRTY_BIT_COVERAGE_MODULATION, // CHROMIUM_framebuffer_mixed_samples 405 DIRTY_BIT_PATH_RENDERING_MATRIX_MV, // CHROMIUM_path_rendering path model view matrix 406 DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ, // CHROMIUM_path_rendering path projection matrix 407 DIRTY_BIT_PATH_RENDERING_STENCIL_STATE, 408 DIRTY_BIT_FRAMEBUFFER_SRGB, // GL_EXT_sRGB_write_control 409 DIRTY_BIT_CURRENT_VALUES, 410 DIRTY_BIT_INVALID, 411 DIRTY_BIT_MAX = DIRTY_BIT_INVALID, 412 }; 413 414 static_assert(DIRTY_BIT_MAX <= 64, "State dirty bits must be capped at 64"); 415 416 // TODO(jmadill): Consider storing dirty objects in a list instead of by binding. 417 enum DirtyObjectType 418 { 419 DIRTY_OBJECT_READ_FRAMEBUFFER, 420 DIRTY_OBJECT_DRAW_FRAMEBUFFER, 421 DIRTY_OBJECT_VERTEX_ARRAY, 422 // Use a very coarse bit for any program or texture change. 423 // TODO(jmadill): Fine-grained dirty bits for each texture/sampler. 424 DIRTY_OBJECT_PROGRAM_TEXTURES, 425 DIRTY_OBJECT_UNKNOWN, 426 DIRTY_OBJECT_MAX = DIRTY_OBJECT_UNKNOWN, 427 }; 428 429 typedef angle::BitSet<DIRTY_BIT_MAX> DirtyBits; getDirtyBits()430 const DirtyBits &getDirtyBits() const { return mDirtyBits; } clearDirtyBits()431 void clearDirtyBits() { mDirtyBits.reset(); } clearDirtyBits(const DirtyBits & bitset)432 void clearDirtyBits(const DirtyBits &bitset) { mDirtyBits &= ~bitset; } setAllDirtyBits()433 void setAllDirtyBits() { mDirtyBits.set(); } 434 435 typedef angle::BitSet<DIRTY_OBJECT_MAX> DirtyObjects; clearDirtyObjects()436 void clearDirtyObjects() { mDirtyObjects.reset(); } setAllDirtyObjects()437 void setAllDirtyObjects() { mDirtyObjects.set(); } 438 void syncDirtyObjects(const Context *context); 439 void syncDirtyObjects(const Context *context, const DirtyObjects &bitset); 440 void syncDirtyObject(const Context *context, GLenum target); 441 void setObjectDirty(GLenum target); 442 443 // This actually clears the current value dirty bits. 444 // TODO(jmadill): Pass mutable dirty bits into Impl. 445 AttributesMask getAndResetDirtyCurrentValues() const; 446 447 void setImageUnit(const Context *context, 448 GLuint unit, 449 Texture *texture, 450 GLint level, 451 GLboolean layered, 452 GLint layer, 453 GLenum access, 454 GLenum format); 455 456 const ImageUnit &getImageUnit(GLuint unit) const; getCompleteTextureCache()457 const std::vector<Texture *> &getCompleteTextureCache() const { return mCompleteTextureCache; } 458 459 // Handle a dirty texture event. 460 void signal(size_t textureIndex, InitState initState) override; 461 462 Error clearUnclearedActiveTextures(const Context *context); 463 464 private: 465 void syncProgramTextures(const Context *context); 466 467 // Cached values from Context's caps 468 GLuint mMaxDrawBuffers; 469 GLuint mMaxCombinedTextureImageUnits; 470 471 ColorF mColorClearValue; 472 GLfloat mDepthClearValue; 473 int mStencilClearValue; 474 475 RasterizerState mRasterizer; 476 bool mScissorTest; 477 Rectangle mScissor; 478 479 BlendState mBlend; 480 ColorF mBlendColor; 481 bool mSampleCoverage; 482 GLfloat mSampleCoverageValue; 483 bool mSampleCoverageInvert; 484 bool mSampleMask; 485 GLuint mMaxSampleMaskWords; 486 std::array<GLbitfield, MAX_SAMPLE_MASK_WORDS> mSampleMaskValues; 487 488 DepthStencilState mDepthStencil; 489 GLint mStencilRef; 490 GLint mStencilBackRef; 491 492 GLfloat mLineWidth; 493 494 GLenum mGenerateMipmapHint; 495 GLenum mFragmentShaderDerivativeHint; 496 497 bool mBindGeneratesResource; 498 bool mClientArraysEnabled; 499 500 Rectangle mViewport; 501 float mNearZ; 502 float mFarZ; 503 504 Framebuffer *mReadFramebuffer; 505 Framebuffer *mDrawFramebuffer; 506 BindingPointer<Renderbuffer> mRenderbuffer; 507 Program *mProgram; 508 BindingPointer<ProgramPipeline> mProgramPipeline; 509 510 typedef std::vector<VertexAttribCurrentValueData> VertexAttribVector; 511 VertexAttribVector mVertexAttribCurrentValues; // From glVertexAttrib 512 VertexArray *mVertexArray; 513 514 // Texture and sampler bindings 515 size_t mActiveSampler; // Active texture unit selector - GL_TEXTURE0 516 517 typedef std::vector<BindingPointer<Texture>> TextureBindingVector; 518 typedef std::map<GLenum, TextureBindingVector> TextureBindingMap; 519 TextureBindingMap mSamplerTextures; 520 521 // Texture Completeness Caching 522 // ---------------------------- 523 // The texture completeness cache uses dirty bits to avoid having to scan the list 524 // of textures each draw call. This gl::State class implements OnAttachmentDirtyReceiver, 525 // and keeps an array of bindings to the Texture class. When the Textures are marked dirty, 526 // they send messages to the State class (and any Framebuffers they're attached to) via the 527 // State::signal method (see above). Internally this then invalidates the completeness cache. 528 // 529 // Note this requires that we also invalidate the completeness cache manually on events like 530 // re-binding textures/samplers or a change in the program. For more information see the 531 // signal_utils.h header and the design doc linked there. 532 533 // A cache of complete textures. nullptr indicates unbound or incomplete. 534 // Don't use BindingPointer because this cache is only valid within a draw call. 535 // Also stores a notification channel to the texture itself to handle texture change events. 536 std::vector<Texture *> mCompleteTextureCache; 537 std::vector<OnAttachmentDirtyBinding> mCompleteTextureBindings; 538 InitState mCachedTexturesInitState; 539 using ActiveTextureMask = angle::BitSet<IMPLEMENTATION_MAX_ACTIVE_TEXTURES>; 540 ActiveTextureMask mActiveTexturesMask; 541 542 typedef std::vector<BindingPointer<Sampler>> SamplerBindingVector; 543 SamplerBindingVector mSamplers; 544 545 typedef std::vector<ImageUnit> ImageUnitVector; 546 ImageUnitVector mImageUnits; 547 548 typedef std::map<GLenum, BindingPointer<Query>> ActiveQueryMap; 549 ActiveQueryMap mActiveQueries; 550 551 // Stores the currently bound buffer for each binding point. It has entries for the element 552 // array buffer and the transform feedback buffer but these should not be used. Instead these 553 // bind points are respectively owned by current the vertex array object and the current 554 // transform feedback object. 555 using BoundBufferMap = angle::PackedEnumMap<BufferBinding, BindingPointer<Buffer>>; 556 BoundBufferMap mBoundBuffers; 557 558 using BufferVector = std::vector<OffsetBindingPointer<Buffer>>; 559 BufferVector mUniformBuffers; 560 BufferVector mAtomicCounterBuffers; 561 BufferVector mShaderStorageBuffers; 562 563 BindingPointer<TransformFeedback> mTransformFeedback; 564 565 BindingPointer<Buffer> mPixelUnpackBuffer; 566 PixelUnpackState mUnpack; 567 BindingPointer<Buffer> mPixelPackBuffer; 568 PixelPackState mPack; 569 570 bool mPrimitiveRestart; 571 572 Debug mDebug; 573 574 bool mMultiSampling; 575 bool mSampleAlphaToOne; 576 577 GLenum mCoverageModulation; 578 579 // CHROMIUM_path_rendering 580 GLfloat mPathMatrixMV[16]; 581 GLfloat mPathMatrixProj[16]; 582 GLenum mPathStencilFunc; 583 GLint mPathStencilRef; 584 GLuint mPathStencilMask; 585 586 // GL_EXT_sRGB_write_control 587 bool mFramebufferSRGB; 588 589 // GL_ANGLE_robust_resource_intialization 590 bool mRobustResourceInit; 591 592 // GL_ANGLE_program_cache_control 593 bool mProgramBinaryCacheEnabled; 594 595 DirtyBits mDirtyBits; 596 DirtyObjects mDirtyObjects; 597 mutable AttributesMask mDirtyCurrentValues; 598 }; 599 600 } // namespace gl 601 602 #endif // LIBANGLE_STATE_H_ 603