]> git.tdb.fi Git - libs/gl.git/commitdiff
Do not attempt to legacy-bind texture targets which do not support it
authorMikko Rasa <tdb@tdb.fi>
Sun, 1 Jul 2018 09:53:08 +0000 (12:53 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 1 Jul 2018 10:04:27 +0000 (13:04 +0300)
source/texture.cpp
source/texture.h

index 1b7bdc2297ec3a1be84d95fdcd091b55b59bae20..820dd10fd90318c64278ae9b0aed66cf227d8743 100644 (file)
@@ -314,6 +314,8 @@ void Texture::bind_to(unsigned i, bool legacy) const
                }
        }
 
+       legacy = (legacy && is_legacy_target(target));
+
        TexUnit &unit = TexUnit::get_unit(i);
        const Texture *old = unit.get_texture();
        bool old_legacy = unit.get_texture_legacy();
@@ -369,6 +371,11 @@ void Texture::unbind_from(unsigned i)
        }
 }
 
+bool Texture::is_legacy_target(GLenum target)
+{
+       return target<GL_TEXTURE_1D_ARRAY;
+}
+
 
 Texture::Loader::Loader(Texture &t):
        DataFile::CollectionObjectLoader<Texture>(t, 0)
index f491297d692816de8d2503ba8e6071f77a852ca6..ffc5e1a4ab40a1f2f6ccee04b93c8423ee003eea 100644 (file)
@@ -202,7 +202,10 @@ public:
        static const Texture *current(unsigned = 0);
        static void unbind() { unbind_from(0); }
        static void unbind_from(unsigned);
+private:
+       static bool is_legacy_target(GLenum);
 
+public:
        virtual UInt64 get_data_size() const { return 0; }
 };