Commit dbb9c534 by Lingfeng Yang Committed by Commit Bot

GLES1: state: Define / initialize GLES1-specific states

Contains definitions of GLES1-specific states such as material / lighting. Tweaked the Color class for easier copying to uniforms / reading as a float array. This CL also adds the GLES1-specific state in GLES1State, which is then part of the State class and is initialized to the spec's values if the context major version is ES 1. + Some clang-format BUG=angleproject:2306 Change-Id: I7fc3bd9a22ebf0ffcd98d931d0176f21e17b1c5c Reviewed-on: https://chromium-review.googlesource.com/936424 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 92de2af5
...@@ -15,13 +15,16 @@ namespace angle ...@@ -15,13 +15,16 @@ namespace angle
template <typename T> template <typename T>
struct Color struct Color
{ {
Color();
Color(T r, T g, T b, T a);
const T *data() const { return &red; }
T *ptr() { return &red; }
T red; T red;
T green; T green;
T blue; T blue;
T alpha; T alpha;
Color();
Color(T r, T g, T b, T a);
}; };
template <typename T> template <typename T>
......
//
// Copyright 2018 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.
//
// GLES1State.cpp: Implements the GLES1State class, tracking state
// for GLES1 contexts.
#include "libANGLE/GLES1State.h"
#include "libANGLE/Context.h"
namespace gl
{
GLES1State::GLES1State()
: mVertexArrayEnabled(false),
mNormalArrayEnabled(false),
mColorArrayEnabled(false),
mPointSizeArrayEnabled(false),
mLineSmoothEnabled(false),
mPointSmoothEnabled(false),
mPointSpriteEnabled(false),
mAlphaTestEnabled(false),
mLogicOpEnabled(false),
mLightingEnabled(false),
mFogEnabled(false),
mRescaleNormalEnabled(false),
mNormalizeEnabled(false),
mColorMaterialEnabled(false),
mReflectionMapEnabled(false),
mCurrentColor({0.0f, 0.0f, 0.0f, 0.0f}),
mCurrentNormal({0.0f, 0.0f, 0.0f}),
mCurrMatrixMode(MatrixType::Modelview),
mShadeModel(ShadingModel::Smooth),
mAlphaFunc(AlphaTestFunc::AlwaysPass),
mAlphaTestRef(0.0f),
mLogicOp(LogicalOperation::Copy),
mLineSmoothHint(HintSetting::DontCare),
mPointSmoothHint(HintSetting::DontCare),
mPerspectiveCorrectionHint(HintSetting::DontCare),
mFogHint(HintSetting::DontCare)
{
}
GLES1State::~GLES1State() = default;
// Taken from the GLES 1.x spec which specifies all initial state values.
void GLES1State::initialize(const Context *context)
{
const Caps &caps = context->getCaps();
mTexUnitEnables.resize(caps.maxMultitextureUnits);
for (auto &enables : mTexUnitEnables)
{
enables.enable2D = false;
enables.enableCubeMap = false;
}
mVertexArrayEnabled = false;
mNormalArrayEnabled = false;
mColorArrayEnabled = false;
mPointSizeArrayEnabled = false;
mTexCoordArrayEnabled.resize(caps.maxMultitextureUnits, false);
mLineSmoothEnabled = false;
mPointSmoothEnabled = false;
mPointSpriteEnabled = false;
mLogicOpEnabled = false;
mAlphaTestEnabled = false;
mLightingEnabled = false;
mFogEnabled = false;
mRescaleNormalEnabled = false;
mNormalizeEnabled = false;
mColorMaterialEnabled = false;
mReflectionMapEnabled = false;
mCurrMatrixMode = MatrixType::Modelview;
mCurrentColor = {1.0f, 1.0f, 1.0f, 1.0f};
mCurrentNormal = {0.0f, 0.0f, 1.0f};
mCurrentTextureCoords.resize(caps.maxMultitextureUnits);
mTextureEnvironments.resize(caps.maxMultitextureUnits);
mProjMatrices.resize(caps.maxProjectionMatrixStackDepth);
mModelviewMatrices.resize(caps.maxModelviewMatrixStackDepth);
mTextureMatrices.resize(caps.maxMultitextureUnits);
for (auto &textureMatrixStack : mTextureMatrices)
{
textureMatrixStack.resize(caps.maxTextureMatrixStackDepth);
}
mMaterial.ambient = {0.2f, 0.2f, 0.2f, 1.0f};
mMaterial.diffuse = {0.8f, 0.8f, 0.8f, 1.0f};
mMaterial.specular = {0.0f, 0.0f, 0.0f, 1.0f};
mMaterial.emissive = {0.0f, 0.0f, 0.0f, 1.0f};
mMaterial.specularExponent = 0.0f;
mLightModel.color = {0.2f, 0.2f, 0.2f, 1.0f};
mLightModel.twoSided = false;
mLights.resize(caps.maxLights);
// GL_LIGHT0 is special and has default state that avoids all-black renderings.
mLights[0].diffuse = {1.0f, 1.0f, 1.0f, 1.0f};
mLights[0].specular = {1.0f, 1.0f, 1.0f, 1.0f};
mFog.mode = FogMode::Exp;
mFog.density = 1.0f;
mFog.start = 0.0f;
mFog.end = 1.0f;
mFog.color = {0.0f, 0.0f, 0.0f, 0.0f};
mShadeModel = ShadingModel::Smooth;
mAlphaFunc = AlphaTestFunc::AlwaysPass;
mAlphaTestRef = 0.0f;
mLogicOp = LogicalOperation::Copy;
mClipPlaneEnabled.resize(caps.maxClipPlanes, false);
mClipPlanes.resize(caps.maxClipPlanes, angle::Vector4(0.0f, 0.0f, 0.0f, 0.0f));
mPointParameters.pointSizeMin = 0.1f;
mPointParameters.pointSizeMax = 100.0f;
mPointParameters.pointFadeThresholdSize = 0.1f;
mPointParameters.pointDistanceAttenuation[0] = 1.0f;
mPointParameters.pointDistanceAttenuation[1] = 0.0f;
mPointParameters.pointDistanceAttenuation[2] = 0.0f;
mPointParameters.pointSize = 1.0f;
mLineSmoothHint = HintSetting::DontCare;
mPointSmoothHint = HintSetting::DontCare;
mPerspectiveCorrectionHint = HintSetting::DontCare;
mFogHint = HintSetting::DontCare;
}
} // namespace gl
//
// Copyright 2018 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.
//
// GLES1State.h: Defines the GLES1State class holding the state of
// a GLES1 context.
#ifndef LIBANGLE_GLES1STATE_H_
#define LIBANGLE_GLES1STATE_H_
#include <unordered_set>
#include "common/angleutils.h"
#include "common/matrix_utils.h"
#include "common/vector_utils.h"
#include "libANGLE/angletypes.h"
namespace gl
{
// State types specific to GLES1 contexts, from the OpenGL ES 1.1 spec "State Tables" section
struct TextureCoordF
{
GLfloat s = 0.0f;
GLfloat t = 0.0f;
GLfloat r = 0.0f;
GLfloat q = 0.0f;
};
struct MaterialParameters
{
ColorF ambient;
ColorF diffuse;
ColorF specular;
ColorF emissive;
GLfloat specularExponent;
};
struct LightModelParameters
{
ColorF color;
bool twoSided;
};
struct LightParameters
{
bool enabled = false;
ColorF ambient = {0.0f, 0.0f, 0.0f, 1.0f};
ColorF diffuse = {0.0f, 0.0f, 0.0f, 1.0f};
ColorF specular = {0.0f, 0.0f, 0.0f, 1.0f};
angle::Vector4 position = {0.0f, 0.0f, 1.0f, 0.0f};
angle::Vector3 direction = {0.0f, 0.0f, -1.0f};
GLfloat spotlightExponent = 0.0f;
GLfloat spotlightCutoffAngle = 180.0f;
GLfloat attenuationConst = 1.0f;
GLfloat attenuationLinear = 0.0f;
GLfloat attenuationQuadratic = 0.0f;
};
struct FogParameters
{
FogMode mode;
GLfloat density;
GLfloat start;
GLfloat end;
ColorF color;
};
struct TextureEnvironmentParameters
{
TextureEnvMode envMode = TextureEnvMode::Modulate;
TextureCombine combineRgb = TextureCombine::Modulate;
TextureCombine combineAlpha = TextureCombine::Modulate;
TextureSrc src0rgb = TextureSrc::Texture;
TextureSrc src0alpha = TextureSrc::Texture;
TextureSrc src1rgb = TextureSrc::Previous;
TextureSrc src1alpha = TextureSrc::Previous;
TextureSrc src2rgb = TextureSrc::Constant;
TextureSrc src2alpha = TextureSrc::Constant;
TextureOp op0rgb = TextureOp::SrcColor;
TextureOp op0alpha = TextureOp::SrcAlpha;
TextureOp op1rgb = TextureOp::SrcColor;
TextureOp op1alpha = TextureOp::SrcAlpha;
TextureOp op2rgb = TextureOp::SrcAlpha;
TextureOp op2alpha = TextureOp::SrcAlpha;
ColorF envColor = {0.0f, 0.0f, 0.0f, 0.0f};
GLfloat rgbScale = 1.0f;
GLfloat alphaScale = 1.0f;
bool pointSpriteCoordReplace = false;
};
struct PointParameters
{
GLfloat pointSizeMin;
GLfloat pointSizeMax;
GLfloat pointFadeThresholdSize;
angle::Vector3 pointDistanceAttenuation;
GLfloat pointSize;
};
class Context;
class GLES1State final : angle::NonCopyable
{
public:
GLES1State();
~GLES1State();
void initialize(const Context *context);
private:
// All initial state values come from the
// OpenGL ES 1.1 spec.
struct TextureEnables
{
bool enable2D = false;
bool enableCubeMap = false;
};
std::vector<TextureEnables> mTexUnitEnables;
// Table 6.4, 6.5 (IsEnabled)
bool mVertexArrayEnabled;
bool mNormalArrayEnabled;
bool mColorArrayEnabled;
bool mPointSizeArrayEnabled;
std::vector<bool> mTexCoordArrayEnabled;
// Table 6.7-6.16 (IsEnabled)
std::vector<bool> mClipPlaneEnabled;
bool mLineSmoothEnabled;
bool mPointSmoothEnabled;
bool mPointSpriteEnabled;
bool mAlphaTestEnabled;
bool mLogicOpEnabled;
bool mLightingEnabled;
bool mFogEnabled;
bool mRescaleNormalEnabled;
bool mNormalizeEnabled;
bool mColorMaterialEnabled;
bool mReflectionMapEnabled;
// Table 6.3
ColorF mCurrentColor;
angle::Vector3 mCurrentNormal;
std::vector<TextureCoordF> mCurrentTextureCoords;
// Table 6.7
using MatrixStack = std::vector<angle::Mat4>;
MatrixType mCurrMatrixMode;
MatrixStack mProjMatrices;
MatrixStack mModelviewMatrices;
std::vector<MatrixStack> mTextureMatrices;
// Table 6.15
using TextureEnvironments = std::vector<TextureEnvironmentParameters>;
TextureEnvironments mTextureEnvironments;
// Table 6.9, 2.8
MaterialParameters mMaterial;
LightModelParameters mLightModel;
// Table 6.10
std::vector<LightParameters> mLights;
// Table 6.8
FogParameters mFog;
ShadingModel mShadeModel;
// Table 6.11
PointParameters mPointParameters;
// Table 6.16
AlphaTestFunc mAlphaFunc;
GLfloat mAlphaTestRef;
LogicalOperation mLogicOp;
// Table 6.7
std::vector<angle::Vector4> mClipPlanes;
// Table 6.19
HintSetting mLineSmoothHint;
HintSetting mPointSmoothHint;
HintSetting mPerspectiveCorrectionHint;
HintSetting mFogHint;
};
} // namespace gl
#endif // LIBANGLE_GLES1STATE_H_
...@@ -22,6 +22,25 @@ namespace gl ...@@ -22,6 +22,25 @@ namespace gl
template <typename Enum> template <typename Enum>
Enum FromGLenum(GLenum from); Enum FromGLenum(GLenum from);
enum class AlphaTestFunc : uint8_t
{
AlwaysPass = 0,
Equal = 1,
Gequal = 2,
Greater = 3,
Lequal = 4,
Less = 5,
Never = 6,
NotEqual = 7,
InvalidEnum = 8,
EnumCount = 8,
};
template <>
AlphaTestFunc FromGLenum<AlphaTestFunc>(GLenum from);
GLenum ToGLenum(AlphaTestFunc from);
enum class BufferBinding : uint8_t enum class BufferBinding : uint8_t
{ {
Array = 0, Array = 0,
...@@ -79,6 +98,154 @@ template <> ...@@ -79,6 +98,154 @@ template <>
CullFaceMode FromGLenum<CullFaceMode>(GLenum from); CullFaceMode FromGLenum<CullFaceMode>(GLenum from);
GLenum ToGLenum(CullFaceMode from); GLenum ToGLenum(CullFaceMode from);
enum class FogMode : uint8_t
{
Exp = 0,
Exp2 = 1,
Linear = 2,
InvalidEnum = 3,
EnumCount = 3,
};
template <>
FogMode FromGLenum<FogMode>(GLenum from);
GLenum ToGLenum(FogMode from);
enum class HintSetting : uint8_t
{
DontCare = 0,
Fastest = 1,
Nicest = 2,
InvalidEnum = 3,
EnumCount = 3,
};
template <>
HintSetting FromGLenum<HintSetting>(GLenum from);
GLenum ToGLenum(HintSetting from);
enum class LogicalOperation : uint8_t
{
And = 0,
AndInverted = 1,
AndReverse = 2,
Clear = 3,
Copy = 4,
CopyInverted = 5,
Equiv = 6,
Invert = 7,
Nand = 8,
Noop = 9,
Nor = 10,
Or = 11,
OrInverted = 12,
OrReverse = 13,
Set = 14,
Xor = 15,
InvalidEnum = 16,
EnumCount = 16,
};
template <>
LogicalOperation FromGLenum<LogicalOperation>(GLenum from);
GLenum ToGLenum(LogicalOperation from);
enum class MatrixType : uint8_t
{
Modelview = 0,
Projection = 1,
Texture = 2,
InvalidEnum = 3,
EnumCount = 3,
};
template <>
MatrixType FromGLenum<MatrixType>(GLenum from);
GLenum ToGLenum(MatrixType from);
enum class ShadingModel : uint8_t
{
Flat = 0,
Smooth = 1,
InvalidEnum = 2,
EnumCount = 2,
};
template <>
ShadingModel FromGLenum<ShadingModel>(GLenum from);
GLenum ToGLenum(ShadingModel from);
enum class TextureCombine : uint8_t
{
Add = 0,
AddSigned = 1,
Dot3Rgb = 2,
Dot3Rgba = 3,
Interpolate = 4,
Modulate = 5,
Replace = 6,
Subtract = 7,
InvalidEnum = 8,
EnumCount = 8,
};
template <>
TextureCombine FromGLenum<TextureCombine>(GLenum from);
GLenum ToGLenum(TextureCombine from);
enum class TextureEnvMode : uint8_t
{
Add = 0,
Blend = 1,
Combine = 2,
Decal = 3,
Modulate = 4,
Replace = 5,
InvalidEnum = 6,
EnumCount = 6,
};
template <>
TextureEnvMode FromGLenum<TextureEnvMode>(GLenum from);
GLenum ToGLenum(TextureEnvMode from);
enum class TextureOp : uint8_t
{
OneMinusSrcAlpha = 0,
OneMinusSrcColor = 1,
SrcAlpha = 2,
SrcColor = 3,
InvalidEnum = 4,
EnumCount = 4,
};
template <>
TextureOp FromGLenum<TextureOp>(GLenum from);
GLenum ToGLenum(TextureOp from);
enum class TextureSrc : uint8_t
{
Constant = 0,
Previous = 1,
PrimaryColor = 2,
Texture = 3,
InvalidEnum = 4,
EnumCount = 4,
};
template <>
TextureSrc FromGLenum<TextureSrc>(GLenum from);
GLenum ToGLenum(TextureSrc from);
enum class TextureTarget : uint8_t enum class TextureTarget : uint8_t
{ {
_2D = 0, _2D = 0,
...@@ -120,6 +287,22 @@ template <> ...@@ -120,6 +287,22 @@ template <>
TextureType FromGLenum<TextureType>(GLenum from); TextureType FromGLenum<TextureType>(GLenum from);
GLenum ToGLenum(TextureType from); GLenum ToGLenum(TextureType from);
enum class VertexArrayType : uint8_t
{
Color = 0,
Normal = 1,
PointSize = 2,
TextureCoord = 3,
Vertex = 4,
InvalidEnum = 5,
EnumCount = 5,
};
template <>
VertexArrayType FromGLenum<VertexArrayType>(GLenum from);
GLenum ToGLenum(VertexArrayType from);
} // namespace gl } // namespace gl
#endif // LIBANGLE_PACKEDGLENUMS_AUTOGEN_H_ #endif // LIBANGLE_PACKEDGLENUMS_AUTOGEN_H_
...@@ -238,6 +238,13 @@ void State::initialize(const Context *context, ...@@ -238,6 +238,13 @@ void State::initialize(const Context *context,
mRobustResourceInit = robustResourceInit; mRobustResourceInit = robustResourceInit;
mProgramBinaryCacheEnabled = programBinaryCacheEnabled; mProgramBinaryCacheEnabled = programBinaryCacheEnabled;
// GLES1 emulation: Initialize state for GLES1 if version
// applies
if (clientVersion < Version(2, 0))
{
mGLES1State.initialize(context);
}
} }
void State::reset(const Context *context) void State::reset(const Context *context)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "common/bitset_utils.h" #include "common/bitset_utils.h"
#include "libANGLE/Debug.h" #include "libANGLE/Debug.h"
#include "libANGLE/GLES1State.h"
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include "libANGLE/ProgramPipeline.h" #include "libANGLE/ProgramPipeline.h"
#include "libANGLE/RefCountObject.h" #include "libANGLE/RefCountObject.h"
...@@ -601,6 +602,10 @@ class State : public angle::ObserverInterface, angle::NonCopyable ...@@ -601,6 +602,10 @@ class State : public angle::ObserverInterface, angle::NonCopyable
// GL_ANGLE_program_cache_control // GL_ANGLE_program_cache_control
bool mProgramBinaryCacheEnabled; bool mProgramBinaryCacheEnabled;
// GLES1 emulation: state specific to GLES1
friend class GLES1State;
GLES1State mGLES1State;
DirtyBits mDirtyBits; DirtyBits mDirtyBits;
mutable DirtyObjects mDirtyObjects; mutable DirtyObjects mDirtyObjects;
mutable AttributesMask mDirtyCurrentValues; mutable AttributesMask mDirtyCurrentValues;
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
#ifndef LIBANGLE_ANGLETYPES_H_ #ifndef LIBANGLE_ANGLETYPES_H_
#define LIBANGLE_ANGLETYPES_H_ #define LIBANGLE_ANGLETYPES_H_
#include "common/Color.h"
#include "common/bitset_utils.h" #include "common/bitset_utils.h"
#include "common/vector_utils.h"
#include "libANGLE/Constants.h" #include "libANGLE/Constants.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/PackedGLEnums.h" #include "libANGLE/PackedGLEnums.h"
...@@ -75,12 +77,12 @@ bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *in ...@@ -75,12 +77,12 @@ bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *in
struct Offset struct Offset
{ {
Offset() : x(0), y(0), z(0) {}
Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) {}
int x; int x;
int y; int y;
int z; int z;
Offset() : x(0), y(0), z(0) { }
Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) { }
}; };
bool operator==(const Offset &a, const Offset &b); bool operator==(const Offset &a, const Offset &b);
...@@ -88,17 +90,17 @@ bool operator!=(const Offset &a, const Offset &b); ...@@ -88,17 +90,17 @@ bool operator!=(const Offset &a, const Offset &b);
struct Extents struct Extents
{ {
int width; Extents() : width(0), height(0), depth(0) {}
int height; Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) {}
int depth;
Extents() : width(0), height(0), depth(0) { }
Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) { }
Extents(const Extents &other) = default; Extents(const Extents &other) = default;
Extents &operator=(const Extents &other) = default; Extents &operator=(const Extents &other) = default;
bool empty() const { return (width * height * depth) == 0; } bool empty() const { return (width * height * depth) == 0; }
int width;
int height;
int depth;
}; };
bool operator==(const Extents &lhs, const Extents &rhs); bool operator==(const Extents &lhs, const Extents &rhs);
...@@ -106,18 +108,29 @@ bool operator!=(const Extents &lhs, const Extents &rhs); ...@@ -106,18 +108,29 @@ bool operator!=(const Extents &lhs, const Extents &rhs);
struct Box struct Box
{ {
Box() : x(0), y(0), z(0), width(0), height(0), depth(0) {}
Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in)
: x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in)
{
}
Box(const Offset &offset, const Extents &size)
: x(offset.x),
y(offset.y),
z(offset.z),
width(size.width),
height(size.height),
depth(size.depth)
{
}
bool operator==(const Box &other) const;
bool operator!=(const Box &other) const;
int x; int x;
int y; int y;
int z; int z;
int width; int width;
int height; int height;
int depth; int depth;
Box() : x(0), y(0), z(0), width(0), height(0), depth(0) { }
Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in) : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in) { }
Box(const Offset &offset, const Extents &size) : x(offset.x), y(offset.y), z(offset.z), width(size.width), height(size.height), depth(size.depth) { }
bool operator==(const Box &other) const;
bool operator!=(const Box &other) const;
}; };
struct RasterizerState final struct RasterizerState final
...@@ -336,12 +349,14 @@ namespace rx ...@@ -336,12 +349,14 @@ namespace rx
#if __has_feature(cxx_rtti) #if __has_feature(cxx_rtti)
#define ANGLE_HAS_DYNAMIC_CAST 1 #define ANGLE_HAS_DYNAMIC_CAST 1
#endif #endif
#elif !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI)) #elif !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && \
(!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || \
defined(__GXX_RTTI))
#define ANGLE_HAS_DYNAMIC_CAST 1 #define ANGLE_HAS_DYNAMIC_CAST 1
#endif #endif
#ifdef ANGLE_HAS_DYNAMIC_CAST #ifdef ANGLE_HAS_DYNAMIC_CAST
#define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != nullptr) #define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type>(obj) != nullptr)
#undef ANGLE_HAS_DYNAMIC_CAST #undef ANGLE_HAS_DYNAMIC_CAST
#else #else
#define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (obj != nullptr) #define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (obj != nullptr)
...@@ -351,15 +366,15 @@ namespace rx ...@@ -351,15 +366,15 @@ namespace rx
template <typename DestT, typename SrcT> template <typename DestT, typename SrcT>
inline DestT *GetAs(SrcT *src) inline DestT *GetAs(SrcT *src)
{ {
ASSERT(ANGLE_HAS_DYNAMIC_TYPE(DestT*, src)); ASSERT(ANGLE_HAS_DYNAMIC_TYPE(DestT *, src));
return static_cast<DestT*>(src); return static_cast<DestT *>(src);
} }
template <typename DestT, typename SrcT> template <typename DestT, typename SrcT>
inline const DestT *GetAs(const SrcT *src) inline const DestT *GetAs(const SrcT *src)
{ {
ASSERT(ANGLE_HAS_DYNAMIC_TYPE(const DestT*, src)); ASSERT(ANGLE_HAS_DYNAMIC_TYPE(const DestT *, src));
return static_cast<const DestT*>(src); return static_cast<const DestT *>(src);
} }
#undef ANGLE_HAS_DYNAMIC_TYPE #undef ANGLE_HAS_DYNAMIC_TYPE
...@@ -501,4 +516,4 @@ class ContextState; ...@@ -501,4 +516,4 @@ class ContextState;
} // namespace gl } // namespace gl
#endif // LIBANGLE_ANGLETYPES_H_ #endif // LIBANGLE_ANGLETYPES_H_
{ {
"AlphaTestFunc":
{
"Never": "GL_NEVER",
"AlwaysPass": "GL_ALWAYS",
"Less": "GL_LESS",
"Lequal": "GL_LEQUAL",
"Equal": "GL_EQUAL",
"Gequal": "GL_GEQUAL",
"Greater": "GL_GREATER",
"NotEqual": "GL_NOTEQUAL"
},
"BufferBinding": "BufferBinding":
{ {
"Array": "GL_ARRAY_BUFFER", "Array": "GL_ARRAY_BUFFER",
...@@ -32,6 +43,82 @@ ...@@ -32,6 +43,82 @@
"Front": "GL_FRONT", "Front": "GL_FRONT",
"FrontAndBack": "GL_FRONT_AND_BACK" "FrontAndBack": "GL_FRONT_AND_BACK"
}, },
"FogMode":
{
"Exp": "GL_EXP",
"Exp2": "GL_EXP2",
"Linear": "GL_LINEAR"
},
"HintSetting":
{
"DontCare" : "GL_DONT_CARE",
"Nicest" : "GL_NICEST",
"Fastest" : "GL_FASTEST"
},
"LogicalOperation":
{
"Clear" : "GL_CLEAR",
"And" : "GL_AND",
"AndReverse" : "GL_AND_REVERSE",
"Copy" : "GL_COPY",
"AndInverted" : "GL_AND_INVERTED",
"Noop" : "GL_NOOP",
"Xor" : "GL_XOR",
"Or" : "GL_OR",
"Nor" : "GL_NOR",
"Equiv" : "GL_EQUIV",
"Invert" : "GL_INVERT",
"OrReverse" : "GL_OR_REVERSE",
"CopyInverted" : "GL_COPY_INVERTED",
"OrInverted" : "GL_OR_INVERTED",
"Nand" : "GL_NAND",
"Set" : "GL_SET"
},
"MatrixType":
{
"Modelview" : "GL_MODELVIEW",
"Projection" : "GL_PROJECTION",
"Texture" : "GL_TEXTURE"
},
"ShadingModel":
{
"Flat" : "GL_FLAT",
"Smooth" : "GL_SMOOTH"
},
"TextureCombine":
{
"Replace" : "GL_REPLACE",
"Modulate" : "GL_MODULATE",
"Add" : "GL_ADD",
"AddSigned" : "GL_ADD_SIGNED",
"Interpolate" : "GL_INTERPOLATE",
"Subtract" : "GL_SUBTRACT",
"Dot3Rgb" : "GL_DOT3_RGB",
"Dot3Rgba" : "GL_DOT3_RGBA"
},
"TextureEnvMode":
{
"Replace" : "GL_REPLACE",
"Modulate" : "GL_MODULATE",
"Decal" : "GL_DECAL",
"Blend" : "GL_BLEND",
"Add" : "GL_ADD",
"Combine" : "GL_COMBINE"
},
"TextureOp":
{
"SrcColor" : "GL_SRC_COLOR",
"OneMinusSrcColor" : "GL_ONE_MINUS_SRC_COLOR",
"SrcAlpha" : "GL_SRC_ALPHA",
"OneMinusSrcAlpha" : "GL_ONE_MINUS_SRC_ALPHA"
},
"TextureSrc":
{
"Texture" : "GL_TEXTURE",
"Constant" : "GL_CONSTANT",
"PrimaryColor" : "GL_PRIMARY_COLOR",
"Previous" : "GL_PREVIOUS"
},
"TextureType": "TextureType":
[ [
{"name": "_2D", "gl_name": "GL_TEXTURE_2D", "value": 0}, {"name": "_2D", "gl_name": "GL_TEXTURE_2D", "value": 0},
...@@ -56,5 +143,13 @@ ...@@ -56,5 +143,13 @@
{"name": "CubeMapNegativeY", "gl_name": "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y", "value": 9}, {"name": "CubeMapNegativeY", "gl_name": "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y", "value": 9},
{"name": "CubeMapPositiveZ", "gl_name": "GL_TEXTURE_CUBE_MAP_POSITIVE_Z", "value": 10}, {"name": "CubeMapPositiveZ", "gl_name": "GL_TEXTURE_CUBE_MAP_POSITIVE_Z", "value": 10},
{"name": "CubeMapNegativeZ", "gl_name": "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z", "value": 11} {"name": "CubeMapNegativeZ", "gl_name": "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z", "value": 11}
] ],
"VertexArrayType":
{
"Vertex" : "GL_VERTEX_ARRAY",
"Normal" : "GL_NORMAL_ARRAY",
"Color" : "GL_COLOR_ARRAY",
"PointSize" : "GL_POINT_SIZE_ARRAY_OES",
"TextureCoord" : "GL_TEXTURE_COORD_ARRAY"
}
} }
...@@ -165,6 +165,7 @@ ...@@ -165,6 +165,7 @@
'libANGLE/Framebuffer.h', 'libANGLE/Framebuffer.h',
'libANGLE/FramebufferAttachment.cpp', 'libANGLE/FramebufferAttachment.cpp',
'libANGLE/FramebufferAttachment.h', 'libANGLE/FramebufferAttachment.h',
'libANGLE/GLES1State.cpp',
'libANGLE/HandleAllocator.cpp', 'libANGLE/HandleAllocator.cpp',
'libANGLE/HandleAllocator.h', 'libANGLE/HandleAllocator.h',
'libANGLE/HandleRangeAllocator.h', 'libANGLE/HandleRangeAllocator.h',
......
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