From cdc85a1238e277c678d0449bbda8138b455e44d8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 9 Aug 2018 21:49:31 +0200 Subject: [PATCH] [d3d11] Add GetImageUsageFlags and GetBufferUsageFlags 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 24b4e63a..8a5f0200 100644 --- a/src/d3d11/d3d11_util.cpp +++ b/src/d3d11/d3d11_util.cpp @@ -129,4 +129,32 @@ namespace dxvk { } } + + VkBufferUsageFlags GetBufferUsageFlags(UINT BindFlags) { + VkBufferUsageFlags usage = 0; + + if (BindFlags & D3D11_BIND_SHADER_RESOURCE) + usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT; + if (BindFlags & D3D11_BIND_UNORDERED_ACCESS) + usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT; + + return 0; + } + + + VkImageUsageFlags GetImageUsageFlags(UINT BindFlags) { + VkImageUsageFlags usage = 0; + + if (BindFlags & D3D11_BIND_DEPTH_STENCIL) + usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + if (BindFlags & D3D11_BIND_RENDER_TARGET) + usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + if (BindFlags & D3D11_BIND_SHADER_RESOURCE) + usage |= VK_IMAGE_USAGE_SAMPLED_BIT; + if (BindFlags & D3D11_BIND_UNORDERED_ACCESS) + usage |= VK_IMAGE_USAGE_STORAGE_BIT; + + return usage; + } + } \ No newline at end of file diff --git a/src/d3d11/d3d11_util.h b/src/d3d11/d3d11_util.h index b562d368..d2fb375a 100644 --- a/src/d3d11/d3d11_util.h +++ b/src/d3d11/d3d11_util.h @@ -40,4 +40,10 @@ namespace dxvk { VkShaderStageFlagBits GetShaderStage( DxbcProgramType ProgramType); + VkBufferUsageFlags GetBufferUsageFlags( + UINT BindFlags); + + VkImageUsageFlags GetImageUsageFlags( + UINT BindFlags); + } \ No newline at end of file