增加vulkan Seamphore创建
This commit is contained in:
parent
389efebf2e
commit
c96eea7bbb
@ -5,6 +5,7 @@
|
||||
//#include"VKDescriptorSet.h"
|
||||
#include"VKRenderPass.h"
|
||||
#include"VKFence.h"
|
||||
#include"VKSemaphore.h"
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
@ -198,4 +199,18 @@ Fence *Device::CreateFence()
|
||||
|
||||
return(new Fence(attr->device,drawFence));
|
||||
}
|
||||
|
||||
Semaphore *Device::CreateSem()
|
||||
{
|
||||
VkSemaphoreCreateInfo SemaphoreCreateInfo;
|
||||
SemaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
SemaphoreCreateInfo.pNext = nullptr;
|
||||
SemaphoreCreateInfo.flags = 0;
|
||||
|
||||
VkSemaphore sem;
|
||||
if(vkCreateSemaphore(attr->device, &SemaphoreCreateInfo, nullptr, &sem)!=VK_SUCCESS)
|
||||
return(nullptr);
|
||||
|
||||
return(new Semaphore(attr->device,sem));
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
|
@ -13,6 +13,7 @@ class VertexBuffer;
|
||||
class CommandBuffer;
|
||||
class RenderPass;
|
||||
class Fence;
|
||||
class Semaphore;
|
||||
|
||||
class Device
|
||||
{
|
||||
@ -63,6 +64,8 @@ public:
|
||||
RenderPass *CreateRenderPass();
|
||||
|
||||
Fence *CreateFence();
|
||||
|
||||
Semaphore *CreateSem();
|
||||
};//class Device
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_RENDER_SURFACE_INCLUDE
|
||||
|
@ -1,4 +1,7 @@
|
||||
#include"VKSemaphore.h"
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
Semaphore::~Semaphore()
|
||||
{
|
||||
vkDestroySemaphore(device,sem,nullptr);
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
|
@ -5,7 +5,22 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
class Semaphore
|
||||
{
|
||||
VkDevice device;
|
||||
VkSemaphore sem;
|
||||
|
||||
private:
|
||||
|
||||
friend class Device;
|
||||
|
||||
Semaphore(VkDevice d,VkSemaphore s)
|
||||
{
|
||||
device=d;
|
||||
sem=s;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
~Semaphore();
|
||||
};//class Semaphore
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_SEMAPHORE_INCLUDE
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include"VKPipeline.h"
|
||||
#include"VKCommandBuffer.h"
|
||||
#include"VKFence.h"
|
||||
#include"VKSemaphore.h"
|
||||
|
||||
#include<io.h>
|
||||
#include<fcntl.h>
|
||||
@ -122,6 +123,7 @@ int main(int,char **)
|
||||
return -3;
|
||||
|
||||
vulkan::Fence *fence=device->CreateFence();
|
||||
vulkan::Semaphore *sem=device->CreateSem();
|
||||
|
||||
vulkan::VertexInput vi;
|
||||
vulkan::PipelineCreater pc(device);
|
||||
@ -144,6 +146,7 @@ int main(int,char **)
|
||||
delete pipeline;
|
||||
}
|
||||
|
||||
delete sem;
|
||||
delete fence;
|
||||
delete rp;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user