Path: blob/21.2-virgl/src/gallium/drivers/r600/r600_formats.h
4570 views
#ifndef R600_FORMATS_H1#define R600_FORMATS_H23#include "util/format/u_format.h"4#include "r600_pipe.h"56/* list of formats from R700 ISA document - apply across GPUs in different registers */7#define FMT_INVALID 0x000000008#define FMT_8 0x000000019#define FMT_4_4 0x0000000210#define FMT_3_3_2 0x0000000311#define FMT_16 0x0000000512#define FMT_16_FLOAT 0x0000000613#define FMT_8_8 0x0000000714#define FMT_5_6_5 0x0000000815#define FMT_6_5_5 0x0000000916#define FMT_1_5_5_5 0x0000000A17#define FMT_4_4_4_4 0x0000000B18#define FMT_5_5_5_1 0x0000000C19#define FMT_32 0x0000000D20#define FMT_32_FLOAT 0x0000000E21#define FMT_16_16 0x0000000F22#define FMT_16_16_FLOAT 0x0000001023#define FMT_8_24 0x0000001124#define FMT_8_24_FLOAT 0x0000001225#define FMT_24_8 0x0000001326#define FMT_24_8_FLOAT 0x0000001427#define FMT_10_11_11 0x0000001528#define FMT_10_11_11_FLOAT 0x0000001629#define FMT_11_11_10 0x0000001730#define FMT_11_11_10_FLOAT 0x0000001831#define FMT_2_10_10_10 0x0000001932#define FMT_8_8_8_8 0x0000001A33#define FMT_10_10_10_2 0x0000001B34#define FMT_X24_8_32_FLOAT 0x0000001C35#define FMT_32_32 0x0000001D36#define FMT_32_32_FLOAT 0x0000001E37#define FMT_16_16_16_16 0x0000001F38#define FMT_16_16_16_16_FLOAT 0x0000002039#define FMT_32_32_32_32 0x0000002240#define FMT_32_32_32_32_FLOAT 0x0000002341#define FMT_1 0x0000002542#define FMT_GB_GR 0x0000002743#define FMT_BG_RG 0x0000002844#define FMT_32_AS_8 0x0000002945#define FMT_32_AS_8_8 0x0000002a46#define FMT_5_9_9_9_SHAREDEXP 0x0000002b47#define FMT_8_8_8 0x0000002c48#define FMT_16_16_16 0x0000002d49#define FMT_16_16_16_FLOAT 0x0000002e50#define FMT_32_32_32 0x0000002f51#define FMT_32_32_32_FLOAT 0x0000003052#define FMT_BC1 0x0000003153#define FMT_BC2 0x0000003254#define FMT_BC3 0x0000003355#define FMT_BC4 0x0000003456#define FMT_BC5 0x0000003557#define FMT_BC6 0x0000003658#define FMT_BC7 0x0000003759#define FMT_32_AS_32_32_32_32 0x000000386061#define ENDIAN_NONE 062#define ENDIAN_8IN16 163#define ENDIAN_8IN32 264#define ENDIAN_8IN64 36566static inline unsigned r600_endian_swap(unsigned size)67{68if (R600_BIG_ENDIAN) {69switch (size) {70case 64:71return ENDIAN_8IN64;72case 32:73return ENDIAN_8IN32;74case 16:75return ENDIAN_8IN16;76default:77return ENDIAN_NONE;78}79} else {80return ENDIAN_NONE;81}82}8384static inline bool r600_is_vertex_format_supported(enum pipe_format format)85{86const struct util_format_description *desc = util_format_description(format);87unsigned i;8889if (format == PIPE_FORMAT_R11G11B10_FLOAT)90return true;9192if (!desc)93return false;9495/* Find the first non-VOID channel. */96for (i = 0; i < 4; i++) {97if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID)98break;99}100if (i == 4)101return false;102103/* No fixed, no double. */104if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||105(desc->channel[i].size == 64 &&106desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT) ||107desc->channel[i].type == UTIL_FORMAT_TYPE_FIXED)108return false;109110/* No scaled/norm formats with 32 bits per channel. */111if (desc->channel[i].size == 32 &&112!desc->channel[i].pure_integer &&113(desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED ||114desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED))115return false;116117/* No 8 bit 3 channel formats */118if (desc->channel[i].size == 8 && desc->nr_channels == 3)119return false;120121return true;122}123124static inline bool r600_is_index_format_supported(enum pipe_format format)125{126switch (format) {127case PIPE_FORMAT_R8_UINT:128case PIPE_FORMAT_R16_UINT:129case PIPE_FORMAT_R32_UINT:130return true;131132default:133return false;134}135}136137#endif138139140