turnip: Add tu6_rb_fmt_to_ifmt.

This commit is contained in:
Bas Nieuwenhuizen
2019-02-04 14:52:34 +01:00
committed by Chia-I Wu
parent 148876d424
commit bafbf3bafe
2 changed files with 75 additions and 0 deletions
+69
View File
@@ -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)
{
+6
View File
@@ -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
{