]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/renderer.cpp
Initial implementation of Vulkan backend
[libs/gl.git] / source / render / renderer.cpp
index 45ad120045397de5848e4cecfe1968f39e83433b..5262d09a90ee2862e6c0db07dcd02e71044241fd 100644 (file)
@@ -32,12 +32,14 @@ void Renderer::begin()
        if(current_state)
                throw invalid_operation("Renderer::begin");
 
+       ++frame_index;
        state_stack.emplace_back();
        current_state = &state_stack.back();
 
        RendererBackend::begin();
 
        add_shader_data(standard_shdata);
+       commands.begin_frame(frame_index);
 }
 
 void Renderer::end()
@@ -240,6 +242,7 @@ void Renderer::draw(const Batch &batch)
 {
        apply_state();
        batch.refresh();
+       pipeline_state.set_primitive_type(batch.get_type());
        commands.use_pipeline(&pipeline_state);
        commands.draw(batch);
 }
@@ -248,6 +251,7 @@ void Renderer::draw_instanced(const Batch &batch, unsigned count)
 {
        apply_state();
        batch.refresh();
+       pipeline_state.set_primitive_type(batch.get_type());
        commands.use_pipeline(&pipeline_state);
        commands.draw_instanced(batch, count);
 }