58TEST(SwapchainTest, CachesRenderPassOnSwapchainImage) {
70 std::vector<std::shared_ptr<Texture>> msaa_textures;
71 std::vector<std::shared_ptr<Texture>> depth_stencil_textures;
72 for (
auto i = 0u;
i < 3u;
i++) {
73 auto drawable =
swapchain->AcquireNextDrawable();
74 RenderTarget render_target = drawable->GetRenderTarget();
83 auto command_buffer = context->CreateCommandBuffer();
84 auto render_pass = command_buffer->CreateRenderPass(render_target);
85 render_pass->EncodeCommands();
88 depth_stencil_textures.push_back(depth.has_value() ? depth->texture
93 for (
auto i = 1;
i < 3;
i++) {
94 EXPECT_EQ(msaa_textures[
i - 1], msaa_textures[
i]);
95 EXPECT_EQ(depth_stencil_textures[
i - 1], depth_stencil_textures[
i]);
101 std::vector<SharedHandleVK<vk::Framebuffer>> framebuffers;
102 std::vector<SharedHandleVK<vk::RenderPass>> render_passes;
103 for (
auto i = 0u;
i < 3u;
i++) {
104 auto drawable =
swapchain->AcquireNextDrawable();
105 RenderTarget render_target = drawable->GetRenderTarget();
114 framebuffers.push_back(
116 render_passes.push_back(
122 for (
auto i = 0u;
i < 3u;
i++) {
123 auto drawable =
swapchain->AcquireNextDrawable();
124 RenderTarget render_target = drawable->GetRenderTarget();
140TEST(SwapchainTest, NoFenceWaitAfterAcquireNextImageFailure) {
141 bool wait_for_fences_called =
false;
145 [](VkDevice, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence,
146 uint32_t*) -> VkResult {
return VK_ERROR_SURFACE_LOST_KHR; })
147 .SetWaitForFencesCallback([&](VkDevice, uint32_t,
const VkFence*,
148 VkBool32, uint64_t) -> VkResult {
149 wait_for_fences_called =
true;
163 EXPECT_FALSE(wait_for_fences_called);
vk::Instance GetInstance() const
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...
MockVulkanContextBuilder SetAcquireNextImageCallback(std::function< std::remove_pointer_t< PFN_vkAcquireNextImageKHR > > acquire_next_image_callback)