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

Function main

external/dfdutils/interpretdfdtest.c:201–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199};
200
201int main(int argc, char** argv)
202{
203 const char *errorText[] = {
204 "UNSUPPORTED_NONTRIVIAL_ENDIANNESS",
205 "UNSUPPORTED_MULTIPLE_SAMPLE_LOCATIONS",
206 "UNSUPPORTED_MULTIPLE_PLANES",
207 "UNSUPPORTED_CHANNEL_TYPES",
208 "UNSUPPORTED_MIXED_CHANNELS"};
209
210 InterpretedDFDChannel R = {0,0}, G = {0,0}, B = {0,0}, A = {0,0};
211 uint32_t wordSize;
212 enum InterpretDFDResult t;
213
214#if 0
215 t = interpretDFD(dfd1, &R, &G, &B, &A, &wordSize);
216#else
217#if 0
218 uint32_t *d = createDFDUnpacked(1,2,4,0,s_UNORM);
219#elif 0
220 int channels[] = {0,1,2,3};
221 int bits[] = {10,10,10,2};
222 uint32_t *d = createDFDPacked(1,4,bits,channels,s_UNORM);
223#elif 0
224 int channels[] = {0,1,2};
225 int bits[] = {5,6,5};
226 uint32_t *d = createDFDPacked(1,3,bits,channels,s_UNORM);
227#elif 1
228 uint32_t *d = createDFDUnpacked(0, 3, 1, 0, s_UNORM);
229#endif
230
231 printDFD(d, *d);
232 t = interpretDFD(d, &R, &G, &B, &A, &wordSize);
233#endif
234
235 if (t & i_UNSUPPORTED_ERROR_BIT) {
236 printf("%s\n", errorText[t - i_UNSUPPORTED_ERROR_BIT]);
237 return 0;
238 } else {
239 if (t & i_BIG_ENDIAN_FORMAT_BIT) {
240 printf("Big-endian\n");
241 } else {
242 printf("Little-endian\n");
243 }
244 if (t & i_PACKED_FORMAT_BIT) {
245 printf("Packed\n");
246 if (R.size > 0) {
247 printf("%u red bit%s starting at %u\n", R.size, R.size>1?"s":"", R.offset);
248 }
249 if (G.size > 0) {
250 printf("%u green bit%s starting at %u\n", G.size, G.size>1?"s":"", G.offset);
251 }
252 if (B.size > 0) {
253 printf("%u blue bit%s starting at %u\n", B.size, B.size>1?"s":"", B.offset);
254 }
255 if (A.size > 0) {
256 printf("%u alpha bit%s starting at %u\n", A.size, A.size>1?"s":"", A.offset);
257 }
258 printf("Total word size %u\n", wordSize);

Callers

nothing calls this directly

Calls 5

interpretDFDFunction · 0.85
createDFDUnpackedFunction · 0.85
createDFDPackedFunction · 0.85
printDFDFunction · 0.85
printfFunction · 0.85

Tested by

no test coverage detected