├── .github ├── FUNDING.yml └── workflows │ └── build.yml ├── .gitignore ├── CMakeLists.txt ├── ChangeLog ├── LICENSE ├── README.md ├── VERSION ├── cmake └── OptimalOptions.cmake ├── configure ├── data ├── bugs │ ├── 85 │ │ ├── Sky.tga │ │ ├── sky_dither.dds │ │ ├── sky_error.dds │ │ ├── sky_screenshot_1.png │ │ └── tables.cpp │ ├── 88 │ │ └── nmap.png │ └── mthomson │ │ ├── world.png │ │ └── world.tif ├── cubemaps │ └── MeadowTrail.dds ├── luma │ └── testpat_orig.1k.png ├── testsuite │ ├── epic │ │ ├── Bradley1.png │ │ ├── Gradient.png │ │ ├── MoreRocks.png │ │ ├── Rainbow.png │ │ ├── Text.png │ │ └── Wall.png │ ├── farbrausch │ │ ├── t.2d.pn02.png │ │ ├── t.aircondition.01.png │ │ ├── t.bricks.02.png │ │ ├── t.bricks.05.png │ │ ├── t.concrete.cracked.01.png │ │ ├── t.envi.colored02.png │ │ ├── t.envi.colored03.png │ │ ├── t.font.01.png │ │ ├── t.sewers.01.png │ │ ├── t.train.03.png │ │ └── t.yello.01.png │ ├── id_nmap │ │ ├── 01_arcade.png │ │ ├── 02_tentacle.png │ │ ├── 03_chest.png │ │ └── 04_face.png │ ├── id_tnmap │ │ ├── 01_dot1.png │ │ ├── 02_dot2.png │ │ ├── 03_dot3.png │ │ ├── 04_dot4.png │ │ ├── 05_lumpy.png │ │ ├── 06_voronoi.png │ │ ├── 07_turtle.png │ │ ├── 08_normalmap.png │ │ ├── 09_metal.png │ │ ├── 10_skin.png │ │ ├── 11_onetile.png │ │ ├── 12_barrel.png │ │ ├── 13_arcade.png │ │ ├── 14_tentacle.png │ │ ├── 15_chest.png │ │ └── 16_face.png │ ├── kodak │ │ ├── kodim01.png │ │ ├── kodim02.png │ │ ├── kodim03.png │ │ ├── kodim04.png │ │ ├── kodim05.png │ │ ├── kodim06.png │ │ ├── kodim07.png │ │ ├── kodim08.png │ │ ├── kodim09.png │ │ ├── kodim10.png │ │ ├── kodim11.png │ │ ├── kodim12.png │ │ ├── kodim13.png │ │ ├── kodim14.png │ │ ├── kodim15.png │ │ ├── kodim16.png │ │ ├── kodim17.png │ │ ├── kodim18.png │ │ ├── kodim19.png │ │ ├── kodim20.png │ │ ├── kodim21.png │ │ ├── kodim22.png │ │ ├── kodim23.png │ │ └── kodim24.png │ ├── lightmap │ │ ├── cottage.dds │ │ ├── specruin.dds │ │ └── tower.dds │ ├── lugaru │ │ ├── lugaru-blood.png │ │ ├── lugaru-bush.png │ │ ├── lugaru-cursor.png │ │ └── lugaru-hawk.png │ ├── quake3 │ │ ├── q3-blocks15cgeomtrn.tga │ │ ├── q3-blocks17bloody.tga │ │ ├── q3-dark_tin2.tga │ │ ├── q3-fan.tga │ │ ├── q3-fan_grate.tga │ │ ├── q3-metal2_2.tga │ │ ├── q3-panel_glo.tga │ │ ├── q3-proto_fence.tga │ │ └── q3-wires02.tga │ └── waterloo │ │ ├── baboon.png │ │ ├── clegg.png │ │ ├── frymire.png │ │ ├── lena.png │ │ ├── monarch.png │ │ ├── peppers.png │ │ ├── sail.png │ │ ├── serrano.png │ │ └── tulips.png └── witness │ ├── archway.dds │ ├── hallway.dds │ ├── hub.dds │ ├── hut.dds │ ├── mine.dds │ ├── run.sh │ ├── shaft.dds │ ├── theater.dds │ ├── tower.dds │ ├── tunnel.dds │ └── windmill.dds ├── doc └── release_todo ├── extern ├── CMP_Core │ ├── CMP_Core.def │ ├── CMakeLists.txt │ ├── shaders │ │ ├── BC1_Encode_kernel.cpp │ │ ├── BC1_Encode_kernel.h │ │ ├── BC1_Encode_kernel.hlsl │ │ ├── BC2_Encode_kernel.cpp │ │ ├── BC2_Encode_kernel.h │ │ ├── BC2_Encode_kernel.hlsl │ │ ├── BC3_Encode_kernel.cpp │ │ ├── BC3_Encode_kernel.h │ │ ├── BC3_Encode_kernel.hlsl │ │ ├── BC4_Encode_kernel.cpp │ │ ├── BC4_Encode_kernel.h │ │ ├── BC4_Encode_kernel.hlsl │ │ ├── BC5_Encode_kernel.cpp │ │ ├── BC5_Encode_kernel.h │ │ ├── BC5_Encode_kernel.hlsl │ │ ├── BC6_Encode_kernel.cpp │ │ ├── BC6_Encode_kernel.h │ │ ├── BC6_Encode_kernel.hlsl │ │ ├── BC7_Encode_Kernel.cpp │ │ ├── BC7_Encode_Kernel.h │ │ ├── BC7_Encode_kernel.hlsl │ │ ├── BCn_Common_Kernel.h │ │ ├── Common_Def.h │ │ └── CopyFiles.bat │ ├── source │ │ ├── CMP_Core.h │ │ ├── cmp_math_func.h │ │ └── cmp_math_vec4.h │ └── test │ │ ├── BlockConstants.h │ │ ├── CMakeLists.txt │ │ ├── CompressonatorTests.cpp │ │ ├── CompressonatorTests.h │ │ └── TestsMain.cpp ├── CMakeLists.txt ├── EtcLib │ ├── CMakeLists.txt │ ├── Etc │ │ ├── Etc.cpp │ │ ├── Etc.h │ │ ├── EtcColor.h │ │ ├── EtcColorFloatRGBA.h │ │ ├── EtcConfig.h │ │ ├── EtcImage.cpp │ │ ├── EtcImage.h │ │ ├── EtcMath.cpp │ │ └── EtcMath.h │ └── EtcCodec │ │ ├── EtcBlock4x4.cpp │ │ ├── EtcBlock4x4.h │ │ ├── EtcBlock4x4Encoding.cpp │ │ ├── EtcBlock4x4Encoding.h │ │ ├── EtcBlock4x4EncodingBits.h │ │ ├── EtcBlock4x4Encoding_ETC1.cpp │ │ ├── EtcBlock4x4Encoding_ETC1.h │ │ ├── EtcBlock4x4Encoding_R11.cpp │ │ ├── EtcBlock4x4Encoding_R11.h │ │ ├── EtcBlock4x4Encoding_RG11.cpp │ │ ├── EtcBlock4x4Encoding_RG11.h │ │ ├── EtcBlock4x4Encoding_RGB8.cpp │ │ ├── EtcBlock4x4Encoding_RGB8.h │ │ ├── EtcBlock4x4Encoding_RGB8A1.cpp │ │ ├── EtcBlock4x4Encoding_RGB8A1.h │ │ ├── EtcBlock4x4Encoding_RGBA8.cpp │ │ ├── EtcBlock4x4Encoding_RGBA8.h │ │ ├── EtcDifferentialTrys.cpp │ │ ├── EtcDifferentialTrys.h │ │ ├── EtcErrorMetric.h │ │ ├── EtcIndividualTrys.cpp │ │ ├── EtcIndividualTrys.h │ │ ├── EtcSortedBlockList.cpp │ │ └── EtcSortedBlockList.h ├── etcpack │ ├── CMakeLists.txt │ ├── etcdec.cxx │ ├── etcpack.cxx │ ├── image.cxx │ └── image.h ├── libsquish-1.15 │ ├── CMakeLists.txt │ ├── CMakeModules │ │ └── FindlibSquish.cmake │ ├── ChangeLog.txt │ ├── Doxyfile │ ├── LICENSE.txt │ ├── Makefile │ ├── README.txt │ ├── alpha.cpp │ ├── alpha.h │ ├── clusterfit.cpp │ ├── clusterfit.h │ ├── colourblock.cpp │ ├── colourblock.h │ ├── colourfit.cpp │ ├── colourfit.h │ ├── colourset.cpp │ ├── colourset.h │ ├── config │ ├── config.h │ ├── extra │ │ ├── squishgen.cpp │ │ ├── squishpng.cpp │ │ └── squishtest.cpp │ ├── libSquish.png │ ├── libSquish.pri │ ├── libSquish.pro │ ├── libSquish.svg │ ├── libsquish.pc.in │ ├── maths.cpp │ ├── maths.h │ ├── rangefit.cpp │ ├── rangefit.h │ ├── simd.h │ ├── simd_float.h │ ├── simd_sse.h │ ├── simd_ve.h │ ├── singlecolourfit.cpp │ ├── singlecolourfit.h │ ├── singlecolourlookup.inl │ ├── squish.cpp │ └── squish.h ├── poshlib │ ├── CMakeLists.txt │ ├── posh.c │ └── posh.h ├── pvrtextool │ ├── Include │ │ ├── PVRTArray.h │ │ ├── PVRTDecompress.h │ │ ├── PVRTError.h │ │ ├── PVRTGlobal.h │ │ ├── PVRTMap.h │ │ ├── PVRTString.h │ │ ├── PVRTTexture.h │ │ ├── PVRTTypes.h │ │ ├── PVRTexture.h │ │ ├── PVRTextureDefines.h │ │ ├── PVRTextureFormat.h │ │ ├── PVRTextureHeader.h │ │ ├── PVRTextureUtilities.h │ │ └── PVRTextureVersion.h │ ├── OSX_x86 │ │ └── Static │ │ │ └── libPVRTexLib.a │ ├── Windows_x86_32 │ │ └── Static │ │ │ └── PVRTexLib.lib │ └── Windows_x86_64 │ │ └── Static │ │ └── PVRTexLib.lib ├── rg │ ├── rgbcx.h │ └── rgbcx_table4.h ├── rg_etc1_v104 │ ├── CMakeLists.txt │ ├── rg_etc1.cpp │ └── rg_etc1.h └── stb │ ├── stb_dxt.h │ ├── stb_image.h │ ├── stb_image_resize.h │ └── stb_image_write.h ├── project ├── nvtt.code-workspace ├── nvtt.sublime-project └── vc2017 │ ├── Nvidia.TextureTools │ ├── Nvidia.TextureTools.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── TextureTools.cs │ ├── bc6h │ └── bc6h.vcxproj │ ├── bc7 │ └── bc7.vcxproj │ ├── buildpkg.bat │ ├── imperativeapi │ └── imperativeapi.vcxproj │ ├── nvassemble │ ├── nvassemble.rc │ ├── nvassemble.vcxproj │ ├── nvassemble.vcxproj.filters │ ├── nvidia.ico │ └── resource.h │ ├── nvcompress │ ├── nvcompress.rc │ ├── nvcompress.vcxproj │ ├── nvcompress.vcxproj.filters │ ├── nvidia.ico │ └── resource.h │ ├── nvconfig.h │ ├── nvcore │ └── nvcore.vcxproj │ ├── nvddsinfo │ ├── nvddsinfo.rc │ ├── nvddsinfo.vcxproj │ ├── nvddsinfo.vcxproj.filters │ ├── nvidia.ico │ └── resource.h │ ├── nvdecompress │ ├── nvdecompress.rc │ ├── nvdecompress.vcxproj │ ├── nvdecompress.vcxproj.filters │ ├── nvidia.ico │ └── resource.h │ ├── nvimage │ └── nvimage.vcxproj │ ├── nvimgdiff │ ├── nvidia.ico │ ├── nvimgdiff.rc │ ├── nvimgdiff.vcxproj │ ├── nvimgdiff.vcxproj.filters │ └── resource.h │ ├── nvmath │ └── nvmath.vcxproj │ ├── nvthread │ ├── nvthread.vcxproj │ └── nvthread.vcxproj.filters │ ├── nvtt.props │ ├── nvtt.sln │ ├── nvtt.v12.suo │ ├── nvtt │ ├── nvtt.rc │ ├── nvtt.vcxproj │ ├── nvtt.vcxproj.filters │ ├── nvtt.vcxproj.user │ └── resource.h │ ├── nvzoom │ ├── nvidia.ico │ ├── nvzoom.rc │ ├── nvzoom.vcxproj │ ├── nvzoom.vcxproj.filters │ └── resource.h │ ├── squish │ └── squish.vcxproj │ └── testsuite │ └── testsuite.vcxproj └── src ├── CMakeLists.txt ├── bc6h ├── CMakeLists.txt ├── bits.h ├── shapes_two.h ├── tile.h ├── zoh.cpp ├── zoh.h ├── zoh_utils.cpp ├── zoh_utils.h ├── zohone.cpp └── zohtwo.cpp ├── bc7 ├── CMakeLists.txt ├── avpcl.cpp ├── avpcl.h ├── avpcl_mode0.cpp ├── avpcl_mode1.cpp ├── avpcl_mode2.cpp ├── avpcl_mode3.cpp ├── avpcl_mode4.cpp ├── avpcl_mode5.cpp ├── avpcl_mode6.cpp ├── avpcl_mode7.cpp ├── avpcl_utils.cpp ├── avpcl_utils.h ├── bits.h ├── endpts.h ├── shapes_three.h ├── shapes_two.h └── tile.h ├── nvconfig.h.in ├── nvcore ├── Array.h ├── Array.inl ├── CMakeLists.txt ├── Debug.cpp ├── Debug.h ├── DefsGnucDarwin.h ├── DefsGnucLinux.h ├── DefsGnucWin32.h ├── DefsVcWin32.h ├── FileSystem.cpp ├── FileSystem.h ├── ForEach.h ├── Hash.h ├── Library.cpp ├── Library.h ├── Memory.cpp ├── Memory.h ├── Ptr.h ├── RefCounted.h ├── StdStream.h ├── StrLib.cpp ├── StrLib.h ├── Stream.h ├── TextWriter.cpp ├── TextWriter.h ├── Timer.cpp ├── Timer.h ├── Utils.h └── nvcore.h ├── nvimage ├── BlockDXT.cpp ├── BlockDXT.h ├── CMakeLists.txt ├── ColorBlock.cpp ├── ColorBlock.h ├── ColorSpace.cpp ├── ColorSpace.h ├── DirectDrawSurface.cpp ├── DirectDrawSurface.h ├── ErrorMetric.cpp ├── ErrorMetric.h ├── Filter.cpp ├── Filter.h ├── FloatImage.cpp ├── FloatImage.h ├── Image.cpp ├── Image.h ├── ImageIO.cpp ├── ImageIO.h ├── KtxFile.cpp ├── KtxFile.h ├── NormalMap.cpp ├── NormalMap.h ├── PixelFormat.h ├── PsdFile.h ├── Quantize.cpp ├── Quantize.h ├── TgaFile.h └── nvimage.h ├── nvmath ├── Box.cpp ├── Box.h ├── Box.inl ├── CMakeLists.txt ├── Color.cpp ├── Color.h ├── Color.inl ├── Fitting.cpp ├── Fitting.h ├── Gamma.cpp ├── Gamma.h ├── Half.cpp ├── Half.h ├── Matrix.cpp ├── Matrix.h ├── Matrix.inl ├── PackedFloat.cpp ├── PackedFloat.h ├── Plane.cpp ├── Plane.h ├── Plane.inl ├── SphericalHarmonic.cpp ├── SphericalHarmonic.h ├── Vector.cpp ├── Vector.h ├── Vector.inl ├── ftoi.h └── nvmath.h ├── nvthread ├── Atomic.h ├── CMakeLists.txt ├── Event.cpp ├── Event.h ├── Mutex.cpp ├── Mutex.h ├── ParallelFor.cpp ├── ParallelFor.h ├── Thread.cpp ├── Thread.h ├── ThreadPool.cpp ├── ThreadPool.h ├── Win32.h ├── nvthread.cpp └── nvthread.h └── nvtt ├── BlockCompressor.cpp ├── BlockCompressor.h ├── CMakeLists.txt ├── CompressionOptions.cpp ├── CompressionOptions.h ├── Compressor.h ├── CompressorDX10.cpp ├── CompressorDX10.h ├── CompressorDX11.cpp ├── CompressorDX11.h ├── CompressorDX9.cpp ├── CompressorDX9.h ├── CompressorDXT5_RGBM.cpp ├── CompressorDXT5_RGBM.h ├── CompressorETC.cpp ├── CompressorETC.h ├── CompressorRGB.cpp ├── CompressorRGB.h ├── Context.cpp ├── Context.h ├── CubeSurface.cpp ├── CubeSurface.h ├── InputOptions.cpp ├── InputOptions.h ├── OptimalCompressDXT.cpp ├── OptimalCompressDXT.h ├── OutputOptions.cpp ├── OutputOptions.h ├── QuickCompressDXT.cpp ├── QuickCompressDXT.h ├── SingleColorLookup.cpp ├── SingleColorLookup.h ├── Surface.cpp ├── Surface.h ├── TaskDispatcher.cpp ├── TaskDispatcher.h ├── cuda ├── BitmapTable.h ├── CompressKernel.cu ├── ConvolveKernel.cu ├── CudaCompressorDXT.cpp ├── CudaCompressorDXT.h ├── CudaMath.h ├── CudaUtils.cpp └── CudaUtils.h ├── experimental ├── nvtt_experimental.cpp ├── nvtt_experimental.h └── test.cpp ├── icbc.cpp ├── icbc.h ├── nvtt.cpp ├── nvtt.h ├── nvtt_wrapper.cpp ├── nvtt_wrapper.h ├── squish ├── CMakeLists.txt ├── ChangeLog ├── Doxyfile ├── README ├── alpha.cpp ├── alpha.h ├── clusterfit.cpp ├── clusterfit.h ├── colourblock.cpp ├── colourblock.h ├── colourfit.cpp ├── colourfit.h ├── colourset.cpp ├── colourset.h ├── config ├── config.h ├── extra │ ├── squishgen.cpp │ ├── squishgen2.cpp │ ├── squishpng.cpp │ └── squishtest.cpp ├── fastclusterfit.cpp ├── fastclusterfit.h ├── fastclusterlookup.inl ├── maths.cpp ├── maths.h ├── rangefit.cpp ├── rangefit.h ├── simd.h ├── simd_3dnow.h ├── simd_sse.h ├── simd_ve.h ├── singlechannelfit.cpp ├── singlechannelfit.h ├── singlecolourfit.cpp ├── singlecolourfit.h ├── singlecolourlookup.inl ├── squish.cpp ├── squish.h ├── weightedclusterfit.cpp └── weightedclusterfit.h ├── tests ├── CMakeLists.txt ├── GoogleCharts.h ├── bc1enc.cpp ├── ctest.c ├── cubemaptest.cpp ├── driverapi.cpp ├── filtertest.cpp ├── hdrtest.cpp ├── imperativeapi.cpp ├── mpegenc.cpp ├── process_alpha_map.cpp └── testsuite.cpp └── tools ├── CMakeLists.txt ├── assemble.cpp ├── benchmark.cpp ├── cmdline.h ├── compress.cpp ├── compressdialog.cpp ├── compressdialog.h ├── compressdialog.ui ├── ddsinfo.cpp ├── ddsview.cpp ├── decompress.cpp ├── imgdiff.cpp ├── nvtt-thumbnailer.schema.in ├── resize.cpp ├── thumbnailer.cpp └── ui ├── configdialog.cpp ├── configdialog.h ├── configdialog.ui └── main.cpp /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: castano 4 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | vs2017: 7 | runs-on: windows-2019 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: microsoft/setup-msbuild@v1.0.0 11 | - name: Build Debug/x64 12 | run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Debug /property:Platform=x64 13 | - name: Build Debug/Win32 14 | run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Debug /property:Platform=Win32 15 | - name: Build Release/x64 16 | run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Release /property:Platform=x64 17 | - name: Build Release/Win32 18 | run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Release /property:Platform=Win32 19 | 20 | unix: 21 | strategy: 22 | matrix: 23 | os: [ubuntu, macos] 24 | name: ${{matrix.os}} 25 | runs-on: ${{matrix.os}}-latest 26 | steps: 27 | - uses: actions/checkout@v2 28 | - name: make 29 | run: | 30 | ./configure --debug 31 | make 32 | ./configure --release 33 | make 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/bin/ 2 | **/obj/ 3 | **/Debug/ 4 | **/Release/ 5 | **/Debug.x64/ 6 | **/Release.x64/ 7 | **/Debug.Win32/ 8 | **/Release.Win32/ 9 | **/Debug-CUDA/ 10 | **/Release-CUDA/ 11 | *.vcxproj.user 12 | *.opensdf 13 | *.sdf 14 | *.suo 15 | build 16 | .vs 17 | project/nvtt.sublime-workspace 18 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/CMakeLists.txt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | NVIDIA Texture Tools is licensed under the MIT license. 2 | 3 | Copyright (c) 2009-2020 Ignacio Castaño 4 | Copyright (c) 2007-2009 NVIDIA Corporation 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the "Software"), to deal in the Software without 9 | restriction, including without limitation the rights to use, 10 | copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 2.1.2 2 | -------------------------------------------------------------------------------- /cmake/OptimalOptions.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Set optimal options for gcc: 3 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 4 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") 5 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 6 | ENDIF() 7 | 8 | IF(MSVC) 9 | # Code generation flags. 10 | # SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2 /fp:fast") 11 | # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /fp:fast") 12 | 13 | # Optimization flags. 14 | SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL") 15 | SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL") 16 | SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") 17 | SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG") 18 | SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") 19 | 20 | # Definitions. 21 | ADD_DEFINITIONS(-D__SSE2__ -D__SSE__ -D__MMX__) 22 | ENDIF(MSVC) 23 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | BOLD="\033[1m" 4 | RED="\033[91m" 5 | GREEN="\033[92m" 6 | YELLOW="\033[93m" 7 | CYAN="\033[96m" 8 | NORMAL="\033[0m" 9 | 10 | # Make sure cmake is available. 11 | if command -v cmake >/dev/null 2>&1; 12 | then 13 | CMAKE=cmake 14 | else 15 | echo "Error - cmake is not available!" 16 | exit 2 17 | fi 18 | 19 | 20 | help=false 21 | build="debug" # release 22 | prefix=/usr/local 23 | 24 | # Parse the args 25 | for i in "$@" 26 | do 27 | case $i in 28 | --help ) help=true ;; 29 | --debug ) build="debug" ;; 30 | --release ) build="release" ;; 31 | --prefix=* ) prefix="${i#--prefix=}" ;; 32 | * ) echo "Unrecognised argument $i" ;; 33 | esac 34 | done 35 | 36 | if [ "$help" = "true" ] 37 | then 38 | echo "-----------------------------------------------" 39 | echo "nvidia-texture-tools "`cat VERSION`" configuration script" 40 | echo "-----------------------------------------------" 41 | echo 42 | echo "--help Show this message." 43 | echo "--debug Configure debug build." 44 | echo "--release Configure release build." 45 | echo "--prefix=path Installation prefix." 46 | echo "--include=path Include path." 47 | echo "--lib=path Library path." 48 | exit 0 49 | fi 50 | 51 | echo "-- Configuring nvidia-texture-tools "`cat VERSION` 52 | 53 | mkdir -p ./build-$build 54 | cd ./build-$build 55 | $CMAKE .. -DNVTT_SHARED=0 -DCMAKE_BUILD_TYPE=$build -DCMAKE_INSTALL_PREFIX=$prefix -G "Unix Makefiles" || exit 1 56 | cd .. 57 | 58 | echo "" 59 | echo -e "Your configure completed "$GREEN"successfully"$NORMAL", now type "$BOLD"make"$NORMAL 60 | echo "" 61 | 62 | cat > Makefile << EOF 63 | all: 64 | @+make --no-print-directory -C build-$build/ 65 | install: 66 | @+make install --no-print-directory -C build-$build/ 67 | package: 68 | @+make package --no-print-directory -C build-$build/ 69 | test: 70 | @+make test --no-print-directory -C build-$build/ 71 | clean: 72 | @+make clean --no-print-directory -C build-$build/ 73 | distclean: 74 | @rm -Rf build-$build/ 75 | EOF 76 | -------------------------------------------------------------------------------- /data/bugs/85/Sky.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/bugs/85/Sky.tga -------------------------------------------------------------------------------- /data/bugs/85/sky_dither.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/bugs/85/sky_dither.dds -------------------------------------------------------------------------------- /data/bugs/85/sky_error.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/bugs/85/sky_error.dds -------------------------------------------------------------------------------- /data/bugs/85/sky_screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/bugs/85/sky_screenshot_1.png -------------------------------------------------------------------------------- /data/bugs/88/nmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/bugs/88/nmap.png -------------------------------------------------------------------------------- /data/bugs/mthomson/world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/bugs/mthomson/world.png -------------------------------------------------------------------------------- /data/bugs/mthomson/world.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/bugs/mthomson/world.tif -------------------------------------------------------------------------------- /data/cubemaps/MeadowTrail.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/cubemaps/MeadowTrail.dds -------------------------------------------------------------------------------- /data/luma/testpat_orig.1k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/luma/testpat_orig.1k.png -------------------------------------------------------------------------------- /data/testsuite/epic/Bradley1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/epic/Bradley1.png -------------------------------------------------------------------------------- /data/testsuite/epic/Gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/epic/Gradient.png -------------------------------------------------------------------------------- /data/testsuite/epic/MoreRocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/epic/MoreRocks.png -------------------------------------------------------------------------------- /data/testsuite/epic/Rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/epic/Rainbow.png -------------------------------------------------------------------------------- /data/testsuite/epic/Text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/epic/Text.png -------------------------------------------------------------------------------- /data/testsuite/epic/Wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/epic/Wall.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.2d.pn02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.2d.pn02.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.aircondition.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.aircondition.01.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.bricks.02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.bricks.02.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.bricks.05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.bricks.05.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.concrete.cracked.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.concrete.cracked.01.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.envi.colored02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.envi.colored02.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.envi.colored03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.envi.colored03.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.font.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.font.01.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.sewers.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.sewers.01.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.train.03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.train.03.png -------------------------------------------------------------------------------- /data/testsuite/farbrausch/t.yello.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/farbrausch/t.yello.01.png -------------------------------------------------------------------------------- /data/testsuite/id_nmap/01_arcade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_nmap/01_arcade.png -------------------------------------------------------------------------------- /data/testsuite/id_nmap/02_tentacle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_nmap/02_tentacle.png -------------------------------------------------------------------------------- /data/testsuite/id_nmap/03_chest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_nmap/03_chest.png -------------------------------------------------------------------------------- /data/testsuite/id_nmap/04_face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_nmap/04_face.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/01_dot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/01_dot1.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/02_dot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/02_dot2.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/03_dot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/03_dot3.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/04_dot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/04_dot4.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/05_lumpy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/05_lumpy.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/06_voronoi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/06_voronoi.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/07_turtle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/07_turtle.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/08_normalmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/08_normalmap.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/09_metal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/09_metal.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/10_skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/10_skin.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/11_onetile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/11_onetile.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/12_barrel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/12_barrel.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/13_arcade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/13_arcade.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/14_tentacle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/14_tentacle.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/15_chest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/15_chest.png -------------------------------------------------------------------------------- /data/testsuite/id_tnmap/16_face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/id_tnmap/16_face.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim01.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim02.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim03.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim04.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim05.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim06.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim07.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim08.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim09.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim10.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim11.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim12.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim13.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim14.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim15.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim16.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim17.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim18.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim19.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim20.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim21.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim22.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim23.png -------------------------------------------------------------------------------- /data/testsuite/kodak/kodim24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/kodak/kodim24.png -------------------------------------------------------------------------------- /data/testsuite/lightmap/cottage.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/lightmap/cottage.dds -------------------------------------------------------------------------------- /data/testsuite/lightmap/specruin.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/lightmap/specruin.dds -------------------------------------------------------------------------------- /data/testsuite/lightmap/tower.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/lightmap/tower.dds -------------------------------------------------------------------------------- /data/testsuite/lugaru/lugaru-blood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/lugaru/lugaru-blood.png -------------------------------------------------------------------------------- /data/testsuite/lugaru/lugaru-bush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/lugaru/lugaru-bush.png -------------------------------------------------------------------------------- /data/testsuite/lugaru/lugaru-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/lugaru/lugaru-cursor.png -------------------------------------------------------------------------------- /data/testsuite/lugaru/lugaru-hawk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/lugaru/lugaru-hawk.png -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-blocks15cgeomtrn.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-blocks15cgeomtrn.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-blocks17bloody.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-blocks17bloody.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-dark_tin2.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-dark_tin2.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-fan.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-fan.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-fan_grate.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-fan_grate.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-metal2_2.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-metal2_2.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-panel_glo.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-panel_glo.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-proto_fence.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-proto_fence.tga -------------------------------------------------------------------------------- /data/testsuite/quake3/q3-wires02.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/quake3/q3-wires02.tga -------------------------------------------------------------------------------- /data/testsuite/waterloo/baboon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/baboon.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/clegg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/clegg.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/frymire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/frymire.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/lena.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/lena.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/monarch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/monarch.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/peppers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/peppers.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/sail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/sail.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/serrano.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/serrano.png -------------------------------------------------------------------------------- /data/testsuite/waterloo/tulips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/testsuite/waterloo/tulips.png -------------------------------------------------------------------------------- /data/witness/archway.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/archway.dds -------------------------------------------------------------------------------- /data/witness/hallway.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/hallway.dds -------------------------------------------------------------------------------- /data/witness/hub.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/hub.dds -------------------------------------------------------------------------------- /data/witness/hut.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/hut.dds -------------------------------------------------------------------------------- /data/witness/mine.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/mine.dds -------------------------------------------------------------------------------- /data/witness/run.sh: -------------------------------------------------------------------------------- 1 | 2 | FILES=(hallway windmill tunnel theater tower hub mine archway hut shaft) 3 | EXT=dds 4 | #FILES=(kodim01 kodim02 kodim03 kodim04 kodim05 kodim06 kodim07 kodim08) 5 | #EXT=png 6 | 7 | 8 | for file in "${FILES[@]}" 9 | do 10 | #echo $file 11 | 12 | # Output histogram 13 | #./nvdecompress -histogram $file.$EXT 14 | 15 | # R11G11B10_FLOAT 16 | #./nvcompress -silent -alpha -nomips -dds10 -rgb $file.$EXT $file.r11g11b10.dds 17 | #./nvimgdiff -alpha $file.$EXT $file.r11g11b10.dds 18 | 19 | # RGBM 20 | #./nvcompress -silent -alpha -nomips -rgb -rgbm $file.$EXT $file.rgbm.dds 21 | #./nvimgdiff -alpha $file.$EXT $file.rgbm.dds 22 | 23 | # RGB-DXT1 24 | #./nvcompress -silent -alpha -nomips -bc1 $file.$EXT $file.bc1.dds 25 | #./nvimgdiff -alpha $file.$EXT $file.bc1.dds 26 | 27 | # RGBM-DXT5 Naive 28 | #./nvcompress -silent -alpha -nomips -bc3 -rgbm $file.$EXT $file.bc3-rgbm.dds 29 | #./nvimgdiff -alpha $file.$EXT $file.bc3-rgbm.dds 30 | 31 | # RGBM-DXT5 Optimized 32 | ./nvcompress -silent -alpha -nomips -bc3_rgbm $file.$EXT $file.bc3-rgbm.dds 33 | ./nvimgdiff -alpha $file.$EXT $file.bc3-rgbm.dds 34 | 35 | # BC6 36 | #./nvcompress -silent -alpha -nomips -bc6 $file.$EXT $file.bc6.dds 37 | #./nvimgdiff -alpha $file.$EXT $file.bc6.dds 38 | 39 | # ETC2-EAC 40 | ./nvcompress -silent -alpha -nomips -etc_rgbm 41 | done 42 | -------------------------------------------------------------------------------- /data/witness/shaft.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/shaft.dds -------------------------------------------------------------------------------- /data/witness/theater.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/theater.dds -------------------------------------------------------------------------------- /data/witness/tower.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/tower.dds -------------------------------------------------------------------------------- /data/witness/tunnel.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/tunnel.dds -------------------------------------------------------------------------------- /data/witness/windmill.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/data/witness/windmill.dds -------------------------------------------------------------------------------- /doc/release_todo: -------------------------------------------------------------------------------- 1 | Update version number in nvtt/nvtt.h 2 | Update version number in nvimage/DirectDrawSurface.cpp 3 | Update version number in CMakeLists.txt 4 | Update version number in VERSION 5 | Update version number in project/vc2017/nvtt/nvtt.rc 6 | -------------------------------------------------------------------------------- /extern/CMP_Core/CMP_Core.def: -------------------------------------------------------------------------------- 1 | ; Core def : Declares the module parameters for the DLL. 2 | 3 | EXPORTS 4 | CreateOptionsBC1 5 | CreateOptionsBC2 6 | CreateOptionsBC3 7 | CreateOptionsBC4 8 | CreateOptionsBC5 9 | CreateOptionsBC6 10 | CreateOptionsBC7 11 | 12 | DestroyOptionsBC1 13 | DestroyOptionsBC2 14 | DestroyOptionsBC3 15 | DestroyOptionsBC4 16 | DestroyOptionsBC5 17 | DestroyOptionsBC6 18 | DestroyOptionsBC7 19 | 20 | SetDecodeChannelMapping 21 | 22 | SetChannelWeightsBC1 23 | SetChannelWeightsBC2 24 | SetChannelWeightsBC3 25 | 26 | SetQualityBC1 27 | SetQualityBC2 28 | SetQualityBC3 29 | SetQualityBC4 30 | SetQualityBC5 31 | SetQualityBC6 32 | SetQualityBC7 33 | 34 | SetAlphaThresholdBC1 35 | 36 | SetMaskBC6 37 | SetMaskBC7 38 | 39 | SetErrorThresholdBC7 40 | SetAlphaOptionsBC7 41 | 42 | CompressBlockBC1 43 | CompressBlockBC2 44 | CompressBlockBC3 45 | CompressBlockBC4 46 | CompressBlockBC5 47 | CompressBlockBC6 48 | CompressBlockBC7 49 | 50 | DecompressBlockBC1 51 | DecompressBlockBC2 52 | DecompressBlockBC3 53 | DecompressBlockBC4 54 | DecompressBlockBC5 55 | DecompressBlockBC6 56 | DecompressBlockBC7 57 | -------------------------------------------------------------------------------- /extern/CMP_Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | add_library(CMP_Core STATIC "") 4 | 5 | target_sources(CMP_Core 6 | PRIVATE 7 | shaders/BC1_Encode_kernel.h 8 | shaders/BC1_Encode_kernel.cpp 9 | shaders/BC2_Encode_kernel.h 10 | shaders/BC2_Encode_kernel.cpp 11 | shaders/BC3_Encode_kernel.h 12 | shaders/BC3_Encode_kernel.cpp 13 | shaders/BC4_Encode_kernel.h 14 | shaders/BC4_Encode_kernel.cpp 15 | shaders/BC5_Encode_kernel.h 16 | shaders/BC5_Encode_kernel.cpp 17 | shaders/BC6_Encode_kernel.h 18 | shaders/BC6_Encode_kernel.cpp 19 | shaders/BC7_Encode_Kernel.h 20 | shaders/BC7_Encode_Kernel.cpp 21 | shaders/BCn_Common_Kernel.h 22 | shaders/Common_Def.h 23 | ) 24 | 25 | target_include_directories(CMP_Core 26 | PRIVATE 27 | shaders 28 | source) 29 | #add_subdirectory(test) 30 | 31 | if (UNIX) 32 | target_compile_definitions(CMP_Core PRIVATE _LINUX ASPM_GPU) 33 | endif() 34 | -------------------------------------------------------------------------------- /extern/CMP_Core/shaders/BC1_Encode_kernel.h: -------------------------------------------------------------------------------- 1 | //===================================================================== 2 | // Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | //===================================================================== 23 | #ifndef BC1_ENCODE_KERNEL_H 24 | #define BC1_ENCODE_KERNEL_H 25 | 26 | #include "Common_Def.h" 27 | #include "BCn_Common_Kernel.h" 28 | 29 | 30 | #endif -------------------------------------------------------------------------------- /extern/CMP_Core/shaders/BC2_Encode_kernel.h: -------------------------------------------------------------------------------- 1 | //===================================================================== 2 | // Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | //===================================================================== 23 | #ifndef BC2_ENCODE_KERNEL_H 24 | #define BC2_ENCODE_KERNEL_H 25 | 26 | #include "Common_Def.h" 27 | #include "BCn_Common_Kernel.h" 28 | 29 | #define BC2CompBlockSize 16 30 | #define NUM_CHANNELS 4 31 | #define NUM_ENDPOINTS 2 32 | 33 | 34 | #endif -------------------------------------------------------------------------------- /extern/CMP_Core/shaders/BC3_Encode_kernel.h: -------------------------------------------------------------------------------- 1 | //===================================================================== 2 | // Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | //===================================================================== 23 | #ifndef BC3_ENCODE_KERNEL_H 24 | #define BC3_ENCODE_KERNEL_H 25 | 26 | #include "Common_Def.h" 27 | #include "BCn_Common_Kernel.h" 28 | 29 | #define BC3CompBlockSize 16 30 | 31 | #endif -------------------------------------------------------------------------------- /extern/CMP_Core/shaders/BC4_Encode_kernel.h: -------------------------------------------------------------------------------- 1 | //===================================================================== 2 | // Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | //===================================================================== 23 | #ifndef BC4_ENCODE_KERNEL_H 24 | #define BC4_ENCODE_KERNEL_H 25 | 26 | #include "Common_Def.h" 27 | #include "BCn_Common_Kernel.h" 28 | 29 | #define BC4CompBlockSize 8 30 | 31 | #endif -------------------------------------------------------------------------------- /extern/CMP_Core/shaders/BC5_Encode_kernel.h: -------------------------------------------------------------------------------- 1 | //===================================================================== 2 | // Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | //===================================================================== 23 | #ifndef BC5_ENCODE_KERNEL_H 24 | #define BC5_ENCODE_KERNEL_H 25 | 26 | #include "Common_Def.h" 27 | #include "BCn_Common_Kernel.h" 28 | 29 | #define BC5CompBlockSize 16 30 | 31 | #endif -------------------------------------------------------------------------------- /extern/CMP_Core/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(CMP_Core_Tests) 3 | 4 | add_executable(Tests TestsMain.cpp) 5 | add_subdirectory(../../../Common/Lib/Ext/Catch2 6 | Common/Lib/Ext/Catch2/bin) 7 | target_sources(Tests 8 | PRIVATE 9 | CompressonatorTests.cpp 10 | CompressonatorTests.h 11 | BlockConstants.h 12 | ../../Applications/_Plugins/Common/UtilFuncs.cpp 13 | ../../Applications/_Plugins/Common/UtilFuncs.h 14 | ) 15 | target_link_libraries(Tests Catch2::Catch2 CMP_Core) 16 | -------------------------------------------------------------------------------- /extern/CMP_Core/test/CompressonatorTests.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPRESSONATOR_TESTS_H 2 | #define COMPRESSONATOR_TESTS_H 3 | 4 | void AssignExpectedColorsToBlocks(); 5 | 6 | #endif -------------------------------------------------------------------------------- /extern/CMP_Core/test/TestsMain.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_RUNNER 2 | #include "../../../Common/Lib/Ext/Catch2/catch.hpp" 3 | #include "CompressonatorTests.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | AssignExpectedColorsToBlocks(); 7 | int result = Catch::Session().run(argc, argv); 8 | 9 | return result; 10 | } -------------------------------------------------------------------------------- /extern/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | ADD_SUBDIRECTORY(poshlib) 3 | 4 | ADD_SUBDIRECTORY(EtcLib) 5 | ADD_SUBDIRECTORY(rg_etc1_v104) 6 | #ADD_SUBDIRECTORY(etcpack) 7 | 8 | ADD_SUBDIRECTORY(libsquish-1.15) 9 | 10 | ADD_SUBDIRECTORY(CMP_Core) 11 | 12 | -------------------------------------------------------------------------------- /extern/EtcLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The Etc2Comp Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | project(EtcLib) 16 | include_directories(./Etc) 17 | include_directories(./EtcCodec) 18 | 19 | file(GLOB SOURCES 20 | ${PROJECT_SOURCE_DIR}/Etc/*.h 21 | ${PROJECT_SOURCE_DIR}/EtcCodec/*.h 22 | ${PROJECT_SOURCE_DIR}/Etc/*.cpp 23 | ${PROJECT_SOURCE_DIR}/EtcCodec/*.cpp) 24 | ADD_LIBRARY(EtcLib STATIC ${SOURCES}) 25 | -------------------------------------------------------------------------------- /extern/EtcLib/Etc/Etc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "EtcConfig.h" 18 | #include "Etc.h" 19 | 20 | #include 21 | 22 | namespace Etc 23 | { 24 | // ---------------------------------------------------------------------------------------------------- 25 | // C-style inteface to the encoder 26 | // 27 | void Encode(float *a_pafSourceRGBA, 28 | unsigned int a_uiSourceWidth, 29 | unsigned int a_uiSourceHeight, 30 | Image::Format a_format, 31 | ErrorMetric a_eErrMetric, 32 | float a_fEffort, 33 | unsigned int a_uiJobs, 34 | unsigned int a_uiMaxJobs, 35 | unsigned char **a_ppaucEncodingBits, 36 | unsigned int *a_puiEncodingBitsBytes, 37 | unsigned int *a_puiExtendedWidth, 38 | unsigned int *a_puiExtendedHeight, 39 | int *a_piEncodingTime_ms, bool a_bVerboseOutput) 40 | { 41 | 42 | Image image(a_pafSourceRGBA, a_uiSourceWidth, 43 | a_uiSourceHeight, 44 | a_eErrMetric); 45 | image.m_bVerboseOutput = a_bVerboseOutput; 46 | image.Encode(a_format, a_eErrMetric, a_fEffort, a_uiJobs, a_uiMaxJobs); 47 | 48 | *a_ppaucEncodingBits = image.GetEncodingBits(); 49 | *a_puiEncodingBitsBytes = image.GetEncodingBitsBytes(); 50 | *a_puiExtendedWidth = image.GetExtendedWidth(); 51 | *a_puiExtendedHeight = image.GetExtendedHeight(); 52 | *a_piEncodingTime_ms = image.GetEncodingTimeMs(); 53 | } 54 | 55 | // ---------------------------------------------------------------------------------------------------- 56 | // 57 | 58 | } 59 | -------------------------------------------------------------------------------- /extern/EtcLib/Etc/Etc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "EtcConfig.h" 20 | #include "EtcImage.h" 21 | #include "EtcColor.h" 22 | #include "EtcErrorMetric.h" 23 | 24 | #define ETCCOMP_MIN_EFFORT_LEVEL (0.0f) 25 | #define ETCCOMP_DEFAULT_EFFORT_LEVEL (40.0f) 26 | #define ETCCOMP_MAX_EFFORT_LEVEL (100.0f) 27 | 28 | namespace Etc 29 | { 30 | class Block4x4EncodingBits; 31 | 32 | // C-style inteface to the encoder 33 | void Encode(float *a_pafSourceRGBA, 34 | unsigned int a_uiSourceWidth, 35 | unsigned int a_uiSourceHeight, 36 | Image::Format a_format, 37 | ErrorMetric a_eErrMetric, 38 | float a_fEffort, 39 | unsigned int a_uiJobs, 40 | unsigned int a_uimaxJobs, 41 | unsigned char **a_ppaucEncodingBits, 42 | unsigned int *a_puiEncodingBitsBytes, 43 | unsigned int *a_puiExtendedWidth, 44 | unsigned int *a_puiExtendedHeight, 45 | int *a_piEncodingTime_ms, bool a_bVerboseOutput = false); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /extern/EtcLib/Etc/EtcColor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace Etc 22 | { 23 | 24 | inline float LogToLinear(float a_fLog) 25 | { 26 | static const float ALPHA = 0.055f; 27 | static const float ONE_PLUS_ALPHA = 1.0f + ALPHA; 28 | 29 | if (a_fLog <= 0.04045f) 30 | { 31 | return a_fLog / 12.92f; 32 | } 33 | else 34 | { 35 | return powf((a_fLog + ALPHA) / ONE_PLUS_ALPHA, 2.4f); 36 | } 37 | } 38 | 39 | inline float LinearToLog(float &a_fLinear) 40 | { 41 | static const float ALPHA = 0.055f; 42 | static const float ONE_PLUS_ALPHA = 1.0f + ALPHA; 43 | 44 | if (a_fLinear <= 0.0031308f) 45 | { 46 | return 12.92f * a_fLinear; 47 | } 48 | else 49 | { 50 | return ONE_PLUS_ALPHA * powf(a_fLinear, (1.0f/2.4f)) - ALPHA; 51 | } 52 | } 53 | 54 | class ColorR8G8B8A8 55 | { 56 | public: 57 | 58 | unsigned char ucR; 59 | unsigned char ucG; 60 | unsigned char ucB; 61 | unsigned char ucA; 62 | 63 | }; 64 | } 65 | -------------------------------------------------------------------------------- /extern/EtcLib/Etc/EtcConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #ifdef _WIN32 20 | #define ETC_WINDOWS (1) 21 | #else 22 | #define ETC_WINDOWS (0) 23 | #endif 24 | 25 | #if __APPLE__ 26 | #define ETC_OSX (1) 27 | #else 28 | #define ETC_OSX (0) 29 | #endif 30 | 31 | #if __unix__ 32 | #define ETC_UNIX (1) 33 | #else 34 | #define ETC_UNIX (0) 35 | #endif 36 | 37 | 38 | // short names for common types 39 | #include 40 | typedef int8_t i8; 41 | typedef int16_t i16; 42 | typedef int32_t i32; 43 | typedef int64_t i64; 44 | 45 | typedef uint8_t u8; 46 | typedef uint16_t u16; 47 | typedef uint32_t u32; 48 | typedef uint64_t u64; 49 | 50 | typedef float f32; 51 | typedef double f64; 52 | 53 | // Keep asserts enabled in release builds during development 54 | #undef NDEBUG 55 | 56 | // 0=disable. stb_image can be used if you need to compress 57 | //other image formats like jpg 58 | #define USE_STB_IMAGE_LOAD 0 59 | 60 | #if ETC_WINDOWS 61 | #include 62 | #define _CRT_SECURE_NO_WARNINGS (1) 63 | #include 64 | #endif 65 | 66 | #include 67 | 68 | -------------------------------------------------------------------------------- /extern/EtcLib/Etc/EtcMath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "EtcConfig.h" 18 | #include "EtcMath.h" 19 | 20 | namespace Etc 21 | { 22 | 23 | // ---------------------------------------------------------------------------------------------------- 24 | // calculate the line that best fits the set of XY points contained in a_afX[] and a_afY[] 25 | // use a_fSlope and a_fOffset to define that line 26 | // 27 | bool Regression(float a_afX[], float a_afY[], unsigned int a_Points, 28 | float *a_fSlope, float *a_fOffset) 29 | { 30 | float fPoints = (float)a_Points; 31 | 32 | float fSumX = 0.0f; 33 | float fSumY = 0.0f; 34 | float fSumXY = 0.0f; 35 | float fSumX2 = 0.0f; 36 | 37 | for (unsigned int uiPoint = 0; uiPoint < a_Points; uiPoint++) 38 | { 39 | fSumX += a_afX[uiPoint]; 40 | fSumY += a_afY[uiPoint]; 41 | fSumXY += a_afX[uiPoint] * a_afY[uiPoint]; 42 | fSumX2 += a_afX[uiPoint] * a_afX[uiPoint]; 43 | } 44 | 45 | float fDivisor = fPoints*fSumX2 - fSumX*fSumX; 46 | 47 | // if vertical line 48 | if (fDivisor == 0.0f) 49 | { 50 | *a_fSlope = 0.0f; 51 | *a_fOffset = 0.0f; 52 | return true; 53 | } 54 | 55 | *a_fSlope = (fPoints*fSumXY - fSumX*fSumY) / fDivisor; 56 | *a_fOffset = (fSumY - (*a_fSlope)*fSumX) / fPoints; 57 | 58 | return false; 59 | } 60 | 61 | // ---------------------------------------------------------------------------------------------------- 62 | // 63 | 64 | } // namespace Etc 65 | -------------------------------------------------------------------------------- /extern/EtcLib/Etc/EtcMath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace Etc 22 | { 23 | 24 | // ---------------------------------------------------------------------------------------------------- 25 | // return true if vertical line 26 | bool Regression(float a_afX[], float a_afY[], unsigned int a_Points, 27 | float *a_fSlope, float *a_fOffset); 28 | 29 | inline float ConvertMSEToPSNR(float a_fMSE) 30 | { 31 | if (a_fMSE == 0.0f) 32 | { 33 | return INFINITY; 34 | } 35 | 36 | return 10.0f * log10f(1.0f / a_fMSE); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /extern/EtcLib/EtcCodec/EtcErrorMetric.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | namespace Etc 20 | { 21 | 22 | enum ErrorMetric 23 | { 24 | RGBA, 25 | REC709, 26 | NUMERIC, 27 | NORMALXYZ, 28 | // 29 | ERROR_METRICS, 30 | // 31 | BT709 = REC709 32 | }; 33 | 34 | inline const char *ErrorMetricToString(ErrorMetric errorMetric) 35 | { 36 | switch (errorMetric) 37 | { 38 | case RGBA: 39 | return "RGBA"; 40 | case REC709: 41 | return "REC709"; 42 | case NUMERIC: 43 | return "NUMERIC"; 44 | case NORMALXYZ: 45 | return "NORMALXYZ"; 46 | case ERROR_METRICS: 47 | default: 48 | return "UNKNOWN"; 49 | } 50 | } 51 | } // namespace Etc 52 | -------------------------------------------------------------------------------- /extern/etcpack/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(ETCPACK_SRCS 3 | etcdec.cxx 4 | etcpack.cxx 5 | image.cxx 6 | image.h) 7 | 8 | add_definitions("-DPGMOUT=0") 9 | ADD_LIBRARY(etcpack STATIC ${ETCPACK_SRCS}) 10 | 11 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/CMakeModules/FindlibSquish.cmake: -------------------------------------------------------------------------------- 1 | # Defines 2 | # LIBSQUISH_FOUND 3 | # LIBSQUISH_INCLUDE_DIR 4 | # LIBSQUISH_LIBRARIES 5 | 6 | FIND_PATH(LIBSQUISH_INCLUDE_DIR squish.h PATHS . squish .. ../squish DOC "Directory containing libSquish headers") 7 | FIND_LIBRARY(LIBSQUISH_LIBRARY NAMES squish libsquish PATHS . squish .. ../squish PATH_SUFFIXES lib lib64 release minsizerel relwithdebinfo DOC "Path to libSquish library") 8 | 9 | SET(LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY}) 10 | 11 | IF (LIBSQUISH_LIBRARY AND LIBSQUISH_INCLUDE_DIR) 12 | SET(LIBSQUISH_FOUND TRUE) 13 | MESSAGE(STATUS "Found libSquish: ${LIBSQUISH_LIBRARY}") 14 | ENDIF (LIBSQUISH_LIBRARY AND LIBSQUISH_INCLUDE_DIR) 15 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/README.txt: -------------------------------------------------------------------------------- 1 | LICENSE 2 | ------- 3 | 4 | The squish library is distributed under the terms and conditions of the MIT 5 | license. This license is specified at the top of each source file and must be 6 | preserved in its entirety. 7 | 8 | BUILDING AND INSTALLING THE LIBRARY 9 | ----------------------------------- 10 | 11 | The preferred way to install the library on Unix/Mac (and Windows) is via cmake: 12 | cmake . && make && sudo make install 13 | 14 | REPORTING BUGS OR FEATURE REQUESTS 15 | ---------------------------------- 16 | 17 | Feedback can be sent to Simon Brown (the developer) at si@sjbrown.co.uk 18 | Feedback can also be sent to Stefan Roettger (the maintainer) at snroettg@gmail.com 19 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/alpha.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_ALPHA_H 27 | #define SQUISH_ALPHA_H 28 | 29 | #include "squish.h" 30 | 31 | namespace squish { 32 | 33 | void CompressAlphaDxt3( u8 const* rgba, int mask, void* block ); 34 | void CompressAlphaDxt5( u8 const* rgba, int mask, void* block ); 35 | 36 | void DecompressAlphaDxt3( u8* rgba, void const* block ); 37 | void DecompressAlphaDxt5( u8* rgba, void const* block ); 38 | 39 | } // namespace squish 40 | 41 | #endif // ndef SQUISH_ALPHA_H 42 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/colourblock.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_COLOURBLOCK_H 27 | #define SQUISH_COLOURBLOCK_H 28 | 29 | #include "squish.h" 30 | #include "maths.h" 31 | 32 | namespace squish { 33 | 34 | void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); 35 | void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); 36 | 37 | void DecompressColour( u8* rgba, void const* block, bool isDxt1 ); 38 | 39 | } // namespace squish 40 | 41 | #endif // ndef SQUISH_COLOURBLOCK_H 42 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/colourfit.cpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #include "colourfit.h" 27 | #include "colourset.h" 28 | 29 | namespace squish { 30 | 31 | ColourFit::ColourFit( ColourSet const* colours, int flags ) 32 | : m_colours( colours ), 33 | m_flags( flags ) 34 | { 35 | } 36 | 37 | ColourFit::~ColourFit() 38 | { 39 | } 40 | 41 | void ColourFit::Compress( void* block ) 42 | { 43 | bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 ); 44 | if( isDxt1 ) 45 | { 46 | Compress3( block ); 47 | if( !m_colours->IsTransparent() ) 48 | Compress4( block ); 49 | } 50 | else 51 | Compress4( block ); 52 | } 53 | 54 | } // namespace squish 55 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/colourfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_COLOURFIT_H 27 | #define SQUISH_COLOURFIT_H 28 | 29 | #include "squish.h" 30 | #include "maths.h" 31 | 32 | #include 33 | 34 | namespace squish { 35 | 36 | class ColourSet; 37 | 38 | class ColourFit 39 | { 40 | public: 41 | ColourFit( ColourSet const* colours, int flags ); 42 | virtual ~ColourFit(); 43 | 44 | void Compress( void* block ); 45 | 46 | protected: 47 | virtual void Compress3( void* block ) = 0; 48 | virtual void Compress4( void* block ) = 0; 49 | 50 | ColourSet const* m_colours; 51 | int m_flags; 52 | }; 53 | 54 | } // namespace squish 55 | 56 | #endif // ndef SQUISH_COLOURFIT_H 57 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/config: -------------------------------------------------------------------------------- 1 | # config file for GNUmake 2 | 3 | # define to 1 to use OpenMP parallelization 4 | USE_OPENMP ?= 0 5 | 6 | # define to 1 to install shared library 7 | USE_SHARED ?= 0 8 | 9 | # define to 1 to use Altivec instructions 10 | USE_ALTIVEC ?= 0 11 | 12 | # define to 1 to use SSE2 instructions 13 | USE_SSE ?= 0 14 | 15 | # default flags 16 | CXXFLAGS ?= -O2 -Wall 17 | ifeq ($(USE_OPENMP),1) 18 | CPPFLAGS += -DSQUISH_USE_OPENMP 19 | CXXFLAGS += -fopenmp 20 | endif 21 | ifeq ($(USE_ALTIVEC),1) 22 | CPPFLAGS += -DSQUISH_USE_ALTIVEC=1 23 | CXXFLAGS += -maltivec 24 | endif 25 | ifeq ($(USE_SSE),1) 26 | CPPFLAGS += -DSQUISH_USE_SSE=2 27 | CXXFLAGS += -msse 28 | endif 29 | 30 | # install options 31 | INSTALL = install 32 | INSTALL_FILE = $(INSTALL) -p -m 644 33 | INSTALL_PROGRAM = $(INSTALL) -p -m 755 34 | INSTALL_DIRECTORY = $(INSTALL) -d -m 755 35 | 36 | # where should we install to 37 | INSTALL_DIR ?= /usr/local 38 | LIB_PATH ?= lib 39 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/config.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_CONFIG_H 27 | #define SQUISH_CONFIG_H 28 | 29 | // Set to 1 when building squish to use Altivec instructions. 30 | #ifndef SQUISH_USE_ALTIVEC 31 | #define SQUISH_USE_ALTIVEC 0 32 | #endif 33 | 34 | // Set to 1 or 2 when building squish to use SSE or SSE2 instructions. 35 | #ifndef SQUISH_USE_SSE 36 | #define SQUISH_USE_SSE 2 37 | #endif 38 | 39 | // Internally set SQUISH_USE_SIMD when either Altivec or SSE is available. 40 | #if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE 41 | #error "Cannot enable both Altivec and SSE!" 42 | #endif 43 | #if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE 44 | #define SQUISH_USE_SIMD 1 45 | #else 46 | #define SQUISH_USE_SIMD 0 47 | #endif 48 | 49 | #endif // ndef SQUISH_CONFIG_H 50 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/libSquish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/extern/libsquish-1.15/libSquish.png -------------------------------------------------------------------------------- /extern/libsquish-1.15/libSquish.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | squish.h 3 | 4 | SOURCES += \ 5 | alpha.cpp \ 6 | alpha.h \ 7 | clusterfit.cpp \ 8 | clusterfit.h \ 9 | colourblock.cpp \ 10 | colourblock.h \ 11 | colourfit.cpp \ 12 | colourfit.h \ 13 | colourset.cpp \ 14 | colourset.h \ 15 | maths.cpp \ 16 | maths.h \ 17 | rangefit.cpp \ 18 | rangefit.h \ 19 | simd.h \ 20 | simd_float.h \ 21 | simd_sse.h \ 22 | simd_ve.h \ 23 | singlecolourfit.cpp \ 24 | singlecolourfit.h \ 25 | singlecolourlookup.inl \ 26 | squish.cpp 27 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/libSquish.pro: -------------------------------------------------------------------------------- 1 | TARGET = squish 2 | TEMPLATE = lib 3 | 4 | include(libSquish.pri) 5 | 6 | QT -= gui 7 | 8 | CONFIG += staticlib thread 9 | CONFIG += debug_and_release 10 | 11 | CONFIG(debug, debug|release) { 12 | unix:TARGET = $$join(TARGET,,,_debug) 13 | } 14 | 15 | MOC_DIR = mocs 16 | OBJECTS_DIR = objs 17 | RCC_DIR = rccs 18 | UI_DIR = uics 19 | 20 | CONFIG(debug, debug|release) { 21 | unix:MOC_DIR = $$join(MOC_DIR,,,_debug) 22 | unix:OBJECTS_DIR = $$join(OBJECTS_DIR,,,_debug) 23 | unix:RCC_DIR = $$join(RCC_DIR,,,_debug) 24 | unix:UI_DIR = $$join(UI_DIR,,,_debug) 25 | win32:MOC_DIR = $$join(MOC_DIR,,,d) 26 | win32:OBJECTS_DIR = $$join(OBJECTS_DIR,,,d) 27 | win32:RCC_DIR = $$join(RCC_DIR,,,d) 28 | win32:UI_DIR = $$join(UI_DIR,,,d) 29 | } 30 | 31 | unix:QMAKE_CXXFLAGS += -DSQUISH_USE_OPENMP -fopenmp 32 | 33 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/libsquish.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/@LIB_PATH@ 4 | sharedlibdir=${libdir} 5 | includedir=${prefix}/include 6 | 7 | Name: libsquish 8 | Description: squish DXT library 9 | Version: 1.14 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -llibsquish 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/rangefit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_RANGEFIT_H 27 | #define SQUISH_RANGEFIT_H 28 | 29 | #include "squish.h" 30 | #include "colourfit.h" 31 | #include "maths.h" 32 | 33 | namespace squish { 34 | 35 | class ColourSet; 36 | 37 | class RangeFit : public ColourFit 38 | { 39 | public: 40 | RangeFit( ColourSet const* colours, int flags, float* metric ); 41 | 42 | private: 43 | virtual void Compress3( void* block ); 44 | virtual void Compress4( void* block ); 45 | 46 | Vec3 m_metric; 47 | Vec3 m_start; 48 | Vec3 m_end; 49 | float m_besterror; 50 | }; 51 | 52 | } // squish 53 | 54 | #endif // ndef SQUISH_RANGEFIT_H 55 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/simd.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_SIMD_H 27 | #define SQUISH_SIMD_H 28 | 29 | #include "maths.h" 30 | 31 | #if SQUISH_USE_ALTIVEC 32 | #include "simd_ve.h" 33 | #elif SQUISH_USE_SSE 34 | #include "simd_sse.h" 35 | #else 36 | #include "simd_float.h" 37 | #endif 38 | 39 | 40 | #endif // ndef SQUISH_SIMD_H 41 | -------------------------------------------------------------------------------- /extern/libsquish-1.15/singlecolourfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_SINGLECOLOURFIT_H 27 | #define SQUISH_SINGLECOLOURFIT_H 28 | 29 | #include "squish.h" 30 | #include "colourfit.h" 31 | 32 | namespace squish { 33 | 34 | class ColourSet; 35 | struct SingleColourLookup; 36 | 37 | class SingleColourFit : public ColourFit 38 | { 39 | public: 40 | SingleColourFit( ColourSet const* colours, int flags ); 41 | 42 | private: 43 | virtual void Compress3( void* block ); 44 | virtual void Compress4( void* block ); 45 | 46 | void ComputeEndPoints( SingleColourLookup const* const* lookups ); 47 | 48 | u8 m_colour[3]; 49 | Vec3 m_start; 50 | Vec3 m_end; 51 | u8 m_index; 52 | int m_error; 53 | int m_besterror; 54 | }; 55 | 56 | } // namespace squish 57 | 58 | #endif // ndef SQUISH_SINGLECOLOURFIT_H 59 | -------------------------------------------------------------------------------- /extern/poshlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(POSHLIB_SRCS 3 | posh.c 4 | posh.h) 5 | 6 | ADD_LIBRARY(posh STATIC ${POSHLIB_SRCS}) 7 | 8 | -------------------------------------------------------------------------------- /extern/pvrtextool/Include/PVRTextureVersion.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | @File PVRTextureVersion.h 4 | 5 | @Title 6 | 7 | @Version 8 | 9 | @Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential. 10 | 11 | @Platform ANSI 12 | 13 | @Description Texture processing routines. 14 | 15 | ******************************************************************************/ 16 | #ifndef PVRTEXLIBVERSION_H 17 | #define PVRTEXLIBVERSION_H 18 | #define PVRTLMAJORVERSION 4 19 | #define PVRTLMINORVERSION 2 20 | #define PVRTLSTRINGVERSION "4.2" 21 | #define PVRTLVERSIONDESCRIPTOR "" //"BETA" //"ALPHA" //"ENGINEERING DROP" 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /extern/pvrtextool/OSX_x86/Static/libPVRTexLib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/extern/pvrtextool/OSX_x86/Static/libPVRTexLib.a -------------------------------------------------------------------------------- /extern/pvrtextool/Windows_x86_32/Static/PVRTexLib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/extern/pvrtextool/Windows_x86_32/Static/PVRTexLib.lib -------------------------------------------------------------------------------- /extern/pvrtextool/Windows_x86_64/Static/PVRTexLib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/extern/pvrtextool/Windows_x86_64/Static/PVRTexLib.lib -------------------------------------------------------------------------------- /extern/rg_etc1_v104/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(RGETC_SRCS 3 | rg_etc1.cpp 4 | rg_etc1.h) 5 | 6 | ADD_LIBRARY(rg_etc1 STATIC ${RGETC_SRCS}) 7 | 8 | -------------------------------------------------------------------------------- /project/nvtt.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": ".." 5 | } 6 | ], 7 | "settings": { 8 | "files.exclude": { 9 | "**/build*": true, 10 | "**/.svn": true, 11 | "**/.gitignore": true, 12 | "**/*.user": true, 13 | }, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /project/nvtt.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": "..", 6 | "file_exclude_patterns": ["*.user"], 7 | "folder_exclude_patterns": ["build*", ".vscode", ".vc"] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /project/vc2017/Nvidia.TextureTools/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Nvidia.TextureTools")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("NVIDIA Corporation")] 12 | [assembly: AssemblyProduct("Nvidia.TextureTools")] 13 | [assembly: AssemblyCopyright("Copyright © NVIDIA 2008")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5fa03fb3-b7a3-4ba8-90e7-545929731356")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /project/vc2017/buildpkg.bat: -------------------------------------------------------------------------------- 1 | 2 | mkdir dist 3 | 4 | mkdir dist\lib 5 | mkdir dist\lib64 6 | mkdir dist\bin 7 | mkdir dist\bin64 8 | mkdir dist\include 9 | mkdir dist\include\nvtt 10 | 11 | copy Release.Win32\bin\nvcompress.exe dist\bin 12 | copy Release.Win32\bin\nvdecompress.exe dist\bin 13 | copy Release.Win32\bin\nvtt.dll dist\bin 14 | copy Release.Win32\bin\nvtt.pdb dist\bin 15 | copy Release.Win32\lib\nvtt.lib dist\lib 16 | 17 | copy Release.x64\bin\nvcompress.exe dist\bin64 18 | copy Release.x64\bin\nvdecompress.exe dist\bin64 19 | copy Release.x64\bin\nvtt.dll dist\bin64 20 | copy Release.x64\bin\nvtt.pdb dist\bin64 21 | copy Release.x64\lib\nvtt.lib dist\lib64 22 | 23 | copy Release.Win32\include\nvtt\nvtt.h dist\include\nvtt\nvtt.h 24 | -------------------------------------------------------------------------------- /project/vc2017/nvassemble/nvassemble.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvassemble/nvassemble.rc -------------------------------------------------------------------------------- /project/vc2017/nvassemble/nvassemble.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /project/vc2017/nvassemble/nvidia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvassemble/nvidia.ico -------------------------------------------------------------------------------- /project/vc2017/nvassemble/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by nvcompress.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /project/vc2017/nvcompress/nvcompress.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvcompress/nvcompress.rc -------------------------------------------------------------------------------- /project/vc2017/nvcompress/nvcompress.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /project/vc2017/nvcompress/nvidia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvcompress/nvidia.ico -------------------------------------------------------------------------------- /project/vc2017/nvcompress/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by nvcompress.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /project/vc2017/nvconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CONFIG 2 | #define NV_CONFIG 3 | 4 | //#cmakedefine HAVE_UNISTD_H 5 | //#define HAVE_STDARG_H 6 | //#cmakedefine HAVE_SIGNAL_H 7 | //#cmakedefine HAVE_EXECINFO_H 8 | //#define HAVE_MALLOC_H 9 | 10 | #if defined(_OPENMP) 11 | #define HAVE_OPENMP 12 | #endif 13 | 14 | #define NV_HAVE_STBIMAGE 15 | /*#if !defined(_M_X64) 16 | //#define NV_HAVE_FREEIMAGE 17 | #define NV_HAVE_PNG 18 | #define NV_HAVE_JPEG 19 | #define NV_HAVE_TIFF 20 | #endif*/ 21 | 22 | #endif // NV_CONFIG 23 | -------------------------------------------------------------------------------- /project/vc2017/nvddsinfo/nvddsinfo.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvddsinfo/nvddsinfo.rc -------------------------------------------------------------------------------- /project/vc2017/nvddsinfo/nvddsinfo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /project/vc2017/nvddsinfo/nvidia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvddsinfo/nvidia.ico -------------------------------------------------------------------------------- /project/vc2017/nvddsinfo/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by nvcompress.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /project/vc2017/nvdecompress/nvdecompress.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvdecompress/nvdecompress.rc -------------------------------------------------------------------------------- /project/vc2017/nvdecompress/nvdecompress.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /project/vc2017/nvdecompress/nvidia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvdecompress/nvidia.ico -------------------------------------------------------------------------------- /project/vc2017/nvdecompress/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by nvcompress.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /project/vc2017/nvimgdiff/nvidia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvimgdiff/nvidia.ico -------------------------------------------------------------------------------- /project/vc2017/nvimgdiff/nvimgdiff.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvimgdiff/nvimgdiff.rc -------------------------------------------------------------------------------- /project/vc2017/nvimgdiff/nvimgdiff.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /project/vc2017/nvimgdiff/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by nvcompress.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /project/vc2017/nvthread/nvthread.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /project/vc2017/nvtt.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(SolutionDir)..\..\src 6 | $(SolutionDir)..\..\extern 7 | 8 | 9 | -------------------------------------------------------------------------------- /project/vc2017/nvtt.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvtt.v12.suo -------------------------------------------------------------------------------- /project/vc2017/nvtt/nvtt.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /project/vc2017/nvtt/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by nvtt.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /project/vc2017/nvzoom/nvidia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvzoom/nvidia.ico -------------------------------------------------------------------------------- /project/vc2017/nvzoom/nvzoom.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/project/vc2017/nvzoom/nvzoom.rc -------------------------------------------------------------------------------- /project/vc2017/nvzoom/nvzoom.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /project/vc2017/nvzoom/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by nvcompress.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 3 | INCLUDE_DIRECTORIES(${NV_SOURCE_DIR}/extern/poshlib) 4 | INCLUDE_DIRECTORIES(${NV_SOURCE_DIR}/extern/stb) 5 | 6 | SUBDIRS(nvcore) 7 | SUBDIRS(nvmath) 8 | SUBDIRS(nvimage) 9 | SUBDIRS(nvthread) 10 | SUBDIRS(nvtt) 11 | SUBDIRS(bc6h) 12 | SUBDIRS(bc7) 13 | 14 | # CUDA 15 | FIND_PACKAGE(CUDA) 16 | IF(CUDA_FOUND) 17 | IF(MINGW) 18 | MESSAGE(STATUS "Looking for CUDA - not supported on MinGW") 19 | UNSET(CUDA_FOUND) 20 | ENDIF(MINGW) 21 | IF(CUDA_FOUND) 22 | SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise") 23 | MESSAGE(STATUS "Looking for CUDA - found") 24 | ENDIF(CUDA_FOUND) 25 | ELSE(CUDA_FOUND) 26 | MESSAGE(STATUS "Looking for CUDA - not found") 27 | ENDIF(CUDA_FOUND) 28 | 29 | # OpenMP 30 | # INCLUDE(FindOpenMP) 31 | # IF(OPENMP_FOUND) 32 | # SET(HAVE_OPENMP ${OPENMP_FOUND} CACHE BOOL "Set to TRUE if OpenMP is found, FALSE otherwise") 33 | # MESSAGE(STATUS "Looking for OpenMP - found") 34 | # SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 35 | # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 36 | # ELSE(OPENMP_FOUND) 37 | # MESSAGE(STATUS "Looking for OpenMP - not found") 38 | # ENDIF(OPENMP_FOUND) 39 | 40 | # Threads 41 | FIND_PACKAGE(Threads REQUIRED) 42 | MESSAGE(STATUS "Use thread library: ${CMAKE_THREAD_LIBS_INIT}") 43 | SET(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) 44 | 45 | # configuration file 46 | INCLUDE(CheckIncludeFiles) 47 | 48 | CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H) 49 | CHECK_INCLUDE_FILES("stdarg.h" HAVE_STDARG_H) 50 | CHECK_INCLUDE_FILES("signal.h" HAVE_SIGNAL_H) 51 | CHECK_INCLUDE_FILES("execinfo.h" HAVE_EXECINFO_H) 52 | CHECK_INCLUDE_FILES("malloc.h" HAVE_MALLOC_H) 53 | CHECK_INCLUDE_FILES("dispatch/dispatch.h" HAVE_DISPATCH_H) 54 | 55 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nvconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h) 56 | 57 | -------------------------------------------------------------------------------- /src/bc6h/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(bc6h) 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 4 | 5 | SET(BC6H_SRCS 6 | bits.h 7 | shapes_two.h 8 | tile.h 9 | zoh_utils.cpp 10 | zoh_utils.h 11 | zoh.cpp 12 | zoh.h 13 | zohone.cpp 14 | zohtwo.cpp) 15 | 16 | ADD_LIBRARY(bc6h STATIC ${BC6H_SRCS}) 17 | TARGET_LINK_LIBRARIES(bc6h nvcore nvmath) 18 | -------------------------------------------------------------------------------- /src/bc6h/zoh.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | #pragma once 13 | #ifndef _ZOH_H 14 | #define _ZOH_H 15 | 16 | #include "tile.h" 17 | 18 | namespace ZOH { 19 | 20 | // UNUSED ZOH MODES are 0x13, 0x17, 0x1b, 0x1f 21 | 22 | static const int NREGIONS_TWO = 2; 23 | static const int NREGIONS_ONE = 1; 24 | static const int NCHANNELS = 3; 25 | 26 | struct FltEndpts 27 | { 28 | nv::Vector3 A; 29 | nv::Vector3 B; 30 | }; 31 | 32 | struct IntEndpts 33 | { 34 | int A[NCHANNELS]; 35 | int B[NCHANNELS]; 36 | }; 37 | 38 | struct ComprEndpts 39 | { 40 | uint A[NCHANNELS]; 41 | uint B[NCHANNELS]; 42 | }; 43 | 44 | static const int BLOCKSIZE=16; 45 | static const int BITSIZE=128; 46 | 47 | void compress(const Tile &t, char *block); 48 | void decompress(const char *block, Tile &t); 49 | 50 | float compressone(const Tile &t, char *block); 51 | float compresstwo(const Tile &t, char *block); 52 | void decompressone(const char *block, Tile &t); 53 | void decompresstwo(const char *block, Tile &t); 54 | 55 | float refinetwo(const Tile &tile, int shapeindex_best, const FltEndpts endpts[NREGIONS_TWO], char *block); 56 | float roughtwo(const Tile &tile, int shape, FltEndpts endpts[NREGIONS_TWO]); 57 | 58 | float refineone(const Tile &tile, int shapeindex_best, const FltEndpts endpts[NREGIONS_ONE], char *block); 59 | float roughone(const Tile &tile, int shape, FltEndpts endpts[NREGIONS_ONE]); 60 | 61 | bool isone(const char *block); 62 | 63 | } 64 | 65 | #endif // _ZOH_H 66 | -------------------------------------------------------------------------------- /src/bc7/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(bc7) 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 4 | 5 | SET(BC7_SRCS 6 | avpcl.cpp 7 | avpcl.h 8 | avpcl_mode0.cpp 9 | avpcl_mode1.cpp 10 | avpcl_mode2.cpp 11 | avpcl_mode3.cpp 12 | avpcl_mode4.cpp 13 | avpcl_mode5.cpp 14 | avpcl_mode6.cpp 15 | avpcl_mode7.cpp 16 | bits.h 17 | endpts.h 18 | shapes_three.h 19 | shapes_two.h 20 | tile.h 21 | avpcl_utils.cpp 22 | avpcl_utils.h) 23 | 24 | ADD_LIBRARY(bc7 STATIC ${BC7_SRCS}) 25 | TARGET_LINK_LIBRARIES(bc7 nvcore nvmath) 26 | -------------------------------------------------------------------------------- /src/bc7/endpts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | 13 | #ifndef _AVPCL_ENDPTS_H 14 | #define _AVPCL_ENDPTS_H 15 | 16 | // endpoint definitions and routines to search through endpoint space 17 | 18 | #include "nvmath/Vector.h" 19 | 20 | namespace AVPCL { 21 | 22 | static const int NCHANNELS_RGB = 3; 23 | static const int NCHANNELS_RGBA = 4; 24 | static const int CHANNEL_R = 0; 25 | static const int CHANNEL_G = 1; 26 | static const int CHANNEL_B = 2; 27 | static const int CHANNEL_A = 3; 28 | 29 | struct FltEndpts 30 | { 31 | nv::Vector4 A; 32 | nv::Vector4 B; 33 | }; 34 | 35 | struct IntEndptsRGB 36 | { 37 | int A[NCHANNELS_RGB]; 38 | int B[NCHANNELS_RGB]; 39 | }; 40 | 41 | struct IntEndptsRGB_1 42 | { 43 | int A[NCHANNELS_RGB]; 44 | int B[NCHANNELS_RGB]; 45 | int lsb; // shared lsb for A and B 46 | }; 47 | 48 | struct IntEndptsRGB_2 49 | { 50 | int A[NCHANNELS_RGB]; 51 | int B[NCHANNELS_RGB]; 52 | int a_lsb; // lsb for A 53 | int b_lsb; // lsb for B 54 | }; 55 | 56 | 57 | struct IntEndptsRGBA 58 | { 59 | int A[NCHANNELS_RGBA]; 60 | int B[NCHANNELS_RGBA]; 61 | }; 62 | 63 | struct IntEndptsRGBA_2 64 | { 65 | int A[NCHANNELS_RGBA]; 66 | int B[NCHANNELS_RGBA]; 67 | int a_lsb; // lsb for A 68 | int b_lsb; // lsb for B 69 | }; 70 | 71 | struct IntEndptsRGBA_2a 72 | { 73 | int A[NCHANNELS_RGBA]; 74 | int B[NCHANNELS_RGBA]; 75 | int a_lsb; // lsb for RGB channels of A 76 | int b_lsb; // lsb for RGB channels of A 77 | }; 78 | 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/bc7/tile.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | 13 | #ifndef _AVPCL_TILE_H 14 | #define _AVPCL_TILE_H 15 | 16 | #include "nvmath/Vector.h" 17 | #include 18 | #include "avpcl_utils.h" 19 | 20 | namespace AVPCL { 21 | 22 | // extract a tile of pixels from an array 23 | 24 | class Tile 25 | { 26 | public: 27 | static const int TILE_H = 4; 28 | static const int TILE_W = 4; 29 | static const int TILE_TOTAL = TILE_H * TILE_W; 30 | nv::Vector4 data[TILE_H][TILE_W]; 31 | float importance_map[TILE_H][TILE_W]; 32 | int size_x, size_y; // actual size of tile 33 | 34 | Tile() {}; 35 | ~Tile(){}; 36 | Tile(int xs, int ys) {size_x = xs; size_y = ys;} 37 | }; 38 | 39 | } 40 | 41 | #endif -------------------------------------------------------------------------------- /src/nvconfig.h.in: -------------------------------------------------------------------------------- 1 | #ifndef NV_CONFIG 2 | #define NV_CONFIG 3 | 4 | #cmakedefine HAVE_UNISTD_H 5 | #cmakedefine HAVE_STDARG_H 6 | #cmakedefine HAVE_SIGNAL_H 7 | #cmakedefine HAVE_EXECINFO_H 8 | #cmakedefine HAVE_MALLOC_H 9 | 10 | #cmakedefine HAVE_OPENMP 11 | #cmakedefine HAVE_DISPATCH_H 12 | 13 | #define NV_HAVE_STBIMAGE 14 | //#cmakedefine HAVE_PNG 15 | //#cmakedefine HAVE_JPEG 16 | //#cmakedefine HAVE_TIFF 17 | //#cmakedefine HAVE_OPENEXR 18 | //#cmakedefine HAVE_FREEIMAGE 19 | 20 | #cmakedefine HAVE_MAYA 21 | 22 | #endif // NV_CONFIG 23 | -------------------------------------------------------------------------------- /src/nvcore/Array.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Array.h -------------------------------------------------------------------------------- /src/nvcore/Array.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Array.inl -------------------------------------------------------------------------------- /src/nvcore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvcore) 2 | 3 | SET(CORE_SRCS 4 | nvcore.h 5 | Array.h 6 | Debug.h Debug.cpp 7 | DefsGnucDarwin.h 8 | DefsGnucLinux.h 9 | DefsGnucWin32.h 10 | DefsVcWin32.h 11 | FileSystem.h FileSystem.cpp 12 | ForEach.h 13 | Library.h Library.cpp 14 | Memory.h Memory.cpp 15 | Ptr.h 16 | RefCounted.h 17 | StrLib.h StrLib.cpp 18 | Stream.h 19 | StdStream.h 20 | TextWriter.h TextWriter.cpp 21 | Timer.h Timer.cpp 22 | Utils.h) 23 | 24 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 25 | 26 | # targets 27 | ADD_DEFINITIONS(-DNVCORE_EXPORTS) 28 | 29 | IF(UNIX) 30 | SET(LIBS ${LIBS} ${CMAKE_DL_LIBS}) 31 | ENDIF(UNIX) 32 | 33 | IF(NVCORE_SHARED) 34 | ADD_DEFINITIONS(-DNVCORE_SHARED=1) 35 | ADD_LIBRARY(nvcore SHARED ${CORE_SRCS}) 36 | ELSE(NVCORE_SHARED) 37 | ADD_LIBRARY(nvcore ${CORE_SRCS}) 38 | ENDIF(NVCORE_SHARED) 39 | 40 | TARGET_LINK_LIBRARIES(nvcore ${LIBS}) 41 | 42 | # On NetBSD and FreeBSD backtrace() is provided by libexecinfo, not libc. 43 | if (CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") 44 | TARGET_LINK_LIBRARIES(nvcore execinfo) 45 | endif() 46 | 47 | INSTALL(TARGETS nvcore 48 | RUNTIME DESTINATION bin 49 | LIBRARY DESTINATION lib 50 | ARCHIVE DESTINATION lib/static) 51 | -------------------------------------------------------------------------------- /src/nvcore/Debug.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Debug.cpp -------------------------------------------------------------------------------- /src/nvcore/Debug.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Debug.h -------------------------------------------------------------------------------- /src/nvcore/DefsGnucDarwin.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | #include // uint8_t, int8_t, ... uintptr_t 6 | #include // operator new, size_t, NULL 7 | 8 | // Function linkage 9 | #define DLL_IMPORT 10 | #if __GNUC__ >= 4 11 | # define DLL_EXPORT __attribute__((visibility("default"))) 12 | # define DLL_EXPORT_CLASS DLL_EXPORT 13 | #else 14 | # define DLL_EXPORT 15 | # define DLL_EXPORT_CLASS 16 | #endif 17 | 18 | // Function calling modes 19 | #if NV_CPU_X86 20 | # define NV_CDECL __attribute__((cdecl)) 21 | # define NV_STDCALL __attribute__((stdcall)) 22 | #else 23 | # define NV_CDECL 24 | # define NV_STDCALL 25 | #endif 26 | 27 | #define NV_FASTCALL __attribute__((fastcall)) 28 | #define NV_FORCEINLINE __attribute__((always_inline)) inline 29 | #define NV_DEPRECATED __attribute__((deprecated)) 30 | #define NV_THREAD_LOCAL __thread 31 | 32 | #if __GNUC__ > 2 33 | #define NV_PURE __attribute__((pure)) 34 | #define NV_CONST __attribute__((const)) 35 | #else 36 | #define NV_PURE 37 | #define NV_CONST 38 | #endif 39 | 40 | #define NV_NOINLINE __attribute__((noinline)) 41 | 42 | // Define __FUNC__ properly. 43 | #if __STDC_VERSION__ < 199901L 44 | # if __GNUC__ >= 2 45 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 46 | # else 47 | # define __FUNC__ "" 48 | # endif 49 | #else 50 | # define __FUNC__ __PRETTY_FUNCTION__ 51 | #endif 52 | 53 | #define restrict __restrict__ 54 | -------------------------------------------------------------------------------- /src/nvcore/DefsGnucLinux.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | #include // uint8_t, int8_t, ... uintptr_t 6 | #include // operator new, size_t, NULL 7 | 8 | // Function linkage 9 | #define DLL_IMPORT 10 | #if __GNUC__ >= 4 11 | # define DLL_EXPORT __attribute__((visibility("default"))) 12 | # define DLL_EXPORT_CLASS DLL_EXPORT 13 | #else 14 | # define DLL_EXPORT 15 | # define DLL_EXPORT_CLASS 16 | #endif 17 | 18 | // Function calling modes 19 | #if NV_CPU_X86 20 | # define NV_CDECL __attribute__((cdecl)) 21 | # define NV_STDCALL __attribute__((stdcall)) 22 | #else 23 | # define NV_CDECL 24 | # define NV_STDCALL 25 | #endif 26 | 27 | #define NV_FASTCALL __attribute__((fastcall)) 28 | //#if __GNUC__ > 3 29 | // It seems that GCC does not assume always_inline implies inline. I think this depends on the GCC version :( 30 | #define NV_FORCEINLINE inline __attribute__((always_inline)) 31 | //#else 32 | // Some compilers complain that inline and always_inline are redundant. 33 | //#define NV_FORCEINLINE __attribute__((always_inline)) 34 | //#endif 35 | #define NV_DEPRECATED __attribute__((deprecated)) 36 | #define NV_THREAD_LOCAL __thread 37 | 38 | #if __GNUC__ > 2 39 | #define NV_PURE __attribute__((pure)) 40 | #define NV_CONST __attribute__((const)) 41 | #else 42 | #define NV_PURE 43 | #define NV_CONST 44 | #endif 45 | 46 | #define NV_NOINLINE __attribute__((noinline)) 47 | 48 | // Define __FUNC__ properly. 49 | #if __STDC_VERSION__ < 199901L 50 | # if __GNUC__ >= 2 51 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 52 | # else 53 | # define __FUNC__ "" 54 | # endif 55 | #else 56 | # define __FUNC__ __PRETTY_FUNCTION__ 57 | #endif 58 | 59 | #define restrict __restrict__ 60 | -------------------------------------------------------------------------------- /src/nvcore/DefsGnucWin32.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | //#include // size_t, NULL 6 | 7 | // Function linkage 8 | #define DLL_IMPORT __declspec(dllimport) 9 | #define DLL_EXPORT __declspec(dllexport) 10 | #define DLL_EXPORT_CLASS DLL_EXPORT 11 | 12 | // Function calling modes 13 | #if NV_CPU_X86 14 | # define NV_CDECL __attribute__((cdecl)) 15 | # define NV_STDCALL __attribute__((stdcall)) 16 | #else 17 | # define NV_CDECL 18 | # define NV_STDCALL 19 | #endif 20 | 21 | #define NV_FASTCALL __attribute__((fastcall)) 22 | #define NV_FORCEINLINE __attribute__((always_inline)) 23 | #define NV_DEPRECATED __attribute__((deprecated)) 24 | 25 | #if __GNUC__ > 2 26 | #define NV_PURE __attribute__((pure)) 27 | #define NV_CONST __attribute__((const)) 28 | #else 29 | #define NV_PURE 30 | #define NV_CONST 31 | #endif 32 | 33 | #define NV_NOINLINE __attribute__((noinline)) 34 | 35 | // Define __FUNC__ properly. 36 | #if __STDC_VERSION__ < 199901L 37 | # if __GNUC__ >= 2 38 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 39 | # else 40 | # define __FUNC__ "" 41 | # endif 42 | #else 43 | # define __FUNC__ __PRETTY_FUNCTION__ 44 | #endif 45 | 46 | #define restrict __restrict__ 47 | 48 | /* 49 | // Type definitions 50 | typedef unsigned char uint8; 51 | typedef signed char int8; 52 | 53 | typedef unsigned short uint16; 54 | typedef signed short int16; 55 | 56 | typedef unsigned int uint32; 57 | typedef signed int int32; 58 | 59 | typedef unsigned long long uint64; 60 | typedef signed long long int64; 61 | 62 | // Aliases 63 | typedef uint32 uint; 64 | */ 65 | 66 | -------------------------------------------------------------------------------- /src/nvcore/FileSystem.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_CORE_FILESYSTEM_H 5 | #define NV_CORE_FILESYSTEM_H 6 | 7 | #include "nvcore.h" 8 | 9 | namespace nv 10 | { 11 | 12 | namespace FileSystem 13 | { 14 | NVCORE_API bool exists(const char * path); 15 | NVCORE_API bool createDirectory(const char * path); 16 | NVCORE_API bool changeDirectory(const char * path); 17 | NVCORE_API bool removeFile(const char * path); 18 | NVCORE_API bool copyFile(const char * src, const char * dst); 19 | } // FileSystem namespace 20 | 21 | } // nv namespace 22 | 23 | 24 | #endif // NV_CORE_FILESYSTEM_H 25 | -------------------------------------------------------------------------------- /src/nvcore/ForEach.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/ForEach.h -------------------------------------------------------------------------------- /src/nvcore/Hash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Hash.h -------------------------------------------------------------------------------- /src/nvcore/Library.cpp: -------------------------------------------------------------------------------- 1 | #include "Library.h" 2 | #include "Debug.h" 3 | 4 | #if NV_OS_WIN32 5 | #define WIN32_LEAN_AND_MEAN 6 | #define VC_EXTRALEAN 7 | #include 8 | #elif NV_OS_XBOX 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | 15 | 16 | void * nvLoadLibrary(const char * name) 17 | { 18 | #if NV_OS_WIN32 19 | return (void *)LoadLibraryExA( name, NULL, 0 ); 20 | #elif NV_OS_XBOX 21 | return (void *)LoadLibraryA( name ); 22 | #else 23 | return dlopen(name, RTLD_LAZY); 24 | #endif 25 | } 26 | 27 | void nvUnloadLibrary(void * handle) 28 | { 29 | nvDebugCheck(handle != NULL); 30 | #if NV_OS_WIN32 || NV_OS_XBOX 31 | FreeLibrary((HMODULE)handle); 32 | #else 33 | dlclose(handle); 34 | #endif 35 | } 36 | 37 | void * nvBindSymbol(void * handle, const char * symbol) 38 | { 39 | #if NV_OS_WIN32 || NV_OS_XBOX 40 | return (void *)GetProcAddress((HMODULE)handle, symbol); 41 | #else 42 | return (void *)dlsym(handle, symbol); 43 | #endif 44 | } -------------------------------------------------------------------------------- /src/nvcore/Library.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_CORE_LIBRARY_H 5 | #define NV_CORE_LIBRARY_H 6 | 7 | #include "nvcore.h" 8 | 9 | #if NV_OS_WIN32 10 | #define LIBRARY_NAME(name) #name ".dll" 11 | #elif NV_OS_DARWIN 12 | #define NV_LIBRARY_NAME(name) "lib" #name ".dylib" 13 | #else 14 | #define NV_LIBRARY_NAME(name) "lib" #name ".so" 15 | #endif 16 | 17 | NVCORE_API void * nvLoadLibrary(const char * name); 18 | NVCORE_API void nvUnloadLibrary(void * lib); 19 | NVCORE_API void * nvBindSymbol(void * lib, const char * symbol); 20 | 21 | class NVCORE_CLASS Library 22 | { 23 | public: 24 | Library(const char * name) 25 | { 26 | handle = nvLoadLibrary(name); 27 | } 28 | ~Library() 29 | { 30 | if (isValid()) 31 | { 32 | nvUnloadLibrary(handle); 33 | } 34 | } 35 | 36 | bool isValid() const 37 | { 38 | return handle != NULL; 39 | } 40 | 41 | void * bindSymbol(const char * symbol) 42 | { 43 | return nvBindSymbol(handle, symbol); 44 | } 45 | 46 | private: 47 | void * handle; 48 | }; 49 | 50 | 51 | #endif // NV_CORE_LIBRARY_H -------------------------------------------------------------------------------- /src/nvcore/Memory.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Memory.cpp -------------------------------------------------------------------------------- /src/nvcore/Memory.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- Ignacio Castaño 2 | 3 | #pragma once 4 | #ifndef NV_CORE_MEMORY_H 5 | #define NV_CORE_MEMORY_H 6 | 7 | #include "nvcore.h" 8 | 9 | #include // malloc(), realloc() and free() 10 | #include // memset 11 | //#include // size_t 12 | 13 | #if NV_OS_LINUX 14 | #include // memalign() 15 | #endif 16 | 17 | //#include // new and delete 18 | 19 | #define TRACK_MEMORY_LEAKS 0 20 | #if TRACK_MEMORY_LEAKS 21 | #include 22 | #endif 23 | 24 | 25 | #if NV_CC_GNUC 26 | # define NV_ALIGN_16 __attribute__ ((__aligned__ (16))) 27 | #else 28 | # define NV_ALIGN_16 __declspec(align(16)) 29 | #endif 30 | 31 | 32 | #define NV_OVERRIDE_ALLOC 0 33 | 34 | #if NV_OVERRIDE_ALLOC 35 | 36 | // Custom memory allocator 37 | extern "C" { 38 | NVCORE_API void * malloc(size_t size); 39 | NVCORE_API void * debug_malloc(size_t size, const char * file, int line); 40 | NVCORE_API void free(void * ptr); 41 | NVCORE_API void * realloc(void * ptr, size_t size); 42 | } 43 | 44 | /* 45 | #ifdef _DEBUG 46 | #define new new(__FILE__, __LINE__) 47 | #define malloc(i) debug_malloc(i, __FILE__, __LINE__) 48 | #endif 49 | */ 50 | 51 | #endif 52 | 53 | namespace nv { 54 | NVCORE_API void * aligned_malloc(size_t size, size_t alignment); 55 | NVCORE_API void aligned_free(void * ); 56 | 57 | // C++ helpers. 58 | template NV_FORCEINLINE T * malloc(size_t count) { 59 | return (T *)::malloc(sizeof(T) * count); 60 | } 61 | 62 | template NV_FORCEINLINE T * realloc(T * ptr, size_t count) { 63 | return (T *)::realloc(ptr, sizeof(T) * count); 64 | } 65 | 66 | template NV_FORCEINLINE void free(const T * ptr) { 67 | ::free((void *)ptr); 68 | } 69 | 70 | template NV_FORCEINLINE void zero(T & data) { 71 | memset(&data, 0, sizeof(T)); 72 | } 73 | 74 | } // nv namespace 75 | 76 | #endif // NV_CORE_MEMORY_H 77 | -------------------------------------------------------------------------------- /src/nvcore/Ptr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Ptr.h -------------------------------------------------------------------------------- /src/nvcore/RefCounted.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/RefCounted.h -------------------------------------------------------------------------------- /src/nvcore/StdStream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/StdStream.h -------------------------------------------------------------------------------- /src/nvcore/StrLib.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/StrLib.cpp -------------------------------------------------------------------------------- /src/nvcore/StrLib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/StrLib.h -------------------------------------------------------------------------------- /src/nvcore/Stream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Stream.h -------------------------------------------------------------------------------- /src/nvcore/TextWriter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/TextWriter.cpp -------------------------------------------------------------------------------- /src/nvcore/TextWriter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/TextWriter.h -------------------------------------------------------------------------------- /src/nvcore/Timer.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #include "Timer.h" 4 | 5 | using namespace nv; 6 | 7 | 8 | #if NV_OS_WIN32 9 | 10 | #define WINDOWS_LEAN_AND_MEAN 11 | #define VC_EXTRALEAN 12 | #define NOMINMAX 13 | #include // QueryPerformanceFrequency, QueryPerformanceCounter 14 | 15 | 16 | uint64 nv::systemClockFrequency() 17 | { 18 | uint64 frequency; 19 | QueryPerformanceFrequency((LARGE_INTEGER*) &frequency); 20 | return frequency; 21 | } 22 | 23 | uint64 nv::systemClock() 24 | { 25 | uint64 counter; 26 | QueryPerformanceCounter((LARGE_INTEGER*) &counter); 27 | return counter; 28 | } 29 | 30 | #else 31 | 32 | #include // clock 33 | 34 | uint64 nv::systemClockFrequency() 35 | { 36 | return CLOCKS_PER_SEC; 37 | } 38 | 39 | uint64 nv::systemClock() 40 | { 41 | return clock(); 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/nvcore/Timer.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_CORE_TIMER_H 5 | #define NV_CORE_TIMER_H 6 | 7 | #include "nvcore.h" 8 | 9 | #if NV_CC_MSVC 10 | #include 11 | #endif 12 | 13 | namespace nv { 14 | 15 | #if NV_CC_MSVC 16 | NV_FORCEINLINE uint64 fastCpuClock() { return __rdtsc(); } 17 | #elif NV_CC_GNUC && NV_CPU_X86 18 | NV_FORCEINLINE uint64 fastCpuClock() { 19 | uint64 val; 20 | __asm__ volatile (".byte 0x0f, 0x31" : "=A" (val)); 21 | return val; 22 | } 23 | #elif NV_CC_GNUC && NV_CPU_X86_64 24 | NV_FORCEINLINE uint64 fastCpuClock() { 25 | uint hi, lo; 26 | __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); 27 | return uint64(lo) | (uint64(hi) << 32); 28 | } 29 | #else 30 | NV_FORCEINLINE uint64 fastCpuClock() { return 0; } 31 | #endif 32 | 33 | uint64 systemClockFrequency(); 34 | uint64 systemClock(); 35 | 36 | class NVCORE_CLASS Timer 37 | { 38 | public: 39 | Timer() {} 40 | 41 | void start() { m_start = systemClock(); } 42 | void stop() { m_stop = systemClock(); } 43 | 44 | float elapsed() const { return float(m_stop - m_start) / systemClockFrequency(); } 45 | 46 | private: 47 | uint64 m_start; 48 | uint64 m_stop; 49 | }; 50 | 51 | } // nv namespace 52 | 53 | #endif // NV_CORE_TIMER_H 54 | -------------------------------------------------------------------------------- /src/nvcore/Utils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvcore/Utils.h -------------------------------------------------------------------------------- /src/nvimage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvimage) 2 | 3 | SET(IMAGE_SRCS 4 | nvimage.h 5 | BlockDXT.h BlockDXT.cpp 6 | ColorBlock.h ColorBlock.cpp 7 | DirectDrawSurface.h DirectDrawSurface.cpp 8 | ErrorMetric.h ErrorMetric.cpp 9 | Filter.h Filter.cpp 10 | FloatImage.h FloatImage.cpp 11 | Image.h Image.cpp 12 | ImageIO.h ImageIO.cpp 13 | #KtxFile.h KtxFile.cpp 14 | NormalMap.h NormalMap.cpp 15 | PixelFormat.h 16 | PsdFile.h 17 | TgaFile.h 18 | KtxFile.h KtxFile.cpp) 19 | 20 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 21 | 22 | IF(PNG_FOUND) 23 | SET(LIBS ${LIBS} ${PNG_LIBRARIES}) 24 | INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) 25 | ENDIF(PNG_FOUND) 26 | 27 | IF(JPEG_FOUND) 28 | SET(LIBS ${LIBS} ${JPEG_LIBRARIES}) 29 | INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) 30 | ENDIF(JPEG_FOUND) 31 | 32 | IF(TIFF_FOUND) 33 | SET(LIBS ${LIBS} ${TIFF_LIBRARIES}) 34 | INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) 35 | ENDIF(TIFF_FOUND) 36 | 37 | IF(OPENEXR_FOUND) 38 | SET(LIBS ${LIBS} ${OPENEXR_LIBRARIES}) 39 | INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS}) 40 | ENDIF(OPENEXR_FOUND) 41 | 42 | IF(FREEIMAGE_FOUND) 43 | SET(LIBS ${LIBS} ${FREEIMAGE_LIBRARIES}) 44 | INCLUDE_DIRECTORIES(${FREEIMAGE_INCLUDE_PATH}) 45 | ENDIF(FREEIMAGE_FOUND) 46 | 47 | # targets 48 | ADD_DEFINITIONS(-DNVIMAGE_EXPORTS) 49 | 50 | IF(NVIMAGE_SHARED) 51 | ADD_DEFINITIONS(-DNVIMAGE_SHARED=1) 52 | ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS}) 53 | ELSE(NVIMAGE_SHARED) 54 | ADD_LIBRARY(nvimage ${IMAGE_SRCS}) 55 | ENDIF(NVIMAGE_SHARED) 56 | 57 | TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore posh bc6h bc7 nvmath) 58 | 59 | INSTALL(TARGETS nvimage 60 | RUNTIME DESTINATION bin 61 | LIBRARY DESTINATION lib 62 | ARCHIVE DESTINATION lib/static) 63 | 64 | -------------------------------------------------------------------------------- /src/nvimage/ColorSpace.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- jim@tilander.org 2 | 3 | #include "ColorSpace.h" 4 | 5 | #include "nvimage/Image.h" 6 | #include "nvmath/Color.h" 7 | 8 | 9 | namespace nv 10 | { 11 | void ColorSpace::RGBtoYCoCg_R(Image* img) 12 | { 13 | const uint w = img->width(); 14 | const uint h = img->height(); 15 | 16 | for( uint y=0; y < h; y++ ) 17 | { 18 | for( uint x=0; x < w; x++ ) 19 | { 20 | Color32 pixel = img->pixel(x, y); 21 | 22 | const int r = pixel.r; 23 | const int g = pixel.g; 24 | const int b = pixel.b; 25 | 26 | const int Co = r - b; 27 | const int t = b + Co/2; 28 | const int Cg = g - t; 29 | const int Y = t + Cg/2; 30 | 31 | // Just saturate the chroma here (we loose out of one bit in each channel) 32 | // this just means that we won't have as high dynamic range. Perhaps a better option 33 | // is to loose the least significant bit instead? 34 | pixel.r = clamp(Co + 128, 0, 255); 35 | pixel.g = clamp(Cg + 128, 0, 255); 36 | pixel.b = 0; 37 | pixel.a = Y; 38 | } 39 | } 40 | } 41 | 42 | void ColorSpace::YCoCg_RtoRGB(Image* img) 43 | { 44 | const uint w = img->width(); 45 | const uint h = img->height(); 46 | 47 | for( uint y=0; y < h; y++ ) 48 | { 49 | for( uint x=0; x < w; x++ ) 50 | { 51 | Color32 pixel = img->pixel(x, y); 52 | 53 | const int Co = (int)pixel.r - 128; 54 | const int Cg = (int)pixel.g - 128; 55 | const int Y = pixel.a; 56 | 57 | const int t = Y - Cg/2; 58 | const int g = Cg + t; 59 | const int b = t - Co/2; 60 | const int r = b + Co; 61 | 62 | pixel.r = r; 63 | pixel.g = g; 64 | pixel.b = b; 65 | pixel.a = 1; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/nvimage/ColorSpace.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- jim@tilander.org 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_COLORSPACE_H 5 | #define NV_IMAGE_COLORSPACE_H 6 | 7 | namespace nv 8 | { 9 | class Image; 10 | 11 | // Defines simple mappings between different color spaces and encodes them in the 12 | // input image. 13 | namespace ColorSpace 14 | { 15 | void RGBtoYCoCg_R(Image* img); 16 | void YCoCg_RtoRGB(Image* img); 17 | } 18 | } 19 | 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/nvimage/ErrorMetric.h: -------------------------------------------------------------------------------- 1 | 2 | #include "nvimage.h" 3 | #include "FloatImage.h" // For FloatImage::WrapMode 4 | 5 | 6 | namespace nv 7 | { 8 | class FloatImage; 9 | 10 | float rmsColorError(const FloatImage * ref, const FloatImage * img, bool alphaWeight); 11 | float rmsAlphaError(const FloatImage * ref, const FloatImage * img); 12 | 13 | float averageColorError(const FloatImage * ref, const FloatImage * img, bool alphaWeight); 14 | float averageAlphaError(const FloatImage * ref, const FloatImage * img); 15 | 16 | float rmsBilinearColorError(const FloatImage * ref, const FloatImage * img, FloatImage::WrapMode wm, bool alphaWeight); 17 | 18 | float cieLabError(const FloatImage * ref, const FloatImage * img); 19 | float cieLab94Error(const FloatImage * ref, const FloatImage * img); 20 | float spatialCieLabError(const FloatImage * ref, const FloatImage * img); 21 | 22 | float averageAngularError(const FloatImage * img0, const FloatImage * img1); 23 | float rmsAngularError(const FloatImage * img0, const FloatImage * img1); 24 | 25 | } // nv namespace 26 | -------------------------------------------------------------------------------- /src/nvimage/Image.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | #pragma once 3 | 4 | #include "nvimage.h" 5 | #include "nvcore/Debug.h" 6 | 7 | #if NV_USE_ALTIVEC 8 | #undef pixel 9 | #endif 10 | 11 | namespace nv 12 | { 13 | class Color32; 14 | 15 | // 32 bit ARGB image. 16 | class Image 17 | { 18 | public: 19 | 20 | enum Format : uint8 { 21 | Format_XRGB, 22 | Format_ARGB, 23 | }; 24 | 25 | Image() {} 26 | Image(const Image & img); 27 | ~Image(); 28 | 29 | const Image & operator=(const Image & img); 30 | 31 | 32 | void allocate(uint w, uint h, uint d = 1); 33 | void acquire(Color32 * data, uint w, uint h, uint d = 1); 34 | bool load(const char * name); 35 | void free(); 36 | 37 | void resize(uint w, uint h, uint d = 1); 38 | 39 | void wrap(void * data, uint w, uint h, uint d = 1); 40 | void unwrap(); 41 | 42 | const Color32 * scanline(uint h) const; 43 | Color32 * scanline(uint h); 44 | 45 | const Color32 * pixels() const; 46 | Color32 * pixels(); 47 | 48 | const Color32 & pixel(uint idx) const; 49 | Color32 & pixel(uint idx); 50 | 51 | const Color32 & pixel(uint x, uint y, uint z = 0) const; 52 | Color32 & pixel(uint x, uint y, uint z = 0); 53 | 54 | void fill(Color32 c); 55 | 56 | 57 | uint width = 0; 58 | uint height = 0; 59 | uint depth = 0; 60 | Format format = Format_XRGB; 61 | bool sRGB = false; 62 | Color32 * data = NULL; 63 | }; 64 | 65 | 66 | inline const Color32 & Image::pixel(uint x, uint y, uint z) const 67 | { 68 | nvDebugCheck(x < width && y < height && z < depth); 69 | return pixel((z * height + y) * width + x); 70 | } 71 | 72 | inline Color32 & Image::pixel(uint x, uint y, uint z) 73 | { 74 | nvDebugCheck(x < width && y < height && z < depth); 75 | return pixel((z * height + y) * width + x); 76 | } 77 | 78 | } // nv namespace 79 | -------------------------------------------------------------------------------- /src/nvimage/ImageIO.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | #pragma once 3 | 4 | #include "nvimage.h" 5 | 6 | namespace nv 7 | { 8 | class Image; 9 | class FloatImage; 10 | class Stream; 11 | 12 | namespace ImageIO 13 | { 14 | Image * load(const char * fileName); 15 | Image * load(const char * fileName, Stream & s); 16 | 17 | FloatImage * loadFloat(const char * fileName); 18 | FloatImage * loadFloat(const char * fileName, Stream & s); 19 | 20 | bool save(const char * fileName, const Image * img, const char ** tags=NULL); // NULL terminated list. 21 | bool save(const char * fileName, Stream & s, const Image * img, const char ** tags=NULL); 22 | 23 | bool saveFloat(const char * fileName, const FloatImage * fimage, uint baseComponent, uint componentCount); 24 | bool saveFloat(const char * fileName, Stream & s, const FloatImage * fimage, uint baseComponent, uint componentCount); 25 | 26 | } // ImageIO namespace 27 | 28 | } // nv namespace 29 | -------------------------------------------------------------------------------- /src/nvimage/KtxFile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvimage/KtxFile.cpp -------------------------------------------------------------------------------- /src/nvimage/KtxFile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvimage/KtxFile.h -------------------------------------------------------------------------------- /src/nvimage/PsdFile.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_PSDFILE_H 5 | #define NV_IMAGE_PSDFILE_H 6 | 7 | #include "nvcore/Stream.h" 8 | 9 | namespace nv 10 | { 11 | enum PsdColorMode 12 | { 13 | PsdColorMode_Bitmap = 0, 14 | PsdColorMode_GrayScale = 1, 15 | PsdColorMode_Indexed = 2, 16 | PsdColorMode_RGB = 3, 17 | PsdColorMode_CMYK = 4, 18 | PsdColorMode_MultiChannel = 7, 19 | PsdColorMode_DuoTone = 8, 20 | PsdColorMode_LabColor = 9 21 | }; 22 | 23 | /// PSD header. 24 | struct PsdHeader 25 | { 26 | uint32 signature; 27 | uint16 version; 28 | uint8 reserved[6]; 29 | uint16 channel_count; 30 | uint32 height; 31 | uint32 width; 32 | uint16 depth; 33 | uint16 color_mode; 34 | 35 | bool isValid() const 36 | { 37 | return signature == 0x38425053; // '8BPS' 38 | } 39 | 40 | bool isSupported() const 41 | { 42 | if (version != 1) { 43 | nvDebug("*** bad version number %u\n", version); 44 | return false; 45 | } 46 | if (channel_count > 4) { 47 | return false; 48 | } 49 | if (depth != 8) { // @@ Add support for 16 bit depths. 50 | return false; 51 | } 52 | if (color_mode != PsdColorMode_RGB) { 53 | return false; 54 | } 55 | return true; 56 | } 57 | }; 58 | 59 | 60 | inline Stream & operator<< (Stream & s, PsdHeader & head) 61 | { 62 | s << head.signature << head.version; 63 | for (int i = 0; i < 6; i++) { 64 | s << head.reserved[i]; 65 | } 66 | return s << head.channel_count << head.height << head.width << head.depth << head.color_mode; 67 | } 68 | 69 | } // nv namespace 70 | 71 | #endif // NV_IMAGE_PSDFILE_H 72 | -------------------------------------------------------------------------------- /src/nvimage/Quantize.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_QUANTIZE_H 5 | #define NV_IMAGE_QUANTIZE_H 6 | 7 | #include "nvimage.h" 8 | 9 | 10 | namespace nv 11 | { 12 | class Image; 13 | 14 | namespace Quantize 15 | { 16 | void RGB16(Image * img); 17 | void BinaryAlpha(Image * img, int alpha_threshold = 127); 18 | void Alpha4(Image * img); 19 | 20 | void FloydSteinberg_RGB16(Image * img); 21 | void FloydSteinberg_BinaryAlpha(Image * img, int alpha_threshold = 127); 22 | void FloydSteinberg_Alpha4(Image * img); 23 | 24 | void Truncate(Image * image, uint rsize, uint gsize, uint bsize, uint asize); 25 | void FloydSteinberg(Image * image, uint rsize, uint gsize, uint bsize, uint asize); 26 | 27 | // @@ Add palette quantization algorithms! 28 | } 29 | } 30 | 31 | 32 | #endif // NV_IMAGE_QUANTIZE_H 33 | -------------------------------------------------------------------------------- /src/nvimage/nvimage.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | #pragma once 3 | 4 | #include "nvcore/nvcore.h" 5 | #include "nvcore/Debug.h" // nvDebugCheck 6 | #include "nvcore/Utils.h" // isPowerOfTwo 7 | 8 | namespace nv { 9 | 10 | // Some utility functions: 11 | inline uint computeBitPitch(uint w, uint bitsize, uint alignmentInBits) 12 | { 13 | nvDebugCheck(isPowerOfTwo(alignmentInBits)); 14 | 15 | return ((w * bitsize + alignmentInBits - 1) / alignmentInBits) * alignmentInBits; 16 | } 17 | 18 | inline uint computeBytePitch(uint w, uint bitsize, uint alignmentInBytes) 19 | { 20 | uint pitch = computeBitPitch(w, bitsize, 8*alignmentInBytes); 21 | nvDebugCheck((pitch & 7) == 0); 22 | 23 | return (pitch + 7) / 8; 24 | } 25 | 26 | } // nv namespace 27 | -------------------------------------------------------------------------------- /src/nvmath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvmath) 2 | 3 | SET(MATH_SRCS 4 | nvmath.h 5 | Box.h Box.inl 6 | Color.h Color.inl 7 | Fitting.h Fitting.cpp 8 | Gamma.h Gamma.cpp 9 | Half.h Half.cpp 10 | Matrix.h Matrix.inl Matrix.cpp 11 | Plane.h Plane.inl Plane.cpp 12 | SphericalHarmonic.h SphericalHarmonic.cpp 13 | Vector.h Vector.inl) 14 | 15 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 16 | 17 | ADD_LIBRARY(nvmath ${MATH_SRCS}) 18 | 19 | TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore) 20 | 21 | INSTALL(TARGETS nvmath 22 | RUNTIME DESTINATION bin 23 | LIBRARY DESTINATION lib 24 | ARCHIVE DESTINATION lib/static) 25 | -------------------------------------------------------------------------------- /src/nvmath/Color.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "Color.h" 4 | #include "Color.inl" 5 | -------------------------------------------------------------------------------- /src/nvmath/Gamma.h: -------------------------------------------------------------------------------- 1 | // 2 | // Fast implementations of powf(x,5/11) and powf(x,11/5) for gamma conversion 3 | // Copyright 2017 Ken Cooke 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a 6 | // copy of this software and associated documentation files (the "Software"), 7 | // to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | // and/or sell copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included 13 | // in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | // 23 | 24 | #pragma once 25 | #ifndef NV_MATH_GAMMA_H 26 | #define NV_MATH_GAMMA_H 27 | 28 | #include "nvmath.h" 29 | 30 | namespace nv { 31 | 32 | // gamma conversion of float array (in-place is allowed) 33 | void powf_5_11(const float* src, float* dst, int count); 34 | void powf_11_5(const float* src, float* dst, int count); 35 | 36 | } // nv namespace 37 | 38 | #endif // NV_MATH_GAMMA_H 39 | -------------------------------------------------------------------------------- /src/nvmath/PackedFloat.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvmath/PackedFloat.cpp -------------------------------------------------------------------------------- /src/nvmath/PackedFloat.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_MATH_PACKEDFLOAT_H 5 | #define NV_MATH_PACKEDFLOAT_H 6 | 7 | #include "nvmath.h" 8 | #include "Vector.h" 9 | 10 | namespace nv 11 | { 12 | 13 | union FloatRGB9E5 { 14 | uint32 v; 15 | struct { 16 | #if NV_BIG_ENDIAN 17 | uint32 e : 5; 18 | uint32 zm : 9; 19 | uint32 ym : 9; 20 | uint32 xm : 9; 21 | #else 22 | uint32 xm : 9; 23 | uint32 ym : 9; 24 | uint32 zm : 9; 25 | uint32 e : 5; 26 | #endif 27 | }; 28 | }; 29 | 30 | union FloatR11G11B10 { 31 | uint32 v; 32 | struct { 33 | #if NV_BIG_ENDIAN 34 | uint32 ze : 5; 35 | uint32 zm : 5; 36 | uint32 ye : 5; 37 | uint32 ym : 6; 38 | uint32 xe : 5; 39 | uint32 xm : 6; 40 | #else 41 | uint32 xm : 6; 42 | uint32 xe : 5; 43 | uint32 ym : 6; 44 | uint32 ye : 5; 45 | uint32 zm : 5; 46 | uint32 ze : 5; 47 | #endif 48 | }; 49 | }; 50 | 51 | union FloatRGBE8 { 52 | uint32 v; 53 | struct { 54 | #if NV_LITTLE_ENDIAN 55 | uint8 r, g, b, e; 56 | #else 57 | uint8 e: 8; 58 | uint8 b: 8; 59 | uint8 g: 8; 60 | uint8 r: 8; 61 | #endif 62 | }; 63 | }; 64 | 65 | Vector3 rgb9e5_to_vector3(FloatRGB9E5 v); 66 | FloatRGB9E5 vector3_to_rgb9e5(const Vector3 & v); 67 | 68 | float float11_to_float32(uint v); 69 | float float10_to_float32(uint v); 70 | 71 | Vector3 r11g11b10_to_vector3(FloatR11G11B10 v); 72 | FloatR11G11B10 vector3_to_r11g11b10(const Vector3 & v); 73 | 74 | Vector3 rgbe8_to_vector3(FloatRGBE8 v); 75 | FloatRGBE8 vector3_to_rgbe8(const Vector3 & v); 76 | 77 | } // nv 78 | 79 | #endif // NV_MATH_PACKEDFLOAT_H 80 | -------------------------------------------------------------------------------- /src/nvmath/Plane.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "Plane.h" 4 | #include "Plane.inl" 5 | #include "Matrix.inl" 6 | 7 | namespace nv 8 | { 9 | Plane transformPlane(const Matrix & m, const Plane & p) 10 | { 11 | Vector3 newVec = transformVector(m, p.vector()); 12 | 13 | Vector3 ptInPlane = p.offset() * p.vector(); 14 | ptInPlane = transformPoint(m, ptInPlane); 15 | 16 | return Plane(newVec, ptInPlane); 17 | } 18 | 19 | Vector3 planeIntersection(const Plane & a, const Plane & b, const Plane & c) 20 | { 21 | return dot(a.vector(), cross(b.vector(), c.vector())) * ( 22 | a.offset() * cross(b.vector(), c.vector()) + 23 | c.offset() * cross(a.vector(), b.vector()) + 24 | b.offset() * cross(c.vector(), a.vector())); 25 | } 26 | 27 | } // nv namespace 28 | -------------------------------------------------------------------------------- /src/nvmath/Plane.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvmath/Plane.h -------------------------------------------------------------------------------- /src/nvmath/Plane.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvmath/Plane.inl -------------------------------------------------------------------------------- /src/nvmath/Vector.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "Vector.h" 4 | #include "Vector.inl" 5 | -------------------------------------------------------------------------------- /src/nvthread/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvthread) 2 | 3 | SET(THREAD_SRCS 4 | nvthread.h nvthread.cpp 5 | Atomic.h 6 | Event.h Event.cpp 7 | Mutex.h Mutex.cpp 8 | ParallelFor.h ParallelFor.cpp 9 | Thread.h Thread.cpp 10 | ThreadPool.h ThreadPool.cpp) 11 | 12 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 13 | 14 | # targets 15 | ADD_DEFINITIONS(-DNVTHREAD_EXPORTS) 16 | 17 | IF(NVTHREAD_SHARED) 18 | ADD_LIBRARY(nvthread SHARED ${THREAD_SRCS}) 19 | ELSE(NVTHREAD_SHARED) 20 | ADD_LIBRARY(nvthread ${THREAD_SRCS}) 21 | ENDIF(NVTHREAD_SHARED) 22 | 23 | TARGET_LINK_LIBRARIES(nvthread ${LIBS} nvcore) 24 | 25 | INSTALL(TARGETS nvthread 26 | RUNTIME DESTINATION bin 27 | LIBRARY DESTINATION lib 28 | ARCHIVE DESTINATION lib/static) 29 | -------------------------------------------------------------------------------- /src/nvthread/Event.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #include "Event.h" 4 | 5 | #if NV_OS_WIN32 6 | #include "Win32.h" 7 | #elif NV_OS_USE_PTHREAD 8 | #include 9 | #endif 10 | 11 | using namespace nv; 12 | 13 | #if NV_OS_WIN32 14 | 15 | struct Event::Private { 16 | HANDLE handle; 17 | }; 18 | 19 | Event::Event() : m(new Private) { 20 | m->handle = CreateEvent(/*lpEventAttributes=*/NULL, /*bManualReset=*/FALSE, /*bInitialState=*/FALSE, /*lpName=*/NULL); 21 | } 22 | 23 | Event::~Event() { 24 | CloseHandle(m->handle); 25 | } 26 | 27 | void Event::post() { 28 | SetEvent(m->handle); 29 | } 30 | 31 | void Event::wait() { 32 | WaitForSingleObject(m->handle, INFINITE); 33 | } 34 | 35 | #elif NV_OS_USE_PTHREAD 36 | 37 | struct Event::Private { 38 | pthread_cond_t pt_cond; 39 | pthread_mutex_t pt_mutex; 40 | int count; 41 | int wait_count; 42 | }; 43 | 44 | Event::Event() : m(new Private) { 45 | m->count=0; 46 | m->wait_count=0; 47 | pthread_mutex_init(&m->pt_mutex, NULL); 48 | pthread_cond_init(&m->pt_cond, NULL); 49 | } 50 | 51 | Event::~Event() { 52 | pthread_cond_destroy(&m->pt_cond); 53 | pthread_mutex_destroy(&m->pt_mutex); 54 | } 55 | 56 | void Event::post() { 57 | pthread_mutex_lock(&m->pt_mutex); 58 | 59 | m->count++; 60 | 61 | //ACS: move this after the unlock? 62 | if(m->wait_count>0) { 63 | pthread_cond_signal(&m->pt_cond); 64 | } 65 | 66 | pthread_mutex_unlock(&m->pt_mutex); 67 | } 68 | 69 | void Event::wait() { 70 | pthread_mutex_lock(&m->pt_mutex); 71 | 72 | while(m->count==0) { 73 | m->wait_count++; 74 | pthread_cond_wait(&m->pt_cond, &m->pt_mutex); 75 | m->wait_count--; 76 | } 77 | m->count--; 78 | 79 | pthread_mutex_unlock(&m->pt_mutex); 80 | } 81 | 82 | #endif // NV_OS_UNIX 83 | 84 | 85 | /*static*/ void Event::post(Event * events, uint count) { 86 | for (uint i = 0; i < count; i++) { 87 | events[i].post(); 88 | } 89 | } 90 | 91 | /*static*/ void Event::wait(Event * events, uint count) { 92 | // @@ Use wait for multiple objects in win32? 93 | 94 | for (uint i = 0; i < count; i++) { 95 | events[i].wait(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/nvthread/Event.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_THREAD_EVENT_H 5 | #define NV_THREAD_EVENT_H 6 | 7 | #include "nvthread.h" 8 | 9 | #include "nvcore/Ptr.h" 10 | 11 | namespace nv 12 | { 13 | // This is intended to be used by a single waiter thread. 14 | class NVTHREAD_CLASS Event 15 | { 16 | NV_FORBID_COPY(Event); 17 | public: 18 | Event(); 19 | ~Event(); 20 | 21 | void post(); 22 | void wait(); // Wait resets the event. 23 | 24 | static void post(Event * events, uint count); 25 | static void wait(Event * events, uint count); 26 | 27 | private: 28 | struct Private; 29 | AutoPtr m; 30 | }; 31 | 32 | } // nv namespace 33 | 34 | #endif // NV_THREAD_EVENT_H 35 | -------------------------------------------------------------------------------- /src/nvthread/Mutex.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_THREAD_MUTEX_H 5 | #define NV_THREAD_MUTEX_H 6 | 7 | #include "nvthread.h" 8 | 9 | #include "nvcore/Ptr.h" 10 | 11 | namespace nv 12 | { 13 | 14 | class NVTHREAD_CLASS Mutex 15 | { 16 | NV_FORBID_COPY(Mutex); 17 | public: 18 | Mutex (const char * name); 19 | ~Mutex (); 20 | 21 | void lock(); 22 | bool tryLock(); 23 | void unlock(); 24 | 25 | private: 26 | struct Private; 27 | AutoPtr m; 28 | }; 29 | 30 | 31 | // Templated lock that can be used with any mutex. 32 | template 33 | class Lock 34 | { 35 | NV_FORBID_COPY(Lock); 36 | public: 37 | 38 | Lock (M & m) : m_mutex (m) { m_mutex.lock(); } 39 | ~Lock () { m_mutex.unlock(); } 40 | 41 | private: 42 | M & m_mutex; 43 | }; 44 | 45 | } // nv namespace 46 | 47 | #endif // NV_THREAD_MUTEX_H 48 | -------------------------------------------------------------------------------- /src/nvthread/ParallelFor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvthread/ParallelFor.cpp -------------------------------------------------------------------------------- /src/nvthread/ParallelFor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvthread/ParallelFor.h -------------------------------------------------------------------------------- /src/nvthread/Thread.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_THREAD_THREAD_H 5 | #define NV_THREAD_THREAD_H 6 | 7 | #include "nvthread.h" 8 | 9 | #include "nvcore/Ptr.h" // AutoPtr 10 | 11 | namespace nv 12 | { 13 | typedef void ThreadFunc(void * arg); 14 | 15 | class NVTHREAD_CLASS Thread 16 | { 17 | NV_FORBID_COPY(Thread); 18 | public: 19 | Thread(); 20 | Thread(const char * name); 21 | ~Thread(); 22 | 23 | void setName(const char * name); 24 | 25 | void start(ThreadFunc * func, void * arg); 26 | void wait(); 27 | 28 | bool isRunning() const; 29 | 30 | static void spinWait(uint count); 31 | static void yield(); 32 | static void sleep(uint ms); 33 | 34 | static void wait(Thread * threads, uint count); 35 | 36 | struct Private; 37 | AutoPtr p; 38 | }; 39 | 40 | } // nv namespace 41 | 42 | #endif // NV_THREAD_THREAD_H 43 | -------------------------------------------------------------------------------- /src/nvthread/Win32.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | // Never include this from a header file. 4 | 5 | #define WIN32_LEAN_AND_MEAN 6 | #define VC_EXTRALEAN 7 | #define _WIN32_WINNT 0x0400 // for SwitchToThread, TryEnterCriticalSection 8 | #include 9 | //#include // for _beginthreadex -------------------------------------------------------------------------------- /src/nvtt/Compressor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #ifndef NVTT_COMPRESSOR_H 26 | #define NVTT_COMPRESSOR_H 27 | 28 | #include "nvtt.h" 29 | #include "nvcore/nvcore.h" // uint 30 | 31 | namespace nv 32 | { 33 | 34 | struct CompressorInterface 35 | { 36 | virtual ~CompressorInterface() {} 37 | virtual void compress(nvtt::AlphaMode alphaMode, uint w, uint h, uint d, const float * rgba, nvtt::TaskDispatcher * dispatcher, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions) = 0; 38 | }; 39 | 40 | } // nv namespace 41 | 42 | #endif // NVTT_COMPRESSOR_H 43 | -------------------------------------------------------------------------------- /src/nvtt/CompressorDX11.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, 7 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following 10 | // conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | // OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef NVTT_COMPRESSORDX11_H 25 | #define NVTT_COMPRESSORDX11_H 26 | 27 | #include "BlockCompressor.h" 28 | 29 | namespace nv 30 | { 31 | struct CompressorBC6 : public FloatColorCompressor 32 | { 33 | virtual void compressBlock(Vector4 colors[16], float weights[16], const nvtt::CompressionOptions::Private & compressionOptions, void * output); 34 | virtual uint blockSize(const nvtt::CompressionOptions::Private & ) const { return 16; } 35 | }; 36 | 37 | struct CompressorBC7 : public FloatColorCompressor 38 | { 39 | virtual void compressBlock(Vector4 colors[16], float weights[16], const nvtt::CompressionOptions::Private & compressionOptions, void * output); 40 | virtual uint blockSize(const nvtt::CompressionOptions::Private & ) const { return 16; } 41 | }; 42 | 43 | } // nv namespace 44 | 45 | 46 | #endif // NVTT_COMPRESSORDX11_H 47 | -------------------------------------------------------------------------------- /src/nvtt/CompressorDXT5_RGBM.h: -------------------------------------------------------------------------------- 1 | 2 | namespace nv { 3 | 4 | struct BlockDXT5; 5 | class Vector4; 6 | 7 | float compress_dxt5_rgbm(const Vector4 input_colors[16], const float input_weights[16], float min_m, BlockDXT5 * output); 8 | float compress_etc2_rgbm(Vector4 input_colors[16], float input_weights[16], float min_m, void * output); 9 | } 10 | -------------------------------------------------------------------------------- /src/nvtt/CompressorETC.h: -------------------------------------------------------------------------------- 1 | #include "nvcore/nvcore.h" 2 | 3 | namespace nv { 4 | 5 | class Vector3; 6 | class Vector4; 7 | 8 | void decompress_etc(const void * input_block, Vector4 output_colors[16]); 9 | void decompress_eac(const void * input_block, Vector4 output_colors[16], int output_channel); 10 | void decompress_etc_eac(const void * input_block, Vector4 output_colors[16]); 11 | 12 | float compress_etc1(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 13 | float compress_etc2(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 14 | float compress_etc2_a1(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 15 | float compress_eac(Vector4 input_colors[16], float input_weights[16], int input_channel, int search_radius, bool use_11bit_mode, void * output); 16 | float compress_etc2_eac(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 17 | 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/nvtt/CompressorRGB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #ifndef NVTT_COMPRESSORRGB_H 26 | #define NVTT_COMPRESSORRGB_H 27 | 28 | #include "Compressor.h" 29 | 30 | namespace nv 31 | { 32 | struct PixelFormatConverter : public CompressorInterface 33 | { 34 | virtual void compress(nvtt::AlphaMode alphaMode, uint w, uint h, uint d, const float * data, nvtt::TaskDispatcher * dispatcher, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); 35 | }; 36 | 37 | } // nv namespace 38 | 39 | 40 | #endif // NVTT_COMPRESSORRGB_H 41 | -------------------------------------------------------------------------------- /src/nvtt/CubeSurface.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvtt/CubeSurface.cpp -------------------------------------------------------------------------------- /src/nvtt/SingleColorLookup.h: -------------------------------------------------------------------------------- 1 | 2 | #include "nvcore/nvcore.h" // uint8 3 | 4 | extern uint8 OMatch5[256][2]; 5 | extern uint8 OMatch6[256][2]; 6 | extern uint8 OMatchAlpha5[256][2]; 7 | extern uint8 OMatchAlpha6[256][2]; 8 | 9 | void initSingleColorLookup(); -------------------------------------------------------------------------------- /src/nvtt/TaskDispatcher.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-texture-tools/aeddd65f81d36d8cb7b169b469ef25156666077e/src/nvtt/TaskDispatcher.cpp -------------------------------------------------------------------------------- /src/nvtt/cuda/CudaUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #ifndef NV_TT_CUDAUTILS_H 26 | #define NV_TT_CUDAUTILS_H 27 | 28 | namespace nv 29 | { 30 | 31 | namespace cuda 32 | { 33 | bool isHardwarePresent(); 34 | int deviceCount(); 35 | int getFastestDevice(); 36 | bool setDevice(int i); 37 | void exit(); 38 | }; 39 | 40 | } // nv namespace 41 | 42 | 43 | #endif // NV_TT_CUDAUTILS_H 44 | -------------------------------------------------------------------------------- /src/nvtt/experimental/nvtt_experimental.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "nvtt_experimental.h" 3 | 4 | struct NvttTexture 5 | { 6 | NvttTexture() : 7 | m_constant(false), 8 | m_image(NULL), 9 | m_floatImage(NULL) 10 | { 11 | } 12 | 13 | ~NvttTexture() 14 | { 15 | if (m_constant && m_image) m_image->unwrap(); 16 | delete m_image; 17 | delete m_floatImage; 18 | } 19 | 20 | bool m_constant; 21 | Image * m_image; 22 | FloatImage * m_floatImage; 23 | }; 24 | 25 | NvttTexture * nvttCreateTexture() 26 | { 27 | return new NvttTexture(); 28 | } 29 | 30 | void nvttDestroyTexture(NvttTexture * tex) 31 | { 32 | delete tex; 33 | } 34 | 35 | void nvttSetImageData(NvttImage * img, NvttInputFormat format, uint w, uint h, void * data) 36 | { 37 | nvCheck(img != NULL); 38 | 39 | if (format == NVTT_InputFormat_BGRA_8UB) 40 | { 41 | img->m_constant = false; 42 | img->m_image->allocate(w, h); 43 | memcpy(img->m_image->pixels(), data, w * h * 4); 44 | } 45 | else 46 | { 47 | nvCheck(false); 48 | } 49 | } 50 | 51 | void nvttCompressImage(NvttImage * img, NvttFormat format) 52 | { 53 | nvCheck(img != NULL); 54 | 55 | // @@ Invoke appropriate compressor. 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/nvtt/experimental/test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "nvtt_experimental.h" 3 | 4 | /* 5 | Errors in the original API: 6 | - Too many memory copies. 7 | - Implementation too complicated. 8 | - Error output should not be in output options. 9 | - Data driven interface. Follows the dialog model. Provide all the data upfront. 10 | */ 11 | 12 | 13 | // Output texture with mipmaps 14 | void example0() 15 | { 16 | CompressionOptions compressionOptions; 17 | OutputOptions outputOptions; 18 | 19 | Texture img; 20 | img.setTexture2D(format, w, h, 0, data); 21 | 22 | Compressor context; 23 | context.outputHeader(outputOptions); 24 | context.outputCompressed(img, compressionOptions, outputOptions); 25 | 26 | img.toLinear(2.2); 27 | while (img.downsample(NVTT_FILTER_BOX)) 28 | { 29 | img.toGamma(2.2); 30 | outputCompressed(img, compressionOptions, outputOptions); 31 | } 32 | } 33 | 34 | 35 | // Output texture with colored mipmaps 36 | void example1() 37 | { 38 | CompressionOptions compressionOptions; 39 | OutputOptions outputOptions; 40 | 41 | Texture img; 42 | img.setTexture2D(format, w, h, 0, data); 43 | 44 | Compressor context; 45 | context.outputHeader(outputOptions); 46 | context.outputCompressed(img, compressionOptions, outputOptions); 47 | 48 | img.toLinear(2.2); 49 | while (img.downsample(NVTT_FILTER_BOX)) 50 | { 51 | img.toGamma(2.2); 52 | 53 | Texture mipmap = img; 54 | mipmap.blend(color[i].r, color[i].g, color[i].b, 0.5f); 55 | 56 | context.outputCompressed(mipmap, compressionOptions, outputOptions); 57 | } 58 | } 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/nvtt/icbc.cpp: -------------------------------------------------------------------------------- 1 | #define ICBC_IMPLEMENTATION 2 | //#define ICBC_SIMD 2 // SSE4.1 3 | #include "icbc.h" 4 | -------------------------------------------------------------------------------- /src/nvtt/squish/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvsquish) 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 4 | 5 | SET(SQUISH_SRCS 6 | fastclusterfit.cpp 7 | fastclusterfit.h 8 | weightedclusterfit.cpp 9 | weightedclusterfit.h 10 | colourblock.cpp 11 | colourblock.h 12 | colourfit.cpp 13 | colourfit.h 14 | colourset.cpp 15 | colourset.h 16 | config.h 17 | maths.cpp 18 | maths.h 19 | simd.h 20 | simd_sse.h 21 | simd_ve.h) 22 | 23 | ADD_LIBRARY(nvsquish STATIC ${SQUISH_SRCS}) 24 | -------------------------------------------------------------------------------- /src/nvtt/squish/ChangeLog: -------------------------------------------------------------------------------- 1 | 2 | 1.7 3 | * Fixed floating-point equality issue in clusterfit sort (x86 affected only) 4 | * Implemented proper SSE(2) floor function for 50% speedup on SSE builds 5 | * The range fit implementation now uses the correct colour metric 6 | 7 | 1.6 8 | * Fixed bug in CompressImage where masked pixels were not skipped over 9 | * DXT3 and DXT5 alpha compression now properly use the mask to ignore pixels 10 | * Fixed major DXT1 bug that can generate unexpected transparent pixels 11 | 12 | 1.5 13 | * Added CompressMasked function to handle incomplete DXT blocks more cleanly 14 | * Added kWeightColourByAlpha flag for better quality images when alpha blending 15 | 16 | 1.4 17 | * Fixed stack overflow in rangefit 18 | 19 | 1.3 20 | * Worked around SSE floor implementation bug, proper fix needed! 21 | * This release has visual studio and makefile builds that work 22 | 23 | 1.2 24 | * Added provably optimal single colour compressor 25 | * Added extra/squishgen.cpp that generates single colour lookup tables 26 | 27 | 1.1 28 | * Fixed a DXT1 colour output bug 29 | * Changed argument order for Decompress function to match Compress 30 | * Added GetStorageRequirements function 31 | * Added CompressImage function 32 | * Added DecompressImage function 33 | * Moved squishtool.cpp to extra/squishpng.cpp 34 | * Added extra/squishtest.cpp 35 | 36 | 1.0 37 | * Initial release 38 | 39 | -------------------------------------------------------------------------------- /src/nvtt/squish/README: -------------------------------------------------------------------------------- 1 | LICENSE 2 | ------- 3 | 4 | The squish library is distributed under the terms and conditions of the MIT 5 | license. This license is specified at the top of each source file and must be 6 | preserved in its entirety. 7 | 8 | BUILDING AND INSTALLING THE LIBRARY 9 | ----------------------------------- 10 | 11 | If you are using Visual Studio 2003 or above under Windows then load the Visual 12 | Studio 2003 project in the vs7 folder. By default, the library is built using 13 | SSE optimisations. To change this either change or remove the SQUISH_USE_SSE=1 14 | from the preprocessor symbols. 15 | 16 | If you are using a Mac then load the Xcode 2.2 project in the distribution. By 17 | default, the library is built using Altivec optimisations. To change this 18 | either change or remove SQUISH_USE_ALTIVEC=1 from the preprocessor symbols. I 19 | guess I'll have to think about changing this for the new Intel Macs that are 20 | rolling out... 21 | 22 | If you are using unix then first edit the config file in the base directory of 23 | the distribution, enabling Altivec or SSE with the USE_ALTIVEC or USE_SSE 24 | variables, and editing the optimisation flags passed to the C++ compiler if 25 | necessary. Then make can be used to build the library, and make install (from 26 | the superuser account) can be used to install (into /usr/local by default). 27 | 28 | REPORTING BUGS OR FEATURE REQUESTS 29 | ---------------------------------- 30 | 31 | Feedback can be sent to Simon Brown (the developer) at si@sjbrown.co.uk 32 | 33 | New releases are announced on the squish library homepage at 34 | http://sjbrown.co.uk/?code=squish 35 | 36 | -------------------------------------------------------------------------------- /src/nvtt/squish/alpha.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_ALPHA_H 27 | #define SQUISH_ALPHA_H 28 | 29 | #include "squish.h" 30 | 31 | namespace squish { 32 | 33 | void CompressAlphaDxt3( u8 const* rgba, void* block ); 34 | void CompressAlphaDxt5( u8 const* rgba, void* block ); 35 | 36 | void DecompressAlphaDxt3( u8* rgba, void const* block ); 37 | void DecompressAlphaDxt5( u8* rgba, void const* block ); 38 | 39 | } // namespace squish 40 | 41 | #endif // ndef SQUISH_ALPHA_H 42 | -------------------------------------------------------------------------------- /src/nvtt/squish/colourblock.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef NV_SQUISH_COLOURBLOCK_H 27 | #define NV_SQUISH_COLOURBLOCK_H 28 | 29 | #include "squish.h" 30 | #include "maths.h" 31 | 32 | namespace nvsquish { 33 | 34 | void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); 35 | void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); 36 | //void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ); 37 | //void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ); 38 | 39 | void DecompressColour( u8* rgba, void const* block, bool isDxt1 ); 40 | 41 | } // namespace squish 42 | 43 | #endif // ndef SQUISH_COLOURBLOCK_H 44 | -------------------------------------------------------------------------------- /src/nvtt/squish/colourfit.cpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #include "colourfit.h" 27 | #include "colourset.h" 28 | 29 | namespace nvsquish { 30 | 31 | ColourFit::ColourFit() 32 | { 33 | } 34 | 35 | void ColourFit::SetColourSet( ColourSet const* colours, int flags ) 36 | { 37 | m_colours = colours; 38 | m_flags = flags; 39 | } 40 | 41 | void ColourFit::Compress( void* block ) 42 | { 43 | bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 ); 44 | if( isDxt1 ) 45 | { 46 | Compress3( block ); 47 | 48 | if( !m_colours->IsTransparent() ) 49 | { 50 | Compress4( block ); 51 | } 52 | } 53 | else 54 | { 55 | Compress4( block ); 56 | } 57 | } 58 | 59 | } // namespace squish 60 | -------------------------------------------------------------------------------- /src/nvtt/squish/colourfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef NV_SQUISH_COLOURFIT_H 27 | #define NV_SQUISH_COLOURFIT_H 28 | 29 | #include "squish.h" 30 | #include "maths.h" 31 | 32 | namespace nvsquish { 33 | 34 | class ColourSet; 35 | 36 | class ColourFit 37 | { 38 | public: 39 | ColourFit(); 40 | 41 | void SetColourSet( ColourSet const* colours, int flags ); 42 | 43 | void Compress( void* block ); 44 | 45 | protected: 46 | virtual void Compress3( void* block ) = 0; 47 | virtual void Compress4( void* block ) = 0; 48 | 49 | ColourSet const* m_colours; 50 | int m_flags; 51 | }; 52 | 53 | } // namespace squish 54 | 55 | #endif // ndef SQUISH_COLOURFIT_H 56 | -------------------------------------------------------------------------------- /src/nvtt/squish/config: -------------------------------------------------------------------------------- 1 | # config file used for the Makefile only 2 | 3 | # define to 1 to use altivec instructions 4 | USE_ALTIVEC ?= 0 5 | 6 | # define to 1 to use sse instructions 7 | USE_SSE ?= 0 8 | 9 | # default flags 10 | CXXFLAGS ?= -O2 11 | ifeq ($(USE_ALTIVEC),1) 12 | CPPFLAGS += -DSQUISH_USE_ALTIVEC=1 13 | CXXFLAGS += -maltivec 14 | endif 15 | ifeq ($(USE_SSE),1) 16 | CPPFLAGS += -DSQUISH_USE_SSE=1 17 | CXXFLAGS += -msse 18 | endif 19 | 20 | # where should we install to 21 | INSTALL_DIR ?= /usr/local 22 | 23 | -------------------------------------------------------------------------------- /src/nvtt/squish/config.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_CONFIG_H 27 | #define SQUISH_CONFIG_H 28 | 29 | // Set to 1 when building squish to use altivec instructions. 30 | #ifndef SQUISH_USE_ALTIVEC 31 | # define SQUISH_USE_ALTIVEC defined(__VEC__) 32 | #endif 33 | 34 | // Set to 1 when building squish to use sse instructions. 35 | #ifndef SQUISH_USE_SSE 36 | # if defined(__SSE2__) 37 | # define SQUISH_USE_SSE 2 38 | # elif defined(__SSE__) 39 | # define SQUISH_USE_SSE 1 40 | # else 41 | # define SQUISH_USE_SSE 0 42 | # endif 43 | #endif 44 | 45 | // Internally et SQUISH_USE_SIMD when either altivec or sse is available. 46 | #if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE 47 | # error "Cannot enable both altivec and sse!" 48 | #endif 49 | #if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE 50 | # define SQUISH_USE_SIMD 1 51 | #else 52 | # define SQUISH_USE_SIMD 0 53 | #endif 54 | 55 | #endif // ndef SQUISH_CONFIG_H 56 | -------------------------------------------------------------------------------- /src/nvtt/squish/rangefit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_RANGEFIT_H 27 | #define SQUISH_RANGEFIT_H 28 | 29 | #include 30 | #include "colourfit.h" 31 | #include "maths.h" 32 | 33 | namespace squish { 34 | 35 | class ColourSet; 36 | 37 | class RangeFit : public ColourFit 38 | { 39 | public: 40 | RangeFit( ColourSet const* colours, int flags ); 41 | 42 | private: 43 | virtual void Compress3( void* block ); 44 | virtual void Compress4( void* block ); 45 | 46 | Vec3 m_metric; 47 | Vec3 m_start; 48 | Vec3 m_end; 49 | float m_besterror; 50 | }; 51 | 52 | } // squish 53 | 54 | #endif // ndef SQUISH_RANGEFIT_H 55 | -------------------------------------------------------------------------------- /src/nvtt/squish/simd.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef NV_SQUISH_SIMD_H 27 | #define NV_SQUISH_SIMD_H 28 | 29 | #include "maths.h" 30 | 31 | #ifdef __GNUC__ 32 | # define SQUISH_ALIGN_16 __attribute__ ((__aligned__ (16))) 33 | #else 34 | # define SQUISH_ALIGN_16 __declspec(align(16)) 35 | #endif 36 | 37 | #if SQUISH_USE_ALTIVEC 38 | #include "simd_ve.h" 39 | #endif 40 | 41 | #if SQUISH_USE_SSE 42 | #include "simd_sse.h" 43 | #endif 44 | 45 | #endif // ndef SQUISH_SIMD_H 46 | -------------------------------------------------------------------------------- /src/nvtt/squish/singlechannelfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | Copyright (c) 2006 Ignacio Castano castanyo@yahoo.es 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included 15 | in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------- */ 26 | 27 | #ifndef SQUISH_SINGLECHANNELFIT_H 28 | #define SQUISH_SINGLECHANNELFIT_H 29 | 30 | #include 31 | #include "maths.h" 32 | #include "colourfit.h" 33 | 34 | namespace squish { 35 | 36 | class SingleChannelFit : public ColourFit 37 | { 38 | public: 39 | SingleChannelFit( ColourSet const* colours, int flags ); 40 | 41 | private: 42 | virtual void Compress3( void* block ); 43 | virtual void Compress4( void* block ); 44 | 45 | private: 46 | u8 m_greys[16]; 47 | int m_g_min; 48 | int m_g_max; 49 | }; 50 | 51 | } // namespace squish 52 | 53 | #endif // ndef SQUISH_SINGLECHANNELFIT_H 54 | -------------------------------------------------------------------------------- /src/nvtt/squish/singlecolourfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_SINGLECOLOURFIT_H 27 | #define SQUISH_SINGLECOLOURFIT_H 28 | 29 | #include 30 | #include "colourfit.h" 31 | 32 | namespace squish { 33 | 34 | class ColourSet; 35 | struct SingleColourLookup; 36 | 37 | class SingleColourFit : public ColourFit 38 | { 39 | public: 40 | SingleColourFit( ColourSet const* colours, int flags ); 41 | 42 | private: 43 | virtual void Compress3( void* block ); 44 | virtual void Compress4( void* block ); 45 | 46 | void ComputeEndPoints( int count, SingleColourLookup const* const* lookups ); 47 | 48 | u8 m_colour[3]; 49 | Vec3 m_start; 50 | Vec3 m_end; 51 | u8 m_index; 52 | int m_error; 53 | int m_besterror; 54 | }; 55 | 56 | } // namespace squish 57 | 58 | #endif // ndef SQUISH_SINGLECOLOURFIT_H 59 | -------------------------------------------------------------------------------- /src/nvtt/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | ADD_EXECUTABLE(filtertest filtertest.cpp ../tools/cmdline.h) 3 | TARGET_LINK_LIBRARIES(filtertest nvcore nvmath nvimage nvtt) 4 | 5 | ADD_EXECUTABLE(nvtestsuite testsuite.cpp) 6 | TARGET_LINK_LIBRARIES(nvtestsuite nvcore nvmath nvimage nvtt) 7 | ADD_TEST(NVTT.TestSuite.Kodak.cuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 0 -out output-cuda-kodak) 8 | ADD_TEST(NVTT.TestSuite.Waterloo.cuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 1 -out output-cuda-waterloo) 9 | ADD_TEST(NVTT.TestSuite.Epic.cuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 2 -out output-cuda-epic) 10 | ADD_TEST(NVTT.TestSuite.Kodak.nocuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 0 -nocuda -out output-nocuda-kodak) 11 | ADD_TEST(NVTT.TestSuite.Waterloo.nocuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 1 -nocuda -out output-nocuda-waterloo) 12 | ADD_TEST(NVTT.TestSuite.Epic.nocuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 2 -nocuda -out output-nocuda-epic) 13 | 14 | IF (CUDA_FOUND) 15 | ADD_EXECUTABLE(driverapitest driverapi.cpp) 16 | TARGET_LINK_LIBRARIES(driverapitest nvcore nvmath nvimage nvtt) 17 | ENDIF (CUDA_FOUND) 18 | 19 | ADD_EXECUTABLE(imperativeapi imperativeapi.cpp) 20 | TARGET_LINK_LIBRARIES(imperativeapi nvcore nvmath nvimage nvtt) 21 | 22 | ADD_EXECUTABLE(process_alpha_map process_alpha_map.cpp) 23 | TARGET_LINK_LIBRARIES(process_alpha_map nvcore nvmath nvimage nvtt) 24 | 25 | ADD_EXECUTABLE(cubemaptest cubemaptest.cpp) 26 | TARGET_LINK_LIBRARIES(cubemaptest nvcore nvmath nvimage nvtt) 27 | 28 | ADD_EXECUTABLE(nvhdrtest hdrtest.cpp) 29 | TARGET_LINK_LIBRARIES(nvhdrtest nvcore nvimage nvtt bc6h nvmath) 30 | 31 | #ADD_EXECUTABLE(bc1enc bc1enc.cpp) 32 | #TARGET_LINK_LIBRARIES(bc1enc nvcore nvimage nvmath squish CMP_Core) 33 | 34 | INSTALL(TARGETS nvtestsuite nvhdrtest DESTINATION bin) 35 | 36 | #include_directories("/usr/include/ffmpeg/") 37 | #ADD_EXECUTABLE(nvmpegenc tools/mpegenc.cpp tools/cmdline.h) 38 | #TARGET_LINK_LIBRARIES(nvmpegenc nvcore nvmath nvimage avcodec z) 39 | #INSTALL(TARGETS nvmpegenc DESTINATION bin) 40 | 41 | -------------------------------------------------------------------------------- /src/nvtt/tests/ctest.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | int main(void) 8 | { 9 | NvttInputOptions inputOptions = 0; 10 | NvttOutputOptions outputOptions = 0; 11 | NvttCompressionOptions compressionOptions = 0; 12 | 13 | const unsigned int img[16*16]; 14 | 15 | memset(img, 0, sizeof(unsigned int) * 16 * 16); 16 | 17 | inputOptions = nvttCreateInputOptions(); 18 | nvttSetInputOptionsTextureLayout(inputOptions, NVTT_TextureType_2D, 16, 16, 1); 19 | nvttSetInputOptionsMipmapData(inputOptions, img, 16, 16, 1, 0, 0); 20 | 21 | outputOptions = nvttCreateOutputOptions(); 22 | nvttSetOutputOptionsFileName(outputOptions, "output.dds"); 23 | 24 | compressionOptions = nvttCreateCompressionOptions(); 25 | nvttSetCompressionOptionsFormat(compressionOptions, NVTT_Format_BC1); 26 | 27 | nvttCompress(inputOptions, outputOptions, compressionOptions); 28 | 29 | nvttDestroyCompressionOptions(compressionOptions); 30 | nvttDestroyOutputOptions(outputOptions); 31 | nvttDestroyInputOptions(inputOptions); 32 | 33 | return 0; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/nvtt/tests/filtertest.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "../tools/cmdline.h" 4 | 5 | #include 6 | 7 | using namespace nv; 8 | 9 | int main(void) 10 | { 11 | // MyAssertHandler assertHandler; 12 | MyMessageHandler messageHandler; 13 | 14 | BoxFilter box1(0.5); 15 | Kernel1 k1(box1, 2); 16 | k1.debugPrint(); nvDebug("\n"); 17 | 18 | BoxFilter box2(1); 19 | Kernel1 k2(box2, 2); 20 | k2.debugPrint(); nvDebug("\n"); 21 | 22 | BoxFilter boxr3(1); 23 | Kernel1 k3(boxr3, 2); 24 | k3.debugPrint(); nvDebug("\n"); 25 | 26 | KaiserFilter kai4(5); 27 | kai4.setParameters(4, 2); 28 | Kernel1 k4(kai4, 2); 29 | k4.debugPrint(); nvDebug("\n"); 30 | 31 | /* Kernel1 k3(3); 32 | Kernel1 k4(9); 33 | Kernel1 k5(10); 34 | 35 | // k3.initFilter(Filter::Box); 36 | // k4.initFilter(Filter::Box); 37 | // k5.initFilter(Filter::Box); 38 | 39 | // nvDebug("Box Filter:\n"); 40 | // k3.debugPrint(); nvDebug("\n"); 41 | // k4.debugPrint(); nvDebug("\n"); 42 | // k5.debugPrint(); nvDebug("\n"); 43 | 44 | k3.initSinc(0.75); 45 | k4.initSinc(0.75); 46 | k5.initSinc(0.75); 47 | 48 | nvDebug("Sinc Filter:\n"); 49 | k3.debugPrint(); nvDebug("\n"); 50 | k4.debugPrint(); nvDebug("\n"); 51 | k5.debugPrint(); nvDebug("\n"); 52 | 53 | k3.initKaiser(4, 1, 100); 54 | k4.initKaiser(4, 1, 100); 55 | k5.initKaiser(4, 1, 100); 56 | 57 | nvDebug("Kaiser Filter:\n"); 58 | k3.debugPrint(); nvDebug("\n"); 59 | k4.debugPrint(); nvDebug("\n"); 60 | k5.debugPrint(); nvDebug("\n"); 61 | 62 | k3.initKaiser(4, 1, 10); 63 | k4.initKaiser(4, 1, 10); 64 | k5.initKaiser(4, 1, 10); 65 | 66 | nvDebug("Kaiser Filter 2:\n"); 67 | k3.debugPrint(); nvDebug("\n"); 68 | k4.debugPrint(); nvDebug("\n"); 69 | k5.debugPrint(); nvDebug("\n"); 70 | */ 71 | int l_start = 4; 72 | int l_end = 2; 73 | 74 | BoxFilter filter; 75 | PolyphaseKernel kp(kai4, l_start, l_end); 76 | 77 | kp.debugPrint(); 78 | 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /src/nvtt/tools/compressdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "compressdialog.h" 2 | #include "ui_compressdialog.h" 3 | 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication app(argc, argv); 9 | 10 | CompressDialog dialog(""); 11 | 12 | return dialog.exec(); 13 | } 14 | 15 | 16 | 17 | CompressDialog::CompressDialog(const QString & fileName, QWidget *parent) : QDialog(parent) 18 | { 19 | ui.setupUi(this); 20 | } 21 | 22 | CompressDialog::~CompressDialog() 23 | { 24 | } 25 | 26 | 27 | void CompressDialog::openClicked() 28 | { 29 | // @@ What is openButton? 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/nvtt/tools/compressdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPRESSDIALOG_H 2 | #define COMPRESSDIALOG_H 3 | 4 | #include 5 | 6 | #include "ui_compressdialog.h" 7 | 8 | 9 | class CompressDialog : public QDialog 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit CompressDialog(const QString & fileName, QWidget *parent = 0); 14 | ~CompressDialog(); 15 | 16 | protected slots: 17 | 18 | void openClicked(); 19 | 20 | 21 | private: 22 | Ui::CompressDialog ui; 23 | }; 24 | 25 | #endif // COMPRESSDIALOG_H 26 | -------------------------------------------------------------------------------- /src/nvtt/tools/ddsinfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Ignacio Castano 2 | // 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, 7 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following 10 | // conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | // OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include "cmdline.h" 31 | 32 | 33 | int main(int argc, char *argv[]) 34 | { 35 | MyAssertHandler assertHandler; 36 | MyMessageHandler messageHandler; 37 | 38 | if (argc != 2) 39 | { 40 | printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); 41 | printf("usage: nvddsinfo ddsfile\n\n"); 42 | return 1; 43 | } 44 | 45 | // Load surface. 46 | nv::DirectDrawSurface dds; 47 | if (!dds.load(argv[1]) || !dds.isValid()) 48 | { 49 | printf("The file '%s' is not a valid DDS file.\n", argv[1]); 50 | return 1; 51 | } 52 | 53 | dds.printInfo(); 54 | 55 | return 0; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/nvtt/tools/nvtt-thumbnailer.schema.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /schemas/desktop/gnome/thumbnailers/image@x-dds/enable 5 | /desktop/gnome/thumbnailers/image@x-dds/enable 6 | nvtt-thumbnailer 7 | bool 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | /schemas/desktop/gnome/thumbnailers/image@x-dds/command 16 | /desktop/gnome/thumbnailers/image@x-dds/command 17 | nvtt-thumbnailer 18 | string 19 | @CMAKE_INSTALL_PREFIX@/bin/nv-gnome-thumbnailer -s %s %i %o 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/nvtt/tools/ui/configdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Ignacio Castano 2 | // 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, 7 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following 10 | // conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | // OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef CONFIGDIALOG_H 25 | #define CONFIGDIALOG_H 26 | 27 | #include 28 | 29 | #include "ui_configdialog.h" 30 | 31 | #include 32 | 33 | 34 | class ConfigDialog : public QDialog 35 | { 36 | Q_OBJECT 37 | public: 38 | ConfigDialog(QWidget *parent = 0); 39 | ConfigDialog(const char * fileName, QWidget *parent = 0); 40 | 41 | protected slots: 42 | 43 | void openClicked(); 44 | void generateMipmapsChanged(int state); 45 | void mipmapFilterChanged(QString name); 46 | 47 | void colorWeightChanged(); 48 | void uniformWeightToggled(bool checked); 49 | void luminanceWeightToggled(bool checked); 50 | 51 | void normalMapModeChanged(bool checked); 52 | 53 | bool open(QString fileName); 54 | 55 | private: 56 | 57 | void init(); 58 | 59 | private: 60 | Ui::ConfigDialog ui; 61 | 62 | nvtt::InputOptions inputOptions; 63 | nvtt::CompressionOptions compressionOptions; 64 | nvtt::OutputOptions outputOptions; 65 | 66 | }; 67 | 68 | 69 | #endif // CONFIGDIALOG_H 70 | -------------------------------------------------------------------------------- /src/nvtt/tools/ui/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Ignacio Castano 2 | // 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, 7 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following 10 | // conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | // OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | #include "configdialog.h" 26 | 27 | int main(int argc, char *argv[]) 28 | { 29 | QApplication app(argc, argv); 30 | ConfigDialog dialog; 31 | return dialog.exec(); 32 | } 33 | 34 | 35 | --------------------------------------------------------------------------------