mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
71e07e6454
I had missed that vkCmdCopyImage requires the source and destination images to have exactly the same size, and I guess assumed that the swapchain images would always be the size they said they were, but this is not the case for tiled-optimal images. However, vkCmdCopyImageToBuffer does the right thing regardless of the source image size. This fixes the skewed screenshots when the window size is not a multiple of 8 (for me, might differ for others).
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
#ifndef __QF_Vulkan_capture_h
|
|
#define __QF_Vulkan_capture_h
|
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
#define VK_NO_PROTOTYPES
|
|
#endif
|
|
#include <vulkan/vulkan.h>
|
|
|
|
#include "QF/darray.h"
|
|
#include "QF/qtypes.h"
|
|
|
|
typedef struct qfv_capture_image_s {
|
|
VkCommandBuffer cmd;
|
|
VkBuffer buffer;
|
|
byte *data;
|
|
} qfv_capture_image_t;
|
|
|
|
typedef struct qfv_capture_image_set_s
|
|
DARRAY_TYPE (qfv_capture_image_t) qfv_capture_image_set_t;
|
|
|
|
#define QFV_AllocCaptureImageSet(num, allocator) \
|
|
DARRAY_ALLOCFIXED (qfv_capture_image_set_t, num, allocator)
|
|
|
|
typedef struct qfv_capture_s {
|
|
struct qfv_device_s *device;
|
|
|
|
VkExtent2D extent;
|
|
qfv_capture_image_set_t *image_set;
|
|
size_t imgsize;
|
|
size_t memsize;
|
|
byte *data;
|
|
VkDeviceMemory memory;
|
|
} qfv_capture_t;
|
|
|
|
struct qfv_swapchain_s;
|
|
|
|
qfv_capture_t *QFV_CreateCapture (struct qfv_device_s *device, int numframes,
|
|
struct qfv_swapchain_s *swapchain,
|
|
VkCommandPool cmdPool);
|
|
void QFV_RenewCapture (qfv_capture_t *capture,
|
|
struct qfv_swapchain_s *swapchain);
|
|
void QFV_DestroyCapture (qfv_capture_t *capture);
|
|
|
|
VkCommandBuffer QFV_CaptureImage (qfv_capture_t *capture, VkImage scImage,
|
|
int frame);
|
|
const byte *QFV_CaptureData (qfv_capture_t *capture, int frame) __attribute__((pure));
|
|
|
|
#endif//__QF_Vulkan_capture_h
|