love.graphics.dispatchThreadgroups;

This commit is contained in:
bjorn
2021-06-04 22:11:21 -06:00
committed by bjorn
parent 085ba2cb6e
commit 25fbf1d8ce
5 changed files with 42 additions and 0 deletions
+19
View File
@@ -1066,6 +1066,25 @@ void Graphics::copyBuffer(Buffer *source, Buffer *dest, size_t sourceoffset, siz
source->copyTo(dest, sourceoffset, destoffset, size);
}
void Graphics::dispatchThreadgroups(Shader* shader, int x, int y, int z)
{
if (!shader->hasStage(SHADERSTAGE_COMPUTE))
throw love::Exception("Only compute shaders can have threads dispatched.");
if (x <= 0 || y <= 0 || z <= 0)
throw love::Exception("Threadgroup dispatch size must be positive.");
if (x > capabilities.limits[LIMIT_THREADGROUPS_X]
|| y > capabilities.limits[LIMIT_THREADGROUPS_Y]
|| z > capabilities.limits[LIMIT_THREADGROUPS_Z])
{
throw love::Exception("Too many threadgroups dispatched.");
}
shader->attach();
dispatch(x, y, z);
}
Graphics::BatchedVertexData Graphics::requestBatchedDraw(const BatchedDrawCommand &cmd)
{
BatchedDrawState &state = batchedDrawState;