mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +01:00
[dxvk] Use VkImageViewUsageCreateInfoKHR when creating image views
Must be used when view formats are used that do not support all usage bits of the underlying image. Refs #504.
This commit is contained in:
parent
8ffe545b38
commit
5fe4c4f610
@ -382,6 +382,7 @@ namespace dxvk {
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspect = formatInfo.Aspect;
|
||||
viewInfo.swizzle = formatInfo.Swizzle;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
|
||||
// Shaders expect the stencil value in the G component
|
||||
if (viewInfo.aspect == VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
@ -594,6 +595,7 @@ namespace dxvk {
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspect = formatInfo.Aspect;
|
||||
viewInfo.swizzle = formatInfo.Swizzle;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
|
||||
switch (desc.ViewDimension) {
|
||||
case D3D11_UAV_DIMENSION_TEXTURE1D:
|
||||
@ -713,6 +715,7 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.format = m_dxgiAdapter->LookupFormat(desc.Format, DXGI_VK_FORMAT_MODE_COLOR).Format;
|
||||
viewInfo.aspect = imageFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
|
||||
switch (desc.ViewDimension) {
|
||||
case D3D11_RTV_DIMENSION_TEXTURE1D:
|
||||
@ -846,6 +849,7 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.format = m_dxgiAdapter->LookupFormat(desc.Format, DXGI_VK_FORMAT_MODE_DEPTH).Format;
|
||||
viewInfo.aspect = imageFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
|
||||
switch (desc.ViewDimension) {
|
||||
case D3D11_DSV_DIMENSION_TEXTURE1D:
|
||||
|
@ -256,6 +256,7 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = Image->info().format;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
viewInfo.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
@ -417,6 +418,7 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo info;
|
||||
info.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
info.format = VK_FORMAT_R16G16B16A16_UNORM;
|
||||
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
info.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
info.minLevel = 0;
|
||||
info.numLevels = 1;
|
||||
|
@ -1291,6 +1291,7 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo dstViewInfo;
|
||||
dstViewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
dstViewInfo.format = format;
|
||||
dstViewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
dstViewInfo.aspect = dstSubresources.aspectMask;
|
||||
dstViewInfo.minLevel = dstSubresources.mipLevel;
|
||||
dstViewInfo.numLevels = 1;
|
||||
@ -1300,6 +1301,7 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo srcViewInfo;
|
||||
srcViewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
srcViewInfo.format = format;
|
||||
srcViewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
srcViewInfo.aspect = srcSubresources.aspectMask;
|
||||
srcViewInfo.minLevel = srcSubresources.mipLevel;
|
||||
srcViewInfo.numLevels = 1;
|
||||
|
@ -178,10 +178,15 @@ namespace dxvk {
|
||||
subresourceRange.levelCount = m_info.numLevels;
|
||||
subresourceRange.baseArrayLayer = m_info.minLayer;
|
||||
subresourceRange.layerCount = numLayers;
|
||||
|
||||
VkImageViewUsageCreateInfoKHR viewUsage;
|
||||
viewUsage.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR;
|
||||
viewUsage.pNext = nullptr;
|
||||
viewUsage.usage = m_info.usage;
|
||||
|
||||
VkImageViewCreateInfo viewInfo;
|
||||
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
viewInfo.pNext = nullptr;
|
||||
viewInfo.pNext = &viewUsage;
|
||||
viewInfo.flags = 0;
|
||||
viewInfo.image = m_image->handle();
|
||||
viewInfo.viewType = type;
|
||||
|
@ -70,6 +70,9 @@ namespace dxvk {
|
||||
|
||||
/// Pixel format
|
||||
VkFormat format = VK_FORMAT_UNDEFINED;
|
||||
|
||||
/// Image view usage flags
|
||||
VkImageUsageFlags usage = 0;
|
||||
|
||||
/// Subresources to use in the view
|
||||
VkImageAspectFlags aspect = 0;
|
||||
|
@ -169,6 +169,7 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = fmt.format;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
viewInfo.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
|
@ -142,6 +142,8 @@ namespace dxvk {
|
||||
DxvkImageViewCreateInfo info;
|
||||
info.type = type;
|
||||
info.format = image->info().format;
|
||||
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT
|
||||
| VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
info.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
info.minLevel = 0;
|
||||
info.numLevels = 1;
|
||||
|
@ -253,6 +253,7 @@ namespace dxvk::hud {
|
||||
DxvkImageViewCreateInfo info;
|
||||
info.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
info.format = m_fontImage->info().format;
|
||||
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
info.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
info.minLevel = 0;
|
||||
info.numLevels = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user