Skip to content

Utilities for working with Khronos data format descriptors

License

Notifications You must be signed in to change notification settings

KhronosGroup/dfdutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Khronos® Data Format Descriptor Utilities

This directory contains helper utilities for creating and interpreting data format descriptors as specified in Part 1 of the Khronos Data Format Specification 1.3 (KDFS). KDFS Part 1 is referred to by the KTX File Format Specification Version 2 and data format descriptors are embedded in .ktx2 files. The OpenGL®, OpenGL ES™️ and Vulkan® specifications refer to other parts of KDFS that specify color transforms and block-compressed texture formats.

These utilities are provided as examples rather than being intended for use in production code (they are not robust to all possible input, even for legal data format descriptors) and no warranty is provided. They should however work with the subset of data format descriptors needed in .ktx2 files.

colorspaces.c contains a helper function for finding a mapping from a set of color primarie values to a KDFS primaries enum.

createdfd.c contains helpers for converting from Vulkan format enums to data format descriptors.

interpretdfd.c provides the ability to interpret a data format descriptor for simple formats, and provides a simplified interface for this case.

printdfd.c produces a (fairly) human-readable description of the fields of a data format descriptor, intended to assist with debugging.

queries.c contains functions to query the component information of a descriptor for an unpacked format and the number of components in the described format. It also contains a utility function to recreate the bytesPlane0 value of a DFD for data that is being inflated from supercomoression.

vk2dfd.c creates a DFD describing a VkFormat and dfd2vk.c returns the VkFormat matching a DFD.

API documentation can be found here.

makevk2dfd.pl and makedfd2vk.pl generate the code used by vk2dfd.c and dfd2vk.c to convert from Vulkan enums to data format descriptors and back again; these should be run with the Vulkan header (or the format enum subset of it) as input, since they heuristically support formats named in the header rather than being hard-wired. As the resulting code depends highly on heuristics to identify existing format mappings, it is not robust against descriptors which did not originate as a Vulkan format.

Note
Only common color formats and depth formats are supported; there’s no support for multi-planar formats, for example.

The commands` syntax is

makevk2dfd.pl [<vulkan header>] [<output_file>]
makedfd2vk.pl [<vulkan_header>] [<output_file>]

With no arguments they read from stdin and write to stdout. With 1 argument they read the first argument file and write to stdout. With 2 arguments they read the first argument file and write to the second.

Note

These utilities require access to vulkan_core.h for access to VkFormat. A version is provided in this repo as a temporary measure until the Vulkan extension for ASTC 3D formats is released and those enums appear in the standard vulkan_core.h.

About

Utilities for working with Khronos data format descriptors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published