diff --git a/.appveyor.yml b/.appveyor.yml index d8b4856864..220823e019 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -245,13 +245,13 @@ deploy: # Deploy to GitHub Releases provider: GitHub auth_token: - secure: ZEoxs4bA/iVAEfPdQOVDq0fyKA6eyecgyvQ0/1kMu6ic2+H6Aua6kPk2hNvWG4tM + secure: ts/Kjg56NnVMgXsM2J/4jXA3W9kIA58rg4B32uRuJDqyNRmkAGWlCXP9Zbp29Uip # Don't set so tag name will be used as release name. #release: # Can't get this to work using artifact.path so use artifact.name set above. artifact: WindowsInstaller,WindowsInstallerSha1 draft: true - #prerelease: true + prerelease: true on: APPVEYOR_REPO_TAG: true # deploy on tag push only APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 diff --git a/.travis.yml b/.travis.yml index 916db93409..f61a958397 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ env: - FEATURE_TESTS: ON - GIT_LFS_SKIP_SMUDGE: 1 - PACKAGE: NO + - REL_DESC_FILE: "$BUILD_DIR/rel_desc.md" - VULKAN_SDK_VER: "1.2.176.1" # This is just to tell the Vulkan install script where to install. - VULKAN_INSTALL_DIR: "$HOME/VulkanSDK/$VULKAN_SDK_VER" @@ -45,7 +46,7 @@ env: SUPPORT_SSE=ON SUPPORT_OPENCL=OFF - CONFIGURATION=Release PLATFORM=macOS ARCHS=x86_64 FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_LOADTESTS=ON FEATURE_TOOLS=ON - SUPPORT_SSE=ON SUPPORT_OPENCL=OFF PACKAGE=YES + SUPPORT_SSE=ON SUPPORT_OPENCL=OFF DEPLOY_DOCS=YES PACKAGE=YES - CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64 FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_LOADTESTS=ON FEATURE_TESTS=OFF FEATURE_TOOLS=ON SUPPORT_SSE=ON SUPPORT_OPENCL=OFF PACKAGE=YES @@ -251,6 +252,7 @@ after_success: before_deploy: - | + gem install octokit mime-types case "${TRAVIS_OS_NAME:-linux}" in linux) ;; @@ -266,48 +268,89 @@ before_deploy: if [ -n "$MACOS_CERTIFICATES_P12" -a -n "$TRAVIS_TAG" -a -z "$NOTARIZED" ]; then ./ci_scripts/notarize.sh $BUILD_DIR/KTX-Software-*.pkg $APPLE_ID $DEVELOPMENT_TEAM $ALTOOL_PASSWORD; export NOTARIZED="true" fi - if [ -z "$RELNOTES" -a -f RELEASE_NOTES.md ]; then - # Copy RELEASE_NOTES into an env. var. so we can remove lines that are - # unnecessary in the context of a GitHub release description. - RELNOTES=$(cat RELEASE_NOTES.md | awk '/^Release Notes/,/^## Version/ { next } - ! / + Release Notes ============= -## Version 4.0.0 -### Significant Changes since Release Candidate 1 +## Version 4.1.0 +### New Features in v4.1.0 -* Basis Universal has been updated to version 1.15. +* ARM's ASTC encoder has been added to `libktx`. As a result you can now use `toktx` to create KTX files with ASTC encoded payloads. -* Errors in both `ktx2check` and `ktxinfo` causing bogus out of memory messages when there is no metadata or an empty value have been fixed. +* Full normal map handling has been added. 3-component normal maps can be +converted to 2-component and the components separated into the RGB and alpha channels of ASTC, ETC1S or UASTC compressed textures. A `--normalize` option has been added to `toktx` to convert an input normal map to unit normals which are needed to allow the third component to be recreated in a shader. -* An issue in msc\_basis\_transcoder causing intermittent Javascript -"Cannot perform Construct on a detached ArrayBuffer" errors has been -fixed. _NOTE:_ that msc\_basis\_transcoder is deprecated and will be -replaced by the transcoder wrapper from the -[Basis Universal](https://github.com/BinomialLLC/basis_universal) -repository. +* A Java wrapper and JNI module for `libktx` has been added. -### Known Issues in v4.0.0. +* An install package for Apple Silicon has been added. + +* The formerly internal `ktxStream` class has been exposed enabling possibilities such as wrapping a ktxStream around a C++ stream so that textures can be created from the C++ stream's content. See [sbufstream.h](https://github.com/KhronosGroup/KTX-Software/blob/master/utils/sbufstream.h) + +* `ktx2check` now verifies BasisLZ supercompression data by performing a transcode. + +### Significant Changes since v4.0.0 + +* Basis Universal has been updated to version 1.16.3. + * The ETC1S encoder performance is now approximastely 30% faster. + * Optional OpenCL support has been added to the ETC1S encoder. Add `-D SUPPORT_OPENCL` when configuring the CMake build to enable it. As OpenCL may not be any faster when encoding individual files - it highly depends on your hardware - it is disabled in the default build and release packages. + +### Known Issues in v4.1.0. * `toktx` will not read JPEG files with a width or height > 32768 pixels. -* `toktx` will not read 4-component JPEG files such as those sometimes -created by Adobe software where the 4th component can be used to re-create -a CMYK image. - -* Emscripten versions greater than 2.0.15 have an -[issue](https://github.com/emscripten-core/emscripten/issues/13926) -that causes the Javascript wrapper for libktx to fail. The downloadable -package `KTX-Software-4.0.0-rc1-Web-libktx.zip` has been built with -Emscripten 2.0.15. You only need to be aware of this if building the -wrapper yourself with your own installed emsdk. - -* Users making Basisu encoded or block compressed textures for WebGL -must be aware of WebGL restrictions with regard to texture size and -may need to resize images appropriately using the --resize feature -of `toktx`. In general the dimensions of block compressed textures -must be a multiple of the block size and, if -`WEBGL_compressed_texture_s3tc` on WebGL 1.0 is expected to be one -of the targets, then the dimensions must be a power of 2. For -portability glTF's KHR\_texture\_basisu extension requires texture -dimensions to be a multiple of 4, the block size of the Universal texture -formats. - -* Basis Universal encoding results (both ETC1S/LZ and UASTC) are -non-deterministic across platforms. Results are valid but level -sizes and data will differ slightly. -See [issue #60](https://github.com/BinomialLLC/basis_universal/issues/60) -in the basis_universal repository. - -* UASTC RDO results differ from run to run unless multi-threading -or RDO multi-threading is disabled. In `toktx` use `--threads 1` for the -former or `--uastc_rdo_m` for the latter. As with the preceeding issue -results are valid but level sizes will differ slightly. See -[issue #151](https://github.com/BinomialLLC/basis_universal/issues/151) -in the basis_universal repository. - -### Changes since v4.0.0-rc1 (by part) +* `toktx` will not read 4-component JPEG files such as those sometimes created by Adobe software where the 4th component can be used to re-create a CMYK image. + +* Users making Basisu encoded or block compressed textures for WebGL must be aware of WebGL restrictions with regard to texture size and may need to resize images appropriately using the --resize feature of `toktx`. In general the dimensions of block compressed textures must be a multiple of the block size and for WebGL 1.0 must be a power of 2. For portability glTF's _KHR\_texture\_basisu_ extension requires texture dimensions to be a multiple of 4, the block size of the Universal texture formats. + +* Basis Universal encoding results (both ETC1S/LZ and UASTC) are non-deterministic across platforms. Results are valid but level sizes and data will differ slightly. See [issue #60](https://github.com/BinomialLLC/basis_universal/issues/60) in the basis_universal repository. + +* UASTC RDO results differ from run to run unless multi-threading or RDO multi-threading is disabled. In `toktx` use `--threads 1` for the former or `--uastc_rdo_m` for the latter. As with the preceeding issue results are valid but level sizes will differ slightly. See [issue #151](https://github.com/BinomialLLC/basis_universal/issues/151) in the basis_universal repository. + +### Changes since v4.0.0 (by part) ### libktx -* Adapt for Basisu 1.15. (a0642fa1) (@MarkCallow) +* git subrepo pull (merge) lib/astc-encoder (51f47631) (@MarkCallow) + +* git subrepo pull (merge) lib/dfdutils (7c24a986) (@MarkCallow) + +* git subrepo pull (merge) lib/dfdutils (c5abc161) (@MarkCallow) + +* Farewell GYP. :-( (f1f04a7e) (@MarkCallow) + +* Miscellaneous fixes (#558) (66f6d750) (@MarkCallow) + +* Fix new in clang 13.1 (Xcode13.3) warnings (#553) (b8d462b0) (@MarkCallow) + +* Fix non-clang warnings (#549) (4e7e40a0) (@MarkCallow) + +* Split each build configuration into a separate CI job. (#546) (9d1204cc) (@MarkCallow) + +* Update to Basis1.16.3 (#543) (c65cfd0d) (@MarkCallow) + +* Remove image.hpp dependency (#542) (9fde96b9) (@wasimabbas-arm) + +* Update to Basis 1.16.1 (#541) (cb45eadc) (@MarkCallow) + +* git subrepo pull (merge) lib/astc-encoder (#540) (d98aa680) (@wasimabbas-arm) + +* git subrepo pull (merge) lib/astc-encoder (#537) (dbfeb82a) (@wasimabbas-arm) + +* Add astc perceptual mode support (#534) (57e62de1) (@wasimabbas-arm) + +* Improve Astc & BasisU normal map support (#493) (2d6ff949) (@wasimabbas-arm) + +* git subrepo pull lib/dfdutils (5ff4811c) (@MarkCallow) + +* git subrepo push lib/dfdutils (ce2a4619) (@MarkCallow) + +* Calculate dst buffer size with ZSTD\_compressBound. (#527) (81d2be5c) (@MarkCallow) + +* Remove extraneous token concatenation operator. (a8f4a71d) (@MarkCallow) + +* Fix malloc/delete pair. (0a3fe5b1) (@sergeyext) + +* Manually update git-subrepo parent (929c75c3) (@wasimabbas-arm) + +* git subrepo pull (merge) lib/astc-encoder (f5daffea) (@wasimabbas-arm) + +* Fix parent commit pointer. (1a356d0e) (@MarkCallow) + +* git subrepo pull (merge) lib/basisu (24c9f7bb) (@MarkCallow) + +* Move common params out from ETC1S case. (a2ccc90e) (@MarkCallow) - * Use zstd included in basisu. - * Regen reference images with updated ETC1S encoder and newer zstd version. +* Remove transferFunction from astc options (#482) (1f085d30) (@wasimabbas-arm) -* git subrepo pull lib/basisu (c7211336) (@MarkCallow) +* Fix leak in zstd inflation. Fixes #465. (720b6cf3) (@MarkCallow) - subrepo: - subdir: "lib/basisu" - merged: "5337227c" - upstream: - origin: "https://github.com/BinomialLLC/basis\_universal.git" - branch: "master" - commit: "5337227c" - git-subrepo: - version: "0.4.3" - origin: "https://github.com/MarkCallow/git-subrepo.git" - commit: "c1f1132" +* Support array and 3d textures. (#468) (b0532530) (@MarkCallow) -* Point .gitsubrepo at correct parent. (02c43d57) (@MarkCallow) +* Add more astc tests (#460) (14284e7d) (@wasimabbas-arm) -* Minor reformat (#399) (a78c3b46) (@lexaknyazev) +* Add astc support (#433) (da435dee) (@wasimabbas-arm) -* Handle PVRTC1 minimum 2 block requirement. Fixes issue #390. (#398) (2034ce71) (@MarkCallow) +* Actually byte swap keyAndValueByteSize values. Fix issue #447. (00118086) (@MarkCallow) -* Fix: Handle metadata with empty values. (02652303) (@MarkCallow) +* Add KTXmetalPixelFormat to valid list used by ktxTexture2\_WriteToStream. (871f111d) (@MarkCallow) - Incidental to the main fix, fix memory leaks in texturetests. +* Fix astc-encoder/.gitrepo parent after latest pull. (f99221eb) (@MarkCallow) -* Fix: properly handle 0 length kvdata. (aee7a1c5) (@MarkCallow) +* git subrepo pull (merge) lib/astc-encoder (66692454) (@MarkCallow) -* Fix error in example. (b7563ea6) (@MarkCallow) +* Fix astc-encoder/.gitrepo parent pointer. (f39b13b1) (@MarkCallow) -* 2 small fixes: (50000ca6) (@MarkCallow) +* Fix memory leak in VkUpload (#448) (2b2b48fa) (@bin) - * Raise error in GLUpload on attempted upload of universal texture. - * In ktx2check don't combine FLOAT & NORM when checking VK\_FORMAT name. +* Fix: if ("GL\_EXT\_texture\_sRGB") is supported,then srgb should be supported (#446) (13f17410) (@dusthand) + +* git subrepo commit (merge) lib/astc-encoder (1264f867) (@MarkCallow) + +* git subrepo pull (merge) lib/astc-encoder (15369663) (@MarkCallow) + +* Make `ktxStream` public (#438) (78929f80) (@UberLambda) + +* git subrepo pull (merge) lib/astc-encoder (535c883b) (@MarkCallow) + +* Fix mismatched malloc and delete (#440) (9d42b86f) (@cperthuisoc) + +* Cleanup Vulkan SDK environment variables. (354f640e) (@MarkCallow) + +* git subrepo pull (merge) lib/astc-encoder (3e75b6a3) (@MarkCallow) + +* Remove unneeded parts of astc-encoder. (360d10bb) (@MarkCallow) + +* git subrepo clone https://github.com/ARM-software/astc-encoder.git lib/astc-encoder (db359593) (@MarkCallow) + +* Raise warning levels to /W4 & -Wall -Wextra (#418) (ca6f6e7d) (@MarkCallow) + +* Minor build tweaks (#407) (6a38a069) (@MarkCallow) ### Tools -* Copy all image attributes when resampling. (83518cdc) (@MarkCallow) +* Farewell GYP. :-( (f1f04a7e) (@MarkCallow) + +* Miscellaneous fixes (#558) (66f6d750) (@MarkCallow) + +* Add JNI component and integrate Java build & test with CMake (#556) (e29e0996) (@MarkCallow) + +* Fix non-clang warnings (#549) (4e7e40a0) (@MarkCallow) + +* Fix VS warnings (#544) (8c6b3571) (@wasimabbas-arm) + +* Remove image.hpp dependency (#542) (9fde96b9) (@wasimabbas-arm) + +* Update to Basis 1.16.1 (#541) (cb45eadc) (@MarkCallow) -* Skip mipPadding also when no sgd or kvd. Fixes #395. (#396) (fa739a2d) (@MarkCallow) +* Improve Astc & BasisU normal map support (#493) (2d6ff949) (@wasimabbas-arm) -* 2 small fixes: (50000ca6) (@MarkCallow) +* Validate BasisU Transcode (#532) (39e2d96e) (@MarkCallow) - * Raise error in GLUpload on attempted upload of universal texture. - * In ktx2check don't combine FLOAT & NORM when checking VK\_FORMAT name. +* Fix mismatched errors for required and optional index entries. (b8786496) (@MarkCallow) +* fix missing -w flag for ktx2check (eade072d) (@sidsethupathi) +* Remove transferFunction from astc options (#482) (1f085d30) (@wasimabbas-arm) + +* Ensure NUL on end of 3d orientation. (74501ef3) (@MarkCallow) + +* Support array and 3d textures. (#468) (b0532530) (@MarkCallow) + +* Fix checks for mismatched image attributes. (#466) (4eca0ef3) (@MarkCallow) + +* Add more astc tests (#460) (14284e7d) (@wasimabbas-arm) + +* Add astc support (#433) (da435dee) (@wasimabbas-arm) + +* macOS Apple Silicon support (#415) (ebab2ea8) (@atteneder) + +* Raise warning levels to /W4 & -Wall -Wextra (#418) (ca6f6e7d) (@MarkCallow) + +* Fix validation errors (#417) (78cd2b01) (@MarkCallow) ### JS Wrappers -* Obtain HEAP references after resizing vectors. (5bf11d8f) (@MarkCallow) +* Farewell GYP. :-( (f1f04a7e) (@MarkCallow) + +* Update to Basis 1.16.1 (#541) (cb45eadc) (@MarkCallow) + +* Raise warning levels to /W4 & -Wall -Wextra (#418) (ca6f6e7d) (@MarkCallow) + +### Java Wrapper + +* Workaround FindJNI searching for framework when JAVA\_HOME not set. (#566) (957a198b) (@MarkCallow) + +* Miscellaneous fixes (#558) (66f6d750) (@MarkCallow) + +* Add JNI component and integrate Java build & test with CMake (#556) (e29e0996) (@MarkCallow) + +* Fix warnings in JNI library and update to latest libktx API. (#548) (6f98b3c4) (@ShukantPal) + +* Update to Basis 1.16.1 (#541) (cb45eadc) (@MarkCallow) - Possible fix for issue #371. +* Feature: Java bindings for libktx (#481) (a7159924) (@ShukantPal) diff --git a/ci_scripts/github_release.rb b/ci_scripts/github_release.rb new file mode 100755 index 0000000000..ad1601c7eb --- /dev/null +++ b/ci_scripts/github_release.rb @@ -0,0 +1,123 @@ +#!/usr/bin/env ruby +# Copyright 2022 The Khronos Group Inc. +# SPDX-License-Identifier: Apache-2.0 + +# Thanks to Valerio Mazzeo (@valeriomazzeo) inspiring this. + +require 'optparse' +require 'ostruct' +require 'octokit' +require 'mime/types' + +options = OpenStruct.new +options.draft = false +options.overwrite = false +options.prerelease = false +OptionParser.new do |opt| + opt.on('-s', '--secret SECRET', 'GitHub access token') { |o| options[:secret] = o } + opt.on('-r', '--repo-slug REPO_SLUG', 'Repo slug. i.e.: apple/swift') { |o| options[:repo_slug] = o } + opt.on('-n', '--relnotes RELNOTES_STRING', 'Release notes') { |o| options[:relnotes] = o } + opt.on('-c', '--relnotes-file RELNOTES_FILE', 'Release notes path') { |o| options[:relnotes_file] = o } + opt.on('-t', '--tag TAG', 'Tag name') { |o| options[:tag_name] = o } + opt.on('-d', '--draft BOOLEAN', TrueClass, 'true if draft release') { |o| options[:draft] = o } + opt.on('-d', '--overwrite BOOLEAN', TrueClass, 'true to overwrite existing assets') { |o| options[:overwrite] = o } + opt.on('-p', '--prerelease BOOLEAN', TrueClass, 'true if prerelease') { |o| options[:prerelease] = o } +end.parse! + +raise OptionParser::MissingArgument if options[:secret].nil? +raise OptionParser::MissingArgument if options[:repo_slug].nil? +raise OptionParser::MissingArgument if options[:relnotes_file].nil? and options[:relnotes].nil? +raise OptionParser::MissingArgument if options[:tag_name].nil? + +client = Octokit::Client.new(:access_token => options[:secret]) +user = client.user +user.login + +unless client.scopes.include? 'public_repo' or client.scopes.include? 'repo' + raise Error, "Insufficient permissions. Make sure your token contains the repo or public_repo scope." +end + +puts "Logged in as #{user.name}" +puts "Deploying to repo: #{options[:repo_slug]}" + +if not options[:relnotes].nil? + body = options[:relnotes] +else + body = File.open(options[:relnotes_file], "rb").read +end + +tag_matched = false +our_release = nil +releases = client.releases(options[:repo_slug]) +releases.each do |release| + puts "Release tag_name = #{release.tag_name}" + if release.tag_name == options[:tag_name] + tag_matched= true + our_release = release + break + end +end +puts "tag #{options[:tag_name]} matched: #{tag_matched}." +if our_release + puts "our_release.url: #{our_release.url}." +end + +# if tag has been pushed directly to git, create a github release +if not our_release + our_release = client.create_release( + options[:repo_slug], + options[:tag_name], + { :name => options[:tag_name], + :draft => options[:draft], + :prerelease => options[:prerelease], + :body => body + }) +else + our_release = client.update_release(our_release.url, + { + :body => body, + :tag_name => our_release.tag_name, + :name => our_release.name, + :draft => our_release.draft, + :prerelease => our_release.prerelease + }) +end + +# We're not using this so it isn't thoroughly tested. Asset uploads +# are done using the Travis CI "releases" provider. +ARGV.each { |file| upload_file(file) } + +def upload_file(path) + #puts "uploading asset #{file} to #{our_release.url}" + file = normalize_filename(path) + asset = asset(file) + return info :skip_existing, file if asset && !overwrite? + delete(asset, file) if asset + info :upload_file, file + client.upload_asset(our_release.url, file, + {:name => file, :content_type => content_type(file)}) +end + +def asset(name) + client.release_assets(url).detect { |asset| asset.name == name } +end + +def content_type(file) + type = MIME::Types.type_for(file).first + type ||= 'application/octet-stream' + type.to_s +end + +def delete(asset, file) + info :overwrite_existing, file + client.delete_release_asset(asset.url) +end + +def normalize_filename(str) + str = File.basename(str) + str = str.split(' ').first + # We likely don't need transliterate as our package names are English. + # See https://github.com/travis-ci/dpl/blob/d104a6ec5fb0ba480875fe120d1e9e986824b9dc/lib/dpl/helper/transliterate.rb + #str = transliterate(str) # + str.gsub(/[^\w@+\-_]/, '.') +end diff --git a/cmake/docs.cmake b/cmake/docs.cmake index b613c3ca6f..907c847ab4 100644 --- a/cmake/docs.cmake +++ b/cmake/docs.cmake @@ -87,6 +87,8 @@ function( CreateDocLibKTX ) lib/strings.c lib/glloader.c lib/hashlist.c + lib/filestream.c + lib/memstream.c lib/texture.c lib/texture1.c lib/texture2.c diff --git a/include/ktx.h b/include/ktx.h index adfa2b851d..b1d4764a9b 100644 --- a/include/ktx.h +++ b/include/ktx.h @@ -861,27 +861,27 @@ typedef void (*ktxStream_destruct)(ktxStream* str); */ struct ktxStream { - ktxStream_read read; /*!< @internal pointer to function for reading bytes. */ - ktxStream_skip skip; /*!< @internal pointer to function for skipping bytes. */ - ktxStream_write write; /*!< @internal pointer to function for writing bytes. */ - ktxStream_getpos getpos; /*!< @internal pointer to function for getting current position in stream. */ - ktxStream_setpos setpos; /*!< @internal pointer to function for setting current position in stream. */ - ktxStream_getsize getsize; /*!< @internal pointer to function for querying size. */ - ktxStream_destruct destruct; /*!< @internal destruct the stream. */ + ktxStream_read read; /*!< pointer to function for reading bytes. */ + ktxStream_skip skip; /*!< pointer to function for skipping bytes. */ + ktxStream_write write; /*!< pointer to function for writing bytes. */ + ktxStream_getpos getpos; /*!< pointer to function for getting current position in stream. */ + ktxStream_setpos setpos; /*!< pointer to function for setting current position in stream. */ + ktxStream_getsize getsize; /*!< pointer to function for querying size. */ + ktxStream_destruct destruct; /*!< destruct the stream. */ enum streamType type; union { - FILE* file; - ktxMem* mem; + FILE* file; /**< a stdio FILE pointer for a ktxFileStream. */ + ktxMem* mem; /**< a pointer to a ktxMem struct for a ktxMemStream. */ struct { - void* address; - void* allocatorAddress; - ktx_size_t size; - } custom_ptr; - } data; /**< @internal pointer to the stream data. */ - ktx_off_t readpos; /**< @internal used by FileStream for stdin. */ - ktx_bool_t closeOnDestruct; /**< @internal Close FILE* or dispose of memory on destruct. */ + void* address; /**< pointer to the data. */ + void* allocatorAddress; /**< pointer to a memory allocator. */ + ktx_size_t size; /**< size of the data. */ + } custom_ptr; /**< pointer to a struct for custom streams. */ + } data; /**< pointer to the stream data. */ + ktx_off_t readpos; /**< used by FileStream for stdin. */ + ktx_bool_t closeOnDestruct; /**< Close FILE* or dispose of memory on destruct. */ }; /* diff --git a/lib/filestream.c b/lib/filestream.c index 6668a73759..5183c5a94e 100644 --- a/lib/filestream.c +++ b/lib/filestream.c @@ -55,7 +55,6 @@ #define KTX_FILE_STREAM_MAX (1 << (sizeof(ktx_off_t) - 1) - 1) /** - * @internal * @~English * @brief Read bytes from a ktxFileStream. * @@ -92,7 +91,6 @@ KTX_error_code ktxFileStream_read(ktxStream* str, void* dst, const ktx_size_t co } /** - * @internal * @~English * @brief Skip bytes in a ktxFileStream. * @@ -133,7 +131,6 @@ KTX_error_code ktxFileStream_skip(ktxStream* str, const ktx_size_t count) } /** - * @internal * @~English * @brief Write bytes to a ktxFileStream. * @@ -174,7 +171,6 @@ KTX_error_code ktxFileStream_write(ktxStream* str, const void *src, } /** - * @internal * @~English * @brief Get the current read/write position in a ktxFileStream. * @@ -219,13 +215,12 @@ KTX_error_code ktxFileStream_getpos(ktxStream* str, ktx_off_t* pos) } /** - * @internal * @~English * @brief Set the current read/write position in a ktxFileStream. * * Offset of 0 is the start of the file. This function operates * like Linux > 3.1's @c lseek() when it is passed a @c whence - * of @c SEEK_DATA is it returns and error if the seek would + * of @c SEEK_DATA as it returns an error if the seek would * go beyond the end of the file. * * @param [in] str pointer to the ktxStream whose r/w position is to be set. @@ -275,7 +270,6 @@ KTX_error_code ktxFileStream_setpos(ktxStream* str, ktx_off_t pos) } /** - * @internal * @~English * @brief Get the size of a ktxFileStream in bytes. * @@ -336,12 +330,13 @@ KTX_error_code ktxFileStream_getsize(ktxStream* str, ktx_size_t* size) } /** - * @internal * @~English * @brief Initialize a ktxFileStream. * * @param [in] str pointer to the ktxStream to initialize. * @param [in] file pointer to the underlying FILE object. + * @param [in] closeFileOnDestruct if not false, stdio file pointer will be closed when ktxStream + * is destructed. * * @return KTX_SUCCESS on success, KTX_INVALID_VALUE on error. * @@ -369,7 +364,6 @@ KTX_error_code ktxFileStream_construct(ktxStream* str, FILE* file, } /** - * @internal * @~English * @brief Destruct the stream, potentially closing the underlying FILE. * diff --git a/lib/memstream.c b/lib/memstream.c index 7c4040b56e..b963fa70ca 100644 --- a/lib/memstream.c +++ b/lib/memstream.c @@ -7,7 +7,6 @@ */ /** - * @internal * @file * @~English * @@ -32,7 +31,6 @@ #define KTX_MEM_DEFAULT_ALLOCATED_SIZE 256 /** - * @internal * @brief Structure to store information about data allocated for ktxMemStream. */ struct ktxMem @@ -47,7 +45,6 @@ struct ktxMem static KTX_error_code ktxMem_expand(ktxMem* pMem, const ktx_size_t size); /** - * @internal * @brief Initialize a ktxMem struct for read-write. * * Memory for the stream data is allocated internally but the @@ -70,7 +67,6 @@ ktxMem_construct(ktxMem* pMem) } /** - * @internal * @brief Create & initialize a ktxMem struct for read-write. * * @sa ktxMem_construct. @@ -98,7 +94,6 @@ ktxMem_create(ktxMem** ppMem) } /** - * @internal * @brief Initialize a ktxMem struct for read-only. * * @param [in] pMem pointer to the @c ktxMem to initialize. @@ -116,7 +111,6 @@ ktxMem_construct_ro(ktxMem* pMem, const void* bytes, ktx_size_t numBytes) } /** - * @internal * @brief Create & initialize a ktxMem struct for read-only. * * @sa ktxMem_construct. @@ -150,7 +144,6 @@ ktxMem_create_ro(ktxMem** ppMem, const void* bytes, ktx_size_t numBytes) */ /** - * @internal * @brief Free the memory of a struct ktxMem. * * @param pMem pointer to ktxMem to free. @@ -167,7 +160,6 @@ ktxMem_destroy(ktxMem* pMem, ktx_bool_t freeData) #ifdef KTXMEM_CLEAR_USED /** - * @internal * @brief Clear the data of a memory stream. * * @param pMem pointer to ktxMem to clear. @@ -181,7 +173,6 @@ ktxMem_clear(ktxMem* pMem) #endif /** - * @internal * @~English * @brief Expand a ktxMem to fit to a new size. * @@ -230,7 +221,6 @@ ktxMem_expand(ktxMem *pMem, const ktx_size_t newsize) } /** - * @internal * @~English * @brief Read bytes from a ktxMemStream. * @@ -269,7 +259,6 @@ KTX_error_code ktxMemStream_read(ktxStream* str, void* dst, const ktx_size_t cou } /** - * @internal * @~English * @brief Skip bytes in a ktxMemStream. * @@ -302,7 +291,6 @@ KTX_error_code ktxMemStream_skip(ktxStream* str, const ktx_size_t count) } /** - * @internal * @~English * @brief Write bytes to a ktxMemStream. * @@ -356,7 +344,6 @@ KTX_error_code ktxMemStream_write(ktxStream* str, const void* src, } /** - * @internal * @~English * @brief Get the current read/write position in a ktxMemStream. * @@ -380,7 +367,6 @@ KTX_error_code ktxMemStream_getpos(ktxStream* str, ktx_off_t* const pos) } /** - * @internal * @~English * @brief Set the current read/write position in a ktxMemStream. * @@ -410,7 +396,6 @@ KTX_error_code ktxMemStream_setpos(ktxStream* str, ktx_off_t pos) } /** - * @internal * @~English * @brief Get a pointer to a ktxMemStream's data. * @@ -419,7 +404,7 @@ KTX_error_code ktxMemStream_setpos(ktxStream* str, ktx_off_t pos) * * @param [in] str pointer to the ktxStream whose data pointer is to * be queried. - * @param [in,out] size pointer to a variable in which the data pointer + * @param [in,out] ppBytes pointer to a variable in which the data pointer * will be written. * * @return KTX_SUCCESS on success, other KTX_* enum values on error. @@ -438,7 +423,6 @@ KTX_error_code ktxMemStream_getdata(ktxStream* str, ktx_uint8_t** ppBytes) } /** - * @internal * @~English * @brief Get the size of a ktxMemStream in bytes. * @@ -462,7 +446,6 @@ KTX_error_code ktxMemStream_getsize(ktxStream* str, ktx_size_t* pSize) } /** - * @internal * @~English * @brief Setup ktxMemStream function pointers. */ @@ -480,7 +463,6 @@ ktxMemStream_setup(ktxStream* str) } /** - * @internal * @~English * @brief Initialize a read-write ktxMemStream. * @@ -518,13 +500,12 @@ KTX_error_code ktxMemStream_construct(ktxStream* str, } /** - * @internal * @~English * @brief Initialize a read-only ktxMemStream. * * @param [in] str pointer to a ktxStream struct to initialize. * @param [in] bytes pointer to an array of bytes containing the data. - * @param [in] size size of array of data for ktxMemStream. + * @param [in] numBytes size of array of data for ktxMemStream. * * @return KTX_SUCCESS on success, other KTX_* enum values on error. * @@ -555,7 +536,6 @@ KTX_error_code ktxMemStream_construct_ro(ktxStream* str, } /** - * @internal * @~English * @brief Free the memory used by a ktxMemStream. * diff --git a/libktx.doxy b/libktx.doxy index a58682ab7f..31c0b8f320 100644 --- a/libktx.doxy +++ b/libktx.doxy @@ -766,6 +766,8 @@ INPUT = LICENSE.md \ lib/mainpage.md \ lib/glloader.c \ lib/hashlist.c \ + lib/filestream.c \ + lib/memstream.c \ lib/texture.c \ lib/texture1.c \ lib/texture2.c \ diff --git a/mkrelnotes b/mkrelnotes index 04f9fc48af..c933a3a089 100755 --- a/mkrelnotes +++ b/mkrelnotes @@ -54,14 +54,14 @@ function commit_summary() { pr=$(git log --oneline -n 1 $hash | grep -o -E "\(#[0-9]+\)" | grep -o -E "[0-9]+") # Even in PR's the commit has the full name of the user as known to GitHub, # not their GitHub username. We want to use the GitHub username so there will - # be a link back to the person. We can retrieve this by requesting detailed info - # from GitHub via HTTPS. + # be a link back to the person. We can retrieve this by requesting detailed + # info from GitHub via HTTPS. summary=$(git log --pretty="$SUMMARY_FORMAT" -n 1 $hash) if [ -z "$pr" ]; then - cmtjson="$(curl -n https://api.github.com/repos/KhronosGroup/KTX-Software/commits/$hash 2>/dev/null)" + cmtjson="$(curl --netrc https://api.github.com/repos/KhronosGroup/KTX-Software/commits/$hash 2>/dev/null)" author="$(echo $cmtjson | jq -r -e '.author.login')" else - prjson="$(curl -n https://api.github.com/repos/KhronosGroup/KTX-Software/pulls/$pr 2>/dev/null)" + prjson="$(curl --netrc https://api.github.com/repos/KhronosGroup/KTX-Software/pulls/$pr 2>/dev/null)" author="$(echo $prjson | jq -r -e '.user.login')" fi summary+=" (@$author)" @@ -71,7 +71,8 @@ function commit_summary() { body="$(git log --pretty="%b" -n 1 $hash | sed -E 's/^(.+)/ \1/')" if [ -n "$body" ]; then echo "" - # Remove CR which some multi-line commit bodies contain for unknown reasons. + # Remove CR which some multi-line commit bodies contain for unknown + # reasons. echo "$body" | tr -d \\r | sed -e 's/_/\\_/g' fi fi @@ -217,6 +218,7 @@ if [ -n "$includeTests" ]; then tests=$(log "Tests" tests) fi js_binding=$(log "JS Wrappers" interface/js_binding) +java_binding=$(log "Java Wrapper" interface/java_binding) if [ -n "$includeBuildSystem" ]; then cmake=$(log "Build System" $(find . \( -path ./build -o -path ./.git -o -path ./other_include \) -prune -false -o -name CMakeLists.txt -o -name '*.cmake')) @@ -240,6 +242,8 @@ $tests $js_binding +$java_binding + $cmake EOF