From: Mikko Rasa Date: Tue, 4 May 2021 20:13:33 +0000 (+0300) Subject: Access builtin resources through a global instance X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=fe2fc291a4fc618425c64112c9ffd3519f0b8a3e Access builtin resources through a global instance Explicitly passing the Resources reference causes problems when some classes in a hierarchy need it and others don't. It's also awkward in RenderPass::set_material and PostProcessor templates. It doesn't even matter which instance is passed in since the data is builtin anyway. The first created Resources instance is now registered as the one to use for builtin data, unless suppressed by a constructor parameter. --- diff --git a/demos/desertpillars/source/desertpillars.cpp b/demos/desertpillars/source/desertpillars.cpp index 41d150b0..fc70af11 100644 --- a/demos/desertpillars/source/desertpillars.cpp +++ b/demos/desertpillars/source/desertpillars.cpp @@ -35,14 +35,14 @@ DesertPillars::DesertPillars(int, char **): keyboard.signal_button_press.connect(sigc::bind_return(sigc::mem_fun(this, &DesertPillars::key_press), false)); const GL::Light &sun = resources.get("Sun.light"); - sky = make_unique(resources, content, sun); + sky = make_unique(content, sun); unsigned shadow_size = 8192; shadow_seq = make_unique(shadow_size, shadow_size); GL::Sequence::Step *step = &shadow_seq->add_step("shadow", content); step->set_depth_test(&GL::DepthTest::lequal()); - shadow_map = make_unique(resources, shadow_size, *sky, sun, *shadow_seq); + shadow_map = make_unique(shadow_size, *sky, sun, *shadow_seq); shadow_map->set_darkness(0.9f); shadow_map->set_target(GL::Vector3(0.0f, 0.0f, 0.0f), 20.0f); @@ -56,7 +56,7 @@ DesertPillars::DesertPillars(int, char **): step->set_lighting(&resources.get("Desert.lightn")); step->set_depth_test(&GL::DepthTest::lequal()); - env_map = make_unique(resources, 256, GL::RGB16F, sphere, *env_seq); + env_map = make_unique(256, GL::RGB16F, sphere, *env_seq); sphere.set_matrix(GL::Matrix::translation(GL::Vector3(0.0f, 0.0f, 3.3f))); content.add(resources.get("Background.scene")); diff --git a/source/builders/sequencebuilder.cpp b/source/builders/sequencebuilder.cpp index 658ded0b..c45d0cc6 100644 --- a/source/builders/sequencebuilder.cpp +++ b/source/builders/sequencebuilder.cpp @@ -66,7 +66,7 @@ void SequenceBuilder::build(Sequence &sequence) const sequence.add_postprocessor(*proc); else if(i->postprocessor_template) { - proc = i->postprocessor_template->create(tmpl.get_resources(), sequence.get_width(), sequence.get_height()); + proc = i->postprocessor_template->create(sequence.get_width(), sequence.get_height()); if(proc) sequence.add_postprocessor_owned(proc); } diff --git a/source/builders/sequencetemplate.cpp b/source/builders/sequencetemplate.cpp index f158c630..d8526433 100644 --- a/source/builders/sequencetemplate.cpp +++ b/source/builders/sequencetemplate.cpp @@ -17,7 +17,6 @@ namespace Msp { namespace GL { SequenceTemplate::SequenceTemplate(): - resources(0), hdr(false), alpha(false), required_multisample(0), @@ -30,13 +29,6 @@ SequenceTemplate::~SequenceTemplate() delete i->postprocessor_template; } -Resources &SequenceTemplate::get_resources() const -{ - if(!resources) - throw logic_error("no resources"); - return *resources; -} - SequenceTemplate::PostProcessorRegistry &SequenceTemplate::get_postprocessor_registry() { @@ -81,8 +73,6 @@ SequenceTemplate::Loader::Loader(SequenceTemplate &t, Collection &c): // Deprecated add("pass", &Loader::step_with_slot); - - obj.resources = &c; } void SequenceTemplate::Loader::postprocessor_loaded() diff --git a/source/builders/sequencetemplate.h b/source/builders/sequencetemplate.h index 596def50..4c195a00 100644 --- a/source/builders/sequencetemplate.h +++ b/source/builders/sequencetemplate.h @@ -103,7 +103,6 @@ public: private: typedef TypeRegistry PostProcessorRegistry; - Resources *resources; bool hdr; bool alpha; unsigned required_multisample; @@ -115,7 +114,6 @@ public: SequenceTemplate(); ~SequenceTemplate(); - Resources &get_resources() const; bool get_hdr() const { return hdr; } bool get_alpha() const { return alpha; } unsigned get_required_multisample() const { return required_multisample; } diff --git a/source/effects/ambientocclusion.cpp b/source/effects/ambientocclusion.cpp index d47d18aa..d23469ed 100644 --- a/source/effects/ambientocclusion.cpp +++ b/source/effects/ambientocclusion.cpp @@ -12,13 +12,13 @@ using namespace std; namespace Msp { namespace GL { -AmbientOcclusion::AmbientOcclusion(Resources &resources, unsigned w, unsigned h, float): +AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float): occlude_target(w, h, (RENDER_COLOR,R8)), - occlude_shader(resources.get("_ambientocclusion_occlude.glsl.shader")), - combine_shader(resources.get("_ambientocclusion_combine.glsl.shader")), - quad(resources.get("_fullscreen_quad.mesh")), - linear_sampler(resources.get("_linear_clamp.samp")), - nearest_sampler(resources.get("_nearest_clamp.samp")) + occlude_shader(Resources::get_global().get("_ambientocclusion_occlude.glsl.shader")), + combine_shader(Resources::get_global().get("_ambientocclusion_combine.glsl.shader")), + quad(Resources::get_global().get("_fullscreen_quad.mesh")), + linear_sampler(Resources::get_global().get("_linear_clamp.samp")), + nearest_sampler(Resources::get_global().get("_nearest_clamp.samp")) { unsigned seed = 1; rotate_lookup.storage(RGBA8, 4, 4, 1); @@ -111,9 +111,9 @@ AmbientOcclusion::Template::Template(): edge_depth_threshold(0.1f) { } -AmbientOcclusion *AmbientOcclusion::Template::create(Resources &res, unsigned width, unsigned height) const +AmbientOcclusion *AmbientOcclusion::Template::create(unsigned width, unsigned height) const { - RefPtr ao = new AmbientOcclusion(res, width/size_divisor, height/size_divisor); + RefPtr ao = new AmbientOcclusion(width/size_divisor, height/size_divisor); ao->set_n_samples(n_samples); ao->set_occlusion_radius(occlusion_radius); ao->set_darkness(darkness); diff --git a/source/effects/ambientocclusion.h b/source/effects/ambientocclusion.h index 2497d5b7..b0030c59 100644 --- a/source/effects/ambientocclusion.h +++ b/source/effects/ambientocclusion.h @@ -35,7 +35,7 @@ public: Template(); - virtual AmbientOcclusion *create(Resources &, unsigned, unsigned) const; + virtual AmbientOcclusion *create(unsigned, unsigned) const; }; private: @@ -49,7 +49,7 @@ private: const Sampler &nearest_sampler; public: - AmbientOcclusion(Resources &, unsigned, unsigned, float = 1.0f); + AmbientOcclusion(unsigned, unsigned, float = 1.0f); private: static float random(unsigned &); diff --git a/source/effects/bloom.cpp b/source/effects/bloom.cpp index 98afedfc..af2057d9 100644 --- a/source/effects/bloom.cpp +++ b/source/effects/bloom.cpp @@ -14,12 +14,12 @@ using namespace std; namespace Msp { namespace GL { -Bloom::Bloom(Resources &resources, unsigned w, unsigned h): - blur_shader(resources.get("_bloom_blur.glsl.shader")), - combine_shader(resources.get("_bloom_combine.glsl.shader")), - quad(resources.get("_fullscreen_quad.mesh")), - nearest_sampler(resources.get("_nearest_clamp.samp")), - linear_sampler(resources.get("_linear_clamp.samp")) +Bloom::Bloom(unsigned w, unsigned h): + blur_shader(Resources::get_global().get("_bloom_blur.glsl.shader")), + combine_shader(Resources::get_global().get("_bloom_combine.glsl.shader")), + quad(Resources::get_global().get("_fullscreen_quad.mesh")), + nearest_sampler(Resources::get_global().get("_nearest_clamp.samp")), + linear_sampler(Resources::get_global().get("_linear_clamp.samp")) { blur_shdata[0].uniform("delta", 1.0f/w, 0.0f); blur_shdata[1].uniform("delta", 0.0f, 1.0f/h); @@ -88,9 +88,9 @@ Bloom::Template::Template(): strength(0.2f) { } -Bloom *Bloom::Template::create(Resources &res, unsigned width, unsigned height) const +Bloom *Bloom::Template::create(unsigned width, unsigned height) const { - RefPtr bloom = new Bloom(res, width/size_divisor, height/size_divisor); + RefPtr bloom = new Bloom(width/size_divisor, height/size_divisor); bloom->set_radius(radius); bloom->set_strength(strength); return bloom.release(); diff --git a/source/effects/bloom.h b/source/effects/bloom.h index f2d9db7f..7315075b 100644 --- a/source/effects/bloom.h +++ b/source/effects/bloom.h @@ -36,7 +36,7 @@ public: Template(); - virtual Bloom *create(Resources &, unsigned, unsigned) const; + virtual Bloom *create(unsigned, unsigned) const; }; private: @@ -50,7 +50,7 @@ private: const Sampler &linear_sampler; public: - Bloom(Resources &, unsigned, unsigned); + Bloom(unsigned, unsigned); ~Bloom(); /** Sets the σ value of the gaussian blur. Values much larger than 4.0 are diff --git a/source/effects/colorcurve.cpp b/source/effects/colorcurve.cpp index 9e242d19..d35b7928 100644 --- a/source/effects/colorcurve.cpp +++ b/source/effects/colorcurve.cpp @@ -12,11 +12,11 @@ using namespace std; namespace Msp { namespace GL { -ColorCurve::ColorCurve(Resources &resources): - shprog(resources.get("_colorcurve.glsl.shader")), - quad(resources.get("_fullscreen_quad.mesh")), - linear_sampler(resources.get("_linear_clamp.samp")), - nearest_sampler(resources.get("_nearest_clamp.samp")) +ColorCurve::ColorCurve(): + shprog(Resources::get_global().get("_colorcurve.glsl.shader")), + quad(Resources::get_global().get("_fullscreen_quad.mesh")), + linear_sampler(Resources::get_global().get("_linear_clamp.samp")), + nearest_sampler(Resources::get_global().get("_nearest_clamp.samp")) { curve.storage(LUMINANCE8, 256, 1); @@ -84,9 +84,9 @@ ColorCurve::Template::Template(): srgb(false) { } -ColorCurve *ColorCurve::Template::create(Resources &res, unsigned, unsigned) const +ColorCurve *ColorCurve::Template::create(unsigned, unsigned) const { - RefPtr colorcurve = new ColorCurve(res); + RefPtr colorcurve = new ColorCurve(); colorcurve->set_exposure_adjust(exposure_adjust); colorcurve->set_brightness_response(brightness_response); if(srgb) diff --git a/source/effects/colorcurve.h b/source/effects/colorcurve.h index ee19a56f..f274bf06 100644 --- a/source/effects/colorcurve.h +++ b/source/effects/colorcurve.h @@ -40,7 +40,7 @@ public: Template(); - virtual ColorCurve *create(Resources &, unsigned, unsigned) const; + virtual ColorCurve *create(unsigned, unsigned) const; }; private: @@ -52,7 +52,7 @@ private: const Sampler &nearest_sampler; public: - ColorCurve(Resources &); + ColorCurve(); /** Set exposure adjustment in EV units. Positive values brighten the image, negative values darken it. Zero is neutral. */ diff --git a/source/effects/environmentmap.cpp b/source/effects/environmentmap.cpp index 353f9841..bd44ae04 100644 --- a/source/effects/environmentmap.cpp +++ b/source/effects/environmentmap.cpp @@ -10,18 +10,18 @@ using namespace std; namespace Msp { namespace GL { -EnvironmentMap::EnvironmentMap(Resources &resources, unsigned s, Renderable &r, Renderable &e): +EnvironmentMap::EnvironmentMap(unsigned s, Renderable &r, Renderable &e): Effect(r), environment(e), - sampler(resources.get("_linear_clamp.samp")) + sampler(Resources::get_global().get("_linear_clamp.samp")) { init(s, RGB8); } -EnvironmentMap::EnvironmentMap(Resources &resources, unsigned s, PixelFormat f, Renderable &r, Renderable &e): +EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, Renderable &r, Renderable &e): Effect(r), environment(e), - sampler(resources.get("_linear_clamp.samp")) + sampler(Resources::get_global().get("_linear_clamp.samp")) { init(s, f); } diff --git a/source/effects/environmentmap.h b/source/effects/environmentmap.h index 36c72987..f22a5b4b 100644 --- a/source/effects/environmentmap.h +++ b/source/effects/environmentmap.h @@ -13,8 +13,6 @@ namespace Msp { namespace GL { -class Resources; - /** Creates a cube map texture of the surroundings of the renderable. This texture can then be used to implement effects such as reflections or refractions. @@ -45,8 +43,8 @@ private: unsigned update_delay; public: - EnvironmentMap(Resources &, unsigned size, Renderable &rend, Renderable &env); - EnvironmentMap(Resources &, unsigned size, PixelFormat, Renderable &rend, Renderable &env); + EnvironmentMap(unsigned size, Renderable &rend, Renderable &env); + EnvironmentMap(unsigned size, PixelFormat, Renderable &rend, Renderable &env); private: void init(unsigned, PixelFormat); diff --git a/source/effects/postprocessor.h b/source/effects/postprocessor.h index 3060e609..aabace6c 100644 --- a/source/effects/postprocessor.h +++ b/source/effects/postprocessor.h @@ -8,7 +8,6 @@ namespace GL { class Mesh; class Renderer; -class Resources; class Sampler; class Shader; class Texture2D; @@ -34,7 +33,7 @@ public: Template(); virtual ~Template() { } - virtual PostProcessor *create(Resources &, unsigned, unsigned) const = 0; + virtual PostProcessor *create(unsigned, unsigned) const = 0; }; protected: diff --git a/source/effects/shadowmap.cpp b/source/effects/shadowmap.cpp index 11bb706e..f11ea7a7 100644 --- a/source/effects/shadowmap.cpp +++ b/source/effects/shadowmap.cpp @@ -13,20 +13,20 @@ using namespace std; namespace Msp { namespace GL { -ShadowMap::ShadowMap(Resources &resources, unsigned s, Renderable &r, const Light &l, Renderable &c): +ShadowMap::ShadowMap(unsigned s, Renderable &r, const Light &l, Renderable &c): Effect(r), light(l), shadow_caster(c), - sampler(resources.get("_linear_clamp_shadow.samp")) + sampler(Resources::get_global().get("_linear_clamp_shadow.samp")) { init(s); } -ShadowMap::ShadowMap(Resources &resources, unsigned s, Renderable &r, const Light &l): +ShadowMap::ShadowMap(unsigned s, Renderable &r, const Light &l): Effect(r), light(l), shadow_caster(r), - sampler(resources.get("_linear_clamp_shadow.samp")) + sampler(Resources::get_global().get("_linear_clamp_shadow.samp")) { init(s); } diff --git a/source/effects/shadowmap.h b/source/effects/shadowmap.h index d618c061..a3c3a8f2 100644 --- a/source/effects/shadowmap.h +++ b/source/effects/shadowmap.h @@ -38,8 +38,8 @@ private: bool rendered; public: - ShadowMap(Resources &, unsigned, Renderable &, const Light &, Renderable &); - DEPRECATED ShadowMap(Resources &, unsigned, Renderable &, const Light &); + ShadowMap(unsigned, Renderable &, const Light &, Renderable &); + DEPRECATED ShadowMap(unsigned, Renderable &, const Light &); private: void init(unsigned); diff --git a/source/effects/sky.cpp b/source/effects/sky.cpp index c7e74879..baf4864a 100644 --- a/source/effects/sky.cpp +++ b/source/effects/sky.cpp @@ -9,18 +9,18 @@ using namespace std; namespace Msp { namespace GL { -Sky::Sky(Resources &resources, Renderable &r, const Light &s): +Sky::Sky(Renderable &r, const Light &s): Effect(r), sun(s), transmittance_lookup(128, 64, (RENDER_COLOR, RGB16F)), - transmittance_shprog(resources.get("_sky_transmittance.glsl.shader")), + transmittance_shprog(Resources::get_global().get("_sky_transmittance.glsl.shader")), transmittance_lookup_dirty(true), distant(256, 128, (RENDER_COLOR, RGB16F)), - distant_shprog(resources.get("_sky_distant.glsl.shader")), - fullscreen_mesh(resources.get("_fullscreen_quad.mesh")), - backdrop_shprog(resources.get("_sky_backdrop.glsl.shader")), - sampler(resources.get("_linear_clamp.samp")), - wrap_sampler(resources.get("_linear_clamp_v.samp")), + distant_shprog(Resources::get_global().get("_sky_distant.glsl.shader")), + fullscreen_mesh(Resources::get_global().get("_fullscreen_quad.mesh")), + backdrop_shprog(Resources::get_global().get("_sky_backdrop.glsl.shader")), + sampler(Resources::get_global().get("_linear_clamp.samp")), + wrap_sampler(Resources::get_global().get("_linear_clamp_v.samp")), rendered(false) { shdata.uniform("n_steps", 50); diff --git a/source/effects/sky.h b/source/effects/sky.h index 5cc7bdaa..faa3eb03 100644 --- a/source/effects/sky.h +++ b/source/effects/sky.h @@ -55,7 +55,7 @@ private: bool rendered; public: - Sky(Resources &, Renderable &, const Light &); + Sky(Renderable &, const Light &); void set_planet(const Planet &); void set_view_height(float); diff --git a/source/materials/material.cpp b/source/materials/material.cpp index ace87e70..b2ee973a 100644 --- a/source/materials/material.cpp +++ b/source/materials/material.cpp @@ -13,7 +13,7 @@ using namespace std; namespace Msp { namespace GL { -const Program *Material::create_compatible_shader(DataFile::Collection &coll, const map &extra_spec) const +const Program *Material::create_compatible_shader(const map &extra_spec) const { string module_name; map spec_values; @@ -26,16 +26,17 @@ const Program *Material::create_compatible_shader(DataFile::Collection &coll, co for(map::const_iterator i=spec_values.begin(); i!=spec_values.end(); ++i) info += format(",%s:%d", i->first, i->second); + Resources &res = Resources::get_global(); string name = format("_material_%016x.shader", hash64(info)); - Program *shprog = coll.find(name); + Program *shprog = res.find(name); if(shprog) return shprog; - const Module &module = coll.get(module_name); + const Module &module = res.get(module_name); shprog = new Program(module, spec_values); try { - coll.add(name, shprog); + res.add(name, shprog); } catch(...) { diff --git a/source/materials/material.h b/source/materials/material.h index ae38f244..a5ee59e5 100644 --- a/source/materials/material.h +++ b/source/materials/material.h @@ -97,7 +97,7 @@ protected: public: virtual ~Material() { } - virtual const Program *create_compatible_shader(DataFile::Collection &, const std::map & = std::map()) const; + virtual const Program *create_compatible_shader(const std::map & = std::map()) const; protected: virtual void fill_program_info(std::string &, std::map &) const = 0; diff --git a/source/materials/renderpass.cpp b/source/materials/renderpass.cpp index dde1fdb4..74b73412 100644 --- a/source/materials/renderpass.cpp +++ b/source/materials/renderpass.cpp @@ -33,7 +33,7 @@ void RenderPass::set_material_textures() set_texture(*tag, material->get_texture(*tag), material->get_sampler()); } -void RenderPass::maybe_create_material_shader(DataFile::Collection *coll) +void RenderPass::maybe_create_material_shader() { if(shprog && !shprog_from_material) return; @@ -42,13 +42,7 @@ void RenderPass::maybe_create_material_shader(DataFile::Collection *coll) if(receive_shadows) extra_spec["use_shadow_map"] = true; - if(coll) - { - shprog = material->create_compatible_shader(*coll, extra_spec); - shprog.keep(); - } - else - throw invalid_operation("RenderPass::maybe_create_material_shader"); + shprog = material->create_compatible_shader(extra_spec); if(shdata) shdata = new ProgramData(*shdata, shprog.get()); @@ -72,11 +66,11 @@ Tag RenderPass::get_slotted_uniform_tag(Tag slot) const return i->second; } -void RenderPass::set_material(const Material *mat, DataFile::Collection *coll) +void RenderPass::set_material(const Material *mat) { material = mat; material.keep(); - maybe_create_material_shader(coll); + maybe_create_material_shader(); set_material_textures(); } @@ -196,7 +190,7 @@ void RenderPass::Loader::init_actions() void RenderPass::Loader::finish() { if(obj.material) - obj.maybe_create_material_shader(coll); + obj.maybe_create_material_shader(); } // Temporary compatibility feature diff --git a/source/materials/renderpass.h b/source/materials/renderpass.h index f02303bc..91ff1b6c 100644 --- a/source/materials/renderpass.h +++ b/source/materials/renderpass.h @@ -85,7 +85,7 @@ public: RenderPass(); private: - void maybe_create_material_shader(DataFile::Collection *); + void maybe_create_material_shader(); void set_material_textures(); public: @@ -93,7 +93,7 @@ public: const Program *get_shader_program() const { return shprog.get(); } const ProgramData *get_shader_data() const { return shdata.get(); } Tag get_slotted_uniform_tag(Tag) const; - void set_material(const Material *, DataFile::Collection * = 0); + void set_material(const Material *); const Material *get_material() const { return material.get(); } const std::string &get_material_slot_name() const { return material_slot; } void set_texture(Tag, const Texture *, const Sampler * = 0); diff --git a/source/render/occludedscene.cpp b/source/render/occludedscene.cpp index b2e7ab32..7c043fa6 100644 --- a/source/render/occludedscene.cpp +++ b/source/render/occludedscene.cpp @@ -12,9 +12,9 @@ using namespace std; namespace Msp { namespace GL { -OccludedScene::OccludedScene(Resources &resources): - bounding_mesh(resources.get("_occluder.mesh")), - bounding_shader(resources.get("_occluder.glsl.shader")), +OccludedScene::OccludedScene(): + bounding_mesh(Resources::get_global().get("_occluder.mesh")), + bounding_shader(Resources::get_global().get("_occluder.glsl.shader")), occluder_min_size(0.25f), cache_dirty(false) { diff --git a/source/render/occludedscene.h b/source/render/occludedscene.h index 2fb463c6..9140d13b 100644 --- a/source/render/occludedscene.h +++ b/source/render/occludedscene.h @@ -42,7 +42,7 @@ private: mutable bool cache_dirty; public: - OccludedScene(Resources &); + OccludedScene(); ~OccludedScene(); virtual void add(Renderable &); diff --git a/source/resources/resources.cpp b/source/resources/resources.cpp index 66f6f082..79c95932 100644 --- a/source/resources/resources.cpp +++ b/source/resources/resources.cpp @@ -3,6 +3,7 @@ #include "animation.h" #include "armature.h" #include "camera.h" +#include "error.h" #include "font.h" #include "keyframe.h" #include "light.h" @@ -33,7 +34,9 @@ namespace GL { void init_shaderlib(DataFile::BuiltinSource &); void init_builtin_data(DataFile::BuiltinSource &); -Resources::Resources(): +Resources *Resources::global_resources = 0; + +Resources::Resources(bool set_as_global): default_tex_filter(Texture::can_generate_mipmap() ? LINEAR_MIPMAP_LINEAR : LINEAR), default_tex_anisotropy(1.0f), srgb_conversion(false), @@ -75,6 +78,22 @@ Resources::Resources(): .notify(&Resources::set_debug_name); add_source(get_builtins()); + + if(set_as_global && !global_resources) + global_resources = this; +} + +Resources::~Resources() +{ + if(this==global_resources) + global_resources = 0; +} + +Resources &Resources::get_global() +{ + if(!global_resources) + throw invalid_operation("no global resources"); + return *global_resources; } const DataFile::CollectionSource &Resources::get_builtins() diff --git a/source/resources/resources.h b/source/resources/resources.h index a50fdc0e..82d2f4c6 100644 --- a/source/resources/resources.h +++ b/source/resources/resources.h @@ -37,9 +37,13 @@ private: bool srgb_conversion; ResourceManager *resource_manager; + static Resources *global_resources; + public: - Resources(); + Resources(bool = true); + virtual ~Resources(); + static Resources &get_global(); static const DataFile::CollectionSource &get_builtins(); void set_default_texture_filter(TextureFilter);