1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 04:24:11 +01:00

[d3d11] Add GetImageUsageFlags and GetBufferUsageFlags helpers

This commit is contained in:
Philip Rebohle 2018-08-09 21:49:31 +02:00
parent 1a4b17d607
commit cdc85a1238
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 34 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -40,4 +40,10 @@ namespace dxvk {
VkShaderStageFlagBits GetShaderStage(
DxbcProgramType ProgramType);
VkBufferUsageFlags GetBufferUsageFlags(
UINT BindFlags);
VkImageUsageFlags GetImageUsageFlags(
UINT BindFlags);
}