Browse Source

Shaders: clean up base array layer setting in Flat and Phong tests.

Do it always when Flag::TextureArrays is set, not inside handling of
some particular texture. Because that way it won't work when other
textures are added/tested.
pull/547/head
Vladimír Vondruš 4 years ago
parent
commit
de62bbf523
  1. 14
      src/Magnum/Shaders/Test/FlatGLTest.cpp
  2. 4
      src/Magnum/Shaders/Test/PhongGLTest.cpp

14
src/Magnum/Shaders/Test/FlatGLTest.cpp

@ -2615,8 +2615,6 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderInstanced2D() {
.setSubImage(0, {image->size().x()/2, 0, 3}, second)
.setSubImage(0, {0, 0, 4}, third);
shader.bindTexture(textureArray);
if(flag != FlatGL2D::Flag::UniformBuffers)
shader.setTextureLayer(2); /* base offset */
} else
#endif
@ -2647,6 +2645,11 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderInstanced2D() {
Vector2{0.5f}
));
#ifndef MAGNUM_TARGET_GLES2
if(data.flags & FlatGL2D::Flag::TextureArrays)
shader.setTextureLayer(2); /* base offset */
#endif
#ifndef MAGNUM_TARGET_GLES2
if(data.flags & FlatGL2D::Flag::ObjectId) {
/* Gets added to the per-instance ID, if that's enabled as well */
@ -2879,8 +2882,6 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderInstanced3D() {
.setSubImage(0, {image->size().x()/2, 0, 3}, second)
.setSubImage(0, {0, 0, 4}, third);
shader.bindTexture(textureArray);
if(flag != FlatGL2D::Flag::UniformBuffers)
shader.setTextureLayer(2); /* base offset */
} else
#endif
@ -2912,6 +2913,11 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderInstanced3D() {
Vector2{0.5f}
));
#ifndef MAGNUM_TARGET_GLES2
if(data.flags & FlatGL3D::Flag::TextureArrays)
shader.setTextureLayer(2); /* base offset */
#endif
#ifndef MAGNUM_TARGET_GLES2
if(data.flags & FlatGL3D::Flag::ObjectId) {
/* Gets added to the per-instance ID, if that's enabled as well */

4
src/Magnum/Shaders/Test/PhongGLTest.cpp

@ -3518,8 +3518,6 @@ template<PhongGL::Flag flag> void PhongGLTest::renderInstanced() {
.setSubImage(0, {image->size().x()/2, 0, 3}, second)
.setSubImage(0, {0, 0, 4}, third);
shader.bindDiffuseTexture(diffuseArray);
if(flag != PhongGL::Flag::UniformBuffers)
shader.setTextureLayer(2); /* base offset */
} else
#endif
@ -3616,7 +3614,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderInstanced() {
Vector2{0.5f}
));
#ifndef MAGNUM_TARGET_GLES2
if((data.flags & PhongGL::Flag::TextureArrays) && flag != PhongGL::Flag::UniformBuffers)
if(data.flags & PhongGL::Flag::TextureArrays)
shader.setTextureLayer(2); /* base offset */
#endif

Loading…
Cancel
Save