Hash :
5ec53c82
Author :
Date :
2015-06-05T16:32:14
Handle the remaining pixel unpack parameters in TextureGL. BUG=angleproject:884 Change-Id: I9e248e623f3b342f878bf65c9686768b90cf5ed8 Reviewed-on: https://chromium-review.googlesource.com/275692 Tested-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
//
// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// StateManagerGL.h: Defines a class for caching applied OpenGL state
#ifndef LIBANGLE_RENDERER_GL_STATEMANAGERGL_H_
#define LIBANGLE_RENDERER_GL_STATEMANAGERGL_H_
#include "common/debug.h"
#include "libANGLE/Error.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/gl/functionsgl_typedefs.h"
#include <map>
namespace gl
{
struct Caps;
struct Data;
class State;
}
namespace rx
{
class FunctionsGL;
class StateManagerGL : angle::NonCopyable
{
public:
StateManagerGL(const FunctionsGL *functions, const gl::Caps &rendererCaps);
void deleteProgram(GLuint program);
void deleteVertexArray(GLuint vao);
void deleteTexture(GLuint texture);
void deleteBuffer(GLuint buffer);
void deleteFramebuffer(GLuint fbo);
void deleteRenderbuffer(GLuint rbo);
void useProgram(GLuint program);
void bindVertexArray(GLuint vao, GLuint elementArrayBuffer);
void bindBuffer(GLenum type, GLuint buffer);
void activeTexture(size_t unit);
void bindTexture(GLenum type, GLuint texture);
void setPixelUnpackState(GLint alignment, GLint rowLength, GLint skipRows, GLint skipPixels,
GLint imageHeight, GLint skipImages);
void setPixelPackState(GLint alignment, GLint rowLength, GLint skipRows, GLint skipPixels);
void bindFramebuffer(GLenum type, GLuint framebuffer);
void bindRenderbuffer(GLenum type, GLuint renderbuffer);
void setClearState(const gl::State &state, GLbitfield mask);
gl::Error setDrawArraysState(const gl::Data &data, GLint first, GLsizei count);
gl::Error setDrawElementsState(const gl::Data &data, GLsizei count, GLenum type, const GLvoid *indices,
const GLvoid **outIndices);
private:
gl::Error setGenericDrawState(const gl::Data &data);
void setAttributeCurrentData(size_t index, const gl::VertexAttribCurrentValueData &data);
void setScissorTestEnabled(bool enabled);
void setScissor(const gl::Rectangle &scissor);
void setViewport(const gl::Rectangle &viewport);
void setDepthRange(float near, float far);
void setBlendEnabled(bool enabled);
void setBlendColor(const gl::ColorF &blendColor);
void setBlendFuncs(GLenum sourceBlendRGB, GLenum destBlendRGB, GLenum sourceBlendAlpha, GLenum destBlendAlpha);
void setBlendEquations(GLenum blendEquationRGB, GLenum blendEquationAlpha);
void setColorMask(bool red, bool green, bool blue, bool alpha);
void setSampleAlphaToCoverageEnabled(bool enabled);
void setSampleCoverageEnabled(bool enabled);
void setSampleCoverage(float value, bool invert);
void setDepthTestEnabled(bool enabled);
void setDepthFunc(GLenum depthFunc);
void setDepthMask(bool mask);
void setStencilTestEnabled(bool enabled);
void setStencilFrontWritemask(GLuint mask);
void setStencilBackWritemask(GLuint mask);
void setStencilFrontFuncs(GLenum func, GLint ref, GLuint mask);
void setStencilBackFuncs(GLenum func, GLint ref, GLuint mask);
void setStencilFrontOps(GLenum sfail, GLenum dpfail, GLenum dppass);
void setStencilBackOps(GLenum sfail, GLenum dpfail, GLenum dppass);
void setCullFaceEnabled(bool enabled);
void setCullFace(GLenum cullFace);
void setFrontFace(GLenum frontFace);
void setPolygonOffsetFillEnabled(bool enabled);
void setPolygonOffset(float factor, float units);
void setMultisampleEnabled(bool enabled);
void setRasterizerDiscardEnabled(bool enabled);
void setLineWidth(float width);
void setPrimitiveRestartEnabled(bool enabled);
void setClearColor(const gl::ColorF &clearColor);
void setClearDepth(float clearDepth);
void setClearStencil(GLint clearStencil);
const FunctionsGL *mFunctions;
GLuint mProgram;
GLuint mVAO;
std::vector<gl::VertexAttribCurrentValueData> mVertexAttribCurrentValues;
std::map<GLenum, GLuint> mBuffers;
size_t mTextureUnitIndex;
std::map<GLenum, std::vector<GLuint>> mTextures;
GLint mUnpackAlignment;
GLint mUnpackRowLength;
GLint mUnpackSkipRows;
GLint mUnpackSkipPixels;
GLint mUnpackImageHeight;
GLint mUnpackSkipImages;
GLint mPackAlignment;
GLint mPackRowLength;
GLint mPackSkipRows;
GLint mPackSkipPixels;
std::map<GLenum, GLuint> mFramebuffers;
GLuint mRenderbuffer;
bool mScissorTestEnabled;
gl::Rectangle mScissor;
gl::Rectangle mViewport;
float mNear;
float mFar;
bool mBlendEnabled;
gl::ColorF mBlendColor;
GLenum mSourceBlendRGB;
GLenum mDestBlendRGB;
GLenum mSourceBlendAlpha;
GLenum mDestBlendAlpha;
GLenum mBlendEquationRGB;
GLenum mBlendEquationAlpha;
bool mColorMaskRed;
bool mColorMaskGreen;
bool mColorMaskBlue;
bool mColorMaskAlpha;
bool mSampleAlphaToCoverageEnabled;
bool mSampleCoverageEnabled;
float mSampleCoverageValue;
bool mSampleCoverageInvert;
bool mDepthTestEnabled;
GLenum mDepthFunc;
bool mDepthMask;
bool mStencilTestEnabled;
GLenum mStencilFrontFunc;
GLint mStencilFrontRef;
GLuint mStencilFrontValueMask;
GLenum mStencilFrontStencilFailOp;
GLenum mStencilFrontStencilPassDepthFailOp;
GLenum mStencilFrontStencilPassDepthPassOp;
GLuint mStencilFrontWritemask;
GLenum mStencilBackFunc;
GLint mStencilBackRef;
GLuint mStencilBackValueMask;
GLenum mStencilBackStencilFailOp;
GLenum mStencilBackStencilPassDepthFailOp;
GLenum mStencilBackStencilPassDepthPassOp;
GLuint mStencilBackWritemask;
bool mCullFaceEnabled;
GLenum mCullFace;
GLenum mFrontFace;
bool mPolygonOffsetFillEnabled;
GLfloat mPolygonOffsetFactor;
GLfloat mPolygonOffsetUnits;
bool mMultisampleEnabled;
bool mRasterizerDiscardEnabled;
float mLineWidth;
bool mPrimitiveRestartEnabled;
gl::ColorF mClearColor;
float mClearDepth;
GLint mClearStencil;
};
}
#endif // LIBANGLE_RENDERER_GL_STATEMANAGERGL_H_