Commit 54ef3ad4 by Lingfeng Yang Committed by Commit Bot

Run clang-format on State.cpp

BUG=angleproject:2306 Change-Id: I1c5a2dd40fb7d9b51cbf3fd37720a172578d76e8 Reviewed-on: https://chromium-review.googlesource.com/959105 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent cc48e5fa
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include "libANGLE/State.h" #include "libANGLE/State.h"
#include <limits>
#include <string.h> #include <string.h>
#include <limits>
#include "common/bitset_utils.h" #include "common/bitset_utils.h"
#include "common/mathutil.h" #include "common/mathutil.h"
...@@ -98,9 +98,7 @@ State::State() ...@@ -98,9 +98,7 @@ State::State()
{ {
} }
State::~State() State::~State() {}
{
}
void State::initialize(const Context *context, void State::initialize(const Context *context,
bool debug, bool debug,
...@@ -494,7 +492,9 @@ void State::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stenci ...@@ -494,7 +492,9 @@ void State::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stenci
mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT); mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT);
} }
void State::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask) void State::setStencilBackParams(GLenum stencilBackFunc,
GLint stencilBackRef,
GLuint stencilBackMask)
{ {
mDepthStencil.stencilBackFunc = stencilBackFunc; mDepthStencil.stencilBackFunc = stencilBackFunc;
mStencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0; mStencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0;
...@@ -514,7 +514,9 @@ void State::setStencilBackWritemask(GLuint stencilBackWritemask) ...@@ -514,7 +514,9 @@ void State::setStencilBackWritemask(GLuint stencilBackWritemask)
mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_BACK); mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_BACK);
} }
void State::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass) void State::setStencilOperations(GLenum stencilFail,
GLenum stencilPassDepthFail,
GLenum stencilPassDepthPass)
{ {
mDepthStencil.stencilFail = stencilFail; mDepthStencil.stencilFail = stencilFail;
mDepthStencil.stencilPassDepthFail = stencilPassDepthFail; mDepthStencil.stencilPassDepthFail = stencilPassDepthFail;
...@@ -522,7 +524,9 @@ void State::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail ...@@ -522,7 +524,9 @@ void State::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail
mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_FRONT); mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_FRONT);
} }
void State::setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass) void State::setStencilBackOperations(GLenum stencilBackFail,
GLenum stencilBackPassDepthFail,
GLenum stencilBackPassDepthPass)
{ {
mDepthStencil.stencilBackFail = stencilBackFail; mDepthStencil.stencilBackFail = stencilBackFail;
mDepthStencil.stencilBackPassDepthFail = stencilBackPassDepthFail; mDepthStencil.stencilBackPassDepthFail = stencilBackPassDepthFail;
...@@ -701,19 +705,45 @@ void State::setEnableFeature(GLenum feature, bool enabled) ...@@ -701,19 +705,45 @@ void State::setEnableFeature(GLenum feature, bool enabled)
{ {
switch (feature) switch (feature)
{ {
case GL_MULTISAMPLE_EXT: setMultisampling(enabled); break; case GL_MULTISAMPLE_EXT:
case GL_SAMPLE_ALPHA_TO_ONE_EXT: setSampleAlphaToOne(enabled); break; setMultisampling(enabled);
case GL_CULL_FACE: setCullFace(enabled); break; break;
case GL_POLYGON_OFFSET_FILL: setPolygonOffsetFill(enabled); break; case GL_SAMPLE_ALPHA_TO_ONE_EXT:
case GL_SAMPLE_ALPHA_TO_COVERAGE: setSampleAlphaToCoverage(enabled); break; setSampleAlphaToOne(enabled);
case GL_SAMPLE_COVERAGE: setSampleCoverage(enabled); break; break;
case GL_SCISSOR_TEST: setScissorTest(enabled); break; case GL_CULL_FACE:
case GL_STENCIL_TEST: setStencilTest(enabled); break; setCullFace(enabled);
case GL_DEPTH_TEST: setDepthTest(enabled); break; break;
case GL_BLEND: setBlend(enabled); break; case GL_POLYGON_OFFSET_FILL:
case GL_DITHER: setDither(enabled); break; setPolygonOffsetFill(enabled);
case GL_PRIMITIVE_RESTART_FIXED_INDEX: setPrimitiveRestart(enabled); break; break;
case GL_RASTERIZER_DISCARD: setRasterizerDiscard(enabled); break; case GL_SAMPLE_ALPHA_TO_COVERAGE:
setSampleAlphaToCoverage(enabled);
break;
case GL_SAMPLE_COVERAGE:
setSampleCoverage(enabled);
break;
case GL_SCISSOR_TEST:
setScissorTest(enabled);
break;
case GL_STENCIL_TEST:
setStencilTest(enabled);
break;
case GL_DEPTH_TEST:
setDepthTest(enabled);
break;
case GL_BLEND:
setBlend(enabled);
break;
case GL_DITHER:
setDither(enabled);
break;
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
setPrimitiveRestart(enabled);
break;
case GL_RASTERIZER_DISCARD:
setRasterizerDiscard(enabled);
break;
case GL_SAMPLE_MASK: case GL_SAMPLE_MASK:
setSampleMaskEnabled(enabled); setSampleMaskEnabled(enabled);
break; break;
...@@ -726,7 +756,8 @@ void State::setEnableFeature(GLenum feature, bool enabled) ...@@ -726,7 +756,8 @@ void State::setEnableFeature(GLenum feature, bool enabled)
case GL_FRAMEBUFFER_SRGB_EXT: case GL_FRAMEBUFFER_SRGB_EXT:
setFramebufferSRGB(enabled); setFramebufferSRGB(enabled);
break; break;
default: UNREACHABLE(); default:
UNREACHABLE();
} }
} }
...@@ -734,19 +765,32 @@ bool State::getEnableFeature(GLenum feature) const ...@@ -734,19 +765,32 @@ bool State::getEnableFeature(GLenum feature) const
{ {
switch (feature) switch (feature)
{ {
case GL_MULTISAMPLE_EXT: return isMultisamplingEnabled(); case GL_MULTISAMPLE_EXT:
case GL_SAMPLE_ALPHA_TO_ONE_EXT: return isSampleAlphaToOneEnabled(); return isMultisamplingEnabled();
case GL_CULL_FACE: return isCullFaceEnabled(); case GL_SAMPLE_ALPHA_TO_ONE_EXT:
case GL_POLYGON_OFFSET_FILL: return isPolygonOffsetFillEnabled(); return isSampleAlphaToOneEnabled();
case GL_SAMPLE_ALPHA_TO_COVERAGE: return isSampleAlphaToCoverageEnabled(); case GL_CULL_FACE:
case GL_SAMPLE_COVERAGE: return isSampleCoverageEnabled(); return isCullFaceEnabled();
case GL_SCISSOR_TEST: return isScissorTestEnabled(); case GL_POLYGON_OFFSET_FILL:
case GL_STENCIL_TEST: return isStencilTestEnabled(); return isPolygonOffsetFillEnabled();
case GL_DEPTH_TEST: return isDepthTestEnabled(); case GL_SAMPLE_ALPHA_TO_COVERAGE:
case GL_BLEND: return isBlendEnabled(); return isSampleAlphaToCoverageEnabled();
case GL_DITHER: return isDitherEnabled(); case GL_SAMPLE_COVERAGE:
case GL_PRIMITIVE_RESTART_FIXED_INDEX: return isPrimitiveRestartEnabled(); return isSampleCoverageEnabled();
case GL_RASTERIZER_DISCARD: return isRasterizerDiscardEnabled(); case GL_SCISSOR_TEST:
return isScissorTestEnabled();
case GL_STENCIL_TEST:
return isStencilTestEnabled();
case GL_DEPTH_TEST:
return isDepthTestEnabled();
case GL_BLEND:
return isBlendEnabled();
case GL_DITHER:
return isDitherEnabled();
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
return isPrimitiveRestartEnabled();
case GL_RASTERIZER_DISCARD:
return isRasterizerDiscardEnabled();
case GL_SAMPLE_MASK: case GL_SAMPLE_MASK:
return isSampleMaskEnabled(); return isSampleMaskEnabled();
case GL_DEBUG_OUTPUT_SYNCHRONOUS: case GL_DEBUG_OUTPUT_SYNCHRONOUS:
...@@ -862,8 +906,8 @@ void State::detachTexture(const Context *context, const TextureMap &zeroTextures ...@@ -862,8 +906,8 @@ void State::detachTexture(const Context *context, const TextureMap &zeroTextures
// the ResourceManager. // the ResourceManager.
// [OpenGL ES 2.0.24] section 3.8 page 84: // [OpenGL ES 2.0.24] section 3.8 page 84:
// If a texture object is deleted, it is as if all texture units which are bound to that texture object are // If a texture object is deleted, it is as if all texture units which are bound to that texture
// rebound to texture object zero // object are rebound to texture object zero
for (TextureType type : angle::AllEnums<TextureType>()) for (TextureType type : angle::AllEnums<TextureType>())
{ {
...@@ -896,9 +940,9 @@ void State::detachTexture(const Context *context, const TextureMap &zeroTextures ...@@ -896,9 +940,9 @@ void State::detachTexture(const Context *context, const TextureMap &zeroTextures
} }
// [OpenGL ES 2.0.24] section 4.4 page 112: // [OpenGL ES 2.0.24] section 4.4 page 112:
// If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is // If a texture object is deleted while its image is attached to the currently bound
// as if Texture2DAttachment had been called, with a texture of 0, for each attachment point to which this // framebuffer, then it is as if Texture2DAttachment had been called, with a texture of 0, for
// image was attached in the currently bound framebuffer. // each attachment point to which this image was attached in the currently bound framebuffer.
if (mReadFramebuffer && mReadFramebuffer->detachTexture(context, texture)) if (mReadFramebuffer && mReadFramebuffer->detachTexture(context, texture))
{ {
...@@ -975,8 +1019,8 @@ Renderbuffer *State::getCurrentRenderbuffer() const ...@@ -975,8 +1019,8 @@ Renderbuffer *State::getCurrentRenderbuffer() const
void State::detachRenderbuffer(const Context *context, GLuint renderbuffer) void State::detachRenderbuffer(const Context *context, GLuint renderbuffer)
{ {
// [OpenGL ES 2.0.24] section 4.4 page 109: // [OpenGL ES 2.0.24] section 4.4 page 109:
// If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though BindRenderbuffer // If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though
// had been executed with the target RENDERBUFFER and name of zero. // BindRenderbuffer had been executed with the target RENDERBUFFER and name of zero.
if (mRenderbuffer.id() == renderbuffer) if (mRenderbuffer.id() == renderbuffer)
{ {
...@@ -984,9 +1028,10 @@ void State::detachRenderbuffer(const Context *context, GLuint renderbuffer) ...@@ -984,9 +1028,10 @@ void State::detachRenderbuffer(const Context *context, GLuint renderbuffer)
} }
// [OpenGL ES 2.0.24] section 4.4 page 111: // [OpenGL ES 2.0.24] section 4.4 page 111:
// If a renderbuffer object is deleted while its image is attached to the currently bound framebuffer, // If a renderbuffer object is deleted while its image is attached to the currently bound
// then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of 0, for each attachment // framebuffer, then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of
// point to which this image was attached in the currently bound framebuffer. // 0, for each attachment point to which this image was attached in the currently bound
// framebuffer.
Framebuffer *readFramebuffer = mReadFramebuffer; Framebuffer *readFramebuffer = mReadFramebuffer;
Framebuffer *drawFramebuffer = mDrawFramebuffer; Framebuffer *drawFramebuffer = mDrawFramebuffer;
...@@ -1003,7 +1048,6 @@ void State::detachRenderbuffer(const Context *context, GLuint renderbuffer) ...@@ -1003,7 +1048,6 @@ void State::detachRenderbuffer(const Context *context, GLuint renderbuffer)
mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER); mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
} }
} }
} }
void State::setReadFramebufferBinding(Framebuffer *framebuffer) void State::setReadFramebufferBinding(Framebuffer *framebuffer)
...@@ -1061,8 +1105,7 @@ Framebuffer *State::getDrawFramebuffer() const ...@@ -1061,8 +1105,7 @@ Framebuffer *State::getDrawFramebuffer() const
bool State::removeReadFramebufferBinding(GLuint framebuffer) bool State::removeReadFramebufferBinding(GLuint framebuffer)
{ {
if (mReadFramebuffer != nullptr && if (mReadFramebuffer != nullptr && mReadFramebuffer->id() == framebuffer)
mReadFramebuffer->id() == framebuffer)
{ {
setReadFramebufferBinding(nullptr); setReadFramebufferBinding(nullptr);
return true; return true;
...@@ -1073,8 +1116,7 @@ bool State::removeReadFramebufferBinding(GLuint framebuffer) ...@@ -1073,8 +1116,7 @@ bool State::removeReadFramebufferBinding(GLuint framebuffer)
bool State::removeDrawFramebufferBinding(GLuint framebuffer) bool State::removeDrawFramebufferBinding(GLuint framebuffer)
{ {
if (mReadFramebuffer != nullptr && if (mReadFramebuffer != nullptr && mDrawFramebuffer->id() == framebuffer)
mDrawFramebuffer->id() == framebuffer)
{ {
setDrawFramebufferBinding(nullptr); setDrawFramebufferBinding(nullptr);
return true; return true;
...@@ -1207,7 +1249,8 @@ TransformFeedback *State::getCurrentTransformFeedback() const ...@@ -1207,7 +1249,8 @@ TransformFeedback *State::getCurrentTransformFeedback() const
bool State::isTransformFeedbackActiveUnpaused() const bool State::isTransformFeedbackActiveUnpaused() const
{ {
TransformFeedback *curTransformFeedback = getCurrentTransformFeedback(); TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
return curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused(); return curTransformFeedback && curTransformFeedback->isActive() &&
!curTransformFeedback->isPaused();
} }
bool State::removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback) bool State::removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback)
...@@ -1723,8 +1766,12 @@ void State::getBooleanv(GLenum pname, GLboolean *params) ...@@ -1723,8 +1766,12 @@ void State::getBooleanv(GLenum pname, GLboolean *params)
{ {
switch (pname) switch (pname)
{ {
case GL_SAMPLE_COVERAGE_INVERT: *params = mSampleCoverageInvert; break; case GL_SAMPLE_COVERAGE_INVERT:
case GL_DEPTH_WRITEMASK: *params = mDepthStencil.depthMask; break; *params = mSampleCoverageInvert;
break;
case GL_DEPTH_WRITEMASK:
*params = mDepthStencil.depthMask;
break;
case GL_COLOR_WRITEMASK: case GL_COLOR_WRITEMASK:
params[0] = mBlend.colorMaskRed; params[0] = mBlend.colorMaskRed;
params[1] = mBlend.colorMaskGreen; params[1] = mBlend.colorMaskGreen;
...@@ -1734,19 +1781,39 @@ void State::getBooleanv(GLenum pname, GLboolean *params) ...@@ -1734,19 +1781,39 @@ void State::getBooleanv(GLenum pname, GLboolean *params)
case GL_CULL_FACE: case GL_CULL_FACE:
*params = mRasterizer.cullFace; *params = mRasterizer.cullFace;
break; break;
case GL_POLYGON_OFFSET_FILL: *params = mRasterizer.polygonOffsetFill; break; case GL_POLYGON_OFFSET_FILL:
case GL_SAMPLE_ALPHA_TO_COVERAGE: *params = mBlend.sampleAlphaToCoverage; break; *params = mRasterizer.polygonOffsetFill;
case GL_SAMPLE_COVERAGE: *params = mSampleCoverage; break; break;
case GL_SAMPLE_ALPHA_TO_COVERAGE:
*params = mBlend.sampleAlphaToCoverage;
break;
case GL_SAMPLE_COVERAGE:
*params = mSampleCoverage;
break;
case GL_SAMPLE_MASK: case GL_SAMPLE_MASK:
*params = mSampleMask; *params = mSampleMask;
break; break;
case GL_SCISSOR_TEST: *params = mScissorTest; break; case GL_SCISSOR_TEST:
case GL_STENCIL_TEST: *params = mDepthStencil.stencilTest; break; *params = mScissorTest;
case GL_DEPTH_TEST: *params = mDepthStencil.depthTest; break; break;
case GL_BLEND: *params = mBlend.blend; break; case GL_STENCIL_TEST:
case GL_DITHER: *params = mBlend.dither; break; *params = mDepthStencil.stencilTest;
case GL_TRANSFORM_FEEDBACK_ACTIVE: *params = getCurrentTransformFeedback()->isActive() ? GL_TRUE : GL_FALSE; break; break;
case GL_TRANSFORM_FEEDBACK_PAUSED: *params = getCurrentTransformFeedback()->isPaused() ? GL_TRUE : GL_FALSE; break; case GL_DEPTH_TEST:
*params = mDepthStencil.depthTest;
break;
case GL_BLEND:
*params = mBlend.blend;
break;
case GL_DITHER:
*params = mBlend.dither;
break;
case GL_TRANSFORM_FEEDBACK_ACTIVE:
*params = getCurrentTransformFeedback()->isActive() ? GL_TRUE : GL_FALSE;
break;
case GL_TRANSFORM_FEEDBACK_PAUSED:
*params = getCurrentTransformFeedback()->isPaused() ? GL_TRUE : GL_FALSE;
break;
case GL_PRIMITIVE_RESTART_FIXED_INDEX: case GL_PRIMITIVE_RESTART_FIXED_INDEX:
*params = mPrimitiveRestart; *params = mPrimitiveRestart;
break; break;
...@@ -1795,11 +1862,21 @@ void State::getFloatv(GLenum pname, GLfloat *params) ...@@ -1795,11 +1862,21 @@ void State::getFloatv(GLenum pname, GLfloat *params)
// case, this should make no difference to the calling application. // case, this should make no difference to the calling application.
switch (pname) switch (pname)
{ {
case GL_LINE_WIDTH: *params = mLineWidth; break; case GL_LINE_WIDTH:
case GL_SAMPLE_COVERAGE_VALUE: *params = mSampleCoverageValue; break; *params = mLineWidth;
case GL_DEPTH_CLEAR_VALUE: *params = mDepthClearValue; break; break;
case GL_POLYGON_OFFSET_FACTOR: *params = mRasterizer.polygonOffsetFactor; break; case GL_SAMPLE_COVERAGE_VALUE:
case GL_POLYGON_OFFSET_UNITS: *params = mRasterizer.polygonOffsetUnits; break; *params = mSampleCoverageValue;
break;
case GL_DEPTH_CLEAR_VALUE:
*params = mDepthClearValue;
break;
case GL_POLYGON_OFFSET_FACTOR:
*params = mRasterizer.polygonOffsetFactor;
break;
case GL_POLYGON_OFFSET_UNITS:
*params = mRasterizer.polygonOffsetUnits;
break;
case GL_DEPTH_RANGE: case GL_DEPTH_RANGE:
params[0] = mNearZ; params[0] = mNearZ;
params[1] = mFarZ; params[1] = mFarZ;
...@@ -1858,14 +1935,29 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -1858,14 +1935,29 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
case GL_ELEMENT_ARRAY_BUFFER_BINDING: case GL_ELEMENT_ARRAY_BUFFER_BINDING:
*params = getVertexArray()->getElementArrayBuffer().id(); *params = getVertexArray()->getElementArrayBuffer().id();
break; break;
//case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE // case GL_FRAMEBUFFER_BINDING:
case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: *params = mDrawFramebuffer->id(); break; // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
case GL_READ_FRAMEBUFFER_BINDING_ANGLE: *params = mReadFramebuffer->id(); break; case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE:
case GL_RENDERBUFFER_BINDING: *params = mRenderbuffer.id(); break; *params = mDrawFramebuffer->id();
case GL_VERTEX_ARRAY_BINDING: *params = mVertexArray->id(); break; break;
case GL_CURRENT_PROGRAM: *params = mProgram ? mProgram->id() : 0; break; case GL_READ_FRAMEBUFFER_BINDING_ANGLE:
case GL_PACK_ALIGNMENT: *params = mPack.alignment; break; *params = mReadFramebuffer->id();
case GL_PACK_REVERSE_ROW_ORDER_ANGLE: *params = mPack.reverseRowOrder; break; break;
case GL_RENDERBUFFER_BINDING:
*params = mRenderbuffer.id();
break;
case GL_VERTEX_ARRAY_BINDING:
*params = mVertexArray->id();
break;
case GL_CURRENT_PROGRAM:
*params = mProgram ? mProgram->id() : 0;
break;
case GL_PACK_ALIGNMENT:
*params = mPack.alignment;
break;
case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
*params = mPack.reverseRowOrder;
break;
case GL_PACK_ROW_LENGTH: case GL_PACK_ROW_LENGTH:
*params = mPack.rowLength; *params = mPack.rowLength;
break; break;
...@@ -1875,8 +1967,12 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -1875,8 +1967,12 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
case GL_PACK_SKIP_PIXELS: case GL_PACK_SKIP_PIXELS:
*params = mPack.skipPixels; *params = mPack.skipPixels;
break; break;
case GL_UNPACK_ALIGNMENT: *params = mUnpack.alignment; break; case GL_UNPACK_ALIGNMENT:
case GL_UNPACK_ROW_LENGTH: *params = mUnpack.rowLength; break; *params = mUnpack.alignment;
break;
case GL_UNPACK_ROW_LENGTH:
*params = mUnpack.rowLength;
break;
case GL_UNPACK_IMAGE_HEIGHT: case GL_UNPACK_IMAGE_HEIGHT:
*params = mUnpack.imageHeight; *params = mUnpack.imageHeight;
break; break;
...@@ -1889,41 +1985,81 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -1889,41 +1985,81 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
case GL_UNPACK_SKIP_PIXELS: case GL_UNPACK_SKIP_PIXELS:
*params = mUnpack.skipPixels; *params = mUnpack.skipPixels;
break; break;
case GL_GENERATE_MIPMAP_HINT: *params = mGenerateMipmapHint; break; case GL_GENERATE_MIPMAP_HINT:
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mFragmentShaderDerivativeHint; break; *params = mGenerateMipmapHint;
break;
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
*params = mFragmentShaderDerivativeHint;
break;
case GL_ACTIVE_TEXTURE: case GL_ACTIVE_TEXTURE:
*params = (static_cast<GLint>(mActiveSampler) + GL_TEXTURE0); *params = (static_cast<GLint>(mActiveSampler) + GL_TEXTURE0);
break; break;
case GL_STENCIL_FUNC: *params = mDepthStencil.stencilFunc; break; case GL_STENCIL_FUNC:
case GL_STENCIL_REF: *params = mStencilRef; break; *params = mDepthStencil.stencilFunc;
break;
case GL_STENCIL_REF:
*params = mStencilRef;
break;
case GL_STENCIL_VALUE_MASK: case GL_STENCIL_VALUE_MASK:
*params = CastMaskValue(context, mDepthStencil.stencilMask); *params = CastMaskValue(context, mDepthStencil.stencilMask);
break; break;
case GL_STENCIL_BACK_FUNC: *params = mDepthStencil.stencilBackFunc; break; case GL_STENCIL_BACK_FUNC:
case GL_STENCIL_BACK_REF: *params = mStencilBackRef; break; *params = mDepthStencil.stencilBackFunc;
break;
case GL_STENCIL_BACK_REF:
*params = mStencilBackRef;
break;
case GL_STENCIL_BACK_VALUE_MASK: case GL_STENCIL_BACK_VALUE_MASK:
*params = CastMaskValue(context, mDepthStencil.stencilBackMask); *params = CastMaskValue(context, mDepthStencil.stencilBackMask);
break; break;
case GL_STENCIL_FAIL: *params = mDepthStencil.stencilFail; break; case GL_STENCIL_FAIL:
case GL_STENCIL_PASS_DEPTH_FAIL: *params = mDepthStencil.stencilPassDepthFail; break; *params = mDepthStencil.stencilFail;
case GL_STENCIL_PASS_DEPTH_PASS: *params = mDepthStencil.stencilPassDepthPass; break; break;
case GL_STENCIL_BACK_FAIL: *params = mDepthStencil.stencilBackFail; break; case GL_STENCIL_PASS_DEPTH_FAIL:
case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *params = mDepthStencil.stencilBackPassDepthFail; break; *params = mDepthStencil.stencilPassDepthFail;
case GL_STENCIL_BACK_PASS_DEPTH_PASS: *params = mDepthStencil.stencilBackPassDepthPass; break; break;
case GL_DEPTH_FUNC: *params = mDepthStencil.depthFunc; break; case GL_STENCIL_PASS_DEPTH_PASS:
case GL_BLEND_SRC_RGB: *params = mBlend.sourceBlendRGB; break; *params = mDepthStencil.stencilPassDepthPass;
case GL_BLEND_SRC_ALPHA: *params = mBlend.sourceBlendAlpha; break; break;
case GL_BLEND_DST_RGB: *params = mBlend.destBlendRGB; break; case GL_STENCIL_BACK_FAIL:
case GL_BLEND_DST_ALPHA: *params = mBlend.destBlendAlpha; break; *params = mDepthStencil.stencilBackFail;
case GL_BLEND_EQUATION_RGB: *params = mBlend.blendEquationRGB; break; break;
case GL_BLEND_EQUATION_ALPHA: *params = mBlend.blendEquationAlpha; break; case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
*params = mDepthStencil.stencilBackPassDepthFail;
break;
case GL_STENCIL_BACK_PASS_DEPTH_PASS:
*params = mDepthStencil.stencilBackPassDepthPass;
break;
case GL_DEPTH_FUNC:
*params = mDepthStencil.depthFunc;
break;
case GL_BLEND_SRC_RGB:
*params = mBlend.sourceBlendRGB;
break;
case GL_BLEND_SRC_ALPHA:
*params = mBlend.sourceBlendAlpha;
break;
case GL_BLEND_DST_RGB:
*params = mBlend.destBlendRGB;
break;
case GL_BLEND_DST_ALPHA:
*params = mBlend.destBlendAlpha;
break;
case GL_BLEND_EQUATION_RGB:
*params = mBlend.blendEquationRGB;
break;
case GL_BLEND_EQUATION_ALPHA:
*params = mBlend.blendEquationAlpha;
break;
case GL_STENCIL_WRITEMASK: case GL_STENCIL_WRITEMASK:
*params = CastMaskValue(context, mDepthStencil.stencilWritemask); *params = CastMaskValue(context, mDepthStencil.stencilWritemask);
break; break;
case GL_STENCIL_BACK_WRITEMASK: case GL_STENCIL_BACK_WRITEMASK:
*params = CastMaskValue(context, mDepthStencil.stencilBackWritemask); *params = CastMaskValue(context, mDepthStencil.stencilBackWritemask);
break; break;
case GL_STENCIL_CLEAR_VALUE: *params = mStencilClearValue; break; case GL_STENCIL_CLEAR_VALUE:
*params = mStencilClearValue;
break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE: case GL_IMPLEMENTATION_COLOR_READ_TYPE:
*params = mReadFramebuffer->getImplementationColorReadType(context); *params = mReadFramebuffer->getImplementationColorReadType(context);
break; break;
...@@ -1993,10 +2129,18 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -1993,10 +2129,18 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
{ {
switch (pname) switch (pname)
{ {
case GL_RED_BITS: *params = colorbuffer->getRedSize(); break; case GL_RED_BITS:
case GL_GREEN_BITS: *params = colorbuffer->getGreenSize(); break; *params = colorbuffer->getRedSize();
case GL_BLUE_BITS: *params = colorbuffer->getBlueSize(); break; break;
case GL_ALPHA_BITS: *params = colorbuffer->getAlphaSize(); break; case GL_GREEN_BITS:
*params = colorbuffer->getGreenSize();
break;
case GL_BLUE_BITS:
*params = colorbuffer->getBlueSize();
break;
case GL_ALPHA_BITS:
*params = colorbuffer->getAlphaSize();
break;
} }
} }
else else
...@@ -2037,7 +2181,8 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -2037,7 +2181,8 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
break; break;
case GL_TEXTURE_BINDING_2D: case GL_TEXTURE_BINDING_2D:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
*params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::_2D); *params =
getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::_2D);
break; break;
case GL_TEXTURE_BINDING_RECTANGLE_ANGLE: case GL_TEXTURE_BINDING_RECTANGLE_ANGLE:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
...@@ -2046,17 +2191,18 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -2046,17 +2191,18 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
break; break;
case GL_TEXTURE_BINDING_CUBE_MAP: case GL_TEXTURE_BINDING_CUBE_MAP:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
*params = *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::CubeMap); TextureType::CubeMap);
break; break;
case GL_TEXTURE_BINDING_3D: case GL_TEXTURE_BINDING_3D:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
*params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::_3D); *params =
getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::_3D);
break; break;
case GL_TEXTURE_BINDING_2D_ARRAY: case GL_TEXTURE_BINDING_2D_ARRAY:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
*params = *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::_2DArray); TextureType::_2DArray);
break; break;
case GL_TEXTURE_BINDING_2D_MULTISAMPLE: case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
...@@ -2065,8 +2211,8 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -2065,8 +2211,8 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
break; break;
case GL_TEXTURE_BINDING_EXTERNAL_OES: case GL_TEXTURE_BINDING_EXTERNAL_OES:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
*params = *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::External); TextureType::External);
break; break;
case GL_UNIFORM_BUFFER_BINDING: case GL_UNIFORM_BUFFER_BINDING:
*params = mBoundBuffers[BufferBinding::Uniform].id(); *params = mBoundBuffers[BufferBinding::Uniform].id();
......
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