X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fcommands_backend.cpp;h=1634863b49e227057ccf3ceb29435600dcb00704;hb=6630b1106493e5a072a9a9f212f0d00648dbedd4;hp=0134474b932d060e6a97eb8a4bd6d97f1fb0eadb;hpb=99ca354f18119f82f1adeca100cd665a8f640317;p=libs%2Fgl.git diff --git a/source/backends/vulkan/commands_backend.cpp b/source/backends/vulkan/commands_backend.cpp index 0134474b..1634863b 100644 --- a/source/backends/vulkan/commands_backend.cpp +++ b/source/backends/vulkan/commands_backend.cpp @@ -9,6 +9,7 @@ #include "pipelinestate.h" #include "rect.h" #include "semaphore.h" +#include "swapchaintexture.h" #include "vulkan.h" using namespace std; @@ -55,7 +56,7 @@ void VulkanCommands::begin_buffer() vk.BeginCommandBuffer(current_buffer, begin_info); } -void VulkanCommands::begin_render_pass(const ClearValue *clear_values) +void VulkanCommands::begin_render_pass(bool clear, const ClearValue *clear_values) { const Framebuffer *target = pipeline_state->get_framebuffer(); if(!target) @@ -68,8 +69,12 @@ void VulkanCommands::begin_render_pass(const ClearValue *clear_values) device.get_transfer_queue().dispatch_transfers(current_buffer); - // TODO Use proper value for to_present - render_pass = device.get_pipeline_cache().get_render_pass(target->get_format(), clear_values, true); + bool to_present = false; + unsigned n_attachments = target->get_format().size(); + for(unsigned i=0; i(target->VulkanFramebuffer::get_attachment(i))) + to_present = true; + VkRenderPass render_pass = device.get_pipeline_cache().get_render_pass(target->get_format(), clear, !clear_values, to_present); target->refresh(); @@ -194,7 +199,7 @@ void VulkanCommands::clear(const ClearValue *values) if(render_pass) throw invalid_operation("VulkanCommands::clear"); - begin_render_pass(values); + begin_render_pass(true, values); } void VulkanCommands::draw(const Batch &batch) @@ -210,7 +215,7 @@ void VulkanCommands::draw_instanced(const Batch &batch, unsigned count) const VulkanFunctions &vk = device.get_functions(); if(!render_pass) - begin_render_pass(0); + begin_render_pass(false, 0); pipeline_state->apply(current_buffer); unsigned first_index = batch.get_offset()/batch.get_index_size();