#include "pipelinestate.h"
#include "rect.h"
#include "semaphore.h"
+#include "swapchaintexture.h"
#include "vulkan.h"
using namespace std;
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)
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<n_attachments; ++i)
+ if(dynamic_cast<const SwapChainTexture *>(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();
if(render_pass)
throw invalid_operation("VulkanCommands::clear");
- begin_render_pass(values);
+ begin_render_pass(true, values);
}
void VulkanCommands::draw(const Batch &batch)
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();