Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions external/dfdutils/printdfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,20 +821,20 @@ void printDFD(uint32_t *DFD, uint32_t dataSize)
if (remainingSize < sizeof_BDFD + (sample + 1) * sizeof_BDFDSample)
break; // Invalid DFD: Missing or partial basic DFD sample

khr_df_model_channels_e channelType = KHR_DFDSVAL(block, sample, CHANNELID);
khr_df_model_channels_e channelId = KHR_DFDSVAL(block, sample, CHANNELID);
printf("Sample %u:\n", sample);

khr_df_sample_datatype_qualifiers_e qualifiers = KHR_DFDSVAL(block, sample, QUALIFIERS);
printf(" Qualifiers: 0x%X (", qualifiers);
printFlagBits(qualifiers, dfdToStringSampleDatatypeQualifiersBit);
printf(")\n");
printf(" Channel Type: 0x%X", channelType);
printf(" Channel Id: 0x%X", channelId);
{
const char* str = dfdToStringChannelId(model, channelType);
const char* str = dfdToStringChannelId(model, channelId);
if (str)
printf(" (%s)\n", str);
else
printf(" (%u)\n", channelType);
printf(" (%u)\n", channelId);
}
printf(" Length: %u bits Offset: %u\n",
KHR_DFDSVAL(block, sample, BITLENGTH) + 1,
Expand Down Expand Up @@ -1008,12 +1008,12 @@ void printDFDJSON(uint32_t* DFD, uint32_t dataSize, uint32_t base_indent, uint32
PRINT_INDENT(4, "],%s", nl)
}

khr_df_model_channels_e channelType = KHR_DFDSVAL(block, sample, CHANNELID);
const char* channelStr = dfdToStringChannelId(model, channelType);
khr_df_model_channels_e channelId = KHR_DFDSVAL(block, sample, CHANNELID);
const char* channelStr = dfdToStringChannelId(model, channelId);
if (channelStr)
PRINT_INDENT(4, "\"channelType\":%s\"%s\",%s", space, channelStr, nl)
PRINT_INDENT(4, "\"channelId\":%s\"%s\",%s", space, channelStr, nl)
else
PRINT_INDENT(4, "\"channelType\":%s%u,%s", space, channelType, nl)
PRINT_INDENT(4, "\"channelId\":%s%u,%s", space, channelId, nl)

PRINT_INDENT(4, "\"bitLength\":%s%u,%s", space, KHR_DFDSVAL(block, sample, BITLENGTH), nl)
PRINT_INDENT(4, "\"bitOffset\":%s%u,%s", space, KHR_DFDSVAL(block, sample, BITOFFSET), nl)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/glloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static GLint contextProfile = 0;
* by the current context.
*/
static GLint sizedFormats = _ALL_SIZED_FORMATS;
static GLboolean supportsSwizzle = GL_TRUE;
static MAYBE_UNUSED GLboolean supportsSwizzle = GL_TRUE;
/**
* @internal
* @~English
Expand Down
2 changes: 1 addition & 1 deletion tests/cts
Submodule cts updated 7651 files
54 changes: 27 additions & 27 deletions tools/imageio/formatdesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct FormatDescriptor {
uint32_t bitOffset: 16;
uint32_t bitLength: 8;
// uint32_t channelType: 8;
uint32_t channelType: 4;
uint32_t channelId: 4;
uint32_t qualifierLinear: 1;
uint32_t qualifierExponent: 1;
uint32_t qualifierSigned: 1;
Expand Down Expand Up @@ -199,26 +199,26 @@ struct FormatDescriptor {
/// For uncompressed formats. Handle integer data as normalized. For
/// unsigned use the full range of the number of bits. For signed set
/// sampleUpper and sampleLower so 0 is representable.
sample(uint32_t chanType,
sample(uint32_t chanId,
uint32_t bLength, uint32_t offset,
khr_df_sample_datatype_qualifiers_e dataType
= static_cast<khr_df_sample_datatype_qualifiers_e>(0),
khr_df_transfer_e tf = KHR_DF_TRANSFER_UNSPECIFIED,
khr_df_model_e m = KHR_DF_MODEL_RGBSDA) {
bitOffset = offset;
bitLength = bLength - 1;
channelType = chanType;
if (channelType == 3 && m != KHR_DF_MODEL_XYZW) {
channelId = chanId;
if (channelId == 3 && m != KHR_DF_MODEL_XYZW) {
/// XYZW does not have an alpha chennel. *_ALPHA has the same
/// value for all other 4-channel-capable uncompressed models.
channelType = KHR_DF_CHANNEL_RGBSDA_ALPHA;
channelId = KHR_DF_CHANNEL_RGBSDA_ALPHA;
}
qualifierFloat = (dataType & KHR_DF_SAMPLE_DATATYPE_FLOAT) != 0;
qualifierSigned = (dataType & KHR_DF_SAMPLE_DATATYPE_SIGNED) != 0;
qualifierExponent = (dataType & KHR_DF_SAMPLE_DATATYPE_EXPONENT) != 0;
qualifierLinear = (dataType & KHR_DF_SAMPLE_DATATYPE_LINEAR) != 0;
if (tf > KHR_DF_TRANSFER_LINEAR
&& channelType == KHR_DF_CHANNEL_RGBSDA_ALPHA) {
&& channelId == KHR_DF_CHANNEL_RGBSDA_ALPHA) {
qualifierLinear = 1;
}

Expand Down Expand Up @@ -295,7 +295,7 @@ struct FormatDescriptor {
/// Data is assumed to be unsigned normalized. @c sampleUpper will be
/// set to the max value representable by @a channelBitLength.
///
/// @c channelType will be set to the standard channel types for @a channelCount
/// @c channelId will be set to the standard channel types for @a channelCount
/// and @a m.
FormatDescriptor(uint32_t channelCount, uint32_t channelBitLength,
khr_df_sample_datatype_qualifiers_e dt
Expand All @@ -313,7 +313,7 @@ struct FormatDescriptor {
dt, t, m));
}
if (m == KHR_DF_MODEL_YUVSDA && channelCount == 2) {
samples[1].channelType = KHR_DF_CHANNEL_YUVSDA_ALPHA;
samples[1].channelId = KHR_DF_CHANNEL_YUVSDA_ALPHA;
}
extended.sameUnitAllChannels = true;
}
Expand Down Expand Up @@ -342,7 +342,7 @@ struct FormatDescriptor {
dt, t, m));
}
if (m == KHR_DF_MODEL_YUVSDA && channelCount == 2) {
samples[1].channelType = KHR_DF_CHANNEL_YUVSDA_ALPHA;
samples[1].channelId = KHR_DF_CHANNEL_YUVSDA_ALPHA;
}
extended.sameUnitAllChannels = true;
}
Expand All @@ -360,7 +360,7 @@ struct FormatDescriptor {
/// Each channel has the same basic data type.
FormatDescriptor(uint32_t channelCount,
std::vector<uint32_t>& channelBitLengths,
std::vector<khr_df_model_channels_e>& channelTypes,
std::vector<khr_df_model_channels_e>& channelIds,
khr_df_sample_datatype_qualifiers_e dt
= static_cast<khr_df_sample_datatype_qualifiers_e>(0),
khr_df_transfer_e t = KHR_DF_TRANSFER_UNSPECIFIED,
Expand All @@ -371,16 +371,16 @@ struct FormatDescriptor {
extended(channelCount)
{
if (channelCount > channelBitLengths.size()
|| channelCount > channelTypes.size()) {
|| channelCount > channelIds.size()) {
throw std::runtime_error(
"Not enough channelBits or channelType specfications."
"Not enough channelBits or channelId specfications."
);
}
uint32_t bitOffset = 0;
bool bitLengthsEqual = true;
uint32_t firstBitLength = channelBitLengths[0];
for (uint32_t s = 0; s < channelCount; s++) {
samples.push_back(sample(channelTypes[s], channelBitLengths[s],
samples.push_back(sample(channelIds[s], channelBitLengths[s],
bitOffset, dt, t, m));
bitOffset += channelBitLengths[s];
if (firstBitLength != channelBitLengths[s]) {
Expand All @@ -391,7 +391,7 @@ struct FormatDescriptor {
extended.sameUnitAllChannels = true;
}
if (m == KHR_DF_MODEL_YUVSDA && channelCount == 2) {
samples[1].channelType = KHR_DF_CHANNEL_YUVSDA_ALPHA;
samples[1].channelId = KHR_DF_CHANNEL_YUVSDA_ALPHA;
}
}

Expand All @@ -402,7 +402,7 @@ struct FormatDescriptor {
/// integer data or normalized data that does not use the full bit range.
FormatDescriptor(uint32_t channelCount,
std::vector<uint32_t>& channelBitLengths,
std::vector<khr_df_model_channels_e>& channelTypes,
std::vector<khr_df_model_channels_e>& channelIds,
std::vector<uint32_t>& samplesLower,
std::vector<uint32_t>& samplesUpper,
khr_df_sample_datatype_qualifiers_e dt
Expand All @@ -415,16 +415,16 @@ struct FormatDescriptor {
extended(channelCount)
{
if (channelCount > channelBitLengths.size()
|| channelCount > channelTypes.size()) {
|| channelCount > channelIds.size()) {
throw std::runtime_error(
"Not enough channelBits or channelType specfications."
"Not enough channelBits or channelId specfications."
);
}
uint32_t bitOffset = 0;
bool bitLengthsEqual = true;
uint32_t firstBitLength = channelBitLengths[0];
for (uint32_t s = 0; s < channelCount; s++) {
samples.push_back(sample(channelTypes[s], channelBitLengths[s],
samples.push_back(sample(channelIds[s], channelBitLengths[s],
samplesLower[s], samplesUpper[s],
bitOffset, dt, t, m));
bitOffset += channelBitLengths[s];
Expand All @@ -436,7 +436,7 @@ struct FormatDescriptor {
extended.sameUnitAllChannels = true;
}
if (m == KHR_DF_MODEL_YUVSDA && channelCount == 2) {
samples[1].channelType = KHR_DF_CHANNEL_YUVSDA_ALPHA;
samples[1].channelId = KHR_DF_CHANNEL_YUVSDA_ALPHA;
}
}

Expand Down Expand Up @@ -568,7 +568,7 @@ struct FormatDescriptor {
{
std::vector<sample>::iterator sit = samples.begin();
for (; sit < samples.end(); sit++) {
if (sit->channelType == KHR_DF_CHANNEL_RGBSDA_ALPHA) {
if (sit->channelId == KHR_DF_CHANNEL_RGBSDA_ALPHA) {
sit->qualifierLinear = t > KHR_DF_TRANSFER_LINEAR;
}
}
Expand Down Expand Up @@ -598,7 +598,7 @@ struct FormatDescriptor {
std::vector<sample>::const_iterator it = samples.begin();
uint32_t bitLength = 0;
for (; it < samples.end(); it++) {
if (it->channelType == static_cast<uint32_t>(c)) {
if (it->channelId == static_cast<uint32_t>(c)) {
bitLength += it->bitLength + 1;
}
}
Expand Down Expand Up @@ -631,7 +631,7 @@ struct FormatDescriptor {
for (uint32_t i = 0; i < 16; ++i) {
uint32_t bitLength = 0;
for (const auto& sample : samples)
if (sample.channelType == i)
if (sample.channelId == i)
bitLength += sample.bitLength + 1;

if (bitLength > maxBitLength)
Expand All @@ -643,7 +643,7 @@ struct FormatDescriptor {
for (uint32_t i = 0; i < 16; ++i) {
uint32_t channelBitLength = 0;
for (const auto& sample : samples)
if (sample.channelType == i)
if (sample.channelId == i)
channelBitLength += sample.bitLength + 1;

if (bitLength != channelBitLength)
Expand All @@ -656,9 +656,9 @@ struct FormatDescriptor {
// TODO: Fix for shared exponent case...
std::vector<sample>::const_iterator it = samples.begin();
for (; it < samples.end(); it++) {
if (it->channelType == static_cast<uint32_t>(c)) {
if (it->channelId == static_cast<uint32_t>(c)) {
return static_cast<khr_df_sample_datatype_qualifiers_e>
(it->channelType & KHR_DF_SAMPLEMASK_QUALIFIERS);
(it->channelId & KHR_DF_SAMPLEMASK_QUALIFIERS);
}
}
throw std::runtime_error("No such channel.");
Expand Down Expand Up @@ -700,7 +700,7 @@ struct FormatDescriptor {
basic.model()));
}
if (basic.model() == KHR_DF_MODEL_YUVSDA && channelCount == 2) {
samples[1].channelType = KHR_DF_CHANNEL_YUVSDA_ALPHA;
samples[1].channelId = KHR_DF_CHANNEL_YUVSDA_ALPHA;
}
extended.channelCount = channelCount;
extended.sameUnitAllChannels = true;
Expand Down Expand Up @@ -744,7 +744,7 @@ struct FormatDescriptor {

[[nodiscard]] const sample* find(khr_df_model_channels_e channel) const {
for (const auto& sample : samples)
if (sample.channelType == static_cast<uint32_t>(channel))
if (sample.channelId == static_cast<uint32_t>(channel))
return &sample;
return nullptr;
}
Expand Down
8 changes: 4 additions & 4 deletions tools/imageio/imageio.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,27 @@ class ImageSpec {

ImageSpec(uint32_t w, uint32_t h, uint32_t d,
uint32_t channelCount, std::vector<uint32_t>& channelBitLengths,
std::vector<khr_df_model_channels_e>& channelTypes,
std::vector<khr_df_model_channels_e>& channelIds,
khr_df_sample_datatype_qualifiers_e dt
= static_cast<khr_df_sample_datatype_qualifiers_e>(0),
khr_df_transfer_e t = KHR_DF_TRANSFER_UNSPECIFIED,
khr_df_primaries_e p = KHR_DF_PRIMARIES_BT709,
khr_df_model_e m = KHR_DF_MODEL_RGBSDA,
khr_df_flags_e f = KHR_DF_FLAG_ALPHA_STRAIGHT)
: ImageSpec(w, h, d, Origin(), channelCount,
channelBitLengths, channelTypes, dt, t, p, m, f) { }
channelBitLengths, channelIds, dt, t, p, m, f) { }

ImageSpec(uint32_t w, uint32_t h, uint32_t d, Origin&& o,
uint32_t channelCount, std::vector<uint32_t>& channelBitLengths,
std::vector<khr_df_model_channels_e>& channelTypes,
std::vector<khr_df_model_channels_e>& channelIds,
khr_df_sample_datatype_qualifiers_e dt
= static_cast<khr_df_sample_datatype_qualifiers_e>(0),
khr_df_transfer_e t = KHR_DF_TRANSFER_UNSPECIFIED,
khr_df_primaries_e p = KHR_DF_PRIMARIES_BT709,
khr_df_model_e m = KHR_DF_MODEL_RGBSDA,
khr_df_flags_e f = KHR_DF_FLAG_ALPHA_STRAIGHT)
: formatDesc(channelCount, channelBitLengths,
channelTypes, dt, t, p, m, f),
channelIds, dt, t, p, m, f),
imageWidth(w), imageHeight(h), imageDepth(d), imageOrigin(o) { }


Expand Down
12 changes: 6 additions & 6 deletions tools/ktx/command_compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ Compare two KTX2 files.
If any of the specified input files are invalid then comparison is done based on best effort
and may be incomplete.

The JSON output formats conform to the https://schema.khronos.org/ktx/compare_v0.json
The JSON output formats conform to the https://schema.khronos.org/ktx/compare_v1.json
schema even if the input file is invalid and certain information cannot be parsed or
displayed.
Additionally, for JSON outputs the KTX file identifier is printed using "\u001A" instead of
Expand Down Expand Up @@ -1351,7 +1351,7 @@ void CommandCompare::executeCompare() {

PrintIndent out{std::cout, baseIndent, indentWidth};
out(0, "{{{}", nl);
out(1, "\"$schema\":{}\"https://schema.khronos.org/ktx/compare_v0.json\",{}", space, nl);
out(1, "\"$schema\":{}\"https://schema.khronos.org/ktx/compare_v1.json\",{}", space, nl);

for (std::size_t i = 0; i < inputStreams.size(); ++i) {
std::ostringstream messagesOS;
Expand Down Expand Up @@ -1740,12 +1740,12 @@ void CommandCompare::compareDFDBasic(PrintDiff& diff, uint32_t blockIndex,
fmt::format("/dataFormatDescriptor/blocks/{}/samples/{}/qualifiers", blockIndex, sampleIndex),
qualifierFlags[0], qualifierFlags[1], dfdToStringSampleDatatypeQualifiersBit);

diff << DiffEnum<khr_df_model_channels_e>(" Channel Type",
fmt::format("/dataFormatDescriptor/blocks/{}/samples/{}/channelType", blockIndex, sampleIndex),
OPT_BITFIELDS(samples, channelType),
diff << DiffEnum<khr_df_model_channels_e>(" Channel Id",
fmt::format("/dataFormatDescriptor/blocks/{}/samples/{}/channelId", blockIndex, sampleIndex),
OPT_BITFIELDS(samples, channelId),
[&](auto i) {
return dfdToStringChannelId(khr_df_model_e(bdfds[i]->model),
khr_df_model_channels_e(samples[i]->channelType));
khr_df_model_channels_e(samples[i]->channelId));
})
.outputHexInText();

Expand Down
6 changes: 3 additions & 3 deletions tools/ktx/command_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ void CommandExtract::unpackAndSave422(std::string filepath, bool appendExtension
uint32_t vPositionX = 0;

for (const auto& sample : format.samples) {
switch (sample.channelType) {
switch (sample.channelId) {
case KHR_DF_CHANNEL_YUVSDA_Y:
if (y0Bits != 0) {
y1Offset = sample.bitOffset;
Expand Down Expand Up @@ -888,8 +888,8 @@ void CommandExtract::saveEXR(std::string filepath, bool appendExtension,
std::vector<Channel> channels;

if (format.model() == KHR_DF_MODEL_RGBSDA) {
const auto addChannel = [&](auto channelType, const char* channelName) {
if (const auto sample = format.find(channelType))
const auto addChannel = [&](auto channelId, const char* channelName) {
if (const auto sample = format.find(channelId))
channels.push_back({
sample->bitOffset,
sample->bitLength + 1u,
Expand Down
4 changes: 2 additions & 2 deletions tools/ktx/command_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Print information about a KTX2 file.
found errors and warnings to stdout. If the specified input file is invalid the information
is displayed based on best effort and may be incomplete.

The JSON output formats conform to the https://schema.khronos.org/ktx/info_v0.json
The JSON output formats conform to the https://schema.khronos.org/ktx/info_v1.json
schema even if the input file is invalid and certain information cannot be parsed or
displayed.
Additionally, for JSON outputs the KTX file identifier is printed using "\u001A" instead of
Expand Down Expand Up @@ -213,7 +213,7 @@ KTX_error_code CommandInfo::printInfoJSON(std::istream& file, bool minified) {

PrintIndent out{std::cout, base_indent, indent_width};
out(0, "{{{}", nl);
out(1, "\"$schema\":{}\"https://schema.khronos.org/ktx/info_v0.json\",{}", space, nl);
out(1, "\"$schema\":{}\"https://schema.khronos.org/ktx/info_v1.json\",{}", space, nl);
out(1, "\"valid\":{}{},{}", space, validationResult == 0, nl);
if (!first) {
out(1, "\"messages\":{}[{}", space, nl);
Expand Down
2 changes: 1 addition & 1 deletion tools/ktx/format_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace ktx {
auto& sample = samples.emplace_back();
sample.bitOffset = KHR_DFDSVAL(bdfd, i, BITOFFSET);
sample.bitLength = KHR_DFDSVAL(bdfd, i, BITLENGTH);
sample.channelType = KHR_DFDSVAL(bdfd, i, CHANNELID);
sample.channelId = KHR_DFDSVAL(bdfd, i, CHANNELID);
const auto dataType = KHR_DFDSVAL(bdfd, i, QUALIFIERS);
sample.qualifierFloat = (dataType & KHR_DF_SAMPLE_DATATYPE_FLOAT) != 0;
sample.qualifierSigned = (dataType & KHR_DF_SAMPLE_DATATYPE_SIGNED) != 0;
Expand Down
Loading
Loading