新增VKFence创建
This commit is contained in:
parent
2e41b03f05
commit
389efebf2e
@ -4,6 +4,7 @@
|
|||||||
#include"VKCommandBuffer.h"
|
#include"VKCommandBuffer.h"
|
||||||
//#include"VKDescriptorSet.h"
|
//#include"VKDescriptorSet.h"
|
||||||
#include"VKRenderPass.h"
|
#include"VKRenderPass.h"
|
||||||
|
#include"VKFence.h"
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -182,4 +183,19 @@ RenderPass *Device::CreateRenderPass()
|
|||||||
|
|
||||||
return(new RenderPass(attr->device,render_pass));
|
return(new RenderPass(attr->device,render_pass));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Fence *Device::CreateFence()
|
||||||
|
{
|
||||||
|
VkFenceCreateInfo fenceInfo;
|
||||||
|
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||||
|
fenceInfo.pNext = nullptr;
|
||||||
|
fenceInfo.flags = 0;
|
||||||
|
|
||||||
|
VkFence drawFence;
|
||||||
|
|
||||||
|
if(vkCreateFence(attr->device, &fenceInfo, nullptr, &drawFence)!=VK_SUCCESS)
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
return(new Fence(attr->device,drawFence));
|
||||||
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -12,6 +12,7 @@ class Buffer;
|
|||||||
class VertexBuffer;
|
class VertexBuffer;
|
||||||
class CommandBuffer;
|
class CommandBuffer;
|
||||||
class RenderPass;
|
class RenderPass;
|
||||||
|
class Fence;
|
||||||
|
|
||||||
class Device
|
class Device
|
||||||
{
|
{
|
||||||
@ -60,6 +61,8 @@ public:
|
|||||||
// DescriptorSet * CreateDescSet(int);
|
// DescriptorSet * CreateDescSet(int);
|
||||||
|
|
||||||
RenderPass *CreateRenderPass();
|
RenderPass *CreateRenderPass();
|
||||||
|
|
||||||
|
Fence *CreateFence();
|
||||||
};//class Device
|
};//class Device
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_RENDER_SURFACE_INCLUDE
|
#endif//HGL_GRAPH_RENDER_SURFACE_INCLUDE
|
||||||
|
7
example/Vulkan/VKFence.cpp
Normal file
7
example/Vulkan/VKFence.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include"VKFence.h"
|
||||||
|
VK_NAMESPACE_BEGIN
|
||||||
|
Fence::~Fence()
|
||||||
|
{
|
||||||
|
vkDestroyFence(device,fence,nullptr);
|
||||||
|
}
|
||||||
|
VK_NAMESPACE_END
|
26
example/Vulkan/VKFence.h
Normal file
26
example/Vulkan/VKFence.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef HGL_VULKAN_GRAPH_FENCE_INCLUDE
|
||||||
|
#define HGL_VULKAN_GRAPH_FENCE_INCLUDE
|
||||||
|
|
||||||
|
#include"VK.h"
|
||||||
|
VK_NAMESPACE_BEGIN
|
||||||
|
class Fence
|
||||||
|
{
|
||||||
|
VkDevice device;
|
||||||
|
VkFence fence;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class Device;
|
||||||
|
|
||||||
|
Fence(VkDevice d,VkFence f)
|
||||||
|
{
|
||||||
|
device=d;
|
||||||
|
fence=f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~Fence();
|
||||||
|
};//class Fence
|
||||||
|
VK_NAMESPACE_END
|
||||||
|
#endif//HGL_VULKAN_GRAPH_FENCE_INCLUDE
|
@ -10,6 +10,7 @@
|
|||||||
#include"VKPipelineLayout.h"
|
#include"VKPipelineLayout.h"
|
||||||
#include"VKPipeline.h"
|
#include"VKPipeline.h"
|
||||||
#include"VKCommandBuffer.h"
|
#include"VKCommandBuffer.h"
|
||||||
|
#include"VKFence.h"
|
||||||
|
|
||||||
#include<io.h>
|
#include<io.h>
|
||||||
#include<fcntl.h>
|
#include<fcntl.h>
|
||||||
@ -120,6 +121,8 @@ int main(int,char **)
|
|||||||
if(!shader)
|
if(!shader)
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
|
vulkan::Fence *fence=device->CreateFence();
|
||||||
|
|
||||||
vulkan::VertexInput vi;
|
vulkan::VertexInput vi;
|
||||||
vulkan::PipelineCreater pc(device);
|
vulkan::PipelineCreater pc(device);
|
||||||
vulkan::RenderPass *rp=device->CreateRenderPass();
|
vulkan::RenderPass *rp=device->CreateRenderPass();
|
||||||
@ -141,6 +144,7 @@ int main(int,char **)
|
|||||||
delete pipeline;
|
delete pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete fence;
|
||||||
delete rp;
|
delete rp;
|
||||||
|
|
||||||
delete ubo;
|
delete ubo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user