Skip to content

Commit 7660e9f

Browse files
committed
Fix pass_has_draw_call flag to improve Vulkan performance
1 parent 9b4028c commit 7660e9f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

pathfinder/gpu/vk/command_encoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ bool CommandEncoderVk::finish() {
208208

209209
// In case we need to clear a framebuffer even when nothing is drawn.
210210
// This is to keep consistency with OpenGL.
211-
if (pass_has_draw_call && render_pass_vk->get_attachment_load_op() == AttachmentLoadOp::Clear) {
211+
if (!pass_has_draw_call && render_pass_vk->get_attachment_load_op() == AttachmentLoadOp::Clear) {
212212
std::array<VkClearAttachment, 1> clear_attachments{};
213213

214214
clear_attachments[0] = {VK_IMAGE_ASPECT_COLOR_BIT, 0, clearValues[0]};
@@ -219,6 +219,7 @@ bool CommandEncoderVk::finish() {
219219
0,
220220
1};
221221

222+
// Note: this operation is really performance-heavy.
222223
vkCmdClearAttachments(vk_command_buffer_,
223224
clear_attachments.size(),
224225
clear_attachments.data(),

pathfinder/gpu/vk/window_builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ VkPresentModeKHR choose_swap_present_mode(const std::vector<VkPresentModeKHR> &a
337337
}
338338

339339
// Traditional V-Sync
340-
return VK_PRESENT_MODE_FIFO_KHR;
340+
return VK_PRESENT_MODE_IMMEDIATE_KHR;
341341
}
342342

343343
QueueFamilyIndices find_queue_families(VkPhysicalDevice physical_device, VkSurfaceKHR surface) {

0 commit comments

Comments
 (0)