Skip to content

Commit 19c2f75

Browse files
authored
Fix issues newly flagged by Doxygen 1.11.0 (#925)
Some were genuine issues that surprisingly weren't flagged before: `astc_encode.cpp`, `ktx2check.c`. One is a change to an existing Doxygen issue that caused a previously working reference to not be found: `vkloader.c`. Includes these other documentation related changes: 1. Change several ktxTexture references in ktxTexture2 to ktxTexture2 references. 2. Update CI to install `graphviz` of which `dot` is part. With `dot` Doxygen provides nice include dependency, inverse include dependency, inheritance and other graphs. 3. Make Doxygen skip the documentation for the ktxTexture macro as the existence of a same-named macro causes Doxygen to fail to make intra-class cross-references in the ktxTexture class. 4. Fine tune the deprecation statements. 5. Remove names from `@file` commands. These are unnecessary and error-prone. Three mismatches were spotted during this work. **IMPORTANT** Documentation for releases must not be generated with Doxygen 1.11.0 as it has a bug that causes it to not add snippets to generated pages. See doxygen/doxygen#10957.
1 parent 86e6e0b commit 19c2f75

76 files changed

Lines changed: 175 additions & 130 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/windows.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,33 +154,41 @@ jobs:
154154
if: github.ref_type == 'tag' && matrix.check_mkvk != 'ONLY'
155155
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }}
156156

157-
# Need doxygen if docs are supposed to be built.
158-
# Note this suffers frequent failures due to Chocolatey attempts
157+
# Need doxygen and graphviz if docs are supposed to be built.
158+
# Note these suffer frequent failures due to Chocolatey attempts
159159
# to blackmail you into purchasing a license. Hence we retry a
160160
# few times. If this still fails, re-run the build.
161-
- name: Install Doxygen
161+
- name: Install Doxygen and Graphviz
162162
if: matrix.options.doc == 'ON'
163163
#run: choco install doxygen.install
164+
#run: choco install graphviz
164165
run: |
165-
$retryCount = 4
166-
$success = $false
167-
for ($i = 1; $i -le $retryCount; $i++) {
168-
Write-Host "Attempt no: $i"
169-
choco install doxygen.install --no-progress
170-
if ($LASTEXITCODE -eq 0) {
171-
$success = $true
172-
Write-Host "Installation successful."
173-
break
174-
} else {
175-
Write-Host "Installation failed. Retrying..."
176-
Start-Sleep -Seconds (2*$i)
166+
function Install-WithChoco {
167+
param ( $Package )
168+
$retryCount = 4
169+
$success = $false
170+
for ($i = 1; $i -le $retryCount; $i++) {
171+
Write-Host "Attempt no $i for $Package"
172+
# Without | Out-Host the choco output becomes output of this
173+
# function because it is called from within `if`.
174+
choco install $Package --no-progress --yes | Out-Host
175+
if ($LASTEXITCODE -eq 0) {
176+
$success = $true
177+
Write-Host "$Package installation successful."
178+
break
179+
} else {
180+
Write-Host "$Package installation failed. Retrying..."
181+
Start-Sleep -Seconds (2*$i)
182+
}
183+
}
184+
if (-not $success) {
185+
Write-Host "$Package installation failed after $retryCount attempts."
177186
}
187+
return $success
178188
}
179-
if (-not $success) {
180-
Write-Host "Installation failed after $retryCount attempts."
189+
if (-not ((Install-WithChoco doxygen.install) -and (Install-WithChoco graphviz))) {
181190
exit 1
182191
}
183-
184192
- name: Install AzureSignTool
185193
if: matrix.check_mkvk != 'ONLY'
186194
id: install-ast

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ addons:
2020
update: false
2121
packages:
2222
- git-lfs
23-
- doxygen
2423

2524
env:
2625
global:
@@ -107,6 +106,7 @@ jobs:
107106
addons:
108107
apt:
109108
packages:
109+
- graphviz
110110
- python3
111111
- python3-venv
112112
compiler: gcc
@@ -127,6 +127,7 @@ jobs:
127127
addons:
128128
apt:
129129
packages:
130+
- graphviz
130131
- python3
131132
- python3-venv
132133
compiler: gcc
@@ -246,6 +247,10 @@ install:
246247
brew install sdl2
247248
brew install assimp
248249
fi
250+
if [ "$FEATURE_DOC" = "ON" ]; then
251+
brew install doxygen
252+
brew install graphviz
253+
fi
249254
./scripts/install_macos.sh
250255
fi
251256
;;

BUILDING.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,23 @@ For iOS and macOS, install the Vulkan SDK by downloading the macOS installer and
570570
571571
### Doxygen
572572
573-
Needed if you want to generate the _libktx_ and _ktxtools_ documentation.
573+
Needed if you want to generate _libktx_, _ktxtools_ and other documentation.
574574
575-
You need a minimum of version 1.8.14 to generate the documentation correctly. You
576-
can download binaries and also find instructions for building it from source at
577-
[Doxygen downloads](http://www.stack.nl/~dimitri/doxygen/download.html). Make
575+
You need a minimum of version 1.8.14 to generate the documentation correctly.
576+
You can download binaries and also find instructions for building it from source
577+
at [Doxygen downloads](http://www.stack.nl/~dimitri/doxygen/download.html). Make
578578
sure the directory containing the `doxygen` executable is in your `$PATH`.
579579
580+
### dot (Graphviz)
581+
582+
Needed if you want Doxygen to generate include dependency, inverse include
583+
dependency, inheritance and other graphs in the generated documentation.
584+
585+
You can download binaries from
586+
[Graphviz downloads](https://graphviz.org/download/).
587+
588+
Optional. If not present documentation will be generated minus graphs.
589+
580590
### libassimp
581591
582592
Needed if you want to build the KTX load tests.

cmake/docs.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# Copyright 2015-2020 The Khronos Group Inc.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
find_package(Doxygen REQUIRED)
4+
# dot is optional as missing include dependency graphs and
5+
# inheritance graphs is not a big enough deal to justify
6+
# forcing people to install Graphviz.
7+
find_package(Doxygen REQUIRED OPTIONAL_COMPONENTS dot)
8+
if(NOT DOXYGEN_DOT_EXECUTABLE)
9+
message(NOTICE "dot executable not found so Doxygen will not generate\n"
10+
"include dependency or inheritance graphs in the documentation.\n"
11+
"If you want these graphs, install Graphviz.")
12+
endif()
513

614
set(docdest "${CMAKE_CURRENT_BINARY_DIR}/docs")
715

@@ -85,6 +93,7 @@ function( CreateDocLibKTX )
8593
set( DOXYGEN_EXPAND_ONLY_PREDEF YES )
8694
8795
set( DOXYGEN_PREDEFINED
96+
KTX_DOXYGEN_SKIP
8897
"KTXTEXTURECLASSDEFN=class_id classId\; \\
8998
struct ktxTexture_vtbl* vtbl\; \\
9099
struct ktxTexture_vvtbl* vvtbl\; \\

include/KHR/khr_df.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#ifndef _KHR_DATA_FORMAT_H_
1818
#define _KHR_DATA_FORMAT_H_
1919

20-
/** @file khr_df.h
21-
22-
@brief Data Format enums and macros.
23-
*/
20+
/** @file
21+
* @~English
22+
* @brief Data Format enums and macros.
23+
*/
2424

2525
/* Accessors */
2626
typedef enum _khr_word_e {

include/ktx.h

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ typedef enum ktx_error_code_e {
191191
KTX_ERROR_MAX_ENUM = KTX_DECOMPRESS_CHECKSUM_ERROR /*!< For safety checks. */
192192
} ktx_error_code_e;
193193
/**
194-
* @deprecated
195194
* @~English
195+
* @deprecated Use #ktx_error_code_e.
196196
* @brief For backward compatibility
197197
*/
198198
#define KTX_error_code ktx_error_code_e
@@ -719,12 +719,24 @@ typedef struct ktxTexture2 {
719719
struct ktxTexture2_private* _private; /*!< Private data. */
720720
} ktxTexture2;
721721

722-
/**
723-
* @brief Helper for casting ktxTexture1 and ktxTexture2 to ktxTexture.
722+
/*
723+
* If Doxygen sees this macro it gets confused and fails to spot
724+
* references to ktxTexture_*() functions in the running text. It
725+
* also complains it can't find the reference when @ref is used
726+
* with a fully qualified method name to make an intra-class
727+
* reference in the @c ktxTexture class.
728+
* See https://github.com/doxygen/doxygen/issues/10311.
724729
*
725-
* Use with caution.
726-
*/
727-
#define ktxTexture(t) ((ktxTexture*)t)
730+
* Not documenting the macro is the lesser of two evils.
731+
*/
732+
#if !defined(KTX_DOXYGEN_SKIP)
733+
/**
734+
* @brief Helper for casting ktxTexture1 and ktxTexture2 to ktxTexture.
735+
*
736+
* Use with caution.
737+
*/
738+
#define ktxTexture(t) ((ktxTexture*)t)
739+
#endif
728740

729741
/**
730742
* @memberof ktxTexture
@@ -1391,7 +1403,7 @@ typedef struct ktxBasisParams {
13911403
Only valid for linear textures.
13921404
*/
13931405
ktx_bool_t separateRGToRGB_A;
1394-
/*!< @deprecated. This was and is a no-op. 2-component inputs have
1406+
/*!< @deprecated This was and is a no-op. 2-component inputs have
13951407
always been automatically separated using an "rrrg" inputSwizzle.
13961408
@sa inputSwizzle and normalMode.
13971409
*/
@@ -1586,25 +1598,25 @@ typedef enum ktx_transcode_fmt_e {
15861598
// Old enums for compatibility with code compiled against previous
15871599
// versions of libktx.
15881600
KTX_TF_ETC1 = KTX_TTF_ETC1_RGB,
1589-
//!< @deprecated. Use #KTX_TTF_ETC1_RGB.
1601+
//!< @deprecated Use #KTX_TTF_ETC1_RGB.
15901602
KTX_TF_ETC2 = KTX_TTF_ETC,
1591-
//!< @deprecated. Use #KTX_TTF_ETC.
1603+
//!< @deprecated Use #KTX_TTF_ETC.
15921604
KTX_TF_BC1 = KTX_TTF_BC1_RGB,
1593-
//!< @deprecated. Use #KTX_TTF_BC1_RGB.
1605+
//!< @deprecated Use #KTX_TTF_BC1_RGB.
15941606
KTX_TF_BC3 = KTX_TTF_BC3_RGBA,
1595-
//!< @deprecated. Use #KTX_TTF_BC3_RGBA.
1607+
//!< @deprecated Use #KTX_TTF_BC3_RGBA.
15961608
KTX_TF_BC4 = KTX_TTF_BC4_R,
1597-
//!< @deprecated. Use #KTX_TTF_BC4_R.
1609+
//!< @deprecated Use #KTX_TTF_BC4_R.
15981610
KTX_TF_BC5 = KTX_TTF_BC5_RG,
1599-
//!< @deprecated. Use #KTX_TTF_BC5_RG.
1611+
//!< @deprecated Use #KTX_TTF_BC5_RG.
16001612
KTX_TTF_BC7_M6_RGB = KTX_TTF_BC7_RGBA,
1601-
//!< @deprecated. Use #KTX_TTF_BC7_RGBA.
1613+
//!< @deprecated Use #KTX_TTF_BC7_RGBA.
16021614
KTX_TTF_BC7_M5_RGBA = KTX_TTF_BC7_RGBA,
1603-
//!< @deprecated. Use #KTX_TTF_BC7_RGBA.
1615+
//!< @deprecated Use #KTX_TTF_BC7_RGBA.
16041616
KTX_TF_BC7_M6_OPAQUE_ONLY = KTX_TTF_BC7_RGBA,
1605-
//!< @deprecated. Use #KTX_TTF_BC7_RGBA
1617+
//!< @deprecated Use #KTX_TTF_BC7_RGBA
16061618
KTX_TF_PVRTC1_4_OPAQUE_ONLY = KTX_TTF_PVRTC1_4_RGB
1607-
//!< @deprecated. Use #KTX_TTF_PVRTC1_4_RGB.
1619+
//!< @deprecated Use #KTX_TTF_PVRTC1_4_RGB.
16081620
} ktx_transcode_fmt_e;
16091621

16101622
/**

lib/astc_encode.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* @internal
11-
* @file astc_encode.cpp
11+
* @file
1212
* @~English
1313
*
1414
* @brief Functions for compressing a texture to ASTC format.
@@ -201,7 +201,7 @@ unorm8x4ArrayToImage(const uint8_t *data, uint32_t dim_x, uint32_t dim_y) {
201201

202202
/**
203203
* @memberof ktxTexture
204-
* @ingroup write
204+
* @ingroup writer
205205
* @~English
206206
* @brief Creates default ASTC parameters
207207
*
@@ -222,7 +222,7 @@ astcDefaultOptions() {
222222

223223
/**
224224
* @memberof ktxTexture
225-
* @ingroup write
225+
* @ingroup writer
226226
* @~English
227227
* @brief Should be used to get VkFormat from ASTC block enum
228228
*
@@ -291,7 +291,7 @@ astcVkFormat(ktx_uint32_t block_size, bool sRGB) {
291291

292292
/**
293293
* @memberof ktxTexture
294-
* @ingroup write
294+
* @ingroup writer
295295
* @~English
296296
* @brief Creates valid ASTC encoder action from string.
297297
*
@@ -320,7 +320,7 @@ astcEncoderAction(const ktxAstcParams &params, const uint32_t* bdb) {
320320

321321
/**
322322
* @memberof ktxTexture
323-
* @ingroup write
323+
* @ingroup writer
324324
* @~English
325325
* @brief Creates valid ASTC encoder swizzle from string.
326326
*

lib/basis_encode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* @internal
11-
* @file basis_encode.cpp
11+
* @file
1212
* @~English
1313
*
1414
* @brief Functions for supercompressing a texture with Basis Universal.

lib/basis_transcode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* @internal
11-
* @file basis_transcode.cpp
11+
* @file
1212
* @~English
1313
*
1414
* @brief Functions for transcoding Basis Universal BasisLZ/ETC1S and UASTC textures.

lib/checkheader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/**
1212
* @internal
13-
* @file checkheader.c
13+
* @file
1414
* @~English
1515
*
1616
* @brief Function to verify a KTX file header

0 commit comments

Comments
 (0)