Polyphase Game Engine
Loading...
Searching...
No Matches
DoubleBuffer.h
Go to the documentation of this file.
1#pragma once
2
3#if API_C3D
4
6#include <stdint.h>
7#include <stddef.h>
8
9// Useful for buffers that are updated every frame by the CPU and used by the GPU.
10// Like particle system vertex/index buffers, cpu-skinned skeletal mesh vertex buffer, etc
11
12class DoubleBuffer
13{
14public:
15
16 void Alloc(size_t size, const void* srcData = nullptr);
17 void Free();
18 void Update(const void* srcData, size_t srcSize, uint32_t frame = MAX_FRAMES);
19 void UpdateAllFrames(const void* srcData, size_t srcSize);
20 void* Get();
21 size_t GetSize() const;
22
23private:
24
25 size_t mSize = 0;
26 void* mData[MAX_FRAMES] = {};
27};
28
29#endif
bool Update()
Definition Engine.cpp:710