|
|
|
|
@ -136,15 +136,27 @@ void AttributeTest::attributeScalar() {
|
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Generic); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Float); |
|
|
|
|
|
|
|
|
|
/* Options */ |
|
|
|
|
Attribute b(Attribute::DataType::UnsignedShort, Attribute::DataOption::Normalized); |
|
|
|
|
CORRADE_COMPARE(b.vectorSize(), 2); |
|
|
|
|
CORRADE_VERIFY(b.dataOptions() <= Attribute::DataOption::Normalized); |
|
|
|
|
|
|
|
|
|
DynamicAttribute db{b}; |
|
|
|
|
CORRADE_COMPARE(db.kind(), DynamicAttribute::Kind::GenericNormalized); |
|
|
|
|
CORRADE_COMPARE(db.location(), 3); |
|
|
|
|
CORRADE_COMPARE(db.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(db.dataType(), DynamicAttribute::DataType::UnsignedShort); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AttributeTest::attributeScalarInt() { |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
|
typedef Attribute<3, Int> Attribute; |
|
|
|
|
typedef Attribute<2, Int> Attribute; |
|
|
|
|
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Int>{})); |
|
|
|
|
CORRADE_COMPARE(Attribute::VectorCount, 1); |
|
|
|
|
|
|
|
|
|
@ -152,9 +164,21 @@ void AttributeTest::attributeScalarInt() {
|
|
|
|
|
Attribute a; |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(da.location(), 2); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Int); |
|
|
|
|
|
|
|
|
|
/* Options */ |
|
|
|
|
Attribute b(Attribute::DataType::Short); |
|
|
|
|
CORRADE_COMPARE(b.vectorSize(), 2); |
|
|
|
|
|
|
|
|
|
DynamicAttribute db{b}; |
|
|
|
|
CORRADE_COMPARE(db.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(db.location(), 2); |
|
|
|
|
CORRADE_COMPARE(db.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(db.dataType(), DynamicAttribute::DataType::Short); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); |
|
|
|
|
#endif |
|
|
|
|
@ -170,9 +194,21 @@ void AttributeTest::attributeScalarUnsignedInt() {
|
|
|
|
|
Attribute a; |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::UnsignedInt); |
|
|
|
|
|
|
|
|
|
/* Options */ |
|
|
|
|
Attribute b(Attribute::DataType::UnsignedByte); |
|
|
|
|
CORRADE_COMPARE(b.vectorSize(), 1); |
|
|
|
|
|
|
|
|
|
DynamicAttribute db{b}; |
|
|
|
|
CORRADE_COMPARE(db.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(db.location(), 3); |
|
|
|
|
CORRADE_COMPARE(db.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(db.dataType(), DynamicAttribute::DataType::UnsignedByte); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); |
|
|
|
|
#endif |
|
|
|
|
@ -187,6 +223,12 @@ void AttributeTest::attributeScalarDouble() {
|
|
|
|
|
/* Default constructor */ |
|
|
|
|
Attribute a; |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 8); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Long); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Double); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Double attributes are not available in OpenGL ES."); |
|
|
|
|
#endif |
|
|
|
|
@ -203,11 +245,23 @@ void AttributeTest::attributeVector() {
|
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 3*4); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Generic); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Three); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Float); |
|
|
|
|
|
|
|
|
|
/* Options */ |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
Attribute b(Attribute::Components::Two, Attribute::DataType::Double); |
|
|
|
|
CORRADE_COMPARE(b.components(), Attribute::Components::Two); |
|
|
|
|
CORRADE_COMPARE(b.vectorSize(), 2*8); |
|
|
|
|
|
|
|
|
|
DynamicAttribute db{b}; |
|
|
|
|
CORRADE_COMPARE(db.kind(), DynamicAttribute::Kind::Generic); |
|
|
|
|
CORRADE_COMPARE(db.location(), 3); |
|
|
|
|
CORRADE_COMPARE(db.components(), DynamicAttribute::Components::Two); |
|
|
|
|
CORRADE_COMPARE(db.dataType(), DynamicAttribute::DataType::Double); |
|
|
|
|
#else |
|
|
|
|
Attribute b(Attribute::Components::Two, Attribute::DataType::Float); |
|
|
|
|
CORRADE_COMPARE(b.components(), Attribute::Components::Two); |
|
|
|
|
@ -227,9 +281,21 @@ void AttributeTest::attributeVectorInt() {
|
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 2*4); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Int); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Two); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Int); |
|
|
|
|
|
|
|
|
|
/* Options */ |
|
|
|
|
Attribute b(Attribute::Components::One, Attribute::DataType::Int); |
|
|
|
|
CORRADE_COMPARE(b.vectorSize(), 4); |
|
|
|
|
|
|
|
|
|
DynamicAttribute db{b}; |
|
|
|
|
CORRADE_COMPARE(db.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(db.location(), 3); |
|
|
|
|
CORRADE_COMPARE(db.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(db.dataType(), DynamicAttribute::DataType::Int); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); |
|
|
|
|
#endif |
|
|
|
|
@ -247,9 +313,21 @@ void AttributeTest::attributeVectorUnsignedInt() {
|
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4*4); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::UnsignedInt); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Four); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::UnsignedInt); |
|
|
|
|
|
|
|
|
|
/* Options */ |
|
|
|
|
Attribute b(Attribute::Components::Three, Attribute::DataType::UnsignedShort); |
|
|
|
|
CORRADE_COMPARE(b.vectorSize(), 3*2); |
|
|
|
|
|
|
|
|
|
DynamicAttribute db{b}; |
|
|
|
|
CORRADE_COMPARE(db.kind(), DynamicAttribute::Kind::Integral); |
|
|
|
|
CORRADE_COMPARE(db.location(), 3); |
|
|
|
|
CORRADE_COMPARE(db.components(), DynamicAttribute::Components::Three); |
|
|
|
|
CORRADE_COMPARE(db.dataType(), DynamicAttribute::DataType::UnsignedShort); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); |
|
|
|
|
#endif |
|
|
|
|
@ -267,9 +345,21 @@ void AttributeTest::attributeVectorDouble() {
|
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 2*8); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Double); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Long); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Two); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Double); |
|
|
|
|
|
|
|
|
|
/* Options */ |
|
|
|
|
Attribute b(Attribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(b.vectorSize(), 8); |
|
|
|
|
|
|
|
|
|
DynamicAttribute db{b}; |
|
|
|
|
CORRADE_COMPARE(db.kind(), DynamicAttribute::Kind::Long); |
|
|
|
|
CORRADE_COMPARE(db.location(), 3); |
|
|
|
|
CORRADE_COMPARE(db.components(), DynamicAttribute::Components::One); |
|
|
|
|
CORRADE_COMPARE(db.dataType(), DynamicAttribute::DataType::Double); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Double attributes are not available in OpenGL ES."); |
|
|
|
|
#endif |
|
|
|
|
@ -284,6 +374,12 @@ void AttributeTest::attributeVector4() {
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
Attribute a(Attribute::DataType::UnsignedInt2101010Rev); |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Generic); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Four); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::UnsignedInt2101010Rev); |
|
|
|
|
#elif !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) |
|
|
|
|
Attribute a(Attribute::DataType::HalfFloat); |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 8); |
|
|
|
|
@ -302,6 +398,12 @@ void AttributeTest::attributeVectorBGRA() {
|
|
|
|
|
/* BGRA */ |
|
|
|
|
Attribute a(Attribute::Components::BGRA); |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4*4); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Generic); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::BGRA); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Float); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("BGRA attribute component ordering is not available in OpenGL ES."); |
|
|
|
|
#endif |
|
|
|
|
@ -317,6 +419,12 @@ void AttributeTest::attributeMatrixNxN() {
|
|
|
|
|
CORRADE_COMPARE(a.components(), Attribute::Components::Three); |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 3*4); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Generic); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Three); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Float); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
|
@ -330,6 +438,12 @@ void AttributeTest::attributeMatrixMxN() {
|
|
|
|
|
CORRADE_COMPARE(a.components(), Attribute::Components::Four); |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4*4); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Generic); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Four); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Float); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
@ -344,6 +458,12 @@ void AttributeTest::attributeMatrixNxNd() {
|
|
|
|
|
CORRADE_COMPARE(a.components(), Attribute::Components::Four); |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 4*8); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Double); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Long); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Four); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Double); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Double attributes are not available in OpenGL ES."); |
|
|
|
|
#endif |
|
|
|
|
@ -360,6 +480,12 @@ void AttributeTest::attributeMatrixMxNd() {
|
|
|
|
|
CORRADE_COMPARE(a.components(), Attribute::Components::Two); |
|
|
|
|
CORRADE_COMPARE(a.vectorSize(), 2*8); |
|
|
|
|
CORRADE_COMPARE(a.dataType(), Attribute::DataType::Double); |
|
|
|
|
|
|
|
|
|
DynamicAttribute da{a}; |
|
|
|
|
CORRADE_COMPARE(da.kind(), DynamicAttribute::Kind::Long); |
|
|
|
|
CORRADE_COMPARE(da.location(), 3); |
|
|
|
|
CORRADE_COMPARE(da.components(), DynamicAttribute::Components::Two); |
|
|
|
|
CORRADE_COMPARE(da.dataType(), DynamicAttribute::DataType::Double); |
|
|
|
|
#else |
|
|
|
|
CORRADE_SKIP("Double attributes are not available in OpenGL ES."); |
|
|
|
|
#endif |
|
|
|
|
|