23#include <unordered_set>
35 iSampler{ &aSampler },
51 return iReferences.find(aGradient) != iReferences.end();
55 iReferences.insert(aGradient);
59 auto existing = iReferences.find(aGradient);
60 if (existing != iReferences.end())
61 iReferences.erase(existing);
70 mutable std::unordered_set<gradient_id> iReferences;
94 std::shared_ptr<shader_array<float>> iSampler;
105 typedef std::pair<gradient::color_stop_list, gradient::alpha_stop_list>
sampler_key_t;
118 i_gradient_sampler
const&
sampler(i_gradient
const& aGradient)
override;
119 i_gradient_filter
const&
filter(i_gradient
const& aGradient)
override;
141 void do_create_gradient(i_gradient
const& aOther, i_gradient::color_stop_list
const& aColorStops,
neolib::i_ref_ptr<i_gradient>& aResult)
override;
142 void do_create_gradient(i_gradient
const& aOther, i_gradient::color_stop_list
const& aColorStops, i_gradient::alpha_stop_list
const& aAlphaStops,
neolib::i_ref_ptr<i_gradient>& aResult)
override;
146 std::vector<gradient_sampler>& free_samplers();
147 std::vector<gradient_filter>& free_filters();
151 std::optional<shader_array<avec4u8>> iSamplers;
153 std::optional<std::vector<gradient_sampler>> iFreeSamplers;
154 std::deque<sampler_map_t::const_iterator> iSamplerQueue;
156 std::optional<std::vector<gradient_filter>> iFreeFilters;
157 std::deque<filter_map_t::const_iterator> iFilterQueue;
i_shader_array< float > const & sampler() const override
std::map< scalar, gradient_filter > filter_map_t
void release(gradient_id aId) override
i_gradient_sampler const & sampler(i_gradient const &aGradient) override
neolib::ref_ptr< i_gradient > add_gradient(neolib::ref_ptr< i_gradient > aGradient)
neolib::pair< gradient_pointer, uint32_t > gradient_list_entry
void add_ref(gradient_id aId) override
const gradient_list & gradients() const
friend class gradient_object
std::pair< gradient::color_stop_list, gradient::alpha_stop_list > sampler_key_t
friend neolib::cookie item_cookie(gradient_list_entry const &)
gradient_id allocate_gradient_id()
static constexpr uint32_t MaxSamplers
void clear_gradients() override
std::map< sampler_key_t, gradient_sampler > sampler_map_t
static constexpr uint32_t MaxFilters
neolib::jar< gradient_list_entry > gradient_list
i_gradient_filter const & filter(i_gradient const &aGradient) override
gradient_list & gradients()
ref_ptr< i_gradient > gradient_pointer
long use_count(gradient_id aId) const override
void release_all() const override
bool used_by(gradient_id aGradient) const override
void release(gradient_id aGradient) const override
i_shader_array< avec4u8 > const & sampler() const override
uint32_t sampler_row() const override
gradient_sampler(i_shader_array< avec4u8 > const &aSampler, uint32_t aRow)
void add_ref(gradient_id aGradient) const override
constexpr uint32_t GRADIENT_FILTER_SIZE
basic_size< uint32_t > size_u32
basic_jar< T, vector< T >, cookie, MutexType > jar