Device增加AcquireNextImage
This commit is contained in:
parent
c96eea7bbb
commit
2547bc36a7
@ -57,8 +57,15 @@ namespace
|
|||||||
}
|
}
|
||||||
}//namespace
|
}//namespace
|
||||||
|
|
||||||
|
Device::Device(DeviceAttribute *da)
|
||||||
|
{
|
||||||
|
attr=da;
|
||||||
|
current_framebuffer=0;
|
||||||
|
image_acquired_semaphore=this->CreateSem();
|
||||||
|
}
|
||||||
Device::~Device()
|
Device::~Device()
|
||||||
{
|
{
|
||||||
|
delete image_acquired_semaphore;
|
||||||
delete attr;
|
delete attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,4 +220,9 @@ Semaphore *Device::CreateSem()
|
|||||||
|
|
||||||
return(new Semaphore(attr->device,sem));
|
return(new Semaphore(attr->device,sem));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::AcquireNextImage()
|
||||||
|
{
|
||||||
|
return(vkAcquireNextImageKHR(attr->device,attr->swap_chain,UINT64_MAX,*image_acquired_semaphore,VK_NULL_HANDLE,¤t_framebuffer)==VK_SUCCESS);
|
||||||
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -19,14 +19,14 @@ class Device
|
|||||||
{
|
{
|
||||||
DeviceAttribute *attr;
|
DeviceAttribute *attr;
|
||||||
|
|
||||||
|
Semaphore *image_acquired_semaphore;
|
||||||
|
uint32_t current_framebuffer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
friend Device *CreateRenderDevice(VkInstance,const PhysicalDevice *,Window *);
|
friend Device *CreateRenderDevice(VkInstance,const PhysicalDevice *,Window *);
|
||||||
|
|
||||||
Device(DeviceAttribute *da)
|
Device(DeviceAttribute *da);
|
||||||
{
|
|
||||||
attr=da;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -66,6 +66,8 @@ public:
|
|||||||
Fence *CreateFence();
|
Fence *CreateFence();
|
||||||
|
|
||||||
Semaphore *CreateSem();
|
Semaphore *CreateSem();
|
||||||
|
|
||||||
|
bool AcquireNextImage();
|
||||||
};//class Device
|
};//class Device
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_RENDER_SURFACE_INCLUDE
|
#endif//HGL_GRAPH_RENDER_SURFACE_INCLUDE
|
||||||
|
@ -21,6 +21,8 @@ private:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
~Semaphore();
|
~Semaphore();
|
||||||
|
|
||||||
|
operator VkSemaphore(){return sem;}
|
||||||
};//class Semaphore
|
};//class Semaphore
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_VULKAN_SEMAPHORE_INCLUDE
|
#endif//HGL_GRAPH_VULKAN_SEMAPHORE_INCLUDE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user