vallium: limit buffer allocations to gallium max.
[mesa.git] / src / gallium / frontends / vallium / val_image.c
index 29a493e77fe2374e9aa9d518f66c4f56488e089f..b40e5b9dccb59978697db96f706d5ca9c1dfeb5e 100644 (file)
@@ -198,6 +198,10 @@ VkResult val_CreateBuffer(
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
 
+   /* gallium has max 32-bit buffer sizes */
+   if (pCreateInfo->size > UINT32_MAX)
+      return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+
    buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (buffer == NULL)