]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/renderer.cpp
Use default member initializers for simple types
[libs/gl.git] / source / render / renderer.cpp
index 6f7e9cba34d3c156a50e255372d0c59d078e8da9..ad5f87d5a4fd6fd8add9613b7562cb4415de0156 100644 (file)
@@ -2,8 +2,8 @@
 #include "buffer.h"
 #include "camera.h"
 #include "clipping.h"
-#include "deviceinfo.h"
 #include "error.h"
+#include "framebuffer.h"
 #include "lighting.h"
 #include "material.h"
 #include "program.h"
@@ -29,7 +29,6 @@ Renderer::Renderer():
        shdata_stack.reserve(32);
        state = &state_stack.back();
        add_shader_data(standard_shdata);
-       commands.use_pipeline(pipeline_state);
 }
 
 Renderer::~Renderer()
@@ -224,7 +223,7 @@ void Renderer::end()
        add_shader_data(standard_shdata);
        excluded.clear();
 
-       PipelineState::clear();
+       commands.use_pipeline(0);
 }
 
 void Renderer::exclude(const Renderable &renderable)
@@ -243,21 +242,20 @@ void Renderer::render(const Renderable &renderable, Tag tag)
                renderable.render(*this, tag);
 }
 
-void Renderer::clear()
-{
-       clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT|STENCIL_BUFFER_BIT);
-}
-
-void Renderer::clear(BufferBits buffers)
+void Renderer::clear(const ClearValue *values)
 {
        pipeline_state.set_framebuffer(state->framebuffer);
-       commands.clear(buffers);
+       pipeline_state.set_viewport(state->viewport);
+       pipeline_state.set_scissor(state->scissor);
+       commands.use_pipeline(&pipeline_state);
+       commands.clear(values);
 }
 
 void Renderer::draw(const Batch &batch)
 {
        apply_state();
        batch.refresh();
+       commands.use_pipeline(&pipeline_state);
        commands.draw(batch);
 }
 
@@ -265,10 +263,11 @@ void Renderer::draw_instanced(const Batch &batch, unsigned count)
 {
        apply_state();
        batch.refresh();
+       commands.use_pipeline(&pipeline_state);
        commands.draw_instanced(batch, count);
 }
 
-void Renderer::resolve_multisample(Framebuffer &target, BufferBits buffers)
+void Renderer::resolve_multisample(Framebuffer &target)
 {
        if(!state->framebuffer)
                throw invalid_operation("Renderer::resolve_multisample");
@@ -279,7 +278,18 @@ void Renderer::resolve_multisample(Framebuffer &target, BufferBits buffers)
                throw incompatible_data("Renderer::resolve_multisample");
 
        pipeline_state.set_framebuffer(state->framebuffer);
-       commands.resolve_multisample(target, buffers);
+       commands.use_pipeline(&pipeline_state);
+       commands.resolve_multisample(target);
+}
+
+void Renderer::begin_query(const QueryPool &pool, unsigned index)
+{
+       commands.begin_query(pool, index);
+}
+
+void Renderer::end_query(const QueryPool &pool, unsigned index)
+{
+       commands.end_query(pool, index);
 }
 
 void Renderer::apply_state()
@@ -349,36 +359,8 @@ void Renderer::apply_state()
 }
 
 
-Renderer::BoundTexture::BoundTexture():
-       unit(-1),
-       texture(0),
-       sampler(0),
-       replaced(-1)
-{ }
-
-
 Renderer::BoundProgramData::BoundProgramData(const ProgramData *d):
-       shdata(d),
-       generation(0)
-{ }
-
-
-Renderer::State::State():
-       camera(0),
-       framebuffer(0),
-       viewport(0),
-       scissor(0),
-       texture_count(0),
-       clipping(0),
-       shprog(0),
-       shdata_count(0),
-       vertex_setup(0),
-       front_face(NON_MANIFOLD),
-       face_cull(NO_CULL),
-       depth_test(0),
-       stencil_test(0),
-       blend(0),
-       object_lod_bias(0)
+       shdata(d)
 { }
 
 } // namespace GL