Vulkan/RenderTarget: Change interface to better suit needs

Former-commit-id: cc61462eca9a4b73821eb0c9bd10b74366e5a6ce [formerly 8e64df958d6b9ccd61b9df22456cd566947fcb0b]
Former-commit-id: 750ea64ee603b0c52058eb93045310db4977dfdb
This commit is contained in:
Lynix
2016-07-08 17:59:43 +02:00
parent 8d3680f4b9
commit f1c5f8d0b7
3 changed files with 232 additions and 236 deletions

View File

@@ -17,7 +17,6 @@
#include <Nazara/Vulkan/VkCommandPool.hpp>
#include <Nazara/Vulkan/VkDevice.hpp>
#include <Nazara/Vulkan/VkFramebuffer.hpp>
#include <Nazara/Vulkan/VkSemaphore.hpp>
#include <Nazara/Vulkan/VkSurface.hpp>
#include <Nazara/Vulkan/VkSwapchain.hpp>
#include <Nazara/Utility/Window.hpp>
@@ -35,7 +34,14 @@ namespace Nz
RenderWindow(RenderWindow&&) = delete; ///TODO
virtual ~RenderWindow();
bool Acquire(const Vk::Framebuffer** framebuffer) const override;
bool Acquire(UInt32* index) const override;
void BuildPreRenderCommands(UInt32 imageIndex, Vk::CommandBuffer& commandBuffer) override;
void BuildPostRenderCommands(UInt32 imageIndex, Vk::CommandBuffer& commandBuffer) override;
const Vk::Framebuffer& GetFrameBuffer(UInt32 imageIndex) const override;
UInt32 GetFramebufferCount() const;
bool Create(VideoMode mode, const String& title, UInt32 style = WindowStyle_Default);
bool Create(WindowHandle handle);
@@ -45,7 +51,7 @@ namespace Nz
const Vk::Surface& GetSurface() const;
const Vk::Swapchain& GetSwapchain() const;
void Present() override;
void Present(UInt32 imageIndex) override;
bool IsValid() const;
@@ -59,25 +65,20 @@ namespace Nz
void OnWindowDestroy() override;
void OnWindowResized() override;
bool SetupRenderPass(VkFormat colorFormat, VkFormat depthFormat);
struct ImageData
{
Vk::CommandBuffer drawToPresentCmd;
Vk::CommandBuffer presentToDrawCmd;
Vk::Framebuffer frameBuffer;
};
bool SetupCommandBuffers();
bool SetupRenderPass();
bool SetupSwapchain();
Clock m_clock;
VkFormat m_colorFormat;
VkFormat m_depthFormat;
VkColorSpaceKHR m_colorSpace;
VkPhysicalDevice m_forcedPhysicalDevice;
std::vector<ImageData> m_images;
Vk::CommandPool m_cmdPool;
std::vector<Vk::Framebuffer> m_frameBuffers;
Vk::DeviceHandle m_device;
Vk::Queue m_presentQueue;
Vk::Semaphore m_imageReadySemaphore;
Vk::Surface m_surface;
Vk::Swapchain m_swapchain;
mutable UInt32 m_lastImageAcquired;
UInt32 m_presentableFamilyQueue;
};
}