FCT
载入中...
搜索中...
未找到
VK_Context.h
浏览该文件的文档.
1//
2// Created by Administrator on 2025/3/1.
3//
4#ifndef VK_CONTEXT_H
5#define VK_CONTEXT_H
6#include "../ThirdParty.h"
7#include "./Context.h"
8
9namespace FCT {
10 class VK_ContextCommon;
11 class VK_Context : public Context {
12 public:
14 ~VK_Context() override;
16 //void create(IRenderTarget* target) override;
17 uint32_t findMemoryType(uint32_t typeFilter, vk::MemoryPropertyFlags properties);
18 void createPlatform() override;
19 auto device()
20 {
21 return m_device;
22 }
23 auto getDevice() const {
24 return m_device;
25 }
26 auto getPhysicalDevice() const {
27 return m_phyDevice;
28 }
29
30 vk::Instance getVkInstance();
31 void beginCommandBuffer(int index);
32 void endCommandBuffer(int index);
34
35 void clear(Vec4 color,float depth = 1.0,float stencil = 0.0){
36
37 }
38 uint32_t getGraphicsQueueFamily() const;
40 vk::CommandBuffer beginSingleTimeTransferCommands();
41 void endSingleTimeTransferCommands(vk::CommandBuffer commandBuffer, vk::Fence* outFence);
42
43 vk::Queue getGraphicsQueue()
44 {
45 return m_graphicsQueue;
46 }
47
48 vk::CommandBuffer beginSingleTimeCommands();
49 void endSingleTimeCommands(vk::CommandBuffer commandBuffer);
50 void transferDataToBuffer(vk::Buffer dstBuffer, size_t size, const void* data);
51 void transferDataToImage(vk::Image dstImage, uint32_t width, uint32_t height, vk::Format format,
52 const void* data,
53 size_t dataSize, vk::Fence* outFence = nullptr, std::function<void()>* cleanUpCallback = nullptr);
54 void transferDataToImage(vk::Image dstImage, uint32_t width, uint32_t height, uint32_t depth, vk::Format format,
55 uint32_t mipLevels, uint32_t arrayLayers, vk::ImageAspectFlags aspectMask,
56 const void* data,
57 size_t dataSize, vk::Fence* outFence = nullptr, std::function<void()>* cleanUpCallback = nullptr);
58
59 private:
63 vk::Device m_device;
64 vk::PhysicalDevice m_phyDevice;
65 vk::Queue m_graphicsQueue;
66 vk::CommandPool m_commandPool;
67 std::vector<vk::CommandBuffer> m_commandBuffers;
68
70 vk::Queue m_transferQueue;
71 vk::CommandPool m_transferCommandPool;
72 };
73}
74
75#endif //VK_CONTEXT_H
Context(Runtime *runtime)
RHI::RasterizationPipeline * createTraditionPipeline() override
void createPlatform() override
vk::PhysicalDevice m_phyDevice
uint32_t findMemoryType(uint32_t typeFilter, vk::MemoryPropertyFlags properties)
auto getDevice() const
vk::Queue m_graphicsQueue
uint32_t getGraphicsQueueFamily() const
vk::Queue getGraphicsQueue()
VK_Context(VK_ContextCommon *common)
vk::Instance getVkInstance()
void transferDataToBuffer(vk::Buffer dstBuffer, size_t size, const void *data)
void endCommandBuffer(int index)
VK_ContextCommon * m_common
uint32_t m_transferQueueFamilyIndex
void beginCommandBuffer(int index)
void clear(Vec4 color, float depth=1.0, float stencil=0.0)
void endSingleTimeTransferCommands(vk::CommandBuffer commandBuffer, vk::Fence *outFence)
vk::Queue m_transferQueue
std::vector< vk::CommandBuffer > m_commandBuffers
void transferDataToImage(vk::Image dstImage, uint32_t width, uint32_t height, vk::Format format, const void *data, size_t dataSize, vk::Fence *outFence=nullptr, std::function< void()> *cleanUpCallback=nullptr)
void endSingleTimeCommands(vk::CommandBuffer commandBuffer)
uint32_t m_graphicsQueueFamilyIndex
vk::CommandBuffer beginSingleTimeCommands()
vk::CommandBuffer beginSingleTimeTransferCommands()
vk::CommandPool m_commandPool
auto getPhysicalDevice() const
vk::CommandPool m_transferCommandPool