mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d9] Do not proactively enable meta copy usage flags
Same as the corresponding D3D11 change, let the backend deal with this when necessary.
This commit is contained in:
parent
5f3fa9e423
commit
b164d6e2a7
@ -381,11 +381,6 @@ namespace dxvk {
|
|||||||
if (imageInfo.tiling == VK_IMAGE_TILING_OPTIMAL && imageInfo.sharing.mode == DxvkSharedHandleMode::None)
|
if (imageInfo.tiling == VK_IMAGE_TILING_OPTIMAL && imageInfo.sharing.mode == DxvkSharedHandleMode::None)
|
||||||
imageInfo.layout = OptimizeLayout(imageInfo.usage);
|
imageInfo.layout = OptimizeLayout(imageInfo.usage);
|
||||||
|
|
||||||
// For some formats, we need to enable render target
|
|
||||||
// capabilities if available, but these should
|
|
||||||
// in no way affect the default image layout
|
|
||||||
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)) {
|
||||||
throw DxvkError(str::format(
|
throw DxvkError(str::format(
|
||||||
@ -459,49 +454,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VkImageUsageFlags D3D9CommonTexture::EnableMetaCopyUsage(
|
|
||||||
VkFormat Format,
|
|
||||||
VkImageTiling Tiling,
|
|
||||||
VkSampleCountFlags SampleCount) const {
|
|
||||||
VkFormatFeatureFlags2 requestedFeatures = 0;
|
|
||||||
|
|
||||||
if (Format == VK_FORMAT_D16_UNORM || Format == VK_FORMAT_D32_SFLOAT)
|
|
||||||
requestedFeatures |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT;
|
|
||||||
|
|
||||||
if (Format == VK_FORMAT_R16_UNORM || Format == VK_FORMAT_R32_SFLOAT)
|
|
||||||
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)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Enable usage flags for all supported and requested features
|
|
||||||
DxvkFormatFeatures properties = m_device->GetDXVKDevice()->getFormatFeatures(Format);
|
|
||||||
|
|
||||||
requestedFeatures &= Tiling == VK_IMAGE_TILING_OPTIMAL
|
|
||||||
? properties.optimal
|
|
||||||
: properties.linear;
|
|
||||||
|
|
||||||
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)
|
|
||||||
requestedUsage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
|
||||||
|
|
||||||
if (requestedFeatures & VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT)
|
|
||||||
requestedUsage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
|
||||||
|
|
||||||
return requestedUsage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VkImageType D3D9CommonTexture::GetImageTypeFromResourceType(D3DRESOURCETYPE Type) {
|
VkImageType D3D9CommonTexture::GetImageTypeFromResourceType(D3DRESOURCETYPE Type) {
|
||||||
switch (Type) {
|
switch (Type) {
|
||||||
case D3DRTYPE_SURFACE:
|
case D3DRTYPE_SURFACE:
|
||||||
|
@ -547,11 +547,6 @@ namespace dxvk {
|
|||||||
const DxvkImageCreateInfo* pImageInfo,
|
const DxvkImageCreateInfo* pImageInfo,
|
||||||
VkImageTiling Tiling) const;
|
VkImageTiling Tiling) const;
|
||||||
|
|
||||||
VkImageUsageFlags EnableMetaCopyUsage(
|
|
||||||
VkFormat Format,
|
|
||||||
VkImageTiling Tiling,
|
|
||||||
VkSampleCountFlags SampleCount) const;
|
|
||||||
|
|
||||||
D3D9_COMMON_TEXTURE_MAP_MODE DetermineMapMode() const;
|
D3D9_COMMON_TEXTURE_MAP_MODE DetermineMapMode() const;
|
||||||
|
|
||||||
VkImageLayout OptimizeLayout(
|
VkImageLayout OptimizeLayout(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user