mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
render/vulkan: check that requested size is smaller than max
Fail with a clearer error when the requested size is too large. Without this, we allocate a buffer with a size smaller than what was requested. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3975
This commit is contained in:
parent
1ba322e9ff
commit
377668aaf6
1 changed files with 7 additions and 0 deletions
|
@ -234,6 +234,13 @@ struct wlr_vk_buffer_span vulkan_get_stage_span(struct wlr_vk_renderer *r,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size > max_stage_size) {
|
||||||
|
wlr_log(WLR_ERROR, "cannot vulkan stage buffer: "
|
||||||
|
"requested size (%zu bytes) exceeds maximum (%zu bytes)",
|
||||||
|
(size_t)size, (size_t)max_stage_size);
|
||||||
|
goto error_alloc;
|
||||||
|
}
|
||||||
|
|
||||||
// we didn't find a free buffer - create one
|
// we didn't find a free buffer - create one
|
||||||
// size = clamp(max(size * 2, prev_size * 2), min_size, max_size)
|
// size = clamp(max(size * 2, prev_size * 2), min_size, max_size)
|
||||||
VkDeviceSize bsize = size * 2;
|
VkDeviceSize bsize = size * 2;
|
||||||
|
|
Loading…
Reference in a new issue