mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
[vulkan] Don't use QFV_CreateImage for resource images
The resource functions assume the requested layers is correct (really, the lighting code assumes that the resource functions assume such), but QFV_CreateImage multiplies the layer count by 6 for cube maps (really, the issue is in QFV_CreateImage, but I want to move away from it anyway).
This commit is contained in:
parent
c605e50d52
commit
0a3c7b5b76
1 changed files with 21 additions and 9 deletions
|
@ -37,6 +37,26 @@
|
|||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/resource.h"
|
||||
|
||||
static void
|
||||
create_image (qfv_device_t *device, qfv_resobj_t *image_obj)
|
||||
{
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
__auto_type image = &image_obj->image;
|
||||
VkImageCreateInfo createInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, 0,
|
||||
image->cubemap ? VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT : 0,
|
||||
image->type, image->format, image->extent, image->num_mipmaps,
|
||||
image->num_layers,
|
||||
image->samples,
|
||||
VK_IMAGE_TILING_OPTIMAL,
|
||||
image->usage,
|
||||
VK_SHARING_MODE_EXCLUSIVE,
|
||||
0, 0,
|
||||
VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
};
|
||||
dfunc->vkCreateImage (device->dev, &createInfo, 0, &image->image);
|
||||
}
|
||||
|
||||
int
|
||||
QFV_CreateResource (qfv_device_t *device, qfv_resource_t *resource)
|
||||
{
|
||||
|
@ -76,16 +96,8 @@ QFV_CreateResource (qfv_device_t *device, qfv_resource_t *resource)
|
|||
break;
|
||||
case qfv_res_image:
|
||||
{
|
||||
create_image (device, obj);
|
||||
__auto_type image = &obj->image;
|
||||
image->image = QFV_CreateImage (device,
|
||||
image->cubemap,
|
||||
image->type,
|
||||
image->format,
|
||||
image->extent,
|
||||
image->num_mipmaps,
|
||||
image->num_layers,
|
||||
image->samples,
|
||||
image->usage);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
||||
image->image,
|
||||
va (resource->va_ctx, "image:%s:%s",
|
||||
|
|
Loading…
Reference in a new issue