Fix vulkan buffers not using the stream usage for the 2d drawer

Add BufferUsageType enum to clarify what kind of usage is expected by the buffer allocated by SetData
This commit is contained in:
Magnus Norddahl 2021-10-27 03:38:02 +02:00 committed by Rachael Alexanderson
commit d853961a83
22 changed files with 95 additions and 65 deletions

View file

@ -81,7 +81,7 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height, int pipelineNbr):
mIndexBuffer = screen->CreateIndexBuffer();
int data[4] = {};
mIndexBuffer->SetData(4, data); // On Vulkan this may not be empty, so set some dummy defaults to avoid crashes.
mIndexBuffer->SetData(4, data, BufferUsageType::Static); // On Vulkan this may not be empty, so set some dummy defaults to avoid crashes.
for (int n = 0; n < mPipelineNbr; n++)
@ -89,7 +89,7 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height, int pipelineNbr):
mVertexBufferPipeline[n] = screen->CreateVertexBuffer();
unsigned int bytesize = BUFFER_SIZE * sizeof(FFlatVertex);
mVertexBufferPipeline[n]->SetData(bytesize, nullptr, false);
mVertexBufferPipeline[n]->SetData(bytesize, nullptr, BufferUsageType::Persistent);
static const FVertexBufferAttribute format[] = {
{ 0, VATTR_VERTEX, VFmt_Float3, (int)myoffsetof(FFlatVertex, x) },