Commit 774fe563 by Markus Tavenrath Committed by Commit Bot

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