Browse Source

Shaders: WebGL doesn't allow uploading an UBO shorter than hardcoded.

Also fixes a WebGL error in the tests. I suspect it might fail elsewhere
as well. Nevertheless, this still doesn't mean that it would be
impossible to use dynamic joint count with UBOs -- simply pad the UBO in
that case.
pull/601/head
Vladimír Vondruš 3 years ago
parent
commit
6db78765d3
  1. 10
      src/Magnum/Shaders/Test/FlatGLTest.cpp
  2. 10
      src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp
  3. 5
      src/Magnum/Shaders/Test/PhongGLTest.cpp

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

@ -3191,6 +3191,11 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderSkinning2D() {
Matrix3{Math::IdentityInit},
};
#ifdef MAGNUM_TARGET_WEBGL
if(flag == FlatGL2D::Flag::UniformBuffers && data.jointCount > Containers::arraySize(jointMatrices))
CORRADE_SKIP("Uploading an uniform buffer smaller than the size hardcoded in the shader is an error in WebGL.");
#endif
GL::Buffer buffer{vertices};
GL::Mesh mesh{MeshPrimitive::TriangleStrip};
@ -3317,6 +3322,11 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderSkinning3D() {
Matrix4{Math::IdentityInit},
};
#ifdef MAGNUM_TARGET_WEBGL
if(flag == FlatGL3D::Flag::UniformBuffers && data.jointCount > Containers::arraySize(jointMatrices))
CORRADE_SKIP("Uploading an uniform buffer smaller than the size hardcoded in the shader is an error in WebGL.");
#endif
GL::Buffer buffer{vertices};
GL::Mesh mesh{MeshPrimitive::TriangleStrip};

10
src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp

@ -4804,6 +4804,11 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderSkinnin
Matrix3{Math::IdentityInit},
};
#ifdef MAGNUM_TARGET_WEBGL
if(flag == MeshVisualizerGL2D::Flag::UniformBuffers && data.jointCount > Containers::arraySize(jointMatrices))
CORRADE_SKIP("Uploading an uniform buffer smaller than the size hardcoded in the shader is an error in WebGL.");
#endif
GL::Buffer buffer{vertices};
GL::Mesh mesh{MeshPrimitive::Triangles};
@ -4937,6 +4942,11 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderSkinnin
Matrix4{Math::IdentityInit},
};
#ifdef MAGNUM_TARGET_WEBGL
if(flag == MeshVisualizerGL3D::Flag::UniformBuffers && data.jointCount > Containers::arraySize(jointMatrices))
CORRADE_SKIP("Uploading an uniform buffer smaller than the size hardcoded in the shader is an error in WebGL.");
#endif
GL::Buffer buffer{vertices};
GL::Mesh mesh{MeshPrimitive::Triangles};

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

@ -4033,6 +4033,11 @@ template<PhongGL::Flag flag> void PhongGLTest::renderSkinning() {
Matrix4{Math::IdentityInit},
};
#ifdef MAGNUM_TARGET_WEBGL
if(flag == PhongGL::Flag::UniformBuffers && data.jointCount > Containers::arraySize(jointMatrices))
CORRADE_SKIP("Uploading an uniform buffer smaller than the size hardcoded in the shader is an error in WebGL.");
#endif
GL::Buffer buffer{vertices};
GL::Mesh mesh{MeshPrimitive::TriangleStrip};

Loading…
Cancel
Save