Slightly less heavy-handed compute memory barrier implementation.

Also validate whether there are any unbound writable resources when dispatching compute shader work.
This commit is contained in:
Alex Szpakowski
2021-08-11 18:41:38 -03:00
parent 1cf8f1192c
commit 4caeb27047
8 changed files with 134 additions and 15 deletions
+10 -1
View File
@@ -1095,8 +1095,17 @@ void Graphics::dispatchThreadgroups(Shader* shader, int x, int y, int z)
}
flushBatchedDraws();
auto prevshader = Shader::current;
shader->attach();
dispatch(x, y, z);
bool success = dispatch(x, y, z);
if (prevshader != nullptr)
prevshader->attach();
if (!success)
throw love::Exception("Compute shader must have resources bound to all writable texture and buffer variables.");
}
Graphics::BatchedVertexData Graphics::requestBatchedDraw(const BatchedDrawCommand &cmd)