Browse Source

Shaders: instancedNormalMatrix isn't needed if Phong has zero lights.

And add an explicit construction test for this case.
pull/539/head
Vladimír Vondruš 4 years ago
parent
commit
026aa7757e
  1. 2
      src/Magnum/Shaders/Phong.vert
  2. 1
      src/Magnum/Shaders/Test/PhongGLTest.cpp

2
src/Magnum/Shaders/Phong.vert

@ -242,11 +242,13 @@ layout(location = TRANSFORMATION_MATRIX_ATTRIBUTE_LOCATION)
#endif
in highp mat4 instancedTransformationMatrix;
#ifdef HAS_LIGHTS
#ifdef EXPLICIT_ATTRIB_LOCATION
layout(location = NORMAL_MATRIX_ATTRIBUTE_LOCATION)
#endif
in highp mat3 instancedNormalMatrix;
#endif
#endif
#ifdef INSTANCED_TEXTURE_OFFSET
#ifdef EXPLICIT_ATTRIB_LOCATION

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

@ -247,6 +247,7 @@ constexpr struct {
{"five lights", {}, 5},
{"zero lights", {}, 0},
{"instanced transformation", PhongGL::Flag::InstancedTransformation, 3},
{"instanced transformation, zero lights", PhongGL::Flag::InstancedTransformation, 0},
{"instanced specular texture offset", PhongGL::Flag::SpecularTexture|PhongGL::Flag::InstancedTextureOffset, 3},
{"instanced normal texture offset", PhongGL::Flag::NormalTexture|PhongGL::Flag::InstancedTextureOffset, 3},
#ifndef MAGNUM_TARGET_GLES2

Loading…
Cancel
Save