mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[d3d11] Add usage flag for meta-pack operations if necessary
- Fix depth-stencil format list
This commit is contained in:
parent
81a5e2fa0c
commit
f483bc9633
@ -145,6 +145,7 @@ namespace dxvk {
|
||||
// render target capabilities if available, but these
|
||||
// should in no way affect the default image layout
|
||||
imageInfo.usage |= EnableMetaCopyUsage(imageInfo.format, imageInfo.tiling);
|
||||
imageInfo.usage |= EnableMetaPackUsage(imageInfo.format, m_desc.CPUAccessFlags);
|
||||
|
||||
// Check if we can actually create the image
|
||||
if (!CheckImageSupport(&imageInfo, imageInfo.tiling)) {
|
||||
@ -353,6 +354,23 @@ namespace dxvk {
|
||||
return requestedUsage;
|
||||
}
|
||||
|
||||
|
||||
VkImageUsageFlags D3D11CommonTexture::EnableMetaPackUsage(
|
||||
VkFormat Format,
|
||||
UINT CpuAccess) const {
|
||||
if ((CpuAccess & D3D11_CPU_ACCESS_READ) == 0)
|
||||
return 0;
|
||||
|
||||
const auto dsMask = VK_IMAGE_ASPECT_DEPTH_BIT
|
||||
| VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
|
||||
auto formatInfo = imageFormatInfo(Format);
|
||||
|
||||
return formatInfo->aspectMask == dsMask
|
||||
? VK_IMAGE_USAGE_SAMPLED_BIT
|
||||
: 0;
|
||||
}
|
||||
|
||||
|
||||
D3D11_COMMON_TEXTURE_MAP_MODE D3D11CommonTexture::DetermineMapMode(
|
||||
const DxvkImageCreateInfo* pImageInfo) const {
|
||||
@ -369,6 +387,11 @@ namespace dxvk {
|
||||
if (m_desc.Usage == D3D11_USAGE_DYNAMIC)
|
||||
return D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER;
|
||||
|
||||
// Depth-stencil formats in D3D11 can be mapped and follow special
|
||||
// packing rules, so we need to copy that data into a buffer first
|
||||
if (GetPackedDepthStencilFormat(m_desc.Format))
|
||||
return D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER;
|
||||
|
||||
// Images that can be read by the host should be mapped directly in
|
||||
// order to avoid expensive synchronization with the GPU. This does
|
||||
// however require linear tiling, which may not be supported for all
|
||||
|
@ -203,6 +203,10 @@ namespace dxvk {
|
||||
VkFormat Format,
|
||||
VkImageTiling Tiling) const;
|
||||
|
||||
VkImageUsageFlags EnableMetaPackUsage(
|
||||
VkFormat Format,
|
||||
UINT CpuAccess) const;
|
||||
|
||||
D3D11_COMMON_TEXTURE_MAP_MODE DetermineMapMode(
|
||||
const DxvkImageCreateInfo* pImageInfo) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user