vk: rt: recreate images on format change
This commit is contained in:
parent
57093d7198
commit
9843f53cde
|
@ -119,6 +119,8 @@ r_vk_image_t R_VkImageCreate(const r_vk_image_create_t *create) {
|
||||||
|
|
||||||
XVK_CHECK(vkCreateImage(vk_core.device, &ici, NULL, &image.image));
|
XVK_CHECK(vkCreateImage(vk_core.device, &ici, NULL, &image.image));
|
||||||
|
|
||||||
|
image.format = ici.format;
|
||||||
|
|
||||||
if (create->debug_name)
|
if (create->debug_name)
|
||||||
SET_DEBUG_NAME(image.image, VK_OBJECT_TYPE_IMAGE, create->debug_name);
|
SET_DEBUG_NAME(image.image, VK_OBJECT_TYPE_IMAGE, create->debug_name);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ typedef struct r_vk_image_s {
|
||||||
|
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
int mips;
|
int mips;
|
||||||
|
VkFormat format;
|
||||||
} r_vk_image_t;
|
} r_vk_image_t;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -390,10 +390,11 @@ static void reloadMainpipe(void) {
|
||||||
|
|
||||||
for (int i = 0; i < newpipe->resources_count; ++i) {
|
for (int i = 0; i < newpipe->resources_count; ++i) {
|
||||||
const vk_meatpipe_resource_t *mr = newpipe->resources + i;
|
const vk_meatpipe_resource_t *mr = newpipe->resources + i;
|
||||||
DEBUG("res %d/%d: %s descriptor=%u count=%d flags=[%c%c] image_format=%u",
|
DEBUG("res %d/%d: %s descriptor=%u count=%d flags=[%c%c] image_format=(%s)%u",
|
||||||
i, newpipe->resources_count, mr->name, mr->descriptor_type, mr->count,
|
i, newpipe->resources_count, mr->name, mr->descriptor_type, mr->count,
|
||||||
(mr->flags & MEATPIPE_RES_WRITE) ? 'W' : ' ',
|
(mr->flags & MEATPIPE_RES_WRITE) ? 'W' : ' ',
|
||||||
(mr->flags & MEATPIPE_RES_CREATE) ? 'C' : ' ',
|
(mr->flags & MEATPIPE_RES_CREATE) ? 'C' : ' ',
|
||||||
|
R_VkFormatName(mr->image_format),
|
||||||
mr->image_format);
|
mr->image_format);
|
||||||
|
|
||||||
const qboolean create = !!(mr->flags & MEATPIPE_RES_CREATE);
|
const qboolean create = !!(mr->flags & MEATPIPE_RES_CREATE);
|
||||||
|
@ -418,7 +419,10 @@ static void reloadMainpipe(void) {
|
||||||
newpipe_out = res;
|
newpipe_out = res;
|
||||||
|
|
||||||
if (create) {
|
if (create) {
|
||||||
if (res->image.image == VK_NULL_HANDLE) {
|
if (res->image.image == VK_NULL_HANDLE || mr->image_format != res->image.format) {
|
||||||
|
if (res->image.image != VK_NULL_HANDLE) {
|
||||||
|
R_VkImageDestroy(&res->image);
|
||||||
|
}
|
||||||
const r_vk_image_create_t create = {
|
const r_vk_image_create_t create = {
|
||||||
.debug_name = mr->name,
|
.debug_name = mr->name,
|
||||||
.width = FRAME_WIDTH,
|
.width = FRAME_WIDTH,
|
||||||
|
@ -434,8 +438,6 @@ static void reloadMainpipe(void) {
|
||||||
};
|
};
|
||||||
res->image = R_VkImageCreate(&create);
|
res->image = R_VkImageCreate(&create);
|
||||||
Q_strncpy(res->name, mr->name, sizeof(res->name));
|
Q_strncpy(res->name, mr->name, sizeof(res->name));
|
||||||
} else {
|
|
||||||
// TODO if (mr->image_format != res->image.format) { S_ERROR and goto fail }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue