summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/d3d12/d3d12_context.cpp4
-rw-r--r--drivers/d3d12/d3d12_context.h2
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp14
-rw-r--r--drivers/gles3/rasterizer_gles3.h1
-rw-r--r--drivers/vulkan/vulkan_context.cpp12
-rw-r--r--drivers/vulkan/vulkan_context.h2
6 files changed, 20 insertions, 15 deletions
diff --git a/drivers/d3d12/d3d12_context.cpp b/drivers/d3d12/d3d12_context.cpp
index 97f5d91f3a..fa27b9bc55 100644
--- a/drivers/d3d12/d3d12_context.cpp
+++ b/drivers/d3d12/d3d12_context.cpp
@@ -889,7 +889,9 @@ void D3D12Context::_wait_for_idle_queue(ID3D12CommandQueue *p_queue) {
#endif
}
-void D3D12Context::flush(bool p_flush_setup, bool p_flush_pending) {
+void D3D12Context::flush(bool p_flush_setup, bool p_flush_pending, bool p_sync) {
+ ERR_FAIL_COND_MSG(!p_sync, "Flush without sync is not supported."); // This is a special case for Vulkan on mobile XR hardware, not applicable to D3D12
+
if (p_flush_setup && command_list_queue[0]) {
md.queue->ExecuteCommandLists(1, command_list_queue.ptr());
command_list_queue[0] = nullptr;
diff --git a/drivers/d3d12/d3d12_context.h b/drivers/d3d12/d3d12_context.h
index 27ec93bb7d..a27c8f4320 100644
--- a/drivers/d3d12/d3d12_context.h
+++ b/drivers/d3d12/d3d12_context.h
@@ -234,7 +234,7 @@ public:
virtual void set_setup_buffer(RDD::CommandBufferID p_command_buffer) override final;
virtual void append_command_buffer(RDD::CommandBufferID p_command_buffer) override final;
void resize_notify();
- virtual void flush(bool p_flush_setup = false, bool p_flush_pending = false) override final;
+ virtual void flush(bool p_flush_setup = false, bool p_flush_pending = false, bool p_sync = true) override final;
virtual Error prepare_buffers(RDD::CommandBufferID p_command_buffer) override final;
virtual void postpare_buffers(RDD::CommandBufferID p_command_buffer) override final;
virtual Error swap_buffers() override final;
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index c048e9bf37..6ab98a9473 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -103,6 +103,11 @@ void RasterizerGLES3::begin_frame(double frame_step) {
}
void RasterizerGLES3::end_frame(bool p_swap_buffers) {
+ GLES3::Utilities *utils = GLES3::Utilities::get_singleton();
+ utils->capture_timestamps_end();
+}
+
+void RasterizerGLES3::end_viewport(bool p_swap_buffers) {
if (p_swap_buffers) {
DisplayServer::get_singleton()->swap_buffers();
} else {
@@ -352,13 +357,6 @@ RasterizerGLES3::~RasterizerGLES3() {
}
void RasterizerGLES3::prepare_for_blitting_render_targets() {
- // This is a hack, but this function is called one time after all viewports have been updated.
- // So it marks the end of the frame for all viewports
- // In the OpenGL renderer we have to call end_frame for each viewport so we can swap the
- // buffers for each window before proceeding to the next.
- // This allows us to only increment the frame after all viewports are done.
- GLES3::Utilities *utils = GLES3::Utilities::get_singleton();
- utils->capture_timestamps_end();
}
void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, DisplayServer::WindowID p_screen, const Rect2 &p_screen_rect, uint32_t p_layer, bool p_first) {
@@ -474,7 +472,7 @@ void RasterizerGLES3::set_boot_image(const Ref<Image> &p_image, const Color &p_c
copy_effects->copy_to_rect(screenrect);
glBindTexture(GL_TEXTURE_2D, 0);
- end_frame(true);
+ end_viewport(true);
texture_storage->texture_free(texture);
}
diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h
index b19ca0e9c9..d9f436a2ec 100644
--- a/drivers/gles3/rasterizer_gles3.h
+++ b/drivers/gles3/rasterizer_gles3.h
@@ -93,6 +93,7 @@ public:
void prepare_for_blitting_render_targets();
void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount);
+ void end_viewport(bool p_swap_buffers);
void end_frame(bool p_swap_buffers);
void finalize();
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 1b1d4fa50f..d536b4455a 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -2395,9 +2395,11 @@ void VulkanContext::append_command_buffer(RDD::CommandBufferID p_command_buffer)
command_buffer_count++;
}
-void VulkanContext::flush(bool p_flush_setup, bool p_flush_pending) {
+void VulkanContext::flush(bool p_flush_setup, bool p_flush_pending, bool p_sync) {
// Ensure everything else pending is executed.
- vkDeviceWaitIdle(device);
+ if (p_sync) {
+ vkDeviceWaitIdle(device);
+ }
// Flush the pending setup buffer.
@@ -2440,7 +2442,9 @@ void VulkanContext::flush(bool p_flush_setup, bool p_flush_pending) {
ERR_FAIL_COND(err);
}
- vkDeviceWaitIdle(device);
+ if (p_sync) {
+ vkDeviceWaitIdle(device);
+ }
}
Error VulkanContext::prepare_buffers(RDD::CommandBufferID p_command_buffer) {
@@ -2504,7 +2508,7 @@ Error VulkanContext::swap_buffers() {
return OK;
}
- // print_line("swapbuffers?");
+ //print_line("swap_buffers");
VkResult err;
#if 0
diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h
index ce1299a559..b914acf3a9 100644
--- a/drivers/vulkan/vulkan_context.h
+++ b/drivers/vulkan/vulkan_context.h
@@ -321,7 +321,7 @@ public:
virtual void set_setup_buffer(RDD::CommandBufferID p_command_buffer) override final;
virtual void append_command_buffer(RDD::CommandBufferID p_command_buffer) override final;
void resize_notify();
- virtual void flush(bool p_flush_setup = false, bool p_flush_pending = false) override final;
+ virtual void flush(bool p_flush_setup = false, bool p_flush_pending = false, bool p_sync = true) override final;
virtual Error prepare_buffers(RDD::CommandBufferID p_command_buffer) override final;
virtual void postpare_buffers(RDD::CommandBufferID p_command_buffer) override final;
virtual Error swap_buffers() override final;