mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
[vulkan] Allow images to be created initialized
Needed for loaded textures.
This commit is contained in:
parent
e7106cce9e
commit
ef817a5cbf
3 changed files with 9 additions and 6 deletions
|
@ -37,7 +37,8 @@ VkImage QFV_CreateImage (struct qfv_device_s *device, int cubemap,
|
||||||
uint32_t num_mipmaps,
|
uint32_t num_mipmaps,
|
||||||
uint32_t num_layers,
|
uint32_t num_layers,
|
||||||
VkSampleCountFlagBits samples,
|
VkSampleCountFlagBits samples,
|
||||||
VkImageUsageFlags usage_scenarios);
|
VkImageUsageFlags usage_scenarios,
|
||||||
|
int initialized);
|
||||||
|
|
||||||
VkDeviceMemory QFV_AllocImageMemory (struct qfv_device_s *device,
|
VkDeviceMemory QFV_AllocImageMemory (struct qfv_device_s *device,
|
||||||
VkImage image,
|
VkImage image,
|
||||||
|
|
|
@ -69,7 +69,8 @@ QFV_CreateImage (qfv_device_t *device, int cubemap,
|
||||||
uint32_t num_mipmaps,
|
uint32_t num_mipmaps,
|
||||||
uint32_t num_layers,
|
uint32_t num_layers,
|
||||||
VkSampleCountFlagBits samples,
|
VkSampleCountFlagBits samples,
|
||||||
VkImageUsageFlags usage_scenarios)
|
VkImageUsageFlags usage_scenarios,
|
||||||
|
int initialized)
|
||||||
{
|
{
|
||||||
VkDevice dev = device->dev;
|
VkDevice dev = device->dev;
|
||||||
qfv_devfuncs_t *dfunc = device->funcs;
|
qfv_devfuncs_t *dfunc = device->funcs;
|
||||||
|
@ -79,11 +80,12 @@ QFV_CreateImage (qfv_device_t *device, int cubemap,
|
||||||
type, format, size, num_mipmaps,
|
type, format, size, num_mipmaps,
|
||||||
cubemap ? 6 * num_layers : num_layers,
|
cubemap ? 6 * num_layers : num_layers,
|
||||||
samples,
|
samples,
|
||||||
VK_IMAGE_TILING_OPTIMAL,
|
initialized ? VK_IMAGE_TILING_LINEAR : VK_IMAGE_TILING_OPTIMAL,
|
||||||
usage_scenarios,
|
usage_scenarios,
|
||||||
VK_SHARING_MODE_EXCLUSIVE,
|
VK_SHARING_MODE_EXCLUSIVE,
|
||||||
0, 0,
|
0, 0,
|
||||||
VK_IMAGE_LAYOUT_UNDEFINED,
|
initialized ? VK_IMAGE_LAYOUT_PREINITIALIZED
|
||||||
|
: VK_IMAGE_LAYOUT_UNDEFINED,
|
||||||
};
|
};
|
||||||
VkImage image;
|
VkImage image;
|
||||||
dfunc->vkCreateImage (dev, &createInfo, 0, &image);
|
dfunc->vkCreateImage (dev, &createInfo, 0, &image);
|
||||||
|
|
|
@ -319,7 +319,7 @@ Vulkan_CreateRenderPass (vulkan_ctx_t *ctx)
|
||||||
= QFV_CreateImage (device, 0, VK_IMAGE_TYPE_2D,
|
= QFV_CreateImage (device, 0, VK_IMAGE_TYPE_2D,
|
||||||
sc->format, extent, 1, 1, ctx->msaaSamples,
|
sc->format, extent, 1, 1, ctx->msaaSamples,
|
||||||
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
|
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
|
||||||
| VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
|
| VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, 0);
|
||||||
colorImage->object
|
colorImage->object
|
||||||
= QFV_AllocImageMemory (device, colorImage->image,
|
= QFV_AllocImageMemory (device, colorImage->image,
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0, 0);
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0, 0);
|
||||||
|
@ -336,7 +336,7 @@ Vulkan_CreateRenderPass (vulkan_ctx_t *ctx)
|
||||||
depthImage->image
|
depthImage->image
|
||||||
= QFV_CreateImage (device, 0, VK_IMAGE_TYPE_2D,
|
= QFV_CreateImage (device, 0, VK_IMAGE_TYPE_2D,
|
||||||
depthFormat, extent, 1, 1, ctx->msaaSamples,
|
depthFormat, extent, 1, 1, ctx->msaaSamples,
|
||||||
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
|
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, 0);
|
||||||
depthImage->object
|
depthImage->object
|
||||||
= QFV_AllocImageMemory (device, depthImage->image,
|
= QFV_AllocImageMemory (device, depthImage->image,
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0, 0);
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0, 0);
|
||||||
|
|
Loading…
Reference in a new issue