Skip to content

Commit a133283

Browse files
authored
Fix mPACKn formats (KhronosGroup#858)
Fixes KhronosGroup#857. It also fixes the part of KhronosGroup#853 that is related to the changes about `mPACKn` rules. Both of these affected the `16X4` and `10X6` formats, so they were addressed together.
1 parent bef5a7d commit a133283

11 files changed

Lines changed: 702 additions & 93 deletions

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ set(KTX_MAIN_SRC
389389
lib/vkformat_check.c
390390
lib/vkformat_enum.h
391391
lib/vkformat_str.c
392+
lib/vkformat_typesize.c
392393
)
393394

394395
set(BASISU_ENCODER_CXX_SRC

cmake/mkvk.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ list(APPEND mkvkformatfiles_input
5757
lib/mkvkformatfiles)
5858
list(APPEND mkvkformatfiles_output
5959
"${PROJECT_SOURCE_DIR}/lib/vkformat_enum.h"
60+
"${PROJECT_SOURCE_DIR}/lib/vkformat_typesize.c"
6061
"${PROJECT_SOURCE_DIR}/lib/vkformat_check.c"
6162
"${PROJECT_SOURCE_DIR}/lib/vkformat_str.c")
6263

lib/dfdutils/createdfd.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ uint32_t *createDFDUnpacked(int bigEndian, int numChannels, int bytes,
230230
* @param bits[] An array of length numChannels.
231231
* Each entry is the number of bits composing the channel, in
232232
* order starting at bit 0 of the packed type.
233-
* @param paddings[] An array of length numChannels.
234-
* Each entry is the number of padding bits after each channel.
233+
* @param shiftBits[] An array of length numChannels.
234+
* Each entry is the number of bits each channel is shifted
235+
* and thus padded with insignificant bits.
235236
* @param channels[] An array of length numChannels.
236237
* Each entry enumerates the channel type: 0 = red, 1 = green,
237238
* 2 = blue, 15 = alpha, in order starting at bit 0 of the
@@ -243,9 +244,9 @@ uint32_t *createDFDUnpacked(int bigEndian, int numChannels, int bytes,
243244
* @return A data format descriptor in malloc'd data. The caller is responsible
244245
* for freeing the descriptor.
245246
**/
246-
uint32_t *createDFDPackedPadded(int bigEndian, int numChannels,
247-
int bits[], int paddings[], int channels[],
248-
enum VkSuffix suffix)
247+
uint32_t *createDFDPackedShifted(int bigEndian, int numChannels,
248+
int bits[], int shiftBits[], int channels[],
249+
enum VkSuffix suffix)
249250
{
250251
uint32_t *DFD = 0;
251252
if (numChannels == 6) {
@@ -291,17 +292,18 @@ uint32_t *createDFDPackedPadded(int bigEndian, int numChannels,
291292
int sampleCounter;
292293
for (channelCounter = 0; channelCounter < numChannels; ++channelCounter) {
293294
beChannelStart[channelCounter] = totalBits;
294-
totalBits += bits[channelCounter] + paddings[channelCounter];
295+
totalBits += shiftBits[channelCounter] + bits[channelCounter];
295296
}
296297
BEMask = (totalBits - 1) & 0x18;
297298
for (channelCounter = 0; channelCounter < numChannels; ++channelCounter) {
299+
bitOffset += shiftBits[channelCounter];
298300
bitChannel[bitOffset ^ BEMask] = channelCounter;
299301
if (((bitOffset + bits[channelCounter] - 1) & ~7) != (bitOffset & ~7)) {
300302
/* Continuation sample */
301303
bitChannel[((bitOffset + bits[channelCounter] - 1) & ~7) ^ BEMask] = channelCounter;
302304
numSamples++;
303305
}
304-
bitOffset += bits[channelCounter] + paddings[channelCounter];
306+
bitOffset += bits[channelCounter];
305307
}
306308
DFD = writeHeader(numSamples, totalBits >> 3, suffix, i_COLOR);
307309

@@ -343,16 +345,17 @@ uint32_t *createDFDPackedPadded(int bigEndian, int numChannels,
343345
int totalBits = 0;
344346
int bitOffset = 0;
345347
for (sampleCounter = 0; sampleCounter < numChannels; ++sampleCounter) {
346-
totalBits += bits[sampleCounter] + paddings[sampleCounter];
348+
totalBits += shiftBits[sampleCounter] + bits[sampleCounter];
347349
}
348350

349351
/* One sample per channel */
350352
DFD = writeHeader(numChannels, totalBits >> 3, suffix, i_COLOR);
351353
for (sampleCounter = 0; sampleCounter < numChannels; ++sampleCounter) {
354+
bitOffset += shiftBits[sampleCounter];
352355
writeSample(DFD, sampleCounter, channels[sampleCounter],
353356
bits[sampleCounter], bitOffset,
354357
1, 1, suffix);
355-
bitOffset += bits[sampleCounter] + paddings[sampleCounter];
358+
bitOffset += bits[sampleCounter];
356359
}
357360
}
358361
return DFD;
@@ -383,20 +386,20 @@ uint32_t *createDFDPacked(int bigEndian, int numChannels,
383386
int bits[], int channels[],
384387
enum VkSuffix suffix) {
385388
assert(numChannels <= 6);
386-
int paddings[] = {0, 0, 0, 0, 0, 0};
387-
return createDFDPackedPadded(bigEndian, numChannels, bits, paddings, channels, suffix);
389+
int shiftBits[] = {0, 0, 0, 0, 0, 0};
390+
return createDFDPackedShifted(bigEndian, numChannels, bits, shiftBits, channels, suffix);
388391
}
389392

390393
uint32_t *createDFD422(int bigEndian, int numSamples,
391-
int bits[], int paddings[], int channels[],
394+
int bits[], int shiftBits[], int channels[],
392395
int position_xs[], int position_ys[],
393396
enum VkSuffix suffix) {
394397
assert(!bigEndian); (void) bigEndian;
395398
assert(suffix == s_UNORM); (void) suffix;
396399

397400
int totalBits = 0;
398401
for (int i = 0; i < numSamples; ++i)
399-
totalBits += bits[i] + paddings[i];
402+
totalBits += shiftBits[i] + bits[i];
400403
assert(totalBits % 8 == 0);
401404

402405
uint32_t BDFDSize = sizeof(uint32_t) * (KHR_DF_WORD_SAMPLESTART + numSamples * KHR_DF_WORD_SAMPLEWORDS);
@@ -428,6 +431,7 @@ uint32_t *createDFD422(int bigEndian, int numSamples,
428431

429432
int bitOffset = 0;
430433
for (int i = 0; i < numSamples; ++i) {
434+
bitOffset += shiftBits[i];
431435
KHR_DFDSETSVAL(BDFD, i, BITOFFSET, bitOffset);
432436
KHR_DFDSETSVAL(BDFD, i, BITLENGTH, bits[i] - 1);
433437
KHR_DFDSETSVAL(BDFD, i, CHANNELID, channels[i]);
@@ -438,7 +442,7 @@ uint32_t *createDFD422(int bigEndian, int numSamples,
438442
KHR_DFDSETSVAL(BDFD, i, SAMPLEPOSITION3, 0);
439443
KHR_DFDSETSVAL(BDFD, i, SAMPLELOWER, 0);
440444
KHR_DFDSETSVAL(BDFD, i, SAMPLEUPPER, (1u << bits[i]) - 1u);
441-
bitOffset += bits[i] + paddings[i];
445+
bitOffset += bits[i];
442446
}
443447

444448
return DFD;

lib/dfdutils/dfd.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ uint32_t *createDFDUnpacked(int bigEndian, int numChannels, int bytes,
7474
int redBlueSwap, enum VkSuffix suffix);
7575

7676
/* Create a Data Format Descriptor for a packed padded format. */
77-
uint32_t *createDFDPackedPadded(int bigEndian, int numChannels,
78-
int bits[], int paddings[], int channels[],
79-
enum VkSuffix suffix);
77+
uint32_t *createDFDPackedShifted(int bigEndian, int numChannels,
78+
int bits[], int shiftBits[],
79+
int channels[], enum VkSuffix suffix);
8080

8181
/* Create a Data Format Descriptor for a packed format. */
8282
uint32_t *createDFDPacked(int bigEndian, int numChannels,
@@ -85,7 +85,7 @@ uint32_t *createDFDPacked(int bigEndian, int numChannels,
8585

8686
/* Create a Data Format Descriptor for a 4:2:2 format. */
8787
uint32_t *createDFD422(int bigEndian, int numChannels,
88-
int bits[], int paddings[], int channels[],
88+
int bits[], int shiftBits[], int channels[],
8989
int position_xs[], int position_ys[],
9090
enum VkSuffix suffix);
9191

lib/dfdutils/makevk2dfd.pl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ sub formatProcessed {
8181
my $formatChannels = $1;
8282

8383
my $bits = "";
84-
my $paddings = "";
84+
my $shiftBits = "";
8585
my $position_xs = "";
8686
my $position_ys = "";
8787
my $last_green = 1;
@@ -95,7 +95,7 @@ sub formatProcessed {
9595
if ($channels ne "") {
9696
$channels = ", " . $channels;
9797
$bits = ", " . $bits;
98-
$paddings = ", " . $paddings;
98+
$shiftBits = ", " . $shiftBits;
9999
$position_xs = ", " . $position_xs;
100100
$position_ys = ", " . $position_ys;
101101
}
@@ -134,16 +134,16 @@ sub formatProcessed {
134134

135135
$bits = $bit . $bits;
136136

137-
if ($padding ne "") { $paddings = $padding . $paddings; }
138-
else { $paddings = "0" . $paddings; }
137+
if ($padding ne "") { $shiftBits = $padding . $shiftBits; }
138+
else { $shiftBits = "0" . $shiftBits; }
139139

140140
$formatChannels = $1;
141141
}
142142

143143
print "case $format: {\n";
144-
print " int channels[] = {$channels}; int bits[] = {$bits}; int paddings[] = {$paddings};\n";
144+
print " int channels[] = {$channels}; int bits[] = {$bits}; int shiftBits[] = {$shiftBits};\n";
145145
print " int position_xs[] = {$position_xs}; int position_ys[] = {$position_ys};\n";
146-
print " return createDFD422($bigEndian, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);\n}\n";
146+
print " return createDFD422($bigEndian, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);\n}\n";
147147

148148
} elsif ($line =~ m/VK_FORMAT_[RGBAE0-9]+_/) {
149149
# Set $format to the enum identifier
@@ -308,48 +308,48 @@ sub formatProcessed {
308308
if (!exists($foundFormats{$format})) {
309309
$foundFormats{$format} = 1;
310310
print "case $format: {\n";
311-
print " int channels[] = {0}; int bits[] = {10}; int paddings[] = {6};\n";
312-
print " return createDFDPackedPadded($bigEndian, 1, bits, paddings, channels, s_UNORM);\n}\n"
311+
print " int channels[] = {0}; int bits[] = {10}; int shiftBits[] = {6};\n";
312+
print " return createDFDPackedShifted($bigEndian, 1, bits, shiftBits, channels, s_UNORM);\n}\n"
313313
}
314314
} elsif ($line =~ m/(VK_FORMAT_R10X6G10X6_UNORM_2PACK16)/) {
315315
$format = $1; # Extract the format identifier from the rest of the line
316316
if (!exists($foundFormats{$format})) {
317317
$foundFormats{$format} = 1;
318318
print "case $format: {\n";
319-
print " int channels[] = {0, 1}; int bits[] = {10, 10}; int paddings[] = {6, 6};\n";
320-
print " return createDFDPackedPadded($bigEndian, 2, bits, paddings, channels, s_UNORM);\n}\n"
319+
print " int channels[] = {0, 1}; int bits[] = {10, 10}; int shiftBits[] = {6, 6};\n";
320+
print " return createDFDPackedShifted($bigEndian, 2, bits, shiftBits, channels, s_UNORM);\n}\n"
321321
}
322322
} elsif ($line =~ m/(VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16)/) {
323323
$format = $1; # Extract the format identifier from the rest of the line
324324
if (!exists($foundFormats{$format})) {
325325
$foundFormats{$format} = 1;
326326
print "case $format: {\n";
327-
print " int channels[] = {0, 1, 2, 3}; int bits[] = {10, 10, 10, 10}; int paddings[] = {6, 6, 6, 6};\n";
328-
print " return createDFDPackedPadded($bigEndian, 4, bits, paddings, channels, s_UNORM);\n}\n"
327+
print " int channels[] = {0, 1, 2, 3}; int bits[] = {10, 10, 10, 10}; int shiftBits[] = {6, 6, 6, 6};\n";
328+
print " return createDFDPackedShifted($bigEndian, 4, bits, shiftBits, channels, s_UNORM);\n}\n"
329329
}
330330
} elsif ($line =~ m/(VK_FORMAT_R12X4_UNORM_PACK16)/) {
331331
$format = $1; # Extract the format identifier from the rest of the line
332332
if (!exists($foundFormats{$format})) {
333333
$foundFormats{$format} = 1;
334334
print "case $format: {\n";
335-
print " int channels[] = {0}; int bits[] = {12}; int paddings[] = {4};\n";
336-
print " return createDFDPackedPadded($bigEndian, 1, bits, paddings, channels, s_UNORM);\n}\n"
335+
print " int channels[] = {0}; int bits[] = {12}; int shiftBits[] = {4};\n";
336+
print " return createDFDPackedShifted($bigEndian, 1, bits, shiftBits, channels, s_UNORM);\n}\n"
337337
}
338338
} elsif ($line =~ m/(VK_FORMAT_R12X4G12X4_UNORM_2PACK16)/) {
339339
$format = $1; # Extract the format identifier from the rest of the line
340340
if (!exists($foundFormats{$format})) {
341341
$foundFormats{$format} = 1;
342342
print "case $format: {\n";
343-
print " int channels[] = {0, 1}; int bits[] = {12, 12}; int paddings[] = {4, 4};\n";
344-
print " return createDFDPackedPadded($bigEndian, 2, bits, paddings, channels, s_UNORM);\n}\n"
343+
print " int channels[] = {0, 1}; int bits[] = {12, 12}; int shiftBits[] = {4, 4};\n";
344+
print " return createDFDPackedShifted($bigEndian, 2, bits, shiftBits, channels, s_UNORM);\n}\n"
345345
}
346346
} elsif ($line =~ m/(VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16)/) {
347347
$format = $1; # Extract the format identifier from the rest of the line
348348
if (!exists($foundFormats{$format})) {
349349
$foundFormats{$format} = 1;
350350
print "case $format: {\n";
351-
print " int channels[] = {0, 1, 2, 3}; int bits[] = {12, 12, 12, 12}; int paddings[] = {4, 4, 4, 4};\n";
352-
print " return createDFDPackedPadded($bigEndian, 4, bits, paddings, channels, s_UNORM);\n}\n"
351+
print " int channels[] = {0, 1, 2, 3}; int bits[] = {12, 12, 12, 12}; int shiftBits[] = {4, 4, 4, 4};\n";
352+
print " return createDFDPackedShifted($bigEndian, 4, bits, shiftBits, channels, s_UNORM);\n}\n"
353353
}
354354

355355
# If we weren't VK_FORMAT_ plus a channel, we might be a compressed

lib/dfdutils/vk2dfd.inl

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -277,68 +277,68 @@ case VK_FORMAT_ASTC_12x10_SRGB_BLOCK: return createDFDCompressed(c_ASTC, 12, 10,
277277
case VK_FORMAT_ASTC_12x12_UNORM_BLOCK: return createDFDCompressed(c_ASTC, 12, 12, 1, s_UNORM);
278278
case VK_FORMAT_ASTC_12x12_SRGB_BLOCK: return createDFDCompressed(c_ASTC, 12, 12, 1, s_SRGB);
279279
case VK_FORMAT_G8B8G8R8_422_UNORM: {
280-
int channels[] = {0, 1, 0, 2}; int bits[] = {8, 8, 8, 8}; int paddings[] = {0, 0, 0, 0};
280+
int channels[] = {0, 1, 0, 2}; int bits[] = {8, 8, 8, 8}; int shiftBits[] = {0, 0, 0, 0};
281281
int position_xs[] = {64, 64, 192, 64}; int position_ys[] = {128, 128, 128, 128};
282-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
282+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
283283
}
284284
case VK_FORMAT_B8G8R8G8_422_UNORM: {
285-
int channels[] = {1, 0, 2, 0}; int bits[] = {8, 8, 8, 8}; int paddings[] = {0, 0, 0, 0};
285+
int channels[] = {1, 0, 2, 0}; int bits[] = {8, 8, 8, 8}; int shiftBits[] = {0, 0, 0, 0};
286286
int position_xs[] = {64, 64, 64, 192}; int position_ys[] = {128, 128, 128, 128};
287-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
287+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
288288
}
289289
case VK_FORMAT_R10X6_UNORM_PACK16: {
290-
int channels[] = {0}; int bits[] = {10}; int paddings[] = {6};
291-
return createDFDPackedPadded(0, 1, bits, paddings, channels, s_UNORM);
290+
int channels[] = {0}; int bits[] = {10}; int shiftBits[] = {6};
291+
return createDFDPackedShifted(0, 1, bits, shiftBits, channels, s_UNORM);
292292
}
293293
case VK_FORMAT_R10X6G10X6_UNORM_2PACK16: {
294-
int channels[] = {0, 1}; int bits[] = {10, 10}; int paddings[] = {6, 6};
295-
return createDFDPackedPadded(0, 2, bits, paddings, channels, s_UNORM);
294+
int channels[] = {0, 1}; int bits[] = {10, 10}; int shiftBits[] = {6, 6};
295+
return createDFDPackedShifted(0, 2, bits, shiftBits, channels, s_UNORM);
296296
}
297297
case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: {
298-
int channels[] = {0, 1, 2, 3}; int bits[] = {10, 10, 10, 10}; int paddings[] = {6, 6, 6, 6};
299-
return createDFDPackedPadded(0, 4, bits, paddings, channels, s_UNORM);
298+
int channels[] = {0, 1, 2, 3}; int bits[] = {10, 10, 10, 10}; int shiftBits[] = {6, 6, 6, 6};
299+
return createDFDPackedShifted(0, 4, bits, shiftBits, channels, s_UNORM);
300300
}
301301
case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16: {
302-
int channels[] = {0, 1, 0, 2}; int bits[] = {10, 10, 10, 10}; int paddings[] = {6, 6, 6, 6};
302+
int channels[] = {0, 1, 0, 2}; int bits[] = {10, 10, 10, 10}; int shiftBits[] = {6, 6, 6, 6};
303303
int position_xs[] = {64, 64, 192, 64}; int position_ys[] = {128, 128, 128, 128};
304-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
304+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
305305
}
306306
case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: {
307-
int channels[] = {1, 0, 2, 0}; int bits[] = {10, 10, 10, 10}; int paddings[] = {6, 6, 6, 6};
307+
int channels[] = {1, 0, 2, 0}; int bits[] = {10, 10, 10, 10}; int shiftBits[] = {6, 6, 6, 6};
308308
int position_xs[] = {64, 64, 64, 192}; int position_ys[] = {128, 128, 128, 128};
309-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
309+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
310310
}
311311
case VK_FORMAT_R12X4_UNORM_PACK16: {
312-
int channels[] = {0}; int bits[] = {12}; int paddings[] = {4};
313-
return createDFDPackedPadded(0, 1, bits, paddings, channels, s_UNORM);
312+
int channels[] = {0}; int bits[] = {12}; int shiftBits[] = {4};
313+
return createDFDPackedShifted(0, 1, bits, shiftBits, channels, s_UNORM);
314314
}
315315
case VK_FORMAT_R12X4G12X4_UNORM_2PACK16: {
316-
int channels[] = {0, 1}; int bits[] = {12, 12}; int paddings[] = {4, 4};
317-
return createDFDPackedPadded(0, 2, bits, paddings, channels, s_UNORM);
316+
int channels[] = {0, 1}; int bits[] = {12, 12}; int shiftBits[] = {4, 4};
317+
return createDFDPackedShifted(0, 2, bits, shiftBits, channels, s_UNORM);
318318
}
319319
case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: {
320-
int channels[] = {0, 1, 2, 3}; int bits[] = {12, 12, 12, 12}; int paddings[] = {4, 4, 4, 4};
321-
return createDFDPackedPadded(0, 4, bits, paddings, channels, s_UNORM);
320+
int channels[] = {0, 1, 2, 3}; int bits[] = {12, 12, 12, 12}; int shiftBits[] = {4, 4, 4, 4};
321+
return createDFDPackedShifted(0, 4, bits, shiftBits, channels, s_UNORM);
322322
}
323323
case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16: {
324-
int channels[] = {0, 1, 0, 2}; int bits[] = {12, 12, 12, 12}; int paddings[] = {4, 4, 4, 4};
324+
int channels[] = {0, 1, 0, 2}; int bits[] = {12, 12, 12, 12}; int shiftBits[] = {4, 4, 4, 4};
325325
int position_xs[] = {64, 64, 192, 64}; int position_ys[] = {128, 128, 128, 128};
326-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
326+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
327327
}
328328
case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: {
329-
int channels[] = {1, 0, 2, 0}; int bits[] = {12, 12, 12, 12}; int paddings[] = {4, 4, 4, 4};
329+
int channels[] = {1, 0, 2, 0}; int bits[] = {12, 12, 12, 12}; int shiftBits[] = {4, 4, 4, 4};
330330
int position_xs[] = {64, 64, 64, 192}; int position_ys[] = {128, 128, 128, 128};
331-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
331+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
332332
}
333333
case VK_FORMAT_G16B16G16R16_422_UNORM: {
334-
int channels[] = {0, 1, 0, 2}; int bits[] = {16, 16, 16, 16}; int paddings[] = {0, 0, 0, 0};
334+
int channels[] = {0, 1, 0, 2}; int bits[] = {16, 16, 16, 16}; int shiftBits[] = {0, 0, 0, 0};
335335
int position_xs[] = {64, 64, 192, 64}; int position_ys[] = {128, 128, 128, 128};
336-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
336+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
337337
}
338338
case VK_FORMAT_B16G16R16G16_422_UNORM: {
339-
int channels[] = {1, 0, 2, 0}; int bits[] = {16, 16, 16, 16}; int paddings[] = {0, 0, 0, 0};
339+
int channels[] = {1, 0, 2, 0}; int bits[] = {16, 16, 16, 16}; int shiftBits[] = {0, 0, 0, 0};
340340
int position_xs[] = {64, 64, 64, 192}; int position_ys[] = {128, 128, 128, 128};
341-
return createDFD422(0, 4, bits, paddings, channels, position_xs, position_ys, s_UNORM);
341+
return createDFD422(0, 4, bits, shiftBits, channels, position_xs, position_ys, s_UNORM);
342342
}
343343
case VK_FORMAT_A4R4G4B4_UNORM_PACK16: {
344344
int channels[] = {2,1,0,3}; int bits[] = {4,4,4,4};

lib/internalexport.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ EXPORTS
4545
ktxTexture2_destruct
4646
vk2dfd
4747
vkFormatString
48+
vkFormatTypeSize
4849
stringToVkFormat

lib/internalexport_mingw.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ EXPORTS
4545
ktxTexture2_destruct
4646
vk2dfd
4747
vkFormatString
48+
vkFormatTypeSize
4849
stringToVkFormat

0 commit comments

Comments
 (0)