#include <algorithm>
#include <msp/gl/extensions/arb_direct_state_access.h>
#include <msp/gl/extensions/arb_draw_instanced.h>
+#include <msp/gl/extensions/arb_occlusion_query.h>
#include <msp/gl/extensions/ext_framebuffer_blit.h>
#include <msp/gl/extensions/ext_framebuffer_object.h>
#include <msp/gl/extensions/msp_clear_buffer.h>
#include "error.h"
#include "gl.h"
#include "pipelinestate.h"
+#include "query.h"
using namespace std;
{
pipeline_state->apply();
void *data_ptr = reinterpret_cast<void *>(batch.get_offset());
- glDrawElements(batch.get_gl_primitive_type(), batch.size(), batch.get_gl_index_type(), data_ptr);
+ glDrawElements(batch.gl_prim_type, batch.size(), batch.gl_index_type, data_ptr);
}
void Commands::draw_instanced(const Batch &batch, unsigned count)
pipeline_state->apply();
void *data_ptr = reinterpret_cast<void *>(batch.get_offset());
- glDrawElementsInstanced(batch.get_gl_primitive_type(), batch.size(), batch.get_gl_index_type(), data_ptr, count);
+ glDrawElementsInstanced(batch.gl_prim_type, batch.size(), batch.gl_index_type, data_ptr, count);
}
-void Commands::resolve_multisample(Framebuffer &target, BufferBits buffers)
+void Commands::resolve_multisample(Framebuffer &target)
{
static Require _req(EXT_framebuffer_blit);
unsigned width = min(source->get_width(), target.get_width());
unsigned height = min(source->get_height(), target.get_height());
+ unsigned buffers = get_gl_buffer_bits(source->get_format())&get_gl_buffer_bits(target.get_format());
if(ARB_direct_state_access)
glBlitNamedFramebuffer(source->id, target.id, 0, 0, width, height, 0, 0, width, height, buffers, GL_NEAREST);
}
}
+void Commands::begin_query(const QueryPool &pool, unsigned index)
+{
+ if(index>=pool.queries.size())
+ throw out_of_range("OpenGLCommands::begin_query");
+ glBeginQuery(pool.gl_type, pool.queries[index]);
+}
+
+void Commands::end_query(const QueryPool &pool, unsigned)
+{
+ glEndQuery(pool.gl_type);
+}
+
} // namespace GL
} // namespace Msp