]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove the deprecated texunit-based texture assignments from RenderPass
authorMikko Rasa <tdb@tdb.fi>
Tue, 28 Sep 2021 13:47:58 +0000 (16:47 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 28 Sep 2021 13:47:58 +0000 (16:47 +0300)
source/materials/renderpass.cpp
source/materials/renderpass.h

index 43d5803e7f1d0a799880ff99a9d8af7375cec1df..63ba695bae7fee718834cf2251863e64c527c8db 100644 (file)
@@ -93,36 +93,6 @@ Tag RenderPass::get_texture_tag(const string &slot) const
        return (i!=textures.end() ? i->tag : Tag());
 }
 
-void RenderPass::set_texture(unsigned index, const Texture *tex, const Sampler *samp)
-{
-       if(!shprog)
-               throw invalid_operation("RenderPass::set_texture");
-
-       const vector<ReflectData::UniformInfo> &uniforms = shprog->get_uniforms();
-       for(const ReflectData::UniformInfo &u: uniforms)
-               if(is_image(u.type) && u.binding==static_cast<int>(index))
-                       return set_texture(u.tag, tex, samp);
-
-       if(shdata)
-       {
-               for(Tag t: shdata->get_uniform_tags())
-               {
-                       auto j = find_member(uniforms, t, &ReflectData::UniformInfo::tag);
-                       if(j==uniforms.end() || !is_image(j->type))
-                               continue;
-                       if(const Uniform1i *uni1i = dynamic_cast<const Uniform1i *>(shdata->find_uniform(t)))
-                               if(uni1i->get()==static_cast<int>(index))
-                                       return set_texture(t, tex, samp);
-               }
-       }
-}
-
-int RenderPass::get_texture_index(const string &n) const
-{
-       auto i = find_member(textures, n, &TextureSlot::slot_name);
-       return (shprog && i!=textures.end() ? shprog->get_uniform_binding(i->tag) : -1);
-}
-
 void RenderPass::set_face_cull(CullMode fc)
 {
        face_cull = fc;
@@ -181,11 +151,6 @@ void RenderPass::Loader::init_actions()
        add("uniforms", &Loader::uniforms);
        add("uniform_slot", &Loader::uniform_slot);
        add("uniform_slot", &Loader::uniform_slot2);
-
-       // Deprecated
-       add("texunit",  &Loader::texunit);
-       add("texunit",  &Loader::texture);
-       add("texunit",  &Loader::texunit_named);
 }
 
 void RenderPass::Loader::set_inline_base_name(const string &n)
@@ -246,35 +211,6 @@ void RenderPass::Loader::texture(const string &n)
        load_sub_with(ldr);
 }
 
-void RenderPass::Loader::texunit(unsigned)
-{
-       IO::print(IO::cerr, "Warning: specifying textures by unit number is deprecated and may not produce expected results");
-       string name;
-       if(obj.shprog)
-       {
-               for(const ReflectData::UniformInfo &u: obj.shprog->get_uniforms())
-                       if(is_image(u.type) && u.binding>=0)
-                       {
-                               if(!name.empty())
-                               {
-                                       name.clear();
-                                       break;
-                               }
-                               name = u.name;
-                       }
-       }
-
-       if(name.empty())
-               throw runtime_error("Could not determine name for texture");
-
-       texture(name);
-}
-
-void RenderPass::Loader::texunit_named(unsigned, const string &n)
-{
-       texture(n);
-}
-
 void RenderPass::Loader::uniforms()
 {
        if(!obj.shprog || obj.shprog_from_material)
index 94cc2ed928b328f0f6dc0d16690b058cf75f0a27..c810e2c7260512cdadcce4612575b832e32458c8 100644 (file)
@@ -47,8 +47,6 @@ public:
                void material(const std::string &);
                void shader(const std::string &);
                void texture(const std::string &);
-               void texunit(unsigned);
-               void texunit_named(unsigned, const std::string &);
                void uniforms();
                void uniform_slot(const std::string &);
                void uniform_slot2(const std::string &, const std::string &);
@@ -105,8 +103,6 @@ public:
        const std::string &get_material_slot_name() const { return material_slot; }
        void set_texture(Tag, const Texture *, const Sampler * = 0);
        Tag get_texture_tag(const std::string &) const;
-       DEPRECATED void set_texture(unsigned, const Texture *, const Sampler * = 0);
-       DEPRECATED int get_texture_index(const std::string &) const;
        void set_face_cull(CullMode);
        CullMode get_face_cull() const { return face_cull; }
        void set_receive_shadows(bool);