MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / createDFDAlpha

Function createDFDAlpha

external/dfdutils/createdfd.c:787–809  ·  view source on GitHub ↗

* @~English * @brief Create a Data Format Descriptor for an alpha-only format. * * @param bigEndian Set to 1 for big-endian byte ordering and 0 for little-endian byte ordering. * @param bytes The number of bytes per channel. * @param suffix Indicates the format suffix for the type. * * @return A data format descriptor in malloc'd data. The caller is responsible *

Source from the content-addressed store, hash-verified

785 * for freeing the descriptor.
786 **/
787uint32_t *createDFDAlpha(int bigEndian, int bytes,
788 enum VkSuffix suffix) {
789 uint32_t *DFD;
790 int channel = 3; /* alpha channel */
791 if (bigEndian) {
792 int channelByte;
793 /* Number of samples = number of channels * bytes per channel */
794 DFD = writeHeader(bytes, bytes, suffix, i_COLOR);
795 /* Loop over the bytes that constitute a channel */
796 for (channelByte = 0; channelByte < bytes; ++channelByte) {
797 writeSample(DFD, channelByte, channel,
798 8, 8 * (bytes - channelByte - 1),
799 channelByte == bytes-1, channelByte == 0, suffix);
800 }
801 } else { /* Little-endian */
802 /* One sample per channel */
803 DFD = writeHeader(1, bytes, suffix, i_COLOR);
804 writeSample(DFD, 0, channel,
805 8 * bytes, 0,
806 1, 1, suffix);
807 }
808 return DFD;
809}

Callers

nothing calls this directly

Calls 2

writeHeaderFunction · 0.85
writeSampleFunction · 0.85

Tested by

no test coverage detected