glDrawElementsInstanced(batch.get_gl_primitive_type(), batch.size(), batch.get_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 clear(const ClearValue *);
void draw(const Batch &);
void draw_instanced(const Batch &, unsigned);
- void resolve_multisample(Framebuffer &, BufferBits);
+ void resolve_multisample(Framebuffer &);
};
} // namespace GL
return GL_COLOR_ATTACHMENT0+get_attach_point(fa);
}
+GLenum get_gl_buffer_bits(const FrameFormat &format)
+{
+ GLenum bits = 0;
+ for(FrameAttachment a: format)
+ {
+ if(get_attach_point(a)==get_attach_point(DEPTH_ATTACHMENT))
+ bits |= GL_DEPTH_BUFFER_BIT;
+ else if(get_attach_point(a)==get_attach_point(STENCIL_ATTACHMENT))
+ bits |= GL_STENCIL_BUFFER_BIT;
+ else
+ bits |= GL_COLOR_BUFFER_BIT;
+ }
+ return bits;
+}
+
} // namespace GL
} // namespace Msp
PixelFormat get_attachment_pixelformat(FrameAttachment);
GLenum get_gl_attachment(FrameAttachment);
+GLenum get_gl_buffer_bits(const FrameFormat &);
} // namespace GL
} // namespace Msp
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");
pipeline_state.set_framebuffer(state->framebuffer);
commands.use_pipeline(&pipeline_state);
- commands.resolve_multisample(target, buffers);
+ commands.resolve_multisample(target);
}
void Renderer::apply_state()
void draw(const Batch &);
void draw_instanced(const Batch &, unsigned);
- void resolve_multisample(Framebuffer &, BufferBits);
+ void resolve_multisample(Framebuffer &);
private:
void apply_state();
if(target[0])
{
if(target_ms)
- renderer.resolve_multisample(target[0]->get_framebuffer(), COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
+ renderer.resolve_multisample(target[0]->get_framebuffer());
renderer.set_depth_test(0);
renderer.set_stencil_test(0);