fix validation error when TextBatch is empty

moar-validation
cosmonaut 2022-10-24 17:22:24 -07:00
parent 59190e619d
commit bd98ae8441
1 changed files with 5 additions and 2 deletions

View File

@ -101,8 +101,11 @@ namespace MoonWorks.Graphics.Font
IndexBuffer = new Buffer(GraphicsDevice, BufferUsageFlags.Index, indexDataLengthInBytes); IndexBuffer = new Buffer(GraphicsDevice, BufferUsageFlags.Index, indexDataLengthInBytes);
} }
if (vertexDataLengthInBytes > 0 && indexDataLengthInBytes > 0)
{
commandBuffer.SetBufferData(VertexBuffer, vertexDataPointer, 0, vertexDataLengthInBytes); commandBuffer.SetBufferData(VertexBuffer, vertexDataPointer, 0, vertexDataLengthInBytes);
commandBuffer.SetBufferData(IndexBuffer, indexDataPointer, 0, indexDataLengthInBytes); commandBuffer.SetBufferData(IndexBuffer, indexDataPointer, 0, indexDataLengthInBytes);
}
PrimitiveCount = vertexCount / 2; // FIXME: is this jank? PrimitiveCount = vertexCount / 2; // FIXME: is this jank?
} }