Files
funnygame/materialsystem/vulkan/commandbuffer.cpp
2025-09-20 12:39:42 +03:00

34 lines
722 B
C++

#include "tier1/utlvector.h"
#include "vulkan_state.h"
class CVkCommandBuffer: public IVkCommandBuffer
{
public:
virtual void Init() override;
virtual void Shutdown() override;
virtual void AddCommand( EVulkanCommandType eType, CVkCommand *pCommand ) override;
virtual void Submit() override;
private:
CUtlSelfReferencingVector<CVkCommand*> g_commands;
};
void CVkCommandBuffer::AddCommand( EVulkanCommandType eType, CVkCommand *pCommand )
{
g_commands.AppendTail(pCommand);
}
void CVkCommandBuffer::Submit()
{
for (auto &pCommand: g_commands)
{
pCommand->Execute();
delete pCommand;
};
};
static CVkCommandBuffer s_vkCommandBuffer;
IVkCommandBuffer *VulkanCommandBuffer()
{
return &s_vkCommandBuffer;
}