Skip swapchain logic if there is nothing to present (Android OpenXR)
This commit is contained in:
parent
c8c483cf57
commit
d6caa69e11
13 changed files with 36 additions and 26 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue