Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/Graphics/Swapchain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Swapchain

virtual uint32_t width() const = 0;
virtual uint32_t height() const = 0;
virtual PixelFormat pixelFormat() const = 0;

virtual std::shared_ptr<Drawable> nextDrawable() = 0;

Expand Down
2 changes: 2 additions & 0 deletions src/Metal/MetalSwapchain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MetalSwapchain : public Swapchain

inline uint32_t width() const override { return m_width; }
inline uint32_t height() const override { return m_height; }
inline PixelFormat pixelFormat() const override { return m_pixelFormat; };

std::shared_ptr<Drawable> nextDrawable() override;

Expand All @@ -41,6 +42,7 @@ class MetalSwapchain : public Swapchain
uint32_t m_width;
uint32_t m_height;
CAMetalLayer* m_mtlLayer;
PixelFormat m_pixelFormat;

public:
MetalSwapchain& operator=(const MetalSwapchain&) = delete;
Expand Down
3 changes: 2 additions & 1 deletion src/Metal/MetalSwapchain.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

MetalSwapchain::MetalSwapchain(const MetalDevice& device, const Swapchain::Descriptor& desc)
: m_width(desc.width)
, m_height(desc.height) { @autoreleasepool
, m_height(desc.height)
, m_pixelFormat(desc.pixelFormat) { @autoreleasepool
{
assert(desc.surface);
auto* mtlSurface = dynamic_cast<MetalSurface*>(desc.surface);
Expand Down
1 change: 1 addition & 0 deletions src/Vulkan/VulkanSwapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace gfx

VulkanSwapchain::VulkanSwapchain(const VulkanDevice* device, const Descriptor& desc)
: m_device(device)
, m_pixelFormat(desc.pixelFormat)
{
assert(desc.surface);
const vk::SurfaceKHR& vkSurface = dynamic_cast<const VulkanSurface&>(*desc.surface).vkSurface();
Expand Down
2 changes: 2 additions & 0 deletions src/Vulkan/VulkanSwapchain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class VulkanSwapchain : public Swapchain

inline uint32_t width() const override { return m_extent.width; }
inline uint32_t height() const override { return m_extent.height; }
inline PixelFormat pixelFormat() const override { return m_pixelFormat; };

std::shared_ptr<Drawable> nextDrawable() override;

Expand All @@ -41,6 +42,7 @@ class VulkanSwapchain : public Swapchain
private:
const VulkanDevice* m_device;
vk::Extent2D m_extent;
PixelFormat m_pixelFormat;

vk::SwapchainKHR* m_vkSwapchain;
std::vector<std::shared_ptr<SwapchainImage>> m_swapchainImages;
Expand Down