mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-30 21:37:53 -04:00
vulkan: fix read_pixels
This commit is contained in:
parent
1426809e06
commit
6646a04439
1 changed files with 2 additions and 2 deletions
|
|
@ -355,13 +355,13 @@ int vulkan_read_pixels(struct vulkan_base *s, struct vulkan_read_pixels_info *in
|
|||
|
||||
const char *d = (const char *)v + img_sub_layout.offset;
|
||||
unsigned char *p = (unsigned char *)info->data + info->offset;
|
||||
uint32_t bytes_per_pixel = 16;
|
||||
uint32_t pack_stride = img_sub_layout.rowPitch;
|
||||
spa_log_trace_fp(s->log, "Read pixels: %p to %p, stride: %d, width %d, height %d, offset %d, pack_stride %d", d, p, info->stride, info->size.width, info->size.height, info->offset, pack_stride);
|
||||
if (pack_stride == info->stride) {
|
||||
memcpy(p, d, info->stride * info->size.height);
|
||||
} else {
|
||||
for (uint32_t i = 0; i < info->size.height; i++) {
|
||||
memcpy(p + i * info->stride, d + i * pack_stride, info->size.width * bytes_per_pixel);
|
||||
memcpy(p + i * info->stride, d + i * pack_stride, info->size.width * info->bytes_per_pixel);
|
||||
}
|
||||
}
|
||||
vkUnmapMemory(s->device, vk_buf->memory);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue