#ifndef _DFD_H_
#define _DFD_H_
#include <KHR/khr_df.h>
#ifdef __cplusplus
extern "C" {
#endif
enum VkSuffix {
s_UNORM,
s_SNORM,
s_USCALED,
s_SSCALED,
s_UINT,
s_SINT,
s_SFLOAT,
s_UFLOAT,
s_SRGB
};
enum VkCompScheme {
c_BC1_RGB,
c_BC1_RGBA,
c_BC2,
c_BC3,
c_BC4,
c_BC5,
c_BC6H,
c_BC7,
c_ETC2_R8G8B8,
c_ETC2_R8G8B8A1,
c_ETC2_R8G8B8A8,
c_EAC_R11,
c_EAC_R11G11,
c_ASTC,
c_ETC1S,
c_PVRTC,
c_PVRTC2
};
typedef unsigned int uint32_t;
#if !defined(LIBKTX)
#include <vulkan/vulkan_core.h>
#else
#include "../vkformat_enum.h"
#endif
uint32_t* vk2dfd(enum VkFormat format);
uint32_t *createDFDUnpacked(int bigEndian, int numChannels, int bytes,
int redBlueSwap, enum VkSuffix suffix);
uint32_t *createDFDPacked(int bigEndian, int numChannels,
int bits[], int channels[],
enum VkSuffix suffix);
uint32_t *createDFDCompressed(enum VkCompScheme compScheme,
int bwidth, int bheight, int bdepth,
enum VkSuffix suffix);
uint32_t *createDFDDepthStencil(int depthBits,
int stencilBits,
int sizeBytes);
enum InterpretDFDResult {
i_LITTLE_ENDIAN_FORMAT_BIT = 0,
i_BIG_ENDIAN_FORMAT_BIT = 1,
i_PACKED_FORMAT_BIT = 2,
i_SRGB_FORMAT_BIT = 4,
i_NORMALIZED_FORMAT_BIT = 8,
i_SIGNED_FORMAT_BIT = 16,
i_FLOAT_FORMAT_BIT = 32,
i_UNSUPPORTED_ERROR_BIT = 64,
i_UNSUPPORTED_NONTRIVIAL_ENDIANNESS = i_UNSUPPORTED_ERROR_BIT,
i_UNSUPPORTED_MULTIPLE_SAMPLE_LOCATIONS = i_UNSUPPORTED_ERROR_BIT + 1,
i_UNSUPPORTED_MULTIPLE_PLANES = i_UNSUPPORTED_ERROR_BIT + 2,
i_UNSUPPORTED_CHANNEL_TYPES = i_UNSUPPORTED_ERROR_BIT + 3,
i_UNSUPPORTED_MIXED_CHANNELS = i_UNSUPPORTED_ERROR_BIT + 4
};
typedef struct _InterpretedDFDChannel {
uint32_t offset;
uint32_t size;
} InterpretedDFDChannel;
enum InterpretDFDResult interpretDFD(const uint32_t *DFD,
InterpretedDFDChannel *R,
InterpretedDFDChannel *G,
InterpretedDFDChannel *B,
InterpretedDFDChannel *A,
uint32_t *wordBytes);
void printDFD(uint32_t *DFD);
void
getDFDComponentInfoUnpacked(const uint32_t* DFD, uint32_t* numComponents,
uint32_t* componentByteLength);
uint32_t getDFDNumComponents(const uint32_t* DFD);
void
recreateBytesPlane0FromSampleInfo(const uint32_t* DFD, uint32_t* bytesPlane0);
typedef struct _Primaries {
float Rx;
float Ry;
float Gx;
float Gy;
float Bx;
float By;
float Wx;
float Wy;
} Primaries;
khr_df_primaries_e findMapping(Primaries *p, float latitude);
#ifdef __cplusplus
}
#endif
#endif