mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d9] Only add meta image usage after determining layout
This commit is contained in:
parent
c7cf0a7368
commit
07e7781c0b
@ -324,10 +324,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DecodeMultiSampleType(m_device->GetDXVKDevice(), m_desc.MultiSample, m_desc.MultisampleQuality, &imageInfo.sampleCount);
|
DecodeMultiSampleType(m_device->GetDXVKDevice(), m_desc.MultiSample, m_desc.MultisampleQuality, &imageInfo.sampleCount);
|
||||||
|
|
||||||
// We need SAMPLED_BIT for StretchRect.
|
if (!m_desc.IsAttachmentOnly)
|
||||||
// However, StretchRect does not allow stretching for DS formats,
|
|
||||||
// so unless we need to resolve, it should always hit code paths that only need TRANSFER_BIT.
|
|
||||||
if (!m_desc.IsAttachmentOnly || !IsDepthStencilFormat(m_desc.Format) || imageInfo.sampleCount != VK_SAMPLE_COUNT_1_BIT)
|
|
||||||
imageInfo.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
imageInfo.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||||
|
|
||||||
// The image must be marked as mutable if it can be reinterpreted
|
// The image must be marked as mutable if it can be reinterpreted
|
||||||
@ -387,7 +384,7 @@ namespace dxvk {
|
|||||||
// For some formats, we need to enable render target
|
// For some formats, we need to enable render target
|
||||||
// capabilities if available, but these should
|
// capabilities if available, but these should
|
||||||
// in no way affect the default image layout
|
// in no way affect the default image layout
|
||||||
imageInfo.usage |= EnableMetaCopyUsage(imageInfo.format, imageInfo.tiling);
|
imageInfo.usage |= EnableMetaCopyUsage(imageInfo.format, imageInfo.tiling, imageInfo.sampleCount);
|
||||||
|
|
||||||
// Check if we can actually create the image
|
// Check if we can actually create the image
|
||||||
if (!CheckImageSupport(&imageInfo, imageInfo.tiling)) {
|
if (!CheckImageSupport(&imageInfo, imageInfo.tiling)) {
|
||||||
@ -464,7 +461,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkImageUsageFlags D3D9CommonTexture::EnableMetaCopyUsage(
|
VkImageUsageFlags D3D9CommonTexture::EnableMetaCopyUsage(
|
||||||
VkFormat Format,
|
VkFormat Format,
|
||||||
VkImageTiling Tiling) const {
|
VkImageTiling Tiling,
|
||||||
|
VkSampleCountFlags SampleCount) const {
|
||||||
VkFormatFeatureFlags2 requestedFeatures = 0;
|
VkFormatFeatureFlags2 requestedFeatures = 0;
|
||||||
|
|
||||||
if (Format == VK_FORMAT_D16_UNORM || Format == VK_FORMAT_D32_SFLOAT)
|
if (Format == VK_FORMAT_D16_UNORM || Format == VK_FORMAT_D32_SFLOAT)
|
||||||
@ -473,6 +471,12 @@ namespace dxvk {
|
|||||||
if (Format == VK_FORMAT_R16_UNORM || Format == VK_FORMAT_R32_SFLOAT)
|
if (Format == VK_FORMAT_R16_UNORM || Format == VK_FORMAT_R32_SFLOAT)
|
||||||
requestedFeatures |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT;
|
requestedFeatures |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT;
|
||||||
|
|
||||||
|
// We need SAMPLED_BIT for StretchRect.
|
||||||
|
// However, StretchRect does not allow stretching for DS formats,
|
||||||
|
// so unless we need to resolve, it should always hit code paths that only need TRANSFER_BIT.
|
||||||
|
if (!IsDepthStencilFormat(m_desc.Format) || SampleCount != VK_SAMPLE_COUNT_1_BIT)
|
||||||
|
requestedFeatures |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT;
|
||||||
|
|
||||||
if (!requestedFeatures)
|
if (!requestedFeatures)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -485,6 +489,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkImageUsageFlags requestedUsage = 0;
|
VkImageUsageFlags requestedUsage = 0;
|
||||||
|
|
||||||
|
if (requestedFeatures & VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT)
|
||||||
|
requestedUsage |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||||
|
|
||||||
if (requestedFeatures & VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT)
|
if (requestedFeatures & VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT)
|
||||||
requestedUsage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
requestedUsage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||||
|
|
||||||
|
@ -549,7 +549,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkImageUsageFlags EnableMetaCopyUsage(
|
VkImageUsageFlags EnableMetaCopyUsage(
|
||||||
VkFormat Format,
|
VkFormat Format,
|
||||||
VkImageTiling Tiling) const;
|
VkImageTiling Tiling,
|
||||||
|
VkSampleCountFlags SampleCount) const;
|
||||||
|
|
||||||
D3D9_COMMON_TEXTURE_MAP_MODE DetermineMapMode() const;
|
D3D9_COMMON_TEXTURE_MAP_MODE DetermineMapMode() const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user