From 7e0a2a91653fe8c62d68d1bbef1128e20efa971c Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 9 Aug 2018 23:33:36 +0200 Subject: [PATCH] [d3d11] Added GetBufferFormatFeatures and GetImageFormatFeatures helpers --- src/d3d11/d3d11_util.cpp | 28 ++++++++++++++++++++++++++++ src/d3d11/d3d11_util.h | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/src/d3d11/d3d11_util.cpp b/src/d3d11/d3d11_util.cpp index 8a5f0200..9e781977 100644 --- a/src/d3d11/d3d11_util.cpp +++ b/src/d3d11/d3d11_util.cpp @@ -157,4 +157,32 @@ namespace dxvk { return usage; } + + VkFormatFeatureFlags GetBufferFormatFeatures(UINT BindFlags) { + VkFormatFeatureFlags features = 0; + + if (BindFlags & D3D11_BIND_SHADER_RESOURCE) + features |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; + if (BindFlags & D3D11_BIND_UNORDERED_ACCESS) + features |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT; + + return features; + } + + + VkFormatFeatureFlags GetImageFormatFeatures(UINT BindFlags) { + VkFormatFeatureFlags features = 0; + + if (BindFlags & D3D11_BIND_DEPTH_STENCIL) + features |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; + if (BindFlags & D3D11_BIND_RENDER_TARGET) + features |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + if (BindFlags & D3D11_BIND_SHADER_RESOURCE) + features |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; + if (BindFlags & D3D11_BIND_UNORDERED_ACCESS) + features |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT; + + return features; + } + } \ No newline at end of file diff --git a/src/d3d11/d3d11_util.h b/src/d3d11/d3d11_util.h index d2fb375a..b1f97dd5 100644 --- a/src/d3d11/d3d11_util.h +++ b/src/d3d11/d3d11_util.h @@ -45,5 +45,11 @@ namespace dxvk { VkImageUsageFlags GetImageUsageFlags( UINT BindFlags); + + VkFormatFeatureFlags GetBufferFormatFeatures( + UINT BindFlags); + + VkFormatFeatureFlags GetImageFormatFeatures( + UINT BindFlags); } \ No newline at end of file