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 bool isIntegrateGpu() override;
17 //void create(IRenderTarget* target) override;
18 uint32_t findMemoryType(uint32_t typeFilter, vk::MemoryPropertyFlags properties);
19 void createPlatform() override;
20 auto device()
21 {
22 return m_device;
23 }
24 auto getDevice() const {
25 return m_device;
26 }
27 auto getPhysicalDevice() const {
28 return m_phyDevice;
29 }
30
31 vk::Instance getVkInstance();
32 void beginCommandBuffer(int index);
33 void endCommandBuffer(int index);
35
36 void clear(Vec4 color,float depth = 1.0,float stencil = 0.0){
37
38 }
39 uint32_t getGraphicsQueueFamily() const;
41 vk::CommandBuffer beginSingleTimeTransferCommands();
42 void endSingleTimeTransferCommands(vk::CommandBuffer commandBuffer, vk::Fence* outFence);
43
44 vk::Queue getGraphicsQueue()
45 {
46 return m_graphicsQueue;
47 }
48
49 vk::CommandBuffer beginSingleTimeCommands();
50 void endSingleTimeCommands(vk::CommandBuffer commandBuffer);
51 void transferDataToBuffer(vk::Buffer dstBuffer, size_t size, const void* data);
52 void transferDataToImage(vk::Image dstImage, uint32_t width, uint32_t height, vk::Format format,
53 const void* data,
54 size_t dataSize, vk::Fence* outFence = nullptr, std::function<void()>* cleanUpCallback = nullptr);
55 void transferDataToImage(vk::Image dstImage, uint32_t width, uint32_t height, uint32_t depth, vk::Format format,
56 uint32_t mipLevels, uint32_t arrayLayers, vk::ImageAspectFlags aspectMask,
57 const void* data,
58 size_t dataSize, vk::Fence* outFence = nullptr, std::function<void()>* cleanUpCallback = nullptr);
59
60 private:
64 vk::Device m_device;
65 vk::PhysicalDevice m_phyDevice;
66 vk::Queue m_graphicsQueue;
67 vk::CommandPool m_commandPool;
68 std::vector<vk::CommandBuffer> m_commandBuffers;
69
71 vk::Queue m_transferQueue;
72 vk::CommandPool m_transferCommandPool;
73 };
74}
75
76#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
bool isIntegrateGpu() override
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