diff options
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/angletypes.cpp')
-rw-r--r-- | src/3rdparty/angle/src/libANGLE/angletypes.cpp | 187 |
1 files changed, 43 insertions, 144 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/angletypes.cpp b/src/3rdparty/angle/src/libANGLE/angletypes.cpp index 16879f8041..fa5b157906 100644 --- a/src/3rdparty/angle/src/libANGLE/angletypes.cpp +++ b/src/3rdparty/angle/src/libANGLE/angletypes.cpp @@ -15,17 +15,28 @@ namespace gl { -bool operator==(const Rectangle &a, const Rectangle &b) +PrimitiveType GetPrimitiveType(GLenum drawMode) { - return a.x == b.x && - a.y == b.y && - a.width == b.width && - a.height == b.height; -} - -bool operator!=(const Rectangle &a, const Rectangle &b) -{ - return !(a == b); + switch (drawMode) + { + case GL_POINTS: + return PRIMITIVE_POINTS; + case GL_LINES: + return PRIMITIVE_LINES; + case GL_LINE_STRIP: + return PRIMITIVE_LINE_STRIP; + case GL_LINE_LOOP: + return PRIMITIVE_LINE_LOOP; + case GL_TRIANGLES: + return PRIMITIVE_TRIANGLES; + case GL_TRIANGLE_STRIP: + return PRIMITIVE_TRIANGLE_STRIP; + case GL_TRIANGLE_FAN: + return PRIMITIVE_TRIANGLE_FAN; + default: + UNREACHABLE(); + return PRIMITIVE_TYPE_MAX; + } } SamplerState::SamplerState() @@ -35,47 +46,30 @@ SamplerState::SamplerState() wrapT(GL_REPEAT), wrapR(GL_REPEAT), maxAnisotropy(1.0f), - baseLevel(0), - maxLevel(1000), minLod(-1000.0f), maxLod(1000.0f), compareMode(GL_NONE), - compareFunc(GL_LEQUAL), - swizzleRed(GL_RED), - swizzleGreen(GL_GREEN), - swizzleBlue(GL_BLUE), - swizzleAlpha(GL_ALPHA) -{} - -bool SamplerState::swizzleRequired() const + compareFunc(GL_LEQUAL) { - return swizzleRed != GL_RED || swizzleGreen != GL_GREEN || - swizzleBlue != GL_BLUE || swizzleAlpha != GL_ALPHA; } -bool SamplerState::operator==(const SamplerState &other) const +TextureState::TextureState() + : swizzleRed(GL_RED), + swizzleGreen(GL_GREEN), + swizzleBlue(GL_BLUE), + swizzleAlpha(GL_ALPHA), + samplerState(), + baseLevel(0), + maxLevel(1000), + immutableFormat(false), + immutableLevels(0) { - return minFilter == other.minFilter && - magFilter == other.magFilter && - wrapS == other.wrapS && - wrapT == other.wrapT && - wrapR == other.wrapR && - maxAnisotropy == other.maxAnisotropy && - baseLevel == other.baseLevel && - maxLevel == other.maxLevel && - minLod == other.minLod && - maxLod == other.maxLod && - compareMode == other.compareMode && - compareFunc == other.compareFunc && - swizzleRed == other.swizzleRed && - swizzleGreen == other.swizzleGreen && - swizzleBlue == other.swizzleBlue && - swizzleAlpha == other.swizzleAlpha; } -bool SamplerState::operator!=(const SamplerState &other) const +bool TextureState::swizzleRequired() const { - return !(*this == other); + return swizzleRed != GL_RED || swizzleGreen != GL_GREEN || + swizzleBlue != GL_BLUE || swizzleAlpha != GL_ALPHA; } static void MinMax(int a, int b, int *minimum, int *maximum) @@ -128,119 +122,24 @@ bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *in } } -VertexFormat::VertexFormat() - : mType(GL_NONE), - mNormalized(GL_FALSE), - mComponents(0), - mPureInteger(false) -{} - -VertexFormat::VertexFormat(GLenum type, GLboolean normalized, GLuint components, bool pureInteger) - : mType(type), - mNormalized(normalized), - mComponents(components), - mPureInteger(pureInteger) -{ - // Float data can not be normalized, so ignore the user setting - if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED) - { - mNormalized = GL_FALSE; - } -} - -VertexFormat::VertexFormat(const VertexAttribute &attrib) - : mType(attrib.type), - mNormalized(attrib.normalized ? GL_TRUE : GL_FALSE), - mComponents(attrib.size), - mPureInteger(attrib.pureInteger) -{ - // Ensure we aren't initializing a vertex format which should be using - // the current-value type - ASSERT(attrib.enabled); - - // Float data can not be normalized, so ignore the user setting - if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED) - { - mNormalized = GL_FALSE; - } -} - -VertexFormat::VertexFormat(const VertexAttribute &attrib, GLenum currentValueType) - : mType(attrib.type), - mNormalized(attrib.normalized ? GL_TRUE : GL_FALSE), - mComponents(attrib.size), - mPureInteger(attrib.pureInteger) -{ - if (!attrib.enabled) - { - mType = currentValueType; - mNormalized = GL_FALSE; - mComponents = 4; - mPureInteger = (currentValueType != GL_FLOAT); - } - - // Float data can not be normalized, so ignore the user setting - if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED) - { - mNormalized = GL_FALSE; - } -} - -void VertexFormat::GetInputLayout(VertexFormat *inputLayout, - Program *program, - const State &state) -{ - const std::vector<VertexAttribute> &vertexAttributes = state.getVertexArray()->getVertexAttributes(); - for (unsigned int attributeIndex = 0; attributeIndex < vertexAttributes.size(); attributeIndex++) - { - int semanticIndex = program->getSemanticIndex(attributeIndex); - - if (semanticIndex != -1) - { - inputLayout[semanticIndex] = VertexFormat(vertexAttributes[attributeIndex], state.getVertexAttribCurrentValue(attributeIndex).Type); - } - } -} - -bool VertexFormat::operator==(const VertexFormat &other) const +bool Box::operator==(const Box &other) const { - return (mType == other.mType && - mComponents == other.mComponents && - mNormalized == other.mNormalized && - mPureInteger == other.mPureInteger ); + return (x == other.x && y == other.y && z == other.z && + width == other.width && height == other.height && depth == other.depth); } -bool VertexFormat::operator!=(const VertexFormat &other) const +bool Box::operator!=(const Box &other) const { return !(*this == other); } -bool VertexFormat::operator<(const VertexFormat& other) const -{ - if (mType != other.mType) - { - return mType < other.mType; - } - if (mNormalized != other.mNormalized) - { - return mNormalized < other.mNormalized; - } - if (mComponents != other.mComponents) - { - return mComponents < other.mComponents; - } - return mPureInteger < other.mPureInteger; -} - -bool Box::operator==(const Box &other) const +bool operator==(const Extents &lhs, const Extents &rhs) { - return (x == other.x && y == other.y && z == other.z && - width == other.width && height == other.height && depth == other.depth); + return lhs.width == rhs.width && lhs.height == rhs.height && lhs.depth == rhs.depth; } -bool Box::operator!=(const Box &other) const +bool operator!=(const Extents &lhs, const Extents &rhs) { - return !(*this == other); + return !(lhs == rhs); } - } |