@ -39,7 +39,7 @@ struct PhongTest: TestSuite::Tester {
void drawUniformConstructDefault ( ) ;
void drawUniformConstructDefault ( ) ;
void drawUniformConstructNoInit ( ) ;
void drawUniformConstructNoInit ( ) ;
void drawUniformSetters ( ) ;
void drawUniformSetters ( ) ;
void drawUniformMaterialId Packing ( ) ;
void drawUniformPacking ( ) ;
void materialUniformConstructDefault ( ) ;
void materialUniformConstructDefault ( ) ;
void materialUniformConstructNoInit ( ) ;
void materialUniformConstructNoInit ( ) ;
@ -58,7 +58,7 @@ PhongTest::PhongTest() {
& PhongTest : : drawUniformConstructDefault ,
& PhongTest : : drawUniformConstructDefault ,
& PhongTest : : drawUniformConstructNoInit ,
& PhongTest : : drawUniformConstructNoInit ,
& PhongTest : : drawUniformSetters ,
& PhongTest : : drawUniformSetters ,
& PhongTest : : drawUniformMaterialId Packing ,
& PhongTest : : drawUniformPacking ,
& PhongTest : : materialUniformConstructDefault ,
& PhongTest : : materialUniformConstructDefault ,
& PhongTest : : materialUniformConstructNoInit ,
& PhongTest : : materialUniformConstructNoInit ,
@ -115,8 +115,8 @@ void PhongTest::drawUniformConstructDefault() {
CORRADE_COMPARE ( b . objectId , 0 ) ;
CORRADE_COMPARE ( b . objectId , 0 ) ;
CORRADE_COMPARE ( a . lightOffset , 0 ) ;
CORRADE_COMPARE ( a . lightOffset , 0 ) ;
CORRADE_COMPARE ( b . lightOffset , 0 ) ;
CORRADE_COMPARE ( b . lightOffset , 0 ) ;
CORRADE_COMPARE ( a . lightCount , 0xffffffff u ) ;
CORRADE_COMPARE ( a . lightCount , 0xffffu ) ;
CORRADE_COMPARE ( b . lightCount , 0xffffffff u ) ;
CORRADE_COMPARE ( b . lightCount , 0xffffu ) ;
constexpr PhongDrawUniform ca ;
constexpr PhongDrawUniform ca ;
constexpr PhongDrawUniform cb { DefaultInit } ;
constexpr PhongDrawUniform cb { DefaultInit } ;
@ -136,8 +136,8 @@ void PhongTest::drawUniformConstructDefault() {
CORRADE_COMPARE ( cb . objectId , 0 ) ;
CORRADE_COMPARE ( cb . objectId , 0 ) ;
CORRADE_COMPARE ( ca . lightOffset , 0 ) ;
CORRADE_COMPARE ( ca . lightOffset , 0 ) ;
CORRADE_COMPARE ( cb . lightOffset , 0 ) ;
CORRADE_COMPARE ( cb . lightOffset , 0 ) ;
CORRADE_COMPARE ( ca . lightCount , 0xffffffff u ) ;
CORRADE_COMPARE ( ca . lightCount , 0xffffu ) ;
CORRADE_COMPARE ( cb . lightCount , 0xffffffff u ) ;
CORRADE_COMPARE ( cb . lightCount , 0xffffu ) ;
CORRADE_VERIFY ( std : : is_nothrow_default_constructible < PhongDrawUniform > : : value ) ;
CORRADE_VERIFY ( std : : is_nothrow_default_constructible < PhongDrawUniform > : : value ) ;
CORRADE_VERIFY ( std : : is_nothrow_constructible < PhongDrawUniform , DefaultInitT > : : value ) ;
CORRADE_VERIFY ( std : : is_nothrow_constructible < PhongDrawUniform , DefaultInitT > : : value ) ;
@ -189,12 +189,20 @@ void PhongTest::drawUniformSetters() {
CORRADE_COMPARE ( a . lightCount , 13 ) ;
CORRADE_COMPARE ( a . lightCount , 13 ) ;
}
}
void PhongTest : : drawUniformMaterialId Packing ( ) {
void PhongTest : : drawUniformPacking ( ) {
PhongDrawUniform a ;
PhongDrawUniform a ;
a . setMaterialId ( 13765 ) ;
a . setMaterialId ( 13765 )
/* second 16 bits unused */
. setLightOffsetCount ( 13766 , 63573 ) ;
/* The normalMatrix field is 3x4 floats, materialId should be right after
/* The normalMatrix field is 3x4 floats, materialId should be right after
in the low 16 bits on both LE and BE */
in the low 16 bits on both LE and BE */
CORRADE_COMPARE ( reinterpret_cast < UnsignedInt * > ( & a ) [ 12 ] & 0xffff , 13765 ) ;
CORRADE_COMPARE ( reinterpret_cast < UnsignedInt * > ( & a ) [ 12 ] & 0xffff , 13765 ) ;
/* second 16 bits unused */
/* lightOffset should be in the low 16 bits on both LE and BE, lightCount
in the high */
CORRADE_COMPARE ( reinterpret_cast < UnsignedInt * > ( & a ) [ 14 ] & 0xffff , 13766 ) ;
CORRADE_COMPARE ( ( reinterpret_cast < UnsignedInt * > ( & a ) [ 14 ] > > 16 ) & 0xffff , 63573 ) ;
}
}
void PhongTest : : materialUniformConstructDefault ( ) {
void PhongTest : : materialUniformConstructDefault ( ) {