#pragma once
#include "../vulkan.h"
#include "thread_worker.h"
#include "../wrapper/commandpool.h"
#include "../wrapper/commandbuffer.h"
namespace vulkanapi {
	class Device;
	class Queue;
	class CommandWorker {
	protected:
		Device& mDevice;
		Queue& mQueue;
		const string& mName;
		CommandThreadWorker mWork;
		CommandPool mCommandPool;
		CommandBuffer mImmediateExeCmd;
	public:
		CommandWorker(const string& name, Device& device, Queue& queue, VkCommandPoolCreateFlags queueFlags);

		void Invoke(voidFn fn);
		void InvokeBuffer(commandFn fn, voidFn callback);
		void Buffer(CommandBuffer& cmd,commandFn fn, voidFn callback);
		void Flush();
		void ImmediatelyExecute(commandFn fn, voidFn callback) {
			Buffer(mImmediateExeCmd, fn , callback);
		}
		void Draw(commandFn fn);
		bool Present(VkPresentInfoKHR& presentInfo);
	};
};