Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ruis/render/vulkan/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,9 @@ rasterimage::image_variant context::readback_framebuffer_color(const ruis::rende
const auto w = uint32_t(color.dims().x());
const auto h = uint32_t(color.dims().y());
const size_t row_bytes = size_t(w) * 4; // RGBA8
const VkDeviceSize total_bytes = row_bytes * h;
// size_t (not VkDeviceSize): used both for the Vulkan API (which widens it)
// and for host-side allocations/copies, avoiding narrowing conversions on 32-bit targets
const size_t total_bytes = row_bytes * h;

// create a host-visible staging buffer for the readback
VkBuffer staging_buffer = VK_NULL_HANDLE;
Expand Down
5 changes: 4 additions & 1 deletion src/ruis/render/vulkan/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,10 @@ void factory::one_shot(std::function<void(VkCommandBuffer)> cmd) const

void factory::upload_texture(texture_2d* t) const
{
const auto total_size = t->staging_size();
// the cast produces a size_t (not VkDeviceSize): used both for the Vulkan API
// (which widens it) and for host-side copies, avoiding narrowing conversions
// on 32-bit targets
const auto total_size = size_t(t->staging_size());
if (total_size == 0) {
return;
}
Expand Down
Loading