vulkan: fix crash when creating compute shaders

If the size of the default uniform block ends up being 0,
there will be a crash since creating a buffer of size 0
is invalid. A simple if-statement fixes this issue
This commit is contained in:
niki
2022-11-12 03:22:23 +01:00
parent 6c47966b41
commit de1a4c3149
+3 -1
View File
@@ -1023,7 +1023,9 @@ void Shader::createDescriptorPoolSizes()
void Shader::createStreamBuffers()
{
streamBuffers.push_back(new StreamBuffer(vgfx, BUFFERUSAGE_UNIFORM, STREAMBUFFER_DEFAULT_SIZE * uniformBufferSizeAligned));
size_t size = STREAMBUFFER_DEFAULT_SIZE * uniformBufferSizeAligned;
if (size > 0)
streamBuffers.push_back(new StreamBuffer(vgfx, BUFFERUSAGE_UNIFORM, size));
}
void Shader::setVideoTextures(graphics::Texture *ytexture, graphics::Texture *cbtexture, graphics::Texture *crtexture)