[Impeller] Add the KHR prefix to existing swapchain utilities. (flutter/engine#51295)
This is part of blowing up https://github.com/flutter/engine/pull/51213 into smaller commits. Our current swapchain is based on the VK_KHR_swapchain extension. When this was the only swapchain that could be created, the KHR prefix was dropped. Since we are going to be having multiple swapchain types, add the KHR prefix and make room for other swapchains. No change in functionality. Just renames classes and files.
This commit is contained in:
@@ -178,6 +178,8 @@
|
||||
../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk_unittests.cc
|
||||
../../../flutter/impeller/renderer/backend/vulkan/render_pass_cache_unittests.cc
|
||||
../../../flutter/impeller/renderer/backend/vulkan/resource_manager_vk_unittests.cc
|
||||
../../../flutter/impeller/renderer/backend/vulkan/swapchain/README.md
|
||||
../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/README.md
|
||||
../../../flutter/impeller/renderer/backend/vulkan/test
|
||||
../../../flutter/impeller/renderer/blit_pass_unittests.cc
|
||||
../../../flutter/impeller/renderer/capabilities_unittests.cc
|
||||
|
||||
@@ -38136,14 +38136,14 @@ ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/shared_object_vk.cc +
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/shared_object_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/surface_context_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/surface_context_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/surface_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/surface_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_image_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_image_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_impl_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_impl_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_surface_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_surface_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_impl_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_impl_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/texture_source_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/texture_source_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/texture_vk.cc + ../../../flutter/LICENSE
|
||||
@@ -40988,14 +40988,14 @@ FILE: ../../../flutter/impeller/renderer/backend/vulkan/shared_object_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/shared_object_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/surface_context_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/surface_context_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/surface_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/surface_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_image_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_image_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_impl_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_impl_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_surface_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_surface_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_impl_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_impl_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/texture_source_vk.cc
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/texture_source_vk.h
|
||||
FILE: ../../../flutter/impeller/renderer/backend/vulkan/texture_vk.cc
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "impeller/renderer/backend/vulkan/context_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/formats_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/surface_context_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/surface_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_surface_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/texture_vk.h"
|
||||
#include "impeller/renderer/vk/compute_shaders_vk.h"
|
||||
#include "impeller/scene/shaders/vk/scene_shaders_vk.h"
|
||||
|
||||
@@ -97,14 +97,14 @@ impeller_component("vulkan") {
|
||||
"shared_object_vk.h",
|
||||
"surface_context_vk.cc",
|
||||
"surface_context_vk.h",
|
||||
"surface_vk.cc",
|
||||
"surface_vk.h",
|
||||
"swapchain_image_vk.cc",
|
||||
"swapchain_image_vk.h",
|
||||
"swapchain_impl_vk.cc",
|
||||
"swapchain_impl_vk.h",
|
||||
"swapchain_vk.cc",
|
||||
"swapchain_vk.h",
|
||||
"swapchain/khr/khr_surface_vk.cc",
|
||||
"swapchain/khr/khr_surface_vk.h",
|
||||
"swapchain/khr/khr_swapchain_image_vk.cc",
|
||||
"swapchain/khr/khr_swapchain_image_vk.h",
|
||||
"swapchain/khr/khr_swapchain_impl_vk.cc",
|
||||
"swapchain/khr/khr_swapchain_impl_vk.h",
|
||||
"swapchain/khr/khr_swapchain_vk.cc",
|
||||
"swapchain/khr/khr_swapchain_vk.h",
|
||||
"texture_source_vk.cc",
|
||||
"texture_source_vk.h",
|
||||
"texture_vk.cc",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "impeller/renderer/backend/vulkan/command_pool_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/context_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_vk.h"
|
||||
#include "impeller/renderer/surface.h"
|
||||
|
||||
namespace impeller {
|
||||
@@ -64,7 +64,7 @@ void SurfaceContextVK::Shutdown() {
|
||||
|
||||
bool SurfaceContextVK::SetWindowSurface(vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size) {
|
||||
auto swapchain = SwapchainVK::Create(parent_, std::move(surface), size);
|
||||
auto swapchain = KHRSwapchainVK::Create(parent_, std::move(surface), size);
|
||||
if (!swapchain) {
|
||||
VALIDATION_LOG << "Could not create swapchain.";
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace impeller {
|
||||
|
||||
class ContextVK;
|
||||
class Surface;
|
||||
class SwapchainVK;
|
||||
class KHRSwapchainVK;
|
||||
|
||||
/// For Vulkan, there is both a ContextVK that implements Context and a
|
||||
/// SurfaceContextVK that also implements Context and takes a ContextVK as its
|
||||
@@ -88,7 +88,7 @@ class SurfaceContextVK : public Context,
|
||||
|
||||
private:
|
||||
std::shared_ptr<ContextVK> parent_;
|
||||
std::shared_ptr<SwapchainVK> swapchain_;
|
||||
std::shared_ptr<KHRSwapchainVK> swapchain_;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Vulkan Swapchains
|
||||
=================
|
||||
|
||||
Contains implementations of swapchains for Window System Integration (WSI) on different platforms.
|
||||
@@ -0,0 +1,4 @@
|
||||
KHR Swapchain
|
||||
=============
|
||||
|
||||
An implementation of a Vulkan swapchain that depends on [`VK_KHR_swapchain`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html). This swapchain is available on most platforms but may not be ideal on all. But, it is a good fallback.
|
||||
@@ -2,18 +2,18 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "impeller/renderer/backend/vulkan/surface_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_surface_vk.h"
|
||||
|
||||
#include "impeller/core/formats.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_image_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/texture_vk.h"
|
||||
#include "impeller/renderer/surface.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
std::unique_ptr<SurfaceVK> SurfaceVK::WrapSwapchainImage(
|
||||
std::unique_ptr<KHRSurfaceVK> KHRSurfaceVK::WrapSwapchainImage(
|
||||
const std::shared_ptr<Context>& context,
|
||||
std::shared_ptr<SwapchainImageVK>& swapchain_image,
|
||||
std::shared_ptr<KHRSwapchainImageVK>& swapchain_image,
|
||||
SwapCallback swap_callback,
|
||||
bool enable_msaa) {
|
||||
if (!context || !swapchain_image || !swap_callback) {
|
||||
@@ -88,16 +88,17 @@ std::unique_ptr<SurfaceVK> SurfaceVK::WrapSwapchainImage(
|
||||
);
|
||||
|
||||
// The constructor is private. So make_unique may not be used.
|
||||
return std::unique_ptr<SurfaceVK>(
|
||||
new SurfaceVK(render_target_desc, std::move(swap_callback)));
|
||||
return std::unique_ptr<KHRSurfaceVK>(
|
||||
new KHRSurfaceVK(render_target_desc, std::move(swap_callback)));
|
||||
}
|
||||
|
||||
SurfaceVK::SurfaceVK(const RenderTarget& target, SwapCallback swap_callback)
|
||||
KHRSurfaceVK::KHRSurfaceVK(const RenderTarget& target,
|
||||
SwapCallback swap_callback)
|
||||
: Surface(target), swap_callback_(std::move(swap_callback)) {}
|
||||
|
||||
SurfaceVK::~SurfaceVK() = default;
|
||||
KHRSurfaceVK::~KHRSurfaceVK() = default;
|
||||
|
||||
bool SurfaceVK::Present() const {
|
||||
bool KHRSurfaceVK::Present() const {
|
||||
return swap_callback_ ? swap_callback_() : false;
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SURFACE_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SURFACE_VK_H_
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SURFACE_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SURFACE_VK_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "impeller/renderer/backend/vulkan/context_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_image_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.h"
|
||||
#include "impeller/renderer/surface.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
class SurfaceVK final : public Surface {
|
||||
class KHRSurfaceVK final : public Surface {
|
||||
public:
|
||||
using SwapCallback = std::function<bool(void)>;
|
||||
|
||||
@@ -22,28 +22,28 @@ class SurfaceVK final : public Surface {
|
||||
/// target by Impeller.
|
||||
///
|
||||
/// This creates the associated MSAA and depth+stencil texture.
|
||||
static std::unique_ptr<SurfaceVK> WrapSwapchainImage(
|
||||
static std::unique_ptr<KHRSurfaceVK> WrapSwapchainImage(
|
||||
const std::shared_ptr<Context>& context,
|
||||
std::shared_ptr<SwapchainImageVK>& swapchain_image,
|
||||
std::shared_ptr<KHRSwapchainImageVK>& swapchain_image,
|
||||
SwapCallback swap_callback,
|
||||
bool enable_msaa = true);
|
||||
|
||||
// |Surface|
|
||||
~SurfaceVK() override;
|
||||
~KHRSurfaceVK() override;
|
||||
|
||||
private:
|
||||
SwapCallback swap_callback_;
|
||||
|
||||
SurfaceVK(const RenderTarget& target, SwapCallback swap_callback);
|
||||
KHRSurfaceVK(const RenderTarget& target, SwapCallback swap_callback);
|
||||
|
||||
// |Surface|
|
||||
bool Present() const override;
|
||||
|
||||
SurfaceVK(const SurfaceVK&) = delete;
|
||||
KHRSurfaceVK(const KHRSurfaceVK&) = delete;
|
||||
|
||||
SurfaceVK& operator=(const SurfaceVK&) = delete;
|
||||
KHRSurfaceVK& operator=(const KHRSurfaceVK&) = delete;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SURFACE_VK_H_
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SURFACE_VK_H_
|
||||
@@ -2,13 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_image_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
SwapchainImageVK::SwapchainImageVK(TextureDescriptor desc,
|
||||
const vk::Device& device,
|
||||
vk::Image image)
|
||||
KHRSwapchainImageVK::KHRSwapchainImageVK(TextureDescriptor desc,
|
||||
const vk::Device& device,
|
||||
vk::Image image)
|
||||
: TextureSourceVK(desc), image_(image) {
|
||||
vk::ImageViewCreateInfo view_info;
|
||||
view_info.image = image_;
|
||||
@@ -29,49 +29,49 @@ SwapchainImageVK::SwapchainImageVK(TextureDescriptor desc,
|
||||
is_valid_ = true;
|
||||
}
|
||||
|
||||
SwapchainImageVK::~SwapchainImageVK() = default;
|
||||
KHRSwapchainImageVK::~KHRSwapchainImageVK() = default;
|
||||
|
||||
bool SwapchainImageVK::IsValid() const {
|
||||
bool KHRSwapchainImageVK::IsValid() const {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Texture> SwapchainImageVK::GetMSAATexture() const {
|
||||
std::shared_ptr<Texture> KHRSwapchainImageVK::GetMSAATexture() const {
|
||||
return msaa_texture_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Texture> SwapchainImageVK::GetDepthStencilTexture() const {
|
||||
std::shared_ptr<Texture> KHRSwapchainImageVK::GetDepthStencilTexture() const {
|
||||
return depth_stencil_texture_;
|
||||
}
|
||||
|
||||
void SwapchainImageVK::SetMSAATexture(std::shared_ptr<Texture> texture) {
|
||||
void KHRSwapchainImageVK::SetMSAATexture(std::shared_ptr<Texture> texture) {
|
||||
msaa_texture_ = std::move(texture);
|
||||
}
|
||||
|
||||
void SwapchainImageVK::SetDepthStencilTexture(
|
||||
void KHRSwapchainImageVK::SetDepthStencilTexture(
|
||||
std::shared_ptr<Texture> texture) {
|
||||
depth_stencil_texture_ = std::move(texture);
|
||||
}
|
||||
|
||||
PixelFormat SwapchainImageVK::GetPixelFormat() const {
|
||||
PixelFormat KHRSwapchainImageVK::GetPixelFormat() const {
|
||||
return desc_.format;
|
||||
}
|
||||
|
||||
ISize SwapchainImageVK::GetSize() const {
|
||||
ISize KHRSwapchainImageVK::GetSize() const {
|
||||
return desc_.size;
|
||||
}
|
||||
|
||||
// |TextureSourceVK|
|
||||
vk::Image SwapchainImageVK::GetImage() const {
|
||||
vk::Image KHRSwapchainImageVK::GetImage() const {
|
||||
return image_;
|
||||
}
|
||||
|
||||
// |TextureSourceVK|
|
||||
vk::ImageView SwapchainImageVK::GetImageView() const {
|
||||
vk::ImageView KHRSwapchainImageVK::GetImageView() const {
|
||||
return image_view_.get();
|
||||
}
|
||||
|
||||
// |TextureSourceVK|
|
||||
vk::ImageView SwapchainImageVK::GetRenderTargetView() const {
|
||||
vk::ImageView KHRSwapchainImageVK::GetRenderTargetView() const {
|
||||
return image_view_.get();
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMAGE_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMAGE_VK_H_
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_IMAGE_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_IMAGE_VK_H_
|
||||
|
||||
#include "impeller/geometry/size.h"
|
||||
#include "impeller/renderer/backend/vulkan/formats_vk.h"
|
||||
@@ -13,14 +13,14 @@
|
||||
|
||||
namespace impeller {
|
||||
|
||||
class SwapchainImageVK final : public TextureSourceVK {
|
||||
class KHRSwapchainImageVK final : public TextureSourceVK {
|
||||
public:
|
||||
SwapchainImageVK(TextureDescriptor desc,
|
||||
const vk::Device& device,
|
||||
vk::Image image);
|
||||
KHRSwapchainImageVK(TextureDescriptor desc,
|
||||
const vk::Device& device,
|
||||
vk::Image image);
|
||||
|
||||
// |TextureSourceVK|
|
||||
~SwapchainImageVK() override;
|
||||
~KHRSwapchainImageVK() override;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
@@ -53,11 +53,11 @@ class SwapchainImageVK final : public TextureSourceVK {
|
||||
std::shared_ptr<Texture> depth_stencil_texture_;
|
||||
bool is_valid_ = false;
|
||||
|
||||
SwapchainImageVK(const SwapchainImageVK&) = delete;
|
||||
KHRSwapchainImageVK(const KHRSwapchainImageVK&) = delete;
|
||||
|
||||
SwapchainImageVK& operator=(const SwapchainImageVK&) = delete;
|
||||
KHRSwapchainImageVK& operator=(const KHRSwapchainImageVK&) = delete;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMAGE_VK_H_
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_IMAGE_VK_H_
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_impl_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_impl_vk.h"
|
||||
|
||||
#include "fml/synchronization/semaphore.h"
|
||||
#include "impeller/base/validation.h"
|
||||
@@ -12,8 +12,8 @@
|
||||
#include "impeller/renderer/backend/vulkan/context_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/formats_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/gpu_tracer_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/surface_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_image_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_surface_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_image_vk.h"
|
||||
#include "impeller/renderer/context.h"
|
||||
#include "vulkan/vulkan_structs.hpp"
|
||||
|
||||
@@ -26,14 +26,14 @@ static constexpr size_t kMaxFramesInFlight = 3u;
|
||||
// orientation will be polled every other frame.
|
||||
static constexpr size_t kPollFramesForOrientation = 1u;
|
||||
|
||||
struct FrameSynchronizer {
|
||||
struct KHRFrameSynchronizerVK {
|
||||
vk::UniqueFence acquire;
|
||||
vk::UniqueSemaphore render_ready;
|
||||
vk::UniqueSemaphore present_ready;
|
||||
std::shared_ptr<CommandBuffer> final_cmd_buffer;
|
||||
bool is_valid = false;
|
||||
|
||||
explicit FrameSynchronizer(const vk::Device& device) {
|
||||
explicit KHRFrameSynchronizerVK(const vk::Device& device) {
|
||||
auto acquire_res = device.createFenceUnique(
|
||||
vk::FenceCreateInfo{vk::FenceCreateFlagBits::eSignaled});
|
||||
auto render_res = device.createSemaphoreUnique({});
|
||||
@@ -50,7 +50,7 @@ struct FrameSynchronizer {
|
||||
is_valid = true;
|
||||
}
|
||||
|
||||
~FrameSynchronizer() = default;
|
||||
~KHRFrameSynchronizerVK() = default;
|
||||
|
||||
bool WaitForFence(const vk::Device& device) {
|
||||
if (auto result = device.waitForFences(
|
||||
@@ -116,21 +116,21 @@ static std::optional<vk::CompositeAlphaFlagBitsKHR> ChooseAlphaCompositionMode(
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::shared_ptr<SwapchainImplVK> SwapchainImplVK::Create(
|
||||
std::shared_ptr<KHRSwapchainImplVK> KHRSwapchainImplVK::Create(
|
||||
const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa,
|
||||
vk::SwapchainKHR old_swapchain) {
|
||||
return std::shared_ptr<SwapchainImplVK>(new SwapchainImplVK(
|
||||
return std::shared_ptr<KHRSwapchainImplVK>(new KHRSwapchainImplVK(
|
||||
context, std::move(surface), size, enable_msaa, old_swapchain));
|
||||
}
|
||||
|
||||
SwapchainImplVK::SwapchainImplVK(const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa,
|
||||
vk::SwapchainKHR old_swapchain) {
|
||||
KHRSwapchainImplVK::KHRSwapchainImplVK(const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa,
|
||||
vk::SwapchainKHR old_swapchain) {
|
||||
if (!context) {
|
||||
VALIDATION_LOG << "Cannot create a swapchain without a context.";
|
||||
return;
|
||||
@@ -263,13 +263,13 @@ SwapchainImplVK::SwapchainImplVK(const std::shared_ptr<Context>& context,
|
||||
std::shared_ptr<Texture> depth_stencil_texture =
|
||||
context->GetResourceAllocator()->CreateTexture(depth_stencil_desc);
|
||||
|
||||
std::vector<std::shared_ptr<SwapchainImageVK>> swapchain_images;
|
||||
std::vector<std::shared_ptr<KHRSwapchainImageVK>> swapchain_images;
|
||||
for (const auto& image : images) {
|
||||
auto swapchain_image =
|
||||
std::make_shared<SwapchainImageVK>(texture_desc, // texture descriptor
|
||||
vk_context.GetDevice(), // device
|
||||
image // image
|
||||
);
|
||||
auto swapchain_image = std::make_shared<KHRSwapchainImageVK>(
|
||||
texture_desc, // texture descriptor
|
||||
vk_context.GetDevice(), // device
|
||||
image // image
|
||||
);
|
||||
if (!swapchain_image->IsValid()) {
|
||||
VALIDATION_LOG << "Could not create swapchain image.";
|
||||
return;
|
||||
@@ -287,9 +287,10 @@ SwapchainImplVK::SwapchainImplVK(const std::shared_ptr<Context>& context,
|
||||
swapchain_images.emplace_back(swapchain_image);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<FrameSynchronizer>> synchronizers;
|
||||
std::vector<std::unique_ptr<KHRFrameSynchronizerVK>> synchronizers;
|
||||
for (size_t i = 0u; i < kMaxFramesInFlight; i++) {
|
||||
auto sync = std::make_unique<FrameSynchronizer>(vk_context.GetDevice());
|
||||
auto sync =
|
||||
std::make_unique<KHRFrameSynchronizerVK>(vk_context.GetDevice());
|
||||
if (!sync->is_valid) {
|
||||
VALIDATION_LOG << "Could not create frame synchronizers.";
|
||||
return;
|
||||
@@ -310,19 +311,19 @@ SwapchainImplVK::SwapchainImplVK(const std::shared_ptr<Context>& context,
|
||||
is_valid_ = true;
|
||||
}
|
||||
|
||||
SwapchainImplVK::~SwapchainImplVK() {
|
||||
KHRSwapchainImplVK::~KHRSwapchainImplVK() {
|
||||
DestroySwapchain();
|
||||
}
|
||||
|
||||
const ISize& SwapchainImplVK::GetSize() const {
|
||||
const ISize& KHRSwapchainImplVK::GetSize() const {
|
||||
return size_;
|
||||
}
|
||||
|
||||
bool SwapchainImplVK::IsValid() const {
|
||||
bool KHRSwapchainImplVK::IsValid() const {
|
||||
return is_valid_;
|
||||
}
|
||||
|
||||
void SwapchainImplVK::WaitIdle() const {
|
||||
void KHRSwapchainImplVK::WaitIdle() const {
|
||||
if (auto context = context_.lock()) {
|
||||
[[maybe_unused]] auto result =
|
||||
ContextVK::Cast(*context).GetDevice().waitIdle();
|
||||
@@ -330,7 +331,7 @@ void SwapchainImplVK::WaitIdle() const {
|
||||
}
|
||||
|
||||
std::pair<vk::UniqueSurfaceKHR, vk::UniqueSwapchainKHR>
|
||||
SwapchainImplVK::DestroySwapchain() {
|
||||
KHRSwapchainImplVK::DestroySwapchain() {
|
||||
WaitIdle();
|
||||
is_valid_ = false;
|
||||
synchronizers_.clear();
|
||||
@@ -339,18 +340,18 @@ SwapchainImplVK::DestroySwapchain() {
|
||||
return {std::move(surface_), std::move(swapchain_)};
|
||||
}
|
||||
|
||||
vk::Format SwapchainImplVK::GetSurfaceFormat() const {
|
||||
vk::Format KHRSwapchainImplVK::GetSurfaceFormat() const {
|
||||
return surface_format_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Context> SwapchainImplVK::GetContext() const {
|
||||
std::shared_ptr<Context> KHRSwapchainImplVK::GetContext() const {
|
||||
return context_.lock();
|
||||
}
|
||||
|
||||
SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
|
||||
KHRSwapchainImplVK::AcquireResult KHRSwapchainImplVK::AcquireNextDrawable() {
|
||||
auto context_strong = context_.lock();
|
||||
if (!context_strong) {
|
||||
return SwapchainImplVK::AcquireResult{};
|
||||
return KHRSwapchainImplVK::AcquireResult{};
|
||||
}
|
||||
|
||||
const auto& context = ContextVK::Cast(*context_strong);
|
||||
@@ -364,7 +365,7 @@ SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
|
||||
///
|
||||
if (!sync->WaitForFence(context.GetDevice())) {
|
||||
VALIDATION_LOG << "Could not wait for fence.";
|
||||
return SwapchainImplVK::AcquireResult{};
|
||||
return KHRSwapchainImplVK::AcquireResult{};
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -395,7 +396,7 @@ SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
|
||||
|
||||
if (index >= images_.size()) {
|
||||
VALIDATION_LOG << "Swapchain returned an invalid image index.";
|
||||
return SwapchainImplVK::AcquireResult{};
|
||||
return KHRSwapchainImplVK::AcquireResult{};
|
||||
}
|
||||
|
||||
/// Record all subsequent cmd buffers as part of the current frame.
|
||||
@@ -403,7 +404,7 @@ SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
|
||||
|
||||
auto image = images_[index % images_.size()];
|
||||
uint32_t image_index = index;
|
||||
return AcquireResult{SurfaceVK::WrapSwapchainImage(
|
||||
return AcquireResult{KHRSurfaceVK::WrapSwapchainImage(
|
||||
context_strong, // context
|
||||
image, // swapchain image
|
||||
[weak_swapchain = weak_from_this(), image, image_index]() -> bool {
|
||||
@@ -417,8 +418,9 @@ SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
|
||||
)};
|
||||
}
|
||||
|
||||
bool SwapchainImplVK::Present(const std::shared_ptr<SwapchainImageVK>& image,
|
||||
uint32_t index) {
|
||||
bool KHRSwapchainImplVK::Present(
|
||||
const std::shared_ptr<KHRSwapchainImageVK>& image,
|
||||
uint32_t index) {
|
||||
auto context_strong = context_.lock();
|
||||
if (!context_strong) {
|
||||
return false;
|
||||
@@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMPL_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMPL_VK_H_
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_IMPL_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_IMPL_VK_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@@ -16,9 +16,9 @@
|
||||
namespace impeller {
|
||||
|
||||
class Context;
|
||||
class SwapchainImageVK;
|
||||
class KHRSwapchainImageVK;
|
||||
class Surface;
|
||||
struct FrameSynchronizer;
|
||||
struct KHRFrameSynchronizerVK;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief An instance of a swapchain that does NOT adapt to going out of
|
||||
@@ -28,17 +28,17 @@ struct FrameSynchronizer;
|
||||
/// the caller must recreate another instance by optionally
|
||||
/// stealing this implementations guts.
|
||||
///
|
||||
class SwapchainImplVK final
|
||||
: public std::enable_shared_from_this<SwapchainImplVK> {
|
||||
class KHRSwapchainImplVK final
|
||||
: public std::enable_shared_from_this<KHRSwapchainImplVK> {
|
||||
public:
|
||||
static std::shared_ptr<SwapchainImplVK> Create(
|
||||
static std::shared_ptr<KHRSwapchainImplVK> Create(
|
||||
const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa = true,
|
||||
vk::SwapchainKHR old_swapchain = VK_NULL_HANDLE);
|
||||
|
||||
~SwapchainImplVK();
|
||||
~KHRSwapchainImplVK();
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
@@ -68,28 +68,29 @@ class SwapchainImplVK final
|
||||
vk::UniqueSurfaceKHR surface_;
|
||||
vk::Format surface_format_ = vk::Format::eUndefined;
|
||||
vk::UniqueSwapchainKHR swapchain_;
|
||||
std::vector<std::shared_ptr<SwapchainImageVK>> images_;
|
||||
std::vector<std::unique_ptr<FrameSynchronizer>> synchronizers_;
|
||||
std::vector<std::shared_ptr<KHRSwapchainImageVK>> images_;
|
||||
std::vector<std::unique_ptr<KHRFrameSynchronizerVK>> synchronizers_;
|
||||
size_t current_frame_ = 0u;
|
||||
ISize size_;
|
||||
bool enable_msaa_ = true;
|
||||
bool is_valid_ = false;
|
||||
|
||||
SwapchainImplVK(const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa,
|
||||
vk::SwapchainKHR old_swapchain);
|
||||
KHRSwapchainImplVK(const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa,
|
||||
vk::SwapchainKHR old_swapchain);
|
||||
|
||||
bool Present(const std::shared_ptr<SwapchainImageVK>& image, uint32_t index);
|
||||
bool Present(const std::shared_ptr<KHRSwapchainImageVK>& image,
|
||||
uint32_t index);
|
||||
|
||||
void WaitIdle() const;
|
||||
|
||||
SwapchainImplVK(const SwapchainImplVK&) = delete;
|
||||
KHRSwapchainImplVK(const KHRSwapchainImplVK&) = delete;
|
||||
|
||||
SwapchainImplVK& operator=(const SwapchainImplVK&) = delete;
|
||||
KHRSwapchainImplVK& operator=(const KHRSwapchainImplVK&) = delete;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMPL_VK_H_
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_IMPL_VK_H_
|
||||
@@ -2,47 +2,47 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_vk.h"
|
||||
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_impl_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_impl_vk.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
std::shared_ptr<SwapchainVK> SwapchainVK::Create(
|
||||
std::shared_ptr<KHRSwapchainVK> KHRSwapchainVK::Create(
|
||||
const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa) {
|
||||
auto impl =
|
||||
SwapchainImplVK::Create(context, std::move(surface), size, enable_msaa);
|
||||
auto impl = KHRSwapchainImplVK::Create(context, std::move(surface), size,
|
||||
enable_msaa);
|
||||
if (!impl || !impl->IsValid()) {
|
||||
VALIDATION_LOG << "Failed to create SwapchainVK implementation.";
|
||||
return nullptr;
|
||||
}
|
||||
return std::shared_ptr<SwapchainVK>(
|
||||
new SwapchainVK(std::move(impl), size, enable_msaa));
|
||||
return std::shared_ptr<KHRSwapchainVK>(
|
||||
new KHRSwapchainVK(std::move(impl), size, enable_msaa));
|
||||
}
|
||||
|
||||
SwapchainVK::SwapchainVK(std::shared_ptr<SwapchainImplVK> impl,
|
||||
const ISize& size,
|
||||
bool enable_msaa)
|
||||
KHRSwapchainVK::KHRSwapchainVK(std::shared_ptr<KHRSwapchainImplVK> impl,
|
||||
const ISize& size,
|
||||
bool enable_msaa)
|
||||
: impl_(std::move(impl)), size_(size), enable_msaa_(enable_msaa) {}
|
||||
|
||||
SwapchainVK::~SwapchainVK() = default;
|
||||
KHRSwapchainVK::~KHRSwapchainVK() = default;
|
||||
|
||||
bool SwapchainVK::IsValid() const {
|
||||
bool KHRSwapchainVK::IsValid() const {
|
||||
return impl_ ? impl_->IsValid() : false;
|
||||
}
|
||||
|
||||
void SwapchainVK::UpdateSurfaceSize(const ISize& size) {
|
||||
void KHRSwapchainVK::UpdateSurfaceSize(const ISize& size) {
|
||||
// Update the size of the swapchain. On the next acquired drawable,
|
||||
// the sizes may no longer match, forcing the swapchain to be recreated.
|
||||
size_ = size;
|
||||
}
|
||||
|
||||
std::unique_ptr<Surface> SwapchainVK::AcquireNextDrawable() {
|
||||
std::unique_ptr<Surface> KHRSwapchainVK::AcquireNextDrawable() {
|
||||
if (!IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -61,11 +61,11 @@ std::unique_ptr<Surface> SwapchainVK::AcquireNextDrawable() {
|
||||
auto context = impl_->GetContext();
|
||||
auto [surface, old_swapchain] = impl_->DestroySwapchain();
|
||||
|
||||
auto new_impl = SwapchainImplVK::Create(context, //
|
||||
std::move(surface), //
|
||||
size_, //
|
||||
enable_msaa_, //
|
||||
*old_swapchain //
|
||||
auto new_impl = KHRSwapchainImplVK::Create(context, //
|
||||
std::move(surface), //
|
||||
size_, //
|
||||
enable_msaa_, //
|
||||
*old_swapchain //
|
||||
);
|
||||
if (!new_impl || !new_impl->IsValid()) {
|
||||
VALIDATION_LOG << "Could not update swapchain.";
|
||||
@@ -82,7 +82,7 @@ std::unique_ptr<Surface> SwapchainVK::AcquireNextDrawable() {
|
||||
return AcquireNextDrawable();
|
||||
}
|
||||
|
||||
vk::Format SwapchainVK::GetSurfaceFormat() const {
|
||||
vk::Format KHRSwapchainVK::GetSurfaceFormat() const {
|
||||
return IsValid() ? impl_->GetSurfaceFormat() : vk::Format::eUndefined;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_VK_H_
|
||||
#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_VK_H_
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_VK_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace impeller {
|
||||
|
||||
class SwapchainImplVK;
|
||||
class KHRSwapchainImplVK;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief A swapchain that adapts to the underlying surface going out of
|
||||
@@ -22,15 +22,15 @@ class SwapchainImplVK;
|
||||
/// to an unrecoverable error and the swapchain must be recreated
|
||||
/// with a new surface.
|
||||
///
|
||||
class SwapchainVK {
|
||||
class KHRSwapchainVK {
|
||||
public:
|
||||
static std::shared_ptr<SwapchainVK> Create(
|
||||
static std::shared_ptr<KHRSwapchainVK> Create(
|
||||
const std::shared_ptr<Context>& context,
|
||||
vk::UniqueSurfaceKHR surface,
|
||||
const ISize& size,
|
||||
bool enable_msaa = true);
|
||||
|
||||
~SwapchainVK();
|
||||
~KHRSwapchainVK();
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
@@ -43,19 +43,19 @@ class SwapchainVK {
|
||||
void UpdateSurfaceSize(const ISize& size);
|
||||
|
||||
private:
|
||||
std::shared_ptr<SwapchainImplVK> impl_;
|
||||
std::shared_ptr<KHRSwapchainImplVK> impl_;
|
||||
ISize size_;
|
||||
const bool enable_msaa_;
|
||||
|
||||
SwapchainVK(std::shared_ptr<SwapchainImplVK> impl,
|
||||
const ISize& size,
|
||||
bool enable_msaa);
|
||||
KHRSwapchainVK(std::shared_ptr<KHRSwapchainImplVK> impl,
|
||||
const ISize& size,
|
||||
bool enable_msaa);
|
||||
|
||||
SwapchainVK(const SwapchainVK&) = delete;
|
||||
KHRSwapchainVK(const KHRSwapchainVK&) = delete;
|
||||
|
||||
SwapchainVK& operator=(const SwapchainVK&) = delete;
|
||||
KHRSwapchainVK& operator=(const KHRSwapchainVK&) = delete;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_VK_H_
|
||||
#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_VK_H_
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "flutter/testing/testing.h" // IWYU pragma: keep
|
||||
#include "gtest/gtest.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_vk.h"
|
||||
#include "impeller/renderer/backend/vulkan/test/mock_vulkan.h"
|
||||
#include "impeller/renderer/backend/vulkan/texture_vk.h"
|
||||
#include "vulkan/vulkan_enums.hpp"
|
||||
@@ -30,7 +30,7 @@ TEST(SwapchainTest, CanCreateSwapchain) {
|
||||
|
||||
auto surface = CreateSurface(*context);
|
||||
auto swapchain =
|
||||
SwapchainVK::Create(context, std::move(surface), ISize{1, 1});
|
||||
KHRSwapchainVK::Create(context, std::move(surface), ISize{1, 1});
|
||||
|
||||
EXPECT_TRUE(swapchain->IsValid());
|
||||
}
|
||||
@@ -40,8 +40,9 @@ TEST(SwapchainTest, RecreateSwapchainWhenSizeChanges) {
|
||||
|
||||
auto surface = CreateSurface(*context);
|
||||
SetSwapchainImageSize(ISize{1, 1});
|
||||
auto swapchain = SwapchainVK::Create(context, std::move(surface), ISize{1, 1},
|
||||
/*enable_msaa=*/false);
|
||||
auto swapchain =
|
||||
KHRSwapchainVK::Create(context, std::move(surface), ISize{1, 1},
|
||||
/*enable_msaa=*/false);
|
||||
auto image = swapchain->AcquireNextDrawable();
|
||||
auto expected_size = ISize{1, 1};
|
||||
EXPECT_EQ(image->GetSize(), expected_size);
|
||||
@@ -59,7 +60,7 @@ TEST(SwapchainTest, CachesRenderPassOnSwapchainImage) {
|
||||
|
||||
auto surface = CreateSurface(*context);
|
||||
auto swapchain =
|
||||
SwapchainVK::Create(context, std::move(surface), ISize{1, 1});
|
||||
KHRSwapchainVK::Create(context, std::move(surface), ISize{1, 1});
|
||||
|
||||
EXPECT_TRUE(swapchain->IsValid());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user