From c74e49b3f4ffb97816bc0c96df607714c1dac126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jun 2020 11:08:40 +0200 Subject: [PATCH] Shaders: make instancing finally work on ES2 / WebGL 1. This was stupid, eh? Blame Mesa and SwiftShader for not exposing ANGLE_instanced_arrays so the only way to test this for me was via the browser, which is practically impossible. Then found this by an accident. Pushing straight to master because YOLO. --- src/Magnum/Shaders/Flat.cpp | 2 +- src/Magnum/Shaders/Phong.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Shaders/Flat.cpp b/src/Magnum/Shaders/Flat.cpp index 9e90d5049..f52957af5 100644 --- a/src/Magnum/Shaders/Flat.cpp +++ b/src/Magnum/Shaders/Flat.cpp @@ -109,11 +109,11 @@ template Flat::Flat(const Flags flags): _fla } if(flags >= Flag::InstancedObjectId) bindAttributeLocation(ObjectId::Location, "instanceObjectId"); + #endif if(flags & Flag::InstancedTransformation) bindAttributeLocation(TransformationMatrix::Location, "instancedTransformationMatrix"); if(flags >= Flag::InstancedTextureOffset) bindAttributeLocation(TextureOffset::Location, "instancedTextureOffset"); - #endif } #endif diff --git a/src/Magnum/Shaders/Phong.cpp b/src/Magnum/Shaders/Phong.cpp index d3c1242c9..03709088e 100644 --- a/src/Magnum/Shaders/Phong.cpp +++ b/src/Magnum/Shaders/Phong.cpp @@ -154,11 +154,11 @@ Phong::Phong(const Flags flags, const UnsignedInt lightCount): _flags{flags}, _l } if(flags >= Flag::InstancedObjectId) bindAttributeLocation(ObjectId::Location, "instanceObjectId"); + #endif if(flags & Flag::InstancedTransformation) bindAttributeLocation(TransformationMatrix::Location, "instancedTransformationMatrix"); if(flags >= Flag::InstancedTextureOffset) bindAttributeLocation(TextureOffset::Location, "instancedTextureOffset"); - #endif } #endif