From 774fe563c66393a4f8047eaa2cddb86b455cb3a1 Mon Sep 17 00:00:00 2001 From: Markus Tavenrath Date: Sun, 18 Nov 2018 14:14:49 +0100 Subject: [PATCH] Make all single line getter functions in State class inline functions. Having getter functions in the State class non-inline results in more generated code to call the function than it'd take to just fetch the value from the class. For those cases inline the getter functions to reduce calling overhead and binary size. Bug: angleproject:2973 Change-Id: Iddd14fd836ee89de69cdabfd58b95bcedc7e9e4e Reviewed-on: https://chromium-review.googlesource.com/c/1340220 Commit-Queue: Jamie Madill Reviewed-by: Jamie Madill --- src/libANGLE/State.cpp | 307 +---------------------------------------- src/libANGLE/State.h | 145 ++++++++++--------- 2 files changed, 89 insertions(+), 363 deletions(-) diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp index 466858a58ba1e..bef0e10078f65 100644 --- a/src/libANGLE/State.cpp +++ b/src/libANGLE/State.cpp @@ -549,22 +549,12 @@ void State::setDepthMask(bool mask) mDirtyBits.set(DIRTY_BIT_DEPTH_MASK); } -bool State::isRasterizerDiscardEnabled() const -{ - return mRasterizer.rasterizerDiscard; -} - void State::setRasterizerDiscard(bool enabled) { mRasterizer.rasterizerDiscard = enabled; mDirtyBits.set(DIRTY_BIT_RASTERIZER_DISCARD_ENABLED); } -bool State::isCullFaceEnabled() const -{ - return mRasterizer.cullFace; -} - void State::setCullFace(bool enabled) { mRasterizer.cullFace = enabled; @@ -583,11 +573,6 @@ void State::setFrontFace(GLenum front) mDirtyBits.set(DIRTY_BIT_FRONT_FACE); } -bool State::isDepthTestEnabled() const -{ - return mDepthStencil.depthTest; -} - void State::setDepthTest(bool enabled) { mDepthStencil.depthTest = enabled; @@ -607,21 +592,6 @@ void State::setDepthRange(float zNear, float zFar) mDirtyBits.set(DIRTY_BIT_DEPTH_RANGE); } -float State::getNearPlane() const -{ - return mNearZ; -} - -float State::getFarPlane() const -{ - return mFarZ; -} - -bool State::isBlendEnabled() const -{ - return mBlend.blend; -} - void State::setBlend(bool enabled) { mBlend.blend = enabled; @@ -653,16 +623,6 @@ void State::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation) mDirtyBits.set(DIRTY_BIT_BLEND_EQUATIONS); } -const ColorF &State::getBlendColor() const -{ - return mBlendColor; -} - -bool State::isStencilTestEnabled() const -{ - return mDepthStencil.stencilTest; -} - void State::setStencilTest(bool enabled) { mDepthStencil.stencilTest = enabled; @@ -719,21 +679,6 @@ void State::setStencilBackOperations(GLenum stencilBackFail, mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_BACK); } -GLint State::getStencilRef() const -{ - return mStencilRef; -} - -GLint State::getStencilBackRef() const -{ - return mStencilBackRef; -} - -bool State::isPolygonOffsetFillEnabled() const -{ - return mRasterizer.polygonOffsetFill; -} - void State::setPolygonOffsetFill(bool enabled) { mRasterizer.polygonOffsetFill = enabled; @@ -748,22 +693,12 @@ void State::setPolygonOffsetParams(GLfloat factor, GLfloat units) mDirtyBits.set(DIRTY_BIT_POLYGON_OFFSET); } -bool State::isSampleAlphaToCoverageEnabled() const -{ - return mBlend.sampleAlphaToCoverage; -} - void State::setSampleAlphaToCoverage(bool enabled) { mBlend.sampleAlphaToCoverage = enabled; mDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED); } -bool State::isSampleCoverageEnabled() const -{ - return mSampleCoverage; -} - void State::setSampleCoverage(bool enabled) { mSampleCoverage = enabled; @@ -777,21 +712,6 @@ void State::setSampleCoverageParams(GLclampf value, bool invert) mDirtyBits.set(DIRTY_BIT_SAMPLE_COVERAGE); } -GLclampf State::getSampleCoverageValue() const -{ - return mSampleCoverageValue; -} - -bool State::getSampleCoverageInvert() const -{ - return mSampleCoverageInvert; -} - -bool State::isSampleMaskEnabled() const -{ - return mSampleMask; -} - void State::setSampleMaskEnabled(bool enabled) { mSampleMask = enabled; @@ -806,44 +726,18 @@ void State::setSampleMaskParams(GLuint maskNumber, GLbitfield mask) mDirtyBits.set(DIRTY_BIT_SAMPLE_MASK); } -GLbitfield State::getSampleMaskWord(GLuint maskNumber) const -{ - ASSERT(maskNumber < mMaxSampleMaskWords); - return mSampleMaskValues[maskNumber]; -} - -GLuint State::getMaxSampleMaskWords() const -{ - return mMaxSampleMaskWords; -} - void State::setSampleAlphaToOne(bool enabled) { mSampleAlphaToOne = enabled; mDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_ONE); } -bool State::isSampleAlphaToOneEnabled() const -{ - return mSampleAlphaToOne; -} - void State::setMultisampling(bool enabled) { mMultiSampling = enabled; mDirtyBits.set(DIRTY_BIT_MULTISAMPLING); } -bool State::isMultisamplingEnabled() const -{ - return mMultiSampling; -} - -bool State::isScissorTestEnabled() const -{ - return mScissorTest; -} - void State::setScissorTest(bool enabled) { mScissorTest = enabled; @@ -859,27 +753,12 @@ void State::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height) mDirtyBits.set(DIRTY_BIT_SCISSOR); } -const Rectangle &State::getScissor() const -{ - return mScissor; -} - -bool State::isDitherEnabled() const -{ - return mBlend.dither; -} - void State::setDither(bool enabled) { mBlend.dither = enabled; mDirtyBits.set(DIRTY_BIT_DITHER_ENABLED); } -bool State::isPrimitiveRestartEnabled() const -{ - return mPrimitiveRestart; -} - void State::setPrimitiveRestart(bool enabled) { mPrimitiveRestart = enabled; @@ -1112,11 +991,6 @@ void State::setLineWidth(GLfloat width) mDirtyBits.set(DIRTY_BIT_LINE_WIDTH); } -float State::getLineWidth() const -{ - return mLineWidth; -} - void State::setGenerateMipmapHint(GLenum hint) { mGenerateMipmapHint = hint; @@ -1132,11 +1006,6 @@ void State::setFragmentShaderDerivativeHint(GLenum hint) // Ignore for now. It is valid for implementations to ignore hint. } -bool State::areClientArraysEnabled() const -{ - return mClientArraysEnabled; -} - void State::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height) { mViewport.x = x; @@ -1146,21 +1015,11 @@ void State::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height) mDirtyBits.set(DIRTY_BIT_VIEWPORT); } -const Rectangle &State::getViewport() const -{ - return mViewport; -} - void State::setActiveSampler(unsigned int active) { mActiveSampler = active; } -unsigned int State::getActiveSampler() const -{ - return static_cast(mActiveSampler); -} - angle::Result State::setSamplerTexture(const Context *context, TextureType type, Texture *texture) { mSamplerTextures[type][mActiveSampler].set(context, texture); @@ -1264,12 +1123,6 @@ void State::setSamplerBinding(const Context *context, GLuint textureUnit, Sample setSamplerDirty(textureUnit); } -GLuint State::getSamplerId(GLuint textureUnit) const -{ - ASSERT(textureUnit < mSamplers.size()); - return mSamplers[textureUnit].id(); -} - void State::detachSampler(const Context *context, GLuint sampler) { // [OpenGL ES 3.0.2] section 3.8.2 pages 123-124: @@ -1292,15 +1145,6 @@ void State::setRenderbufferBinding(const Context *context, Renderbuffer *renderb mDirtyBits.set(DIRTY_BIT_RENDERBUFFER_BINDING); } -GLuint State::getRenderbufferId() const -{ - return mRenderbuffer.id(); -} - -Renderbuffer *State::getCurrentRenderbuffer() const -{ - return mRenderbuffer.get(); -} void State::detachRenderbuffer(const Context *context, GLuint renderbuffer) { @@ -1379,11 +1223,6 @@ Framebuffer *State::getTargetFramebuffer(GLenum target) const } } -Framebuffer *State::getReadFramebuffer() const -{ - return mReadFramebuffer; -} - bool State::removeReadFramebufferBinding(GLuint framebuffer) { if (mReadFramebuffer != nullptr && mReadFramebuffer->id() == framebuffer) @@ -1423,12 +1262,6 @@ void State::setVertexArrayBinding(const Context *context, VertexArray *vertexArr } } -GLuint State::getVertexArrayId() const -{ - ASSERT(mVertexArray != nullptr); - return mVertexArray->id(); -} - bool State::removeVertexArrayBinding(const Context *context, GLuint vertexArray) { if (mVertexArray && mVertexArray->id() == vertexArray) @@ -1443,6 +1276,12 @@ bool State::removeVertexArrayBinding(const Context *context, GLuint vertexArray) return false; } +GLuint State::getVertexArrayId() const +{ + ASSERT(mVertexArray != nullptr); + return mVertexArray->id(); +} + void State::bindVertexBuffer(const Context *context, GLuint bindingIndex, Buffer *boundBuffer, @@ -1751,17 +1590,6 @@ void State::setVertexAttribDivisor(const Context *context, GLuint index, GLuint mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY); } -const VertexAttribCurrentValueData &State::getVertexAttribCurrentValue(size_t attribNum) const -{ - ASSERT(attribNum < mVertexAttribCurrentValues.size()); - return mVertexAttribCurrentValues[attribNum]; -} - -const std::vector &State::getVertexAttribCurrentValues() const -{ - return mVertexAttribCurrentValues; -} - const void *State::getVertexAttribPointer(unsigned int attribNum) const { return getVertexArray()->getVertexAttribute(attribNum).pointer; @@ -1773,150 +1601,66 @@ void State::setPackAlignment(GLint alignment) mDirtyBits.set(DIRTY_BIT_PACK_STATE); } -GLint State::getPackAlignment() const -{ - return mPack.alignment; -} - void State::setPackReverseRowOrder(bool reverseRowOrder) { mPack.reverseRowOrder = reverseRowOrder; mDirtyBits.set(DIRTY_BIT_PACK_STATE); } -bool State::getPackReverseRowOrder() const -{ - return mPack.reverseRowOrder; -} - void State::setPackRowLength(GLint rowLength) { mPack.rowLength = rowLength; mDirtyBits.set(DIRTY_BIT_PACK_STATE); } -GLint State::getPackRowLength() const -{ - return mPack.rowLength; -} - void State::setPackSkipRows(GLint skipRows) { mPack.skipRows = skipRows; mDirtyBits.set(DIRTY_BIT_PACK_STATE); } -GLint State::getPackSkipRows() const -{ - return mPack.skipRows; -} - void State::setPackSkipPixels(GLint skipPixels) { mPack.skipPixels = skipPixels; mDirtyBits.set(DIRTY_BIT_PACK_STATE); } -GLint State::getPackSkipPixels() const -{ - return mPack.skipPixels; -} - -const PixelPackState &State::getPackState() const -{ - return mPack; -} - -PixelPackState &State::getPackState() -{ - return mPack; -} - void State::setUnpackAlignment(GLint alignment) { mUnpack.alignment = alignment; mDirtyBits.set(DIRTY_BIT_UNPACK_STATE); } -GLint State::getUnpackAlignment() const -{ - return mUnpack.alignment; -} - void State::setUnpackRowLength(GLint rowLength) { mUnpack.rowLength = rowLength; mDirtyBits.set(DIRTY_BIT_UNPACK_STATE); } -GLint State::getUnpackRowLength() const -{ - return mUnpack.rowLength; -} - void State::setUnpackImageHeight(GLint imageHeight) { mUnpack.imageHeight = imageHeight; mDirtyBits.set(DIRTY_BIT_UNPACK_STATE); } -GLint State::getUnpackImageHeight() const -{ - return mUnpack.imageHeight; -} - void State::setUnpackSkipImages(GLint skipImages) { mUnpack.skipImages = skipImages; mDirtyBits.set(DIRTY_BIT_UNPACK_STATE); } -GLint State::getUnpackSkipImages() const -{ - return mUnpack.skipImages; -} - void State::setUnpackSkipRows(GLint skipRows) { mUnpack.skipRows = skipRows; mDirtyBits.set(DIRTY_BIT_UNPACK_STATE); } -GLint State::getUnpackSkipRows() const -{ - return mUnpack.skipRows; -} - void State::setUnpackSkipPixels(GLint skipPixels) { mUnpack.skipPixels = skipPixels; mDirtyBits.set(DIRTY_BIT_UNPACK_STATE); } -GLint State::getUnpackSkipPixels() const -{ - return mUnpack.skipPixels; -} - -const PixelUnpackState &State::getUnpackState() const -{ - return mUnpack; -} - -PixelUnpackState &State::getUnpackState() -{ - return mUnpack; -} - -const Debug &State::getDebug() const -{ - return mDebug; -} - -Debug &State::getDebug() -{ - return mDebug; -} void State::setCoverageModulation(GLenum components) { @@ -1924,11 +1668,6 @@ void State::setCoverageModulation(GLenum components) mDirtyBits.set(DIRTY_BIT_COVERAGE_MODULATION); } -GLenum State::getCoverageModulation() const -{ - return mCoverageModulation; -} - void State::loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix) { if (matrixMode == GL_PATH_MODELVIEW_CHROMIUM) @@ -1970,42 +1709,17 @@ void State::setPathStencilFunc(GLenum func, GLint ref, GLuint mask) mDirtyBits.set(DIRTY_BIT_PATH_RENDERING); } -GLenum State::getPathStencilFunc() const -{ - return mPathStencilFunc; -} - -GLint State::getPathStencilRef() const -{ - return mPathStencilRef; -} - -GLuint State::getPathStencilMask() const -{ - return mPathStencilMask; -} - void State::setFramebufferSRGB(bool sRGB) { mFramebufferSRGB = sRGB; mDirtyBits.set(DIRTY_BIT_FRAMEBUFFER_SRGB); } -bool State::getFramebufferSRGB() const -{ - return mFramebufferSRGB; -} - void State::setMaxShaderCompilerThreads(GLuint count) { mMaxShaderCompilerThreads = count; } -GLuint State::getMaxShaderCompilerThreads() const -{ - return mMaxShaderCompilerThreads; -} - void State::getBooleanv(GLenum pname, GLboolean *params) { switch (pname) @@ -3030,11 +2744,6 @@ void State::setImageUnit(const Context *context, mDirtyBits.set(DIRTY_BIT_IMAGE_BINDINGS); } -const ImageUnit &State::getImageUnit(size_t unit) const -{ - return mImageUnits[unit]; -} - // Handle a dirty texture event. void State::onActiveTextureStateChange(size_t textureIndex) { @@ -3097,8 +2806,4 @@ AttributesMask State::getAndResetDirtyCurrentValues() const return retVal; } -bool State::isCurrentTransformFeedback(const TransformFeedback *tf) const -{ - return tf == mTransformFeedback.get(); -} } // namespace gl diff --git a/src/libANGLE/State.h b/src/libANGLE/State.h index 291921e86edfc..15dcc531cc60e 100644 --- a/src/libANGLE/State.h +++ b/src/libANGLE/State.h @@ -67,37 +67,37 @@ class State : angle::NonCopyable void setDepthMask(bool mask); // Discard toggle & query - bool isRasterizerDiscardEnabled() const; + bool isRasterizerDiscardEnabled() const { return mRasterizer.rasterizerDiscard; } void setRasterizerDiscard(bool enabled); // Primitive restart - bool isPrimitiveRestartEnabled() const; + bool isPrimitiveRestartEnabled() const { return mPrimitiveRestart; } void setPrimitiveRestart(bool enabled); // Face culling state manipulation - bool isCullFaceEnabled() const; + bool isCullFaceEnabled() const { return mRasterizer.cullFace; } void setCullFace(bool enabled); void setCullMode(CullFaceMode mode); void setFrontFace(GLenum front); // Depth test state manipulation - bool isDepthTestEnabled() const; + bool isDepthTestEnabled() const { return mDepthStencil.depthTest; } void setDepthTest(bool enabled); void setDepthFunc(GLenum depthFunc); void setDepthRange(float zNear, float zFar); - float getNearPlane() const; - float getFarPlane() const; + float getNearPlane() const { return mNearZ; } + float getFarPlane() const { return mFarZ; } // Blend state manipulation - bool isBlendEnabled() const; + bool isBlendEnabled() const { return mBlend.blend; } void setBlend(bool enabled); void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha); void setBlendColor(float red, float green, float blue, float alpha); void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation); - const ColorF &getBlendColor() const; + const ColorF &getBlendColor() const { return mBlendColor; } // Stencil state maniupulation - bool isStencilTestEnabled() const; + bool isStencilTestEnabled() const { return mDepthStencil.stencilTest; } void setStencilTest(bool enabled); void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask); void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask); @@ -109,44 +109,48 @@ class State : angle::NonCopyable void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass); - GLint getStencilRef() const; - GLint getStencilBackRef() const; + GLint getStencilRef() const { return mStencilRef; } + GLint getStencilBackRef() const { return mStencilBackRef; } // Depth bias/polygon offset state manipulation - bool isPolygonOffsetFillEnabled() const; + bool isPolygonOffsetFillEnabled() const { return mRasterizer.polygonOffsetFill; } void setPolygonOffsetFill(bool enabled); void setPolygonOffsetParams(GLfloat factor, GLfloat units); // Multisample coverage state manipulation - bool isSampleAlphaToCoverageEnabled() const; + bool isSampleAlphaToCoverageEnabled() const { return mBlend.sampleAlphaToCoverage; } void setSampleAlphaToCoverage(bool enabled); - bool isSampleCoverageEnabled() const; + bool isSampleCoverageEnabled() const { return mSampleCoverage; } void setSampleCoverage(bool enabled); void setSampleCoverageParams(GLclampf value, bool invert); - GLfloat getSampleCoverageValue() const; - bool getSampleCoverageInvert() const; + GLclampf getSampleCoverageValue() const { return mSampleCoverageValue; } + bool getSampleCoverageInvert() const { return mSampleCoverageInvert; } // Multisample mask state manipulation. - bool isSampleMaskEnabled() const; + bool isSampleMaskEnabled() const { return mSampleMask; } void setSampleMaskEnabled(bool enabled); void setSampleMaskParams(GLuint maskNumber, GLbitfield mask); - GLbitfield getSampleMaskWord(GLuint maskNumber) const; - GLuint getMaxSampleMaskWords() const; + GLbitfield getSampleMaskWord(GLuint maskNumber) const + { + ASSERT(maskNumber < mMaxSampleMaskWords); + return mSampleMaskValues[maskNumber]; + } + GLuint getMaxSampleMaskWords() const { return mMaxSampleMaskWords; } // Multisampling/alpha to one manipulation. void setSampleAlphaToOne(bool enabled); - bool isSampleAlphaToOneEnabled() const; + bool isSampleAlphaToOneEnabled() const { return mSampleAlphaToOne; } void setMultisampling(bool enabled); - bool isMultisamplingEnabled() const; + bool isMultisamplingEnabled() const { return mMultiSampling; } // Scissor test state toggle & query - bool isScissorTestEnabled() const; + bool isScissorTestEnabled() const { return mScissorTest; } void setScissorTest(bool enabled); void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height); - const Rectangle &getScissor() const; + const Rectangle &getScissor() const { return mScissor; } // Dither state toggle & query - bool isDitherEnabled() const; + bool isDitherEnabled() const { return mBlend.dither; } void setDither(bool enabled); // Generic state toggle & query @@ -155,7 +159,7 @@ class State : angle::NonCopyable // Line width state setter void setLineWidth(GLfloat width); - float getLineWidth() const; + float getLineWidth() const { return mLineWidth; } // Hint setters void setGenerateMipmapHint(GLenum hint); @@ -165,15 +169,16 @@ class State : angle::NonCopyable bool isBindGeneratesResourceEnabled() const { return mBindGeneratesResource; } // GL_ANGLE_client_arrays - bool areClientArraysEnabled() const; + bool areClientArraysEnabled() const { return mClientArraysEnabled; } // Viewport state setter/getter void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height); - const Rectangle &getViewport() const; + const Rectangle &getViewport() const { return mViewport; } // Texture binding & active texture unit manipulation void setActiveSampler(unsigned int active); - unsigned int getActiveSampler() const; + unsigned int getActiveSampler() const { return static_cast(mActiveSampler); } + angle::Result setSamplerTexture(const Context *context, TextureType type, Texture *texture); Texture *getTargetTexture(TextureType type) const; @@ -189,7 +194,11 @@ class State : angle::NonCopyable // Sampler object binding manipulation void setSamplerBinding(const Context *context, GLuint textureUnit, Sampler *sampler); - GLuint getSamplerId(GLuint textureUnit) const; + GLuint getSamplerId(GLuint textureUnit) const + { + ASSERT(textureUnit < mSamplers.size()); + return mSamplers[textureUnit].id(); + } Sampler *getSampler(GLuint textureUnit) const { return mSamplers[textureUnit].get(); } @@ -200,15 +209,15 @@ class State : angle::NonCopyable // Renderbuffer binding manipulation void setRenderbufferBinding(const Context *context, Renderbuffer *renderbuffer); - GLuint getRenderbufferId() const; - Renderbuffer *getCurrentRenderbuffer() const; + GLuint getRenderbufferId() const { return mRenderbuffer.id(); } + Renderbuffer *getCurrentRenderbuffer() const { return mRenderbuffer.get(); } void detachRenderbuffer(const Context *context, GLuint renderbuffer); // Framebuffer binding manipulation void setReadFramebufferBinding(Framebuffer *framebuffer); void setDrawFramebufferBinding(Framebuffer *framebuffer); Framebuffer *getTargetFramebuffer(GLenum target) const; - Framebuffer *getReadFramebuffer() const; + Framebuffer *getReadFramebuffer() const { return mReadFramebuffer; } Framebuffer *getDrawFramebuffer() const { return mDrawFramebuffer; } bool removeReadFramebufferBinding(GLuint framebuffer); @@ -216,14 +225,15 @@ class State : angle::NonCopyable // Vertex array object binding manipulation void setVertexArrayBinding(const Context *context, VertexArray *vertexArray); + bool removeVertexArrayBinding(const Context *context, GLuint vertexArray); GLuint getVertexArrayId() const; + VertexArray *getVertexArray() const { ASSERT(mVertexArray != nullptr); return mVertexArray; } - bool removeVertexArrayBinding(const Context *context, GLuint vertexArray); // Program binding manipulation angle::Result setProgram(const Context *context, Program *newProgram); @@ -303,9 +313,19 @@ class State : angle::NonCopyable GLsizei stride, const void *pointer); void setVertexAttribDivisor(const Context *context, GLuint index, GLuint divisor); - const VertexAttribCurrentValueData &getVertexAttribCurrentValue(size_t attribNum) const; - const std::vector &getVertexAttribCurrentValues() const; + const VertexAttribCurrentValueData &getVertexAttribCurrentValue(size_t attribNum) const + { + ASSERT(attribNum < mVertexAttribCurrentValues.size()); + return mVertexAttribCurrentValues[attribNum]; + } + + const std::vector &getVertexAttribCurrentValues() const + { + return mVertexAttribCurrentValues; + } + const void *getVertexAttribPointer(unsigned int attribNum) const; + void bindVertexBuffer(const Context *context, GLuint bindingIndex, Buffer *boundBuffer, @@ -322,58 +342,57 @@ class State : angle::NonCopyable // Pixel pack state manipulation void setPackAlignment(GLint alignment); - GLint getPackAlignment() const; + GLint getPackAlignment() const { return mPack.alignment; } void setPackReverseRowOrder(bool reverseRowOrder); - bool getPackReverseRowOrder() const; + bool getPackReverseRowOrder() const { return mPack.reverseRowOrder; } void setPackRowLength(GLint rowLength); - GLint getPackRowLength() const; + GLint getPackRowLength() const { return mPack.rowLength; } void setPackSkipRows(GLint skipRows); - GLint getPackSkipRows() const; + GLint getPackSkipRows() const { return mPack.skipRows; } void setPackSkipPixels(GLint skipPixels); - GLint getPackSkipPixels() const; - const PixelPackState &getPackState() const; - PixelPackState &getPackState(); + GLint getPackSkipPixels() const { return mPack.skipPixels; } + const PixelPackState &getPackState() const { return mPack; } + PixelPackState &getPackState() { return mPack; } // Pixel unpack state manipulation void setUnpackAlignment(GLint alignment); - GLint getUnpackAlignment() const; + GLint getUnpackAlignment() const { return mUnpack.alignment; } void setUnpackRowLength(GLint rowLength); - GLint getUnpackRowLength() const; + GLint getUnpackRowLength() const { return mUnpack.rowLength; } void setUnpackImageHeight(GLint imageHeight); - GLint getUnpackImageHeight() const; + GLint getUnpackImageHeight() const { return mUnpack.imageHeight; } void setUnpackSkipImages(GLint skipImages); - GLint getUnpackSkipImages() const; + GLint getUnpackSkipImages() const { return mUnpack.skipImages; } void setUnpackSkipRows(GLint skipRows); - GLint getUnpackSkipRows() const; + GLint getUnpackSkipRows() const { return mUnpack.skipRows; } void setUnpackSkipPixels(GLint skipPixels); - GLint getUnpackSkipPixels() const; - const PixelUnpackState &getUnpackState() const; - PixelUnpackState &getUnpackState(); + GLint getUnpackSkipPixels() const { return mUnpack.skipPixels; } + const PixelUnpackState &getUnpackState() const { return mUnpack; } + PixelUnpackState &getUnpackState() { return mUnpack; } // Debug state - const Debug &getDebug() const; - Debug &getDebug(); + const Debug &getDebug() const { return mDebug; } + Debug &getDebug() { return mDebug; } // CHROMIUM_framebuffer_mixed_samples coverage modulation void setCoverageModulation(GLenum components); - GLenum getCoverageModulation() const; + GLenum getCoverageModulation() const { return mCoverageModulation; } // CHROMIUM_path_rendering void loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix); const GLfloat *getPathRenderingMatrix(GLenum which) const; void setPathStencilFunc(GLenum func, GLint ref, GLuint mask); - - GLenum getPathStencilFunc() const; - GLint getPathStencilRef() const; - GLuint getPathStencilMask() const; + GLenum getPathStencilFunc() const { return mPathStencilFunc; } + GLint getPathStencilRef() const { return mPathStencilRef; } + GLuint getPathStencilMask() const { return mPathStencilMask; } // GL_EXT_sRGB_write_control void setFramebufferSRGB(bool sRGB); - bool getFramebufferSRGB() const; + bool getFramebufferSRGB() const { return mFramebufferSRGB; } // GL_KHR_parallel_shader_compile void setMaxShaderCompilerThreads(GLuint count); - GLuint getMaxShaderCompilerThreads() const; + GLuint getMaxShaderCompilerThreads() const { return mMaxShaderCompilerThreads; } // State query functions void getBooleanv(GLenum pname, GLboolean *params); @@ -504,7 +523,7 @@ class State : angle::NonCopyable GLenum access, GLenum format); - const ImageUnit &getImageUnit(size_t unit) const; + const ImageUnit &getImageUnit(size_t unit) const { return mImageUnits[unit]; } const ActiveTexturePointerArray &getActiveTexturesCache() const { return mActiveTexturesCache; } ComponentTypeMask getCurrentValuesTypeMask() const { return mCurrentValuesTypeMask; } @@ -513,8 +532,10 @@ class State : angle::NonCopyable angle::Result clearUnclearedActiveTextures(const Context *context); - bool isCurrentTransformFeedback(const TransformFeedback *tf) const; - + bool isCurrentTransformFeedback(const TransformFeedback *tf) const + { + return tf == mTransformFeedback.get(); + } bool isCurrentVertexArray(const VertexArray *va) const { return va == mVertexArray; } GLES1State &gles1() { return mGLES1State; }