void Renderer::draw(const Batch &batch)
{
apply_state();
- batch.refresh(frame_index);
- PipelineState &ps = get_pipeline_state();
- ps.set_primitive_type(batch.get_type());
- commands.use_pipeline(&ps);
+ apply_batch(batch);
commands.draw(batch);
}
void Renderer::draw_instanced(const Batch &batch, unsigned count)
{
apply_state();
+ apply_batch(batch);
+ commands.draw_instanced(batch, count);
+}
+
+void Renderer::apply_batch(const Batch &batch)
+{
batch.refresh(frame_index);
PipelineState &ps = get_pipeline_state();
ps.set_primitive_type(batch.get_type());
commands.use_pipeline(&ps);
- commands.draw_instanced(batch, count);
}
void Renderer::dispatch(unsigned count_x, unsigned count_y, unsigned count_z)
/** Draws multiple instances of a batch of primitives. A shader must be active. */
void draw_instanced(const Batch &, unsigned);
+private:
+ void apply_batch(const Batch &);
+
+public:
/** Dispatches a compute operation. */
void dispatch(unsigned, unsigned = 1, unsigned = 1);