Add love.graphics.copyBuffer.

This commit is contained in:
Alex Szpakowski
2021-01-17 14:02:00 -04:00
parent e1f40b433d
commit e2838131f2
12 changed files with 89 additions and 1 deletions
+4
View File
@@ -50,6 +50,7 @@ Buffer::Buffer(Graphics *gfx, const Settings &settings, const std::vector<DataDe
bool vertexbuffer = settings.typeFlags & TYPEFLAG_VERTEX;
bool texelbuffer = settings.typeFlags & TYPEFLAG_TEXEL;
bool storagebuffer = settings.typeFlags & TYPEFLAG_SHADER_STORAGE;
bool copydest = settings.typeFlags & TYPEFLAG_COPY_DEST;
if (!indexbuffer && !vertexbuffer && !texelbuffer && !storagebuffer)
throw love::Exception("Buffer must be created with at least one buffer type (index, vertex, texel, or shaderstorage).");
@@ -60,6 +61,9 @@ Buffer::Buffer(Graphics *gfx, const Settings &settings, const std::vector<DataDe
if (storagebuffer && !caps.features[Graphics::FEATURE_GLSL4])
throw love::Exception("Shader Storage buffers are not supported on this system (GLSL 4 support is necessary.)");
if (copydest && usage == BUFFERUSAGE_STREAM)
throw love::Exception("Buffers created with 'stream' usage cannot be a copy destination.");
size_t offset = 0;
size_t stride = 0;
size_t structurealignment = 1;