Add ability to opt-out buffer swapping in VS::draw()
This commit is contained in:
parent
ff03a0bc7b
commit
3aa79fc1a3
@ -352,7 +352,7 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re
|
||||
canvas->canvas_end();
|
||||
}
|
||||
|
||||
void RasterizerGLES3::end_frame() {
|
||||
void RasterizerGLES3::end_frame(bool p_swap_buffers) {
|
||||
|
||||
#if 0
|
||||
canvas->canvas_begin();
|
||||
@ -384,7 +384,10 @@ void RasterizerGLES3::end_frame() {
|
||||
|
||||
canvas->draw_generic_textured_rect(Rect2(0,0,15,15),Rect2(0,0,1,1));
|
||||
#endif
|
||||
OS::get_singleton()->swap_buffers();
|
||||
if (p_swap_buffers)
|
||||
OS::get_singleton()->swap_buffers();
|
||||
else
|
||||
glFinish();
|
||||
|
||||
/* print_line("objects: "+itos(storage->info.render_object_count));
|
||||
print_line("material chages: "+itos(storage->info.render_material_switch_count));
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
virtual void restore_render_target();
|
||||
virtual void clear_render_target(const Color &p_color);
|
||||
virtual void blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen = 0);
|
||||
virtual void end_frame();
|
||||
virtual void end_frame(bool p_swap_buffers);
|
||||
virtual void finalize();
|
||||
|
||||
static void make_current();
|
||||
|
@ -1027,7 +1027,7 @@ public:
|
||||
virtual void restore_render_target() = 0;
|
||||
virtual void clear_render_target(const Color &p_color) = 0;
|
||||
virtual void blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen = 0) = 0;
|
||||
virtual void end_frame() = 0;
|
||||
virtual void end_frame(bool p_swap_buffers) = 0;
|
||||
virtual void finalize() = 0;
|
||||
|
||||
virtual ~Rasterizer() {}
|
||||
|
@ -92,7 +92,7 @@ void VisualServerRaster::request_frame_drawn_callback(Object *p_where, const Str
|
||||
frame_drawn_callbacks.push_back(fdc);
|
||||
}
|
||||
|
||||
void VisualServerRaster::draw() {
|
||||
void VisualServerRaster::draw(bool p_swap_buffers) {
|
||||
|
||||
changes = 0;
|
||||
|
||||
@ -103,7 +103,7 @@ void VisualServerRaster::draw() {
|
||||
VSG::viewport->draw_viewports();
|
||||
VSG::scene->render_probes();
|
||||
_draw_margins();
|
||||
VSG::rasterizer->end_frame();
|
||||
VSG::rasterizer->end_frame(p_swap_buffers);
|
||||
|
||||
while (frame_drawn_callbacks.front()) {
|
||||
|
||||
|
@ -625,7 +625,7 @@ public:
|
||||
|
||||
virtual void request_frame_drawn_callback(Object *p_where, const StringName &p_method, const Variant &p_userdata);
|
||||
|
||||
virtual void draw();
|
||||
virtual void draw(bool p_swap_buffers);
|
||||
virtual void sync();
|
||||
virtual bool has_changed() const;
|
||||
virtual void init();
|
||||
|
@ -89,7 +89,7 @@ void VisualServerWrapMT::sync() {
|
||||
}
|
||||
}
|
||||
|
||||
void VisualServerWrapMT::draw() {
|
||||
void VisualServerWrapMT::draw(bool p_swap_buffers) {
|
||||
|
||||
if (create_thread) {
|
||||
|
||||
@ -97,7 +97,7 @@ void VisualServerWrapMT::draw() {
|
||||
command_queue.push(this, &VisualServerWrapMT::thread_draw);
|
||||
} else {
|
||||
|
||||
visual_server->draw();
|
||||
visual_server->draw(p_swap_buffers);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ public:
|
||||
|
||||
virtual void init();
|
||||
virtual void finish();
|
||||
virtual void draw();
|
||||
virtual void draw(bool p_swap_buffers);
|
||||
virtual void sync();
|
||||
FUNC0RC(bool, has_changed)
|
||||
|
||||
|
@ -1481,7 +1481,7 @@ Array VisualServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surfa
|
||||
void VisualServer::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("force_sync"), &VisualServer::sync);
|
||||
ClassDB::bind_method(D_METHOD("force_draw"), &VisualServer::draw);
|
||||
ClassDB::bind_method(D_METHOD("force_draw"), &VisualServer::draw, DEFVAL(true));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("texture_create"), &VisualServer::texture_create);
|
||||
ClassDB::bind_method(D_METHOD("texture_create_from_image", "image", "flags"), &VisualServer::texture_create_from_image, DEFVAL(TEXTURE_FLAGS_DEFAULT));
|
||||
@ -1658,7 +1658,7 @@ void VisualServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("free", "rid"), &VisualServer::free);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("request_frame_drawn_callback", "where", "method", "userdata"), &VisualServer::request_frame_drawn_callback);
|
||||
ClassDB::bind_method(D_METHOD("draw"), &VisualServer::draw);
|
||||
ClassDB::bind_method(D_METHOD("draw"), &VisualServer::draw, DEFVAL(true));
|
||||
ClassDB::bind_method(D_METHOD("sync"), &VisualServer::sync);
|
||||
ClassDB::bind_method(D_METHOD("has_changed"), &VisualServer::has_changed);
|
||||
ClassDB::bind_method(D_METHOD("init"), &VisualServer::init);
|
||||
|
@ -909,7 +909,7 @@ public:
|
||||
|
||||
/* EVENT QUEUING */
|
||||
|
||||
virtual void draw() = 0;
|
||||
virtual void draw(bool p_swap_buffers = true) = 0;
|
||||
virtual void sync() = 0;
|
||||
virtual bool has_changed() const = 0;
|
||||
virtual void init() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user