diff options
author | Bas Nieuwenhuizen <[email protected]> | 2019-02-04 14:52:34 +0100 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:02:13 -0700 |
commit | bafbf3bafe4440e61b5ba97716de5b270a2be9d8 (patch) | |
tree | 7ec3cbc0c73eb67e0775d95f339a0462a297bbd5 /src/freedreno | |
parent | 148876d424cb26ad28f0a3333792da3558a39ac9 (diff) |
turnip: Add tu6_rb_fmt_to_ifmt.
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/vulkan/tu_formats.c | 69 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_private.h | 6 |
2 files changed, 75 insertions, 0 deletions
diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c index 1dbb6de3380..ce013e65c22 100644 --- a/src/freedreno/vulkan/tu_formats.c +++ b/src/freedreno/vulkan/tu_formats.c @@ -328,6 +328,75 @@ tu6_get_native_format(VkFormat format) return (fmt && fmt->present) ? fmt : NULL; } +enum a6xx_2d_ifmt +tu6_rb_fmt_to_ifmt(enum a6xx_color_fmt fmt) +{ + switch (fmt) { + case RB6_A8_UNORM: + case RB6_R8_UNORM: + case RB6_R8_SNORM: + case RB6_R8G8_UNORM: + case RB6_R8G8_SNORM: + case RB6_R8G8B8A8_UNORM: + case RB6_R8G8B8_UNORM: + case RB6_R8G8B8A8_SNORM: + return R2D_UNORM8; + + case RB6_R32_UINT: + case RB6_R32_SINT: + case RB6_R32G32_UINT: + case RB6_R32G32_SINT: + case RB6_R32G32B32A32_UINT: + case RB6_R32G32B32A32_SINT: + return R2D_INT32; + + case RB6_R16_UINT: + case RB6_R16_SINT: + case RB6_R16G16_UINT: + case RB6_R16G16_SINT: + case RB6_R16G16B16A16_UINT: + case RB6_R16G16B16A16_SINT: + return R2D_INT16; + + case RB6_R8_UINT: + case RB6_R8_SINT: + case RB6_R8G8_UINT: + case RB6_R8G8_SINT: + case RB6_R8G8B8A8_UINT: + case RB6_R8G8B8A8_SINT: + return R2D_INT8; + + case RB6_R16_UNORM: + case RB6_R16_SNORM: + case RB6_R16G16_UNORM: + case RB6_R16G16_SNORM: + case RB6_R16G16B16A16_UNORM: + case RB6_R16G16B16A16_SNORM: + case RB6_R32_FLOAT: + case RB6_R32G32_FLOAT: + case RB6_R32G32B32A32_FLOAT: + return R2D_FLOAT32; + + case RB6_R16_FLOAT: + case RB6_R16G16_FLOAT: + case RB6_R16G16B16A16_FLOAT: + return R2D_FLOAT16; + + case RB6_R4G4B4A4_UNORM: + case RB6_R5G5B5A1_UNORM: + case RB6_R5G6B5_UNORM: + case RB6_R10G10B10A2_UNORM: + case RB6_R10G10B10A2_UINT: + case RB6_R11G11B10_FLOAT: + case RB6_X8Z24_UNORM: + // ??? + return 0; + default: + unreachable("bad format"); + return 0; + } +} + static uint32_t tu_pack_mask(int bits) { diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index f9af1031aa9..2f46134f962 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -52,6 +52,11 @@ #include "vk_debug_report.h" #include "drm/msm_drm.h" + +#include "adreno_common.xml.h" +#include "adreno_pm4.xml.h" +#include "a6xx.xml.h" + #include "tu_descriptor_set.h" #include "tu_extensions.h" @@ -1027,6 +1032,7 @@ int tu_pack_clear_value(const VkClearValue *val, VkFormat format, uint32_t buf[4]); +enum a6xx_2d_ifmt tu6_rb_fmt_to_ifmt(enum a6xx_color_fmt fmt); struct tu_image_level { |