mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[d3d11] Set mutable and extended usage bits for multi-plane images
This commit is contained in:
parent
2764f4abb5
commit
e988895e51
@ -58,9 +58,10 @@ namespace dxvk {
|
||||
|
||||
bool isTypeless = formatInfo.Aspect == 0;
|
||||
bool isMutable = formatFamily.FormatCount > 1;
|
||||
bool isMultiPlane = (formatProperties->aspectMask & VK_IMAGE_ASPECT_PLANE_0_BIT) != 0;
|
||||
bool isColorFormat = (formatProperties->aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0;
|
||||
|
||||
if (isMutable && isColorFormat) {
|
||||
if (isMutable && (isColorFormat || isMultiPlane)) {
|
||||
imageInfo.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
|
||||
|
||||
// Typeless UAV images have relaxed reinterpretation rules
|
||||
@ -104,6 +105,15 @@ namespace dxvk {
|
||||
imageInfo.access |= VK_ACCESS_SHADER_READ_BIT
|
||||
| VK_ACCESS_SHADER_WRITE_BIT;
|
||||
}
|
||||
|
||||
// Multi-plane formats need views to be created with color formats, and
|
||||
// may not report all relevant usage flags as supported on their own.
|
||||
// Also, enable sampled bit to enable use with video processor APIs.
|
||||
if (isMultiPlane) {
|
||||
imageInfo.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
imageInfo.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
|
||||
| VK_IMAGE_CREATE_EXTENDED_USAGE_BIT;
|
||||
}
|
||||
|
||||
// Access pattern for meta-resolve operations
|
||||
if (imageInfo.sampleCount != VK_SAMPLE_COUNT_1_BIT && isColorFormat) {
|
||||
@ -146,7 +156,7 @@ namespace dxvk {
|
||||
// We must keep LINEAR images in GENERAL layout, but we
|
||||
// can choose a better layout for the image based on how
|
||||
// it is going to be used by the game.
|
||||
if (imageInfo.tiling == VK_IMAGE_TILING_OPTIMAL)
|
||||
if (imageInfo.tiling == VK_IMAGE_TILING_OPTIMAL && !isMultiPlane)
|
||||
imageInfo.layout = OptimizeLayout(imageInfo.usage);
|
||||
|
||||
// For some formats, we need to enable sampled and/or
|
||||
@ -324,11 +334,15 @@ namespace dxvk {
|
||||
VkImageTiling Tiling) const {
|
||||
const Rc<DxvkAdapter> adapter = m_device->GetDXVKDevice()->adapter();
|
||||
|
||||
VkImageUsageFlags usage = pImageInfo->usage;
|
||||
|
||||
if (pImageInfo->flags & VK_IMAGE_CREATE_EXTENDED_USAGE_BIT)
|
||||
usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||
|
||||
VkImageFormatProperties formatProps = { };
|
||||
|
||||
VkResult status = adapter->imageFormatProperties(
|
||||
pImageInfo->format, pImageInfo->type, Tiling,
|
||||
pImageInfo->usage, pImageInfo->flags, formatProps);
|
||||
usage, pImageInfo->flags, formatProps);
|
||||
|
||||
if (status != VK_SUCCESS)
|
||||
return FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user