turnip: Drop the copy of the formats table.

Now that we can (mostly) generate a pipe format for a VkFormat, use that
to answer queries about formats.  This will let us refactor the freedreno
format table surface layout code to be shared between gallium and vulkan.

This causes us to expose fewer formats for now (on a 1/100 CTS run I'm
doing, skips go from 3671 to 3835 out of 5145 tests).  Fails stay about
the same (478 -> 434, but the run is pretty flaky and we're doing fewer
tests now).

v2: Rebase on master, throw a finishme on missing vk-to-pipe formats that
    tu used to support.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> (v1)
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
This commit is contained in:
Eric Anholt
2019-11-11 16:08:25 -08:00
parent 3a28281bf8
commit bdf03b738d
6 changed files with 84 additions and 739 deletions
+1 -10
View File
@@ -39,15 +39,6 @@ tu_extensions_c = custom_target(
],
)
tu_format_table_c = custom_target(
'tu_format_table.c',
input : ['vk_format_table.py', 'vk_format_layout.csv'],
output : 'vk_format_table.c',
command : [prog_python, '@INPUT@'],
depend_files : files('vk_format_parse.py'),
capture : true,
)
libtu_files = files(
'tu_blit.c',
'tu_blit.h',
@@ -108,7 +99,7 @@ endif
libvulkan_freedreno = shared_library(
'vulkan_freedreno',
[libtu_files, tu_entrypoints, tu_extensions_c, tu_format_table_c, freedreno_xml_header_files],
[libtu_files, tu_entrypoints, tu_extensions_c, freedreno_xml_header_files],
include_directories : [
inc_common,
inc_compiler,
+37 -30
View File
@@ -323,6 +323,14 @@ tu6_get_native_format(VkFormat format)
if (format >= tu6_format_table0_first && format <= tu6_format_table0_last)
fmt = &tu6_format_table0[format - tu6_format_table0_first];
if (!fmt || !fmt->present)
return NULL;
if (vk_format_to_pipe_format(format) == PIPE_FORMAT_NONE) {
tu_finishme("vk_format %d missing matching pipe format.\n", format);
return NULL;
}
return (fmt && fmt->present) ? fmt : NULL;
}
@@ -499,32 +507,30 @@ union tu_clear_component_value {
static uint32_t
tu_pack_clear_component_value(union tu_clear_component_value val,
const struct vk_format_channel_description *ch)
const struct util_format_channel_description *ch)
{
uint32_t packed;
switch (ch->type) {
case VK_FORMAT_TYPE_UNSIGNED:
case UTIL_FORMAT_TYPE_UNSIGNED:
/* normalized, scaled, or pure integer */
assert(ch->normalized + ch->scaled + ch->pure_integer == 1);
if (ch->normalized)
packed = tu_pack_float32_for_unorm(val.float32, ch->size);
else if (ch->scaled)
packed = tu_pack_float32_for_uscaled(val.float32, ch->size);
else
else if (ch->pure_integer)
packed = tu_pack_uint32_for_uint(val.uint32, ch->size);
else
packed = tu_pack_float32_for_uscaled(val.float32, ch->size);
break;
case VK_FORMAT_TYPE_SIGNED:
case UTIL_FORMAT_TYPE_SIGNED:
/* normalized, scaled, or pure integer */
assert(ch->normalized + ch->scaled + ch->pure_integer == 1);
if (ch->normalized)
packed = tu_pack_float32_for_snorm(val.float32, ch->size);
else if (ch->scaled)
packed = tu_pack_float32_for_sscaled(val.float32, ch->size);
else
else if (ch->pure_integer)
packed = tu_pack_int32_for_sint(val.int32, ch->size);
else
packed = tu_pack_float32_for_sscaled(val.float32, ch->size);
break;
case VK_FORMAT_TYPE_FLOAT:
case UTIL_FORMAT_TYPE_FLOAT:
packed = tu_pack_float32_for_sfloat(val.float32, ch->size);
break;
default:
@@ -537,18 +543,18 @@ tu_pack_clear_component_value(union tu_clear_component_value val,
return packed;
}
static const struct vk_format_channel_description *
tu_get_format_channel_description(const struct vk_format_description *desc,
static const struct util_format_channel_description *
tu_get_format_channel_description(const struct util_format_description *desc,
int comp)
{
switch (desc->swizzle[comp]) {
case VK_SWIZZLE_X:
case PIPE_SWIZZLE_X:
return &desc->channel[0];
case VK_SWIZZLE_Y:
case PIPE_SWIZZLE_Y:
return &desc->channel[1];
case VK_SWIZZLE_Z:
case PIPE_SWIZZLE_Z:
return &desc->channel[2];
case VK_SWIZZLE_W:
case PIPE_SWIZZLE_W:
return &desc->channel[3];
default:
return NULL;
@@ -557,20 +563,20 @@ tu_get_format_channel_description(const struct vk_format_description *desc,
static union tu_clear_component_value
tu_get_clear_component_value(const VkClearValue *val, int comp,
enum vk_format_colorspace colorspace)
enum util_format_colorspace colorspace)
{
assert(comp < 4);
union tu_clear_component_value tmp;
switch (colorspace) {
case VK_FORMAT_COLORSPACE_ZS:
case UTIL_FORMAT_COLORSPACE_ZS:
assert(comp < 2);
if (comp == 0)
tmp.float32 = val->depthStencil.depth;
else
tmp.uint32 = val->depthStencil.stencil;
break;
case VK_FORMAT_COLORSPACE_SRGB:
case UTIL_FORMAT_COLORSPACE_SRGB:
if (comp < 3) {
tmp.float32 = util_format_linear_to_srgb_float(val->color.float32[comp]);
break;
@@ -594,7 +600,7 @@ tu_get_clear_component_value(const VkClearValue *val, int comp,
void
tu_pack_clear_value(const VkClearValue *val, VkFormat format, uint32_t buf[4])
{
const struct vk_format_description *desc = vk_format_description(format);
const struct util_format_description *desc = vk_format_description(format);
switch (format) {
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
@@ -607,7 +613,7 @@ tu_pack_clear_value(const VkClearValue *val, VkFormat format, uint32_t buf[4])
break;
}
assert(desc && desc->layout == VK_FORMAT_LAYOUT_PLAIN);
assert(desc && desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
/* S8_UINT is special and has no depth */
const int max_components =
@@ -616,7 +622,7 @@ tu_pack_clear_value(const VkClearValue *val, VkFormat format, uint32_t buf[4])
int buf_offset = 0;
int bit_shift = 0;
for (int comp = 0; comp < max_components; comp++) {
const struct vk_format_channel_description *ch =
const struct util_format_channel_description *ch =
tu_get_format_channel_description(desc, comp);
if (!ch) {
assert((format == VK_FORMAT_S8_UINT && comp == 0) ||
@@ -645,7 +651,7 @@ tu_pack_clear_value(const VkClearValue *val, VkFormat format, uint32_t buf[4])
void
tu_2d_clear_color(const VkClearColorValue *val, VkFormat format, uint32_t buf[4])
{
const struct vk_format_description *desc = vk_format_description(format);
const struct util_format_description *desc = vk_format_description(format);
/* not supported by 2D engine, cleared as U32 */
if (format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
@@ -655,10 +661,11 @@ tu_2d_clear_color(const VkClearColorValue *val, VkFormat format, uint32_t buf[4]
enum a6xx_2d_ifmt ifmt = tu6_rb_fmt_to_ifmt(tu6_get_native_format(format)->rb);
assert(desc && desc->layout == VK_FORMAT_LAYOUT_PLAIN);
assert(desc && (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ||
format == VK_FORMAT_B10G11R11_UFLOAT_PACK32));
for (unsigned i = 0; i < desc->nr_channels; i++) {
const struct vk_format_channel_description *ch = &desc->channel[i];
const struct util_format_channel_description *ch = &desc->channel[i];
switch (ifmt) {
case R2D_INT32:
@@ -672,10 +679,10 @@ tu_2d_clear_color(const VkClearColorValue *val, VkFormat format, uint32_t buf[4]
break;
case R2D_UNORM8: {
float linear = val->float32[i];
if (desc->colorspace == VK_FORMAT_COLORSPACE_SRGB && i < 3)
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB && i < 3)
linear = util_format_linear_to_srgb_float(val->float32[i]);
if (ch->type == VK_FORMAT_TYPE_SIGNED)
if (ch->type == UTIL_FORMAT_TYPE_SIGNED)
buf[i] = tu_pack_float32_for_snorm(linear, 8);
else
buf[i] = tu_pack_float32_for_unorm(linear, 8);
@@ -718,7 +725,7 @@ tu_physical_device_get_format_properties(
VkFormatProperties *out_properties)
{
VkFormatFeatureFlags linear = 0, tiled = 0, buffer = 0;
const struct vk_format_description *desc = vk_format_description(format);
const struct util_format_description *desc = vk_format_description(format);
const struct tu_native_format *native_fmt = tu6_get_native_format(format);
if (!desc || !native_fmt) {
goto end;
+5 -5
View File
@@ -74,7 +74,7 @@ static void
setup_slices(struct tu_image *image, const VkImageCreateInfo *pCreateInfo)
{
VkFormat format = pCreateInfo->format;
enum vk_format_layout layout = vk_format_description(format)->layout;
enum util_format_layout layout = vk_format_description(format)->layout;
uint32_t layer_size = 0;
int ta = image->cpp;
@@ -113,7 +113,7 @@ setup_slices(struct tu_image *image, const VkImageCreateInfo *pCreateInfo)
if (level + 1 == pCreateInfo->mipLevels)
aligned_height = align(aligned_height, 32);
if (layout == VK_FORMAT_LAYOUT_ASTC)
if (layout == UTIL_FORMAT_LAYOUT_ASTC)
slice->pitch =
util_align_npot(width, pitchalign * vk_format_get_blockwidth(format));
else
@@ -218,7 +218,7 @@ tu_image_create(VkDevice _device,
static enum a6xx_tex_fetchsize
tu6_fetchsize(VkFormat format)
{
if (vk_format_description(format)->layout == VK_FORMAT_LAYOUT_ASTC)
if (vk_format_description(format)->layout == UTIL_FORMAT_LAYOUT_ASTC)
return TFETCH6_16_BYTE;
switch (vk_format_get_blocksize(format) / vk_format_get_blockwidth(format)) {
@@ -249,8 +249,8 @@ tu6_texswiz(const VkComponentMapping *comps, const unsigned char *fmt_swiz)
/* if format has 0/1 in channel, use that (needed for bc1_rgb) */
if (swiz[i] < 4) {
switch (fmt_swiz[swiz[i]]) {
case VK_SWIZZLE_0: swiz[i] = A6XX_TEX_ZERO; break;
case VK_SWIZZLE_1: swiz[i] = A6XX_TEX_ONE; break;
case PIPE_SWIZZLE_0: swiz[i] = A6XX_TEX_ZERO; break;
case PIPE_SWIZZLE_1: swiz[i] = A6XX_TEX_ONE; break;
}
}
}
+41 -333
View File
@@ -29,120 +29,16 @@
#include <assert.h>
#include <util/macros.h>
#include <util/format/u_format.h>
#include <vulkan/util/vk_format.h>
#include <vulkan/vulkan.h>
enum vk_format_layout
static inline const struct util_format_description *
vk_format_description(VkFormat format)
{
/**
* Formats with vk_format_block::width == vk_format_block::height == 1
* that can be described as an ordinary data structure.
*/
VK_FORMAT_LAYOUT_PLAIN = 0,
/**
* Formats with sub-sampled channels.
*
* This is for formats like YVYU where there is less than one sample per
* pixel.
*/
VK_FORMAT_LAYOUT_SUBSAMPLED = 3,
/**
* S3 Texture Compression formats.
*/
VK_FORMAT_LAYOUT_S3TC = 4,
/**
* Red-Green Texture Compression formats.
*/
VK_FORMAT_LAYOUT_RGTC = 5,
/**
* Ericsson Texture Compression
*/
VK_FORMAT_LAYOUT_ETC = 6,
/**
* BC6/7 Texture Compression
*/
VK_FORMAT_LAYOUT_BPTC = 7,
/**
* ASTC
*/
VK_FORMAT_LAYOUT_ASTC = 8,
/**
* Everything else that doesn't fit in any of the above layouts.
*/
VK_FORMAT_LAYOUT_OTHER = 9
};
struct vk_format_block
{
/** Block width in pixels */
unsigned width;
/** Block height in pixels */
unsigned height;
/** Block size in bits */
unsigned bits;
};
enum vk_format_type
{
VK_FORMAT_TYPE_VOID = 0,
VK_FORMAT_TYPE_UNSIGNED = 1,
VK_FORMAT_TYPE_SIGNED = 2,
VK_FORMAT_TYPE_FIXED = 3,
VK_FORMAT_TYPE_FLOAT = 4
};
enum vk_format_colorspace
{
VK_FORMAT_COLORSPACE_RGB = 0,
VK_FORMAT_COLORSPACE_SRGB = 1,
VK_FORMAT_COLORSPACE_YUV = 2,
VK_FORMAT_COLORSPACE_ZS = 3
};
struct vk_format_channel_description
{
unsigned type : 5;
unsigned normalized : 1;
unsigned pure_integer : 1;
unsigned scaled : 1;
unsigned size : 8;
unsigned shift : 16;
};
struct vk_format_description
{
VkFormat format;
const char *name;
const char *short_name;
struct vk_format_block block;
enum vk_format_layout layout;
unsigned nr_channels : 3;
unsigned is_array : 1;
unsigned is_bitmask : 1;
unsigned is_mixed : 1;
struct vk_format_channel_description channel[4];
unsigned char swizzle[4];
enum vk_format_colorspace colorspace;
};
extern const struct vk_format_description vk_format_description_table[];
const struct vk_format_description *
vk_format_description(VkFormat format);
return util_format_description(vk_format_to_pipe_format(format));
}
/**
* Return total bits needed for the pixel format per block.
@@ -150,14 +46,7 @@ vk_format_description(VkFormat format);
static inline unsigned
vk_format_get_blocksizebits(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
assert(desc);
if (!desc) {
return 0;
}
return desc->block.bits;
return util_format_get_blocksizebits(vk_format_to_pipe_format(format));
}
/**
@@ -166,97 +55,40 @@ vk_format_get_blocksizebits(VkFormat format)
static inline unsigned
vk_format_get_blocksize(VkFormat format)
{
unsigned bits = vk_format_get_blocksizebits(format);
unsigned bytes = bits / 8;
assert(bits % 8 == 0);
assert(bytes > 0);
if (bytes == 0) {
bytes = 1;
}
return bytes;
return util_format_get_blocksize(vk_format_to_pipe_format(format));
}
static inline unsigned
vk_format_get_blockwidth(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
assert(desc);
if (!desc) {
return 1;
}
return desc->block.width;
return util_format_get_blockwidth(vk_format_to_pipe_format(format));
}
static inline unsigned
vk_format_get_blockheight(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
assert(desc);
if (!desc) {
return 1;
}
return desc->block.height;
return util_format_get_blockheight(vk_format_to_pipe_format(format));
}
static inline unsigned
vk_format_get_block_count_width(VkFormat format, unsigned width)
{
unsigned blockwidth = vk_format_get_blockwidth(format);
return (width + blockwidth - 1) / blockwidth;
return util_format_get_nblocksx(vk_format_to_pipe_format(format), width);
}
static inline unsigned
vk_format_get_block_count_height(VkFormat format, unsigned height)
{
unsigned blockheight = vk_format_get_blockheight(format);
return (height + blockheight - 1) / blockheight;
return util_format_get_nblocksy(vk_format_to_pipe_format(format), height);
}
static inline unsigned
vk_format_get_block_count(VkFormat format, unsigned width, unsigned height)
{
return vk_format_get_block_count_width(format, width) *
vk_format_get_block_count_height(format, height);
return util_format_get_nblocks(vk_format_to_pipe_format(format),
width, height);
}
/**
* Return the index of the first non-void channel
* -1 if no non-void channels
*/
static inline int
vk_format_get_first_non_void_channel(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
int i;
for (i = 0; i < 4; i++)
if (desc->channel[i].type != VK_FORMAT_TYPE_VOID)
break;
if (i == 4)
return -1;
return i;
}
enum vk_swizzle
{
VK_SWIZZLE_X,
VK_SWIZZLE_Y,
VK_SWIZZLE_Z,
VK_SWIZZLE_W,
VK_SWIZZLE_0,
VK_SWIZZLE_1,
VK_SWIZZLE_NONE,
VK_SWIZZLE_MAX, /**< Number of enums counter (must be last) */
};
static inline VkImageAspectFlags
vk_format_aspects(VkFormat format)
{
@@ -282,7 +114,7 @@ vk_format_aspects(VkFormat format)
}
}
static inline enum vk_swizzle
static inline enum pipe_swizzle
tu_swizzle_conv(VkComponentSwizzle component,
const unsigned char chan[4],
VkComponentSwizzle vk_swiz)
@@ -293,29 +125,29 @@ tu_swizzle_conv(VkComponentSwizzle component,
vk_swiz = component;
switch (vk_swiz) {
case VK_COMPONENT_SWIZZLE_ZERO:
return VK_SWIZZLE_0;
return PIPE_SWIZZLE_0;
case VK_COMPONENT_SWIZZLE_ONE:
return VK_SWIZZLE_1;
return PIPE_SWIZZLE_1;
case VK_COMPONENT_SWIZZLE_R:
for (x = 0; x < 4; x++)
if (chan[x] == 0)
return x;
return VK_SWIZZLE_0;
return PIPE_SWIZZLE_0;
case VK_COMPONENT_SWIZZLE_G:
for (x = 0; x < 4; x++)
if (chan[x] == 1)
return x;
return VK_SWIZZLE_0;
return PIPE_SWIZZLE_0;
case VK_COMPONENT_SWIZZLE_B:
for (x = 0; x < 4; x++)
if (chan[x] == 2)
return x;
return VK_SWIZZLE_0;
return PIPE_SWIZZLE_0;
case VK_COMPONENT_SWIZZLE_A:
for (x = 0; x < 4; x++)
if (chan[x] == 3)
return x;
return VK_SWIZZLE_1;
return PIPE_SWIZZLE_1;
default:
unreachable("Illegal swizzle");
}
@@ -324,7 +156,7 @@ tu_swizzle_conv(VkComponentSwizzle component,
static inline void
vk_format_compose_swizzles(const VkComponentMapping *mapping,
const unsigned char swz[4],
enum vk_swizzle dst[4])
enum pipe_swizzle dst[4])
{
dst[0] = tu_swizzle_conv(VK_COMPONENT_SWIZZLE_R, swz, mapping->r);
dst[1] = tu_swizzle_conv(VK_COMPONENT_SWIZZLE_G, swz, mapping->g);
@@ -335,77 +167,29 @@ vk_format_compose_swizzles(const VkComponentMapping *mapping,
static inline bool
vk_format_is_compressed(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
assert(desc);
if (!desc) {
return false;
}
switch (desc->layout) {
case VK_FORMAT_LAYOUT_S3TC:
case VK_FORMAT_LAYOUT_RGTC:
case VK_FORMAT_LAYOUT_ETC:
case VK_FORMAT_LAYOUT_BPTC:
case VK_FORMAT_LAYOUT_ASTC:
/* XXX add other formats in the future */
return true;
default:
return false;
}
return util_format_is_compressed(vk_format_to_pipe_format(format));
}
static inline bool
vk_format_has_depth(const struct vk_format_description *desc)
vk_format_has_depth(VkFormat format)
{
return desc->colorspace == VK_FORMAT_COLORSPACE_ZS &&
desc->swizzle[0] != VK_SWIZZLE_NONE;
const struct util_format_description *desc = vk_format_description(format);
return util_format_has_depth(desc);
}
static inline bool
vk_format_has_stencil(const struct vk_format_description *desc)
vk_format_has_stencil(VkFormat format)
{
return desc->colorspace == VK_FORMAT_COLORSPACE_ZS &&
desc->swizzle[1] != VK_SWIZZLE_NONE;
const struct util_format_description *desc = vk_format_description(format);
return util_format_has_stencil(desc);
}
static inline bool
vk_format_is_depth_or_stencil(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
assert(desc);
if (!desc) {
return false;
}
return vk_format_has_depth(desc) || vk_format_has_stencil(desc);
}
static inline bool
vk_format_is_depth(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
assert(desc);
if (!desc) {
return false;
}
return vk_format_has_depth(desc);
}
static inline bool
vk_format_is_stencil(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
assert(desc);
if (!desc) {
return false;
}
return vk_format_has_stencil(desc);
return vk_format_has_depth(format) || vk_format_has_stencil(format);
}
static inline bool
@@ -417,11 +201,7 @@ vk_format_is_color(VkFormat format)
static inline bool
vk_format_has_alpha(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
return (desc->colorspace == VK_FORMAT_COLORSPACE_RGB ||
desc->colorspace == VK_FORMAT_COLORSPACE_SRGB) &&
desc->swizzle[3] != VK_SWIZZLE_1;
return util_format_has_alpha(vk_format_to_pipe_format(format));
}
static inline VkFormat
@@ -442,39 +222,25 @@ vk_format_depth_only(VkFormat format)
static inline bool
vk_format_is_int(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
int channel = vk_format_get_first_non_void_channel(format);
return channel >= 0 && desc->channel[channel].pure_integer;
return util_format_is_pure_integer(vk_format_to_pipe_format(format));
}
static inline bool
vk_format_is_uint(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
int channel = vk_format_get_first_non_void_channel(format);
return channel >= 0 &&
desc->channel[channel].pure_integer &&
desc->channel[channel].type != VK_FORMAT_TYPE_SIGNED;
return util_format_is_pure_uint(vk_format_to_pipe_format(format));
}
static inline bool
vk_format_is_sint(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
int channel = vk_format_get_first_non_void_channel(format);
return channel >= 0 &&
desc->channel[channel].pure_integer &&
desc->channel[channel].type == VK_FORMAT_TYPE_SIGNED;
return util_format_is_pure_sint(vk_format_to_pipe_format(format));
}
static inline bool
vk_format_is_srgb(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
return desc->colorspace == VK_FORMAT_COLORSPACE_SRGB;
return util_format_is_srgb(vk_format_to_pipe_format(format));
}
static inline VkFormat
@@ -525,75 +291,17 @@ vk_format_stencil_only(VkFormat format)
static inline unsigned
vk_format_get_component_bits(VkFormat format,
enum vk_format_colorspace colorspace,
enum util_format_colorspace colorspace,
unsigned component)
{
const struct vk_format_description *desc = vk_format_description(format);
enum vk_format_colorspace desc_colorspace;
assert(format);
if (!format) {
return 0;
}
assert(component < 4);
/* Treat RGB and SRGB as equivalent. */
if (colorspace == VK_FORMAT_COLORSPACE_SRGB) {
colorspace = VK_FORMAT_COLORSPACE_RGB;
}
if (desc->colorspace == VK_FORMAT_COLORSPACE_SRGB) {
desc_colorspace = VK_FORMAT_COLORSPACE_RGB;
} else {
desc_colorspace = desc->colorspace;
}
if (desc_colorspace != colorspace) {
return 0;
}
switch (desc->swizzle[component]) {
case VK_SWIZZLE_X:
return desc->channel[0].size;
case VK_SWIZZLE_Y:
return desc->channel[1].size;
case VK_SWIZZLE_Z:
return desc->channel[2].size;
case VK_SWIZZLE_W:
return desc->channel[3].size;
default:
return 0;
}
}
static inline VkFormat
vk_to_non_srgb_format(VkFormat format)
{
switch (format) {
case VK_FORMAT_R8_SRGB:
return VK_FORMAT_R8_UNORM;
case VK_FORMAT_R8G8_SRGB:
return VK_FORMAT_R8G8_UNORM;
case VK_FORMAT_R8G8B8_SRGB:
return VK_FORMAT_R8G8B8_UNORM;
case VK_FORMAT_B8G8R8_SRGB:
return VK_FORMAT_B8G8R8_UNORM;
case VK_FORMAT_R8G8B8A8_SRGB:
return VK_FORMAT_R8G8B8A8_UNORM;
case VK_FORMAT_B8G8R8A8_SRGB:
return VK_FORMAT_B8G8R8A8_UNORM;
case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
return VK_FORMAT_A8B8G8R8_UNORM_PACK32;
default:
return format;
}
return util_format_get_component_bits(vk_format_to_pipe_format(format),
colorspace, component);
}
static inline unsigned
vk_format_get_nr_components(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);
return desc->nr_channels;
return util_format_get_nr_components(vk_format_to_pipe_format(format));
}
#endif /* VK_FORMAT_H */
-188
View File
@@ -1,188 +0,0 @@
/* this is pretty much taken from the gallium one. */
VK_FORMAT_UNDEFINED , plain, 1, 1, u8 , , , , x001, rgb
VK_FORMAT_R4G4_UNORM_PACK8 , plain, 1, 1, un4 , un4 , , , xy01, rgb
VK_FORMAT_R4G4B4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb
VK_FORMAT_B4G4R4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wxyz, rgb
VK_FORMAT_R5G6B5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb
VK_FORMAT_B5G6R5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , xyz1, rgb
VK_FORMAT_R5G5B5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb
VK_FORMAT_B5G5R5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wxyz, rgb
VK_FORMAT_A1R5G5B5_UNORM_PACK16 , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
VK_FORMAT_R8_UNORM , plain, 1, 1, un8 , , , , x001, rgb
VK_FORMAT_R8_SNORM , plain, 1, 1, sn8 , , , , x001, rgb
VK_FORMAT_R8_USCALED , plain, 1, 1, us8 , , , , x001, rgb
VK_FORMAT_R8_SSCALED , plain, 1, 1, ss8 , , , , x001, rgb
VK_FORMAT_R8_UINT , plain, 1, 1, up8 , , , , x001, rgb
VK_FORMAT_R8_SINT , plain, 1, 1, sp8 , , , , x001, rgb
VK_FORMAT_R8_SRGB , plain, 1, 1, un8 , , , , x001, srgb
VK_FORMAT_R8G8_UNORM , plain, 1, 1, un8 , un8 , , , xy01, rgb
VK_FORMAT_R8G8_SNORM , plain, 1, 1, sn8 , sn8 , , , xy01, rgb
VK_FORMAT_R8G8_USCALED , plain, 1, 1, us8 , us8 , , , xy01, rgb
VK_FORMAT_R8G8_SSCALED , plain, 1, 1, ss8 , ss8 , , , xy01, rgb
VK_FORMAT_R8G8_UINT , plain, 1, 1, up8 , up8 , , , xy01, rgb
VK_FORMAT_R8G8_SINT , plain, 1, 1, sp8 , sp8 , , , xy01, rgb
VK_FORMAT_R8G8_SRGB , plain, 1, 1, un8 , un8 , , , xy01, srgb
VK_FORMAT_R8G8B8_UNORM , plain, 1, 1, un8 , un8 , un8 , , xyz1, rgb
VK_FORMAT_R8G8B8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , , xyz1, rgb
VK_FORMAT_R8G8B8_USCALED , plain, 1, 1, us8 , us8 , us8 , , xyz1, rgb
VK_FORMAT_R8G8B8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , , xyz1, rgb
VK_FORMAT_R8G8B8_UINT , plain, 1, 1, up8 , up8 , up8 , , xyz1, rgb
VK_FORMAT_R8G8B8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , , xyz1, rgb
VK_FORMAT_R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , , xyz1, srgb
VK_FORMAT_B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , , zyx1, rgb
VK_FORMAT_B8G8R8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , , zyx1, rgb
VK_FORMAT_B8G8R8_USCALED , plain, 1, 1, us8 , us8 , us8 , , zyx1, rgb
VK_FORMAT_B8G8R8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , , zyx1, rgb
VK_FORMAT_B8G8R8_UINT , plain, 1, 1, up8 , up8 , up8 , , zyx1, rgb
VK_FORMAT_B8G8R8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , , zyx1, rgb
VK_FORMAT_B8G8R8_SRGB , plain, 1, 1, un8 , un8 , un8 , , zyx1, srgb
VK_FORMAT_R8G8B8A8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
VK_FORMAT_R8G8B8A8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb
VK_FORMAT_R8G8B8A8_USCALED , plain, 1, 1, us8 , us8 , us8 , us8 , xyzw, rgb
VK_FORMAT_R8G8B8A8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , ss8 , xyzw, rgb
VK_FORMAT_R8G8B8A8_UINT , plain, 1, 1, up8 , up8 , up8 , up8 , xyzw, rgb
VK_FORMAT_R8G8B8A8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , sp8 , xyzw, rgb
VK_FORMAT_R8G8B8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb
VK_FORMAT_B8G8R8A8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb
VK_FORMAT_B8G8R8A8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , zyxw, rgb
VK_FORMAT_B8G8R8A8_USCALED , plain, 1, 1, us8 , us8 , us8 , us8 , zyxw, rgb
VK_FORMAT_B8G8R8A8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , ss8 , zyxw, rgb
VK_FORMAT_B8G8R8A8_UINT , plain, 1, 1, up8 , up8 , up8 , up8 , zyxw, rgb
VK_FORMAT_B8G8R8A8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , sp8 , zyxw, rgb
VK_FORMAT_B8G8R8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
VK_FORMAT_A8B8G8R8_UNORM_PACK32 , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
VK_FORMAT_A8B8G8R8_SNORM_PACK32 , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb
VK_FORMAT_A8B8G8R8_USCALED_PACK32 , plain, 1, 1, us8 , us8 , us8 , us8 , xyzw, rgb
VK_FORMAT_A8B8G8R8_SSCALED_PACK32 , plain, 1, 1, ss8 , ss8 , ss8 , ss8 , xyzw, rgb
VK_FORMAT_A8B8G8R8_UINT_PACK32 , plain, 1, 1, up8 , up8 , up8 , up8 , xyzw, rgb
VK_FORMAT_A8B8G8R8_SINT_PACK32 , plain, 1, 1, sp8 , sp8 , sp8 , sp8 , xyzw, rgb
VK_FORMAT_A8B8G8R8_SRGB_PACK32 , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb
VK_FORMAT_A2R10G10B10_UNORM_PACK32 , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb
VK_FORMAT_A2R10G10B10_SNORM_PACK32 , plain, 1, 1, sn10, sn10, sn10, sn2 , zyxw, rgb
VK_FORMAT_A2R10G10B10_USCALED_PACK32 , plain, 1, 1, us10, us10, us10, us2 , zyxw, rgb
VK_FORMAT_A2R10G10B10_SSCALED_PACK32 , plain, 1, 1, ss10, ss10, ss10, ss2 , zyxw, rgb
VK_FORMAT_A2R10G10B10_UINT_PACK32 , plain, 1, 1, up10, up10, up10, up2 , zyxw, rgb
VK_FORMAT_A2R10G10B10_SINT_PACK32 , plain, 1, 1, sp10, sp10, sp10, sp2 , zyxw, rgb
VK_FORMAT_A2B10G10R10_UNORM_PACK32 , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb
VK_FORMAT_A2B10G10R10_SNORM_PACK32 , plain, 1, 1, sn10, sn10, sn10, sn2 , xyzw, rgb
VK_FORMAT_A2B10G10R10_USCALED_PACK32 , plain, 1, 1, us10, us10, us10, us2 , xyzw, rgb
VK_FORMAT_A2B10G10R10_SSCALED_PACK32 , plain, 1, 1, ss10, ss10, ss10, ss2 , xyzw, rgb
VK_FORMAT_A2B10G10R10_UINT_PACK32 , plain, 1, 1, up10, up10, up10, up2 , xyzw, rgb
VK_FORMAT_A2B10G10R10_SINT_PACK32 , plain, 1, 1, sp10, sp10, sp10, sp2 , xyzw, rgb
VK_FORMAT_R16_UNORM , plain, 1, 1, un16, , , , x001, rgb
VK_FORMAT_R16_SNORM , plain, 1, 1, sn16, , , , x001, rgb
VK_FORMAT_R16_USCALED , plain, 1, 1, us16, , , , x001, rgb
VK_FORMAT_R16_SSCALED , plain, 1, 1, ss16, , , , x001, rgb
VK_FORMAT_R16_UINT , plain, 1, 1, up16, , , , x001, rgb
VK_FORMAT_R16_SINT , plain, 1, 1, sp16, , , , x001, rgb
VK_FORMAT_R16_SFLOAT , plain, 1, 1, f16 , , , , x001, rgb
VK_FORMAT_R16G16_UNORM , plain, 1, 1, un16, un16, , , xy01, rgb
VK_FORMAT_R16G16_SNORM , plain, 1, 1, sn16, sn16, , , xy01, rgb
VK_FORMAT_R16G16_USCALED , plain, 1, 1, us16, us16, , , xy01, rgb
VK_FORMAT_R16G16_SSCALED , plain, 1, 1, ss16, ss16, , , xy01, rgb
VK_FORMAT_R16G16_UINT , plain, 1, 1, up16, up16, , , xy01, rgb
VK_FORMAT_R16G16_SINT , plain, 1, 1, sp16, sp16, , , xy01, rgb
VK_FORMAT_R16G16_SFLOAT , plain, 1, 1, f16 , f16 , , , xy01, rgb
VK_FORMAT_R16G16B16_UNORM , plain, 1, 1, un16, un16, un16, , xyz1, rgb
VK_FORMAT_R16G16B16_SNORM , plain, 1, 1, sn16, sn16, sn16, , xyz1, rgb
VK_FORMAT_R16G16B16_USCALED , plain, 1, 1, us16, us16, us16, , xyz1, rgb
VK_FORMAT_R16G16B16_SSCALED , plain, 1, 1, ss16, ss16, ss16, , xyz1, rgb
VK_FORMAT_R16G16B16_UINT , plain, 1, 1, up16, up16, up16, , xyz1, rgb
VK_FORMAT_R16G16B16_SINT , plain, 1, 1, sp16, sp16, sp16, , xyz1, rgb
VK_FORMAT_R16G16B16_SFLOAT , plain, 1, 1, f16 , f16 , f16 , , xyz1, rgb
VK_FORMAT_R16G16B16A16_UNORM , plain, 1, 1, un16, un16, un16, un16, xyzw, rgb
VK_FORMAT_R16G16B16A16_SNORM , plain, 1, 1, sn16, sn16, sn16, sn16, xyzw, rgb
VK_FORMAT_R16G16B16A16_USCALED , plain, 1, 1, us16, us16, us16, us16, xyzw, rgb
VK_FORMAT_R16G16B16A16_SSCALED , plain, 1, 1, ss16, ss16, ss16, ss16, xyzw, rgb
VK_FORMAT_R16G16B16A16_UINT , plain, 1, 1, up16, up16, up16, up16, xyzw, rgb
VK_FORMAT_R16G16B16A16_SINT , plain, 1, 1, sp16, sp16, sp16, sp16, xyzw, rgb
VK_FORMAT_R16G16B16A16_SFLOAT , plain, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb
VK_FORMAT_R32_UINT , plain, 1, 1, up32, , , , x001, rgb
VK_FORMAT_R32_SINT , plain, 1, 1, sp32, , , , x001, rgb
VK_FORMAT_R32_SFLOAT , plain, 1, 1, f32 , , , , x001, rgb
VK_FORMAT_R32G32_UINT , plain, 1, 1, up32, up32, , , xy01, rgb
VK_FORMAT_R32G32_SINT , plain, 1, 1, sp32, sp32, , , xy01, rgb
VK_FORMAT_R32G32_SFLOAT , plain, 1, 1, f32 , f32 , , , xy01, rgb
VK_FORMAT_R32G32B32_UINT , plain, 1, 1, up32, up32, up32, , xyz1, rgb
VK_FORMAT_R32G32B32_SINT , plain, 1, 1, sp32, sp32, sp32, , xyz1, rgb
VK_FORMAT_R32G32B32_SFLOAT , plain, 1, 1, f32 , f32 , f32 , , xyz1, rgb
VK_FORMAT_R32G32B32A32_UINT , plain, 1, 1, up32, up32, up32, up32, xyzw, rgb
VK_FORMAT_R32G32B32A32_SINT , plain, 1, 1, sp32, sp32, sp32, sp32, xyzw, rgb
VK_FORMAT_R32G32B32A32_SFLOAT , plain, 1, 1, f32 , f32 , f32 , f32 , xyzw, rgb
VK_FORMAT_R64_UINT , plain, 1, 1, up64, , , , x001, rgb
VK_FORMAT_R64_SINT , plain, 1, 1, sp64, , , , x001, rgb
VK_FORMAT_R64_SFLOAT , plain, 1, 1, f64 , , , , x001, rgb
VK_FORMAT_R64G64_UINT , plain, 1, 1, up64, up64, , , xy01, rgb
VK_FORMAT_R64G64_SINT , plain, 1, 1, sp64, sp64, , , xy01, rgb
VK_FORMAT_R64G64_SFLOAT , plain, 1, 1, f64 , f64 , , , xy01, rgb
VK_FORMAT_R64G64B64_UINT , plain, 1, 1, up64, up64, up64, , xyz1, rgb
VK_FORMAT_R64G64B64_SINT , plain, 1, 1, sp64, sp64, sp64, , xyz1, rgb
VK_FORMAT_R64G64B64_SFLOAT , plain, 1, 1, f64 , f64 , f64 , , xyz1, rgb
VK_FORMAT_R64G64B64A64_UINT , plain, 1, 1, up64, up64, up64, up64, xyzw, rgb
VK_FORMAT_R64G64B64A64_SINT , plain, 1, 1, sp64, sp64, sp64, sp64, xyzw, rgb
VK_FORMAT_R64G64B64A64_SFLOAT , plain, 1, 1, f64 , f64 , f64 , f64 , xyzw, rgb
VK_FORMAT_B10G11R11_UFLOAT_PACK32 , plain, 1, 1, f10 , f11 , f11 , , xyz1, rgb
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 , other, 1, 1, x32 , , , , xyz1, rgb
VK_FORMAT_D16_UNORM , plain, 1, 1, un16, , , , x___, zs
VK_FORMAT_X8_D24_UNORM_PACK32 , plain, 1, 1, un24, x8 , , , x___, zs
VK_FORMAT_D32_SFLOAT , plain, 1, 1, f32 , , , , x___, zs
VK_FORMAT_S8_UINT , plain, 1, 1, up8 , , , , _x__, zs
VK_FORMAT_D16_UNORM_S8_UINT , plain, 1, 1, un16, up8 , , , xy__, zs
VK_FORMAT_D24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs
VK_FORMAT_D32_SFLOAT_S8_UINT , plain, 1, 1, f32 , up8 , , , xy__, zs
VK_FORMAT_BC1_RGB_UNORM_BLOCK , s3tc, 4, 4, x64 , , , , xyz1, rgb
VK_FORMAT_BC1_RGB_SRGB_BLOCK , s3tc, 4, 4, x64 , , , , xyz1, srgb
VK_FORMAT_BC1_RGBA_UNORM_BLOCK , s3tc, 4, 4, x64 , , , , xyzw, rgb
VK_FORMAT_BC1_RGBA_SRGB_BLOCK , s3tc, 4, 4, x64 , , , , xyzw, srgb
VK_FORMAT_BC2_UNORM_BLOCK , s3tc, 4, 4, x128, , , , xyzw, rgb
VK_FORMAT_BC2_SRGB_BLOCK , s3tc, 4, 4, x128, , , , xyzw, srgb
VK_FORMAT_BC3_UNORM_BLOCK , s3tc, 4, 4, x128, , , , xyzw, rgb
VK_FORMAT_BC3_SRGB_BLOCK , s3tc, 4, 4, x128, , , , xyzw, srgb
VK_FORMAT_BC4_UNORM_BLOCK , rgtc, 4, 4, x64, , , , x001, rgb
VK_FORMAT_BC4_SNORM_BLOCK , rgtc, 4, 4, x64, , , , x001, rgb
VK_FORMAT_BC5_UNORM_BLOCK , rgtc, 4, 4, x128, , , , xy01, rgb
VK_FORMAT_BC5_SNORM_BLOCK , rgtc, 4, 4, x128, , , , xy01, rgb
VK_FORMAT_BC6H_UFLOAT_BLOCK , bptc, 4, 4, x128, , , , xyz1, rgb
VK_FORMAT_BC6H_SFLOAT_BLOCK , bptc, 4, 4, x128, , , , xyz1, rgb
VK_FORMAT_BC7_UNORM_BLOCK , bptc, 4, 4, x128, , , , xyzw, rgb
VK_FORMAT_BC7_SRGB_BLOCK , bptc, 4, 4, x128, , , , xyzw, srgb
VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK , etc, 4, 4, x64, , , , xyz1, rgb
VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK , etc, 4, 4, x64, , , , xyz1, srgb
VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK , etc, 4, 4, x64, , , , xyzw, rgb
VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK , etc, 4, 4, x64, , , , xyzw, srgb
VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK , etc, 4, 4, x128, , , , xyzw, rgb
VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK , etc, 4, 4, x128, , , , xyzw, srgb
VK_FORMAT_EAC_R11_UNORM_BLOCK , etc, 4, 4, x64, , , , x001, rgb
VK_FORMAT_EAC_R11_SNORM_BLOCK , etc, 4, 4, x64, , , , x001, rgb
VK_FORMAT_EAC_R11G11_UNORM_BLOCK , etc, 4, 4, x128, , , , xy01, rgb
VK_FORMAT_EAC_R11G11_SNORM_BLOCK , etc, 4, 4, x128, , , , xy01, rgb
VK_FORMAT_ASTC_4x4_UNORM_BLOCK , astc, 4, 4, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_5x4_UNORM_BLOCK , astc, 5, 4, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_5x5_UNORM_BLOCK , astc, 5, 5, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_6x5_UNORM_BLOCK , astc, 6, 5, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_6x6_UNORM_BLOCK , astc, 6, 6, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_8x5_UNORM_BLOCK , astc, 8, 5, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_8x6_UNORM_BLOCK , astc, 8, 6, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_8x8_UNORM_BLOCK , astc, 8, 8, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_10x5_UNORM_BLOCK , astc, 10, 5, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_10x6_UNORM_BLOCK , astc, 10, 6, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_10x8_UNORM_BLOCK , astc, 10, 8, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_10x10_UNORM_BLOCK , astc, 10,10, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_12x10_UNORM_BLOCK , astc, 12,10, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_12x12_UNORM_BLOCK , astc, 12,12, x128, , , , xyzw, rgb
VK_FORMAT_ASTC_4x4_SRGB_BLOCK , astc, 4, 4, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_5x4_SRGB_BLOCK , astc, 5, 4, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_5x5_SRGB_BLOCK , astc, 5, 5, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_6x5_SRGB_BLOCK , astc, 6, 5, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_6x6_SRGB_BLOCK , astc, 6, 6, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_8x5_SRGB_BLOCK , astc, 8, 5, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_8x6_SRGB_BLOCK , astc, 8, 6, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_8x8_SRGB_BLOCK , astc, 8, 8, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_10x5_SRGB_BLOCK , astc, 10, 5, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_10x6_SRGB_BLOCK , astc, 10, 6, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_10x8_SRGB_BLOCK , astc, 10, 8, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_10x10_SRGB_BLOCK , astc, 10,10, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_12x10_SRGB_BLOCK , astc, 12,10, x128, , , , xyzw, srgb
VK_FORMAT_ASTC_12x12_SRGB_BLOCK , astc, 12,12, x128, , , , xyzw, srgb
1 /* this is pretty much taken from the gallium one. */
2 VK_FORMAT_UNDEFINED , plain, 1, 1, u8 , , , , x001, rgb
3 VK_FORMAT_R4G4_UNORM_PACK8 , plain, 1, 1, un4 , un4 , , , xy01, rgb
4 VK_FORMAT_R4G4B4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb
5 VK_FORMAT_B4G4R4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wxyz, rgb
6 VK_FORMAT_R5G6B5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb
7 VK_FORMAT_B5G6R5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , xyz1, rgb
8 VK_FORMAT_R5G5B5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb
9 VK_FORMAT_B5G5R5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wxyz, rgb
10 VK_FORMAT_A1R5G5B5_UNORM_PACK16 , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
11 VK_FORMAT_R8_UNORM , plain, 1, 1, un8 , , , , x001, rgb
12 VK_FORMAT_R8_SNORM , plain, 1, 1, sn8 , , , , x001, rgb
13 VK_FORMAT_R8_USCALED , plain, 1, 1, us8 , , , , x001, rgb
14 VK_FORMAT_R8_SSCALED , plain, 1, 1, ss8 , , , , x001, rgb
15 VK_FORMAT_R8_UINT , plain, 1, 1, up8 , , , , x001, rgb
16 VK_FORMAT_R8_SINT , plain, 1, 1, sp8 , , , , x001, rgb
17 VK_FORMAT_R8_SRGB , plain, 1, 1, un8 , , , , x001, srgb
18 VK_FORMAT_R8G8_UNORM , plain, 1, 1, un8 , un8 , , , xy01, rgb
19 VK_FORMAT_R8G8_SNORM , plain, 1, 1, sn8 , sn8 , , , xy01, rgb
20 VK_FORMAT_R8G8_USCALED , plain, 1, 1, us8 , us8 , , , xy01, rgb
21 VK_FORMAT_R8G8_SSCALED , plain, 1, 1, ss8 , ss8 , , , xy01, rgb
22 VK_FORMAT_R8G8_UINT , plain, 1, 1, up8 , up8 , , , xy01, rgb
23 VK_FORMAT_R8G8_SINT , plain, 1, 1, sp8 , sp8 , , , xy01, rgb
24 VK_FORMAT_R8G8_SRGB , plain, 1, 1, un8 , un8 , , , xy01, srgb
25 VK_FORMAT_R8G8B8_UNORM , plain, 1, 1, un8 , un8 , un8 , , xyz1, rgb
26 VK_FORMAT_R8G8B8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , , xyz1, rgb
27 VK_FORMAT_R8G8B8_USCALED , plain, 1, 1, us8 , us8 , us8 , , xyz1, rgb
28 VK_FORMAT_R8G8B8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , , xyz1, rgb
29 VK_FORMAT_R8G8B8_UINT , plain, 1, 1, up8 , up8 , up8 , , xyz1, rgb
30 VK_FORMAT_R8G8B8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , , xyz1, rgb
31 VK_FORMAT_R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , , xyz1, srgb
32 VK_FORMAT_B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , , zyx1, rgb
33 VK_FORMAT_B8G8R8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , , zyx1, rgb
34 VK_FORMAT_B8G8R8_USCALED , plain, 1, 1, us8 , us8 , us8 , , zyx1, rgb
35 VK_FORMAT_B8G8R8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , , zyx1, rgb
36 VK_FORMAT_B8G8R8_UINT , plain, 1, 1, up8 , up8 , up8 , , zyx1, rgb
37 VK_FORMAT_B8G8R8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , , zyx1, rgb
38 VK_FORMAT_B8G8R8_SRGB , plain, 1, 1, un8 , un8 , un8 , , zyx1, srgb
39 VK_FORMAT_R8G8B8A8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
40 VK_FORMAT_R8G8B8A8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb
41 VK_FORMAT_R8G8B8A8_USCALED , plain, 1, 1, us8 , us8 , us8 , us8 , xyzw, rgb
42 VK_FORMAT_R8G8B8A8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , ss8 , xyzw, rgb
43 VK_FORMAT_R8G8B8A8_UINT , plain, 1, 1, up8 , up8 , up8 , up8 , xyzw, rgb
44 VK_FORMAT_R8G8B8A8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , sp8 , xyzw, rgb
45 VK_FORMAT_R8G8B8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb
46 VK_FORMAT_B8G8R8A8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb
47 VK_FORMAT_B8G8R8A8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , zyxw, rgb
48 VK_FORMAT_B8G8R8A8_USCALED , plain, 1, 1, us8 , us8 , us8 , us8 , zyxw, rgb
49 VK_FORMAT_B8G8R8A8_SSCALED , plain, 1, 1, ss8 , ss8 , ss8 , ss8 , zyxw, rgb
50 VK_FORMAT_B8G8R8A8_UINT , plain, 1, 1, up8 , up8 , up8 , up8 , zyxw, rgb
51 VK_FORMAT_B8G8R8A8_SINT , plain, 1, 1, sp8 , sp8 , sp8 , sp8 , zyxw, rgb
52 VK_FORMAT_B8G8R8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
53 VK_FORMAT_A8B8G8R8_UNORM_PACK32 , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
54 VK_FORMAT_A8B8G8R8_SNORM_PACK32 , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb
55 VK_FORMAT_A8B8G8R8_USCALED_PACK32 , plain, 1, 1, us8 , us8 , us8 , us8 , xyzw, rgb
56 VK_FORMAT_A8B8G8R8_SSCALED_PACK32 , plain, 1, 1, ss8 , ss8 , ss8 , ss8 , xyzw, rgb
57 VK_FORMAT_A8B8G8R8_UINT_PACK32 , plain, 1, 1, up8 , up8 , up8 , up8 , xyzw, rgb
58 VK_FORMAT_A8B8G8R8_SINT_PACK32 , plain, 1, 1, sp8 , sp8 , sp8 , sp8 , xyzw, rgb
59 VK_FORMAT_A8B8G8R8_SRGB_PACK32 , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb
60 VK_FORMAT_A2R10G10B10_UNORM_PACK32 , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb
61 VK_FORMAT_A2R10G10B10_SNORM_PACK32 , plain, 1, 1, sn10, sn10, sn10, sn2 , zyxw, rgb
62 VK_FORMAT_A2R10G10B10_USCALED_PACK32 , plain, 1, 1, us10, us10, us10, us2 , zyxw, rgb
63 VK_FORMAT_A2R10G10B10_SSCALED_PACK32 , plain, 1, 1, ss10, ss10, ss10, ss2 , zyxw, rgb
64 VK_FORMAT_A2R10G10B10_UINT_PACK32 , plain, 1, 1, up10, up10, up10, up2 , zyxw, rgb
65 VK_FORMAT_A2R10G10B10_SINT_PACK32 , plain, 1, 1, sp10, sp10, sp10, sp2 , zyxw, rgb
66 VK_FORMAT_A2B10G10R10_UNORM_PACK32 , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb
67 VK_FORMAT_A2B10G10R10_SNORM_PACK32 , plain, 1, 1, sn10, sn10, sn10, sn2 , xyzw, rgb
68 VK_FORMAT_A2B10G10R10_USCALED_PACK32 , plain, 1, 1, us10, us10, us10, us2 , xyzw, rgb
69 VK_FORMAT_A2B10G10R10_SSCALED_PACK32 , plain, 1, 1, ss10, ss10, ss10, ss2 , xyzw, rgb
70 VK_FORMAT_A2B10G10R10_UINT_PACK32 , plain, 1, 1, up10, up10, up10, up2 , xyzw, rgb
71 VK_FORMAT_A2B10G10R10_SINT_PACK32 , plain, 1, 1, sp10, sp10, sp10, sp2 , xyzw, rgb
72 VK_FORMAT_R16_UNORM , plain, 1, 1, un16, , , , x001, rgb
73 VK_FORMAT_R16_SNORM , plain, 1, 1, sn16, , , , x001, rgb
74 VK_FORMAT_R16_USCALED , plain, 1, 1, us16, , , , x001, rgb
75 VK_FORMAT_R16_SSCALED , plain, 1, 1, ss16, , , , x001, rgb
76 VK_FORMAT_R16_UINT , plain, 1, 1, up16, , , , x001, rgb
77 VK_FORMAT_R16_SINT , plain, 1, 1, sp16, , , , x001, rgb
78 VK_FORMAT_R16_SFLOAT , plain, 1, 1, f16 , , , , x001, rgb
79 VK_FORMAT_R16G16_UNORM , plain, 1, 1, un16, un16, , , xy01, rgb
80 VK_FORMAT_R16G16_SNORM , plain, 1, 1, sn16, sn16, , , xy01, rgb
81 VK_FORMAT_R16G16_USCALED , plain, 1, 1, us16, us16, , , xy01, rgb
82 VK_FORMAT_R16G16_SSCALED , plain, 1, 1, ss16, ss16, , , xy01, rgb
83 VK_FORMAT_R16G16_UINT , plain, 1, 1, up16, up16, , , xy01, rgb
84 VK_FORMAT_R16G16_SINT , plain, 1, 1, sp16, sp16, , , xy01, rgb
85 VK_FORMAT_R16G16_SFLOAT , plain, 1, 1, f16 , f16 , , , xy01, rgb
86 VK_FORMAT_R16G16B16_UNORM , plain, 1, 1, un16, un16, un16, , xyz1, rgb
87 VK_FORMAT_R16G16B16_SNORM , plain, 1, 1, sn16, sn16, sn16, , xyz1, rgb
88 VK_FORMAT_R16G16B16_USCALED , plain, 1, 1, us16, us16, us16, , xyz1, rgb
89 VK_FORMAT_R16G16B16_SSCALED , plain, 1, 1, ss16, ss16, ss16, , xyz1, rgb
90 VK_FORMAT_R16G16B16_UINT , plain, 1, 1, up16, up16, up16, , xyz1, rgb
91 VK_FORMAT_R16G16B16_SINT , plain, 1, 1, sp16, sp16, sp16, , xyz1, rgb
92 VK_FORMAT_R16G16B16_SFLOAT , plain, 1, 1, f16 , f16 , f16 , , xyz1, rgb
93 VK_FORMAT_R16G16B16A16_UNORM , plain, 1, 1, un16, un16, un16, un16, xyzw, rgb
94 VK_FORMAT_R16G16B16A16_SNORM , plain, 1, 1, sn16, sn16, sn16, sn16, xyzw, rgb
95 VK_FORMAT_R16G16B16A16_USCALED , plain, 1, 1, us16, us16, us16, us16, xyzw, rgb
96 VK_FORMAT_R16G16B16A16_SSCALED , plain, 1, 1, ss16, ss16, ss16, ss16, xyzw, rgb
97 VK_FORMAT_R16G16B16A16_UINT , plain, 1, 1, up16, up16, up16, up16, xyzw, rgb
98 VK_FORMAT_R16G16B16A16_SINT , plain, 1, 1, sp16, sp16, sp16, sp16, xyzw, rgb
99 VK_FORMAT_R16G16B16A16_SFLOAT , plain, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb
100 VK_FORMAT_R32_UINT , plain, 1, 1, up32, , , , x001, rgb
101 VK_FORMAT_R32_SINT , plain, 1, 1, sp32, , , , x001, rgb
102 VK_FORMAT_R32_SFLOAT , plain, 1, 1, f32 , , , , x001, rgb
103 VK_FORMAT_R32G32_UINT , plain, 1, 1, up32, up32, , , xy01, rgb
104 VK_FORMAT_R32G32_SINT , plain, 1, 1, sp32, sp32, , , xy01, rgb
105 VK_FORMAT_R32G32_SFLOAT , plain, 1, 1, f32 , f32 , , , xy01, rgb
106 VK_FORMAT_R32G32B32_UINT , plain, 1, 1, up32, up32, up32, , xyz1, rgb
107 VK_FORMAT_R32G32B32_SINT , plain, 1, 1, sp32, sp32, sp32, , xyz1, rgb
108 VK_FORMAT_R32G32B32_SFLOAT , plain, 1, 1, f32 , f32 , f32 , , xyz1, rgb
109 VK_FORMAT_R32G32B32A32_UINT , plain, 1, 1, up32, up32, up32, up32, xyzw, rgb
110 VK_FORMAT_R32G32B32A32_SINT , plain, 1, 1, sp32, sp32, sp32, sp32, xyzw, rgb
111 VK_FORMAT_R32G32B32A32_SFLOAT , plain, 1, 1, f32 , f32 , f32 , f32 , xyzw, rgb
112 VK_FORMAT_R64_UINT , plain, 1, 1, up64, , , , x001, rgb
113 VK_FORMAT_R64_SINT , plain, 1, 1, sp64, , , , x001, rgb
114 VK_FORMAT_R64_SFLOAT , plain, 1, 1, f64 , , , , x001, rgb
115 VK_FORMAT_R64G64_UINT , plain, 1, 1, up64, up64, , , xy01, rgb
116 VK_FORMAT_R64G64_SINT , plain, 1, 1, sp64, sp64, , , xy01, rgb
117 VK_FORMAT_R64G64_SFLOAT , plain, 1, 1, f64 , f64 , , , xy01, rgb
118 VK_FORMAT_R64G64B64_UINT , plain, 1, 1, up64, up64, up64, , xyz1, rgb
119 VK_FORMAT_R64G64B64_SINT , plain, 1, 1, sp64, sp64, sp64, , xyz1, rgb
120 VK_FORMAT_R64G64B64_SFLOAT , plain, 1, 1, f64 , f64 , f64 , , xyz1, rgb
121 VK_FORMAT_R64G64B64A64_UINT , plain, 1, 1, up64, up64, up64, up64, xyzw, rgb
122 VK_FORMAT_R64G64B64A64_SINT , plain, 1, 1, sp64, sp64, sp64, sp64, xyzw, rgb
123 VK_FORMAT_R64G64B64A64_SFLOAT , plain, 1, 1, f64 , f64 , f64 , f64 , xyzw, rgb
124 VK_FORMAT_B10G11R11_UFLOAT_PACK32 , plain, 1, 1, f10 , f11 , f11 , , xyz1, rgb
125 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 , other, 1, 1, x32 , , , , xyz1, rgb
126 VK_FORMAT_D16_UNORM , plain, 1, 1, un16, , , , x___, zs
127 VK_FORMAT_X8_D24_UNORM_PACK32 , plain, 1, 1, un24, x8 , , , x___, zs
128 VK_FORMAT_D32_SFLOAT , plain, 1, 1, f32 , , , , x___, zs
129 VK_FORMAT_S8_UINT , plain, 1, 1, up8 , , , , _x__, zs
130 VK_FORMAT_D16_UNORM_S8_UINT , plain, 1, 1, un16, up8 , , , xy__, zs
131 VK_FORMAT_D24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs
132 VK_FORMAT_D32_SFLOAT_S8_UINT , plain, 1, 1, f32 , up8 , , , xy__, zs
133 VK_FORMAT_BC1_RGB_UNORM_BLOCK , s3tc, 4, 4, x64 , , , , xyz1, rgb
134 VK_FORMAT_BC1_RGB_SRGB_BLOCK , s3tc, 4, 4, x64 , , , , xyz1, srgb
135 VK_FORMAT_BC1_RGBA_UNORM_BLOCK , s3tc, 4, 4, x64 , , , , xyzw, rgb
136 VK_FORMAT_BC1_RGBA_SRGB_BLOCK , s3tc, 4, 4, x64 , , , , xyzw, srgb
137 VK_FORMAT_BC2_UNORM_BLOCK , s3tc, 4, 4, x128, , , , xyzw, rgb
138 VK_FORMAT_BC2_SRGB_BLOCK , s3tc, 4, 4, x128, , , , xyzw, srgb
139 VK_FORMAT_BC3_UNORM_BLOCK , s3tc, 4, 4, x128, , , , xyzw, rgb
140 VK_FORMAT_BC3_SRGB_BLOCK , s3tc, 4, 4, x128, , , , xyzw, srgb
141 VK_FORMAT_BC4_UNORM_BLOCK , rgtc, 4, 4, x64, , , , x001, rgb
142 VK_FORMAT_BC4_SNORM_BLOCK , rgtc, 4, 4, x64, , , , x001, rgb
143 VK_FORMAT_BC5_UNORM_BLOCK , rgtc, 4, 4, x128, , , , xy01, rgb
144 VK_FORMAT_BC5_SNORM_BLOCK , rgtc, 4, 4, x128, , , , xy01, rgb
145 VK_FORMAT_BC6H_UFLOAT_BLOCK , bptc, 4, 4, x128, , , , xyz1, rgb
146 VK_FORMAT_BC6H_SFLOAT_BLOCK , bptc, 4, 4, x128, , , , xyz1, rgb
147 VK_FORMAT_BC7_UNORM_BLOCK , bptc, 4, 4, x128, , , , xyzw, rgb
148 VK_FORMAT_BC7_SRGB_BLOCK , bptc, 4, 4, x128, , , , xyzw, srgb
149 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK , etc, 4, 4, x64, , , , xyz1, rgb
150 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK , etc, 4, 4, x64, , , , xyz1, srgb
151 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK , etc, 4, 4, x64, , , , xyzw, rgb
152 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK , etc, 4, 4, x64, , , , xyzw, srgb
153 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK , etc, 4, 4, x128, , , , xyzw, rgb
154 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK , etc, 4, 4, x128, , , , xyzw, srgb
155 VK_FORMAT_EAC_R11_UNORM_BLOCK , etc, 4, 4, x64, , , , x001, rgb
156 VK_FORMAT_EAC_R11_SNORM_BLOCK , etc, 4, 4, x64, , , , x001, rgb
157 VK_FORMAT_EAC_R11G11_UNORM_BLOCK , etc, 4, 4, x128, , , , xy01, rgb
158 VK_FORMAT_EAC_R11G11_SNORM_BLOCK , etc, 4, 4, x128, , , , xy01, rgb
159 VK_FORMAT_ASTC_4x4_UNORM_BLOCK , astc, 4, 4, x128, , , , xyzw, rgb
160 VK_FORMAT_ASTC_5x4_UNORM_BLOCK , astc, 5, 4, x128, , , , xyzw, rgb
161 VK_FORMAT_ASTC_5x5_UNORM_BLOCK , astc, 5, 5, x128, , , , xyzw, rgb
162 VK_FORMAT_ASTC_6x5_UNORM_BLOCK , astc, 6, 5, x128, , , , xyzw, rgb
163 VK_FORMAT_ASTC_6x6_UNORM_BLOCK , astc, 6, 6, x128, , , , xyzw, rgb
164 VK_FORMAT_ASTC_8x5_UNORM_BLOCK , astc, 8, 5, x128, , , , xyzw, rgb
165 VK_FORMAT_ASTC_8x6_UNORM_BLOCK , astc, 8, 6, x128, , , , xyzw, rgb
166 VK_FORMAT_ASTC_8x8_UNORM_BLOCK , astc, 8, 8, x128, , , , xyzw, rgb
167 VK_FORMAT_ASTC_10x5_UNORM_BLOCK , astc, 10, 5, x128, , , , xyzw, rgb
168 VK_FORMAT_ASTC_10x6_UNORM_BLOCK , astc, 10, 6, x128, , , , xyzw, rgb
169 VK_FORMAT_ASTC_10x8_UNORM_BLOCK , astc, 10, 8, x128, , , , xyzw, rgb
170 VK_FORMAT_ASTC_10x10_UNORM_BLOCK , astc, 10,10, x128, , , , xyzw, rgb
171 VK_FORMAT_ASTC_12x10_UNORM_BLOCK , astc, 12,10, x128, , , , xyzw, rgb
172 VK_FORMAT_ASTC_12x12_UNORM_BLOCK , astc, 12,12, x128, , , , xyzw, rgb
173 VK_FORMAT_ASTC_4x4_SRGB_BLOCK , astc, 4, 4, x128, , , , xyzw, srgb
174 VK_FORMAT_ASTC_5x4_SRGB_BLOCK , astc, 5, 4, x128, , , , xyzw, srgb
175 VK_FORMAT_ASTC_5x5_SRGB_BLOCK , astc, 5, 5, x128, , , , xyzw, srgb
176 VK_FORMAT_ASTC_6x5_SRGB_BLOCK , astc, 6, 5, x128, , , , xyzw, srgb
177 VK_FORMAT_ASTC_6x6_SRGB_BLOCK , astc, 6, 6, x128, , , , xyzw, srgb
178 VK_FORMAT_ASTC_8x5_SRGB_BLOCK , astc, 8, 5, x128, , , , xyzw, srgb
179 VK_FORMAT_ASTC_8x6_SRGB_BLOCK , astc, 8, 6, x128, , , , xyzw, srgb
180 VK_FORMAT_ASTC_8x8_SRGB_BLOCK , astc, 8, 8, x128, , , , xyzw, srgb
181 VK_FORMAT_ASTC_10x5_SRGB_BLOCK , astc, 10, 5, x128, , , , xyzw, srgb
182 VK_FORMAT_ASTC_10x6_SRGB_BLOCK , astc, 10, 6, x128, , , , xyzw, srgb
183 VK_FORMAT_ASTC_10x8_SRGB_BLOCK , astc, 10, 8, x128, , , , xyzw, srgb
184 VK_FORMAT_ASTC_10x10_SRGB_BLOCK , astc, 10,10, x128, , , , xyzw, srgb
185 VK_FORMAT_ASTC_12x10_SRGB_BLOCK , astc, 12,10, x128, , , , xyzw, srgb
186 VK_FORMAT_ASTC_12x12_SRGB_BLOCK , astc, 12,12, x128, , , , xyzw, srgb
-173
View File
@@ -1,173 +0,0 @@
from __future__ import print_function
CopyRight = '''
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
'''
import sys
from vk_format_parse import *
def layout_map(layout):
return 'VK_FORMAT_LAYOUT_' + str(layout).upper()
def colorspace_map(colorspace):
return 'VK_FORMAT_COLORSPACE_' + str(colorspace).upper()
colorspace_channels_map = {
'rgb': ['r', 'g', 'b', 'a'],
'srgb': ['sr', 'sg', 'sb', 'a'],
'zs': ['z', 's'],
'yuv': ['y', 'u', 'v'],
}
type_map = {
VOID: "VK_FORMAT_TYPE_VOID",
UNSIGNED: "VK_FORMAT_TYPE_UNSIGNED",
SIGNED: "VK_FORMAT_TYPE_SIGNED",
FIXED: "VK_FORMAT_TYPE_FIXED",
FLOAT: "VK_FORMAT_TYPE_FLOAT",
}
def bool_map(value):
if value:
return "true"
else:
return "false"
swizzle_map = {
SWIZZLE_X: "VK_SWIZZLE_X",
SWIZZLE_Y: "VK_SWIZZLE_Y",
SWIZZLE_Z: "VK_SWIZZLE_Z",
SWIZZLE_W: "VK_SWIZZLE_W",
SWIZZLE_0: "VK_SWIZZLE_0",
SWIZZLE_1: "VK_SWIZZLE_1",
SWIZZLE_NONE: "VK_SWIZZLE_NONE",
}
def print_channels(format, func):
if format.nr_channels() <= 1:
func(format.le_channels, format.le_swizzles)
else:
print('#if UTIL_ARCH_BIG_ENDIAN')
func(format.be_channels, format.be_swizzles)
print('#else')
func(format.le_channels, format.le_swizzles)
print('#endif')
def write_format_table(formats):
print('/* This file is autogenerated by vk_format_table.py from vk_format_layout.csv. Do not edit directly. */')
print()
# This will print the copyright message on the top of this file
print(CopyRight.strip())
print()
print('#include "stdbool.h"')
print('#include "vk_format.h"')
print()
def do_channel_array(channels, swizzles):
print(" {")
for i in range(4):
channel = channels[i]
if i < 3:
sep = ","
else:
sep = ""
if channel.size:
print(" {%s, %s, %s, %s, %u, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), bool_map(channel.scaled), channel.size, channel.shift, sep, "xyzw"[i], channel.name))
else:
print(" {0, 0, 0, 0, 0}%s" % (sep,))
print(" },")
def do_swizzle_array(channels, swizzles):
print(" {")
for i in range(4):
swizzle = swizzles[i]
if i < 3:
sep = ","
else:
sep = ""
try:
comment = colorspace_channels_map[format.colorspace][i]
except (KeyError, IndexError):
comment = 'ignored'
print(" %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment))
print(" },")
for format in formats:
print('static const struct vk_format_description')
print('vk_format_%s_description = {' % (format.short_name(),))
print(" %s," % (format.name,))
print(" \"%s\"," % (format.name,))
print(" \"%s\"," % (format.short_name(),))
print(" {%u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_size()))
print(" %s," % (layout_map(format.layout),))
print(" %u,\t/* nr_channels */" % (format.nr_channels(),))
print(" %s,\t/* is_array */" % (bool_map(format.is_array()),))
print(" %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),))
print(" %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),))
print_channels(format, do_channel_array)
print_channels(format, do_swizzle_array)
print(" %s," % (colorspace_map(format.colorspace),))
print("};")
print()
print("const struct vk_format_description *")
print("vk_format_description(VkFormat format)")
print("{")
print(" if (format > VK_FORMAT_END_RANGE) {")
print(" return NULL;")
print(" }")
print()
print(" switch (format) {")
for format in formats:
print(" case %s:" % format.name)
print(" return &vk_format_%s_description;" % (format.short_name(),))
print(" default:")
print(" return NULL;")
print(" }")
print("}")
print()
def main():
formats = []
for arg in sys.argv[1:]:
formats.extend(parse(arg))
write_format_table(formats)
if __name__ == '__main__':
main()