1*8975f5c5SAndroid Build Coastguard Worker // 2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2018 The ANGLE Project Authors. All rights reserved. 3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file. 5*8975f5c5SAndroid Build Coastguard Worker // 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard Worker // GLES1State.h: Defines the GLES1State class holding the state of 8*8975f5c5SAndroid Build Coastguard Worker // a GLES1 context. 9*8975f5c5SAndroid Build Coastguard Worker 10*8975f5c5SAndroid Build Coastguard Worker #ifndef LIBANGLE_GLES1STATE_H_ 11*8975f5c5SAndroid Build Coastguard Worker #define LIBANGLE_GLES1STATE_H_ 12*8975f5c5SAndroid Build Coastguard Worker 13*8975f5c5SAndroid Build Coastguard Worker #include <unordered_set> 14*8975f5c5SAndroid Build Coastguard Worker 15*8975f5c5SAndroid Build Coastguard Worker #include "common/FixedVector.h" 16*8975f5c5SAndroid Build Coastguard Worker #include "common/angleutils.h" 17*8975f5c5SAndroid Build Coastguard Worker #include "common/bitset_utils.h" 18*8975f5c5SAndroid Build Coastguard Worker #include "common/matrix_utils.h" 19*8975f5c5SAndroid Build Coastguard Worker #include "common/vector_utils.h" 20*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Caps.h" 21*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/angletypes.h" 22*8975f5c5SAndroid Build Coastguard Worker 23*8975f5c5SAndroid Build Coastguard Worker namespace gl 24*8975f5c5SAndroid Build Coastguard Worker { 25*8975f5c5SAndroid Build Coastguard Worker 26*8975f5c5SAndroid Build Coastguard Worker // State types specific to GLES1 contexts, from the OpenGL ES 1.1 spec "State Tables" section 27*8975f5c5SAndroid Build Coastguard Worker struct TextureCoordF 28*8975f5c5SAndroid Build Coastguard Worker { 29*8975f5c5SAndroid Build Coastguard Worker TextureCoordF(); 30*8975f5c5SAndroid Build Coastguard Worker TextureCoordF(float _s, float _t, float _r, float _q); 31*8975f5c5SAndroid Build Coastguard Worker bool operator==(const TextureCoordF &other) const; 32*8975f5c5SAndroid Build Coastguard Worker 33*8975f5c5SAndroid Build Coastguard Worker GLfloat s = 0.0f; 34*8975f5c5SAndroid Build Coastguard Worker GLfloat t = 0.0f; 35*8975f5c5SAndroid Build Coastguard Worker GLfloat r = 0.0f; 36*8975f5c5SAndroid Build Coastguard Worker GLfloat q = 0.0f; 37*8975f5c5SAndroid Build Coastguard Worker }; 38*8975f5c5SAndroid Build Coastguard Worker 39*8975f5c5SAndroid Build Coastguard Worker struct MaterialParameters 40*8975f5c5SAndroid Build Coastguard Worker { 41*8975f5c5SAndroid Build Coastguard Worker MaterialParameters(); 42*8975f5c5SAndroid Build Coastguard Worker 43*8975f5c5SAndroid Build Coastguard Worker ColorF ambient; 44*8975f5c5SAndroid Build Coastguard Worker ColorF diffuse; 45*8975f5c5SAndroid Build Coastguard Worker ColorF specular; 46*8975f5c5SAndroid Build Coastguard Worker ColorF emissive; 47*8975f5c5SAndroid Build Coastguard Worker GLfloat specularExponent; 48*8975f5c5SAndroid Build Coastguard Worker }; 49*8975f5c5SAndroid Build Coastguard Worker 50*8975f5c5SAndroid Build Coastguard Worker struct LightModelParameters 51*8975f5c5SAndroid Build Coastguard Worker { 52*8975f5c5SAndroid Build Coastguard Worker LightModelParameters(); 53*8975f5c5SAndroid Build Coastguard Worker 54*8975f5c5SAndroid Build Coastguard Worker ColorF color; 55*8975f5c5SAndroid Build Coastguard Worker bool twoSided; 56*8975f5c5SAndroid Build Coastguard Worker }; 57*8975f5c5SAndroid Build Coastguard Worker 58*8975f5c5SAndroid Build Coastguard Worker struct LightParameters 59*8975f5c5SAndroid Build Coastguard Worker { 60*8975f5c5SAndroid Build Coastguard Worker LightParameters(); 61*8975f5c5SAndroid Build Coastguard Worker LightParameters(const LightParameters &other); 62*8975f5c5SAndroid Build Coastguard Worker 63*8975f5c5SAndroid Build Coastguard Worker bool enabled = false; 64*8975f5c5SAndroid Build Coastguard Worker ColorF ambient = {0.0f, 0.0f, 0.0f, 1.0f}; 65*8975f5c5SAndroid Build Coastguard Worker ColorF diffuse = {0.0f, 0.0f, 0.0f, 1.0f}; 66*8975f5c5SAndroid Build Coastguard Worker ColorF specular = {0.0f, 0.0f, 0.0f, 1.0f}; 67*8975f5c5SAndroid Build Coastguard Worker angle::Vector4 position = {0.0f, 0.0f, 1.0f, 0.0f}; 68*8975f5c5SAndroid Build Coastguard Worker angle::Vector3 direction = {0.0f, 0.0f, -1.0f}; 69*8975f5c5SAndroid Build Coastguard Worker GLfloat spotlightExponent = 0.0f; 70*8975f5c5SAndroid Build Coastguard Worker GLfloat spotlightCutoffAngle = 180.0f; 71*8975f5c5SAndroid Build Coastguard Worker GLfloat attenuationConst = 1.0f; 72*8975f5c5SAndroid Build Coastguard Worker GLfloat attenuationLinear = 0.0f; 73*8975f5c5SAndroid Build Coastguard Worker GLfloat attenuationQuadratic = 0.0f; 74*8975f5c5SAndroid Build Coastguard Worker }; 75*8975f5c5SAndroid Build Coastguard Worker 76*8975f5c5SAndroid Build Coastguard Worker struct FogParameters 77*8975f5c5SAndroid Build Coastguard Worker { 78*8975f5c5SAndroid Build Coastguard Worker FogParameters(); 79*8975f5c5SAndroid Build Coastguard Worker 80*8975f5c5SAndroid Build Coastguard Worker FogMode mode; 81*8975f5c5SAndroid Build Coastguard Worker GLfloat density; 82*8975f5c5SAndroid Build Coastguard Worker GLfloat start; 83*8975f5c5SAndroid Build Coastguard Worker GLfloat end; 84*8975f5c5SAndroid Build Coastguard Worker ColorF color; 85*8975f5c5SAndroid Build Coastguard Worker }; 86*8975f5c5SAndroid Build Coastguard Worker 87*8975f5c5SAndroid Build Coastguard Worker struct AlphaTestParameters 88*8975f5c5SAndroid Build Coastguard Worker { 89*8975f5c5SAndroid Build Coastguard Worker AlphaTestParameters(); 90*8975f5c5SAndroid Build Coastguard Worker bool operator!=(const AlphaTestParameters &other) const; 91*8975f5c5SAndroid Build Coastguard Worker 92*8975f5c5SAndroid Build Coastguard Worker AlphaTestFunc func = AlphaTestFunc::AlwaysPass; 93*8975f5c5SAndroid Build Coastguard Worker GLfloat ref = 0.0f; 94*8975f5c5SAndroid Build Coastguard Worker }; 95*8975f5c5SAndroid Build Coastguard Worker 96*8975f5c5SAndroid Build Coastguard Worker struct TextureEnvironmentParameters 97*8975f5c5SAndroid Build Coastguard Worker { 98*8975f5c5SAndroid Build Coastguard Worker TextureEnvironmentParameters(); 99*8975f5c5SAndroid Build Coastguard Worker TextureEnvironmentParameters(const TextureEnvironmentParameters &other); 100*8975f5c5SAndroid Build Coastguard Worker 101*8975f5c5SAndroid Build Coastguard Worker TextureEnvMode mode = TextureEnvMode::Modulate; 102*8975f5c5SAndroid Build Coastguard Worker TextureCombine combineRgb = TextureCombine::Modulate; 103*8975f5c5SAndroid Build Coastguard Worker TextureCombine combineAlpha = TextureCombine::Modulate; 104*8975f5c5SAndroid Build Coastguard Worker 105*8975f5c5SAndroid Build Coastguard Worker TextureSrc src0Rgb = TextureSrc::Texture; 106*8975f5c5SAndroid Build Coastguard Worker TextureSrc src0Alpha = TextureSrc::Texture; 107*8975f5c5SAndroid Build Coastguard Worker 108*8975f5c5SAndroid Build Coastguard Worker TextureSrc src1Rgb = TextureSrc::Previous; 109*8975f5c5SAndroid Build Coastguard Worker TextureSrc src1Alpha = TextureSrc::Previous; 110*8975f5c5SAndroid Build Coastguard Worker 111*8975f5c5SAndroid Build Coastguard Worker TextureSrc src2Rgb = TextureSrc::Constant; 112*8975f5c5SAndroid Build Coastguard Worker TextureSrc src2Alpha = TextureSrc::Constant; 113*8975f5c5SAndroid Build Coastguard Worker 114*8975f5c5SAndroid Build Coastguard Worker TextureOp op0Rgb = TextureOp::SrcColor; 115*8975f5c5SAndroid Build Coastguard Worker TextureOp op0Alpha = TextureOp::SrcAlpha; 116*8975f5c5SAndroid Build Coastguard Worker 117*8975f5c5SAndroid Build Coastguard Worker TextureOp op1Rgb = TextureOp::SrcColor; 118*8975f5c5SAndroid Build Coastguard Worker TextureOp op1Alpha = TextureOp::SrcAlpha; 119*8975f5c5SAndroid Build Coastguard Worker 120*8975f5c5SAndroid Build Coastguard Worker TextureOp op2Rgb = TextureOp::SrcAlpha; 121*8975f5c5SAndroid Build Coastguard Worker TextureOp op2Alpha = TextureOp::SrcAlpha; 122*8975f5c5SAndroid Build Coastguard Worker 123*8975f5c5SAndroid Build Coastguard Worker ColorF color = {0.0f, 0.0f, 0.0f, 0.0f}; 124*8975f5c5SAndroid Build Coastguard Worker GLfloat rgbScale = 1.0f; 125*8975f5c5SAndroid Build Coastguard Worker GLfloat alphaScale = 1.0f; 126*8975f5c5SAndroid Build Coastguard Worker 127*8975f5c5SAndroid Build Coastguard Worker bool pointSpriteCoordReplace = false; 128*8975f5c5SAndroid Build Coastguard Worker tieTextureEnvironmentParameters129*8975f5c5SAndroid Build Coastguard Worker auto tie() const 130*8975f5c5SAndroid Build Coastguard Worker { 131*8975f5c5SAndroid Build Coastguard Worker return std::tie(mode, combineRgb, combineAlpha, src0Rgb, src0Alpha, src1Rgb, src1Alpha, 132*8975f5c5SAndroid Build Coastguard Worker src2Rgb, src2Alpha, op0Rgb, op0Alpha, op1Rgb, op1Alpha, op2Rgb, op2Alpha, 133*8975f5c5SAndroid Build Coastguard Worker color, rgbScale, alphaScale, pointSpriteCoordReplace); 134*8975f5c5SAndroid Build Coastguard Worker } 135*8975f5c5SAndroid Build Coastguard Worker }; 136*8975f5c5SAndroid Build Coastguard Worker 137*8975f5c5SAndroid Build Coastguard Worker bool operator==(const TextureEnvironmentParameters &a, const TextureEnvironmentParameters &b); 138*8975f5c5SAndroid Build Coastguard Worker bool operator!=(const TextureEnvironmentParameters &a, const TextureEnvironmentParameters &b); 139*8975f5c5SAndroid Build Coastguard Worker 140*8975f5c5SAndroid Build Coastguard Worker struct PointParameters 141*8975f5c5SAndroid Build Coastguard Worker { 142*8975f5c5SAndroid Build Coastguard Worker PointParameters(); 143*8975f5c5SAndroid Build Coastguard Worker PointParameters(const PointParameters &other); 144*8975f5c5SAndroid Build Coastguard Worker 145*8975f5c5SAndroid Build Coastguard Worker GLfloat pointSizeMin = 0.0f; 146*8975f5c5SAndroid Build Coastguard Worker GLfloat pointSizeMax = 1.0f; 147*8975f5c5SAndroid Build Coastguard Worker GLfloat pointFadeThresholdSize = 1.0f; 148*8975f5c5SAndroid Build Coastguard Worker angle::Vector3 pointDistanceAttenuation = {1.0f, 0.0f, 0.0f}; 149*8975f5c5SAndroid Build Coastguard Worker GLfloat pointSize = 1.0f; 150*8975f5c5SAndroid Build Coastguard Worker }; 151*8975f5c5SAndroid Build Coastguard Worker 152*8975f5c5SAndroid Build Coastguard Worker struct ClipPlaneParameters 153*8975f5c5SAndroid Build Coastguard Worker { 154*8975f5c5SAndroid Build Coastguard Worker ClipPlaneParameters(); 155*8975f5c5SAndroid Build Coastguard Worker ClipPlaneParameters(bool enabled, const angle::Vector4 &equation); 156*8975f5c5SAndroid Build Coastguard Worker ClipPlaneParameters(const ClipPlaneParameters &other); 157*8975f5c5SAndroid Build Coastguard Worker ClipPlaneParameters &operator=(const ClipPlaneParameters &other); 158*8975f5c5SAndroid Build Coastguard Worker 159*8975f5c5SAndroid Build Coastguard Worker bool enabled; 160*8975f5c5SAndroid Build Coastguard Worker angle::Vector4 equation; 161*8975f5c5SAndroid Build Coastguard Worker }; 162*8975f5c5SAndroid Build Coastguard Worker 163*8975f5c5SAndroid Build Coastguard Worker class Context; 164*8975f5c5SAndroid Build Coastguard Worker class GLES1Renderer; 165*8975f5c5SAndroid Build Coastguard Worker class PrivateState; 166*8975f5c5SAndroid Build Coastguard Worker 167*8975f5c5SAndroid Build Coastguard Worker class GLES1State final : angle::NonCopyable 168*8975f5c5SAndroid Build Coastguard Worker { 169*8975f5c5SAndroid Build Coastguard Worker public: 170*8975f5c5SAndroid Build Coastguard Worker GLES1State(); 171*8975f5c5SAndroid Build Coastguard Worker ~GLES1State(); 172*8975f5c5SAndroid Build Coastguard Worker 173*8975f5c5SAndroid Build Coastguard Worker void initialize(const Context *context, const PrivateState *state); 174*8975f5c5SAndroid Build Coastguard Worker 175*8975f5c5SAndroid Build Coastguard Worker void setAlphaTestParameters(AlphaTestFunc func, GLfloat ref); 176*8975f5c5SAndroid Build Coastguard Worker const AlphaTestParameters &getAlphaTestParameters() const; 177*8975f5c5SAndroid Build Coastguard Worker 178*8975f5c5SAndroid Build Coastguard Worker void setClientTextureUnit(unsigned int unit); 179*8975f5c5SAndroid Build Coastguard Worker unsigned int getClientTextureUnit() const; 180*8975f5c5SAndroid Build Coastguard Worker 181*8975f5c5SAndroid Build Coastguard Worker void setCurrentColor(const ColorF &color); 182*8975f5c5SAndroid Build Coastguard Worker const ColorF &getCurrentColor() const; 183*8975f5c5SAndroid Build Coastguard Worker 184*8975f5c5SAndroid Build Coastguard Worker void setCurrentNormal(const angle::Vector3 &normal); 185*8975f5c5SAndroid Build Coastguard Worker const angle::Vector3 &getCurrentNormal() const; 186*8975f5c5SAndroid Build Coastguard Worker 187*8975f5c5SAndroid Build Coastguard Worker void setCurrentTextureCoords(unsigned int unit, const TextureCoordF &coords); 188*8975f5c5SAndroid Build Coastguard Worker const TextureCoordF &getCurrentTextureCoords(unsigned int unit) const; 189*8975f5c5SAndroid Build Coastguard Worker 190*8975f5c5SAndroid Build Coastguard Worker void setMatrixMode(MatrixType mode); 191*8975f5c5SAndroid Build Coastguard Worker MatrixType getMatrixMode() const; 192*8975f5c5SAndroid Build Coastguard Worker 193*8975f5c5SAndroid Build Coastguard Worker GLint getCurrentMatrixStackDepth(GLenum param) const; 194*8975f5c5SAndroid Build Coastguard Worker 195*8975f5c5SAndroid Build Coastguard Worker void pushMatrix(); 196*8975f5c5SAndroid Build Coastguard Worker void popMatrix(); 197*8975f5c5SAndroid Build Coastguard Worker 198*8975f5c5SAndroid Build Coastguard Worker using MatrixStack = angle::FixedVector<angle::Mat4, Caps::GlobalMatrixStackDepth>; 199*8975f5c5SAndroid Build Coastguard Worker MatrixStack ¤tMatrixStack(); 200*8975f5c5SAndroid Build Coastguard Worker const MatrixStack ¤tMatrixStack() const; 201*8975f5c5SAndroid Build Coastguard Worker const MatrixStack &getMatrixStack(MatrixType mode) const; 202*8975f5c5SAndroid Build Coastguard Worker 203*8975f5c5SAndroid Build Coastguard Worker const angle::Mat4 &getModelviewMatrix() const; 204*8975f5c5SAndroid Build Coastguard Worker 205*8975f5c5SAndroid Build Coastguard Worker void loadMatrix(const angle::Mat4 &m); 206*8975f5c5SAndroid Build Coastguard Worker void multMatrix(const angle::Mat4 &m); 207*8975f5c5SAndroid Build Coastguard Worker 208*8975f5c5SAndroid Build Coastguard Worker void setTextureEnabled(GLint activeSampler, TextureType type, bool enabled); 209*8975f5c5SAndroid Build Coastguard Worker 210*8975f5c5SAndroid Build Coastguard Worker void setLogicOpEnabled(bool enabled); 211*8975f5c5SAndroid Build Coastguard Worker void setLogicOp(LogicalOperation opcodePacked); 212*8975f5c5SAndroid Build Coastguard Worker 213*8975f5c5SAndroid Build Coastguard Worker void setClientStateEnabled(ClientVertexArrayType clientState, bool enable); 214*8975f5c5SAndroid Build Coastguard Worker void setTexCoordArrayEnabled(unsigned int unit, bool enable); 215*8975f5c5SAndroid Build Coastguard Worker bool isClientStateEnabled(ClientVertexArrayType clientState) const; 216*8975f5c5SAndroid Build Coastguard Worker bool isTexCoordArrayEnabled(unsigned int unit) const; 217*8975f5c5SAndroid Build Coastguard Worker bool isTextureTargetEnabled(unsigned int unit, const TextureType type) const; 218*8975f5c5SAndroid Build Coastguard Worker 219*8975f5c5SAndroid Build Coastguard Worker LightModelParameters &lightModelParameters(); 220*8975f5c5SAndroid Build Coastguard Worker const LightModelParameters &lightModelParameters() const; 221*8975f5c5SAndroid Build Coastguard Worker 222*8975f5c5SAndroid Build Coastguard Worker LightParameters &lightParameters(unsigned int light); 223*8975f5c5SAndroid Build Coastguard Worker const LightParameters &lightParameters(unsigned int light) const; 224*8975f5c5SAndroid Build Coastguard Worker 225*8975f5c5SAndroid Build Coastguard Worker MaterialParameters &materialParameters(); 226*8975f5c5SAndroid Build Coastguard Worker const MaterialParameters &materialParameters() const; 227*8975f5c5SAndroid Build Coastguard Worker bool isColorMaterialEnabled() const; 228*8975f5c5SAndroid Build Coastguard Worker 229*8975f5c5SAndroid Build Coastguard Worker void setShadeModel(ShadingModel model); 230*8975f5c5SAndroid Build Coastguard Worker 231*8975f5c5SAndroid Build Coastguard Worker void setClipPlane(unsigned int plane, const GLfloat *equation); 232*8975f5c5SAndroid Build Coastguard Worker void getClipPlane(unsigned int plane, GLfloat *equation) const; 233*8975f5c5SAndroid Build Coastguard Worker 234*8975f5c5SAndroid Build Coastguard Worker FogParameters &fogParameters(); 235*8975f5c5SAndroid Build Coastguard Worker const FogParameters &fogParameters() const; 236*8975f5c5SAndroid Build Coastguard Worker 237*8975f5c5SAndroid Build Coastguard Worker TextureEnvironmentParameters &textureEnvironment(unsigned int unit); 238*8975f5c5SAndroid Build Coastguard Worker const TextureEnvironmentParameters &textureEnvironment(unsigned int unit) const; 239*8975f5c5SAndroid Build Coastguard Worker 240*8975f5c5SAndroid Build Coastguard Worker PointParameters &pointParameters(); 241*8975f5c5SAndroid Build Coastguard Worker const PointParameters &pointParameters() const; 242*8975f5c5SAndroid Build Coastguard Worker 243*8975f5c5SAndroid Build Coastguard Worker AttributesMask getVertexArraysAttributeMask() const; 244*8975f5c5SAndroid Build Coastguard Worker AttributesMask getActiveAttributesMask() const; 245*8975f5c5SAndroid Build Coastguard Worker 246*8975f5c5SAndroid Build Coastguard Worker bool shouldHandleDirtyProgram(); 247*8975f5c5SAndroid Build Coastguard Worker 248*8975f5c5SAndroid Build Coastguard Worker void setHint(GLenum target, GLenum mode); 249*8975f5c5SAndroid Build Coastguard Worker GLenum getHint(GLenum target) const; 250*8975f5c5SAndroid Build Coastguard Worker 251*8975f5c5SAndroid Build Coastguard Worker enum DirtyGles1Type 252*8975f5c5SAndroid Build Coastguard Worker { 253*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_TEXTURE_UNIT_ENABLE = 0, 254*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_CLIENT_STATE_ENABLE, 255*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_FEATURE_ENABLE, 256*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_CURRENT_VECTOR, 257*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_CLIENT_ACTIVE_TEXTURE, 258*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_MATRICES, 259*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_TEXTURE_ENVIRONMENT, 260*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_MATERIAL, 261*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_LIGHTS, 262*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_FOG, 263*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_SHADE_MODEL, 264*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_POINT_PARAMETERS, 265*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_ALPHA_TEST, 266*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_LOGIC_OP, 267*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_CLIP_PLANES, 268*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_HINT_SETTING, 269*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_PROGRAM, 270*8975f5c5SAndroid Build Coastguard Worker DIRTY_GLES1_MAX, 271*8975f5c5SAndroid Build Coastguard Worker }; 272*8975f5c5SAndroid Build Coastguard Worker setAllDirty()273*8975f5c5SAndroid Build Coastguard Worker void setAllDirty() { mDirtyBits.set(); } 274*8975f5c5SAndroid Build Coastguard Worker 275*8975f5c5SAndroid Build Coastguard Worker private: 276*8975f5c5SAndroid Build Coastguard Worker friend class PrivateState; 277*8975f5c5SAndroid Build Coastguard Worker friend class GLES1Renderer; 278*8975f5c5SAndroid Build Coastguard Worker 279*8975f5c5SAndroid Build Coastguard Worker // Back pointer for reading from State. 280*8975f5c5SAndroid Build Coastguard Worker const PrivateState *mGLState; 281*8975f5c5SAndroid Build Coastguard Worker 282*8975f5c5SAndroid Build Coastguard Worker using DirtyBits = angle::BitSet<DIRTY_GLES1_MAX>; 283*8975f5c5SAndroid Build Coastguard Worker DirtyBits mDirtyBits; 284*8975f5c5SAndroid Build Coastguard Worker setDirty(DirtyGles1Type type)285*8975f5c5SAndroid Build Coastguard Worker void setDirty(DirtyGles1Type type) { mDirtyBits.set(type); } clearDirty()286*8975f5c5SAndroid Build Coastguard Worker void clearDirty() { mDirtyBits.reset(); } clearDirtyBits(const DirtyGles1Type & bitset)287*8975f5c5SAndroid Build Coastguard Worker void clearDirtyBits(const DirtyGles1Type &bitset) { mDirtyBits &= ~bitset; } isDirty(DirtyGles1Type type)288*8975f5c5SAndroid Build Coastguard Worker bool isDirty(DirtyGles1Type type) const { return mDirtyBits.test(type); } 289*8975f5c5SAndroid Build Coastguard Worker 290*8975f5c5SAndroid Build Coastguard Worker // All initial state values come from the 291*8975f5c5SAndroid Build Coastguard Worker // OpenGL ES 1.1 spec. 292*8975f5c5SAndroid Build Coastguard Worker std::vector<angle::PackedEnumBitSet<TextureType>> mTexUnitEnables; 293*8975f5c5SAndroid Build Coastguard Worker 294*8975f5c5SAndroid Build Coastguard Worker // Table 6.4, 6.5 (IsEnabled) 295*8975f5c5SAndroid Build Coastguard Worker bool mVertexArrayEnabled; 296*8975f5c5SAndroid Build Coastguard Worker bool mNormalArrayEnabled; 297*8975f5c5SAndroid Build Coastguard Worker bool mColorArrayEnabled; 298*8975f5c5SAndroid Build Coastguard Worker bool mPointSizeArrayEnabled; 299*8975f5c5SAndroid Build Coastguard Worker std::vector<bool> mTexCoordArrayEnabled; 300*8975f5c5SAndroid Build Coastguard Worker 301*8975f5c5SAndroid Build Coastguard Worker // Table 6.7-6.16 (IsEnabled) 302*8975f5c5SAndroid Build Coastguard Worker bool mLineSmoothEnabled; 303*8975f5c5SAndroid Build Coastguard Worker bool mPointSmoothEnabled; 304*8975f5c5SAndroid Build Coastguard Worker bool mPointSpriteEnabled; 305*8975f5c5SAndroid Build Coastguard Worker bool mAlphaTestEnabled; 306*8975f5c5SAndroid Build Coastguard Worker bool mLogicOpEnabled; 307*8975f5c5SAndroid Build Coastguard Worker bool mLightingEnabled; 308*8975f5c5SAndroid Build Coastguard Worker bool mFogEnabled; 309*8975f5c5SAndroid Build Coastguard Worker bool mRescaleNormalEnabled; 310*8975f5c5SAndroid Build Coastguard Worker bool mNormalizeEnabled; 311*8975f5c5SAndroid Build Coastguard Worker bool mColorMaterialEnabled; 312*8975f5c5SAndroid Build Coastguard Worker bool mReflectionMapEnabled; 313*8975f5c5SAndroid Build Coastguard Worker 314*8975f5c5SAndroid Build Coastguard Worker // Table 6.3 315*8975f5c5SAndroid Build Coastguard Worker ColorF mCurrentColor; 316*8975f5c5SAndroid Build Coastguard Worker angle::Vector3 mCurrentNormal; 317*8975f5c5SAndroid Build Coastguard Worker // Invariant: mCurrentTextureCoords size is == GL_MAX_TEXTURE_UNITS. 318*8975f5c5SAndroid Build Coastguard Worker std::vector<TextureCoordF> mCurrentTextureCoords; 319*8975f5c5SAndroid Build Coastguard Worker 320*8975f5c5SAndroid Build Coastguard Worker // Table 6.4 321*8975f5c5SAndroid Build Coastguard Worker unsigned int mClientActiveTexture; 322*8975f5c5SAndroid Build Coastguard Worker 323*8975f5c5SAndroid Build Coastguard Worker // Table 6.7 324*8975f5c5SAndroid Build Coastguard Worker MatrixType mMatrixMode; 325*8975f5c5SAndroid Build Coastguard Worker MatrixStack mProjectionMatrices; 326*8975f5c5SAndroid Build Coastguard Worker MatrixStack mModelviewMatrices; 327*8975f5c5SAndroid Build Coastguard Worker std::vector<MatrixStack> mTextureMatrices; 328*8975f5c5SAndroid Build Coastguard Worker 329*8975f5c5SAndroid Build Coastguard Worker // Table 6.15 330*8975f5c5SAndroid Build Coastguard Worker using TextureEnvironments = std::vector<TextureEnvironmentParameters>; 331*8975f5c5SAndroid Build Coastguard Worker TextureEnvironments mTextureEnvironments; 332*8975f5c5SAndroid Build Coastguard Worker 333*8975f5c5SAndroid Build Coastguard Worker // Table 6.9, 2.8 334*8975f5c5SAndroid Build Coastguard Worker MaterialParameters mMaterial; 335*8975f5c5SAndroid Build Coastguard Worker LightModelParameters mLightModel; 336*8975f5c5SAndroid Build Coastguard Worker 337*8975f5c5SAndroid Build Coastguard Worker // Table 6.10 338*8975f5c5SAndroid Build Coastguard Worker std::vector<LightParameters> mLights; 339*8975f5c5SAndroid Build Coastguard Worker 340*8975f5c5SAndroid Build Coastguard Worker // Table 6.8 341*8975f5c5SAndroid Build Coastguard Worker FogParameters mFog; 342*8975f5c5SAndroid Build Coastguard Worker ShadingModel mShadeModel; 343*8975f5c5SAndroid Build Coastguard Worker 344*8975f5c5SAndroid Build Coastguard Worker // Table 6.11 345*8975f5c5SAndroid Build Coastguard Worker PointParameters mPointParameters; 346*8975f5c5SAndroid Build Coastguard Worker 347*8975f5c5SAndroid Build Coastguard Worker // Table 6.16 348*8975f5c5SAndroid Build Coastguard Worker AlphaTestParameters mAlphaTestParameters; 349*8975f5c5SAndroid Build Coastguard Worker LogicalOperation mLogicOp; 350*8975f5c5SAndroid Build Coastguard Worker 351*8975f5c5SAndroid Build Coastguard Worker // Table 6.7 352*8975f5c5SAndroid Build Coastguard Worker std::vector<ClipPlaneParameters> mClipPlanes; 353*8975f5c5SAndroid Build Coastguard Worker 354*8975f5c5SAndroid Build Coastguard Worker // Table 6.19 355*8975f5c5SAndroid Build Coastguard Worker HintSetting mLineSmoothHint; 356*8975f5c5SAndroid Build Coastguard Worker HintSetting mPointSmoothHint; 357*8975f5c5SAndroid Build Coastguard Worker HintSetting mPerspectiveCorrectionHint; 358*8975f5c5SAndroid Build Coastguard Worker HintSetting mFogHint; 359*8975f5c5SAndroid Build Coastguard Worker }; 360*8975f5c5SAndroid Build Coastguard Worker 361*8975f5c5SAndroid Build Coastguard Worker } // namespace gl 362*8975f5c5SAndroid Build Coastguard Worker 363*8975f5c5SAndroid Build Coastguard Worker #endif // LIBANGLE_GLES1STATE_H_ 364