mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Remove DxvkImageViewCreateInfo
This commit is contained in:
parent
8195bea63e
commit
b4e69dce76
@ -523,7 +523,7 @@ namespace dxvk {
|
||||
if (isViewCompatible || isZeroClearValue) {
|
||||
// Create a view with an integer format if necessary
|
||||
if (uavFormat != rawFormat && !isZeroClearValue) {
|
||||
DxvkImageViewCreateInfo info = imageView->info();
|
||||
DxvkImageViewKey info = imageView->info();
|
||||
info.format = rawFormat;
|
||||
|
||||
imageView = imageView->image()->createView(info);
|
||||
@ -542,7 +542,7 @@ namespace dxvk {
|
||||
} else {
|
||||
DxvkBufferCreateInfo bufferInfo;
|
||||
bufferInfo.size = imageView->formatInfo()->elementSize
|
||||
* imageView->info().numLayers
|
||||
* imageView->info().layerCount
|
||||
* util::flattenImageExtent(imageView->mipLevelExtent(0));
|
||||
bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT
|
||||
| VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
|
||||
@ -718,7 +718,7 @@ namespace dxvk {
|
||||
|
||||
// 3D views are unsupported
|
||||
if (imgView != nullptr
|
||||
&& imgView->info().type == VK_IMAGE_VIEW_TYPE_3D)
|
||||
&& imgView->info().viewType == VK_IMAGE_VIEW_TYPE_3D)
|
||||
return;
|
||||
|
||||
// Query the view format. We'll have to convert
|
||||
@ -5402,8 +5402,8 @@ namespace dxvk {
|
||||
// Render target views must all have the same sample count,
|
||||
// layer count, and type. The size can mismatch under certain
|
||||
// conditions, the D3D11 documentation is wrong here.
|
||||
if (curView->info().type != refView->info().type
|
||||
|| curView->info().numLayers != refView->info().numLayers)
|
||||
if (curView->info().viewType != refView->info().viewType
|
||||
|| curView->info().layerCount != refView->info().layerCount)
|
||||
return false;
|
||||
|
||||
if (curView->image()->info().sampleCount
|
||||
|
@ -543,15 +543,15 @@ namespace dxvk {
|
||||
imageInfo.layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||
imageInfo.shared = VK_TRUE;
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = info.format.format;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
viewInfo.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
|
||||
for (uint32_t i = 0; i < info.imageCount; i++) {
|
||||
VkImage imageHandle = m_presenter->getImage(i).image;
|
||||
@ -608,15 +608,15 @@ namespace dxvk {
|
||||
|
||||
// Create an image view that allows the
|
||||
// image to be bound as a shader resource.
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = m_swapImage->info().format;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
viewInfo.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
m_swapImageView = m_swapImage->createView(viewInfo);
|
||||
|
||||
// Initialize the image so that we can use it. Clearing
|
||||
|
@ -190,18 +190,18 @@ namespace dxvk {
|
||||
|
||||
VkImageAspectFlags aspectMask = lookupFormatInfo(formatInfo.Format)->aspectMask;
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.swizzle = formatInfo.Swizzle;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
viewInfo.packedSwizzle = DxvkImageViewKey::packSwizzle(formatInfo.Swizzle);
|
||||
|
||||
switch (m_desc.ViewDimension) {
|
||||
case D3D11_VPIV_DIMENSION_TEXTURE2D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = m_desc.Texture2D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = m_desc.Texture2D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_VPIV_DIMENSION_UNKNOWN:
|
||||
@ -209,14 +209,14 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
m_subresources.aspectMask = aspectMask;
|
||||
m_subresources.baseArrayLayer = viewInfo.minLayer;
|
||||
m_subresources.layerCount = viewInfo.numLayers;
|
||||
m_subresources.mipLevel = viewInfo.minLevel;
|
||||
m_subresources.baseArrayLayer = viewInfo.layerIndex;
|
||||
m_subresources.layerCount = viewInfo.layerCount;
|
||||
m_subresources.mipLevel = viewInfo.mipIndex;
|
||||
|
||||
for (uint32_t i = 0; aspectMask && i < m_views.size(); i++) {
|
||||
viewInfo.aspect = vk::getNextAspect(aspectMask);
|
||||
viewInfo.aspects = vk::getNextAspect(aspectMask);
|
||||
|
||||
if (viewInfo.aspect != VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
if (viewInfo.aspects != VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
viewInfo.format = formatFamily.Formats[i];
|
||||
|
||||
m_views[i] = dxvkImage->createView(viewInfo);
|
||||
@ -287,27 +287,27 @@ namespace dxvk {
|
||||
DXGI_VK_FORMAT_INFO formatInfo = pDevice->LookupFormat(
|
||||
resourceDesc.Format, DXGI_VK_FORMAT_MODE_COLOR);
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspect = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.swizzle = formatInfo.Swizzle;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspects = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.packedSwizzle = DxvkImageViewKey::packSwizzle(formatInfo.Swizzle);
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
|
||||
switch (m_desc.ViewDimension) {
|
||||
case D3D11_VPOV_DIMENSION_TEXTURE2D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = m_desc.Texture2D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = m_desc.Texture2D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_VPOV_DIMENSION_TEXTURE2DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = m_desc.Texture2DArray.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = m_desc.Texture2DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = m_desc.Texture2DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = m_desc.Texture2DArray.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = m_desc.Texture2DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = m_desc.Texture2DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_VPOV_DIMENSION_UNKNOWN:
|
||||
|
@ -17,58 +17,58 @@ namespace dxvk {
|
||||
D3D11_COMMON_RESOURCE_DESC resourceDesc;
|
||||
GetCommonResourceDesc(pResource, &resourceDesc);
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.format = pDevice->LookupFormat(pDesc->Format, DXGI_VK_FORMAT_MODE_DEPTH).Format;
|
||||
viewInfo.aspect = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
viewInfo.aspects = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
|
||||
switch (pDesc->ViewDimension) {
|
||||
case D3D11_DSV_DIMENSION_TEXTURE1D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.minLevel = pDesc->Texture1D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.mipIndex = pDesc->Texture1D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_DSV_DIMENSION_TEXTURE1DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture1DArray.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture1DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture1DArray.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture1DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_DSV_DIMENSION_TEXTURE2D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = pDesc->Texture2D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = pDesc->Texture2D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture2DArray.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture2DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture2DArray.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture2DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_DSV_DIMENSION_TEXTURE2DMS:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture2DMSArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture2DMSArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture2DMSArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture2DMSArray.ArraySize;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -77,20 +77,22 @@ namespace dxvk {
|
||||
|
||||
// Normalize view type so that we won't accidentally
|
||||
// bind 2D array views and 2D views at the same time
|
||||
if (viewInfo.numLayers == 1) {
|
||||
if (viewInfo.type == VK_IMAGE_VIEW_TYPE_1D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
if (viewInfo.type == VK_IMAGE_VIEW_TYPE_2D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
if (viewInfo.layerCount == 1) {
|
||||
if (viewInfo.viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY)
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D;
|
||||
if (viewInfo.viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY)
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
}
|
||||
|
||||
// Populate view info struct
|
||||
m_info.pResource = pResource;
|
||||
m_info.Dimension = resourceDesc.Dim;
|
||||
m_info.BindFlags = resourceDesc.BindFlags;
|
||||
m_info.Image.Aspects = viewInfo.aspect;
|
||||
m_info.Image.MinLevel = viewInfo.minLevel;
|
||||
m_info.Image.MinLayer = viewInfo.minLayer;
|
||||
m_info.Image.NumLevels = viewInfo.numLevels;
|
||||
m_info.Image.NumLayers = viewInfo.numLayers;
|
||||
m_info.Image.Aspects = viewInfo.aspects;
|
||||
m_info.Image.MinLevel = viewInfo.mipIndex;
|
||||
m_info.Image.MinLayer = viewInfo.layerIndex;
|
||||
m_info.Image.NumLevels = viewInfo.mipCount;
|
||||
m_info.Image.NumLayers = viewInfo.layerCount;
|
||||
|
||||
if (m_desc.Flags & D3D11_DSV_READ_ONLY_DEPTH)
|
||||
m_info.Image.Aspects &= ~VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
|
@ -22,67 +22,67 @@ namespace dxvk {
|
||||
DXGI_VK_FORMAT_INFO formatInfo = pDevice->LookupFormat(
|
||||
pDesc->Format, DXGI_VK_FORMAT_MODE_COLOR);
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspect = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.swizzle = formatInfo.Swizzle;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspects = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
viewInfo.packedSwizzle = DxvkImageViewKey::packSwizzle(formatInfo.Swizzle);
|
||||
|
||||
switch (pDesc->ViewDimension) {
|
||||
case D3D11_RTV_DIMENSION_TEXTURE1D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.minLevel = pDesc->Texture1D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.mipIndex = pDesc->Texture1D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture1DArray.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture1DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture1DArray.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture1DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = pDesc->Texture2D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = pDesc->Texture2D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture2DArray.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture2DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture2DArray.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture2DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2DMS:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture2DMSArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture2DMSArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture2DMSArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture2DMSArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_RTV_DIMENSION_TEXTURE3D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture3D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture3D.FirstWSlice;
|
||||
viewInfo.numLayers = pDesc->Texture3D.WSize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture3D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture3D.FirstWSlice;
|
||||
viewInfo.layerCount = pDesc->Texture3D.WSize;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -90,24 +90,26 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
if (texture->GetPlaneCount() > 1)
|
||||
viewInfo.aspect = vk::getPlaneAspect(GetPlaneSlice(pDesc));
|
||||
viewInfo.aspects = vk::getPlaneAspect(GetPlaneSlice(pDesc));
|
||||
|
||||
// Normalize view type so that we won't accidentally
|
||||
// bind 2D array views and 2D views at the same time
|
||||
if (viewInfo.numLayers == 1) {
|
||||
if (viewInfo.type == VK_IMAGE_VIEW_TYPE_1D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
if (viewInfo.type == VK_IMAGE_VIEW_TYPE_2D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
if (viewInfo.layerCount == 1) {
|
||||
if (viewInfo.viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY)
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D;
|
||||
if (viewInfo.viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY)
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
}
|
||||
|
||||
// Populate view info struct
|
||||
m_info.pResource = pResource;
|
||||
m_info.Dimension = resourceDesc.Dim;
|
||||
m_info.BindFlags = resourceDesc.BindFlags;
|
||||
m_info.Image.Aspects = viewInfo.aspect;
|
||||
m_info.Image.MinLevel = viewInfo.minLevel;
|
||||
m_info.Image.MinLayer = viewInfo.minLayer;
|
||||
m_info.Image.NumLevels = viewInfo.numLevels;
|
||||
m_info.Image.NumLayers = viewInfo.numLayers;
|
||||
m_info.Image.Aspects = viewInfo.aspects;
|
||||
m_info.Image.MinLevel = viewInfo.mipIndex;
|
||||
m_info.Image.MinLayer = viewInfo.layerIndex;
|
||||
m_info.Image.NumLevels = viewInfo.mipCount;
|
||||
m_info.Image.NumLayers = viewInfo.layerCount;
|
||||
|
||||
// Create the underlying image view object
|
||||
m_view = texture->GetImage()->createView(viewInfo);
|
||||
|
@ -74,91 +74,91 @@ namespace dxvk {
|
||||
auto texture = GetCommonTexture(pResource);
|
||||
auto formatInfo = pDevice->LookupFormat(pDesc->Format, texture->GetFormatMode());
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspect = formatInfo.Aspect;
|
||||
viewInfo.swizzle = formatInfo.Swizzle;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspects = formatInfo.Aspect;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
viewInfo.packedSwizzle = DxvkImageViewKey::packSwizzle(formatInfo.Swizzle);
|
||||
|
||||
// Shaders expect the stencil value in the G component
|
||||
if (viewInfo.aspect == VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
viewInfo.swizzle = VkComponentMapping {
|
||||
if (viewInfo.aspects == VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
viewInfo.packedSwizzle = DxvkImageViewKey::packSwizzle({
|
||||
VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_R,
|
||||
VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO };
|
||||
VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO });
|
||||
}
|
||||
|
||||
switch (pDesc->ViewDimension) {
|
||||
case D3D11_SRV_DIMENSION_TEXTURE1D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.minLevel = pDesc->Texture1D.MostDetailedMip;
|
||||
viewInfo.numLevels = pDesc->Texture1D.MipLevels;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.mipIndex = pDesc->Texture1D.MostDetailedMip;
|
||||
viewInfo.mipCount = pDesc->Texture1D.MipLevels;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURE1DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture1DArray.MostDetailedMip;
|
||||
viewInfo.numLevels = pDesc->Texture1DArray.MipLevels;
|
||||
viewInfo.minLayer = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture1DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture1DArray.MostDetailedMip;
|
||||
viewInfo.mipCount = pDesc->Texture1DArray.MipLevels;
|
||||
viewInfo.layerIndex = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture1DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURE2D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = pDesc->Texture2D.MostDetailedMip;
|
||||
viewInfo.numLevels = pDesc->Texture2D.MipLevels;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = pDesc->Texture2D.MostDetailedMip;
|
||||
viewInfo.mipCount = pDesc->Texture2D.MipLevels;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture2DArray.MostDetailedMip;
|
||||
viewInfo.numLevels = pDesc->Texture2DArray.MipLevels;
|
||||
viewInfo.minLayer = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture2DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture2DArray.MostDetailedMip;
|
||||
viewInfo.mipCount = pDesc->Texture2DArray.MipLevels;
|
||||
viewInfo.layerIndex = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture2DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURE2DMS:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture2DMSArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture2DMSArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture2DMSArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture2DMSArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURE3D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_3D;
|
||||
viewInfo.minLevel = pDesc->Texture3D.MostDetailedMip;
|
||||
viewInfo.numLevels = pDesc->Texture3D.MipLevels;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_3D;
|
||||
viewInfo.mipIndex = pDesc->Texture3D.MostDetailedMip;
|
||||
viewInfo.mipCount = pDesc->Texture3D.MipLevels;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURECUBE: {
|
||||
const bool cubeArraysEnabled = pDevice->GetDXVKDevice()->features().core.features.imageCubeArray;
|
||||
viewInfo.type = cubeArraysEnabled ? VK_IMAGE_VIEW_TYPE_CUBE_ARRAY : VK_IMAGE_VIEW_TYPE_CUBE;
|
||||
viewInfo.minLevel = pDesc->TextureCube.MostDetailedMip;
|
||||
viewInfo.numLevels = pDesc->TextureCube.MipLevels;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 6;
|
||||
viewInfo.viewType = cubeArraysEnabled ? VK_IMAGE_VIEW_TYPE_CUBE_ARRAY : VK_IMAGE_VIEW_TYPE_CUBE;
|
||||
viewInfo.mipIndex = pDesc->TextureCube.MostDetailedMip;
|
||||
viewInfo.mipCount = pDesc->TextureCube.MipLevels;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 6;
|
||||
} break;
|
||||
|
||||
case D3D11_SRV_DIMENSION_TEXTURECUBEARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
|
||||
viewInfo.minLevel = pDesc->TextureCubeArray.MostDetailedMip;
|
||||
viewInfo.numLevels = pDesc->TextureCubeArray.MipLevels;
|
||||
viewInfo.minLayer = pDesc->TextureCubeArray.First2DArrayFace;
|
||||
viewInfo.numLayers = pDesc->TextureCubeArray.NumCubes * 6;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->TextureCubeArray.MostDetailedMip;
|
||||
viewInfo.mipCount = pDesc->TextureCubeArray.MipLevels;
|
||||
viewInfo.layerIndex = pDesc->TextureCubeArray.First2DArrayFace;
|
||||
viewInfo.layerCount = pDesc->TextureCubeArray.NumCubes * 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -166,14 +166,14 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
if (texture->GetPlaneCount() > 1)
|
||||
viewInfo.aspect = vk::getPlaneAspect(GetPlaneSlice(pDesc));
|
||||
viewInfo.aspects = vk::getPlaneAspect(GetPlaneSlice(pDesc));
|
||||
|
||||
// Populate view info struct
|
||||
m_info.Image.Aspects = viewInfo.aspect;
|
||||
m_info.Image.MinLevel = viewInfo.minLevel;
|
||||
m_info.Image.MinLayer = viewInfo.minLayer;
|
||||
m_info.Image.NumLevels = viewInfo.numLevels;
|
||||
m_info.Image.NumLayers = viewInfo.numLayers;
|
||||
m_info.Image.Aspects = viewInfo.aspects;
|
||||
m_info.Image.MinLevel = viewInfo.mipIndex;
|
||||
m_info.Image.MinLayer = viewInfo.layerIndex;
|
||||
m_info.Image.NumLevels = viewInfo.mipCount;
|
||||
m_info.Image.NumLayers = viewInfo.layerCount;
|
||||
|
||||
// Create the underlying image view object
|
||||
m_imageView = texture->GetImage()->createView(viewInfo);
|
||||
|
@ -56,55 +56,55 @@ namespace dxvk {
|
||||
auto texture = GetCommonTexture(pResource);
|
||||
auto formatInfo = pDevice->LookupFormat(pDesc->Format, texture->GetFormatMode());
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspect = formatInfo.Aspect;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.format = formatInfo.Format;
|
||||
viewInfo.aspects = formatInfo.Aspect;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
|
||||
if (!util::isIdentityMapping(formatInfo.Swizzle))
|
||||
Logger::warn(str::format("UAV format ", pDesc->Format, " has non-identity swizzle, but UAV swizzles are not supported"));
|
||||
|
||||
switch (pDesc->ViewDimension) {
|
||||
case D3D11_UAV_DIMENSION_TEXTURE1D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.minLevel = pDesc->Texture1D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.mipIndex = pDesc->Texture1D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_UAV_DIMENSION_TEXTURE1DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture1DArray.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture1DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture1DArray.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture1DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture1DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_UAV_DIMENSION_TEXTURE2D:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.minLevel = pDesc->Texture2D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.mipIndex = pDesc->Texture2D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
case D3D11_UAV_DIMENSION_TEXTURE2DARRAY:
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = pDesc->Texture2DArray.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.numLayers = pDesc->Texture2DArray.ArraySize;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.mipIndex = pDesc->Texture2DArray.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = pDesc->Texture2DArray.FirstArraySlice;
|
||||
viewInfo.layerCount = pDesc->Texture2DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D11_UAV_DIMENSION_TEXTURE3D:
|
||||
// FIXME we actually have to map this to a
|
||||
// 2D array view in order to support W slices
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_3D;
|
||||
viewInfo.minLevel = pDesc->Texture3D.MipSlice;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_3D;
|
||||
viewInfo.mipIndex = pDesc->Texture3D.MipSlice;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -112,14 +112,14 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
if (texture->GetPlaneCount() > 1)
|
||||
viewInfo.aspect = vk::getPlaneAspect(GetPlaneSlice(pDesc));
|
||||
viewInfo.aspects = vk::getPlaneAspect(GetPlaneSlice(pDesc));
|
||||
|
||||
// Populate view info struct
|
||||
m_info.Image.Aspects = viewInfo.aspect;
|
||||
m_info.Image.MinLevel = viewInfo.minLevel;
|
||||
m_info.Image.MinLayer = viewInfo.minLayer;
|
||||
m_info.Image.NumLevels = viewInfo.numLevels;
|
||||
m_info.Image.NumLayers = viewInfo.numLayers;
|
||||
m_info.Image.Aspects = viewInfo.aspects;
|
||||
m_info.Image.MinLevel = viewInfo.mipIndex;
|
||||
m_info.Image.MinLayer = viewInfo.layerIndex;
|
||||
m_info.Image.NumLevels = viewInfo.mipCount;
|
||||
m_info.Image.NumLayers = viewInfo.layerCount;
|
||||
|
||||
m_imageView = GetCommonTexture(pResource)->GetImage()->createView(viewInfo);
|
||||
}
|
||||
|
@ -635,32 +635,31 @@ namespace dxvk {
|
||||
UINT Lod,
|
||||
VkImageUsageFlags UsageFlags,
|
||||
bool Srgb) {
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.format = m_mapping.ConversionFormatInfo.FormatColor != VK_FORMAT_UNDEFINED
|
||||
? PickSRGB(m_mapping.ConversionFormatInfo.FormatColor, m_mapping.ConversionFormatInfo.FormatSrgb, Srgb)
|
||||
: PickSRGB(m_mapping.FormatColor, m_mapping.FormatSrgb, Srgb);
|
||||
viewInfo.aspect = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.swizzle = m_mapping.Swizzle;
|
||||
viewInfo.aspects = lookupFormatInfo(viewInfo.format)->aspectMask;
|
||||
viewInfo.usage = UsageFlags;
|
||||
viewInfo.type = GetImageViewTypeFromResourceType(m_type, Layer);
|
||||
viewInfo.minLevel = Lod;
|
||||
viewInfo.numLevels = m_desc.MipLevels - Lod;
|
||||
viewInfo.minLayer = Layer == AllLayers ? 0 : Layer;
|
||||
viewInfo.numLayers = Layer == AllLayers ? m_desc.ArraySize : 1;
|
||||
viewInfo.viewType = GetImageViewTypeFromResourceType(m_type, Layer);
|
||||
viewInfo.mipIndex = Lod;
|
||||
viewInfo.mipCount = m_desc.MipLevels - Lod;
|
||||
viewInfo.layerIndex = Layer == AllLayers ? 0 : Layer;
|
||||
viewInfo.layerCount = Layer == AllLayers ? m_desc.ArraySize : 1;
|
||||
viewInfo.packedSwizzle = DxvkImageViewKey::packSwizzle(m_mapping.Swizzle);
|
||||
|
||||
// Remove the stencil aspect if we are trying to create a regular image
|
||||
// view of a depth stencil format
|
||||
if (UsageFlags != VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
||||
viewInfo.aspect &= ~VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
viewInfo.aspects &= ~VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
|
||||
if (UsageFlags == VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT ||
|
||||
UsageFlags == VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.mipCount = 1;
|
||||
|
||||
// Remove swizzle on depth views.
|
||||
if (UsageFlags == VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
||||
viewInfo.swizzle = { VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY };
|
||||
viewInfo.packedSwizzle = 0u;
|
||||
|
||||
// Create the underlying image view object
|
||||
return GetImage()->createView(viewInfo);
|
||||
|
@ -76,15 +76,15 @@ namespace dxvk {
|
||||
VkFormat bufferFormat,
|
||||
uint32_t specConstantValue,
|
||||
VkExtent2D macroPixelRun) {
|
||||
DxvkImageViewCreateInfo imageViewInfo;
|
||||
imageViewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
DxvkImageViewKey imageViewInfo;
|
||||
imageViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
imageViewInfo.format = dstImage->info().format;
|
||||
imageViewInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
imageViewInfo.aspect = dstSubresource.aspectMask;
|
||||
imageViewInfo.minLevel = dstSubresource.mipLevel;
|
||||
imageViewInfo.numLevels = 1;
|
||||
imageViewInfo.minLayer = dstSubresource.baseArrayLayer;
|
||||
imageViewInfo.numLayers = dstSubresource.layerCount;
|
||||
imageViewInfo.aspects = dstSubresource.aspectMask;
|
||||
imageViewInfo.mipIndex = dstSubresource.mipLevel;
|
||||
imageViewInfo.mipCount = 1;
|
||||
imageViewInfo.layerIndex = dstSubresource.baseArrayLayer;
|
||||
imageViewInfo.layerCount = dstSubresource.layerCount;
|
||||
auto tmpImageView = dstImage->createView(imageViewInfo);
|
||||
|
||||
VkExtent3D imageExtent = dstImage->mipLevelExtent(dstSubresource.mipLevel);
|
||||
|
@ -970,15 +970,15 @@ namespace dxvk {
|
||||
imageInfo.layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||
imageInfo.shared = VK_TRUE;
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = info.format.format;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
viewInfo.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
|
||||
for (uint32_t i = 0; i < info.imageCount; i++) {
|
||||
VkImage imageHandle = m_wctx->presenter->getImage(i).image;
|
||||
|
@ -318,7 +318,7 @@ namespace dxvk {
|
||||
// Make sure the color components are ordered correctly
|
||||
if (clearAspects & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
clearValue.color = util::swizzleClearColor(clearValue.color,
|
||||
util::invertComponentMapping(imageView->info().swizzle));
|
||||
util::invertComponentMapping(imageView->info().unpackSwizzle()));
|
||||
}
|
||||
|
||||
// Check whether the render target view is an attachment
|
||||
@ -357,7 +357,7 @@ namespace dxvk {
|
||||
clearRect.rect.extent.width = imageView->mipLevelExtent(0).width;
|
||||
clearRect.rect.extent.height = imageView->mipLevelExtent(0).height;
|
||||
clearRect.baseArrayLayer = 0;
|
||||
clearRect.layerCount = imageView->info().numLayers;
|
||||
clearRect.layerCount = imageView->info().layerCount;
|
||||
|
||||
m_cmd->cmdClearAttachments(1, &clearInfo, 1, &clearRect);
|
||||
} else
|
||||
@ -375,7 +375,7 @@ namespace dxvk {
|
||||
|
||||
if (aspect & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
value.color = util::swizzleClearColor(value.color,
|
||||
util::invertComponentMapping(imageView->info().swizzle));
|
||||
util::invertComponentMapping(imageView->info().unpackSwizzle()));
|
||||
}
|
||||
|
||||
if (viewUsage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT))
|
||||
@ -730,18 +730,18 @@ namespace dxvk {
|
||||
return;
|
||||
|
||||
// Create one depth view and one stencil view
|
||||
DxvkImageViewCreateInfo dViewInfo = { };
|
||||
dViewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
DxvkImageViewKey dViewInfo = { };
|
||||
dViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
dViewInfo.format = srcImage->info().format;
|
||||
dViewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
dViewInfo.aspect = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
dViewInfo.minLevel = srcSubresource.mipLevel;
|
||||
dViewInfo.numLevels = 1;
|
||||
dViewInfo.minLayer = srcSubresource.baseArrayLayer;
|
||||
dViewInfo.numLayers = srcSubresource.layerCount;
|
||||
dViewInfo.aspects = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
dViewInfo.mipIndex = srcSubresource.mipLevel;
|
||||
dViewInfo.mipCount = 1;
|
||||
dViewInfo.layerIndex = srcSubresource.baseArrayLayer;
|
||||
dViewInfo.layerCount = srcSubresource.layerCount;
|
||||
|
||||
DxvkImageViewCreateInfo sViewInfo = dViewInfo;
|
||||
sViewInfo.aspect = VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
DxvkImageViewKey sViewInfo = dViewInfo;
|
||||
sViewInfo.aspects = VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
|
||||
Rc<DxvkImageView> dView = srcImage->createView(dViewInfo);
|
||||
Rc<DxvkImageView> sView = srcImage->createView(sViewInfo);
|
||||
@ -1643,7 +1643,7 @@ namespace dxvk {
|
||||
void DxvkContext::generateMipmaps(
|
||||
const Rc<DxvkImageView>& imageView,
|
||||
VkFilter filter) {
|
||||
if (imageView->info().numLevels <= 1)
|
||||
if (imageView->info().mipCount <= 1)
|
||||
return;
|
||||
|
||||
this->spillRenderPass(false);
|
||||
@ -2038,7 +2038,7 @@ namespace dxvk {
|
||||
|
||||
bool is3D = imageView->image()->info().type == VK_IMAGE_TYPE_3D;
|
||||
|
||||
if ((clearAspects | discardAspects) == imageView->info().aspect && !is3D) {
|
||||
if ((clearAspects | discardAspects) == imageView->info().aspects && !is3D) {
|
||||
colorOp.loadLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
depthOp.loadLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
}
|
||||
@ -2066,7 +2066,7 @@ namespace dxvk {
|
||||
|
||||
VkRenderingInfo renderingInfo = { VK_STRUCTURE_TYPE_RENDERING_INFO };
|
||||
renderingInfo.renderArea.extent = { extent.width, extent.height };
|
||||
renderingInfo.layerCount = imageView->info().numLayers;
|
||||
renderingInfo.layerCount = imageView->info().layerCount;
|
||||
|
||||
VkImageLayout loadLayout;
|
||||
VkImageLayout storeLayout;
|
||||
@ -2095,12 +2095,12 @@ namespace dxvk {
|
||||
| VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
|
||||
clearAccess |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
|
||||
|
||||
if (imageView->info().aspect & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
if (imageView->info().aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
renderingInfo.pDepthAttachment = &attachmentInfo;
|
||||
attachmentInfo.loadOp = depthOp.loadOpD;
|
||||
}
|
||||
|
||||
if (imageView->info().aspect & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
if (imageView->info().aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
renderingInfo.pStencilAttachment = &stencilInfo;
|
||||
stencilInfo.loadOp = depthOp.loadOpS;
|
||||
}
|
||||
@ -2123,13 +2123,13 @@ namespace dxvk {
|
||||
|
||||
if (hasViewFormatMismatch) {
|
||||
VkClearAttachment clearInfo = { };
|
||||
clearInfo.aspectMask = imageView->info().aspect;
|
||||
clearInfo.aspectMask = imageView->info().aspects;
|
||||
clearInfo.clearValue = clearValue;
|
||||
|
||||
VkClearRect clearRect = { };
|
||||
clearRect.rect.extent.width = extent.width;
|
||||
clearRect.rect.extent.height = extent.height;
|
||||
clearRect.layerCount = imageView->info().numLayers;
|
||||
clearRect.layerCount = imageView->info().layerCount;
|
||||
|
||||
m_cmd->cmdClearAttachments(1, &clearInfo, 1, &clearRect);
|
||||
}
|
||||
@ -3304,7 +3304,7 @@ namespace dxvk {
|
||||
if (m_execBarriers.isImageDirty(imageView->image(), imageView->imageSubresources(), DxvkAccess::Write))
|
||||
m_execBarriers.recordCommands(m_cmd);
|
||||
|
||||
clearLayout = (imageView->info().aspect & VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
clearLayout = (imageView->info().aspects & VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
? imageView->pickLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
|
||||
: imageView->pickLayout(VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||
|
||||
@ -3318,9 +3318,9 @@ namespace dxvk {
|
||||
|
||||
VkRenderingInfo renderingInfo = { VK_STRUCTURE_TYPE_RENDERING_INFO };
|
||||
renderingInfo.renderArea.extent = { extent.width, extent.height };
|
||||
renderingInfo.layerCount = imageView->info().numLayers;
|
||||
renderingInfo.layerCount = imageView->info().layerCount;
|
||||
|
||||
if (imageView->info().aspect & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (imageView->info().aspects & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
clearStages |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||
clearAccess |= VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT
|
||||
| VK_ACCESS_COLOR_ATTACHMENT_READ_BIT;
|
||||
@ -3333,10 +3333,10 @@ namespace dxvk {
|
||||
clearAccess |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
|
||||
| VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT;
|
||||
|
||||
if (imageView->info().aspect & VK_IMAGE_ASPECT_DEPTH_BIT)
|
||||
if (imageView->info().aspects & VK_IMAGE_ASPECT_DEPTH_BIT)
|
||||
renderingInfo.pDepthAttachment = &attachmentInfo;
|
||||
|
||||
if (imageView->info().aspect & VK_IMAGE_ASPECT_STENCIL_BIT)
|
||||
if (imageView->info().aspects & VK_IMAGE_ASPECT_STENCIL_BIT)
|
||||
renderingInfo.pStencilAttachment = &attachmentInfo;
|
||||
}
|
||||
|
||||
@ -3373,7 +3373,7 @@ namespace dxvk {
|
||||
clearRect.rect.extent.width = extent.width;
|
||||
clearRect.rect.extent.height = extent.height;
|
||||
clearRect.baseArrayLayer = 0;
|
||||
clearRect.layerCount = imageView->info().numLayers;
|
||||
clearRect.layerCount = imageView->info().layerCount;
|
||||
|
||||
m_cmd->cmdClearAttachments(1, &clearInfo, 1, &clearRect);
|
||||
|
||||
@ -3900,14 +3900,14 @@ namespace dxvk {
|
||||
|
||||
// Create a view for the destination image with the general
|
||||
// properties ofthe source image view used for the clear
|
||||
DxvkImageViewCreateInfo viewInfo = clear->imageView->info();
|
||||
viewInfo.type = dstImage->info().type == VK_IMAGE_TYPE_1D
|
||||
DxvkImageViewKey viewInfo = clear->imageView->info();
|
||||
viewInfo.viewType = dstImage->info().type == VK_IMAGE_TYPE_1D
|
||||
? VK_IMAGE_VIEW_TYPE_1D_ARRAY
|
||||
: VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
viewInfo.minLevel = dstSubresource.mipLevel;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = dstSubresource.baseArrayLayer;
|
||||
viewInfo.numLayers = dstSubresource.layerCount;
|
||||
viewInfo.mipIndex = dstSubresource.mipLevel;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = dstSubresource.baseArrayLayer;
|
||||
viewInfo.layerCount = dstSubresource.layerCount;
|
||||
|
||||
// That is, if the formats are actually compatible
|
||||
// so that we can safely use the same clear value
|
||||
@ -4631,7 +4631,7 @@ namespace dxvk {
|
||||
|
||||
if (depthAttachment.layout != ops.depthOps.loadLayout
|
||||
&& depthAttachment.view != nullptr) {
|
||||
VkImageAspectFlags depthAspects = depthAttachment.view->info().aspect;
|
||||
VkImageAspectFlags depthAspects = depthAttachment.view->info().aspects;
|
||||
|
||||
VkPipelineStageFlags depthStages =
|
||||
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
|
||||
@ -4801,7 +4801,7 @@ namespace dxvk {
|
||||
|
||||
if (framebufferInfo.getDepthTarget().view != nullptr) {
|
||||
const auto& depthTarget = framebufferInfo.getDepthTarget();
|
||||
depthStencilAspects = depthTarget.view->info().aspect;
|
||||
depthStencilAspects = depthTarget.view->info().aspects;
|
||||
depthInfo.imageView = depthTarget.view->handle();
|
||||
depthInfo.imageLayout = depthTarget.layout;
|
||||
depthInfo.loadOp = ops.depthOps.loadOpD;
|
||||
@ -5451,7 +5451,7 @@ namespace dxvk {
|
||||
const Rc<DxvkImageView>& attachment = fbInfo.getColorTarget(i).view;
|
||||
|
||||
VkComponentMapping mapping = attachment != nullptr
|
||||
? util::invertComponentMapping(attachment->info().swizzle)
|
||||
? util::invertComponentMapping(attachment->info().unpackSwizzle())
|
||||
: VkComponentMapping();
|
||||
|
||||
m_state.gp.state.omSwizzle[i] = DxvkOmAttachmentSwizzle(mapping);
|
||||
|
@ -58,7 +58,7 @@ namespace dxvk {
|
||||
bool DxvkFramebufferInfo::isFullSize(const Rc<DxvkImageView>& view) const {
|
||||
return m_renderSize.width == view->mipLevelExtent(0).width
|
||||
&& m_renderSize.height == view->mipLevelExtent(0).height
|
||||
&& m_renderSize.layers == view->info().numLayers;
|
||||
&& m_renderSize.layers == view->info().layerCount;
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ namespace dxvk {
|
||||
DxvkFramebufferSize DxvkFramebufferInfo::computeRenderTargetSize(
|
||||
const Rc<DxvkImageView>& renderTarget) const {
|
||||
auto extent = renderTarget->mipLevelExtent(0);
|
||||
auto layers = renderTarget->info().numLayers;
|
||||
auto layers = renderTarget->info().layerCount;
|
||||
return DxvkFramebufferSize { extent.width, extent.height, layers };
|
||||
}
|
||||
|
||||
|
@ -86,26 +86,11 @@ namespace dxvk {
|
||||
|
||||
|
||||
Rc<DxvkImageView> DxvkImage::createView(
|
||||
const DxvkImageViewCreateInfo& info) {
|
||||
DxvkImageViewKey key = { };
|
||||
key.viewType = info.type;
|
||||
key.format = info.format;
|
||||
key.usage = info.usage;
|
||||
key.aspects = info.aspect;
|
||||
key.mipIndex = info.minLevel;
|
||||
key.mipCount = info.numLevels;
|
||||
key.layerIndex = info.minLayer;
|
||||
key.layerCount = info.numLayers;
|
||||
key.packedSwizzle =
|
||||
(uint16_t(info.swizzle.r) << 0) |
|
||||
(uint16_t(info.swizzle.g) << 4) |
|
||||
(uint16_t(info.swizzle.b) << 8) |
|
||||
(uint16_t(info.swizzle.a) << 12);
|
||||
|
||||
const DxvkImageViewKey& info) {
|
||||
std::unique_lock lock(m_viewMutex);
|
||||
|
||||
auto entry = m_views.emplace(std::piecewise_construct,
|
||||
std::make_tuple(key), std::make_tuple(this, key));
|
||||
std::make_tuple(info), std::make_tuple(this, info));
|
||||
|
||||
return &entry.first->second;
|
||||
}
|
||||
|
@ -70,40 +70,6 @@ namespace dxvk {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Image create info
|
||||
*
|
||||
* The properties of an image view that are
|
||||
* passed to \ref DxvkDevice::createImageView
|
||||
*/
|
||||
struct DxvkImageViewCreateInfo {
|
||||
/// Image view dimension
|
||||
VkImageViewType type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
|
||||
/// Pixel format
|
||||
VkFormat format = VK_FORMAT_UNDEFINED;
|
||||
|
||||
/// Image view usage flags
|
||||
VkImageUsageFlags usage = 0;
|
||||
|
||||
/// Subresources to use in the view
|
||||
VkImageAspectFlags aspect = 0;
|
||||
|
||||
uint32_t minLevel = 0;
|
||||
uint32_t numLevels = 0;
|
||||
uint32_t minLayer = 0;
|
||||
uint32_t numLayers = 0;
|
||||
|
||||
/// Component mapping. Defaults to identity.
|
||||
VkComponentMapping swizzle = {
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Virtual image view
|
||||
*
|
||||
@ -160,21 +126,8 @@ namespace dxvk {
|
||||
* \brief Image view properties
|
||||
* \returns Image view properties
|
||||
*/
|
||||
DxvkImageViewCreateInfo info() const {
|
||||
DxvkImageViewCreateInfo info = { };
|
||||
info.type = m_key.viewType;
|
||||
info.format = m_key.format;
|
||||
info.usage = m_key.usage;
|
||||
info.aspect = m_key.aspects;
|
||||
info.minLevel = m_key.mipIndex;
|
||||
info.numLevels = m_key.mipCount;
|
||||
info.minLayer = m_key.layerIndex;
|
||||
info.numLayers = m_key.layerCount;
|
||||
info.swizzle.r = VkComponentSwizzle((m_key.packedSwizzle >> 0) & 0xf);
|
||||
info.swizzle.g = VkComponentSwizzle((m_key.packedSwizzle >> 4) & 0xf);
|
||||
info.swizzle.b = VkComponentSwizzle((m_key.packedSwizzle >> 8) & 0xf);
|
||||
info.swizzle.a = VkComponentSwizzle((m_key.packedSwizzle >> 12) & 0xf);
|
||||
return info;
|
||||
DxvkImageViewKey info() const {
|
||||
return m_key;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -262,10 +215,10 @@ namespace dxvk {
|
||||
if (this == view.ptr())
|
||||
return true;
|
||||
|
||||
return this->image() == view->image()
|
||||
&& this->subresources() == view->subresources()
|
||||
&& this->info().type == view->info().type
|
||||
&& this->info().format == view->info().format;
|
||||
return this->image() == view->image()
|
||||
&& this->subresources() == view->subresources()
|
||||
&& this->info().viewType == view->info().viewType
|
||||
&& this->info().format == view->info().format;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -568,7 +521,7 @@ namespace dxvk {
|
||||
* \returns Newly created image view
|
||||
*/
|
||||
Rc<DxvkImageView> createView(
|
||||
const DxvkImageViewCreateInfo& info);
|
||||
const DxvkImageViewKey& info);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -95,10 +95,7 @@ namespace dxvk {
|
||||
info.image = m_image;
|
||||
info.viewType = key.viewType;
|
||||
info.format = key.format;
|
||||
info.components.r = VkComponentSwizzle((key.packedSwizzle >> 0) & 0xf);
|
||||
info.components.g = VkComponentSwizzle((key.packedSwizzle >> 4) & 0xf);
|
||||
info.components.b = VkComponentSwizzle((key.packedSwizzle >> 8) & 0xf);
|
||||
info.components.a = VkComponentSwizzle((key.packedSwizzle >> 12) & 0xf);
|
||||
info.components = key.unpackSwizzle();
|
||||
info.subresourceRange.aspectMask = key.aspects;
|
||||
info.subresourceRange.baseMipLevel = key.mipIndex;
|
||||
info.subresourceRange.levelCount = key.mipCount;
|
||||
|
@ -330,6 +330,21 @@ namespace dxvk {
|
||||
&& layerCount == other.layerCount
|
||||
&& packedSwizzle == other.packedSwizzle;
|
||||
}
|
||||
|
||||
VkComponentMapping unpackSwizzle() const {
|
||||
return VkComponentMapping {
|
||||
VkComponentSwizzle((packedSwizzle >> 0) & 0xf),
|
||||
VkComponentSwizzle((packedSwizzle >> 4) & 0xf),
|
||||
VkComponentSwizzle((packedSwizzle >> 8) & 0xf),
|
||||
VkComponentSwizzle((packedSwizzle >> 12) & 0xf) };
|
||||
}
|
||||
|
||||
static uint16_t packSwizzle(VkComponentMapping mapping) {
|
||||
return (uint16_t(mapping.r) << 0)
|
||||
| (uint16_t(mapping.g) << 4)
|
||||
| (uint16_t(mapping.b) << 8)
|
||||
| (uint16_t(mapping.a) << 12);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace dxvk {
|
||||
m_dstViewType = viewTypes.at(uint32_t(view->image()->info().type)).second;
|
||||
|
||||
// Create image views and framebuffers
|
||||
m_passes.resize(view->info().numLevels - 1);
|
||||
m_passes.resize(view->info().mipCount - 1);
|
||||
|
||||
for (uint32_t i = 0; i < m_passes.size(); i++)
|
||||
m_passes[i] = createViews(i);
|
||||
@ -36,7 +36,7 @@ namespace dxvk {
|
||||
VkExtent3D extent = m_view->mipLevelExtent(passId + 1);
|
||||
|
||||
if (m_view->image()->info().type != VK_IMAGE_TYPE_3D)
|
||||
extent.depth = m_view->info().numLayers;
|
||||
extent.depth = m_view->info().layerCount;
|
||||
|
||||
return extent;
|
||||
}
|
||||
@ -55,10 +55,10 @@ namespace dxvk {
|
||||
// the one mip level we're going to sample.
|
||||
VkImageSubresourceRange srcSubresources;
|
||||
srcSubresources.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
srcSubresources.baseMipLevel = m_view->info().minLevel + pass;
|
||||
srcSubresources.baseMipLevel = m_view->info().mipIndex + pass;
|
||||
srcSubresources.levelCount = 1;
|
||||
srcSubresources.baseArrayLayer = m_view->info().minLayer;
|
||||
srcSubresources.layerCount = m_view->info().numLayers;
|
||||
srcSubresources.baseArrayLayer = m_view->info().layerIndex;
|
||||
srcSubresources.layerCount = m_view->info().layerCount;
|
||||
|
||||
usageInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
viewInfo.viewType = m_srcViewType;
|
||||
@ -73,12 +73,12 @@ namespace dxvk {
|
||||
|
||||
VkImageSubresourceRange dstSubresources;
|
||||
dstSubresources.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
dstSubresources.baseMipLevel = m_view->info().minLevel + pass + 1;
|
||||
dstSubresources.baseMipLevel = m_view->info().mipIndex + pass + 1;
|
||||
dstSubresources.levelCount = 1;
|
||||
|
||||
if (m_view->image()->info().type != VK_IMAGE_TYPE_3D) {
|
||||
dstSubresources.baseArrayLayer = m_view->info().minLayer;
|
||||
dstSubresources.layerCount = m_view->info().numLayers;
|
||||
dstSubresources.baseArrayLayer = m_view->info().layerIndex;
|
||||
dstSubresources.layerCount = m_view->info().layerCount;
|
||||
} else {
|
||||
dstSubresources.baseArrayLayer = 0;
|
||||
dstSubresources.layerCount = dstExtent.depth;
|
||||
|
@ -257,15 +257,15 @@ namespace dxvk {
|
||||
m_gammaImage = m_device->createImage(
|
||||
imgInfo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_1D;
|
||||
viewInfo.format = VK_FORMAT_R16G16B16A16_UNORM;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
viewInfo.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
|
||||
m_gammaView = m_gammaImage->createView(viewInfo);
|
||||
}
|
||||
@ -371,15 +371,15 @@ namespace dxvk {
|
||||
newInfo.layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
m_resolveImage = m_device->createImage(newInfo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
DxvkImageViewKey viewInfo;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = info.format;
|
||||
viewInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
viewInfo.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.minLevel = 0;
|
||||
viewInfo.numLevels = 1;
|
||||
viewInfo.minLayer = 0;
|
||||
viewInfo.numLayers = 1;
|
||||
viewInfo.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.mipIndex = 0;
|
||||
viewInfo.mipCount = 1;
|
||||
viewInfo.layerIndex = 0;
|
||||
viewInfo.layerCount = 1;
|
||||
m_resolveView = m_resolveImage->createView(viewInfo);
|
||||
}
|
||||
|
||||
|
@ -306,15 +306,15 @@ namespace dxvk::hud {
|
||||
|
||||
|
||||
Rc<DxvkImageView> HudRenderer::createFontView() {
|
||||
DxvkImageViewCreateInfo info;
|
||||
info.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
DxvkImageViewKey info;
|
||||
info.viewType = 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;
|
||||
info.minLayer = 0;
|
||||
info.numLayers = 1;
|
||||
info.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
info.mipIndex = 0;
|
||||
info.mipCount = 1;
|
||||
info.layerIndex = 0;
|
||||
info.layerCount = 1;
|
||||
|
||||
return m_fontImage->createView(info);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user