zengine/engine/modules/render/vulkan/include/vkn/thread/worker.h

32 lines
876 B
C
Raw Normal View History

2024-08-23 22:13:05 +08:00
#pragma once
#include "vkn/wrapper/commandpool.h"
#include "thread_worker.h"
namespace vkn {
class Device;
class Queue;
class CommandWorker {
protected:
Device& mDevice;
Queue& mQueue;
Name mName;
CommandThreadWorker mWork;
CommandPool mCommandPool;
CommandBuffer mImmediateExeCmd;
public:
CommandWorker(Name name, Device& device, Queue& queue, VkCommandPoolCreateFlags queueFlags);
CommandPool& GetCommandPool() {
return mCommandPool;
}
Queue& GetQueue() {
return mQueue;
}
void Invoke(const voidFn& fn);
void InvokeBuffer(const commandFn& fn, const voidFn& callback);
void Buffer(CommandBuffer& cmd, const commandFn& fn, const voidFn& callback);
void Flush();
void ImmediatelyExecute(const commandFn& fn, const voidFn callback) {
Buffer(mImmediateExeCmd, fn , callback);
}
bool Present(VkPresentInfoKHR& presentInfo);
};
};