├── DirectXTex ├── Shaders │ ├── Compiled │ │ └── DoNotDeleteMe.txt │ ├── CompiledShaders.zip │ ├── CompileShaders_HQ.cmd │ └── CompileShaders.cmd ├── scoped.h ├── BCDirectCompute.h ├── DirectXTex.inl └── DirectXTex_Desktop_2015.vcxproj.filters ├── DDSView ├── directx.ico ├── hlsl.cmd ├── DDSView_Desktop_2015.vcxproj.filters ├── DDSView_Desktop_2017.vcxproj.filters ├── DDSView.rc ├── ddsview.fx └── shaders │ ├── vs.h │ ├── ps2D.h │ └── ps1D.h ├── Texdiag ├── directx.ico ├── texdiag_Desktop_2015.vcxproj.filters ├── texdiag_Desktop_2017.vcxproj.filters └── texdiag.rc ├── stb_image └── stb_image.cpp ├── ScreenGrab ├── ScreenGrab.cpp ├── ScreenGrab12.cpp ├── ScreenGrab.h └── ScreenGrab12.h ├── Texassemble ├── directx.ico ├── Texassemble_Desktop_2015.vcxproj.filters ├── Texassemble_Desktop_2017.vcxproj.filters └── texassemble.rc ├── x64 └── Release │ └── ispc_texcomp.dll ├── ISPCTextureCompressor ├── lib │ └── ispc_texcomp.lib ├── ISPCTextureCompressor.vcxproj.filters ├── Tester.cpp └── ispc_texcomp.h ├── .gitmodules ├── InspectDDS ├── App.config ├── Properties │ └── AssemblyInfo.cs └── InspectDDS.csproj ├── analyze ├── App.config ├── Properties │ └── AssemblyInfo.cs └── analyze.csproj ├── .editorconfig ├── .gitattributes ├── .gitignore ├── Texconv ├── Texconv_Desktop_2015.vcxproj.filters ├── Texconv_Desktop_2017.vcxproj.filters └── Texconv.rc ├── ReadMe.txt ├── FasTCTest ├── FasTC │ ├── BaseConfig.h │ ├── ImageFwd.h │ ├── BPTCConfig.h │ ├── Matrix2x2.h │ ├── Matrix3x3.h │ ├── Matrix4x4.h │ ├── ScopedAllocator.h │ ├── IPixel.h │ ├── TexCompTypes.h │ ├── Color.h │ ├── Vector2.h │ ├── Bits.h │ ├── Shapes.h │ ├── MatrixSquare.h │ ├── Vector3.h │ ├── Image.h │ ├── BitStream.h │ ├── CompressionFormat.h │ └── Pixel.h ├── Tester.cpp ├── FasTCTest.vcxproj.filters ├── IPixel.cpp ├── Color.cpp ├── AnchorTables.h ├── ParallelStage.h ├── CompressionJob.cpp ├── ParallelStage.cpp ├── CompressNVTT.cpp └── FasTCTest.vcxproj ├── .nuget ├── directxtex_uwp.targets ├── directxtex_desktop_2015.targets ├── directxtex_desktop_2015.nuspec └── directxtex_uwp.nuspec ├── ConvectionCPUTest ├── ConvectionCPUTest.vcxproj.filters └── ConvectionCPUTest.vcxproj ├── DirectXTex_XboxOneXDK_2015.sln ├── DDSFile ├── Properties │ └── AssemblyInfo.cs └── DDSFile.csproj ├── DirectXTex_XboxOneXDK_2017.sln ├── DirectXTex_Windows10_2015.sln ├── DirectXTex_Desktop_2015_Win10.sln ├── DirectXTex_Windows10.sln ├── DirectXTex_Desktop_2017_Win10.sln ├── WICTextureLoader ├── WICTextureLoader12.h └── WICTextureLoader.h ├── DDSTextureLoader ├── DDSTextureLoader12.h └── DDSTextureLoader.h └── LICENSE.txt /DirectXTex/Shaders/Compiled/DoNotDeleteMe.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DDSView/directx.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/DDSView/directx.ico -------------------------------------------------------------------------------- /Texdiag/directx.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/Texdiag/directx.ico -------------------------------------------------------------------------------- /stb_image/stb_image.cpp: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_IMPLEMENTATION 2 | #include "stb_image.h" 3 | -------------------------------------------------------------------------------- /ScreenGrab/ScreenGrab.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/ScreenGrab/ScreenGrab.cpp -------------------------------------------------------------------------------- /Texassemble/directx.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/Texassemble/directx.ico -------------------------------------------------------------------------------- /ScreenGrab/ScreenGrab12.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/ScreenGrab/ScreenGrab12.cpp -------------------------------------------------------------------------------- /x64/Release/ispc_texcomp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/x64/Release/ispc_texcomp.dll -------------------------------------------------------------------------------- /DirectXTex/Shaders/CompiledShaders.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/DirectXTex/Shaders/CompiledShaders.zip -------------------------------------------------------------------------------- /ISPCTextureCompressor/lib/ispc_texcomp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elasota/cvtt/HEAD/ISPCTextureCompressor/lib/ispc_texcomp.lib -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ConvectionKernels"] 2 | path = ConvectionKernels 3 | url = https://github.com/elasota/ConvectionKernels.git 4 | -------------------------------------------------------------------------------- /InspectDDS/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /analyze/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{cpp,h,inl,fx,hlsl}] 4 | indent_size = 4 5 | indent_style = space 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | end_of_line = crlf 9 | charset = latin1 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Explicitly declare code/VS files as CRLF 5 | *.cpp eol=crlf 6 | *.cmd eol=crlf 7 | *.h eol=crlf 8 | *.hlsl eol=crlf 9 | *.hlsli eol=crlf 10 | *.fx eol=crlf 11 | *.fxh eol=crlf 12 | *.inc eol=crlf 13 | *.inl eol=crlf 14 | *.vcxproj eol=crlf 15 | *.filters eol=crlf 16 | *.sln eol=crlf 17 | 18 | # Explicitly declare resource files as binary 19 | *.pdb binary 20 | -------------------------------------------------------------------------------- /DDSView/hlsl.cmd: -------------------------------------------------------------------------------- 1 | fxc ddsview.fx /nologo /EVS /Tvs_4_1 /Fhshaders\vs.h 2 | fxc ddsview.fx /nologo /EPS_1D /Tps_4_1 /Fhshaders\ps1D.h 3 | fxc ddsview.fx /nologo /EPS_1DArray /Tps_4_1 /Fhshaders\ps1Darray.h 4 | fxc ddsview.fx /nologo /EPS_2D /Tps_4_1 /Fhshaders\ps2D.h 5 | fxc ddsview.fx /nologo /EPS_2DArray /Tps_4_1 /Fhshaders\ps2Darray.h 6 | fxc ddsview.fx /nologo /EPS_3D /Tps_4_1 /Fhshaders\ps3D.h 7 | fxc ddsview.fx /nologo /EPS_Cube /Tps_4_1 /Fhshaders\psCube.h 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.psess 2 | *.vsp 3 | *.log 4 | *.err 5 | *.wrn 6 | *.suo 7 | *.sdf 8 | *.user 9 | *.i 10 | *.vspscc 11 | *.opensdf 12 | *.opendb 13 | *.ipch 14 | *.cache 15 | *.tlog 16 | *.lastbuildstate 17 | *.ilk 18 | *.VC.db 19 | *.nupkg 20 | *.obj 21 | *.idb 22 | .vs 23 | /Bin 24 | /ipch 25 | /Debug 26 | /Profile 27 | /Release 28 | /Tests 29 | /wiki 30 | *.inc 31 | *.pdb 32 | *.csv 33 | *.dds 34 | /*/bin/* 35 | /*/obj/* 36 | /*/x64/* 37 | /x64/*/*.exe 38 | /x64/*/*.iobj 39 | /x64/*/*.ipdb 40 | 41 | 42 | !ISPCTextureCompressor/lib/ispc_texcomp.lib 43 | -------------------------------------------------------------------------------- /Texconv/Texconv_Desktop_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /Texconv/Texconv_Desktop_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /Texdiag/texdiag_Desktop_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /Texdiag/texdiag_Desktop_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /Texassemble/Texassemble_Desktop_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /Texassemble/Texassemble_Desktop_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /ReadMe.txt: -------------------------------------------------------------------------------- 1 | Convection Texture Tools 2 | 3 | Copyright (c) 2018 Eric Lasota 4 | 5 | Licensed under MIT License (see LICENSE.txt for details) 6 | 7 | Convection Texture Tools are an enhanced fork of Microsoft's DirectX Texture Library (DirectXTex). 8 | 9 | All of the CPU codecs have been replaced with new SIMD-optimized codecs that get great quality and great speed. 10 | 11 | See the "ConvectionKernels" dir for stand-alone codecs if you want to use them outside of the library. 12 | 13 | For usage, see ReadMe_DirectXTex.txt 14 | 15 | Flag changes: 16 | -rw, -gw, -bw, and -aw change channel importance for red, green, blue, and alpha respectively. 17 | -nogpu has been removed, use -gpu 0 to use the GPU codecs, be aware that they're lower quality though. 18 | -------------------------------------------------------------------------------- /DDSView/DDSView_Desktop_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /DDSView/DDSView_Desktop_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Resource Files 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/BaseConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | // Does our compiler support cpp11 types? 19 | //#cmakedefine FASTC_BASE_HAS_CPP11_TYPES 20 | -------------------------------------------------------------------------------- /.nuget/directxtex_uwp.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildThisFileDirectory)..\..\lib\$(Platform)\$(Configuration) 6 | 7 | 8 | 9 | 10 | $(directxtex-LibPath);%(AdditionalLibraryDirectories) 11 | DirectXTex.lib;%(AdditionalDependencies) 12 | 13 | 14 | 15 | 16 | 17 | HAS_DIRECTXTEX;%(PreprocessorDefinitions) 18 | $(MSBuildThisFileDirectory)..\..\include;%(AdditionalIncludeDirectories) 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /.nuget/directxtex_desktop_2015.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildThisFileDirectory)..\..\lib\$(Platform)\$(Configuration) 6 | 7 | 8 | 9 | 10 | $(directxtex-LibPath);%(AdditionalLibraryDirectories) 11 | DirectXTex.lib;%(AdditionalDependencies) 12 | 13 | 14 | 15 | 16 | 17 | HAS_DIRECTXTEX;%(PreprocessorDefinitions) 18 | $(MSBuildThisFileDirectory)..\..\include;%(AdditionalIncludeDirectories) 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/ImageFwd.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef FASTC_BASE_INCLUDE_IMAGEFWD_H_ 19 | #define FASTC_BASE_INCLUDE_IMAGEFWD_H_ 20 | 21 | #include "TexCompTypes.h" 22 | 23 | namespace FasTC { 24 | class Pixel; 25 | template class Image; 26 | } 27 | 28 | #endif // FASTC_BASE_INCLUDE_IMAGEFWD_H_ 29 | -------------------------------------------------------------------------------- /ConvectionCPUTest/ConvectionCPUTest.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;hh;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;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /ISPCTextureCompressor/ISPCTextureCompressor.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;hh;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;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /DirectXTex/Shaders/CompileShaders_HQ.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright (c) Microsoft Corporation. All rights reserved. 3 | rem Licensed under the MIT License. 4 | 5 | setlocal 6 | set error=0 7 | 8 | set FXCOPTS=/nologo /WX /Ges /Zi /Zpc /Qstrip_reflect /Qstrip_debug 9 | 10 | set PCFXC="%WindowsSdkBinPath%%WindowsSDKVersion%\x86\fxc.exe" 11 | if exist %PCFXC% goto continue 12 | set PCFXC="%WindowsSdkDir%bin\%WindowsSDKVersion%\x86\fxc.exe" 13 | if exist %PCFXC% goto continue 14 | set PCFXC="%WindowsSdkDir%bin\x86\fxc.exe" 15 | if exist %PCFXC% goto continue 16 | 17 | set PCFXC=fxc.exe 18 | 19 | :continue 20 | call :CompileShader BC7Encode_HQ TryMode456CS 21 | call :CompileShader BC7Encode_HQ TryMode137CS 22 | call :CompileShader BC7Encode_HQ TryMode0CS 23 | call :CompileShader BC7Encode_HQ TryMode2CS 24 | call :CompileShader BC7Encode_HQ EncodeBlockCS 25 | 26 | echo. 27 | 28 | if %error% == 0 ( 29 | echo Shaders compiled ok 30 | ) else ( 31 | echo There were shader compilation errors! 32 | ) 33 | 34 | endlocal 35 | exit /b 36 | 37 | :CompileShader 38 | set fxc=%PCFXC% %1.hlsl %FXCOPTS% /Tcs_4_0 /E%2 /FhCompiled\%1_%2.inc /FdCompiled\%1_%2.pdb /Vn%1_%2 39 | echo. 40 | echo %fxc% 41 | %fxc% || set error=1 42 | exit /b 43 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/BPTCConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | // BPTCConfig.h.in -- This file contains variables that are introduced 19 | // explicitly by the CMake build process. 20 | 21 | // Do we have the proper popcnt instruction defined? 22 | //#cmakedefine NO_INLINE_ASSEMBLY 23 | //#cmakedefine HAS_SSE_POPCNT 24 | //#cmakedefine HAS_SSE_41 25 | 26 | //#cmakedefine HAS_ATOMICS 27 | //#cmakedefine HAS_GCC_ATOMICS 28 | //#cmakedefine HAS_MSVC_ATOMICS 29 | 30 | //#cmakedefine FOUND_NVTT_BPTC_EXPORT 31 | -------------------------------------------------------------------------------- /DirectXTex_XboxOneXDK_2015.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "DirectXTex\DirectXTex_XboxOneXDK_2015.vcxproj", "{879B5023-53B7-4108-AEAE-F019C2E9410D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Durango = Debug|Durango 11 | Profile|Durango = Profile|Durango 12 | Release|Durango = Release|Durango 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Debug|Durango.ActiveCfg = Debug|Durango 16 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Debug|Durango.Build.0 = Debug|Durango 17 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Profile|Durango.ActiveCfg = Profile|Durango 18 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Profile|Durango.Build.0 = Profile|Durango 19 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Release|Durango.ActiveCfg = Release|Durango 20 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Release|Durango.Build.0 = Release|Durango 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Matrix2x2.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_MATRIX2X2_H_ 19 | #define BASE_INCLUDE_MATRIX2X2_H_ 20 | 21 | #include "MatrixSquare.h" 22 | 23 | namespace FasTC { 24 | 25 | template 26 | class Matrix2x2 : public MatrixSquare { 27 | public: 28 | // Constructors 29 | Matrix2x2() { } 30 | Matrix2x2(const Matrix2x2 &other) 31 | : MatrixSquare(other) { } 32 | Matrix2x2(const MatrixSquare &other) 33 | : MatrixSquare(other) { } 34 | Matrix2x2(const MatrixBase &other) 35 | : MatrixSquare(other) { } 36 | }; 37 | REGISTER_ONE_TEMPLATE_MATRIX_TYPE(Matrix2x2); 38 | }; 39 | 40 | #endif // BASE_INCLUDE_MATRIX2X2_H_ 41 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Matrix3x3.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_MATRIX3X3_H_ 19 | #define BASE_INCLUDE_MATRIX3X3_H_ 20 | 21 | #include "MatrixSquare.h" 22 | 23 | namespace FasTC { 24 | 25 | template 26 | class Matrix3x3 : public MatrixSquare { 27 | public: 28 | // Constructors 29 | Matrix3x3() { } 30 | Matrix3x3(const Matrix3x3 &other) 31 | : MatrixSquare(other) { } 32 | Matrix3x3(const MatrixSquare &other) 33 | : MatrixSquare(other) { } 34 | Matrix3x3(const MatrixBase &other) 35 | : MatrixSquare(other) { } 36 | }; 37 | REGISTER_ONE_TEMPLATE_MATRIX_TYPE(Matrix3x3); 38 | }; 39 | 40 | #endif // BASE_INCLUDE_MATRIX3X3_H_ 41 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Matrix4x4.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_MATRIX4X4_H_ 19 | #define BASE_INCLUDE_MATRIX4X4_H_ 20 | 21 | #include "MatrixSquare.h" 22 | 23 | namespace FasTC { 24 | 25 | template 26 | class Matrix4x4 : public MatrixSquare { 27 | public: 28 | // Constructors 29 | Matrix4x4() { } 30 | Matrix4x4(const Matrix4x4 &other) 31 | : MatrixSquare(other) { } 32 | Matrix4x4(const MatrixSquare &other) 33 | : MatrixSquare(other) { } 34 | Matrix4x4(const MatrixBase &other) 35 | : MatrixSquare(other) { } 36 | }; 37 | REGISTER_ONE_TEMPLATE_MATRIX_TYPE(Matrix4x4); 38 | }; 39 | 40 | #endif // BASE_INCLUDE_MATRIX3X3_H_ 41 | -------------------------------------------------------------------------------- /DDSFile/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("DDSFile")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("HP Inc.")] 12 | [assembly: AssemblyProduct("DDSFile")] 13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2018")] 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("03f9d6e4-a320-4835-a82f-d16036f1583e")] 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 Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /analyze/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("analyze")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("HP Inc.")] 12 | [assembly: AssemblyProduct("analyze")] 13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2018")] 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("45e3765e-cc3f-4dd9-b1d9-9d1b61cb7dbe")] 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 Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /InspectDDS/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("InspectDDS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("HP Inc.")] 12 | [assembly: AssemblyProduct("InspectDDS")] 13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2018")] 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("e6ddf89f-9056-43f0-9b32-810ce6f9b5f7")] 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 Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /FasTCTest/Tester.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "FasTC/BPTCCompressor.h" 4 | #include "../DirectXTex/DirectXTex.h" 5 | 6 | #include "../stb_image/stb_image.h" 7 | 8 | int main(int argc, const char** argv) 9 | { 10 | if (argc != 3) 11 | return -1; 12 | 13 | int w, h, channels; 14 | 15 | stbi_uc* imageData = stbi_load(argv[1], &w, &h, &channels, 4); 16 | 17 | if (!imageData) 18 | return -1; 19 | 20 | size_t compressedSize = w * h; 21 | unsigned char* compressedBlocks = new unsigned char[compressedSize]; 22 | 23 | FasTC::CompressionJob compressionJob(FasTC::eCompressionFormat_BPTC, imageData, compressedBlocks, w, h); 24 | 25 | BPTCC::CompressionSettings settings; 26 | settings.m_ErrorMetric = BPTCC::eErrorMetric_Uniform; 27 | 28 | BPTCC::Compress(compressionJob, settings); 29 | 30 | stbi_image_free(imageData); 31 | 32 | 33 | DirectX::Image image; 34 | image.format = DXGI_FORMAT_BC7_UNORM; 35 | image.width = w; 36 | image.height = h; 37 | image.rowPitch = 0; 38 | image.slicePitch = compressedSize; 39 | image.pixels = compressedBlocks; 40 | 41 | size_t outLen = strlen(argv[2]); 42 | wchar_t* outPathW = new wchar_t[outLen + 1]; 43 | outPathW[outLen] = 0; 44 | for (size_t i = 0; i < outLen; i++) 45 | outPathW[i] = static_cast(argv[2][i]); 46 | 47 | DirectX::SaveToDDSFile(image, 0, outPathW); 48 | 49 | delete[] outPathW; 50 | delete[] compressedBlocks; 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /DirectXTex/Shaders/CompileShaders.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright (c) Microsoft Corporation. All rights reserved. 3 | rem Licensed under the MIT License. 4 | 5 | setlocal 6 | set error=0 7 | 8 | set FXCOPTS=/nologo /WX /Ges /Zi /Zpc /Qstrip_reflect /Qstrip_debug 9 | 10 | set PCFXC="%WindowsSdkBinPath%%WindowsSDKVersion%\x86\fxc.exe" 11 | if exist %PCFXC% goto continue 12 | set PCFXC="%WindowsSdkDir%bin\%WindowsSDKVersion%\x86\fxc.exe" 13 | if exist %PCFXC% goto continue 14 | set PCFXC="%WindowsSdkDir%bin\x86\fxc.exe" 15 | if exist %PCFXC% goto continue 16 | 17 | set PCFXC=fxc.exe 18 | 19 | :continue 20 | call :CompileShader BC7Encode TryMode456CS 21 | call :CompileShader BC7Encode TryMode137CS 22 | call :CompileShader BC7Encode TryMode02CS 23 | call :CompileShader BC7Encode EncodeBlockCS 24 | 25 | call :CompileShader BC7Encode_HQ TryMode456CS 26 | call :CompileShader BC7Encode_HQ TryMode137CS 27 | call :CompileShader BC7Encode_HQ TryMode0CS 28 | call :CompileShader BC7Encode_HQ TryMode2CS 29 | call :CompileShader BC7Encode_HQ EncodeBlockCS 30 | 31 | call :CompileShader BC6HEncode TryModeG10CS 32 | call :CompileShader BC6HEncode TryModeLE10CS 33 | call :CompileShader BC6HEncode EncodeBlockCS 34 | 35 | echo. 36 | 37 | if %error% == 0 ( 38 | echo Shaders compiled ok 39 | ) else ( 40 | echo There were shader compilation errors! 41 | ) 42 | 43 | endlocal 44 | exit /b 45 | 46 | :CompileShader 47 | set fxc=%PCFXC% %1.hlsl %FXCOPTS% /Tcs_4_0 /E%2 /FhCompiled\%1_%2.inc /FdCompiled\%1_%2.pdb /Vn%1_%2 48 | echo. 49 | echo %fxc% 50 | %fxc% || set error=1 51 | exit /b 52 | -------------------------------------------------------------------------------- /FasTCTest/FasTCTest.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;hh;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;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/ScopedAllocator.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_SCOPEDALLOCATOR_H_ 19 | #define BASE_INCLUDE_SCOPEDALLOCATOR_H_ 20 | 21 | #include "TexCompTypes.h" 22 | 23 | namespace FasTC { 24 | 25 | template 26 | class ScopedAllocator { 27 | private: 28 | T *m_Ptr; 29 | ScopedAllocator() : m_Ptr(NULL) { } 30 | public: 31 | ScopedAllocator(uint32 nBytes) : m_Ptr(new T[nBytes]) { } 32 | ~ScopedAllocator() { 33 | if(m_Ptr) { 34 | delete [] m_Ptr; 35 | m_Ptr = NULL; 36 | } 37 | } 38 | 39 | T &operator[](uint32 idx) { 40 | return m_Ptr[idx]; 41 | } 42 | 43 | operator T *() { 44 | return m_Ptr; 45 | } 46 | 47 | operator bool() { 48 | return m_Ptr != NULL; 49 | } 50 | }; 51 | 52 | } // namespace FasTC 53 | 54 | #endif // BASE_INCLUDE_SCOPEDALLOCATOR_H_ 55 | -------------------------------------------------------------------------------- /FasTCTest/IPixel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #include "FasTC/Pixel.h" 19 | #include "FasTC/IPixel.h" 20 | 21 | namespace FasTC { 22 | 23 | // Take all of the components, transform them to their 8-bit variants, 24 | // and then pack each channel into an R8G8B8A8 32-bit integer. We assume 25 | // that the architecture is little-endian, so the alpha channel will end 26 | // up in the most-significant byte. 27 | uint32 IPixel::Pack() const { 28 | uint32 ret = 0xFF << 24; 29 | for(uint32 i = 0; i < 3; i++) { 30 | if(vec[0] > 1.0) { 31 | ret |= static_cast(vec[0]) << i*8; 32 | } else { 33 | ret |= static_cast((255.0 * vec[0]) + 0.5f) << i*8; 34 | } 35 | } 36 | return ret; 37 | } 38 | 39 | void IPixel::Unpack(uint32 rgba) { 40 | Pixel p(rgba); 41 | vec[0] = p.ToIntensity(); 42 | } 43 | 44 | } // namespace FasTC 45 | -------------------------------------------------------------------------------- /Texconv/Texconv.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #define APSTUDIO_READONLY_SYMBOLS 4 | ///////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Generated from the TEXTINCLUDE 2 resource. 7 | // 8 | #define IDC_STATIC -1 9 | #include 10 | 11 | 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (U.S.) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | #ifdef _WIN32 21 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 22 | #pragma code_page(1252) 23 | #endif //_WIN32 24 | 25 | #ifdef APSTUDIO_INVOKED 26 | ///////////////////////////////////////////////////////////////////////////// 27 | // 28 | // TEXTINCLUDE 29 | // 30 | 31 | 1 TEXTINCLUDE 32 | BEGIN 33 | "resource.h\0" 34 | END 35 | 36 | 2 TEXTINCLUDE 37 | BEGIN 38 | "#define IDC_STATIC -1\r\n" 39 | "#include \r\n" 40 | "\r\n" 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | 3 TEXTINCLUDE 46 | BEGIN 47 | "\r\n" 48 | "\0" 49 | END 50 | 51 | #endif // APSTUDIO_INVOKED 52 | 53 | #endif // English (U.S.) resources 54 | ///////////////////////////////////////////////////////////////////////////// 55 | 56 | 57 | 58 | #ifndef APSTUDIO_INVOKED 59 | ///////////////////////////////////////////////////////////////////////////// 60 | // 61 | // Generated from the TEXTINCLUDE 3 resource. 62 | // 63 | 64 | 65 | ///////////////////////////////////////////////////////////////////////////// 66 | #endif // not APSTUDIO_INVOKED 67 | 68 | -------------------------------------------------------------------------------- /ScreenGrab/ScreenGrab.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D 11 Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // Licensed under the MIT License. 13 | // 14 | // http://go.microsoft.com/fwlink/?LinkId=248926 15 | // http://go.microsoft.com/fwlink/?LinkId=248929 16 | //-------------------------------------------------------------------------------------- 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | namespace DirectX 28 | { 29 | HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, 30 | _In_ ID3D11Resource* pSource, 31 | _In_z_ const wchar_t* fileName ); 32 | 33 | HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, 34 | _In_ ID3D11Resource* pSource, 35 | _In_ REFGUID guidContainerFormat, 36 | _In_z_ const wchar_t* fileName, 37 | _In_opt_ const GUID* targetFormat = nullptr, 38 | _In_opt_ std::function setCustomProps = nullptr ); 39 | } 40 | -------------------------------------------------------------------------------- /DirectXTex_XboxOneXDK_2017.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2020 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex_XboxOneXDK_2017", "DirectXTex\DirectXTex_XboxOneXDK_2017.vcxproj", "{879B5023-53B7-4108-AEAE-F019C2E9410D}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{98781974-DA38-4814-9D99-4C17922F35F7}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Durango = Debug|Durango 16 | Profile|Durango = Profile|Durango 17 | Release|Durango = Release|Durango 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Debug|Durango.ActiveCfg = Debug|Durango 21 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Debug|Durango.Build.0 = Debug|Durango 22 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Profile|Durango.ActiveCfg = Profile|Durango 23 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Profile|Durango.Build.0 = Profile|Durango 24 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Release|Durango.ActiveCfg = Release|Durango 25 | {879B5023-53B7-4108-AEAE-F019C2E9410D}.Release|Durango.Build.0 = Release|Durango 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | GlobalSection(ExtensibilityGlobals) = postSolution 31 | SolutionGuid = {AEA78A02-2861-40C0-86D1-72DC17A9DE13} 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /DirectXTex_Windows10_2015.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2015 4 | VisualStudioVersion = 14.0.22609.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "DirectXTex\DirectXTex_Windows10_2015.vcxproj", "{FB3F52B5-BFE8-43FD-836F-363735DAB738}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|ARM = Release|ARM 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|ARM.ActiveCfg = Debug|ARM 19 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|ARM.Build.0 = Debug|ARM 20 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x64.ActiveCfg = Debug|x64 21 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x64.Build.0 = Debug|x64 22 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x86.ActiveCfg = Debug|Win32 23 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x86.Build.0 = Debug|Win32 24 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|ARM.ActiveCfg = Release|ARM 25 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|ARM.Build.0 = Release|ARM 26 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x64.ActiveCfg = Release|x64 27 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x64.Build.0 = Release|x64 28 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x86.ActiveCfg = Release|Win32 29 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x86.Build.0 = Release|Win32 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /DirectXTex_Desktop_2015_Win10.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | VisualStudioVersion = 14.0.23107.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "DirectXTex\DirectXTex_Desktop_2015_Win10.vcxproj", "{371B9FA9-4C90-4AC6-A123-ACED756D6C77}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Profile|Win32 = Profile|Win32 12 | Profile|x64 = Profile|x64 13 | Release|Win32 = Release|Win32 14 | Release|x64 = Release|x64 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.ActiveCfg = Debug|Win32 18 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.Build.0 = Debug|Win32 19 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.ActiveCfg = Debug|x64 20 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.Build.0 = Debug|x64 21 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.ActiveCfg = Profile|Win32 22 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.Build.0 = Profile|Win32 23 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.ActiveCfg = Profile|x64 24 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.Build.0 = Profile|x64 25 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.ActiveCfg = Release|Win32 26 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.Build.0 = Release|Win32 27 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.ActiveCfg = Release|x64 28 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.Build.0 = Release|x64 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /ScreenGrab/ScreenGrab12.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab12.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D 12 Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // Licensed under the MIT License. 13 | // 14 | // http://go.microsoft.com/fwlink/?LinkId=248926 15 | // http://go.microsoft.com/fwlink/?LinkID=615561 16 | //-------------------------------------------------------------------------------------- 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | namespace DirectX 28 | { 29 | HRESULT __cdecl SaveDDSTextureToFile( 30 | _In_ ID3D12CommandQueue* pCommandQueue, 31 | _In_ ID3D12Resource* pSource, 32 | _In_z_ const wchar_t* fileName, 33 | D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET, 34 | D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET); 35 | 36 | HRESULT __cdecl SaveWICTextureToFile( 37 | _In_ ID3D12CommandQueue* pCommandQ, 38 | _In_ ID3D12Resource* pSource, 39 | REFGUID guidContainerFormat, 40 | _In_z_ const wchar_t* fileName, 41 | D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET, 42 | D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET, 43 | _In_opt_ const GUID* targetFormat = nullptr, 44 | _In_opt_ std::function setCustomProps = nullptr); 45 | } 46 | -------------------------------------------------------------------------------- /Texdiag/texdiag.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #define APSTUDIO_READONLY_SYMBOLS 4 | ///////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Generated from the TEXTINCLUDE 2 resource. 7 | // 8 | #define IDC_STATIC -1 9 | #include 10 | 11 | 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (U.S.) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | #ifdef _WIN32 21 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 22 | #pragma code_page(1252) 23 | #endif //_WIN32 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // Icon 28 | // 29 | 30 | // Icon with lowest ID value placed first to ensure application icon 31 | // remains consistent on all systems. 32 | IDI_MAIN_ICON ICON "directx.ico" 33 | 34 | #ifdef APSTUDIO_INVOKED 35 | ///////////////////////////////////////////////////////////////////////////// 36 | // 37 | // TEXTINCLUDE 38 | // 39 | 40 | 1 TEXTINCLUDE 41 | BEGIN 42 | "resource.h\0" 43 | END 44 | 45 | 2 TEXTINCLUDE 46 | BEGIN 47 | "#define IDC_STATIC -1\r\n" 48 | "#include \r\n" 49 | "\r\n" 50 | "\r\n" 51 | "\0" 52 | END 53 | 54 | 3 TEXTINCLUDE 55 | BEGIN 56 | "\r\n" 57 | "\0" 58 | END 59 | 60 | #endif // APSTUDIO_INVOKED 61 | 62 | #endif // English (U.S.) resources 63 | ///////////////////////////////////////////////////////////////////////////// 64 | 65 | 66 | 67 | #ifndef APSTUDIO_INVOKED 68 | ///////////////////////////////////////////////////////////////////////////// 69 | // 70 | // Generated from the TEXTINCLUDE 3 resource. 71 | // 72 | 73 | 74 | ///////////////////////////////////////////////////////////////////////////// 75 | #endif // not APSTUDIO_INVOKED 76 | 77 | -------------------------------------------------------------------------------- /Texassemble/texassemble.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #define APSTUDIO_READONLY_SYMBOLS 4 | ///////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Generated from the TEXTINCLUDE 2 resource. 7 | // 8 | #define IDC_STATIC -1 9 | #include 10 | 11 | 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (U.S.) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | #ifdef _WIN32 21 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 22 | #pragma code_page(1252) 23 | #endif //_WIN32 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // Icon 28 | // 29 | 30 | // Icon with lowest ID value placed first to ensure application icon 31 | // remains consistent on all systems. 32 | IDI_MAIN_ICON ICON "directx.ico" 33 | 34 | #ifdef APSTUDIO_INVOKED 35 | ///////////////////////////////////////////////////////////////////////////// 36 | // 37 | // TEXTINCLUDE 38 | // 39 | 40 | 1 TEXTINCLUDE 41 | BEGIN 42 | "resource.h\0" 43 | END 44 | 45 | 2 TEXTINCLUDE 46 | BEGIN 47 | "#define IDC_STATIC -1\r\n" 48 | "#include \r\n" 49 | "\r\n" 50 | "\r\n" 51 | "\0" 52 | END 53 | 54 | 3 TEXTINCLUDE 55 | BEGIN 56 | "\r\n" 57 | "\0" 58 | END 59 | 60 | #endif // APSTUDIO_INVOKED 61 | 62 | #endif // English (U.S.) resources 63 | ///////////////////////////////////////////////////////////////////////////// 64 | 65 | 66 | 67 | #ifndef APSTUDIO_INVOKED 68 | ///////////////////////////////////////////////////////////////////////////// 69 | // 70 | // Generated from the TEXTINCLUDE 3 resource. 71 | // 72 | 73 | 74 | ///////////////////////////////////////////////////////////////////////////// 75 | #endif // not APSTUDIO_INVOKED 76 | 77 | -------------------------------------------------------------------------------- /FasTCTest/Color.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #include "FasTC/Color.h" 19 | 20 | namespace FasTC { 21 | 22 | uint32 Color::Pack() const { 23 | uint32 result = 0; 24 | result |= static_cast((A() * 255.0f) + 0.5f); 25 | result <<= 8; 26 | result |= static_cast((B() * 255.0f) + 0.5f); 27 | result <<= 8; 28 | result |= static_cast((G() * 255.0f) + 0.5f); 29 | result <<= 8; 30 | result |= static_cast((R() * 255.0f) + 0.5f); 31 | return result; 32 | } 33 | 34 | void Color::Unpack(uint32 rgba) { 35 | R() = static_cast(rgba & 0xFF) / 255.0f; 36 | G() = static_cast((rgba >> 8) & 0xFF) / 255.0f; 37 | B() = static_cast((rgba >> 16) & 0xFF) / 255.0f; 38 | A() = static_cast((rgba >> 24) & 0xFF) / 255.0f; 39 | } 40 | 41 | // Tests for equality by comparing the values and the bit depths. 42 | bool Color::operator==(const Color &other) const { 43 | static const float kEpsilon = 0.001f; 44 | for(uint32 c = 0; c < 4; c++) { 45 | if(fabs(Component(c) - other.Component(c)) > kEpsilon) { 46 | return false; 47 | } 48 | } 49 | 50 | return true; 51 | } 52 | } // namespace FasTC 53 | -------------------------------------------------------------------------------- /DDSView/DDSView.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #define APSTUDIO_READONLY_SYMBOLS 4 | ///////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Generated from the TEXTINCLUDE 2 resource. 7 | // 8 | #define IDC_STATIC -1 9 | #define IDI_MAIN_ICON 100 10 | #include 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // Icon 27 | // 28 | 29 | // Icon with lowest ID value placed first to ensure application icon 30 | // remains consistent on all systems. 31 | IDI_MAIN_ICON ICON "directx.ico" 32 | 33 | #ifdef APSTUDIO_INVOKED 34 | ///////////////////////////////////////////////////////////////////////////// 35 | // 36 | // TEXTINCLUDE 37 | // 38 | 39 | 1 TEXTINCLUDE 40 | BEGIN 41 | "resource.h\0" 42 | END 43 | 44 | 2 TEXTINCLUDE 45 | BEGIN 46 | "#define IDC_STATIC -1\r\n" 47 | "#include \r\n" 48 | "\r\n" 49 | "\r\n" 50 | "\0" 51 | END 52 | 53 | 3 TEXTINCLUDE 54 | BEGIN 55 | "\r\n" 56 | "\0" 57 | END 58 | 59 | #endif // APSTUDIO_INVOKED 60 | 61 | #endif // English (U.S.) resources 62 | ///////////////////////////////////////////////////////////////////////////// 63 | 64 | 65 | 66 | #ifndef APSTUDIO_INVOKED 67 | ///////////////////////////////////////////////////////////////////////////// 68 | // 69 | // Generated from the TEXTINCLUDE 3 resource. 70 | // 71 | 72 | 73 | ///////////////////////////////////////////////////////////////////////////// 74 | #endif // not APSTUDIO_INVOKED 75 | 76 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/IPixel.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_IPIXEL_H_ 19 | #define BASE_INCLUDE_IPIXEL_H_ 20 | 21 | #include "TexCompTypes.h" 22 | #include "VectorBase.h" 23 | 24 | namespace FasTC { 25 | 26 | class IPixel : public VectorBase { 27 | public: 28 | IPixel() : VectorBase() { vec[0] = 0.0f; } 29 | IPixel(float f) : VectorBase(&f) { } 30 | 31 | operator float() const { 32 | return vec[0]; 33 | } 34 | 35 | IPixel operator=(const float &f) { 36 | return vec[0] = f; 37 | } 38 | 39 | // Take all of the components, transform them to their 8-bit variants, 40 | // and then pack each channel into an R8G8B8A8 32-bit integer. We assume 41 | // that the architecture is little-endian, so the alpha channel will end 42 | // up in the most-significant byte. 43 | uint32 Pack() const; 44 | void Unpack(uint32 rgba); 45 | 46 | void MakeOpaque() { /* Do nothing.. */ } 47 | 48 | bool operator==(const IPixel &other) const { 49 | return static_cast(*this) == static_cast(other); 50 | } 51 | 52 | bool operator!=(const IPixel &other) const { 53 | return static_cast(*this) != static_cast(other); 54 | } 55 | }; 56 | REGISTER_VECTOR_TYPE(IPixel); 57 | 58 | } // namespace FasTC 59 | 60 | #endif // BASE_INCLUDE_PIXEL_H_ 61 | -------------------------------------------------------------------------------- /DirectXTex_Windows10.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2020 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex_Windows10", "DirectXTex\DirectXTex_Windows10.vcxproj", "{FB3F52B5-BFE8-43FD-836F-363735DAB738}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8D3EE191-AC2D-4DA6-97EB-058D8A28B933}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|ARM = Debug|ARM 16 | Debug|x64 = Debug|x64 17 | Debug|x86 = Debug|x86 18 | Release|ARM = Release|ARM 19 | Release|x64 = Release|x64 20 | Release|x86 = Release|x86 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|ARM.ActiveCfg = Debug|ARM 24 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|ARM.Build.0 = Debug|ARM 25 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x64.ActiveCfg = Debug|x64 26 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x64.Build.0 = Debug|x64 27 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x86.ActiveCfg = Debug|Win32 28 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Debug|x86.Build.0 = Debug|Win32 29 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|ARM.ActiveCfg = Release|ARM 30 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|ARM.Build.0 = Release|ARM 31 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x64.ActiveCfg = Release|x64 32 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x64.Build.0 = Release|x64 33 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x86.ActiveCfg = Release|Win32 34 | {FB3F52B5-BFE8-43FD-836F-363735DAB738}.Release|x86.Build.0 = Release|Win32 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | GlobalSection(ExtensibilityGlobals) = postSolution 40 | SolutionGuid = {E507EBC0-EBB7-4519-A886-15B7E0917E2F} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /DirectXTex_Desktop_2017_Win10.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | VisualStudioVersion = 15.0.27130.2020 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "DirectXTex\DirectXTex_Desktop_2017_Win10.vcxproj", "{371B9FA9-4C90-4AC6-A123-ACED756D6C77}" 6 | EndProject 7 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5200A2F8-5215-421E-BCE6-E8DCDAB7779D}" 8 | ProjectSection(SolutionItems) = preProject 9 | .editorconfig = .editorconfig 10 | EndProjectSection 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Win32 = Debug|Win32 15 | Debug|x64 = Debug|x64 16 | Profile|Win32 = Profile|Win32 17 | Profile|x64 = Profile|x64 18 | Release|Win32 = Release|Win32 19 | Release|x64 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.ActiveCfg = Debug|Win32 23 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.Build.0 = Debug|Win32 24 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.ActiveCfg = Debug|x64 25 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.Build.0 = Debug|x64 26 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.ActiveCfg = Profile|Win32 27 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.Build.0 = Profile|Win32 28 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.ActiveCfg = Profile|x64 29 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.Build.0 = Profile|x64 30 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.ActiveCfg = Release|Win32 31 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.Build.0 = Release|Win32 32 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.ActiveCfg = Release|x64 33 | {371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.Build.0 = Release|x64 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | GlobalSection(ExtensibilityGlobals) = postSolution 39 | SolutionGuid = {22D52797-6BAE-4409-AE3B-513587E92758} 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /DDSFile/DDSFile.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {03F9D6E4-A320-4835-A82F-D16036F1583E} 8 | Library 9 | Properties 10 | DDSFile 11 | DDSFile 12 | v4.6.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /DirectXTex/scoped.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------- 2 | // scoped.h 3 | // 4 | // Utility header with helper classes for exception-safe handling of resources 5 | // 6 | // Copyright (c) Microsoft Corporation. All rights reserved. 7 | // Licensed under the MIT License. 8 | //------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | //--------------------------------------------------------------------------------- 17 | struct aligned_deleter { void operator()(void* p) { _aligned_free(p); } }; 18 | 19 | typedef std::unique_ptr ScopedAlignedArrayFloat; 20 | 21 | typedef std::unique_ptr ScopedAlignedArrayXMVECTOR; 22 | 23 | //--------------------------------------------------------------------------------- 24 | struct handle_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } }; 25 | 26 | typedef std::unique_ptr ScopedHandle; 27 | 28 | inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } 29 | 30 | //--------------------------------------------------------------------------------- 31 | struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } }; 32 | 33 | typedef std::unique_ptr ScopedFindHandle; 34 | 35 | //--------------------------------------------------------------------------------- 36 | class auto_delete_file 37 | { 38 | public: 39 | auto_delete_file(HANDLE hFile) : m_handle(hFile) {} 40 | 41 | auto_delete_file(const auto_delete_file&) = delete; 42 | auto_delete_file& operator=(const auto_delete_file&) = delete; 43 | 44 | ~auto_delete_file() 45 | { 46 | if (m_handle) 47 | { 48 | FILE_DISPOSITION_INFO info = {}; 49 | info.DeleteFile = TRUE; 50 | (void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info)); 51 | } 52 | } 53 | 54 | void clear() { m_handle = 0; } 55 | 56 | private: 57 | HANDLE m_handle; 58 | }; 59 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/TexCompTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | // This file contains all of the various platform definitions for fixed width integers 19 | // on various platforms. 20 | 21 | // !FIXME! Still needs to be tested on Windows platforms. 22 | #ifndef _TEX_COMP_TYPES_H_ 23 | #define _TEX_COMP_TYPES_H_ 24 | 25 | #include "FasTC/BaseConfig.h" 26 | 27 | // Do we support C++11? 28 | #ifdef FASTC_BASE_HAS_CPP11_TYPES 29 | #include 30 | 31 | typedef int8_t int8; 32 | typedef uint8_t uint8; 33 | 34 | typedef int16_t int16; 35 | typedef uint16_t uint16; 36 | 37 | typedef int32_t int32; 38 | typedef uint32_t uint32; 39 | 40 | typedef int64_t int64; 41 | typedef uint64_t uint64; 42 | 43 | typedef char CHAR; 44 | 45 | #else 46 | 47 | // Windows? 48 | #ifdef _MSC_VER 49 | 50 | typedef __int16 int16; 51 | typedef unsigned __int16 uint16; 52 | typedef __int32 int32; 53 | typedef unsigned __int32 uint32; 54 | typedef __int8 int8; 55 | typedef unsigned __int8 uint8; 56 | 57 | typedef unsigned __int64 uint64; 58 | typedef __int64 int64; 59 | 60 | #include 61 | typedef TCHAR CHAR; 62 | 63 | // If not, assume GCC, or at least standard defines... 64 | #else 65 | 66 | #include 67 | 68 | typedef int8_t int8; 69 | typedef int16_t int16; 70 | typedef int32_t int32; 71 | typedef int64_t int64; 72 | 73 | typedef uint8_t uint8; 74 | typedef uint16_t uint16; 75 | typedef uint32_t uint32; 76 | typedef uint64_t uint64; 77 | 78 | typedef char CHAR; 79 | 80 | #endif // _MSC_VER 81 | 82 | #endif // FASTC_BASE_HAS_CPP11_TYPES 83 | 84 | #endif // _TEX_COMP_TYPES_H_ 85 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Color.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_COLOR_H_ 19 | #define BASE_INCLUDE_COLOR_H_ 20 | 21 | #include "TexCompTypes.h" 22 | #include "Vector4.h" 23 | 24 | namespace FasTC { 25 | 26 | class Color : public Vec4f { 27 | public: 28 | Color(float r, float g, float b, float a) : Vec4f(a, r, g, b) { } 29 | Color() : Vec4f(0, 0, 0, 0) { } 30 | 31 | // Let's allow us to use the operators... 32 | template 33 | Color &operator=(const Vector4 &other) { 34 | Vec4f::operator=(other); 35 | return *this; 36 | } 37 | 38 | template 39 | Color(const Vector4 &other) : Vec4f(other) { } 40 | 41 | const float &A() const { return vec[0]; } 42 | float &A() { return vec[0]; } 43 | const float &R() const { return vec[1]; } 44 | float &R() { return vec[1]; } 45 | const float &G() const { return vec[2]; } 46 | float &G() { return vec[2]; } 47 | const float &B() const { return vec[3]; } 48 | float &B() { return vec[3]; } 49 | const float &Component(uint32 idx) const { return vec[idx]; } 50 | float &Component(uint32 idx) { return vec[idx]; } 51 | 52 | // Take all of the components, transform them to their 8-bit variants, 53 | // and then pack each channel into an R8G8B8A8 32-bit integer. We assume 54 | // that the architecture is little-endian, so the alpha channel will end 55 | // up in the most-significant byte. 56 | uint32 Pack() const; 57 | void Unpack(uint32 rgba); 58 | 59 | // Tests for equality by comparing the values and the bit depths. 60 | bool operator==(const Color &) const; 61 | 62 | void MakeOpaque() { A() = 1.f ; } 63 | }; 64 | REGISTER_VECTOR_TYPE(Color); 65 | 66 | } // namespace FasTC 67 | 68 | #endif // BASE_INCLUDE_COLOR_H_ 69 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Vector2.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_VECTOR2_H_ 19 | #define BASE_INCLUDE_VECTOR2_H_ 20 | 21 | #include "VectorBase.h" 22 | 23 | # define _VEX_VEC2_SWIZZLE_DEF(X, Y) \ 24 | Vector2 X##Y() const { return Vector2( X(), Y() ); } 25 | 26 | namespace FasTC { 27 | 28 | template 29 | class Vector2 : public VectorBase { 30 | public: 31 | // Ideally, we would be able to do this with initialization 32 | // lists, but I'm not really sure how to do that without gross 33 | // code duplication. 34 | Vector2() { } 35 | Vector2(T x, T y) { 36 | X() = x; 37 | Y() = y; 38 | } 39 | 40 | explicit Vector2(const T *_vec) { 41 | for(int i = 0; i < 2; i++) 42 | this->vec[i] = _vec[i]; 43 | } 44 | 45 | // Overloaded functions 46 | template 47 | Vector2(const Vector2<_T> &v) : VectorBase(v) { } 48 | 49 | template 50 | Vector2 &operator=(const Vector2<_T> &v) { 51 | VectorBase::operator=(v); 52 | return *this; 53 | } 54 | 55 | Vector2 &operator=(const T *_vec) { 56 | VectorBase::operator=(_vec); 57 | return *this; 58 | } 59 | 60 | // Accessors 61 | T &X() { return (*this)[0]; } 62 | const T &X() const { return (*this)[0]; } 63 | 64 | T &Y() { return (*this)[1]; } 65 | const T &Y() const { return (*this)[1]; } 66 | 67 | // Swizzle 68 | _VEX_VEC2_SWIZZLE_DEF(X, X) 69 | _VEX_VEC2_SWIZZLE_DEF(X, Y) 70 | _VEX_VEC2_SWIZZLE_DEF(Y, X) 71 | _VEX_VEC2_SWIZZLE_DEF(Y, Y) 72 | }; 73 | REGISTER_ONE_TEMPLATE_VECTOR_TYPE(Vector2); 74 | 75 | typedef Vector2 Vec2f; 76 | typedef Vector2 Vec2d; 77 | typedef Vector2 Vec2i; 78 | }; 79 | 80 | #endif // BASE_INCLUDE_VECTOR2_H_ 81 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Bits.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef __BASE_INCLUDE_BITS_H__ 19 | #define __BASE_INCLUDE_BITS_H__ 20 | 21 | #include "TexCompTypes.h" 22 | 23 | namespace FasTC { 24 | 25 | template 26 | class Bits { 27 | private: 28 | const IntType &m_Bits; 29 | 30 | // Don't copy 31 | Bits() { } 32 | Bits(const Bits &) { } 33 | Bits &operator=(const Bits &) { } 34 | 35 | public: 36 | explicit Bits(IntType &v) : m_Bits(v) { } 37 | 38 | uint8 operator[](uint32 bitPos) { 39 | return static_cast((m_Bits >> bitPos) & 1); 40 | } 41 | 42 | IntType operator()(uint32 start, uint32 end) { 43 | if(start == end) { 44 | return (*this)[start]; 45 | } else if(start > end) { 46 | uint32 t = start; 47 | start = end; 48 | end = t; 49 | } 50 | 51 | uint64 mask = (1 << (end - start + 1)) - 1; 52 | return (m_Bits >> start) & mask; 53 | } 54 | }; 55 | 56 | // Replicates low numBits such that [(toBit - 1):(toBit - 1 - fromBit)] 57 | // is the same as [(numBits - 1):0] and repeats all the way down. 58 | template 59 | IntType Replicate(const IntType &val, uint32 numBits, uint32 toBit) { 60 | if(numBits == 0) return 0; 61 | if(toBit == 0) return 0; 62 | IntType v = val & ((1 << numBits) - 1); 63 | IntType res = v; 64 | uint32 reslen = numBits; 65 | while(reslen < toBit) { 66 | uint32 comp = 0; 67 | if(numBits > toBit - reslen) { 68 | uint32 newshift = toBit - reslen; 69 | comp = numBits - newshift; 70 | numBits = newshift; 71 | } 72 | res <<= numBits; 73 | res |= v >> comp; 74 | reslen += numBits; 75 | } 76 | return res; 77 | } 78 | 79 | } // namespace FasTC 80 | #endif // __BASE_INCLUDE_BITS_H__ 81 | -------------------------------------------------------------------------------- /FasTCTest/AnchorTables.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #include "FasTC/Shapes.h" 19 | 20 | #include 21 | 22 | static const int kAnchorIdx2[BPTCC::kNumShapes2] = { 23 | 15, 15, 15, 15, 15, 15, 15, 15, 24 | 15, 15, 15, 15, 15, 15, 15, 15, 25 | 15, 2, 8, 2, 2, 8, 8, 15, 26 | 2 , 8, 2, 2, 8, 8, 2, 2, 27 | 15, 15, 6, 8, 2, 8, 15, 15, 28 | 2 , 8, 2, 2, 2, 15, 15, 6, 29 | 6 , 2, 6, 8, 15, 15, 2, 2, 30 | 15, 15, 15, 15, 15, 2, 2, 15 31 | }; 32 | 33 | static const int kAnchorIdx3[2][BPTCC::kNumShapes3] = { 34 | {3, 3, 15, 15, 8, 3, 15, 15, 35 | 8 , 8, 6, 6, 6, 5, 3, 3, 36 | 3 , 3, 8, 15, 3, 3, 6, 10, 37 | 5 , 8, 8, 6, 8, 5, 15, 15, 38 | 8 , 15, 3, 5, 6, 10, 8, 15, 39 | 15, 3, 15, 5, 15, 15, 15, 15, 40 | 3 , 15, 5, 5, 5, 8, 5, 10, 41 | 5 , 10, 8, 13, 15, 12, 3, 3 }, 42 | 43 | {15, 8, 8, 3, 15, 15, 3, 8, 44 | 15 , 15, 15, 15, 15, 15, 15, 8, 45 | 15 , 8, 15, 3, 15, 8, 15, 8, 46 | 3 , 15, 6, 10, 15, 15, 10, 8, 47 | 15 , 3, 15, 10, 10, 8, 9, 10, 48 | 6 , 15, 8, 15, 3, 6, 6, 8, 49 | 15 , 3, 15, 15, 15, 15, 15, 15, 50 | 15 , 15, 15, 15, 3, 15, 15, 8 } 51 | }; 52 | 53 | namespace BPTCC { 54 | 55 | static uint32 GetAnchorIndexForSubset( 56 | int subset, const int shapeIdx, const int nSubsets 57 | ) { 58 | 59 | int anchorIdx = 0; 60 | switch(subset) { 61 | case 1: 62 | { 63 | if(nSubsets == 2) { 64 | anchorIdx = kAnchorIdx2[shapeIdx]; 65 | } else { 66 | anchorIdx = kAnchorIdx3[0][shapeIdx]; 67 | } 68 | } 69 | break; 70 | 71 | case 2: 72 | { 73 | assert(nSubsets == 3); 74 | anchorIdx = kAnchorIdx3[1][shapeIdx]; 75 | } 76 | break; 77 | 78 | default: 79 | break; 80 | } 81 | 82 | return anchorIdx; 83 | } 84 | 85 | } // namespace BPTCC 86 | -------------------------------------------------------------------------------- /FasTCTest/ParallelStage.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #include "FasTC/TexCompTypes.h" 19 | 20 | enum BPTCParallelStage { 21 | eParallelStage_Uniform, 22 | eParallelStage_Partitioned, 23 | eParallelStage_Normal, 24 | 25 | kNumParallelStages 26 | }; 27 | 28 | class ParallelStage { 29 | public: 30 | ParallelStage( 31 | BPTCParallelStage stage, 32 | const unsigned char *inbuf, 33 | unsigned char *outbuf, 34 | uint32 numBlocks, 35 | uint32 outBlockSz = 16, 36 | uint32 inBlockSz = 64 37 | ); 38 | ParallelStage(const ParallelStage &); 39 | ParallelStage &operator=(const ParallelStage &); 40 | 41 | ~ParallelStage(); 42 | 43 | const BPTCParallelStage m_Stage; 44 | 45 | // Adds the block number to the list of blocks for this parallel stage 46 | void AddBlock(uint32 blockNum); 47 | 48 | // Loads the desired number of blocks into the destination buffer. Returns 49 | // the number of blocks loaded. 50 | uint32 LoadBlocks(uint32 blockOffset, uint32 numBlocks, unsigned char *dst); 51 | 52 | // Writes the block data from src into numBlocks blocks starting from 53 | // the block given by blockOffset. 54 | bool WriteBlocks(uint32 blockOffset, uint32 numBlocks, const unsigned char *src); 55 | 56 | private: 57 | 58 | // This is the stream of data that will be used to read the block data. 59 | const unsigned char *const m_InBuf; 60 | 61 | // This is the destination buffer to which the block data will be written to. 62 | unsigned char *const m_OutBuf; 63 | 64 | // This is the array of block offsets that belong to this stage. 65 | uint32 *m_Blocks; 66 | 67 | // This is the total number of blocks in the given image. 68 | const uint32 m_TotalNumBlocks; 69 | 70 | // This is the total number of blocks in this particular stage. 71 | uint32 m_NumBlocks; 72 | 73 | const uint32 m_OutBlockSz; 74 | const uint32 m_InBlockSz; 75 | }; 76 | -------------------------------------------------------------------------------- /analyze/analyze.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {45E3765E-CC3F-4DD9-B1D9-9D1B61CB7DBE} 8 | Exe 9 | analyze 10 | analyze 11 | v4.6.2 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | {03f9d6e4-a320-4835-a82f-d16036f1583e} 55 | DDSFile 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /InspectDDS/InspectDDS.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E6DDF89F-9056-43F0-9B32-810CE6F9B5F7} 8 | Exe 9 | InspectDDS 10 | InspectDDS 11 | v4.6.2 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | {03f9d6e4-a320-4835-a82f-d16036f1583e} 55 | DDSFile 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /DDSView/ddsview.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ddsview.fx 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | //-------------------------------------------------------------------------------------- 7 | 8 | //-------------------------------------------------------------------------------------- 9 | // Constant Buffer Variables 10 | //-------------------------------------------------------------------------------------- 11 | Texture1D tx1D : register( t0 ); 12 | Texture1DArray tx1DArray : register( t0 ); 13 | 14 | Texture2D tx2D : register( t0 ); 15 | Texture2DArray tx2DArray : register( t0 ); 16 | 17 | Texture3D tx3D : register( t0 ); 18 | 19 | SamplerState samLinear : register( s0 ); 20 | 21 | cbuffer cbArrayControl : register( b0 ) 22 | { 23 | float Index; 24 | }; 25 | 26 | //-------------------------------------------------------------------------------------- 27 | struct VS_INPUT 28 | { 29 | float4 Pos : POSITION; 30 | float4 Tex : TEXCOORD0; 31 | }; 32 | 33 | struct PS_INPUT 34 | { 35 | float4 Pos : SV_POSITION; 36 | float4 Tex : TEXCOORD0; 37 | }; 38 | 39 | 40 | //-------------------------------------------------------------------------------------- 41 | // Vertex Shader 42 | //-------------------------------------------------------------------------------------- 43 | PS_INPUT VS( VS_INPUT input ) 44 | { 45 | PS_INPUT output = (PS_INPUT)0; 46 | output.Pos = input.Pos; 47 | output.Tex = input.Tex; 48 | return output; 49 | } 50 | 51 | 52 | //-------------------------------------------------------------------------------------- 53 | // Pixel Shader 54 | //-------------------------------------------------------------------------------------- 55 | float4 PS_1D( PS_INPUT input) : SV_Target 56 | { 57 | return tx1D.Sample( samLinear, input.Tex.x ); 58 | } 59 | 60 | float4 PS_1DArray( PS_INPUT input) : SV_Target 61 | { 62 | return tx1DArray.Sample( samLinear, float2(input.Tex.x, Index) ); 63 | } 64 | 65 | float4 PS_2D( PS_INPUT input) : SV_Target 66 | { 67 | return tx2D.Sample( samLinear, input.Tex.xy ); 68 | } 69 | 70 | float4 PS_2DArray( PS_INPUT input) : SV_Target 71 | { 72 | return tx2DArray.Sample( samLinear, float3(input.Tex.xy, Index) ); 73 | } 74 | 75 | float4 PS_3D( PS_INPUT input) : SV_Target 76 | { 77 | int Width, Height, Depth; 78 | tx3D.GetDimensions( Width, Height, Depth); 79 | 80 | return tx3D.Sample( samLinear, float3(input.Tex.xy, Index / Depth) ); 81 | } 82 | 83 | float4 PS_Cube( PS_INPUT input) : SV_Target 84 | { 85 | return tx2DArray.Sample( samLinear, float3(input.Tex.xy, input.Tex.z + (6*Index)) ); 86 | } 87 | -------------------------------------------------------------------------------- /.nuget/directxtex_desktop_2015.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | directxtex_desktop_2015 5 | 0.0.0-SpecifyVersionOnCommandline 6 | DirectXTex Library (VS 2015/VS 2017 Win32) 7 | Microsoft 8 | microsoft,directxtk 9 | DirectXTex texture processing library 10 | This version is for Windows desktop applications using Visual Studio 2015 Update 3 or Visual Studio 2017. 11 | 12 | DirectXTex, a shared source library for reading and writing .DDS files, and performing various texture content processing operations including resizing, format conversion, mip-map generation, block compression for Direct3D runtime texture resources, and height-map to normal-map conversion. This library makes use of the Windows Image Component (WIC) APIs. It also includes simple .TGA and .HDR readers and writers since these image file format are commonly used for texture content processing pipelines, but are not currently supported by a built-in WIC codec. 13 | Matches the April 23, 2018 release on GitHub. 14 | http://go.microsoft.com/fwlink/?LinkId=248926 15 | https://github.com/Microsoft/DirectXTex/wiki/X_jpg.jpg 16 | http://opensource.org/licenses/MIT 17 | false 18 | © Microsoft Corporation. All rights reserved. 19 | DirectX DirectXTex native nativepackage 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WICTextureLoader/WICTextureLoader12.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: WICTextureLoader12.h 3 | // 4 | // Function for loading a WIC image and creating a Direct3D runtime texture for it 5 | // (auto-generating mipmaps if possible) 6 | // 7 | // Note: Assumes application has already called CoInitializeEx 8 | // 9 | // Note these functions are useful for images created as simple 2D textures. For 10 | // more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. 11 | // For a full-featured DDS file reader, writer, and texture processing pipeline see 12 | // the 'Texconv' sample and the 'DirectXTex' library. 13 | // 14 | // Copyright (c) Microsoft Corporation. All rights reserved. 15 | // Licensed under the MIT License. 16 | // 17 | // http://go.microsoft.com/fwlink/?LinkId=248926 18 | // http://go.microsoft.com/fwlink/?LinkID=615561 19 | //-------------------------------------------------------------------------------------- 20 | 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace DirectX 29 | { 30 | enum WIC_LOADER_FLAGS 31 | { 32 | WIC_LOADER_DEFAULT = 0, 33 | WIC_LOADER_FORCE_SRGB = 0x1, 34 | WIC_LOADER_IGNORE_SRGB = 0x2, 35 | WIC_LOADER_MIP_AUTOGEN = 0x4, 36 | WIC_LOADER_MIP_RESERVE = 0x8, 37 | }; 38 | 39 | // Standard version 40 | HRESULT __cdecl LoadWICTextureFromMemory( 41 | _In_ ID3D12Device* d3dDevice, 42 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 43 | size_t wicDataSize, 44 | _Outptr_ ID3D12Resource** texture, 45 | std::unique_ptr& decodedData, 46 | D3D12_SUBRESOURCE_DATA& subresource, 47 | size_t maxsize = 0); 48 | 49 | HRESULT __cdecl LoadWICTextureFromFile( 50 | _In_ ID3D12Device* d3dDevice, 51 | _In_z_ const wchar_t* szFileName, 52 | _Outptr_ ID3D12Resource** texture, 53 | std::unique_ptr& decodedData, 54 | D3D12_SUBRESOURCE_DATA& subresource, 55 | size_t maxsize = 0); 56 | 57 | // Extended version 58 | HRESULT __cdecl LoadWICTextureFromMemoryEx( 59 | _In_ ID3D12Device* d3dDevice, 60 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 61 | size_t wicDataSize, 62 | size_t maxsize, 63 | D3D12_RESOURCE_FLAGS resFlags, 64 | unsigned int loadFlags, 65 | _Outptr_ ID3D12Resource** texture, 66 | std::unique_ptr& decodedData, 67 | D3D12_SUBRESOURCE_DATA& subresource); 68 | 69 | HRESULT __cdecl LoadWICTextureFromFileEx( 70 | _In_ ID3D12Device* d3dDevice, 71 | _In_z_ const wchar_t* szFileName, 72 | size_t maxsize, 73 | D3D12_RESOURCE_FLAGS resFlags, 74 | unsigned int loadFlags, 75 | _Outptr_ ID3D12Resource** texture, 76 | std::unique_ptr& decodedData, 77 | D3D12_SUBRESOURCE_DATA& subresource); 78 | } 79 | -------------------------------------------------------------------------------- /DirectXTex/BCDirectCompute.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------- 2 | // BCDirectCompute.h 3 | // 4 | // Direct3D 11 Compute Shader BC Compressor 5 | // 6 | // Copyright (c) Microsoft Corporation. All rights reserved. 7 | // Licensed under the MIT License. 8 | //------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | namespace DirectX 13 | { 14 | 15 | class GPUCompressBC 16 | { 17 | public: 18 | GPUCompressBC() noexcept; 19 | 20 | HRESULT Initialize(_In_ ID3D11Device* pDevice); 21 | 22 | HRESULT Prepare(size_t width, size_t height, DWORD flags, DXGI_FORMAT format, float alphaWeight); 23 | 24 | HRESULT Compress(const Image& srcImage, const Image& destImage); 25 | 26 | DXGI_FORMAT GetSourceFormat() const { return m_srcformat; } 27 | 28 | private: 29 | DXGI_FORMAT m_bcformat; 30 | DXGI_FORMAT m_srcformat; 31 | float m_alphaWeight; 32 | bool m_bc7_mode02; 33 | bool m_bc7_mode137; 34 | size_t m_width; 35 | size_t m_height; 36 | 37 | Microsoft::WRL::ComPtr m_device; 38 | Microsoft::WRL::ComPtr m_context; 39 | 40 | Microsoft::WRL::ComPtr m_err1; 41 | Microsoft::WRL::ComPtr m_err1UAV; 42 | Microsoft::WRL::ComPtr m_err1SRV; 43 | 44 | Microsoft::WRL::ComPtr m_err2; 45 | Microsoft::WRL::ComPtr m_err2UAV; 46 | Microsoft::WRL::ComPtr m_err2SRV; 47 | 48 | Microsoft::WRL::ComPtr m_output; 49 | Microsoft::WRL::ComPtr m_outputCPU; 50 | Microsoft::WRL::ComPtr m_outputUAV; 51 | Microsoft::WRL::ComPtr m_constBuffer; 52 | 53 | // Compute shader library 54 | Microsoft::WRL::ComPtr m_BC6H_tryModeG10CS; 55 | Microsoft::WRL::ComPtr m_BC6H_tryModeLE10CS; 56 | Microsoft::WRL::ComPtr m_BC6H_encodeBlockCS; 57 | 58 | Microsoft::WRL::ComPtr m_BC7_hq_tryMode456CS; 59 | Microsoft::WRL::ComPtr m_BC7_hq_tryMode137CS; 60 | Microsoft::WRL::ComPtr m_BC7_hq_tryMode0CS; 61 | Microsoft::WRL::ComPtr m_BC7_hq_tryMode2CS; 62 | Microsoft::WRL::ComPtr m_BC7_hq_encodeBlockCS; 63 | }; 64 | 65 | } // namespace 66 | -------------------------------------------------------------------------------- /.nuget/directxtex_uwp.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | directxtex_uwp 5 | 0.0.0-SpecifyVersionOnCommandline 6 | DirectXTex Library (UWP) 7 | Microsoft 8 | microsoft,directxtk 9 | DirectXTex texture processing library 10 | This version is for Universal Windows apps on Windows 10 using Visual Studio 2015 Update 3 or Visual Studio 2017. 11 | 12 | DirectXTex, a shared source library for reading and writing .DDS files, and performing various texture content processing operations including resizing, format conversion, mip-map generation, block compression for Direct3D runtime texture resources, and height-map to normal-map conversion. This library makes use of the Windows Image Component (WIC) APIs. It also includes simple .TGA and .HDR readers and writers since these image file format are commonly used for texture content processing pipelines, but are not currently supported by a built-in WIC codec. 13 | Matches the April 23, 2018 release on GitHub. 14 | http://go.microsoft.com/fwlink/?LinkId=248926 15 | https://github.com/Microsoft/DirectXTex/wiki/X_jpg.jpg 16 | http://opensource.org/licenses/MIT 17 | false 18 | © Microsoft Corporation. All rights reserved. 19 | DirectX DirectXTex native nativepackage 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /DDSTextureLoader/DDSTextureLoader12.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DDSTextureLoader12.h 3 | // 4 | // Functions for loading a DDS texture and creating a Direct3D runtime resource for it 5 | // 6 | // Note these functions are useful as a light-weight runtime loader for DDS files. For 7 | // a full-featured DDS file reader, writer, and texture processing pipeline see 8 | // the 'Texconv' sample and the 'DirectXTex' library. 9 | // 10 | // Copyright (c) Microsoft Corporation. All rights reserved. 11 | // Licensed under the MIT License. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=248926 14 | // http://go.microsoft.com/fwlink/?LinkID=615561 15 | //-------------------------------------------------------------------------------------- 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | namespace DirectX 27 | { 28 | enum DDS_ALPHA_MODE 29 | { 30 | DDS_ALPHA_MODE_UNKNOWN = 0, 31 | DDS_ALPHA_MODE_STRAIGHT = 1, 32 | DDS_ALPHA_MODE_PREMULTIPLIED = 2, 33 | DDS_ALPHA_MODE_OPAQUE = 3, 34 | DDS_ALPHA_MODE_CUSTOM = 4, 35 | }; 36 | 37 | enum DDS_LOADER_FLAGS 38 | { 39 | DDS_LOADER_DEFAULT = 0, 40 | DDS_LOADER_FORCE_SRGB = 0x1, 41 | DDS_LOADER_MIP_RESERVE = 0x8, 42 | }; 43 | 44 | // Standard version 45 | HRESULT __cdecl LoadDDSTextureFromMemory( 46 | _In_ ID3D12Device* d3dDevice, 47 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 48 | size_t ddsDataSize, 49 | _Outptr_ ID3D12Resource** texture, 50 | std::vector& subresources, 51 | size_t maxsize = 0, 52 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 53 | _Out_opt_ bool* isCubeMap = nullptr); 54 | 55 | HRESULT __cdecl LoadDDSTextureFromFile( 56 | _In_ ID3D12Device* d3dDevice, 57 | _In_z_ const wchar_t* szFileName, 58 | _Outptr_ ID3D12Resource** texture, 59 | std::unique_ptr& ddsData, 60 | std::vector& subresources, 61 | size_t maxsize = 0, 62 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 63 | _Out_opt_ bool* isCubeMap = nullptr); 64 | 65 | // Extended version 66 | HRESULT __cdecl LoadDDSTextureFromMemoryEx( 67 | _In_ ID3D12Device* d3dDevice, 68 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 69 | size_t ddsDataSize, 70 | size_t maxsize, 71 | D3D12_RESOURCE_FLAGS resFlags, 72 | unsigned int loadFlags, 73 | _Outptr_ ID3D12Resource** texture, 74 | std::vector& subresources, 75 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 76 | _Out_opt_ bool* isCubeMap = nullptr); 77 | 78 | HRESULT __cdecl LoadDDSTextureFromFileEx( 79 | _In_ ID3D12Device* d3dDevice, 80 | _In_z_ const wchar_t* szFileName, 81 | size_t maxsize, 82 | D3D12_RESOURCE_FLAGS resFlags, 83 | unsigned int loadFlags, 84 | _Outptr_ ID3D12Resource** texture, 85 | std::unique_ptr& ddsData, 86 | std::vector& subresources, 87 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 88 | _Out_opt_ bool* isCubeMap = nullptr); 89 | } 90 | -------------------------------------------------------------------------------- /ISPCTextureCompressor/Tester.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "ispc_texcomp.h" 4 | #include "../DirectXTex/DirectXTex.h" 5 | 6 | #include "../stb_image/stb_image.h" 7 | 8 | int main(int argc, const char** argv) 9 | { 10 | if (argc < 3) 11 | return -1; 12 | 13 | int quality = 5; 14 | int alpha = 1; 15 | for (int i = 3; i < argc; i++) 16 | { 17 | if (!strcmp(argv[i], "-q")) 18 | { 19 | i++; 20 | if (i == argc) 21 | { 22 | fprintf(stderr, "No parameter for -q"); 23 | exit(-1); 24 | } 25 | 26 | quality = atoi(argv[i]); 27 | } 28 | else if (!strcmp(argv[i], "-a")) 29 | { 30 | i++; 31 | if (i == argc) 32 | { 33 | fprintf(stderr, "No parameter for -a"); 34 | exit(-1); 35 | } 36 | 37 | alpha = atoi(argv[i]); 38 | } 39 | } 40 | 41 | int w, h, channels; 42 | 43 | stbi_uc* imageData = stbi_load(argv[1], &w, &h, &channels, 4); 44 | 45 | if (!imageData) 46 | return -1; 47 | 48 | size_t compressedSize = w * h; 49 | unsigned char* compressedBlocks = new unsigned char[compressedSize]; 50 | 51 | bc7_enc_settings settings; 52 | if (alpha) 53 | { 54 | switch (quality) 55 | { 56 | case 1: 57 | GetProfile_alpha_ultrafast(&settings); 58 | break; 59 | case 2: 60 | GetProfile_alpha_veryfast(&settings); 61 | break; 62 | case 3: 63 | GetProfile_alpha_fast(&settings); 64 | break; 65 | case 4: 66 | GetProfile_alpha_basic(&settings); 67 | break; 68 | case 5: 69 | default: 70 | GetProfile_alpha_slow(&settings); 71 | break; 72 | } 73 | } 74 | else 75 | { 76 | switch (quality) 77 | { 78 | case 1: 79 | GetProfile_ultrafast(&settings); 80 | break; 81 | case 2: 82 | GetProfile_veryfast(&settings); 83 | break; 84 | case 3: 85 | GetProfile_fast(&settings); 86 | break; 87 | case 4: 88 | GetProfile_basic(&settings); 89 | break; 90 | case 5: 91 | default: 92 | GetProfile_slow(&settings); 93 | break; 94 | } 95 | } 96 | 97 | rgba_surface surface; 98 | surface.width = w; 99 | surface.height = h; 100 | surface.stride = w * 4; 101 | surface.ptr = imageData; 102 | 103 | CompressBlocksBC7(&surface, compressedBlocks, &settings); 104 | 105 | stbi_image_free(imageData); 106 | 107 | 108 | DirectX::Image image; 109 | image.format = DXGI_FORMAT_BC7_UNORM; 110 | image.width = w; 111 | image.height = h; 112 | image.rowPitch = 0; 113 | image.slicePitch = compressedSize; 114 | image.pixels = compressedBlocks; 115 | 116 | size_t outLen = strlen(argv[2]); 117 | wchar_t* outPathW = new wchar_t[outLen + 1]; 118 | outPathW[outLen] = 0; 119 | for (size_t i = 0; i < outLen; i++) 120 | outPathW[i] = static_cast(argv[2][i]); 121 | 122 | DirectX::SaveToDDSFile(image, 0, outPathW); 123 | 124 | delete[] outPathW; 125 | delete[] compressedBlocks; 126 | 127 | return 0; 128 | } 129 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Shapes.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BPTCENCODER_INCLUDE_SHAPES_H_ 19 | #define BPTCENCODER_INCLUDE_SHAPES_H_ 20 | 21 | namespace BPTCC { 22 | 23 | static const uint32 kNumShapes2 = 64; 24 | static const uint16 kShapeMask2[kNumShapes2] = { 25 | 0xcccc, 0x8888, 0xeeee, 0xecc8, 0xc880, 0xfeec, 0xfec8, 0xec80, 26 | 0xc800, 0xffec, 0xfe80, 0xe800, 0xffe8, 0xff00, 0xfff0, 0xf000, 27 | 0xf710, 0x008e, 0x7100, 0x08ce, 0x008c, 0x7310, 0x3100, 0x8cce, 28 | 0x088c, 0x3110, 0x6666, 0x366c, 0x17e8, 0x0ff0, 0x718e, 0x399c, 29 | 0xaaaa, 0xf0f0, 0x5a5a, 0x33cc, 0x3c3c, 0x55aa, 0x9696, 0xa55a, 30 | 0x73ce, 0x13c8, 0x324c, 0x3bdc, 0x6996, 0xc33c, 0x9966, 0x0660, 31 | 0x0272, 0x04e4, 0x4e40, 0x2720, 0xc936, 0x936c, 0x39c6, 0x639c, 32 | 0x9336, 0x9cc6, 0x817e, 0xe718, 0xccf0, 0x0fcc, 0x7744, 0xee22 33 | }; 34 | 35 | static const uint32 kNumShapes3 = 64; 36 | static const uint16 kShapeMask3[kNumShapes3][2] = { 37 | {0xfecc, 0xf600}, {0xffc8, 0x7300}, {0xff90, 0x3310}, {0xecce, 0x00ce}, 38 | {0xff00, 0xcc00}, {0xcccc, 0xcc00}, {0xffcc, 0x00cc}, {0xffcc, 0x3300}, 39 | {0xff00, 0xf000}, {0xfff0, 0xf000}, {0xfff0, 0xff00}, {0xcccc, 0x8888}, 40 | {0xeeee, 0x8888}, {0xeeee, 0xcccc}, {0xffec, 0xec80}, {0x739c, 0x7310}, 41 | {0xfec8, 0xc800}, {0x39ce, 0x3100}, {0xfff0, 0xccc0}, {0xfccc, 0x0ccc}, 42 | {0xeeee, 0xee00}, {0xff88, 0x7700}, {0xeec0, 0xcc00}, {0x7730, 0x3300}, 43 | {0x0cee, 0x00cc}, {0xffcc, 0xfc88}, {0x6ff6, 0x0660}, {0xff60, 0x6600}, 44 | {0xcbbc, 0xc88c}, {0xf966, 0xf900}, {0xceec, 0x0cc0}, {0xff10, 0x7310}, 45 | {0xff80, 0xec80}, {0xccce, 0x08ce}, {0xeccc, 0xec80}, {0x6666, 0x4444}, 46 | {0x0ff0, 0x0f00}, {0x6db6, 0x4924}, {0x6bd6, 0x4294}, {0xcf3c, 0x0c30}, 47 | {0xc3fc, 0x03c0}, {0xffaa, 0xff00}, {0xff00, 0x5500}, {0xfcfc, 0xcccc}, 48 | {0xcccc, 0x0c0c}, {0xf6f6, 0x6666}, {0xaffa, 0x0ff0}, {0xfff0, 0x5550}, 49 | {0xfaaa, 0xf000}, {0xeeee, 0x0e0e}, {0xf8f8, 0x8888}, {0xfff0, 0x9990}, 50 | {0xeeee, 0xe00e}, {0x8ff8, 0x8888}, {0xf666, 0xf000}, {0xff00, 0x9900}, 51 | {0xff66, 0xff00}, {0xcccc, 0xc00c}, {0xcffc, 0xcccc}, {0xf000, 0x9000}, 52 | {0x8888, 0x0808}, {0xfefe, 0xeeee}, {0xfffa, 0xfff0}, {0x7bde, 0x7310} 53 | }; 54 | 55 | static uint8 GetSubsetForIndex(int idx, const int shapeIdx, const int nSubs) { 56 | int subset = 0; 57 | 58 | switch(nSubs) { 59 | case 2: 60 | { 61 | subset = !!((1 << idx) & kShapeMask2[shapeIdx]); 62 | } 63 | break; 64 | 65 | case 3: 66 | { 67 | if(1 << idx & kShapeMask3[shapeIdx][0]) 68 | subset = 1 + !!((1 << idx) & kShapeMask3[shapeIdx][1]); 69 | else 70 | subset = 0; 71 | } 72 | break; 73 | 74 | default: 75 | break; 76 | } 77 | 78 | return subset; 79 | } 80 | 81 | } // namespace BPTCC 82 | 83 | #endif // BPTCENCODER_INCLUDE_SHAPES_H_ 84 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Convection Texture Tools 2 | 3 | Copyright (c) 2018 Eric Lasota 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 11 | to 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 | Based on DirectX Texture Library 27 | 28 | Copyright (c) 2018 Microsoft Corp 29 | 30 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 31 | software and associated documentation files (the "Software"), to deal in the Software 32 | without restriction, including without limitation the rights to use, copy, modify, 33 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 34 | permit persons to whom the Software is furnished to do so, subject to the following 35 | conditions: 36 | 37 | The above copyright notice and this permission notice shall be included in all copies 38 | or substantial portions of the Software. 39 | 40 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 41 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 42 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 43 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 44 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 45 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 46 | 47 | 48 | ************************************************************************** 49 | 50 | Contains portions of Squish 51 | 52 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 53 | 54 | Permission is hereby granted, free of charge, to any person obtaining 55 | a copy of this software and associated documentation files (the 56 | "Software"), to deal in the Software without restriction, including 57 | without limitation the rights to use, copy, modify, merge, publish, 58 | distribute, sublicense, and/or sell copies of the Software, and to 59 | permit persons to whom the Software is furnished to do so, subject to 60 | the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included 63 | in all copies or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 66 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 67 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 68 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 69 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 70 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 71 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 72 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/MatrixSquare.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_MATRIXSQUARE_H_ 19 | #define BASE_INCLUDE_MATRIXSQUARE_H_ 20 | 21 | #include "MatrixBase.h" 22 | #include 23 | #include 24 | 25 | namespace FasTC { 26 | 27 | template 28 | class MatrixSquare : public MatrixBase { 29 | public: 30 | 31 | // Constructors 32 | MatrixSquare() { } 33 | MatrixSquare(const MatrixSquare &other) 34 | : MatrixBase(other) { } 35 | MatrixSquare(const MatrixBase &other) 36 | : MatrixBase(other) { } 37 | 38 | MatrixSquare Transpose() const { 39 | return MatrixBase::Transpose(); 40 | } 41 | 42 | // Does power iteration to determine the principal eigenvector and eigenvalue. 43 | // Returns them in eigVec and eigVal after kMaxNumIterations 44 | int PowerMethod(VectorBase &eigVec, 45 | T *eigVal = NULL, 46 | const int kMaxNumIterations = 5) { 47 | 48 | int numIterations = 0; 49 | 50 | VectorBase b; 51 | T norm = static_cast(1.0)/sqrt(static_cast(N)); 52 | for(int i = 0; i < N; i++) 53 | b[i] = norm; 54 | 55 | bool badEigenValue = false; 56 | bool fixed = false; 57 | numIterations = 0; 58 | while(!fixed && ++numIterations < kMaxNumIterations) { 59 | 60 | VectorBase newB = (*this) * b; 61 | 62 | // !HACK! If the principal eigenvector of the matrix 63 | // converges to zero, that could mean that there is no 64 | // principal eigenvector. However, that may be due to 65 | // poor initialization of the random vector, so rerandomize 66 | // and try again. 67 | const T newBlen = newB.Length(); 68 | if(newBlen < 1e-10) { 69 | if(badEigenValue) { 70 | eigVec = b; 71 | if(eigVal) *eigVal = 0.0; 72 | return numIterations; 73 | } 74 | 75 | for(int i = 0; i < (N>>1); i++) 76 | b[i] = 1; 77 | 78 | b.Normalize(); 79 | badEigenValue = true; 80 | continue; 81 | } 82 | 83 | // Normalize 84 | newB.Normalize(); 85 | 86 | // If the new eigenvector is close enough to the old one, 87 | // then we've converged. 88 | if(fabs(1.0f - (b.Dot(newB))) < 1e-8) 89 | fixed = true; 90 | 91 | // Save and continue. 92 | b = newB; 93 | } 94 | 95 | // Store the eigenvector in the proper variable. 96 | eigVec = b; 97 | 98 | // Store eigenvalue if it was requested 99 | if(eigVal) { 100 | VectorBase result = (*this) * b; 101 | *eigVal = result.Length() / b.Length(); 102 | } 103 | 104 | return numIterations; 105 | } 106 | 107 | private: 108 | 109 | }; 110 | REGISTER_ONE_TEMPLATE_MATRIX_SIZED_TYPE(MatrixSquare); 111 | 112 | }; 113 | 114 | #endif // BASE_INCLUDE_MATRIXSQUARE_H_ 115 | -------------------------------------------------------------------------------- /FasTCTest/CompressionJob.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #include "FasTC/CompressionJob.h" 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace FasTC { 26 | 27 | // Initialize the list by specifying the total number of jobs that it will contain. 28 | // This constructor allocates the necessary memory to hold the array. 29 | CompressionJobList::CompressionJobList(const uint32 nJobs) 30 | : m_NumJobs(0) 31 | , m_TotalNumJobs(nJobs) 32 | , m_CurrentJobIndex(0) 33 | , m_CurrentBlockIndex(0) 34 | { 35 | m_FinishedFlags = new FinishedFlag[nJobs]; 36 | memset(m_FinishedFlags, 0, nJobs * sizeof(m_FinishedFlags[0])); 37 | 38 | m_Jobs = (CompressionJob *)(malloc(nJobs * sizeof(m_Jobs[0]))); 39 | } 40 | 41 | CompressionJobList::~CompressionJobList() { 42 | delete [] m_FinishedFlags; 43 | free(m_Jobs); 44 | } 45 | 46 | // Overrides to deal with memory management. 47 | CompressionJobList::CompressionJobList(const CompressionJobList &other) 48 | : m_NumJobs(other.m_NumJobs) 49 | , m_TotalNumJobs(other.m_TotalNumJobs) 50 | , m_CurrentJobIndex(other.m_CurrentJobIndex) 51 | , m_CurrentBlockIndex(other.m_CurrentBlockIndex) 52 | { 53 | uint32 arraySz = m_TotalNumJobs * sizeof(m_Jobs[0]); 54 | m_Jobs = (CompressionJob *)malloc(arraySz); 55 | memcpy(m_Jobs, other.m_Jobs, arraySz); 56 | 57 | m_FinishedFlags = new FinishedFlag[m_TotalNumJobs]; 58 | memcpy(m_FinishedFlags, other.m_FinishedFlags, m_TotalNumJobs * sizeof(m_FinishedFlags[0])); 59 | } 60 | 61 | CompressionJobList &CompressionJobList::operator =(const CompressionJobList &other) { 62 | assert(m_TotalNumJobs == other.m_TotalNumJobs); 63 | 64 | m_NumJobs = other.m_NumJobs; 65 | m_CurrentJobIndex = other.m_CurrentJobIndex; 66 | m_CurrentBlockIndex = other.m_CurrentBlockIndex; 67 | 68 | // Get rid of old variables... 69 | free(m_Jobs); 70 | delete [] m_FinishedFlags; 71 | 72 | // Make new variables. 73 | uint32 arraySz = m_TotalNumJobs * sizeof(m_Jobs[0]); 74 | m_Jobs = (CompressionJob *)malloc(arraySz); 75 | memcpy(m_Jobs, other.m_Jobs, arraySz); 76 | 77 | m_FinishedFlags = new FinishedFlag[m_TotalNumJobs]; 78 | memcpy(m_FinishedFlags, other.m_FinishedFlags, m_TotalNumJobs * sizeof(m_FinishedFlags[0])); 79 | return *this; 80 | } 81 | 82 | // Add a job to the list. This function returns false on failure. 83 | bool CompressionJobList::AddJob(const CompressionJob &cj) { 84 | if(m_NumJobs == m_TotalNumJobs) { 85 | return false; 86 | } 87 | 88 | CompressionJob *cjPtr = &(m_Jobs[m_NumJobs++]); 89 | return 0 != (new (cjPtr) CompressionJob(cj)); 90 | } 91 | 92 | const CompressionJob *CompressionJobList::GetJob(uint32 idx) const { 93 | if(idx >= m_NumJobs) { 94 | return NULL; 95 | } 96 | 97 | return &(m_Jobs[m_CurrentJobIndex]); 98 | } 99 | 100 | uint32 *CompressionJobList::GetFinishedFlag(uint32 idx) const { 101 | if(idx >= m_NumJobs) { 102 | return NULL; 103 | } 104 | 105 | return &(m_FinishedFlags[idx].m_flag); 106 | } 107 | 108 | } // namespace FasTC 109 | -------------------------------------------------------------------------------- /DirectXTex/DirectXTex.inl: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------- 2 | // DirectXTex.inl 3 | // 4 | // DirectX Texture Library 5 | // 6 | // Copyright (c) Microsoft Corporation. All rights reserved. 7 | // Licensed under the MIT License. 8 | // 9 | // http://go.microsoft.com/fwlink/?LinkId=248926 10 | //------------------------------------------------------------------------------------- 11 | 12 | #pragma once 13 | 14 | //===================================================================================== 15 | // DXGI Format Utilities 16 | //===================================================================================== 17 | 18 | _Use_decl_annotations_ 19 | inline bool __cdecl IsValid(DXGI_FORMAT fmt) 20 | { 21 | return (static_cast(fmt) >= 1 && static_cast(fmt) <= 190); 22 | } 23 | 24 | _Use_decl_annotations_ 25 | inline bool __cdecl IsCompressed(DXGI_FORMAT fmt) 26 | { 27 | switch (fmt) 28 | { 29 | case DXGI_FORMAT_BC1_TYPELESS: 30 | case DXGI_FORMAT_BC1_UNORM: 31 | case DXGI_FORMAT_BC1_UNORM_SRGB: 32 | case DXGI_FORMAT_BC2_TYPELESS: 33 | case DXGI_FORMAT_BC2_UNORM: 34 | case DXGI_FORMAT_BC2_UNORM_SRGB: 35 | case DXGI_FORMAT_BC3_TYPELESS: 36 | case DXGI_FORMAT_BC3_UNORM: 37 | case DXGI_FORMAT_BC3_UNORM_SRGB: 38 | case DXGI_FORMAT_BC4_TYPELESS: 39 | case DXGI_FORMAT_BC4_UNORM: 40 | case DXGI_FORMAT_BC4_SNORM: 41 | case DXGI_FORMAT_BC5_TYPELESS: 42 | case DXGI_FORMAT_BC5_UNORM: 43 | case DXGI_FORMAT_BC5_SNORM: 44 | case DXGI_FORMAT_BC6H_TYPELESS: 45 | case DXGI_FORMAT_BC6H_UF16: 46 | case DXGI_FORMAT_BC6H_SF16: 47 | case DXGI_FORMAT_BC7_TYPELESS: 48 | case DXGI_FORMAT_BC7_UNORM: 49 | case DXGI_FORMAT_BC7_UNORM_SRGB: 50 | return true; 51 | 52 | default: 53 | return false; 54 | } 55 | } 56 | 57 | _Use_decl_annotations_ 58 | inline bool __cdecl IsPalettized(DXGI_FORMAT fmt) 59 | { 60 | switch (fmt) 61 | { 62 | case DXGI_FORMAT_AI44: 63 | case DXGI_FORMAT_IA44: 64 | case DXGI_FORMAT_P8: 65 | case DXGI_FORMAT_A8P8: 66 | return true; 67 | 68 | default: 69 | return false; 70 | } 71 | } 72 | 73 | _Use_decl_annotations_ 74 | inline bool __cdecl IsSRGB(DXGI_FORMAT fmt) 75 | { 76 | switch (fmt) 77 | { 78 | case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: 79 | case DXGI_FORMAT_BC1_UNORM_SRGB: 80 | case DXGI_FORMAT_BC2_UNORM_SRGB: 81 | case DXGI_FORMAT_BC3_UNORM_SRGB: 82 | case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: 83 | case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: 84 | case DXGI_FORMAT_BC7_UNORM_SRGB: 85 | return true; 86 | 87 | default: 88 | return false; 89 | } 90 | } 91 | 92 | 93 | //===================================================================================== 94 | // Image I/O 95 | //===================================================================================== 96 | _Use_decl_annotations_ 97 | inline HRESULT __cdecl SaveToDDSMemory(const Image& image, DWORD flags, Blob& blob) 98 | { 99 | TexMetadata mdata = {}; 100 | mdata.width = image.width; 101 | mdata.height = image.height; 102 | mdata.depth = 1; 103 | mdata.arraySize = 1; 104 | mdata.mipLevels = 1; 105 | mdata.format = image.format; 106 | mdata.dimension = TEX_DIMENSION_TEXTURE2D; 107 | 108 | return SaveToDDSMemory(&image, 1, mdata, flags, blob); 109 | } 110 | 111 | _Use_decl_annotations_ 112 | inline HRESULT __cdecl SaveToDDSFile(const Image& image, DWORD flags, const wchar_t* szFile) 113 | { 114 | TexMetadata mdata = {}; 115 | mdata.width = image.width; 116 | mdata.height = image.height; 117 | mdata.depth = 1; 118 | mdata.arraySize = 1; 119 | mdata.mipLevels = 1; 120 | mdata.format = image.format; 121 | mdata.dimension = TEX_DIMENSION_TEXTURE2D; 122 | 123 | return SaveToDDSFile(&image, 1, mdata, flags, szFile); 124 | } 125 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Vector3.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_VECTOR3_H_ 19 | #define BASE_INCLUDE_VECTOR3_H_ 20 | 21 | #include "Vector2.h" 22 | 23 | # define _VEX_VEC3_SWIZZLE_DEF(X, Y, Z) \ 24 | Vector3 X##Y##Z() const { return Vector3( X(), Y(), Z() ); } 25 | 26 | namespace FasTC { 27 | 28 | template 29 | class Vector3 : public VectorBase { 30 | public: 31 | Vector3() { } 32 | Vector3(T x, T y, T z) { 33 | X() = x; 34 | Y() = y; 35 | Z() = z; 36 | } 37 | 38 | explicit Vector3(const T *_vec) { 39 | for(int i = 0; i < 3; i++) { 40 | this->vec[i] = _vec[i]; 41 | } 42 | } 43 | 44 | // Overloaded functions 45 | template 46 | Vector3(const Vector3<_T> &v) : VectorBase(v) { } 47 | 48 | template 49 | Vector3 &operator=(const Vector3<_T> &v) { 50 | VectorBase::operator=(v); 51 | return *this; 52 | } 53 | 54 | template 55 | Vector3 &operator=(const _T *v) { 56 | VectorBase::operator=(v); 57 | return *this; 58 | } 59 | 60 | // Accessors 61 | T &X() { return (*this)[0]; } 62 | const T &X() const { return (*this)[0]; } 63 | 64 | T &Y() { return (*this)[1]; } 65 | const T &Y() const { return (*this)[1]; } 66 | 67 | T &Z() { return (*this)[2]; } 68 | const T &Z() const { return (*this)[2]; } 69 | 70 | // Vector operations 71 | template 72 | Vector3 Cross(const Vector3<_T> &v) { 73 | return Vector3( 74 | Y() * v.Z() - v.Y() * Z(), 75 | Z() * v.X() - v.Z() * X(), 76 | X() * v.Y() - v.X() * Y() 77 | ); 78 | } 79 | 80 | // Swizzle 81 | _VEX_VEC2_SWIZZLE_DEF(X, X) 82 | _VEX_VEC2_SWIZZLE_DEF(X, Y) 83 | _VEX_VEC2_SWIZZLE_DEF(X, Z) 84 | _VEX_VEC2_SWIZZLE_DEF(Y, X) 85 | _VEX_VEC2_SWIZZLE_DEF(Y, Y) 86 | _VEX_VEC2_SWIZZLE_DEF(Y, Z) 87 | _VEX_VEC2_SWIZZLE_DEF(Z, X) 88 | _VEX_VEC2_SWIZZLE_DEF(Z, Y) 89 | _VEX_VEC2_SWIZZLE_DEF(Z, Z) 90 | 91 | _VEX_VEC3_SWIZZLE_DEF(X, X, X) 92 | _VEX_VEC3_SWIZZLE_DEF(X, X, Y) 93 | _VEX_VEC3_SWIZZLE_DEF(X, X, Z) 94 | _VEX_VEC3_SWIZZLE_DEF(X, Y, X) 95 | _VEX_VEC3_SWIZZLE_DEF(X, Y, Y) 96 | _VEX_VEC3_SWIZZLE_DEF(X, Y, Z) 97 | _VEX_VEC3_SWIZZLE_DEF(X, Z, X) 98 | _VEX_VEC3_SWIZZLE_DEF(X, Z, Y) 99 | _VEX_VEC3_SWIZZLE_DEF(X, Z, Z) 100 | _VEX_VEC3_SWIZZLE_DEF(Y, X, X) 101 | _VEX_VEC3_SWIZZLE_DEF(Y, X, Y) 102 | _VEX_VEC3_SWIZZLE_DEF(Y, X, Z) 103 | _VEX_VEC3_SWIZZLE_DEF(Y, Y, X) 104 | _VEX_VEC3_SWIZZLE_DEF(Y, Y, Y) 105 | _VEX_VEC3_SWIZZLE_DEF(Y, Y, Z) 106 | _VEX_VEC3_SWIZZLE_DEF(Y, Z, X) 107 | _VEX_VEC3_SWIZZLE_DEF(Y, Z, Y) 108 | _VEX_VEC3_SWIZZLE_DEF(Y, Z, Z) 109 | _VEX_VEC3_SWIZZLE_DEF(Z, X, X) 110 | _VEX_VEC3_SWIZZLE_DEF(Z, X, Y) 111 | _VEX_VEC3_SWIZZLE_DEF(Z, X, Z) 112 | _VEX_VEC3_SWIZZLE_DEF(Z, Y, X) 113 | _VEX_VEC3_SWIZZLE_DEF(Z, Y, Y) 114 | _VEX_VEC3_SWIZZLE_DEF(Z, Y, Z) 115 | _VEX_VEC3_SWIZZLE_DEF(Z, Z, X) 116 | _VEX_VEC3_SWIZZLE_DEF(Z, Z, Y) 117 | _VEX_VEC3_SWIZZLE_DEF(Z, Z, Z) 118 | }; 119 | REGISTER_ONE_TEMPLATE_VECTOR_TYPE(Vector3); 120 | 121 | typedef Vector3 Vec3f; 122 | typedef Vector3 Vec3d; 123 | typedef Vector3 Vec3i; 124 | }; 125 | 126 | #endif // BASE_INCLUDE_VECTOR3_H_ 127 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Image.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef FASTC_BASE_INCLUDE_IMAGE_H_ 19 | #define FASTC_BASE_INCLUDE_IMAGE_H_ 20 | 21 | #include "FasTC/TexCompTypes.h" 22 | #include "FasTC/ImageFwd.h" 23 | 24 | namespace FasTC { 25 | 26 | class IPixel; 27 | 28 | template 29 | extern double ComputePSNR(Image *img1, Image *img2); 30 | 31 | // Forward declare 32 | template 33 | class Image { 34 | 35 | public: 36 | Image() : m_Width(0), m_Height(0), m_Pixels(0) { } 37 | Image(uint32 width, uint32 height); 38 | Image(uint32 width, uint32 height, 39 | const PixelType *pixels); 40 | Image(uint32 width, uint32 height, 41 | const uint32 *pixels); 42 | Image(const Image &); 43 | Image &operator=(const Image &); 44 | virtual ~Image(); 45 | 46 | virtual Image *Clone() const { 47 | return new Image(*this); 48 | }; 49 | 50 | PixelType &operator()(uint32 i, uint32 j); 51 | const PixelType &operator()(uint32 i, uint32 j) const; 52 | 53 | // Reads a buffer full of pixels and stores them in the 54 | // data associated with this image. 55 | virtual bool ReadPixels(const uint32 *rgba); 56 | const PixelType *GetPixels() const { return m_Pixels; } 57 | 58 | uint32 GetWidth() const { return m_Width; } 59 | uint32 GetHeight() const { return m_Height; } 60 | uint32 GetNumPixels() const { return GetWidth() * GetHeight(); } 61 | 62 | template 63 | void ConvertTo(Image &other) const { 64 | for(uint32 j = 0; j < other.GetHeight(); j++) { 65 | for(uint32 i = 0; i < other.GetWidth(); i++) { 66 | other(i, j).Unpack((*this)(i, j).Pack()); 67 | } 68 | } 69 | } 70 | 71 | double ComputePSNR(Image *other); 72 | double ComputeSSIM(Image *other); 73 | 74 | Image Diff(Image *other, float mult); 75 | 76 | double ComputeEntropy(); 77 | double ComputeMeanLocalEntropy(); 78 | 79 | // Function to allow derived classes to populate the pixel array. 80 | // This may involve decompressing a compressed image or otherwise 81 | // processing some data in order to populate the m_Pixels pointer. 82 | // This function should use SetImageData in order to set all of the 83 | // appropriate pixels. 84 | virtual void ComputePixels() { } 85 | 86 | // Filters the image with a given set of kernel values. The values 87 | // are normalized before they are used (i.e. we make sure that they 88 | // sum up to one). 89 | void Filter(const Image &kernel); 90 | 91 | private: 92 | uint32 m_Width; 93 | uint32 m_Height; 94 | 95 | PixelType *m_Pixels; 96 | 97 | protected: 98 | 99 | void SetImageData(uint32 width, uint32 height, PixelType *data); 100 | }; 101 | 102 | extern void GenerateGaussianKernel(Image &out, uint32 size, float sigma); 103 | 104 | template 105 | extern void SplitChannels(const Image &in, 106 | Image *channelOne, 107 | Image *channelTwo, 108 | Image *channelThree); 109 | 110 | extern void DiscreteCosineXForm(Image *img, uint32 blockSize); 111 | extern void InvDiscreteCosineXForm(Image *img, uint32 blockSize); 112 | } // namespace FasTC 113 | 114 | #endif // __TEXCOMP_IMAGE_H__ 115 | -------------------------------------------------------------------------------- /FasTCTest/ParallelStage.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #include "ParallelStage.h" 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | const BPTCParallelStage stage; 25 | 26 | // This is the stream of data that will be used to read the block data. 27 | const unsigned char *const m_InBuf; 28 | 29 | // This is the destination buffer to which the block data will be written to. 30 | unsigned char *const m_OutBuf; 31 | 32 | // This is the array of block offsets that belong to this stage. 33 | uint32 *m_Blocks; 34 | 35 | // This is the total number of blocks in the given image. 36 | const uint32 m_TotalNumBlocks; 37 | 38 | // This is the total number of blocks in this particular stage. 39 | uint32 m_NumBlocks; 40 | */ 41 | ParallelStage::ParallelStage( 42 | BPTCParallelStage stage, 43 | const unsigned char *inbuf, 44 | unsigned char *outbuf, 45 | uint32 numBlocks, 46 | uint32 outBlockSz, 47 | uint32 inBlockSz 48 | ) 49 | : m_Stage(stage) 50 | , m_InBuf(inbuf) 51 | , m_OutBuf(outbuf) 52 | , m_Blocks(new uint32[numBlocks]) 53 | , m_TotalNumBlocks(numBlocks) 54 | , m_NumBlocks(0) 55 | , m_OutBlockSz(outBlockSz) 56 | , m_InBlockSz(inBlockSz) 57 | { 58 | assert(numBlocks > 0); 59 | } 60 | 61 | ParallelStage::ParallelStage(const ParallelStage &other) 62 | : m_Stage(other.m_Stage) 63 | , m_InBuf(other.m_InBuf) 64 | , m_OutBuf(other.m_OutBuf) 65 | , m_Blocks(new uint32[other.m_NumBlocks]) 66 | , m_TotalNumBlocks(other.m_TotalNumBlocks) 67 | , m_NumBlocks(other.m_NumBlocks) 68 | , m_OutBlockSz(other.m_OutBlockSz) 69 | , m_InBlockSz(other.m_InBlockSz) 70 | { 71 | memcpy(m_Blocks, other.m_Blocks, m_NumBlocks * sizeof(m_Blocks[0])); 72 | } 73 | 74 | ParallelStage &ParallelStage::operator=(const ParallelStage &other) { 75 | assert(m_Stage == other.m_Stage); 76 | assert(m_InBuf == other.m_InBuf); 77 | assert(m_OutBuf == other.m_OutBuf); 78 | assert(m_TotalNumBlocks == other.m_TotalNumBlocks); 79 | assert(m_NumBlocks == other.m_NumBlocks); 80 | assert(m_OutBlockSz == other.m_OutBlockSz); 81 | assert(m_InBlockSz == other.m_InBlockSz); 82 | 83 | memcpy(m_Blocks, other.m_Blocks, m_NumBlocks * sizeof(m_Blocks[0])); 84 | return *this; 85 | } 86 | 87 | ParallelStage::~ParallelStage() { 88 | if(m_Blocks) { 89 | delete [] m_Blocks; 90 | m_Blocks = 0; 91 | } 92 | } 93 | 94 | void ParallelStage::AddBlock(uint32 blockNum) { 95 | assert(m_NumBlocks < m_TotalNumBlocks); 96 | 97 | m_Blocks[m_NumBlocks++] = blockNum; 98 | } 99 | 100 | uint32 ParallelStage::LoadBlocks(uint32 blockOffset, uint32 numBlocks, unsigned char *dst) { 101 | 102 | if(!dst) 103 | return 0; 104 | 105 | if(blockOffset + numBlocks > m_NumBlocks) 106 | return 0; 107 | 108 | int lastBlock = blockOffset + numBlocks; 109 | for(int i = blockOffset; i < lastBlock; i++) 110 | { 111 | uint32 block = m_Blocks[i]; 112 | uint32 bOffset = block * m_InBlockSz; 113 | memcpy(dst + ((i - blockOffset) * m_InBlockSz), m_InBuf + bOffset, m_InBlockSz); 114 | } 115 | 116 | return 0; 117 | } 118 | 119 | bool ParallelStage::WriteBlocks(uint32 blockOffset, uint32 numBlocks, const unsigned char *src) { 120 | if(!src) 121 | return false; 122 | 123 | if(blockOffset + numBlocks > m_NumBlocks) 124 | return false; 125 | 126 | int lastBlock = blockOffset + numBlocks; 127 | for(int i = blockOffset; i < lastBlock; i++) { 128 | uint32 block = m_Blocks[i]; 129 | uint32 bOffset = block * m_OutBlockSz; 130 | memcpy(m_OutBuf + bOffset, src + ((i-blockOffset) * m_OutBlockSz), m_OutBlockSz); 131 | } 132 | 133 | return true; 134 | } 135 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/BitStream.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | // The original lisence from the code available at the following location: 19 | // http://software.intel.com/en-us/vcsource/samples/fast-texture-compression 20 | // 21 | // This code has been modified significantly from the original. 22 | 23 | //------------------------------------------------------------------------------ 24 | // Copyright 2011 Intel Corporation 25 | // All Rights Reserved 26 | // 27 | // Permission is granted to use, copy, distribute and prepare derivative works 28 | // of this software for any purpose and without fee, provided, that the above 29 | // copyright notice and this statement appear in all copies. Intel makes no 30 | // representations about the suitability of this software for any purpose. THIS 31 | // SOFTWARE IS PROVIDED "AS IS." INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES, 32 | // EXPRESS OR IMPLIED, AND ALL LIABILITY, INCLUDING CONSEQUENTIAL AND OTHER 33 | // INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE, INCLUDING LIABILITY FOR 34 | // INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE WARRANTIES OF 35 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not assume 36 | // any responsibility for any errors which may appear in this software nor any 37 | // responsibility to update it. 38 | // 39 | //------------------------------------------------------------------------------ 40 | 41 | #ifndef __BASE_INCLUDE_BITSTREAM_H__ 42 | #define __BASE_INCLUDE_BITSTREAM_H__ 43 | 44 | namespace FasTC { 45 | 46 | class BitStream { 47 | public: 48 | BitStream(unsigned char *ptr, int nBits, int start_offset) : 49 | m_BitsWritten(0), 50 | m_NumBits(nBits), 51 | m_CurByte(ptr), 52 | m_NextBit(start_offset % 8), 53 | done(false) 54 | { } 55 | 56 | int GetBitsWritten() const { return m_BitsWritten; } 57 | 58 | ~BitStream() { } 59 | void WriteBitsR(unsigned int val, unsigned int nBits) { 60 | for(unsigned int i = 0; i < nBits; i++) { 61 | WriteBit((val >> (nBits - i - 1)) & 1); 62 | } 63 | } 64 | 65 | void WriteBits(unsigned int val, unsigned int nBits) { 66 | for(unsigned int i = 0; i < nBits; i++) { 67 | WriteBit((val >> i) & 1); 68 | } 69 | } 70 | 71 | private: 72 | void WriteBit(int b) { 73 | 74 | if(done) return; 75 | 76 | const unsigned int mask = 1 << m_NextBit++; 77 | 78 | // clear the bit 79 | *m_CurByte &= ~mask; 80 | 81 | // Write the bit, if necessary 82 | if(b) *m_CurByte |= mask; 83 | 84 | // Next byte? 85 | if(m_NextBit >= 8) { 86 | m_CurByte += 1; 87 | m_NextBit = 0; 88 | } 89 | 90 | done = done || ++m_BitsWritten >= m_NumBits; 91 | } 92 | 93 | int m_BitsWritten; 94 | const int m_NumBits; 95 | unsigned char *m_CurByte; 96 | int m_NextBit; 97 | 98 | bool done; 99 | }; 100 | 101 | class BitStreamReadOnly { 102 | public: 103 | BitStreamReadOnly(const unsigned char *ptr) : 104 | m_BitsRead(0), 105 | m_CurByte(ptr), 106 | m_NextBit(0) 107 | { } 108 | 109 | int GetBitsRead() const { return m_BitsRead; } 110 | 111 | ~BitStreamReadOnly() { } 112 | 113 | int ReadBit() { 114 | 115 | int bit = *m_CurByte >> m_NextBit++; 116 | while(m_NextBit >= 8) { 117 | m_NextBit -= 8; 118 | m_CurByte++; 119 | } 120 | 121 | m_BitsRead++; 122 | return bit & 1; 123 | } 124 | 125 | unsigned int ReadBits(unsigned int nBits) { 126 | unsigned int ret = 0; 127 | for(unsigned int i = 0; i < nBits; i++) { 128 | ret |= (ReadBit() & 1) << i; 129 | } 130 | return ret; 131 | } 132 | 133 | private: 134 | int m_BitsRead; 135 | const unsigned char *m_CurByte; 136 | int m_NextBit; 137 | }; 138 | 139 | } // namespace FasTC 140 | 141 | #endif //__BASE_INCLUDE_BITSTREAM_H__ 142 | -------------------------------------------------------------------------------- /DDSView/shaders/vs.h: -------------------------------------------------------------------------------- 1 | #if 0 2 | // 3 | // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 4 | // 5 | // 6 | // fxc ddsview.fx /nologo /EVS /Tvs_4_1 /Fhshaders\vs.h 7 | // 8 | // 9 | // 10 | // Input signature: 11 | // 12 | // Name Index Mask Register SysValue Format Used 13 | // -------------------- ----- ------ -------- -------- ------ ------ 14 | // POSITION 0 xyzw 0 NONE float xyzw 15 | // TEXCOORD 0 xyzw 1 NONE float xyzw 16 | // 17 | // 18 | // Output signature: 19 | // 20 | // Name Index Mask Register SysValue Format Used 21 | // -------------------- ----- ------ -------- -------- ------ ------ 22 | // SV_POSITION 0 xyzw 0 POS float xyzw 23 | // TEXCOORD 0 xyzw 1 NONE float xyzw 24 | // 25 | vs_4_1 26 | dcl_globalFlags refactoringAllowed 27 | dcl_input v0.xyzw 28 | dcl_input v1.xyzw 29 | dcl_output_siv o0.xyzw, position 30 | dcl_output o1.xyzw 31 | mov o0.xyzw, v0.xyzw 32 | mov o1.xyzw, v1.xyzw 33 | ret 34 | // Approximately 3 instruction slots used 35 | #endif 36 | 37 | const BYTE g_VS[] = 38 | { 39 | 68, 88, 66, 67, 243, 4, 40 | 207, 4, 72, 185, 125, 253, 41 | 86, 236, 11, 103, 199, 128, 42 | 83, 243, 1, 0, 0, 0, 43 | 40, 2, 0, 0, 5, 0, 44 | 0, 0, 52, 0, 0, 0, 45 | 140, 0, 0, 0, 224, 0, 46 | 0, 0, 56, 1, 0, 0, 47 | 172, 1, 0, 0, 82, 68, 48 | 69, 70, 80, 0, 0, 0, 49 | 0, 0, 0, 0, 0, 0, 50 | 0, 0, 0, 0, 0, 0, 51 | 28, 0, 0, 0, 1, 4, 52 | 254, 255, 0, 1, 0, 0, 53 | 28, 0, 0, 0, 77, 105, 54 | 99, 114, 111, 115, 111, 102, 55 | 116, 32, 40, 82, 41, 32, 56 | 72, 76, 83, 76, 32, 83, 57 | 104, 97, 100, 101, 114, 32, 58 | 67, 111, 109, 112, 105, 108, 59 | 101, 114, 32, 57, 46, 50, 60 | 57, 46, 57, 53, 50, 46, 61 | 51, 49, 49, 49, 0, 171, 62 | 171, 171, 73, 83, 71, 78, 63 | 76, 0, 0, 0, 2, 0, 64 | 0, 0, 8, 0, 0, 0, 65 | 56, 0, 0, 0, 0, 0, 66 | 0, 0, 0, 0, 0, 0, 67 | 3, 0, 0, 0, 0, 0, 68 | 0, 0, 15, 15, 0, 0, 69 | 65, 0, 0, 0, 0, 0, 70 | 0, 0, 0, 0, 0, 0, 71 | 3, 0, 0, 0, 1, 0, 72 | 0, 0, 15, 15, 0, 0, 73 | 80, 79, 83, 73, 84, 73, 74 | 79, 78, 0, 84, 69, 88, 75 | 67, 79, 79, 82, 68, 0, 76 | 171, 171, 79, 83, 71, 78, 77 | 80, 0, 0, 0, 2, 0, 78 | 0, 0, 8, 0, 0, 0, 79 | 56, 0, 0, 0, 0, 0, 80 | 0, 0, 1, 0, 0, 0, 81 | 3, 0, 0, 0, 0, 0, 82 | 0, 0, 15, 0, 0, 0, 83 | 68, 0, 0, 0, 0, 0, 84 | 0, 0, 0, 0, 0, 0, 85 | 3, 0, 0, 0, 1, 0, 86 | 0, 0, 15, 0, 0, 0, 87 | 83, 86, 95, 80, 79, 83, 88 | 73, 84, 73, 79, 78, 0, 89 | 84, 69, 88, 67, 79, 79, 90 | 82, 68, 0, 171, 171, 171, 91 | 83, 72, 68, 82, 108, 0, 92 | 0, 0, 65, 0, 1, 0, 93 | 27, 0, 0, 0, 106, 8, 94 | 0, 1, 95, 0, 0, 3, 95 | 242, 16, 16, 0, 0, 0, 96 | 0, 0, 95, 0, 0, 3, 97 | 242, 16, 16, 0, 1, 0, 98 | 0, 0, 103, 0, 0, 4, 99 | 242, 32, 16, 0, 0, 0, 100 | 0, 0, 1, 0, 0, 0, 101 | 101, 0, 0, 3, 242, 32, 102 | 16, 0, 1, 0, 0, 0, 103 | 54, 0, 0, 5, 242, 32, 104 | 16, 0, 0, 0, 0, 0, 105 | 70, 30, 16, 0, 0, 0, 106 | 0, 0, 54, 0, 0, 5, 107 | 242, 32, 16, 0, 1, 0, 108 | 0, 0, 70, 30, 16, 0, 109 | 1, 0, 0, 0, 62, 0, 110 | 0, 1, 83, 84, 65, 84, 111 | 116, 0, 0, 0, 3, 0, 112 | 0, 0, 0, 0, 0, 0, 113 | 0, 0, 0, 0, 4, 0, 114 | 0, 0, 0, 0, 0, 0, 115 | 0, 0, 0, 0, 0, 0, 116 | 0, 0, 1, 0, 0, 0, 117 | 0, 0, 0, 0, 0, 0, 118 | 0, 0, 0, 0, 0, 0, 119 | 0, 0, 0, 0, 0, 0, 120 | 0, 0, 0, 0, 0, 0, 121 | 0, 0, 0, 0, 0, 0, 122 | 0, 0, 0, 0, 0, 0, 123 | 0, 0, 0, 0, 0, 0, 124 | 0, 0, 2, 0, 0, 0, 125 | 0, 0, 0, 0, 0, 0, 126 | 0, 0, 0, 0, 0, 0, 127 | 0, 0, 0, 0, 0, 0, 128 | 0, 0, 0, 0, 0, 0, 129 | 0, 0, 0, 0, 0, 0, 130 | 0, 0, 0, 0, 0, 0 131 | }; 132 | -------------------------------------------------------------------------------- /WICTextureLoader/WICTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: WICTextureLoader.h 3 | // 4 | // Function for loading a WIC image and creating a Direct3D runtime texture for it 5 | // (auto-generating mipmaps if possible) 6 | // 7 | // Note: Assumes application has already called CoInitializeEx 8 | // 9 | // Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for 10 | // auto-gen mipmap support. 11 | // 12 | // Note these functions are useful for images created as simple 2D textures. For 13 | // more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. 14 | // For a full-featured DDS file reader, writer, and texture processing pipeline see 15 | // the 'Texconv' sample and the 'DirectXTex' library. 16 | // 17 | // Copyright (c) Microsoft Corporation. All rights reserved. 18 | // Licensed under the MIT License. 19 | // 20 | // http://go.microsoft.com/fwlink/?LinkId=248926 21 | // http://go.microsoft.com/fwlink/?LinkId=248929 22 | //-------------------------------------------------------------------------------------- 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | 30 | namespace DirectX 31 | { 32 | enum WIC_LOADER_FLAGS 33 | { 34 | WIC_LOADER_DEFAULT = 0, 35 | WIC_LOADER_FORCE_SRGB = 0x1, 36 | WIC_LOADER_IGNORE_SRGB = 0x2, 37 | }; 38 | 39 | // Standard version 40 | HRESULT CreateWICTextureFromMemory( 41 | _In_ ID3D11Device* d3dDevice, 42 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 43 | _In_ size_t wicDataSize, 44 | _Outptr_opt_ ID3D11Resource** texture, 45 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 46 | _In_ size_t maxsize = 0); 47 | 48 | HRESULT CreateWICTextureFromFile( 49 | _In_ ID3D11Device* d3dDevice, 50 | _In_z_ const wchar_t* szFileName, 51 | _Outptr_opt_ ID3D11Resource** texture, 52 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 53 | _In_ size_t maxsize = 0); 54 | 55 | // Standard version with optional auto-gen mipmap support 56 | HRESULT CreateWICTextureFromMemory( 57 | _In_ ID3D11Device* d3dDevice, 58 | _In_opt_ ID3D11DeviceContext* d3dContext, 59 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 60 | _In_ size_t wicDataSize, 61 | _Outptr_opt_ ID3D11Resource** texture, 62 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 63 | _In_ size_t maxsize = 0); 64 | 65 | HRESULT CreateWICTextureFromFile( 66 | _In_ ID3D11Device* d3dDevice, 67 | _In_opt_ ID3D11DeviceContext* d3dContext, 68 | _In_z_ const wchar_t* szFileName, 69 | _Outptr_opt_ ID3D11Resource** texture, 70 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 71 | _In_ size_t maxsize = 0); 72 | 73 | // Extended version 74 | HRESULT CreateWICTextureFromMemoryEx( 75 | _In_ ID3D11Device* d3dDevice, 76 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 77 | _In_ size_t wicDataSize, 78 | _In_ size_t maxsize, 79 | _In_ D3D11_USAGE usage, 80 | _In_ unsigned int bindFlags, 81 | _In_ unsigned int cpuAccessFlags, 82 | _In_ unsigned int miscFlags, 83 | _In_ unsigned int loadFlags, 84 | _Outptr_opt_ ID3D11Resource** texture, 85 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 86 | 87 | HRESULT CreateWICTextureFromFileEx( 88 | _In_ ID3D11Device* d3dDevice, 89 | _In_z_ const wchar_t* szFileName, 90 | _In_ size_t maxsize, 91 | _In_ D3D11_USAGE usage, 92 | _In_ unsigned int bindFlags, 93 | _In_ unsigned int cpuAccessFlags, 94 | _In_ unsigned int miscFlags, 95 | _In_ unsigned int loadFlags, 96 | _Outptr_opt_ ID3D11Resource** texture, 97 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 98 | 99 | // Extended version with optional auto-gen mipmap support 100 | HRESULT CreateWICTextureFromMemoryEx( 101 | _In_ ID3D11Device* d3dDevice, 102 | _In_opt_ ID3D11DeviceContext* d3dContext, 103 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 104 | _In_ size_t wicDataSize, 105 | _In_ size_t maxsize, 106 | _In_ D3D11_USAGE usage, 107 | _In_ unsigned int bindFlags, 108 | _In_ unsigned int cpuAccessFlags, 109 | _In_ unsigned int miscFlags, 110 | _In_ unsigned int loadFlags, 111 | _Outptr_opt_ ID3D11Resource** texture, 112 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 113 | 114 | HRESULT CreateWICTextureFromFileEx( 115 | _In_ ID3D11Device* d3dDevice, 116 | _In_opt_ ID3D11DeviceContext* d3dContext, 117 | _In_z_ const wchar_t* szFileName, 118 | _In_ size_t maxsize, 119 | _In_ D3D11_USAGE usage, 120 | _In_ unsigned int bindFlags, 121 | _In_ unsigned int cpuAccessFlags, 122 | _In_ unsigned int miscFlags, 123 | _In_ unsigned int loadFlags, 124 | _Outptr_opt_ ID3D11Resource** texture, 125 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 126 | } 127 | -------------------------------------------------------------------------------- /ISPCTextureCompressor/ispc_texcomp.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) 2016, Intel Corporation 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 4 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 5 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 6 | // permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of 8 | // the Software. 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 10 | // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 12 | // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 13 | // SOFTWARE. 14 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 15 | 16 | #include 17 | 18 | struct rgba_surface 19 | { 20 | uint8_t* ptr; 21 | int32_t width; 22 | int32_t height; 23 | int32_t stride; // in bytes 24 | }; 25 | 26 | struct bc7_enc_settings 27 | { 28 | bool mode_selection[4]; 29 | int refineIterations[8]; 30 | 31 | bool skip_mode2; 32 | int fastSkipTreshold_mode1; 33 | int fastSkipTreshold_mode3; 34 | int fastSkipTreshold_mode7; 35 | 36 | int mode45_channel0; 37 | int refineIterations_channel; 38 | 39 | int channels; 40 | }; 41 | 42 | struct bc6h_enc_settings 43 | { 44 | bool slow_mode; 45 | bool fast_mode; 46 | int refineIterations_1p; 47 | int refineIterations_2p; 48 | int fastSkipTreshold; 49 | }; 50 | 51 | struct etc_enc_settings 52 | { 53 | int fastSkipTreshold; 54 | }; 55 | 56 | struct astc_enc_settings 57 | { 58 | int block_width; 59 | int block_height; 60 | int channels; 61 | 62 | int fastSkipTreshold; 63 | int refineIterations; 64 | }; 65 | 66 | // profiles for RGB data (alpha channel will be ignored) 67 | extern "C" void GetProfile_ultrafast(bc7_enc_settings* settings); 68 | extern "C" void GetProfile_veryfast(bc7_enc_settings* settings); 69 | extern "C" void GetProfile_fast(bc7_enc_settings* settings); 70 | extern "C" void GetProfile_basic(bc7_enc_settings* settings); 71 | extern "C" void GetProfile_slow(bc7_enc_settings* settings); 72 | 73 | // profiles for RGBA inputs 74 | extern "C" void GetProfile_alpha_ultrafast(bc7_enc_settings* settings); 75 | extern "C" void GetProfile_alpha_veryfast(bc7_enc_settings* settings); 76 | extern "C" void GetProfile_alpha_fast(bc7_enc_settings* settings); 77 | extern "C" void GetProfile_alpha_basic(bc7_enc_settings* settings); 78 | extern "C" void GetProfile_alpha_slow(bc7_enc_settings* settings); 79 | 80 | // profiles for BC6H (RGB HDR) 81 | extern "C" void GetProfile_bc6h_veryfast(bc6h_enc_settings* settings); 82 | extern "C" void GetProfile_bc6h_fast(bc6h_enc_settings* settings); 83 | extern "C" void GetProfile_bc6h_basic(bc6h_enc_settings* settings); 84 | extern "C" void GetProfile_bc6h_slow(bc6h_enc_settings* settings); 85 | extern "C" void GetProfile_bc6h_veryslow(bc6h_enc_settings* settings); 86 | 87 | // profiles for ETC 88 | extern "C" void GetProfile_etc_slow(etc_enc_settings* settings); 89 | 90 | // profiles for ASTC 91 | extern "C" void GetProfile_astc_fast(astc_enc_settings* settings, int block_width, int block_height); 92 | extern "C" void GetProfile_astc_alpha_fast(astc_enc_settings* settings, int block_width, int block_height); 93 | extern "C" void GetProfile_astc_alpha_slow(astc_enc_settings* settings, int block_width, int block_height); 94 | 95 | // helper function to replicate border pixels for the desired block sizes (bpp = 32 or 64) 96 | extern "C" void ReplicateBorders(rgba_surface* dst_slice, const rgba_surface* src_tex, int x, int y, int bpp); 97 | 98 | /* 99 | Notes: 100 | - input width and height need to be a multiple of block size 101 | - LDR input is 32 bit/pixel (sRGB), HDR is 64 bit/pixel (half float) 102 | - dst buffer must be allocated with enough space for the compressed texture: 103 | 4 bytes/block for BC1/ETC1, 8 bytes/block for BC3/BC6H/BC7/ASTC 104 | the blocks are stored in raster scan order (natural CPU texture layout) 105 | - you can use GetProfile_* functions to select various speed/quality tradeoffs. 106 | - the RGB profiles are slightly faster as they ignore the alpha channel 107 | */ 108 | 109 | extern "C" void CompressBlocksBC1(const rgba_surface* src, uint8_t* dst); 110 | extern "C" void CompressBlocksBC3(const rgba_surface* src, uint8_t* dst); 111 | extern "C" void CompressBlocksBC6H(const rgba_surface* src, uint8_t* dst, bc6h_enc_settings* settings); 112 | extern "C" void CompressBlocksBC7(const rgba_surface* src, uint8_t* dst, bc7_enc_settings* settings); 113 | extern "C" void CompressBlocksETC1(const rgba_surface* src, uint8_t* dst, etc_enc_settings* settings); 114 | extern "C" void CompressBlocksASTC(const rgba_surface* src, uint8_t* dst, astc_enc_settings* settings); 115 | -------------------------------------------------------------------------------- /DDSTextureLoader/DDSTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DDSTextureLoader.h 3 | // 4 | // Functions for loading a DDS texture and creating a Direct3D runtime resource for it 5 | // 6 | // Note these functions are useful as a light-weight runtime loader for DDS files. For 7 | // a full-featured DDS file reader, writer, and texture processing pipeline see 8 | // the 'Texconv' sample and the 'DirectXTex' library. 9 | // 10 | // Copyright (c) Microsoft Corporation. All rights reserved. 11 | // Licensed under the MIT License. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=248926 14 | // http://go.microsoft.com/fwlink/?LinkId=248929 15 | //-------------------------------------------------------------------------------------- 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | 23 | namespace DirectX 24 | { 25 | enum DDS_ALPHA_MODE 26 | { 27 | DDS_ALPHA_MODE_UNKNOWN = 0, 28 | DDS_ALPHA_MODE_STRAIGHT = 1, 29 | DDS_ALPHA_MODE_PREMULTIPLIED = 2, 30 | DDS_ALPHA_MODE_OPAQUE = 3, 31 | DDS_ALPHA_MODE_CUSTOM = 4, 32 | }; 33 | 34 | // Standard version 35 | HRESULT CreateDDSTextureFromMemory( 36 | _In_ ID3D11Device* d3dDevice, 37 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 38 | _In_ size_t ddsDataSize, 39 | _Outptr_opt_ ID3D11Resource** texture, 40 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 41 | _In_ size_t maxsize = 0, 42 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 43 | 44 | HRESULT CreateDDSTextureFromFile( 45 | _In_ ID3D11Device* d3dDevice, 46 | _In_z_ const wchar_t* szFileName, 47 | _Outptr_opt_ ID3D11Resource** texture, 48 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 49 | _In_ size_t maxsize = 0, 50 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 51 | 52 | // Standard version with optional auto-gen mipmap support 53 | HRESULT CreateDDSTextureFromMemory( 54 | _In_ ID3D11Device* d3dDevice, 55 | _In_opt_ ID3D11DeviceContext* d3dContext, 56 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 57 | _In_ size_t ddsDataSize, 58 | _Outptr_opt_ ID3D11Resource** texture, 59 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 60 | _In_ size_t maxsize = 0, 61 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 62 | 63 | HRESULT CreateDDSTextureFromFile( 64 | _In_ ID3D11Device* d3dDevice, 65 | _In_opt_ ID3D11DeviceContext* d3dContext, 66 | _In_z_ const wchar_t* szFileName, 67 | _Outptr_opt_ ID3D11Resource** texture, 68 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 69 | _In_ size_t maxsize = 0, 70 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 71 | 72 | // Extended version 73 | HRESULT CreateDDSTextureFromMemoryEx( 74 | _In_ ID3D11Device* d3dDevice, 75 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 76 | _In_ size_t ddsDataSize, 77 | _In_ size_t maxsize, 78 | _In_ D3D11_USAGE usage, 79 | _In_ unsigned int bindFlags, 80 | _In_ unsigned int cpuAccessFlags, 81 | _In_ unsigned int miscFlags, 82 | _In_ bool forceSRGB, 83 | _Outptr_opt_ ID3D11Resource** texture, 84 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 85 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 86 | 87 | HRESULT CreateDDSTextureFromFileEx( 88 | _In_ ID3D11Device* d3dDevice, 89 | _In_z_ const wchar_t* szFileName, 90 | _In_ size_t maxsize, 91 | _In_ D3D11_USAGE usage, 92 | _In_ unsigned int bindFlags, 93 | _In_ unsigned int cpuAccessFlags, 94 | _In_ unsigned int miscFlags, 95 | _In_ bool forceSRGB, 96 | _Outptr_opt_ ID3D11Resource** texture, 97 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 98 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 99 | 100 | // Extended version with optional auto-gen mipmap support 101 | HRESULT CreateDDSTextureFromMemoryEx( 102 | _In_ ID3D11Device* d3dDevice, 103 | _In_opt_ ID3D11DeviceContext* d3dContext, 104 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 105 | _In_ size_t ddsDataSize, 106 | _In_ size_t maxsize, 107 | _In_ D3D11_USAGE usage, 108 | _In_ unsigned int bindFlags, 109 | _In_ unsigned int cpuAccessFlags, 110 | _In_ unsigned int miscFlags, 111 | _In_ bool forceSRGB, 112 | _Outptr_opt_ ID3D11Resource** texture, 113 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 114 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 115 | 116 | HRESULT CreateDDSTextureFromFileEx( 117 | _In_ ID3D11Device* d3dDevice, 118 | _In_opt_ ID3D11DeviceContext* d3dContext, 119 | _In_z_ const wchar_t* szFileName, 120 | _In_ size_t maxsize, 121 | _In_ D3D11_USAGE usage, 122 | _In_ unsigned int bindFlags, 123 | _In_ unsigned int cpuAccessFlags, 124 | _In_ unsigned int miscFlags, 125 | _In_ bool forceSRGB, 126 | _Outptr_opt_ ID3D11Resource** texture, 127 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 128 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 129 | } 130 | -------------------------------------------------------------------------------- /DDSView/shaders/ps2D.h: -------------------------------------------------------------------------------- 1 | #if 0 2 | // 3 | // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 4 | // 5 | // 6 | // fxc ddsview.fx /nologo /EPS_2D /Tps_4_1 /Fhshaders\ps2D.h 7 | // 8 | // 9 | // Resource Bindings: 10 | // 11 | // Name Type Format Dim Slot Elements 12 | // ------------------------------ ---------- ------- ----------- ---- -------- 13 | // samLinear sampler NA NA 0 1 14 | // tx2D texture float4 2d 0 1 15 | // 16 | // 17 | // 18 | // Input signature: 19 | // 20 | // Name Index Mask Register SysValue Format Used 21 | // -------------------- ----- ------ -------- -------- ------ ------ 22 | // SV_POSITION 0 xyzw 0 POS float 23 | // TEXCOORD 0 xyzw 1 NONE float xy 24 | // 25 | // 26 | // Output signature: 27 | // 28 | // Name Index Mask Register SysValue Format Used 29 | // -------------------- ----- ------ -------- -------- ------ ------ 30 | // SV_Target 0 xyzw 0 TARGET float xyzw 31 | // 32 | ps_4_1 33 | dcl_globalFlags refactoringAllowed 34 | dcl_sampler s0, mode_default 35 | dcl_resource_texture2d (float,float,float,float) t0 36 | dcl_input_ps linear v1.xy 37 | dcl_output o0.xyzw 38 | sample o0.xyzw, v1.xyxx, t0.xyzw, s0 39 | ret 40 | // Approximately 2 instruction slots used 41 | #endif 42 | 43 | const BYTE g_PS_2D[] = 44 | { 45 | 68, 88, 66, 67, 45, 73, 46 | 251, 77, 247, 44, 253, 34, 47 | 100, 41, 211, 74, 100, 236, 48 | 72, 69, 1, 0, 0, 0, 49 | 80, 2, 0, 0, 5, 0, 50 | 0, 0, 52, 0, 0, 0, 51 | 216, 0, 0, 0, 48, 1, 52 | 0, 0, 100, 1, 0, 0, 53 | 212, 1, 0, 0, 82, 68, 54 | 69, 70, 156, 0, 0, 0, 55 | 0, 0, 0, 0, 0, 0, 56 | 0, 0, 2, 0, 0, 0, 57 | 28, 0, 0, 0, 1, 4, 58 | 255, 255, 0, 1, 0, 0, 59 | 107, 0, 0, 0, 92, 0, 60 | 0, 0, 3, 0, 0, 0, 61 | 0, 0, 0, 0, 0, 0, 62 | 0, 0, 0, 0, 0, 0, 63 | 0, 0, 0, 0, 1, 0, 64 | 0, 0, 1, 0, 0, 0, 65 | 102, 0, 0, 0, 2, 0, 66 | 0, 0, 5, 0, 0, 0, 67 | 4, 0, 0, 0, 255, 255, 68 | 255, 255, 0, 0, 0, 0, 69 | 1, 0, 0, 0, 13, 0, 70 | 0, 0, 115, 97, 109, 76, 71 | 105, 110, 101, 97, 114, 0, 72 | 116, 120, 50, 68, 0, 77, 73 | 105, 99, 114, 111, 115, 111, 74 | 102, 116, 32, 40, 82, 41, 75 | 32, 72, 76, 83, 76, 32, 76 | 83, 104, 97, 100, 101, 114, 77 | 32, 67, 111, 109, 112, 105, 78 | 108, 101, 114, 32, 57, 46, 79 | 50, 57, 46, 57, 53, 50, 80 | 46, 51, 49, 49, 49, 0, 81 | 73, 83, 71, 78, 80, 0, 82 | 0, 0, 2, 0, 0, 0, 83 | 8, 0, 0, 0, 56, 0, 84 | 0, 0, 0, 0, 0, 0, 85 | 1, 0, 0, 0, 3, 0, 86 | 0, 0, 0, 0, 0, 0, 87 | 15, 0, 0, 0, 68, 0, 88 | 0, 0, 0, 0, 0, 0, 89 | 0, 0, 0, 0, 3, 0, 90 | 0, 0, 1, 0, 0, 0, 91 | 15, 3, 0, 0, 83, 86, 92 | 95, 80, 79, 83, 73, 84, 93 | 73, 79, 78, 0, 84, 69, 94 | 88, 67, 79, 79, 82, 68, 95 | 0, 171, 171, 171, 79, 83, 96 | 71, 78, 44, 0, 0, 0, 97 | 1, 0, 0, 0, 8, 0, 98 | 0, 0, 32, 0, 0, 0, 99 | 0, 0, 0, 0, 0, 0, 100 | 0, 0, 3, 0, 0, 0, 101 | 0, 0, 0, 0, 15, 0, 102 | 0, 0, 83, 86, 95, 84, 103 | 97, 114, 103, 101, 116, 0, 104 | 171, 171, 83, 72, 68, 82, 105 | 104, 0, 0, 0, 65, 0, 106 | 0, 0, 26, 0, 0, 0, 107 | 106, 8, 0, 1, 90, 0, 108 | 0, 3, 0, 96, 16, 0, 109 | 0, 0, 0, 0, 88, 24, 110 | 0, 4, 0, 112, 16, 0, 111 | 0, 0, 0, 0, 85, 85, 112 | 0, 0, 98, 16, 0, 3, 113 | 50, 16, 16, 0, 1, 0, 114 | 0, 0, 101, 0, 0, 3, 115 | 242, 32, 16, 0, 0, 0, 116 | 0, 0, 69, 0, 0, 9, 117 | 242, 32, 16, 0, 0, 0, 118 | 0, 0, 70, 16, 16, 0, 119 | 1, 0, 0, 0, 70, 126, 120 | 16, 0, 0, 0, 0, 0, 121 | 0, 96, 16, 0, 0, 0, 122 | 0, 0, 62, 0, 0, 1, 123 | 83, 84, 65, 84, 116, 0, 124 | 0, 0, 2, 0, 0, 0, 125 | 0, 0, 0, 0, 0, 0, 126 | 0, 0, 2, 0, 0, 0, 127 | 0, 0, 0, 0, 0, 0, 128 | 0, 0, 0, 0, 0, 0, 129 | 1, 0, 0, 0, 0, 0, 130 | 0, 0, 0, 0, 0, 0, 131 | 0, 0, 0, 0, 0, 0, 132 | 0, 0, 0, 0, 0, 0, 133 | 0, 0, 0, 0, 1, 0, 134 | 0, 0, 0, 0, 0, 0, 135 | 0, 0, 0, 0, 0, 0, 136 | 0, 0, 0, 0, 0, 0, 137 | 0, 0, 0, 0, 0, 0, 138 | 0, 0, 0, 0, 0, 0, 139 | 0, 0, 0, 0, 0, 0, 140 | 0, 0, 0, 0, 0, 0, 141 | 0, 0, 0, 0, 0, 0, 142 | 0, 0, 0, 0, 0, 0, 143 | 0, 0, 0, 0 144 | }; 145 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/CompressionFormat.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef _BASE_INCLUDE_COMPRESSIONFORMAT_H_ 19 | #define _BASE_INCLUDE_COMPRESSIONFORMAT_H_ 20 | 21 | #include "FasTC/TexCompTypes.h" 22 | 23 | namespace FasTC { 24 | 25 | // The different supported compression formats 26 | enum ECompressionFormat { 27 | eCompressionFormat_DXT1, 28 | eCompressionFormat_DXT5, 29 | eCompressionFormat_ETC1, 30 | eCompressionFormat_BPTC, 31 | 32 | eCompressionFormat_PVRTC2, 33 | eCompressionFormat_PVRTC4, 34 | COMPRESSION_FORMAT_PVRTC_BEGIN = eCompressionFormat_PVRTC2, 35 | COMPRESSION_FORMAT_PVRTC_END = eCompressionFormat_PVRTC4, 36 | 37 | eCompressionFormat_ASTC4x4, 38 | eCompressionFormat_ASTC5x4, 39 | eCompressionFormat_ASTC5x5, 40 | eCompressionFormat_ASTC6x5, 41 | eCompressionFormat_ASTC6x6, 42 | eCompressionFormat_ASTC8x5, 43 | eCompressionFormat_ASTC8x6, 44 | eCompressionFormat_ASTC8x8, 45 | eCompressionFormat_ASTC10x5, 46 | eCompressionFormat_ASTC10x6, 47 | eCompressionFormat_ASTC10x8, 48 | eCompressionFormat_ASTC10x10, 49 | eCompressionFormat_ASTC12x10, 50 | eCompressionFormat_ASTC12x12, 51 | COMPRESSION_FORMAT_ASTC_BEGIN = eCompressionFormat_ASTC4x4, 52 | COMPRESSION_FORMAT_ASTC_END = eCompressionFormat_ASTC12x12, 53 | 54 | kNumCompressionFormats 55 | }; 56 | 57 | // Returns the dimensions of the blocks for the given format. 58 | inline static void GetBlockDimensions(ECompressionFormat fmt, uint32 (&outSz)[2]) { 59 | switch(fmt) { 60 | default: 61 | case eCompressionFormat_DXT1: 62 | case eCompressionFormat_DXT5: 63 | case eCompressionFormat_BPTC: 64 | case eCompressionFormat_PVRTC4: 65 | case eCompressionFormat_ETC1: 66 | case eCompressionFormat_ASTC4x4: 67 | outSz[0] = 4; 68 | outSz[1] = 4; 69 | break; 70 | 71 | case eCompressionFormat_PVRTC2: 72 | outSz[0] = 8; 73 | outSz[1] = 4; 74 | break; 75 | 76 | case eCompressionFormat_ASTC5x4: 77 | outSz[0] = 5; 78 | outSz[1] = 4; 79 | break; 80 | 81 | case eCompressionFormat_ASTC5x5: 82 | outSz[0] = 5; 83 | outSz[1] = 5; 84 | break; 85 | 86 | case eCompressionFormat_ASTC6x5: 87 | outSz[0] = 6; 88 | outSz[1] = 5; 89 | break; 90 | 91 | case eCompressionFormat_ASTC6x6: 92 | outSz[0] = 6; 93 | outSz[1] = 6; 94 | break; 95 | 96 | case eCompressionFormat_ASTC8x5: 97 | outSz[0] = 8; 98 | outSz[1] = 5; 99 | break; 100 | 101 | case eCompressionFormat_ASTC8x6: 102 | outSz[0] = 8; 103 | outSz[1] = 6; 104 | break; 105 | 106 | case eCompressionFormat_ASTC8x8: 107 | outSz[0] = 8; 108 | outSz[1] = 8; 109 | break; 110 | 111 | case eCompressionFormat_ASTC10x5: 112 | outSz[0] = 10; 113 | outSz[1] = 5; 114 | break; 115 | 116 | case eCompressionFormat_ASTC10x6: 117 | outSz[0] = 10; 118 | outSz[1] = 6; 119 | break; 120 | 121 | case eCompressionFormat_ASTC10x8: 122 | outSz[0] = 10; 123 | outSz[1] = 8; 124 | break; 125 | 126 | case eCompressionFormat_ASTC10x10: 127 | outSz[0] = 10; 128 | outSz[1] = 10; 129 | break; 130 | 131 | case eCompressionFormat_ASTC12x10: 132 | outSz[0] = 12; 133 | outSz[1] = 10; 134 | break; 135 | 136 | case eCompressionFormat_ASTC12x12: 137 | outSz[0] = 12; 138 | outSz[1] = 12; 139 | break; 140 | } 141 | } 142 | 143 | // Returns the size of the compressed block in bytes for the given format. 144 | inline static uint32 GetBlockSize(ECompressionFormat fmt) { 145 | switch(fmt) { 146 | default: 147 | case eCompressionFormat_DXT1: 148 | case eCompressionFormat_PVRTC4: 149 | case eCompressionFormat_PVRTC2: 150 | case eCompressionFormat_ETC1: 151 | return 8; 152 | 153 | case eCompressionFormat_DXT5: 154 | 155 | case eCompressionFormat_BPTC: 156 | 157 | case eCompressionFormat_ASTC4x4: 158 | case eCompressionFormat_ASTC5x4: 159 | case eCompressionFormat_ASTC5x5: 160 | case eCompressionFormat_ASTC6x5: 161 | case eCompressionFormat_ASTC6x6: 162 | case eCompressionFormat_ASTC8x5: 163 | case eCompressionFormat_ASTC8x6: 164 | case eCompressionFormat_ASTC8x8: 165 | case eCompressionFormat_ASTC10x5: 166 | case eCompressionFormat_ASTC10x6: 167 | case eCompressionFormat_ASTC10x8: 168 | case eCompressionFormat_ASTC10x10: 169 | case eCompressionFormat_ASTC12x10: 170 | case eCompressionFormat_ASTC12x12: 171 | return 16; 172 | } 173 | } 174 | } // namespace FasTC 175 | 176 | #endif // _BASE_INCLUDE_COMPRESSIONFORMAT_H_ 177 | -------------------------------------------------------------------------------- /FasTCTest/CompressNVTT.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #include "FasTC/BPTCCompressor.h" 19 | 20 | #include "CompressionMode.h" 21 | #undef DBL_MAX 22 | #include "FasTC/BitStream.h" 23 | #include "FasTC/TexCompTypes.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "avpcl.h" 30 | 31 | namespace BPTCC { 32 | 33 | void GetBlock(uint32 x, uint32 y, uint32 width, const uint32 *pixels, Tile &t) { 34 | for(uint32 j = 0; j < 4; j++) 35 | for(uint32 i = 0; i < 4; i++) { 36 | uint32 pixel = pixels[(y+j)*width + (x+i)]; 37 | t.data[j][i].X() = pixel & 0xFF; 38 | t.data[j][i].Y() = (pixel >> 8) & 0xFF; 39 | t.data[j][i].Z() = (pixel >> 16) & 0xFF; 40 | t.data[j][i].W() = (pixel >> 24) & 0xFF; 41 | } 42 | } 43 | 44 | class BlockLogger { 45 | public: 46 | BlockLogger(uint64 blockIdx, std::ostream &os) 47 | : m_BlockIdx(blockIdx), m_Stream(os) { } 48 | 49 | template 50 | friend std::ostream &operator<<(const BlockLogger &bl, const T &v); 51 | 52 | uint64 m_BlockIdx; 53 | std::ostream &m_Stream; 54 | }; 55 | 56 | template 57 | std::ostream &operator<<(const BlockLogger &bl, const T &v) { 58 | std::stringstream ss; 59 | ss << bl.m_BlockIdx << ": " << v; 60 | return bl.m_Stream << ss.str(); 61 | } 62 | 63 | template 64 | static void PrintStat(const BlockLogger &lgr, const char *stat, const T &v) { 65 | std::stringstream ss; 66 | ss << stat << " -- " << v << std::endl; 67 | lgr << ss.str(); 68 | } 69 | 70 | // Compress an image using BC7 compression. Use the inBuf parameter to point 71 | // to an image in 4-byte RGBA format. The width and height parameters specify 72 | // the size of the image in pixels. The buffer pointed to by outBuf should be 73 | // large enough to store the compressed image. This implementation has an 4:1 74 | // compression ratio. 75 | void CompressNVTT(const FasTC::CompressionJob &cj) { 76 | const uint32 *inPixels = reinterpret_cast(cj.InBuf()); 77 | const uint32 kBlockSz = GetBlockSize(FasTC::eCompressionFormat_BPTC); 78 | uint8 *outBuf = cj.OutBuf() + cj.CoordsToBlockIdx(cj.XStart(), cj.YStart()) * kBlockSz; 79 | 80 | uint32 startX = cj.XStart(); 81 | const uint32 endY = std::min(cj.YEnd(), cj.Height() - 4); 82 | for(uint32 j = cj.YStart(); j <= endY; j += 4) { 83 | const uint32 endX = j == cj.YEnd()? cj.XEnd() : cj.Width(); 84 | for(uint32 i = startX; i < endX; i += 4) { 85 | 86 | Tile block(4, 4); 87 | GetBlock(i, j, cj.Width(), inPixels, block); 88 | AVPCL::compress(block, reinterpret_cast(outBuf), NULL); 89 | 90 | outBuf += kBlockSz; 91 | } 92 | startX = 0; 93 | } 94 | } 95 | 96 | typedef double (*ModeCompressFunc)(const Tile &, char* out); 97 | static ModeCompressFunc kModeFuncs[8] = { 98 | AVPCL::compress_mode0, 99 | AVPCL::compress_mode1, 100 | AVPCL::compress_mode2, 101 | AVPCL::compress_mode3, 102 | AVPCL::compress_mode4, 103 | AVPCL::compress_mode5, 104 | AVPCL::compress_mode6, 105 | AVPCL::compress_mode7 106 | }; 107 | 108 | double CompressMode(uint32 mode, const Tile &t, char *out, BlockLogger &log) { 109 | std::stringstream ss; 110 | ss << "Mode_" << mode << "_error"; 111 | double mse = kModeFuncs[mode](t, out); 112 | PrintStat(log, ss.str().c_str(), mse); 113 | 114 | FasTC::BitStreamReadOnly strm(reinterpret_cast(out)); 115 | while(!strm.ReadBit()); 116 | 117 | const CompressionMode::Attributes *attrs = 118 | CompressionMode::GetAttributesForMode(mode); 119 | const uint32 nSubsets = attrs->numSubsets; 120 | 121 | ss.str(""); 122 | ss << "Mode_" << mode << "_shape"; 123 | 124 | uint32 shapeIdx = 0; 125 | if ( nSubsets > 1 ) { 126 | shapeIdx = strm.ReadBits(mode == 0? 4 : 6); 127 | PrintStat(log, ss.str().c_str(), shapeIdx); 128 | } else { 129 | PrintStat(log, ss.str().c_str(), -1); 130 | } 131 | 132 | return mse; 133 | } 134 | 135 | void CompressNVTTWithStats(const FasTC::CompressionJob &cj, std::ostream *logStream) { 136 | const uint32 *inPixels = reinterpret_cast(cj.InBuf()); 137 | const uint32 kBlockSz = GetBlockSize(FasTC::eCompressionFormat_BPTC); 138 | uint8 *outBuf = cj.OutBuf() + cj.CoordsToBlockIdx(cj.XStart(), cj.YStart()) * kBlockSz; 139 | 140 | uint32 startX = cj.XStart(); 141 | const uint32 endY = std::min(cj.YEnd(), cj.Height() - 4); 142 | for(uint32 j = cj.YStart(); j <= endY; j += 4) { 143 | const uint32 endX = j == cj.YEnd()? cj.XEnd() : cj.Width(); 144 | for(uint32 i = startX; i < endX; i += 4) { 145 | 146 | Tile block(4, 4); 147 | GetBlock(i, j, cj.Width(), inPixels, block); 148 | 149 | if(logStream) { 150 | BlockLogger logger(cj.CoordsToBlockIdx(i, j), *logStream); 151 | 152 | char tempblock[16]; 153 | double msebest = 1e30; 154 | for(uint32 mode = 0; mode < 8; mode++) { 155 | double mse_mode = CompressMode(mode, block, tempblock, logger); 156 | if(mse_mode < msebest) { 157 | msebest = mse_mode; 158 | memcpy(outBuf, tempblock, AVPCL::BLOCKSIZE); 159 | } 160 | } 161 | } else { 162 | AVPCL::compress(block, reinterpret_cast(outBuf), NULL); 163 | } 164 | 165 | outBuf += 16; 166 | } 167 | 168 | startX = 0; 169 | } 170 | } 171 | 172 | } // namespace BC7C 173 | -------------------------------------------------------------------------------- /FasTCTest/FasTC/Pixel.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The University of North Carolina at Chapel Hill 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 | // Please send all BUG REPORTS to . 16 | // 17 | 18 | #ifndef BASE_INCLUDE_PIXEL_H_ 19 | #define BASE_INCLUDE_PIXEL_H_ 20 | 21 | #include "TexCompTypes.h" 22 | #include "Vector4.h" 23 | 24 | namespace FasTC { 25 | 26 | class Pixel : public Vector4 { 27 | protected: 28 | typedef int16 ChannelType; 29 | typedef Vector4 VectorType; 30 | uint8 m_BitDepth[4]; 31 | 32 | public: 33 | Pixel() : VectorType(0, 0, 0, 0) { 34 | for(int i = 0; i < 4; i++) 35 | m_BitDepth[i] = 8; 36 | } 37 | 38 | Pixel(ChannelType a, ChannelType r, ChannelType g, ChannelType b, unsigned bitDepth = 8) 39 | : VectorType(a, r, g, b) 40 | { 41 | for(int i = 0; i < 4; i++) 42 | m_BitDepth[i] = bitDepth; 43 | } 44 | 45 | explicit Pixel(uint32 rgba) : VectorType() { 46 | for(int i = 0; i < 4; i++) 47 | m_BitDepth[i] = 8; 48 | Unpack(rgba); 49 | } 50 | 51 | Pixel(const uint8 *bits, 52 | const uint8 channelDepth[4] = static_cast(0), 53 | uint8 bitOffset = 0) : VectorType() { 54 | FromBits(bits, channelDepth, bitOffset); 55 | } 56 | 57 | // Reads a pixel from memory given the bit depth. If NULL then 58 | // it is assumed to be 8 bit RGBA. The bit offset is the offset 59 | // from the least significant bit from which we start reading 60 | // the pixel values. 61 | void FromBits(const uint8 *bits, 62 | const uint8 channelDepth[4] = static_cast(0), 63 | uint8 bitOffset = 0); 64 | 65 | // This function is the converse of FromBits. It will pack a pixel 66 | // into a specified buffer based on the bit depth of the pixel. The 67 | // bitOffset determines at which bit to start from. The bits are written 68 | // starting from the LSB of bits[0]. numBytes is a sanity check and isn't 69 | // used in release mode. 70 | void ToBits(uint8 *bits, uint32 numBytes, uint32 bitOffset = 0) const; 71 | 72 | // Changes the depth of each pixel. This scales the values to 73 | // the appropriate bit depth by either truncating the least 74 | // significant bits when going from larger to smaller bit depth 75 | // or by repeating the most significant bits when going from 76 | // smaller to larger bit depths. 77 | void ChangeBitDepth(const uint8 (&newDepth)[4]); 78 | 79 | template 80 | static float ConvertChannelToFloat(IntType channel, uint8 bitDepth) { 81 | float denominator = static_cast((1 << bitDepth) - 1); 82 | return static_cast(channel) / denominator; 83 | } 84 | 85 | // Returns the intensity of the pixel. Computed using the following 86 | // formula: 87 | // a*r*0.21f + a*g*0.71f + a*b*0.07f; 88 | float ToIntensity() const; 89 | 90 | // Changes the bit depth of a single component. See the comment 91 | // above for how we do this. 92 | static ChannelType ChangeBitDepth(ChannelType val, uint8 oldDepth, uint8 newDepth); 93 | 94 | const ChannelType &A() const { return X(); } 95 | ChannelType &A() { return X(); } 96 | const ChannelType &R() const { return Y(); } 97 | ChannelType &R() { return Y(); } 98 | const ChannelType &G() const { return Z(); } 99 | ChannelType &G() { return Z(); } 100 | const ChannelType &B() const { return W(); } 101 | ChannelType &B() { return W(); } 102 | const ChannelType &Component(uint32 idx) const { return vec[idx]; } 103 | ChannelType &Component(uint32 idx) { return vec[idx]; } 104 | 105 | void GetBitDepth(uint8 (&outDepth)[4]) const { 106 | for(int i = 0; i < 4; i++) { 107 | outDepth[i] = m_BitDepth[i]; 108 | } 109 | } 110 | 111 | // Take all of the components, transform them to their 8-bit variants, 112 | // and then pack each channel into an R8G8B8A8 32-bit integer. We assume 113 | // that the architecture is little-endian, so the alpha channel will end 114 | // up in the most-significant byte. 115 | uint32 Pack() const; 116 | void Unpack(uint32 rgba); 117 | 118 | // Shuffles the pixel values around so that they change their ordering based 119 | // on the passed mask. The values are chosen such that each two bits from the 120 | // least significant bit define a value from 0-3. From LSB to MSB, the values 121 | // are labelled a, b, c, d. From these labels, we store: 122 | // m_Pixels[0] = m_Pixels[a] 123 | // m_Pixels[1] = m_Pixels[b] 124 | // m_Pixels[2] = m_Pixels[c] 125 | // m_Pixels[3] = m_Pixels[d] 126 | // hence, 0xE4 (11 10 01 00) represents a no-op. 127 | void Shuffle(uint8 shuffleMask = 0xE4); 128 | 129 | // Tests for equality by comparing the values and the bit depths. 130 | bool operator==(const Pixel &) const; 131 | 132 | // Clamps the pixel to the range [0,255] 133 | void ClampByte() { 134 | for(uint32 i = 0; i < 4; i++) { 135 | vec[i] = (vec[i] < 0)? 0 : ((vec[i] > 255)? 255 : vec[i]); 136 | } 137 | } 138 | 139 | void MakeOpaque() { A() = 255; } 140 | }; 141 | REGISTER_VECTOR_TYPE(Pixel); 142 | 143 | class YCoCgPixel : public Pixel { 144 | private: 145 | void ToYCoCg(); 146 | 147 | public: 148 | YCoCgPixel() : Pixel() { } 149 | explicit YCoCgPixel(uint32 rgba) : Pixel(rgba) { ToYCoCg(); } 150 | explicit YCoCgPixel(const Pixel &p) : Pixel(p) { ToYCoCg(); } 151 | 152 | Pixel ToRGBA() const; 153 | 154 | float ToIntensity() const { return ConvertChannelToFloat(R(), 8); } 155 | uint32 Pack() const { return ToRGBA().Pack(); } 156 | void Unpack(uint32 rgba) { Pixel::Unpack(rgba); ToYCoCg(); } 157 | 158 | const ChannelType &Co() const { return Z(); } 159 | ChannelType &Co() { return Z(); } 160 | const ChannelType &Cg() const { return W(); } 161 | ChannelType &Cg() { return W(); } 162 | }; 163 | REGISTER_VECTOR_TYPE(YCoCgPixel); 164 | 165 | } // namespace FasTC 166 | 167 | #endif // BASE_INCLUDE_PIXEL_H_ 168 | -------------------------------------------------------------------------------- /ConvectionCPUTest/ConvectionCPUTest.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {ADC2361F-E037-460F-A4C7-B6F877DACC02} 24 | ConvectionCPUTest 25 | 10.0.16299.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v141 32 | MultiByte 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v141 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | MaxSpeed 77 | true 78 | true 79 | true 80 | true 81 | 82 | 83 | true 84 | true 85 | 86 | 87 | 88 | 89 | Level3 90 | Disabled 91 | true 92 | true 93 | 94 | 95 | 96 | 97 | Level3 98 | Disabled 99 | true 100 | true 101 | 102 | 103 | 104 | 105 | Level3 106 | MaxSpeed 107 | true 108 | true 109 | true 110 | true 111 | 112 | 113 | true 114 | true 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | {371b9fa9-4c90-4ac6-a123-aced756d6c77} 124 | 125 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /DirectXTex/DirectXTex_Desktop_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {68652706-b700-4472-9af7-a56a482bd896} 6 | 7 | 8 | {9b7fcbc5-2533-4b88-b75b-d4803e55fa7c} 9 | 10 | 11 | {eb989628-e889-44bf-837a-05c9f09b258e} 12 | 13 | 14 | {a674c059-ed12-4d51-b5b3-44c34ce565da} 15 | 16 | 17 | {c0d1c51b-c157-45b8-9169-af3cc2c4f4b6} 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | Source Files 79 | 80 | 81 | Source Files 82 | 83 | 84 | Source Files 85 | 86 | 87 | Source Files 88 | 89 | 90 | Source Files 91 | 92 | 93 | Source Files 94 | 95 | 96 | Source Files 97 | 98 | 99 | Source Files 100 | 101 | 102 | Source Files 103 | 104 | 105 | Source Files 106 | 107 | 108 | 109 | 110 | Source Files 111 | 112 | 113 | 114 | 115 | Source Files\Shaders 116 | 117 | 118 | Source Files\Shaders 119 | 120 | 121 | Source Files\Shaders 122 | 123 | 124 | Source Files\Shaders\Compiled 125 | 126 | 127 | Source Files\Shaders\Compiled 128 | 129 | 130 | Source Files\Shaders\Compiled 131 | 132 | 133 | Source Files\Shaders\Compiled 134 | 135 | 136 | Source Files\Shaders\Compiled 137 | 138 | 139 | Source Files\Shaders\Compiled 140 | 141 | 142 | Source Files\Shaders\Compiled 143 | 144 | 145 | Source Files\Shaders\Symbols 146 | 147 | 148 | Source Files\Shaders\Symbols 149 | 150 | 151 | Source Files\Shaders\Symbols 152 | 153 | 154 | Source Files\Shaders\Symbols 155 | 156 | 157 | Source Files\Shaders\Symbols 158 | 159 | 160 | Source Files\Shaders\Symbols 161 | 162 | 163 | Source Files\Shaders\Symbols 164 | 165 | 166 | -------------------------------------------------------------------------------- /DDSView/shaders/ps1D.h: -------------------------------------------------------------------------------- 1 | #if 0 2 | // 3 | // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 4 | // 5 | // 6 | // fxc ddsview.fx /nologo /EPS_1D /Tps_4_1 /Fhshaders\ps1D.h 7 | // 8 | // 9 | // Buffer Definitions: 10 | // 11 | // cbuffer cbArrayControl 12 | // { 13 | // 14 | // float Index; // Offset: 0 Size: 4 [unused] 15 | // 16 | // } 17 | // 18 | // 19 | // Resource Bindings: 20 | // 21 | // Name Type Format Dim Slot Elements 22 | // ------------------------------ ---------- ------- ----------- ---- -------- 23 | // samLinear sampler NA NA 0 1 24 | // tx1D texture float4 1d 0 1 25 | // cbArrayControl cbuffer NA NA 0 1 26 | // 27 | // 28 | // 29 | // Input signature: 30 | // 31 | // Name Index Mask Register SysValue Format Used 32 | // -------------------- ----- ------ -------- -------- ------ ------ 33 | // SV_POSITION 0 xyzw 0 POS float 34 | // TEXCOORD 0 xyzw 1 NONE float x 35 | // 36 | // 37 | // Output signature: 38 | // 39 | // Name Index Mask Register SysValue Format Used 40 | // -------------------- ----- ------ -------- -------- ------ ------ 41 | // SV_Target 0 xyzw 0 TARGET float xyzw 42 | // 43 | ps_4_1 44 | dcl_globalFlags refactoringAllowed 45 | dcl_constantbuffer cb0[1], immediateIndexed 46 | dcl_sampler s0, mode_default 47 | dcl_resource_texture1d (float,float,float,float) t0 48 | dcl_input_ps linear v1.x 49 | dcl_output o0.xyzw 50 | sample o0.xyzw, v1.xxxx, t0.xyzw, s0 51 | ret 52 | // Approximately 2 instruction slots used 53 | #endif 54 | 55 | const BYTE g_PS_1D[] = 56 | { 57 | 68, 88, 66, 67, 71, 33, 58 | 105, 235, 206, 215, 61, 110, 59 | 190, 73, 39, 172, 36, 251, 60 | 31, 148, 1, 0, 0, 0, 61 | 220, 2, 0, 0, 5, 0, 62 | 0, 0, 52, 0, 0, 0, 63 | 84, 1, 0, 0, 172, 1, 64 | 0, 0, 224, 1, 0, 0, 65 | 96, 2, 0, 0, 82, 68, 66 | 69, 70, 24, 1, 0, 0, 67 | 1, 0, 0, 0, 156, 0, 68 | 0, 0, 3, 0, 0, 0, 69 | 28, 0, 0, 0, 1, 4, 70 | 255, 255, 0, 1, 0, 0, 71 | 228, 0, 0, 0, 124, 0, 72 | 0, 0, 3, 0, 0, 0, 73 | 0, 0, 0, 0, 0, 0, 74 | 0, 0, 0, 0, 0, 0, 75 | 0, 0, 0, 0, 1, 0, 76 | 0, 0, 1, 0, 0, 0, 77 | 134, 0, 0, 0, 2, 0, 78 | 0, 0, 5, 0, 0, 0, 79 | 2, 0, 0, 0, 255, 255, 80 | 255, 255, 0, 0, 0, 0, 81 | 1, 0, 0, 0, 13, 0, 82 | 0, 0, 139, 0, 0, 0, 83 | 0, 0, 0, 0, 0, 0, 84 | 0, 0, 0, 0, 0, 0, 85 | 0, 0, 0, 0, 0, 0, 86 | 0, 0, 1, 0, 0, 0, 87 | 1, 0, 0, 0, 115, 97, 88 | 109, 76, 105, 110, 101, 97, 89 | 114, 0, 116, 120, 49, 68, 90 | 0, 99, 98, 65, 114, 114, 91 | 97, 121, 67, 111, 110, 116, 92 | 114, 111, 108, 0, 171, 171, 93 | 139, 0, 0, 0, 1, 0, 94 | 0, 0, 180, 0, 0, 0, 95 | 16, 0, 0, 0, 0, 0, 96 | 0, 0, 0, 0, 0, 0, 97 | 204, 0, 0, 0, 0, 0, 98 | 0, 0, 4, 0, 0, 0, 99 | 0, 0, 0, 0, 212, 0, 100 | 0, 0, 0, 0, 0, 0, 101 | 73, 110, 100, 101, 120, 0, 102 | 171, 171, 0, 0, 3, 0, 103 | 1, 0, 1, 0, 0, 0, 104 | 0, 0, 0, 0, 0, 0, 105 | 77, 105, 99, 114, 111, 115, 106 | 111, 102, 116, 32, 40, 82, 107 | 41, 32, 72, 76, 83, 76, 108 | 32, 83, 104, 97, 100, 101, 109 | 114, 32, 67, 111, 109, 112, 110 | 105, 108, 101, 114, 32, 57, 111 | 46, 50, 57, 46, 57, 53, 112 | 50, 46, 51, 49, 49, 49, 113 | 0, 171, 171, 171, 73, 83, 114 | 71, 78, 80, 0, 0, 0, 115 | 2, 0, 0, 0, 8, 0, 116 | 0, 0, 56, 0, 0, 0, 117 | 0, 0, 0, 0, 1, 0, 118 | 0, 0, 3, 0, 0, 0, 119 | 0, 0, 0, 0, 15, 0, 120 | 0, 0, 68, 0, 0, 0, 121 | 0, 0, 0, 0, 0, 0, 122 | 0, 0, 3, 0, 0, 0, 123 | 1, 0, 0, 0, 15, 1, 124 | 0, 0, 83, 86, 95, 80, 125 | 79, 83, 73, 84, 73, 79, 126 | 78, 0, 84, 69, 88, 67, 127 | 79, 79, 82, 68, 0, 171, 128 | 171, 171, 79, 83, 71, 78, 129 | 44, 0, 0, 0, 1, 0, 130 | 0, 0, 8, 0, 0, 0, 131 | 32, 0, 0, 0, 0, 0, 132 | 0, 0, 0, 0, 0, 0, 133 | 3, 0, 0, 0, 0, 0, 134 | 0, 0, 15, 0, 0, 0, 135 | 83, 86, 95, 84, 97, 114, 136 | 103, 101, 116, 0, 171, 171, 137 | 83, 72, 68, 82, 120, 0, 138 | 0, 0, 65, 0, 0, 0, 139 | 30, 0, 0, 0, 106, 8, 140 | 0, 1, 89, 0, 0, 4, 141 | 70, 142, 32, 0, 0, 0, 142 | 0, 0, 1, 0, 0, 0, 143 | 90, 0, 0, 3, 0, 96, 144 | 16, 0, 0, 0, 0, 0, 145 | 88, 16, 0, 4, 0, 112, 146 | 16, 0, 0, 0, 0, 0, 147 | 85, 85, 0, 0, 98, 16, 148 | 0, 3, 18, 16, 16, 0, 149 | 1, 0, 0, 0, 101, 0, 150 | 0, 3, 242, 32, 16, 0, 151 | 0, 0, 0, 0, 69, 0, 152 | 0, 9, 242, 32, 16, 0, 153 | 0, 0, 0, 0, 6, 16, 154 | 16, 0, 1, 0, 0, 0, 155 | 70, 126, 16, 0, 0, 0, 156 | 0, 0, 0, 96, 16, 0, 157 | 0, 0, 0, 0, 62, 0, 158 | 0, 1, 83, 84, 65, 84, 159 | 116, 0, 0, 0, 2, 0, 160 | 0, 0, 0, 0, 0, 0, 161 | 0, 0, 0, 0, 2, 0, 162 | 0, 0, 0, 0, 0, 0, 163 | 0, 0, 0, 0, 0, 0, 164 | 0, 0, 1, 0, 0, 0, 165 | 0, 0, 0, 0, 0, 0, 166 | 0, 0, 0, 0, 0, 0, 167 | 0, 0, 0, 0, 0, 0, 168 | 0, 0, 0, 0, 0, 0, 169 | 1, 0, 0, 0, 0, 0, 170 | 0, 0, 0, 0, 0, 0, 171 | 0, 0, 0, 0, 0, 0, 172 | 0, 0, 0, 0, 0, 0, 173 | 0, 0, 0, 0, 0, 0, 174 | 0, 0, 0, 0, 0, 0, 175 | 0, 0, 0, 0, 0, 0, 176 | 0, 0, 0, 0, 0, 0, 177 | 0, 0, 0, 0, 0, 0, 178 | 0, 0, 0, 0, 0, 0 179 | }; 180 | -------------------------------------------------------------------------------- /FasTCTest/FasTCTest.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {72BA6DA6-E5E0-42E6-8E2E-08184D8701F5} 24 | FasTCTest 25 | 10.0.16299.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v141 32 | MultiByte 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v141 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | Disabled 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | Level3 84 | Disabled 85 | true 86 | true 87 | 88 | 89 | 90 | 91 | Level3 92 | MaxSpeed 93 | true 94 | true 95 | true 96 | true 97 | 98 | 99 | true 100 | true 101 | 102 | 103 | 104 | 105 | Level3 106 | MaxSpeed 107 | true 108 | true 109 | true 110 | true 111 | 112 | 113 | true 114 | true 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | {371b9fa9-4c90-4ac6-a123-aced756d6c77} 128 | 129 | 130 | 131 | 132 | 133 | --------------------------------------------------------------------------------