24 #include "../../generic/containers/contiguous_map.h"
26 #include "../../core/aligned_allocator.h"
27 #include "../../macros.h"
28 #include "../../threads/shared_mutex.h"
29 #include "../../types.h"
60 struct alignas(alignof(uint32_t)) {
64 unsigned texture : 10;
67 unsigned precedence : 3;
71 unsigned distance_to_camera : 10;
73 unsigned is_blended : 1;
78 unsigned priority : 6;
79 } __attribute__((packed)) s;
84 static_assert(
sizeof(RenderGroupKey::s) == 4,
85 "Render group key has unexpected size");
93 return sort_key.i < rhs.sort_key.i;
97 return sort_key.i == rhs.sort_key.i;
101 return !(*
this == rhs);
106 const RenderPriority priority,
const uint8_t pass,
const bool is_blended,
107 const float distance_to_camera, int16_t precedence, uint16_t texture_id);
117 const MaterialPass* material_pass,
const RenderPriority priority,
118 const uint8_t pass_number,
const bool is_blended,
119 const float distance_to_camera, uint16_t texture_id) = 0;
122 typedef uint32_t Pass;
123 typedef uint32_t Iteration;
131 virtual void start_traversal(
const RenderQueue& queue, uint64_t frame_id,
StageNode* stage) = 0;
136 virtual void apply_lights(
const LightPtr* lights,
const uint8_t count) = 0;
148 void watch(AssetID material_id,
Renderable* renderable);
157 std::unordered_map<AssetID, std::set<Renderable*>> renderables_by_material_;
163 std::unordered_map<AssetID, sig::connection> material_update_conections_;
165 void on_material_changed(AssetID material);
177 void insert_renderable(
Renderable&& renderable);
182 std::size_t renderable_count()
const {
183 return render_queue_.size();
201 void clean_empty_batches();