@ -86,7 +86,7 @@ struct FlatGLTest: GL::OpenGLTester {
template < UnsignedInt dimensions > void constructTextureTransformationNotTextured ( ) ;
template < UnsignedInt dimensions > void constructTextureTransformationNotTextured ( ) ;
# ifndef MAGNUM_TARGET_GLES2
# ifndef MAGNUM_TARGET_GLES2
template < UnsignedInt dimensions > void constructUniformBuffersZeroDraws ( ) ;
template < UnsignedInt dimensions > void constructUniformBuffersInvalid ( ) ;
# endif
# endif
# ifndef MAGNUM_TARGET_GLES2
# ifndef MAGNUM_TARGET_GLES2
@ -210,17 +210,31 @@ constexpr struct {
constexpr struct {
constexpr struct {
const char * name ;
const char * name ;
FlatGL2D : : Flags flags ;
FlatGL2D : : Flags flags ;
UnsignedInt drawCount ;
UnsignedInt materialCount , drawCount ;
} ConstructUniformBuffersData [ ] {
} ConstructUniformBuffersData [ ] {
{ " classic fallback " , { } , 1 } ,
{ " classic fallback " , { } , 1 , 1 } ,
{ " " , FlatGL2D : : Flag : : UniformBuffers , 1 } ,
{ " " , FlatGL2D : : Flag : : UniformBuffers , 1 , 1 } ,
/* SwiftShader has 256 uniform vectors at most, per-draw is 4+2 in 3D case
/* SwiftShader has 256 uniform vectors at most, per-draw is 4+1 in 3D case
and 3 + 2 in 2 D */
and 3 + 1 in 2 D , per - material 2 */
{ " multiple draws " , FlatGL2D : : Flag : : UniformBuffers , 42 } ,
{ " multiple materials, draws " , FlatGL2D : : Flag : : UniformBuffers , 8 , 48 } ,
{ " texture transformation " , FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : Textured | FlatGL2D : : Flag : : TextureTransformation , 1 } ,
{ " texture transformation " , FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : Textured | FlatGL2D : : Flag : : TextureTransformation , 1 , 1 } ,
{ " alpha mask " , FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : AlphaMask , 1 } ,
{ " alpha mask " , FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : AlphaMask , 1 , 1 } ,
{ " object ID " , FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : ObjectId , 1 } ,
{ " object ID " , FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : ObjectId , 1 , 1 } ,
{ " multidraw with all the things " , FlatGL2D : : Flag : : MultiDraw | FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured | FlatGL2D : : Flag : : AlphaMask | FlatGL2D : : Flag : : ObjectId | FlatGL2D : : Flag : : InstancedTextureOffset | FlatGL2D : : Flag : : InstancedTransformation | FlatGL2D : : Flag : : InstancedObjectId , 42 }
{ " multidraw with all the things " , FlatGL2D : : Flag : : MultiDraw | FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured | FlatGL2D : : Flag : : AlphaMask | FlatGL2D : : Flag : : ObjectId | FlatGL2D : : Flag : : InstancedTextureOffset | FlatGL2D : : Flag : : InstancedTransformation | FlatGL2D : : Flag : : InstancedObjectId , 8 , 48 }
} ;
# endif
# ifndef MAGNUM_TARGET_GLES2
constexpr struct {
const char * name ;
FlatGL2D : : Flags flags ;
UnsignedInt materialCount , drawCount ;
const char * message ;
} ConstructUniformBuffersInvalidData [ ] {
{ " zero draws " , FlatGL2D : : Flag : : UniformBuffers , 1 , 0 ,
" draw count can't be zero " } ,
{ " zero materials " , FlatGL2D : : Flag : : UniformBuffers , 0 , 1 ,
" material count can't be zero " } ,
} ;
} ;
# endif
# endif
@ -282,30 +296,30 @@ constexpr struct {
const char * expected2D ;
const char * expected2D ;
const char * expected3D ;
const char * expected3D ;
FlatGL2D : : Flags flags ;
FlatGL2D : : Flags flags ;
UnsignedInt drawCount ;
UnsignedInt materialCount , drawCount ;
UnsignedInt uniformIncrement ;
UnsignedInt uniformIncrement ;
Float maxThreshold , meanThreshold ;
Float maxThreshold , meanThreshold ;
} RenderMultiData [ ] {
} RenderMultiData [ ] {
{ " bind with offset, colored " , " multidraw2D.tga " , " multidraw3D.tga " ,
{ " bind with offset, colored " , " multidraw2D.tga " , " multidraw3D.tga " ,
{ } , 1 , 16 , 0.0f , 0.0f } ,
{ } , 1 , 1 , 1 6, 0.0f , 0.0f } ,
{ " bind with offset, textured " , " multidraw-textured2D.tga " , " multidraw-textured3D.tga " ,
{ " bind with offset, textured " , " multidraw-textured2D.tga " , " multidraw-textured3D.tga " ,
FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured ,
FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured ,
1 , 16 ,
1 , 1 , 1 6,
/* Minor differences on ARM Mali */
/* Minor differences on ARM Mali */
2.34f , 0.01f } ,
2.34f , 0.01f } ,
{ " draw offset, colored " , " multidraw2D.tga " , " multidraw3D.tga " ,
{ " draw offset, colored " , " multidraw2D.tga " , " multidraw3D.tga " ,
{ } ,
{ } ,
3 , 1 , 0.0f , 0.0f } ,
2 , 3 , 1 , 0.0f , 0.0f } ,
{ " draw offset, textured " , " multidraw-textured2D.tga " , " multidraw-textured3D.tga " ,
{ " draw offset, textured " , " multidraw-textured2D.tga " , " multidraw-textured3D.tga " ,
FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured ,
FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured ,
3 , 1 ,
2 , 3 , 1 ,
/* Minor differences on ARM Mali */
/* Minor differences on ARM Mali */
2.34f , 0.01f } ,
2.34f , 0.01f } ,
{ " multidraw, colored " , " multidraw2D.tga " , " multidraw3D.tga " ,
{ " multidraw, colored " , " multidraw2D.tga " , " multidraw3D.tga " ,
FlatGL2D : : Flag : : MultiDraw , 3 , 1 , 0.0f , 0.0f } ,
FlatGL2D : : Flag : : MultiDraw , 2 , 3 , 1 , 0.0f , 0.0f } ,
{ " multidraw, textured " , " multidraw-textured2D.tga " , " multidraw-textured3D.tga " ,
{ " multidraw, textured " , " multidraw-textured2D.tga " , " multidraw-textured3D.tga " ,
FlatGL2D : : Flag : : MultiDraw | FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured ,
FlatGL2D : : Flag : : MultiDraw | FlatGL2D : : Flag : : TextureTransformation | FlatGL2D : : Flag : : Textured ,
3 , 1 ,
2 , 3 , 1 ,
/* Minor differences on ARM Mali */
/* Minor differences on ARM Mali */
2.34f , 0.01f }
2.34f , 0.01f }
} ;
} ;
@ -334,12 +348,16 @@ FlatGLTest::FlatGLTest() {
# endif
# endif
& FlatGLTest : : constructTextureTransformationNotTextured < 2 > ,
& FlatGLTest : : constructTextureTransformationNotTextured < 2 > ,
& FlatGLTest : : constructTextureTransformationNotTextured < 3 > ,
& FlatGLTest : : constructTextureTransformationNotTextured < 3 > } ) ;
# ifndef MAGNUM_TARGET_GLES2
& FlatGLTest : : constructUniformBuffersZeroDraws < 2 > ,
& FlatGLTest : : constructUniformBuffersZeroDraws < 3 > ,
# endif
# ifndef MAGNUM_TARGET_GLES2
addInstancedTests < FlatGLTest > ( {
& FlatGLTest : : constructUniformBuffersInvalid < 2 > ,
& FlatGLTest : : constructUniformBuffersInvalid < 3 > } ,
Containers : : arraySize ( ConstructUniformBuffersInvalidData ) ) ;
# endif
addTests < FlatGLTest > ( {
# ifndef MAGNUM_TARGET_GLES2
# ifndef MAGNUM_TARGET_GLES2
& FlatGLTest : : setUniformUniformBuffersEnabled < 2 > ,
& FlatGLTest : : setUniformUniformBuffersEnabled < 2 > ,
& FlatGLTest : : setUniformUniformBuffersEnabled < 3 > ,
& FlatGLTest : : setUniformUniformBuffersEnabled < 3 > ,
@ -557,8 +575,9 @@ template<UnsignedInt dimensions> void FlatGLTest::constructUniformBuffers() {
# endif
# endif
}
}
FlatGL < dimensions > shader { data . flags , data . drawCount } ;
FlatGL < dimensions > shader { data . flags , data . materialCount , data . drawCount } ;
CORRADE_COMPARE ( shader . flags ( ) , data . flags ) ;
CORRADE_COMPARE ( shader . flags ( ) , data . flags ) ;
CORRADE_COMPARE ( shader . materialCount ( ) , data . materialCount ) ;
CORRADE_COMPARE ( shader . drawCount ( ) , data . drawCount ) ;
CORRADE_COMPARE ( shader . drawCount ( ) , data . drawCount ) ;
CORRADE_VERIFY ( shader . id ( ) ) ;
CORRADE_VERIFY ( shader . id ( ) ) ;
{
{
@ -602,7 +621,7 @@ template<UnsignedInt dimensions> void FlatGLTest::constructMoveUniformBuffers()
CORRADE_SKIP ( GL : : Extensions : : ARB : : uniform_buffer_object : : string ( ) < < " is not supported. " ) ;
CORRADE_SKIP ( GL : : Extensions : : ARB : : uniform_buffer_object : : string ( ) < < " is not supported. " ) ;
# endif
# endif
FlatGL < dimensions > a { FlatGL < dimensions > : : Flag : : UniformBuffers , 5 } ;
FlatGL < dimensions > a { FlatGL < dimensions > : : Flag : : UniformBuffers , 2 , 5 } ;
const GLuint id = a . id ( ) ;
const GLuint id = a . id ( ) ;
CORRADE_VERIFY ( id ) ;
CORRADE_VERIFY ( id ) ;
@ -611,6 +630,7 @@ template<UnsignedInt dimensions> void FlatGLTest::constructMoveUniformBuffers()
FlatGL < dimensions > b { std : : move ( a ) } ;
FlatGL < dimensions > b { std : : move ( a ) } ;
CORRADE_COMPARE ( b . id ( ) , id ) ;
CORRADE_COMPARE ( b . id ( ) , id ) ;
CORRADE_COMPARE ( b . flags ( ) , FlatGL < dimensions > : : Flag : : UniformBuffers ) ;
CORRADE_COMPARE ( b . flags ( ) , FlatGL < dimensions > : : Flag : : UniformBuffers ) ;
CORRADE_COMPARE ( b . materialCount ( ) , 2 ) ;
CORRADE_COMPARE ( b . drawCount ( ) , 5 ) ;
CORRADE_COMPARE ( b . drawCount ( ) , 5 ) ;
CORRADE_VERIFY ( ! a . id ( ) ) ;
CORRADE_VERIFY ( ! a . id ( ) ) ;
@ -618,6 +638,7 @@ template<UnsignedInt dimensions> void FlatGLTest::constructMoveUniformBuffers()
c = std : : move ( b ) ;
c = std : : move ( b ) ;
CORRADE_COMPARE ( c . id ( ) , id ) ;
CORRADE_COMPARE ( c . id ( ) , id ) ;
CORRADE_COMPARE ( c . flags ( ) , FlatGL < dimensions > : : Flag : : UniformBuffers ) ;
CORRADE_COMPARE ( c . flags ( ) , FlatGL < dimensions > : : Flag : : UniformBuffers ) ;
CORRADE_COMPARE ( c . materialCount ( ) , 2 ) ;
CORRADE_COMPARE ( c . drawCount ( ) , 5 ) ;
CORRADE_COMPARE ( c . drawCount ( ) , 5 ) ;
CORRADE_VERIFY ( ! b . id ( ) ) ;
CORRADE_VERIFY ( ! b . id ( ) ) ;
}
}
@ -638,8 +659,10 @@ template<UnsignedInt dimensions> void FlatGLTest::constructTextureTransformation
}
}
# ifndef MAGNUM_TARGET_GLES2
# ifndef MAGNUM_TARGET_GLES2
template < UnsignedInt dimensions > void FlatGLTest : : constructUniformBuffersZeroDraws ( ) {
template < UnsignedInt dimensions > void FlatGLTest : : constructUniformBuffersInvalid ( ) {
auto & & data = ConstructUniformBuffersInvalidData [ testCaseInstanceId ( ) ] ;
setTestCaseTemplateName ( std : : to_string ( dimensions ) ) ;
setTestCaseTemplateName ( std : : to_string ( dimensions ) ) ;
setTestCaseDescription ( data . name ) ;
# ifdef CORRADE_NO_ASSERT
# ifdef CORRADE_NO_ASSERT
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
@ -652,9 +675,9 @@ template<UnsignedInt dimensions> void FlatGLTest::constructUniformBuffersZeroDra
std : : ostringstream out ;
std : : ostringstream out ;
Error redirectError { & out } ;
Error redirectError { & out } ;
FlatGL < dimensions > { FlatGL < dimensions > : : Flag : : UniformBuffers , 0 } ;
FlatGL < dimensions > { data . flags , data . materialCount , data . drawCount } ;
CORRADE_COMPARE ( out . str ( ) ,
CORRADE_COMPARE ( out . str ( ) , Utility : : formatString (
" Shaders::FlatGL: draw count can't be zero \n " ) ;
" Shaders::FlatGL: {} \n " , data . message ) ) ;
}
}
# endif
# endif
@ -706,6 +729,8 @@ template<UnsignedInt dimensions> void FlatGLTest::bindBufferUniformBuffersNotEna
. bindDrawBuffer ( buffer , 0 , 16 )
. bindDrawBuffer ( buffer , 0 , 16 )
. bindTextureTransformationBuffer ( buffer )
. bindTextureTransformationBuffer ( buffer )
. bindTextureTransformationBuffer ( buffer , 0 , 16 )
. bindTextureTransformationBuffer ( buffer , 0 , 16 )
. bindMaterialBuffer ( buffer )
. bindMaterialBuffer ( buffer , 0 , 16 )
. setDrawOffset ( 0 ) ;
. setDrawOffset ( 0 ) ;
CORRADE_COMPARE ( out . str ( ) ,
CORRADE_COMPARE ( out . str ( ) ,
" Shaders::FlatGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled \n "
@ -714,6 +739,8 @@ template<UnsignedInt dimensions> void FlatGLTest::bindBufferUniformBuffersNotEna
" Shaders::FlatGL::bindDrawBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindDrawBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindTextureTransformationBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindTextureTransformationBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindTextureTransformationBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindTextureTransformationBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindMaterialBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::bindMaterialBuffer(): the shader was not created with uniform buffers enabled \n "
" Shaders::FlatGL::setDrawOffset(): the shader was not created with uniform buffers enabled \n " ) ;
" Shaders::FlatGL::setDrawOffset(): the shader was not created with uniform buffers enabled \n " ) ;
}
}
# endif
# endif
@ -829,7 +856,7 @@ template<UnsignedInt dimensions> void FlatGLTest::setWrongDrawOffset() {
std : : ostringstream out ;
std : : ostringstream out ;
Error redirectError { & out } ;
Error redirectError { & out } ;
FlatGL < dimensions > { FlatGL < dimensions > : : Flag : : UniformBuffers , 5 }
FlatGL < dimensions > { FlatGL < dimensions > : : Flag : : UniformBuffers , 2 , 5 }
. setDrawOffset ( 5 ) ;
. setDrawOffset ( 5 ) ;
CORRADE_COMPARE ( out . str ( ) ,
CORRADE_COMPARE ( out . str ( ) ,
" Shaders::FlatGL::setDrawOffset(): draw offset 5 is out of bounds for 5 draws \n " ) ;
" Shaders::FlatGL::setDrawOffset(): draw offset 5 is out of bounds for 5 draws \n " ) ;
@ -890,9 +917,13 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderDefaults2D() {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
} } ;
shader
shader
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
}
}
# endif
# endif
@ -939,9 +970,13 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderDefaults3D() {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
} } ;
shader
shader
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( sphere ) ;
. draw ( sphere ) ;
}
}
# endif
# endif
@ -991,11 +1026,15 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderColored2D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
. setColor ( 0x9999ff _rgbf )
} } ;
} } ;
shader
shader
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
}
}
# endif
# endif
@ -1059,11 +1098,15 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderColored3D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
. setColor ( 0x9999ff _rgbf )
} } ;
} } ;
shader
shader
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( sphere ) ;
. draw ( sphere ) ;
}
}
# endif
# endif
@ -1144,8 +1187,12 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderSinglePixelTextured2D() {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
}
}
# endif
# endif
@ -1221,8 +1268,12 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderSinglePixelTextured3D() {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( sphere ) ;
. draw ( sphere ) ;
}
}
# endif
# endif
@ -1302,16 +1353,20 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderTextured2D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
. setColor ( 0x9999ff _rgbf )
} } ;
} } ;
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
TextureTransformationUniform { }
TextureTransformationUniform { }
. setTextureMatrix ( data . textureTransformation )
. setTextureMatrix ( data . textureTransformation )
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
} } ;
if ( data . flags & FlatGL2D : : Flag : : TextureTransformation )
if ( data . flags & FlatGL2D : : Flag : : TextureTransformation )
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
}
}
# endif
# endif
@ -1401,16 +1456,20 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderTextured3D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
. setColor ( 0x9999ff _rgbf )
} } ;
} } ;
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
TextureTransformationUniform { }
TextureTransformationUniform { }
. setTextureMatrix ( data . textureTransformation )
. setTextureMatrix ( data . textureTransformation )
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
} } ;
if ( data . flags & FlatGL3D : : Flag : : TextureTransformation )
if ( data . flags & FlatGL3D : : Flag : : TextureTransformation )
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( sphere ) ;
. draw ( sphere ) ;
}
}
# endif
# endif
@ -1496,10 +1555,14 @@ template<class T, FlatGL2D::Flag flag> void FlatGLTest::renderVertexColor2D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
. setColor ( 0x9999ff _rgbf )
} } ;
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
}
}
# endif
# endif
@ -1590,10 +1653,14 @@ template<class T, FlatGL2D::Flag flag> void FlatGLTest::renderVertexColor3D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
. setColor ( 0x9999ff _rgbf )
} } ;
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( sphere ) ;
. draw ( sphere ) ;
}
}
# endif
# endif
@ -1685,11 +1752,15 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderAlpha2D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
. setColor ( 0x9999ff _rgbf )
. setAlphaMask ( data . threshold )
. setAlphaMask ( data . threshold )
} } ;
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
}
}
# endif
# endif
@ -1782,11 +1853,15 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderAlpha3D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
. setColor ( 0x9999ff _rgbf )
. setAlphaMask ( data . threshold )
. setAlphaMask ( data . threshold )
} } ;
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform ) ;
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform ) ;
/* For proper Z order draw back faces first and then front faces */
/* For proper Z order draw back faces first and then front faces */
GL : : Renderer : : setFaceCullingMode ( GL : : Renderer : : PolygonFacing : : Front ) ;
GL : : Renderer : : setFaceCullingMode ( GL : : Renderer : : PolygonFacing : : Front ) ;
@ -1896,11 +1971,15 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderObjectId2D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
. setColor ( 0x9999ff _rgbf )
. setObjectId ( data . uniformId )
. setObjectId ( data . uniformId )
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
} else CORRADE_INTERNAL_ASSERT_UNREACHABLE ( ) ;
} else CORRADE_INTERNAL_ASSERT_UNREACHABLE ( ) ;
@ -1990,11 +2069,15 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderObjectId3D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
. setColor ( 0x9999ff _rgbf )
. setObjectId ( data . uniformId )
. setObjectId ( data . uniformId )
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0x9999ff _rgbf )
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( sphere ) ;
. draw ( sphere ) ;
} else CORRADE_INTERNAL_ASSERT_UNREACHABLE ( ) ;
} else CORRADE_INTERNAL_ASSERT_UNREACHABLE ( ) ;
@ -2127,15 +2210,19 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderInstanced2D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
. setColor ( 0xffff99 _rgbf )
} } ;
} } ;
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
TextureTransformationUniform { }
TextureTransformationUniform { }
. setTextureMatrix ( Matrix3 : : scaling ( Vector2 { 0.5f } ) )
. setTextureMatrix ( Matrix3 : : scaling ( Vector2 { 0.5f } ) )
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0xffff99 _rgbf )
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindTextureTransformationBuffer ( textureTransformationUniform )
. bindTextureTransformationBuffer ( textureTransformationUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( circle ) ;
. draw ( circle ) ;
}
}
# endif
# endif
@ -2251,15 +2338,19 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderInstanced3D() {
} } ;
} } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatDrawUniform { }
FlatDrawUniform { }
. setColor ( 0xffff99 _rgbf )
} } ;
} } ;
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , {
TextureTransformationUniform { }
TextureTransformationUniform { }
. setTextureMatrix ( Matrix3 : : scaling ( Vector2 { 0.5f } ) )
. setTextureMatrix ( Matrix3 : : scaling ( Vector2 { 0.5f } ) )
} } ;
} } ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , {
FlatMaterialUniform { }
. setColor ( 0xffff99 _rgbf )
} } ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform )
. bindDrawBuffer ( drawUniform )
. bindTextureTransformationBuffer ( textureTransformationUniform )
. bindTextureTransformationBuffer ( textureTransformationUniform )
. bindMaterialBuffer ( materialUniform )
. draw ( sphere ) ;
. draw ( sphere ) ;
}
}
# endif
# endif
@ -2344,6 +2435,15 @@ void FlatGLTest::renderMulti2D() {
The data . uniformIncrement is set high enough to ensure that , in the
The data . uniformIncrement is set high enough to ensure that , in the
non - offset - bind case this value is 1. */
non - offset - bind case this value is 1. */
Containers : : Array < FlatMaterialUniform > materialData { data . uniformIncrement + 1 } ;
materialData [ 0 * data . uniformIncrement ] = FlatMaterialUniform { }
. setColor ( data . flags & FlatGL2D : : Flag : : Textured ?
0xffffff _rgbf : 0x0000ff _rgbf ) ;
materialData [ 1 * data . uniformIncrement ] = FlatMaterialUniform { }
. setColor ( data . flags & FlatGL2D : : Flag : : Textured ?
0xffffff _rgbf : 0xff0000 _rgbf ) ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , materialData } ;
Containers : : Array < TransformationProjectionUniform2D > transformationProjectionData { 2 * data . uniformIncrement + 1 } ;
Containers : : Array < TransformationProjectionUniform2D > transformationProjectionData { 2 * data . uniformIncrement + 1 } ;
transformationProjectionData [ 0 * data . uniformIncrement ] = TransformationProjectionUniform2D { }
transformationProjectionData [ 0 * data . uniformIncrement ] = TransformationProjectionUniform2D { }
. setTransformationProjectionMatrix (
. setTransformationProjectionMatrix (
@ -2384,26 +2484,28 @@ void FlatGLTest::renderMulti2D() {
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , textureTransformationData } ;
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , textureTransformationData } ;
Containers : : Array < FlatDrawUniform > drawData { 2 * data . uniformIncrement + 1 } ;
Containers : : Array < FlatDrawUniform > drawData { 2 * data . uniformIncrement + 1 } ;
/* Material offsets are zero if we have single draw, as those are
done with UBO offset bindings instead . */
drawData [ 0 * data . uniformIncrement ] = FlatDrawUniform { }
drawData [ 0 * data . uniformIncrement ] = FlatDrawUniform { }
. setColor ( data . flags & FlatGL2D : : Flag : : Textured ?
. setMaterialId ( data . drawCount = = 1 ? 0 : 1 )
0xffffff _rgbf : 0xff0000 _rgbf )
. setObjectId ( 1211 ) ;
. setObjectId ( 1211 ) ;
drawData [ 1 * data . uniformIncrement ] = FlatDrawUniform { }
drawData [ 1 * data . uniformIncrement ] = FlatDrawUniform { }
. setColor ( data . flags & FlatGL2D : : Flag : : Textured ?
. setMaterialId ( data . drawCount = = 1 ? 0 : 0 )
0xffffff _rgbf : 0x0000ff _rgbf )
. setObjectId ( 5627 ) ;
. setObjectId ( 5627 ) ;
drawData [ 2 * data . uniformIncrement ] = FlatDrawUniform { }
drawData [ 2 * data . uniformIncrement ] = FlatDrawUniform { }
. setColor ( data . flags & FlatGL2D : : Flag : : Textured ?
. setMaterialId ( data . drawCount = = 1 ? 0 : 1 )
0xffffff _rgbf : 0xff0000 _rgbf )
. setObjectId ( 36363 ) ;
. setObjectId ( 36363 ) ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , drawData } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , drawData } ;
FlatGL2D shader { FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : ObjectId | data . flags , data . drawCount } ;
FlatGL2D shader { FlatGL2D : : Flag : : UniformBuffers | FlatGL2D : : Flag : : ObjectId | data . flags , data . materialCount , data . drawCount } ;
if ( data . flags & FlatGL2D : : Flag : : Textured )
if ( data . flags & FlatGL2D : : Flag : : Textured )
shader . bindTexture ( texture ) ;
shader . bindTexture ( texture ) ;
/* Just one draw, rebinding UBOs each time */
/* Just one draw, rebinding UBOs each time */
if ( data . drawCount = = 1 ) {
if ( data . drawCount = = 1 ) {
shader . bindMaterialBuffer ( materialUniform ,
1 * data . uniformIncrement * sizeof ( FlatMaterialUniform ) ,
sizeof ( FlatMaterialUniform ) ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
0 * data . uniformIncrement * sizeof ( TransformationProjectionUniform2D ) ,
0 * data . uniformIncrement * sizeof ( TransformationProjectionUniform2D ) ,
sizeof ( TransformationProjectionUniform2D ) ) ;
sizeof ( TransformationProjectionUniform2D ) ) ;
@ -2416,6 +2518,9 @@ void FlatGLTest::renderMulti2D() {
sizeof ( TextureTransformationUniform ) ) ;
sizeof ( TextureTransformationUniform ) ) ;
shader . draw ( circle ) ;
shader . draw ( circle ) ;
shader . bindMaterialBuffer ( materialUniform ,
0 * data . uniformIncrement * sizeof ( FlatMaterialUniform ) ,
sizeof ( FlatMaterialUniform ) ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
1 * data . uniformIncrement * sizeof ( TransformationProjectionUniform2D ) ,
1 * data . uniformIncrement * sizeof ( TransformationProjectionUniform2D ) ,
sizeof ( TransformationProjectionUniform2D ) ) ;
sizeof ( TransformationProjectionUniform2D ) ) ;
@ -2428,6 +2533,9 @@ void FlatGLTest::renderMulti2D() {
sizeof ( TextureTransformationUniform ) ) ;
sizeof ( TextureTransformationUniform ) ) ;
shader . draw ( square ) ;
shader . draw ( square ) ;
shader . bindMaterialBuffer ( materialUniform ,
1 * data . uniformIncrement * sizeof ( FlatMaterialUniform ) ,
sizeof ( FlatMaterialUniform ) ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
2 * data . uniformIncrement * sizeof ( TransformationProjectionUniform2D ) ,
2 * data . uniformIncrement * sizeof ( TransformationProjectionUniform2D ) ,
sizeof ( TransformationProjectionUniform2D ) ) ;
sizeof ( TransformationProjectionUniform2D ) ) ;
@ -2443,7 +2551,8 @@ void FlatGLTest::renderMulti2D() {
/* Otherwise using the draw offset / multidraw */
/* Otherwise using the draw offset / multidraw */
} else {
} else {
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform ) ;
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform ) ;
if ( data . flags & FlatGL2D : : Flag : : TextureTransformation )
if ( data . flags & FlatGL2D : : Flag : : TextureTransformation )
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;
@ -2565,6 +2674,15 @@ void FlatGLTest::renderMulti3D() {
The data . uniformIncrement is set high enough to ensure that , in the
The data . uniformIncrement is set high enough to ensure that , in the
non - offset - bind case this value is 1. */
non - offset - bind case this value is 1. */
Containers : : Array < FlatMaterialUniform > materialData { data . uniformIncrement + 1 } ;
materialData [ 0 * data . uniformIncrement ] = FlatMaterialUniform { }
. setColor ( data . flags & FlatGL2D : : Flag : : Textured ?
0xffffff _rgbf : 0x0000ff _rgbf ) ;
materialData [ 1 * data . uniformIncrement ] = FlatMaterialUniform { }
. setColor ( data . flags & FlatGL2D : : Flag : : Textured ?
0xffffff _rgbf : 0xff0000 _rgbf ) ;
GL : : Buffer materialUniform { GL : : Buffer : : TargetHint : : Uniform , materialData } ;
Containers : : Array < TransformationProjectionUniform3D > transformationProjectionData { 2 * data . uniformIncrement + 1 } ;
Containers : : Array < TransformationProjectionUniform3D > transformationProjectionData { 2 * data . uniformIncrement + 1 } ;
transformationProjectionData [ 0 * data . uniformIncrement ] = TransformationProjectionUniform3D { }
transformationProjectionData [ 0 * data . uniformIncrement ] = TransformationProjectionUniform3D { }
. setTransformationProjectionMatrix (
. setTransformationProjectionMatrix (
@ -2611,26 +2729,28 @@ void FlatGLTest::renderMulti3D() {
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , textureTransformationData } ;
GL : : Buffer textureTransformationUniform { GL : : Buffer : : TargetHint : : Uniform , textureTransformationData } ;
Containers : : Array < FlatDrawUniform > drawData { 2 * data . uniformIncrement + 1 } ;
Containers : : Array < FlatDrawUniform > drawData { 2 * data . uniformIncrement + 1 } ;
/* Material offsets are zero if we have single draw, as those are done with
UBO offset bindings instead . */
drawData [ 0 * data . uniformIncrement ] = FlatDrawUniform { }
drawData [ 0 * data . uniformIncrement ] = FlatDrawUniform { }
. setColor ( data . flags & FlatGL3D : : Flag : : Textured ?
. setMaterialId ( data . drawCount = = 1 ? 0 : 1 )
0xffffff _rgbf : 0xff0000 _rgbf )
. setObjectId ( 1211 ) ;
. setObjectId ( 1211 ) ;
drawData [ 1 * data . uniformIncrement ] = FlatDrawUniform { }
drawData [ 1 * data . uniformIncrement ] = FlatDrawUniform { }
. setColor ( data . flags & FlatGL3D : : Flag : : Textured ?
. setMaterialId ( data . drawCount = = 1 ? 0 : 0 )
0xffffff _rgbf : 0x0000ff _rgbf )
. setObjectId ( 5627 ) ;
. setObjectId ( 5627 ) ;
drawData [ 2 * data . uniformIncrement ] = FlatDrawUniform { }
drawData [ 2 * data . uniformIncrement ] = FlatDrawUniform { }
. setColor ( data . flags & FlatGL3D : : Flag : : Textured ?
. setMaterialId ( data . drawCount = = 1 ? 0 : 1 )
0xffffff _rgbf : 0xff0000 _rgbf )
. setObjectId ( 36363 ) ;
. setObjectId ( 36363 ) ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , drawData } ;
GL : : Buffer drawUniform { GL : : Buffer : : TargetHint : : Uniform , drawData } ;
FlatGL3D shader { FlatGL3D : : Flag : : UniformBuffers | FlatGL3D : : Flag : : ObjectId | data . flags , data . drawCount } ;
FlatGL3D shader { FlatGL3D : : Flag : : UniformBuffers | FlatGL3D : : Flag : : ObjectId | data . flags , data . materialCount , data . drawCount } ;
if ( data . flags & FlatGL3D : : Flag : : Textured )
if ( data . flags & FlatGL3D : : Flag : : Textured )
shader . bindTexture ( texture ) ;
shader . bindTexture ( texture ) ;
/* Just one draw, rebinding UBOs each time */
/* Just one draw, rebinding UBOs each time */
if ( data . drawCount = = 1 ) {
if ( data . drawCount = = 1 ) {
shader . bindMaterialBuffer ( materialUniform ,
1 * data . uniformIncrement * sizeof ( FlatMaterialUniform ) ,
sizeof ( FlatMaterialUniform ) ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
0 * data . uniformIncrement * sizeof ( TransformationProjectionUniform3D ) ,
0 * data . uniformIncrement * sizeof ( TransformationProjectionUniform3D ) ,
sizeof ( TransformationProjectionUniform3D ) ) ;
sizeof ( TransformationProjectionUniform3D ) ) ;
@ -2643,6 +2763,9 @@ void FlatGLTest::renderMulti3D() {
sizeof ( TextureTransformationUniform ) ) ;
sizeof ( TextureTransformationUniform ) ) ;
shader . draw ( sphere ) ;
shader . draw ( sphere ) ;
shader . bindMaterialBuffer ( materialUniform ,
0 * data . uniformIncrement * sizeof ( FlatMaterialUniform ) ,
sizeof ( FlatMaterialUniform ) ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
1 * data . uniformIncrement * sizeof ( TransformationProjectionUniform3D ) ,
1 * data . uniformIncrement * sizeof ( TransformationProjectionUniform3D ) ,
sizeof ( TransformationProjectionUniform3D ) ) ;
sizeof ( TransformationProjectionUniform3D ) ) ;
@ -2655,6 +2778,9 @@ void FlatGLTest::renderMulti3D() {
sizeof ( TextureTransformationUniform ) ) ;
sizeof ( TextureTransformationUniform ) ) ;
shader . draw ( plane ) ;
shader . draw ( plane ) ;
shader . bindMaterialBuffer ( materialUniform ,
1 * data . uniformIncrement * sizeof ( FlatMaterialUniform ) ,
sizeof ( FlatMaterialUniform ) ) ;
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform ,
2 * data . uniformIncrement * sizeof ( TransformationProjectionUniform3D ) ,
2 * data . uniformIncrement * sizeof ( TransformationProjectionUniform3D ) ,
sizeof ( TransformationProjectionUniform3D ) ) ;
sizeof ( TransformationProjectionUniform3D ) ) ;
@ -2670,7 +2796,8 @@ void FlatGLTest::renderMulti3D() {
/* Otherwise using the draw offset / multidraw */
/* Otherwise using the draw offset / multidraw */
} else {
} else {
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
shader . bindTransformationProjectionBuffer ( transformationProjectionUniform )
. bindDrawBuffer ( drawUniform ) ;
. bindDrawBuffer ( drawUniform )
. bindMaterialBuffer ( materialUniform ) ;
if ( data . flags & FlatGL3D : : Flag : : TextureTransformation )
if ( data . flags & FlatGL3D : : Flag : : TextureTransformation )
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;
shader . bindTextureTransformationBuffer ( textureTransformationUniform ) ;