DirectXTex: Added VS 2010+Windows SDK 8.0 projects; updated to use SAL2 annotation

This commit is contained in:
walbourn_cp 2012-12-07 17:30:49 -08:00
parent e3959f5327
commit cee58c4aed
31 changed files with 1769 additions and 229 deletions

View File

@ -0,0 +1,45 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DDSView", "DDSView_Desktop_2010_SDK80.vcxproj", "{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\DirectXTex\DirectXTex_Desktop_2010_SDK80.vcxproj", "{371B9FA9-4C90-4AC6-A123-ACED756D6C77}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Profile|Win32 = Profile|Win32
Profile|x64 = Profile|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Debug|Win32.ActiveCfg = Debug|Win32
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Debug|Win32.Build.0 = Debug|Win32
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Debug|x64.ActiveCfg = Debug|x64
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Debug|x64.Build.0 = Debug|x64
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Profile|Win32.ActiveCfg = Profile|Win32
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Profile|Win32.Build.0 = Profile|Win32
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Profile|x64.ActiveCfg = Profile|x64
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Profile|x64.Build.0 = Profile|x64
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Release|Win32.ActiveCfg = Release|Win32
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Release|Win32.Build.0 = Release|Win32
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Release|x64.ActiveCfg = Release|x64
{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}.Release|x64.Build.0 = Release|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.ActiveCfg = Debug|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.Build.0 = Debug|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.ActiveCfg = Debug|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.Build.0 = Debug|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.ActiveCfg = Profile|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.Build.0 = Profile|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.ActiveCfg = Profile|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.Build.0 = Profile|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.ActiveCfg = Release|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.Build.0 = Release|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.ActiveCfg = Release|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,371 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|Win32">
<Configuration>Profile</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|x64">
<Configuration>Profile</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>DDSView</ProjectName>
<ProjectGuid>{9D3EDCAD-A800-43F0-B77F-FE6E4DFA3D84}</ProjectGuid>
<RootNamespace>DDSView</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d11.lib;ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d11.lib;ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d11.lib;ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d11.lib;ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d11.lib;ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d11.lib;ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="DDSView.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="DDSView.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DirectXTex\DirectXTex_Desktop_2010.vcxproj">
<Project>{371b9fa9-4c90-4ac6-a123-aced756d6c77}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="ddsview.fx" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns:atg="http://atg.xbox.com" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{8e114980-c1a3-4ada-ad7c-83caadf5daeb}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="DDSView.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="DDSView.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="ddsview.fx" />
</ItemGroup>
</Project>

View File

@ -21,6 +21,10 @@
#include "BC.h" #include "BC.h"
#ifndef USE_XNAMATH
using namespace DirectX::PackedVector;
#endif
namespace DirectX namespace DirectX
{ {
@ -63,7 +67,7 @@ inline static uint16_t Encode565(_In_ const HDRColorA *pColor)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static void OptimizeRGB(_Out_ HDRColorA *pX, _Out_ HDRColorA *pY, static void OptimizeRGB(_Out_ HDRColorA *pX, _Out_ HDRColorA *pY,
_In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA *pPoints, _In_ size_t cSteps, _In_ DWORD flags) _In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA *pPoints, _In_ size_t cSteps, _In_ DWORD flags)
{ {
static const float fEpsilon = (0.25f / 64.0f) * (0.25f / 64.0f); static const float fEpsilon = (0.25f / 64.0f) * (0.25f / 64.0f);
static const float pC3[] = { 2.0f/2.0f, 1.0f/2.0f, 0.0f/2.0f }; static const float pC3[] = { 2.0f/2.0f, 1.0f/2.0f, 0.0f/2.0f };
@ -317,7 +321,7 @@ static void OptimizeRGB(_Out_ HDRColorA *pX, _Out_ HDRColorA *pY,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
inline static void DecodeBC1( _Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_ const D3DX_BC1 *pBC, _In_ bool isbc1 ) inline static void DecodeBC1( _Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_ const D3DX_BC1 *pBC, _In_ bool isbc1 )
{ {
assert( pColor && pBC ); assert( pColor && pBC );
static_assert( sizeof(D3DX_BC1) == 8, "D3DX_BC1 should be 8 bytes" ); static_assert( sizeof(D3DX_BC1) == 8, "D3DX_BC1 should be 8 bytes" );
@ -330,8 +334,8 @@ inline static void DecodeBC1( _Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor
clr0 = XMVectorMultiply( clr0, s_Scale ); clr0 = XMVectorMultiply( clr0, s_Scale );
clr1 = XMVectorMultiply( clr1, s_Scale ); clr1 = XMVectorMultiply( clr1, s_Scale );
clr0 = XMVectorSwizzle( clr0, 2, 1, 0, 3 ); clr0 = XMVectorSwizzle<2, 1, 0, 3>( clr0 );
clr1 = XMVectorSwizzle( clr1, 2, 1, 0, 3 ); clr1 = XMVectorSwizzle<2, 1, 0, 3>( clr1 );
clr0 = XMVectorSelect( g_XMIdentityR3, clr0, g_XMSelect1110 ); clr0 = XMVectorSelect( g_XMIdentityR3, clr0, g_XMSelect1110 );
clr1 = XMVectorSelect( g_XMIdentityR3, clr1, g_XMSelect1110 ); clr1 = XMVectorSelect( g_XMIdentityR3, clr1, g_XMSelect1110 );
@ -368,7 +372,7 @@ inline static void DecodeBC1( _Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#pragma warning(disable: 4616 6001 6201) #pragma warning(disable: 4616 6001 6201)
static void EncodeBC1(_Out_ D3DX_BC1 *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA *pColor, static void EncodeBC1(_Out_ D3DX_BC1 *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA *pColor,
_In_ bool bColorKey, _In_ float alphaRef, _In_ DWORD flags) _In_ bool bColorKey, _In_ float alphaRef, _In_ DWORD flags)
{ {
assert( pBC && pColor ); assert( pBC && pColor );
@ -446,7 +450,7 @@ static void EncodeBC1(_Out_ D3DX_BC1 *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) co
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 15 ); assert( i < 15 );
__analysis_assume( i < 15 ); _Analysis_assume_( i < 15 );
Error[i + 1].r += Diff.r * (7.0f / 16.0f); Error[i + 1].r += Diff.r * (7.0f / 16.0f);
Error[i + 1].g += Diff.g * (7.0f / 16.0f); Error[i + 1].g += Diff.g * (7.0f / 16.0f);
Error[i + 1].b += Diff.b * (7.0f / 16.0f); Error[i + 1].b += Diff.b * (7.0f / 16.0f);
@ -468,7 +472,7 @@ static void EncodeBC1(_Out_ D3DX_BC1 *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) co
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 11 ); assert( i < 11 );
__analysis_assume(i < 11 ); _Analysis_assume_( i < 11 );
Error[i + 5].r += Diff.r * (1.0f / 16.0f); Error[i + 5].r += Diff.r * (1.0f / 16.0f);
Error[i + 5].g += Diff.g * (1.0f / 16.0f); Error[i + 5].g += Diff.g * (1.0f / 16.0f);
Error[i + 5].b += Diff.b * (1.0f / 16.0f); Error[i + 5].b += Diff.b * (1.0f / 16.0f);
@ -677,7 +681,7 @@ static void EncodeBC1(_Out_ D3DX_BC1 *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) co
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#ifdef COLOR_WEIGHTS #ifdef COLOR_WEIGHTS
static void EncodeSolidBC1(_Out_ D3DX_BC1 *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA *pColor) static void EncodeSolidBC1(_Out_ D3DX_BC1 *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA *pColor)
{ {
#ifdef COLOR_AVG_0WEIGHTS #ifdef COLOR_AVG_0WEIGHTS
// Compute avg color // Compute avg color
@ -717,12 +721,14 @@ static void EncodeSolidBC1(_Out_ D3DX_BC1 *pBC, _In_count_c_(NUM_PIXELS_PER_BLOC
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC1 Compression // BC1 Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DXDecodeBC1(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC1(XMVECTOR *pColor, const uint8_t *pBC)
{ {
const D3DX_BC1 *pBC1 = reinterpret_cast<const D3DX_BC1 *>(pBC); const D3DX_BC1 *pBC1 = reinterpret_cast<const D3DX_BC1 *>(pBC);
DecodeBC1( pColor, pBC1, true ); DecodeBC1( pColor, pBC1, true );
} }
_Use_decl_annotations_
void D3DXEncodeBC1(uint8_t *pBC, const XMVECTOR *pColor, float alphaRef, DWORD flags) void D3DXEncodeBC1(uint8_t *pBC, const XMVECTOR *pColor, float alphaRef, DWORD flags)
{ {
assert( pBC && pColor ); assert( pBC && pColor );
@ -751,7 +757,7 @@ void D3DXEncodeBC1(uint8_t *pBC, const XMVECTOR *pColor, float alphaRef, DWORD f
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 15 ); assert( i < 15 );
__analysis_assume( i < 15 ); _Analysis_assume_( i < 15 );
fError[i + 1] += fDiff * (7.0f / 16.0f); fError[i + 1] += fDiff * (7.0f / 16.0f);
} }
@ -765,7 +771,7 @@ void D3DXEncodeBC1(uint8_t *pBC, const XMVECTOR *pColor, float alphaRef, DWORD f
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 11 ); assert( i < 11 );
__analysis_assume( i < 11 ); _Analysis_assume_( i < 11 );
fError[i + 5] += fDiff * (1.0f / 16.0f); fError[i + 5] += fDiff * (1.0f / 16.0f);
} }
} }
@ -787,6 +793,7 @@ void D3DXEncodeBC1(uint8_t *pBC, const XMVECTOR *pColor, float alphaRef, DWORD f
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC2 Compression // BC2 Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DXDecodeBC2(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC2(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -809,6 +816,7 @@ void D3DXDecodeBC2(XMVECTOR *pColor, const uint8_t *pBC)
pColor[i] = XMVectorSetW( pColor[i], (float) (dw & 0xf) * (1.0f / 15.0f) ); pColor[i] = XMVectorSetW( pColor[i], (float) (dw & 0xf) * (1.0f / 15.0f) );
} }
_Use_decl_annotations_
void D3DXEncodeBC2(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags) void D3DXEncodeBC2(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
{ {
assert( pBC && pColor ); assert( pBC && pColor );
@ -848,7 +856,7 @@ void D3DXEncodeBC2(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 15 ); assert( i < 15 );
__analysis_assume( i < 15 ); _Analysis_assume_( i < 15 );
fError[i + 1] += fDiff * (7.0f / 16.0f); fError[i + 1] += fDiff * (7.0f / 16.0f);
} }
@ -862,7 +870,7 @@ void D3DXEncodeBC2(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 11 ); assert( i < 11 );
__analysis_assume( i < 11 ); _Analysis_assume_( i < 11 );
fError[i + 5] += fDiff * (1.0f / 16.0f); fError[i + 5] += fDiff * (1.0f / 16.0f);
} }
} }
@ -885,6 +893,7 @@ void D3DXEncodeBC2(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC3 Compression // BC3 Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DXDecodeBC3(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC3(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -926,6 +935,7 @@ void D3DXDecodeBC3(XMVECTOR *pColor, const uint8_t *pBC)
pColor[i] = XMVectorSetW( pColor[i], fAlpha[dw & 0x7] ); pColor[i] = XMVectorSetW( pColor[i], fAlpha[dw & 0x7] );
} }
_Use_decl_annotations_
void D3DXEncodeBC3(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags) void D3DXEncodeBC3(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
{ {
assert( pBC && pColor ); assert( pBC && pColor );
@ -971,7 +981,7 @@ void D3DXEncodeBC3(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 15 ); assert( i < 15 );
__analysis_assume( i < 15 ); _Analysis_assume_( i < 15 );
fError[i + 1] += fDiff * (7.0f / 16.0f); fError[i + 1] += fDiff * (7.0f / 16.0f);
} }
@ -985,7 +995,7 @@ void D3DXEncodeBC3(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
if(3 != (i & 3)) if(3 != (i & 3))
{ {
assert( i < 11 ); assert( i < 11 );
__analysis_assume( i < 11 ); _Analysis_assume_( i < 11 );
fError[i + 5] += fDiff * (1.0f / 16.0f); fError[i + 5] += fDiff * (1.0f / 16.0f);
} }
} }
@ -1128,4 +1138,4 @@ void D3DXEncodeBC3(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
} }
} }
} // namespace } // namespace

View File

@ -50,7 +50,7 @@ const uint16_t F16S_MASK = 0x8000; // f16 sign mask
const uint16_t F16EM_MASK = 0x7fff; // f16 exp & mantissa mask const uint16_t F16EM_MASK = 0x7fff; // f16 exp & mantissa mask
const uint16_t F16MAX = 0x7bff; // MAXFLT bit pattern for XMHALF const uint16_t F16MAX = 0x7bff; // MAXFLT bit pattern for XMHALF
#define SIGN_EXTEND(x,nb) ((((x)&(1<<((nb)-1)))?((~0)<<(nb)):0)|(x)) #define SIGN_EXTEND(x,nb) ((((x)&(1<<((nb)-1)))?((~0)<<(nb)):0)|(x))
// Because these are used in SAL annotations, they need to remain macros rather than const values // Because these are used in SAL annotations, they need to remain macros rather than const values
#define NUM_PIXELS_PER_BLOCK 16 #define NUM_PIXELS_PER_BLOCK 16
@ -120,14 +120,14 @@ public:
LDRColorA operator = (_In_ const HDRColorA& c); LDRColorA operator = (_In_ const HDRColorA& c);
static void InterpolateRGB(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wc, _In_ size_t wcprec, _Out_ LDRColorA& out) static void InterpolateRGB(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wc, _In_ _In_range_(2, 4) size_t wcprec, _Out_ LDRColorA& out)
{ {
const int* aWeights = nullptr; const int* aWeights = nullptr;
switch(wcprec) switch(wcprec)
{ {
case 2: aWeights = g_aWeights2; assert( wc < 4 ); __analysis_assume( wc < 4 ); break; case 2: aWeights = g_aWeights2; assert( wc < 4 ); _Analysis_assume_( wc < 4 ); break;
case 3: aWeights = g_aWeights3; assert( wc < 8 ); __analysis_assume( wc < 8 ); break; case 3: aWeights = g_aWeights3; assert( wc < 8 ); _Analysis_assume_( wc < 8 ); break;
case 4: aWeights = g_aWeights4; assert( wc < 16 ); __analysis_assume( wc < 16 ); break; case 4: aWeights = g_aWeights4; assert( wc < 16 ); _Analysis_assume_( wc < 16 ); break;
default: assert(false); out.r = out.g = out.b = 0; return; default: assert(false); out.r = out.g = out.b = 0; return;
} }
out.r = uint8_t((uint32_t(c0.r) * uint32_t(BC67_WEIGHT_MAX - aWeights[wc]) + uint32_t(c1.r) * uint32_t(aWeights[wc]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT); out.r = uint8_t((uint32_t(c0.r) * uint32_t(BC67_WEIGHT_MAX - aWeights[wc]) + uint32_t(c1.r) * uint32_t(aWeights[wc]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
@ -135,20 +135,20 @@ public:
out.b = uint8_t((uint32_t(c0.b) * uint32_t(BC67_WEIGHT_MAX - aWeights[wc]) + uint32_t(c1.b) * uint32_t(aWeights[wc]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT); out.b = uint8_t((uint32_t(c0.b) * uint32_t(BC67_WEIGHT_MAX - aWeights[wc]) + uint32_t(c1.b) * uint32_t(aWeights[wc]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
} }
static void InterpolateA(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wa, _In_ size_t waprec, _Out_ LDRColorA& out) static void InterpolateA(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wa, _In_range_(2, 4) _In_ size_t waprec, _Out_ LDRColorA& out)
{ {
const int* aWeights = nullptr; const int* aWeights = nullptr;
switch(waprec) switch(waprec)
{ {
case 2: aWeights = g_aWeights2; assert( wa < 4 ); __analysis_assume( wa < 4 ); break; case 2: aWeights = g_aWeights2; assert( wa < 4 ); _Analysis_assume_( wa < 4 ); break;
case 3: aWeights = g_aWeights3; assert( wa < 8 ); __analysis_assume( wa < 8 ); break; case 3: aWeights = g_aWeights3; assert( wa < 8 ); _Analysis_assume_( wa < 8 ); break;
case 4: aWeights = g_aWeights4; assert( wa < 16 ); __analysis_assume( wa < 16 ); break; case 4: aWeights = g_aWeights4; assert( wa < 16 ); _Analysis_assume_( wa < 16 ); break;
default: assert(false); out.a = 0; return; default: assert(false); out.a = 0; return;
} }
out.a = uint8_t((uint32_t(c0.a) * uint32_t(BC67_WEIGHT_MAX - aWeights[wa]) + uint32_t(c1.a) * uint32_t(aWeights[wa]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT); out.a = uint8_t((uint32_t(c0.a) * uint32_t(BC67_WEIGHT_MAX - aWeights[wa]) + uint32_t(c1.a) * uint32_t(aWeights[wa]) + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
} }
static void Interpolate(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wc, _In_ size_t wa, _In_ size_t wcprec, _In_ size_t waprec, _Out_ LDRColorA& out) static void Interpolate(_In_ const LDRColorA& c0, _In_ const LDRColorA& c1, _In_ size_t wc, _In_ size_t wa, _In_ _In_range_(2, 4) size_t wcprec, _In_ _In_range_(2, 4) size_t waprec, _Out_ LDRColorA& out)
{ {
InterpolateRGB(c0, c1, wc, wcprec, out); InterpolateRGB(c0, c1, wc, wcprec, out);
InterpolateA(c0, c1, wa, waprec, out); InterpolateA(c0, c1, wa, waprec, out);
@ -360,7 +360,7 @@ public:
int& operator [] ( _In_ uint8_t i ) int& operator [] ( _In_ uint8_t i )
{ {
assert(i < sizeof(INTColor) / sizeof(int)); assert(i < sizeof(INTColor) / sizeof(int));
__analysis_assume(i < sizeof(INTColor) / sizeof(int)); _Analysis_assume_(i < sizeof(INTColor) / sizeof(int));
return ((int*) this)[i]; return ((int*) this)[i];
} }
@ -392,7 +392,7 @@ public:
return *this; return *this;
} }
void ToF16(_Out_cap_c_(3) HALF aF16[3], _In_ bool bSigned) const void ToF16(_Out_writes_(3) HALF aF16[3], _In_ bool bSigned) const
{ {
aF16[0] = INT2F16(r, bSigned); aF16[0] = INT2F16(r, bSigned);
aF16[1] = INT2F16(g, bSigned); aF16[1] = INT2F16(g, bSigned);
@ -458,7 +458,7 @@ public:
uint8_t GetBit(_Inout_ size_t& uStartBit) const uint8_t GetBit(_Inout_ size_t& uStartBit) const
{ {
assert(uStartBit < 128); assert(uStartBit < 128);
__analysis_assume(uStartBit < 128); _Analysis_assume_(uStartBit < 128);
size_t uIndex = uStartBit >> 3; size_t uIndex = uStartBit >> 3;
uint8_t ret = (m_uBits[uIndex] >> (uStartBit - (uIndex << 3))) & 0x01; uint8_t ret = (m_uBits[uIndex] >> (uStartBit - (uIndex << 3))) & 0x01;
uStartBit++; uStartBit++;
@ -469,7 +469,7 @@ public:
{ {
if(uNumBits == 0) return 0; if(uNumBits == 0) return 0;
assert(uStartBit + uNumBits <= 128 && uNumBits <= 8); assert(uStartBit + uNumBits <= 128 && uNumBits <= 8);
__analysis_assume(uStartBit + uNumBits <= 128 && uNumBits <= 8); _Analysis_assume_(uStartBit + uNumBits <= 128 && uNumBits <= 8);
uint8_t ret; uint8_t ret;
size_t uIndex = uStartBit >> 3; size_t uIndex = uStartBit >> 3;
size_t uBase = uStartBit - (uIndex << 3); size_t uBase = uStartBit - (uIndex << 3);
@ -491,7 +491,7 @@ public:
void SetBit(_Inout_ size_t& uStartBit, _In_ uint8_t uValue) void SetBit(_Inout_ size_t& uStartBit, _In_ uint8_t uValue)
{ {
assert(uStartBit < 128 && uValue < 2); assert(uStartBit < 128 && uValue < 2);
__analysis_assume(uStartBit < 128 && uValue < 2); _Analysis_assume_(uStartBit < 128 && uValue < 2);
size_t uIndex = uStartBit >> 3; size_t uIndex = uStartBit >> 3;
size_t uBase = uStartBit - (uIndex << 3); size_t uBase = uStartBit - (uIndex << 3);
m_uBits[uIndex] &= ~(1 << uBase); m_uBits[uIndex] &= ~(1 << uBase);
@ -504,7 +504,7 @@ public:
if(uNumBits == 0) if(uNumBits == 0)
return; return;
assert(uStartBit + uNumBits <= 128 && uNumBits <= 8); assert(uStartBit + uNumBits <= 128 && uNumBits <= 8);
__analysis_assume(uStartBit + uNumBits <= 128 && uNumBits <= 8); _Analysis_assume_(uStartBit + uNumBits <= 128 && uNumBits <= 8);
assert(uValue < (1 << uNumBits)); assert(uValue < (1 << uNumBits));
size_t uIndex = uStartBit >> 3; size_t uIndex = uStartBit >> 3;
size_t uBase = uStartBit - (uIndex << 3); size_t uBase = uStartBit - (uIndex << 3);
@ -536,8 +536,8 @@ private:
class D3DX_BC6H : private CBits< 16 > class D3DX_BC6H : private CBits< 16 >
{ {
public: public:
void Decode(_In_ bool bSigned, _Out_cap_c_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut) const; void Decode(_In_ bool bSigned, _Out_writes_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut) const;
void Encode(_In_ bool bSigned, _In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pIn); void Encode(_In_ bool bSigned, _In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pIn);
private: private:
enum EField : uint8_t enum EField : uint8_t
@ -598,30 +598,30 @@ private:
static int Unquantize(_In_ int comp, _In_ uint8_t uBitsPerComp, _In_ bool bSigned); static int Unquantize(_In_ int comp, _In_ uint8_t uBitsPerComp, _In_ bool bSigned);
static int FinishUnquantize(_In_ int comp, _In_ bool bSigned); static int FinishUnquantize(_In_ int comp, _In_ bool bSigned);
static bool EndPointsFit(_In_ const EncodeParams* pEP, _In_count_c_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[]); static bool EndPointsFit(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[]);
void GeneratePaletteQuantized(_In_ const EncodeParams* pEP, _In_ const INTEndPntPair& endPts, void GeneratePaletteQuantized(_In_ const EncodeParams* pEP, _In_ const INTEndPntPair& endPts,
_Out_cap_c_(BC6H_MAX_INDICES) INTColor aPalette[]) const; _Out_writes_(BC6H_MAX_INDICES) INTColor aPalette[]) const;
float MapColorsQuantized(_In_ const EncodeParams* pEP, _In_count_(np) const INTColor aColors[], _In_ size_t np, _In_ const INTEndPntPair &endPts) const; float MapColorsQuantized(_In_ const EncodeParams* pEP, _In_reads_(np) const INTColor aColors[], _In_ size_t np, _In_ const INTEndPntPair &endPts) const;
float PerturbOne(_In_ const EncodeParams* pEP, _In_count_(np) const INTColor aColors[], _In_ size_t np, _In_ uint8_t ch, float PerturbOne(_In_ const EncodeParams* pEP, _In_reads_(np) const INTColor aColors[], _In_ size_t np, _In_ uint8_t ch,
_In_ const INTEndPntPair& oldEndPts, _Out_ INTEndPntPair& newEndPts, _In_ float fOldErr, _In_ int do_b) const; _In_ const INTEndPntPair& oldEndPts, _Out_ INTEndPntPair& newEndPts, _In_ float fOldErr, _In_ int do_b) const;
void OptimizeOne(_In_ const EncodeParams* pEP, _In_count_(np) const INTColor aColors[], _In_ size_t np, _In_ float aOrgErr, void OptimizeOne(_In_ const EncodeParams* pEP, _In_reads_(np) const INTColor aColors[], _In_ size_t np, _In_ float aOrgErr,
_In_ const INTEndPntPair &aOrgEndPts, _Out_ INTEndPntPair &aOptEndPts) const; _In_ const INTEndPntPair &aOrgEndPts, _Out_ INTEndPntPair &aOptEndPts) const;
void OptimizeEndPoints(_In_ const EncodeParams* pEP, _In_count_c_(BC6H_MAX_REGIONS) const float aOrgErr[], void OptimizeEndPoints(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const float aOrgErr[],
_In_count_c_(BC6H_MAX_REGIONS) const INTEndPntPair aOrgEndPts[], _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aOrgEndPts[],
_Inout_count_c_(BC6H_MAX_REGIONS) INTEndPntPair aOptEndPts[]) const; _Inout_updates_all_(BC6H_MAX_REGIONS) INTEndPntPair aOptEndPts[]) const;
static void SwapIndices(_In_ const EncodeParams* pEP, _Inout_count_c_(BC6H_MAX_REGIONS) INTEndPntPair aEndPts[], static void SwapIndices(_In_ const EncodeParams* pEP, _Inout_updates_all_(BC6H_MAX_REGIONS) INTEndPntPair aEndPts[],
_In_count_c_(NUM_PIXELS_PER_BLOCK) size_t aIndices[]); _In_reads_(NUM_PIXELS_PER_BLOCK) size_t aIndices[]);
void AssignIndices(_In_ const EncodeParams* pEP, _In_count_c_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[], void AssignIndices(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[],
_Out_cap_c_(NUM_PIXELS_PER_BLOCK) size_t aIndices[], _Out_writes_(NUM_PIXELS_PER_BLOCK) size_t aIndices[],
_Out_cap_c_(BC6H_MAX_REGIONS) float aTotErr[]) const; _Out_writes_(BC6H_MAX_REGIONS) float aTotErr[]) const;
void QuantizeEndPts(_In_ const EncodeParams* pEP, _Out_cap_c_(BC6H_MAX_REGIONS) INTEndPntPair* qQntEndPts) const; void QuantizeEndPts(_In_ const EncodeParams* pEP, _Out_writes_(BC6H_MAX_REGIONS) INTEndPntPair* qQntEndPts) const;
void EmitBlock(_In_ const EncodeParams* pEP, _In_count_c_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[], void EmitBlock(_In_ const EncodeParams* pEP, _In_reads_(BC6H_MAX_REGIONS) const INTEndPntPair aEndPts[],
_In_count_c_(NUM_PIXELS_PER_BLOCK) const size_t aIndices[]); _In_reads_(NUM_PIXELS_PER_BLOCK) const size_t aIndices[]);
void Refine(_Inout_ EncodeParams* pEP); void Refine(_Inout_ EncodeParams* pEP);
static void GeneratePaletteUnquantized(_In_ const EncodeParams* pEP, _In_ size_t uRegion, _Out_cap_c_(BC6H_MAX_INDICES) INTColor aPalette[]); static void GeneratePaletteUnquantized(_In_ const EncodeParams* pEP, _In_ size_t uRegion, _Out_writes_(BC6H_MAX_INDICES) INTColor aPalette[]);
float MapColors(_In_ const EncodeParams* pEP, _In_ size_t uRegion, _In_ size_t np, _In_count_(np) const size_t* auIndex) const; float MapColors(_In_ const EncodeParams* pEP, _In_ size_t uRegion, _In_ size_t np, _In_reads_(np) const size_t* auIndex) const;
float RoughMSE(_Inout_ EncodeParams* pEP) const; float RoughMSE(_Inout_ EncodeParams* pEP) const;
private: private:
@ -634,8 +634,8 @@ private:
class D3DX_BC7 : private CBits< 16 > class D3DX_BC7 : private CBits< 16 >
{ {
public: public:
void Decode(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut) const; void Decode(_Out_writes_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut) const;
void Encode(_In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pIn); void Encode(_In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pIn);
private: private:
struct ModeInfo struct ModeInfo
@ -699,29 +699,29 @@ private:
} }
void GeneratePaletteQuantized(_In_ const EncodeParams* pEP, _In_ size_t uIndexMode, _In_ const LDREndPntPair& endpts, void GeneratePaletteQuantized(_In_ const EncodeParams* pEP, _In_ size_t uIndexMode, _In_ const LDREndPntPair& endpts,
_Out_cap_c_(BC7_MAX_INDICES) LDRColorA aPalette[]) const; _Out_writes_(BC7_MAX_INDICES) LDRColorA aPalette[]) const;
float PerturbOne(_In_ const EncodeParams* pEP, _In_count_(np) const LDRColorA colors[], _In_ size_t np, _In_ size_t uIndexMode, float PerturbOne(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA colors[], _In_ size_t np, _In_ size_t uIndexMode,
_In_ size_t ch, _In_ const LDREndPntPair &old_endpts, _In_ size_t ch, _In_ const LDREndPntPair &old_endpts,
_Out_ LDREndPntPair &new_endpts, _In_ float old_err, _In_ uint8_t do_b) const; _Out_ LDREndPntPair &new_endpts, _In_ float old_err, _In_ uint8_t do_b) const;
void Exhaustive(_In_ const EncodeParams* pEP, _In_count_(np) const LDRColorA aColors[], _In_ size_t np, _In_ size_t uIndexMode, void Exhaustive(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA aColors[], _In_ size_t np, _In_ size_t uIndexMode,
_In_ size_t ch, _Inout_ float& fOrgErr, _Inout_ LDREndPntPair& optEndPt) const; _In_ size_t ch, _Inout_ float& fOrgErr, _Inout_ LDREndPntPair& optEndPt) const;
void OptimizeOne(_In_ const EncodeParams* pEP, _In_count_(np) const LDRColorA colors[], _In_ size_t np, _In_ size_t uIndexMode, void OptimizeOne(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA colors[], _In_ size_t np, _In_ size_t uIndexMode,
_In_ float orig_err, _In_ const LDREndPntPair &orig_endpts, _Out_ LDREndPntPair &opt_endpts) const; _In_ float orig_err, _In_ const LDREndPntPair &orig_endpts, _Out_ LDREndPntPair &opt_endpts) const;
void OptimizeEndPoints(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode, void OptimizeEndPoints(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode,
_In_count_c_(BC7_MAX_REGIONS) const float orig_err[], _In_reads_(BC7_MAX_REGIONS) const float orig_err[],
_In_count_c_(BC7_MAX_REGIONS) const LDREndPntPair orig_endpts[], _In_reads_(BC7_MAX_REGIONS) const LDREndPntPair orig_endpts[],
_Out_cap_c_(BC7_MAX_REGIONS) LDREndPntPair opt_endpts[]) const; _Out_writes_(BC7_MAX_REGIONS) LDREndPntPair opt_endpts[]) const;
void AssignIndices(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode, void AssignIndices(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode,
_In_count_c_(BC7_MAX_REGIONS) LDREndPntPair endpts[], _In_reads_(BC7_MAX_REGIONS) LDREndPntPair endpts[],
_Out_cap_c_(NUM_PIXELS_PER_BLOCK) size_t aIndices[], _Out_cap_c_(NUM_PIXELS_PER_BLOCK) size_t aIndices2[], _Inout_updates_all_(NUM_PIXELS_PER_BLOCK) size_t aIndices[], _Inout_updates_all_(NUM_PIXELS_PER_BLOCK) size_t aIndices2[],
_Out_cap_c_(BC7_MAX_REGIONS) float afTotErr[]) const; _Out_writes_(BC7_MAX_REGIONS) float afTotErr[]) const;
void EmitBlock(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uRotation, _In_ size_t uIndexMode, void EmitBlock(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uRotation, _In_ size_t uIndexMode,
_In_count_c_(BC7_MAX_REGIONS) const LDREndPntPair aEndPts[], _In_reads_(BC7_MAX_REGIONS) const LDREndPntPair aEndPts[],
_In_count_c_(NUM_PIXELS_PER_BLOCK) const size_t aIndex[], _In_reads_(NUM_PIXELS_PER_BLOCK) const size_t aIndex[],
_In_count_c_(NUM_PIXELS_PER_BLOCK) const size_t aIndex2[]); _In_reads_(NUM_PIXELS_PER_BLOCK) const size_t aIndex2[]);
float Refine(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uRotation, _In_ size_t uIndexMode); float Refine(_In_ const EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uRotation, _In_ size_t uIndexMode);
float MapColors(_In_ const EncodeParams* pEP, _In_count_(np) const LDRColorA aColors[], _In_ size_t np, _In_ size_t uIndexMode, float MapColors(_In_ const EncodeParams* pEP, _In_reads_(np) const LDRColorA aColors[], _In_ size_t np, _In_ size_t uIndexMode,
_In_ const LDREndPntPair& endPts, _In_ float fMinErr) const; _In_ const LDREndPntPair& endPts, _In_ float fMinErr) const;
static float RoughMSE(_Inout_ EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode); static float RoughMSE(_Inout_ EncodeParams* pEP, _In_ size_t uShape, _In_ size_t uIndexMode);
@ -870,28 +870,28 @@ template <bool bRange> void OptimizeAlpha(float *pX, float *pY, const float *pPo
typedef void (*BC_DECODE)(XMVECTOR *pColor, const uint8_t *pBC); typedef void (*BC_DECODE)(XMVECTOR *pColor, const uint8_t *pBC);
typedef void (*BC_ENCODE)(uint8_t *pDXT, const XMVECTOR *pColor, DWORD flags); typedef void (*BC_ENCODE)(uint8_t *pDXT, const XMVECTOR *pColor, DWORD flags);
void D3DXDecodeBC1(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(8) const uint8_t *pBC); void D3DXDecodeBC1(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(8) const uint8_t *pBC);
void D3DXDecodeBC2(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(16) const uint8_t *pBC); void D3DXDecodeBC2(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
void D3DXDecodeBC3(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(16) const uint8_t *pBC); void D3DXDecodeBC3(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
void D3DXDecodeBC4U(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(8) const uint8_t *pBC); void D3DXDecodeBC4U(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(8) const uint8_t *pBC);
void D3DXDecodeBC4S(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(8) const uint8_t *pBC); void D3DXDecodeBC4S(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(8) const uint8_t *pBC);
void D3DXDecodeBC5U(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(16) const uint8_t *pBC); void D3DXDecodeBC5U(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
void D3DXDecodeBC5S(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(16) const uint8_t *pBC); void D3DXDecodeBC5S(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
void D3DXDecodeBC6HU(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(16) const uint8_t *pBC); void D3DXDecodeBC6HU(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
void D3DXDecodeBC6HS(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(16) const uint8_t *pBC); void D3DXDecodeBC6HS(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
void D3DXDecodeBC7(_Out_cap_c_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_count_c_(16) const uint8_t *pBC); void D3DXDecodeBC7(_Out_writes_(NUM_PIXELS_PER_BLOCK) XMVECTOR *pColor, _In_reads_(16) const uint8_t *pBC);
void D3DXEncodeBC1(_Out_cap_c_(8) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ float alphaRef, _In_ DWORD flags); void D3DXEncodeBC1(_Out_writes_(8) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ float alphaRef, _In_ DWORD flags);
// BC1 requires one additional parameter, so it doesn't match signature of BC_ENCODE above // BC1 requires one additional parameter, so it doesn't match signature of BC_ENCODE above
void D3DXEncodeBC2(_Out_cap_c_(16) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC2(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC3(_Out_cap_c_(16) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC3(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC4U(_Out_cap_c_(8) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC4U(_Out_writes_(8) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC4S(_Out_cap_c_(8) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC4S(_Out_writes_(8) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC5U(_Out_cap_c_(16) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC5U(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC5S(_Out_cap_c_(16) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC5S(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC6HU(_Out_cap_c_(16) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC6HU(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC6HS(_Out_cap_c_(16) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC6HS(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
void D3DXEncodeBC7(_Out_cap_c_(16) uint8_t *pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags); void D3DXEncodeBC7(_Out_writes_(16) uint8_t *pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const XMVECTOR *pColor, _In_ DWORD flags);
}; // namespace }; // namespace

View File

@ -164,10 +164,10 @@ static void inline FloatToSNorm( _In_ float fVal, _Out_ int8_t *piSNorm )
fVal = 0; fVal = 0;
else else
if( fVal > 1 ) if( fVal > 1 )
fVal = 1; // Clamp to 1 fVal = 1; // Clamp to 1
else else
if( fVal < -1 ) if( fVal < -1 )
fVal = -1; // Clamp to -1 fVal = -1; // Clamp to -1
fVal = fVal * (int8_t) ( dwMostNeg - 1 ); fVal = fVal * (int8_t) ( dwMostNeg - 1 );
@ -181,7 +181,7 @@ static void inline FloatToSNorm( _In_ float fVal, _Out_ int8_t *piSNorm )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
static void FindEndPointsBC4U( _In_count_c_(BLOCK_SIZE) const float theTexelsU[], _Out_ uint8_t &endpointU_0, _Out_ uint8_t &endpointU_1) static void FindEndPointsBC4U( _In_reads_(BLOCK_SIZE) const float theTexelsU[], _Out_ uint8_t &endpointU_0, _Out_ uint8_t &endpointU_1)
{ {
// The boundary of codec for signed/unsigned format // The boundary of codec for signed/unsigned format
float MIN_NORM; float MIN_NORM;
@ -235,7 +235,7 @@ static void FindEndPointsBC4U( _In_count_c_(BLOCK_SIZE) const float theTexelsU[]
} }
} }
static void FindEndPointsBC4S(_In_count_c_(BLOCK_SIZE) const float theTexelsU[], _Out_ int8_t &endpointU_0, _Out_ int8_t &endpointU_1) static void FindEndPointsBC4S(_In_reads_(BLOCK_SIZE) const float theTexelsU[], _Out_ int8_t &endpointU_0, _Out_ int8_t &endpointU_1)
{ {
// The boundary of codec for signed/unsigned format // The boundary of codec for signed/unsigned format
float MIN_NORM; float MIN_NORM;
@ -291,7 +291,7 @@ static void FindEndPointsBC4S(_In_count_c_(BLOCK_SIZE) const float theTexelsU[],
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
static inline void FindEndPointsBC5U( _In_count_c_(BLOCK_SIZE) const float theTexelsU[], _In_count_c_(BLOCK_SIZE) const float theTexelsV[], static inline void FindEndPointsBC5U( _In_reads_(BLOCK_SIZE) const float theTexelsU[], _In_reads_(BLOCK_SIZE) const float theTexelsV[],
_Out_ uint8_t &endpointU_0, _Out_ uint8_t &endpointU_1, _Out_ uint8_t &endpointV_0, _Out_ uint8_t &endpointV_1) _Out_ uint8_t &endpointU_0, _Out_ uint8_t &endpointU_1, _Out_ uint8_t &endpointV_0, _Out_ uint8_t &endpointV_1)
{ {
//Encoding the U and V channel by BC4 codec separately. //Encoding the U and V channel by BC4 codec separately.
@ -299,7 +299,7 @@ static inline void FindEndPointsBC5U( _In_count_c_(BLOCK_SIZE) const float theTe
FindEndPointsBC4U( theTexelsV, endpointV_0, endpointV_1); FindEndPointsBC4U( theTexelsV, endpointV_0, endpointV_1);
} }
static inline void FindEndPointsBC5S( _In_count_c_(BLOCK_SIZE) const float theTexelsU[], _In_count_c_(BLOCK_SIZE) const float theTexelsV[], static inline void FindEndPointsBC5S( _In_reads_(BLOCK_SIZE) const float theTexelsU[], _In_reads_(BLOCK_SIZE) const float theTexelsV[],
_Out_ int8_t &endpointU_0, _Out_ int8_t &endpointU_1, _Out_ int8_t &endpointV_0, _Out_ int8_t &endpointV_1) _Out_ int8_t &endpointU_0, _Out_ int8_t &endpointU_1, _Out_ int8_t &endpointV_0, _Out_ int8_t &endpointV_1)
{ {
//Encoding the U and V channel by BC4 codec separately. //Encoding the U and V channel by BC4 codec separately.
@ -309,7 +309,7 @@ static inline void FindEndPointsBC5S( _In_count_c_(BLOCK_SIZE) const float theTe
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
static void FindClosestUNORM(_Inout_ BC4_UNORM* pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const float theTexelsU[]) static void FindClosestUNORM(_Inout_ BC4_UNORM* pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const float theTexelsU[])
{ {
float rGradient[8]; float rGradient[8];
int i; int i;
@ -334,7 +334,7 @@ static void FindClosestUNORM(_Inout_ BC4_UNORM* pBC, _In_count_c_(NUM_PIXELS_PER
} }
} }
static void FindClosestSNORM(_Inout_ BC4_SNORM* pBC, _In_count_c_(NUM_PIXELS_PER_BLOCK) const float theTexelsU[]) static void FindClosestSNORM(_Inout_ BC4_SNORM* pBC, _In_reads_(NUM_PIXELS_PER_BLOCK) const float theTexelsU[])
{ {
float rGradient[8]; float rGradient[8];
int i; int i;
@ -367,6 +367,7 @@ static void FindClosestSNORM(_Inout_ BC4_SNORM* pBC, _In_count_c_(NUM_PIXELS_PER
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC4 Compression // BC4 Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DXDecodeBC4U( XMVECTOR *pColor, const uint8_t *pBC ) void D3DXDecodeBC4U( XMVECTOR *pColor, const uint8_t *pBC )
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -380,6 +381,7 @@ void D3DXDecodeBC4U( XMVECTOR *pColor, const uint8_t *pBC )
} }
} }
_Use_decl_annotations_
void D3DXDecodeBC4S(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC4S(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -393,6 +395,7 @@ void D3DXDecodeBC4S(XMVECTOR *pColor, const uint8_t *pBC)
} }
} }
_Use_decl_annotations_
void D3DXEncodeBC4U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags ) void D3DXEncodeBC4U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
{ {
UNREFERENCED_PARAMETER( flags ); UNREFERENCED_PARAMETER( flags );
@ -413,6 +416,7 @@ void D3DXEncodeBC4U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
FindClosestUNORM(pBC4, theTexelsU); FindClosestUNORM(pBC4, theTexelsU);
} }
_Use_decl_annotations_
void D3DXEncodeBC4S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags ) void D3DXEncodeBC4S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
{ {
UNREFERENCED_PARAMETER( flags ); UNREFERENCED_PARAMETER( flags );
@ -437,6 +441,7 @@ void D3DXEncodeBC4S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC5 Compression // BC5 Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DXDecodeBC5U(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC5U(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -451,6 +456,7 @@ void D3DXDecodeBC5U(XMVECTOR *pColor, const uint8_t *pBC)
} }
} }
_Use_decl_annotations_
void D3DXDecodeBC5S(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC5S(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -465,6 +471,7 @@ void D3DXDecodeBC5S(XMVECTOR *pColor, const uint8_t *pBC)
} }
} }
_Use_decl_annotations_
void D3DXEncodeBC5U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags ) void D3DXEncodeBC5U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
{ {
UNREFERENCED_PARAMETER( flags ); UNREFERENCED_PARAMETER( flags );
@ -498,6 +505,7 @@ void D3DXEncodeBC5U( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
FindClosestUNORM(pBCG, theTexelsV); FindClosestUNORM(pBCG, theTexelsV);
} }
_Use_decl_annotations_
void D3DXEncodeBC5S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags ) void D3DXEncodeBC5S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
{ {
UNREFERENCED_PARAMETER( flags ); UNREFERENCED_PARAMETER( flags );
@ -531,4 +539,4 @@ void D3DXEncodeBC5S( uint8_t *pBC, const XMVECTOR *pColor, DWORD flags )
FindClosestSNORM(pBCG, theTexelsV); FindClosestSNORM(pBCG, theTexelsV);
} }
} // namespace } // namespace

View File

@ -571,7 +571,7 @@ inline static void Swap( T& a, T& b )
inline static bool IsFixUpOffset(_In_range_(0,2) size_t uPartitions, _In_range_(0,63) size_t uShape, _In_range_(0,15) size_t uOffset) inline static bool IsFixUpOffset(_In_range_(0,2) size_t uPartitions, _In_range_(0,63) size_t uShape, _In_range_(0,15) size_t uOffset)
{ {
assert(uPartitions < 3 && uShape < 64 && uOffset < 16); assert(uPartitions < 3 && uShape < 64 && uOffset < 16);
__analysis_assume(uPartitions < 3 && uShape < 64 && uOffset < 16); _Analysis_assume_(uPartitions < 3 && uShape < 64 && uOffset < 16);
for(size_t p = 0; p <= uPartitions; p++) for(size_t p = 0; p <= uPartitions; p++)
{ {
if(uOffset == g_aFixUp[uPartitions][uShape][p]) if(uOffset == g_aFixUp[uPartitions][uShape][p])
@ -605,14 +605,14 @@ inline static float ErrorMetric(_In_ const LDRColorA& a, _In_ const LDRColorA& b
return ErrorMetricRGB(a, b) + ErrorMetricAlpha(a, b); return ErrorMetricRGB(a, b) + ErrorMetricAlpha(a, b);
} }
inline static void TransformForward(_Inout_count_c_(BC6H_MAX_REGIONS) INTEndPntPair aEndPts[]) inline static void TransformForward(_Inout_updates_all_(BC6H_MAX_REGIONS) INTEndPntPair aEndPts[])
{ {
aEndPts[0].B -= aEndPts[0].A; aEndPts[0].B -= aEndPts[0].A;
aEndPts[1].A -= aEndPts[0].A; aEndPts[1].A -= aEndPts[0].A;
aEndPts[1].B -= aEndPts[0].A; aEndPts[1].B -= aEndPts[0].A;
} }
inline static void TransformInverse(_Inout_count_c_(BC6H_MAX_REGIONS) INTEndPntPair aEndPts[], _In_ const LDRColorA& Prec, _In_ bool bSigned) inline static void TransformInverse(_Inout_updates_all_(BC6H_MAX_REGIONS) INTEndPntPair aEndPts[], _In_ const LDRColorA& Prec, _In_ bool bSigned)
{ {
INTColor WrapMask((1 << Prec.r) - 1, (1 << Prec.g) - 1, (1 << Prec.b) - 1); INTColor WrapMask((1 << Prec.r) - 1, (1 << Prec.g) - 1, (1 << Prec.b) - 1);
aEndPts[0].B += aEndPts[0].A; aEndPts[0].B &= WrapMask; aEndPts[0].B += aEndPts[0].A; aEndPts[0].B &= WrapMask;
@ -657,9 +657,9 @@ inline static int NBits(_In_ int n, _In_ bool bIsSigned)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static float OptimizeRGB(_In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pPoints, static float OptimizeRGB(_In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pPoints,
_Out_ HDRColorA* pX, _Out_ HDRColorA* pY, _Out_ HDRColorA* pX, _Out_ HDRColorA* pY,
_In_ size_t cSteps, _In_ size_t cPixels, _In_count_(cPixels) const size_t* pIndex) _In_ size_t cSteps, _In_ size_t cPixels, _In_reads_(cPixels) const size_t* pIndex)
{ {
float fError = FLT_MAX; float fError = FLT_MAX;
const float *pC = (3 == cSteps) ? pC3 : pC4; const float *pC = (3 == cSteps) ? pC3 : pC4;
@ -849,9 +849,9 @@ static float OptimizeRGB(_In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA* con
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static float OptimizeRGBA(_In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pPoints, static float OptimizeRGBA(_In_reads_(NUM_PIXELS_PER_BLOCK) const HDRColorA* const pPoints,
_Out_ HDRColorA* pX, _Out_ HDRColorA* pY, _Out_ HDRColorA* pX, _Out_ HDRColorA* pY,
_In_ size_t cSteps, _In_ size_t cPixels, _In_count_(cPixels) const size_t* pIndex) _In_ size_t cSteps, _In_ size_t cPixels, _In_reads_(cPixels) const size_t* pIndex)
{ {
float fError = FLT_MAX; float fError = FLT_MAX;
const float *pC = (3 == cSteps) ? pC3 : pC4; const float *pC = (3 == cSteps) ? pC3 : pC4;
@ -1016,7 +1016,7 @@ static float OptimizeRGBA(_In_count_c_(NUM_PIXELS_PER_BLOCK) const HDRColorA* co
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#pragma warning(disable: 4616 6001 6297) #pragma warning(disable: 4616 6001 6297)
static float ComputeError(_Inout_ const LDRColorA& pixel, _In_count_x_(1 << uIndexPrec) const LDRColorA aPalette[], static float ComputeError(_Inout_ const LDRColorA& pixel, _In_reads_(1 << uIndexPrec) const LDRColorA aPalette[],
_In_ uint8_t uIndexPrec, _In_ uint8_t uIndexPrec2, _Out_opt_ size_t* pBestIndex = nullptr, _Out_opt_ size_t* pBestIndex2 = nullptr) _In_ uint8_t uIndexPrec, _In_ uint8_t uIndexPrec2, _Out_opt_ size_t* pBestIndex = nullptr, _Out_opt_ size_t* pBestIndex2 = nullptr)
{ {
const size_t uNumIndices = 1 << uIndexPrec; const size_t uNumIndices = 1 << uIndexPrec;
@ -1080,7 +1080,7 @@ static float ComputeError(_Inout_ const LDRColorA& pixel, _In_count_x_(1 << uInd
} }
inline static void FillWithErrorColors( _Out_cap_c_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut ) inline static void FillWithErrorColors( _Out_writes_(NUM_PIXELS_PER_BLOCK) HDRColorA* pOut )
{ {
for(size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i) for(size_t i = 0; i < NUM_PIXELS_PER_BLOCK; ++i)
{ {
@ -1098,6 +1098,7 @@ inline static void FillWithErrorColors( _Out_cap_c_(NUM_PIXELS_PER_BLOCK) HDRCol
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC6H Compression // BC6H Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const
{ {
assert(pOut ); assert(pOut );
@ -1110,16 +1111,16 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const
} }
assert( uMode < 32 ); assert( uMode < 32 );
__analysis_assume( uMode < 32 ); _Analysis_assume_( uMode < 32 );
if ( ms_aModeToInfo[uMode] >= 0 ) if ( ms_aModeToInfo[uMode] >= 0 )
{ {
assert(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aInfo)); assert(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aInfo));
__analysis_assume(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aInfo)); _Analysis_assume_(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aInfo));
const ModeDescriptor* desc = ms_aDesc[ms_aModeToInfo[uMode]]; const ModeDescriptor* desc = ms_aDesc[ms_aModeToInfo[uMode]];
assert(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aDesc)); assert(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aDesc));
__analysis_assume(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aDesc)); _Analysis_assume_(ms_aModeToInfo[uMode] < ARRAYSIZE(ms_aDesc));
const ModeInfo& info = ms_aInfo[ms_aModeToInfo[uMode]]; const ModeInfo& info = ms_aInfo[ms_aModeToInfo[uMode]];
INTEndPntPair aEndPts[BC6H_MAX_REGIONS]; INTEndPntPair aEndPts[BC6H_MAX_REGIONS];
@ -1161,7 +1162,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const
} }
assert( uShape < 64 ); assert( uShape < 64 );
__analysis_assume( uShape < 64 ); _Analysis_assume_( uShape < 64 );
// Sign extend necessary end points // Sign extend necessary end points
if(bSigned) if(bSigned)
@ -1171,7 +1172,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const
if(bSigned || info.bTransformed) if(bSigned || info.bTransformed)
{ {
assert( info.uPartitions < BC6H_MAX_REGIONS ); assert( info.uPartitions < BC6H_MAX_REGIONS );
__analysis_assume( info.uPartitions < BC6H_MAX_REGIONS ); _Analysis_assume_( info.uPartitions < BC6H_MAX_REGIONS );
for(size_t p = 0; p <= info.uPartitions; ++p) for(size_t p = 0; p <= info.uPartitions; ++p)
{ {
if(p != 0) if(p != 0)
@ -1213,7 +1214,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const
size_t uRegion = g_aPartitionTable[info.uPartitions][uShape][i]; size_t uRegion = g_aPartitionTable[info.uPartitions][uShape][i];
assert( uRegion < BC6H_MAX_REGIONS ); assert( uRegion < BC6H_MAX_REGIONS );
__analysis_assume( uRegion < BC6H_MAX_REGIONS ); _Analysis_assume_( uRegion < BC6H_MAX_REGIONS );
// Unquantize endpoints and interpolate // Unquantize endpoints and interpolate
int r1 = Unquantize(aEndPts[uRegion].A.r, info.RGBAPrec[0][0].r, bSigned); int r1 = Unquantize(aEndPts[uRegion].A.r, info.RGBAPrec[0][0].r, bSigned);
@ -1246,6 +1247,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const
} }
} }
_Use_decl_annotations_
void D3DX_BC6H::Encode(bool bSigned, const HDRColorA* const pIn) void D3DX_BC6H::Encode(bool bSigned, const HDRColorA* const pIn)
{ {
assert( pIn ); assert( pIn );
@ -1292,6 +1294,7 @@ void D3DX_BC6H::Encode(bool bSigned, const HDRColorA* const pIn)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
int D3DX_BC6H::Quantize(int iValue, int prec, bool bSigned) int D3DX_BC6H::Quantize(int iValue, int prec, bool bSigned)
{ {
assert(prec > 1); // didn't bother to make it work for 1 assert(prec > 1); // didn't bother to make it work for 1
@ -1319,6 +1322,7 @@ int D3DX_BC6H::Quantize(int iValue, int prec, bool bSigned)
return q; return q;
} }
_Use_decl_annotations_
int D3DX_BC6H::Unquantize(int comp, uint8_t uBitsPerComp, bool bSigned) int D3DX_BC6H::Unquantize(int comp, uint8_t uBitsPerComp, bool bSigned)
{ {
int unq = 0, s = 0; int unq = 0, s = 0;
@ -1354,6 +1358,7 @@ int D3DX_BC6H::Unquantize(int comp, uint8_t uBitsPerComp, bool bSigned)
return unq; return unq;
} }
_Use_decl_annotations_
int D3DX_BC6H::FinishUnquantize(int comp, bool bSigned) int D3DX_BC6H::FinishUnquantize(int comp, bool bSigned)
{ {
if(bSigned) if(bSigned)
@ -1368,6 +1373,7 @@ int D3DX_BC6H::FinishUnquantize(int comp, bool bSigned)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
bool D3DX_BC6H::EndPointsFit(const EncodeParams* pEP, const INTEndPntPair aEndPts[]) bool D3DX_BC6H::EndPointsFit(const EncodeParams* pEP, const INTEndPntPair aEndPts[])
{ {
assert( pEP ); assert( pEP );
@ -1408,13 +1414,14 @@ bool D3DX_BC6H::EndPointsFit(const EncodeParams* pEP, const INTEndPntPair aEndPt
return true; return true;
} }
_Use_decl_annotations_
void D3DX_BC6H::GeneratePaletteQuantized(const EncodeParams* pEP, const INTEndPntPair& endPts, INTColor aPalette[]) const void D3DX_BC6H::GeneratePaletteQuantized(const EncodeParams* pEP, const INTEndPntPair& endPts, INTColor aPalette[]) const
{ {
assert( pEP ); assert( pEP );
const size_t uIndexPrec = ms_aInfo[pEP->uMode].uIndexPrec; const size_t uIndexPrec = ms_aInfo[pEP->uMode].uIndexPrec;
const size_t uNumIndices = 1 << uIndexPrec; const size_t uNumIndices = 1 << uIndexPrec;
assert( uNumIndices > 0 ); assert( uNumIndices > 0 );
__analysis_assume( uNumIndices > 0 ); _Analysis_assume_( uNumIndices > 0 );
const LDRColorA& Prec = ms_aInfo[pEP->uMode].RGBAPrec[0][0]; const LDRColorA& Prec = ms_aInfo[pEP->uMode].RGBAPrec[0][0];
// scale endpoints // scale endpoints
@ -1430,8 +1437,8 @@ void D3DX_BC6H::GeneratePaletteQuantized(const EncodeParams* pEP, const INTEndPn
const int* aWeights = nullptr; const int* aWeights = nullptr;
switch(uIndexPrec) switch(uIndexPrec)
{ {
case 3: aWeights = g_aWeights3; assert(uNumIndices <= 8); __analysis_assume(uNumIndices <= 8); break; case 3: aWeights = g_aWeights3; assert(uNumIndices <= 8); _Analysis_assume_(uNumIndices <= 8); break;
case 4: aWeights = g_aWeights4; assert(uNumIndices <= 16); __analysis_assume(uNumIndices <= 16); break; case 4: aWeights = g_aWeights4; assert(uNumIndices <= 16); _Analysis_assume_(uNumIndices <= 16); break;
default: assert(false); for(size_t i=0; i < uNumIndices; ++i) aPalette[i] = INTColor(0,0,0); return; default: assert(false); for(size_t i=0; i < uNumIndices; ++i) aPalette[i] = INTColor(0,0,0); return;
} }
@ -1450,6 +1457,7 @@ void D3DX_BC6H::GeneratePaletteQuantized(const EncodeParams* pEP, const INTEndPn
} }
// given a collection of colors and quantized endpoints, generate a palette, choose best entries, and return a single toterr // given a collection of colors and quantized endpoints, generate a palette, choose best entries, and return a single toterr
_Use_decl_annotations_
float D3DX_BC6H::MapColorsQuantized(const EncodeParams* pEP, const INTColor aColors[], size_t np, const INTEndPntPair &endPts) const float D3DX_BC6H::MapColorsQuantized(const EncodeParams* pEP, const INTColor aColors[], size_t np, const INTEndPntPair &endPts) const
{ {
assert( pEP ); assert( pEP );
@ -1474,6 +1482,7 @@ float D3DX_BC6H::MapColorsQuantized(const EncodeParams* pEP, const INTColor aCol
return fTotErr; return fTotErr;
} }
_Use_decl_annotations_
float D3DX_BC6H::PerturbOne(const EncodeParams* pEP, const INTColor aColors[], size_t np, uint8_t ch, float D3DX_BC6H::PerturbOne(const EncodeParams* pEP, const INTColor aColors[], size_t np, uint8_t ch,
const INTEndPntPair& oldEndPts, INTEndPntPair& newEndPts, float fOldErr, int do_b) const const INTEndPntPair& oldEndPts, INTEndPntPair& newEndPts, float fOldErr, int do_b) const
{ {
@ -1533,6 +1542,7 @@ float D3DX_BC6H::PerturbOne(const EncodeParams* pEP, const INTColor aColors[], s
return fMinErr; return fMinErr;
} }
_Use_decl_annotations_
void D3DX_BC6H::OptimizeOne(const EncodeParams* pEP, const INTColor aColors[], size_t np, float aOrgErr, void D3DX_BC6H::OptimizeOne(const EncodeParams* pEP, const INTColor aColors[], size_t np, float aOrgErr,
const INTEndPntPair &aOrgEndPts, INTEndPntPair &aOptEndPts) const const INTEndPntPair &aOrgEndPts, INTEndPntPair &aOptEndPts) const
{ {
@ -1584,12 +1594,13 @@ void D3DX_BC6H::OptimizeOne(const EncodeParams* pEP, const INTColor aColors[], s
} }
} }
_Use_decl_annotations_
void D3DX_BC6H::OptimizeEndPoints(const EncodeParams* pEP, const float aOrgErr[], const INTEndPntPair aOrgEndPts[], INTEndPntPair aOptEndPts[]) const void D3DX_BC6H::OptimizeEndPoints(const EncodeParams* pEP, const float aOrgErr[], const INTEndPntPair aOrgEndPts[], INTEndPntPair aOptEndPts[]) const
{ {
assert( pEP ); assert( pEP );
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC6H_MAX_REGIONS ); assert( uPartitions < BC6H_MAX_REGIONS );
__analysis_assume( uPartitions < BC6H_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC6H_MAX_REGIONS );
INTColor aPixels[NUM_PIXELS_PER_BLOCK]; INTColor aPixels[NUM_PIXELS_PER_BLOCK];
for(size_t p = 0; p <= uPartitions; ++p) for(size_t p = 0; p <= uPartitions; ++p)
@ -1609,6 +1620,7 @@ void D3DX_BC6H::OptimizeEndPoints(const EncodeParams* pEP, const float aOrgErr[]
} }
// Swap endpoints as needed to ensure that the indices at fix up have a 0 high-order bit // Swap endpoints as needed to ensure that the indices at fix up have a 0 high-order bit
_Use_decl_annotations_
void D3DX_BC6H::SwapIndices(const EncodeParams* pEP, INTEndPntPair aEndPts[], size_t aIndices[]) void D3DX_BC6H::SwapIndices(const EncodeParams* pEP, INTEndPntPair aEndPts[], size_t aIndices[])
{ {
assert( pEP ); assert( pEP );
@ -1617,7 +1629,7 @@ void D3DX_BC6H::SwapIndices(const EncodeParams* pEP, INTEndPntPair aEndPts[], si
const size_t uHighIndexBit = uNumIndices >> 1; const size_t uHighIndexBit = uNumIndices >> 1;
assert( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES ); assert( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES );
__analysis_assume( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES ); _Analysis_assume_( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES );
for(size_t p = 0; p <= uPartitions; ++p) for(size_t p = 0; p <= uPartitions; ++p)
{ {
@ -1636,6 +1648,7 @@ void D3DX_BC6H::SwapIndices(const EncodeParams* pEP, INTEndPntPair aEndPts[], si
} }
// assign indices given a tile, shape, and quantized endpoints, return toterr for each region // assign indices given a tile, shape, and quantized endpoints, return toterr for each region
_Use_decl_annotations_
void D3DX_BC6H::AssignIndices(const EncodeParams* pEP, const INTEndPntPair aEndPts[], size_t aIndices[], float aTotErr[]) const void D3DX_BC6H::AssignIndices(const EncodeParams* pEP, const INTEndPntPair aEndPts[], size_t aIndices[], float aTotErr[]) const
{ {
assert( pEP ); assert( pEP );
@ -1643,7 +1656,7 @@ void D3DX_BC6H::AssignIndices(const EncodeParams* pEP, const INTEndPntPair aEndP
const uint8_t uNumIndices = 1 << ms_aInfo[pEP->uMode].uIndexPrec; const uint8_t uNumIndices = 1 << ms_aInfo[pEP->uMode].uIndexPrec;
assert( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES ); assert( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES );
__analysis_assume( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES ); _Analysis_assume_( uPartitions < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES );
// build list of possibles // build list of possibles
INTColor aPalette[BC6H_MAX_REGIONS][BC6H_MAX_INDICES]; INTColor aPalette[BC6H_MAX_REGIONS][BC6H_MAX_INDICES];
@ -1658,7 +1671,7 @@ void D3DX_BC6H::AssignIndices(const EncodeParams* pEP, const INTEndPntPair aEndP
{ {
const uint8_t uRegion = g_aPartitionTable[uPartitions][pEP->uShape][i]; const uint8_t uRegion = g_aPartitionTable[uPartitions][pEP->uShape][i];
assert( uRegion < BC6H_MAX_REGIONS ); assert( uRegion < BC6H_MAX_REGIONS );
__analysis_assume( uRegion < BC6H_MAX_REGIONS ); _Analysis_assume_( uRegion < BC6H_MAX_REGIONS );
float fBestErr = Norm(pEP->aIPixels[i], aPalette[uRegion][0]); float fBestErr = Norm(pEP->aIPixels[i], aPalette[uRegion][0]);
aIndices[i] = 0; aIndices[i] = 0;
@ -1676,6 +1689,7 @@ void D3DX_BC6H::AssignIndices(const EncodeParams* pEP, const INTEndPntPair aEndP
} }
} }
_Use_decl_annotations_
void D3DX_BC6H::QuantizeEndPts(const EncodeParams* pEP, INTEndPntPair* aQntEndPts) const void D3DX_BC6H::QuantizeEndPts(const EncodeParams* pEP, INTEndPntPair* aQntEndPts) const
{ {
assert( pEP && aQntEndPts ); assert( pEP && aQntEndPts );
@ -1683,7 +1697,7 @@ void D3DX_BC6H::QuantizeEndPts(const EncodeParams* pEP, INTEndPntPair* aQntEndPt
const LDRColorA& Prec = ms_aInfo[pEP->uMode].RGBAPrec[0][0]; const LDRColorA& Prec = ms_aInfo[pEP->uMode].RGBAPrec[0][0];
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC6H_MAX_REGIONS ); assert( uPartitions < BC6H_MAX_REGIONS );
__analysis_assume( uPartitions < BC6H_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC6H_MAX_REGIONS );
for(size_t p = 0; p <= uPartitions; ++p) for(size_t p = 0; p <= uPartitions; ++p)
{ {
@ -1696,6 +1710,7 @@ void D3DX_BC6H::QuantizeEndPts(const EncodeParams* pEP, INTEndPntPair* aQntEndPt
} }
} }
_Use_decl_annotations_
void D3DX_BC6H::EmitBlock(const EncodeParams* pEP, const INTEndPntPair aEndPts[], const size_t aIndices[]) void D3DX_BC6H::EmitBlock(const EncodeParams* pEP, const INTEndPntPair aEndPts[], const size_t aIndices[])
{ {
assert( pEP ); assert( pEP );
@ -1738,12 +1753,13 @@ void D3DX_BC6H::EmitBlock(const EncodeParams* pEP, const INTEndPntPair aEndPts[]
assert(uStartBit == 128); assert(uStartBit == 128);
} }
_Use_decl_annotations_
void D3DX_BC6H::Refine(EncodeParams* pEP) void D3DX_BC6H::Refine(EncodeParams* pEP)
{ {
assert( pEP ); assert( pEP );
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC6H_MAX_REGIONS ); assert( uPartitions < BC6H_MAX_REGIONS );
__analysis_assume( uPartitions < BC6H_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC6H_MAX_REGIONS );
const bool bTransformed = ms_aInfo[pEP->uMode].bTransformed; const bool bTransformed = ms_aInfo[pEP->uMode].bTransformed;
float aOrgErr[BC6H_MAX_REGIONS], aOptErr[BC6H_MAX_REGIONS]; float aOrgErr[BC6H_MAX_REGIONS], aOptErr[BC6H_MAX_REGIONS];
@ -1786,22 +1802,23 @@ void D3DX_BC6H::Refine(EncodeParams* pEP)
} }
} }
_Use_decl_annotations_
void D3DX_BC6H::GeneratePaletteUnquantized(const EncodeParams* pEP, size_t uRegion, INTColor aPalette[]) void D3DX_BC6H::GeneratePaletteUnquantized(const EncodeParams* pEP, size_t uRegion, INTColor aPalette[])
{ {
assert( pEP ); assert( pEP );
assert( uRegion < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES ); assert( uRegion < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES );
__analysis_assume( uRegion < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES ); _Analysis_assume_( uRegion < BC6H_MAX_REGIONS && pEP->uShape < BC6H_MAX_SHAPES );
const INTEndPntPair& endPts = pEP->aUnqEndPts[pEP->uShape][uRegion]; const INTEndPntPair& endPts = pEP->aUnqEndPts[pEP->uShape][uRegion];
const uint8_t uIndexPrec = ms_aInfo[pEP->uMode].uIndexPrec; const uint8_t uIndexPrec = ms_aInfo[pEP->uMode].uIndexPrec;
const uint8_t uNumIndices = 1 << uIndexPrec; const uint8_t uNumIndices = 1 << uIndexPrec;
assert( uNumIndices > 0 ); assert(uNumIndices > 0);
__analysis_assume( uNumIndices > 0 ); _Analysis_assume_(uNumIndices > 0);
const int* aWeights = nullptr; const int* aWeights = nullptr;
switch(uIndexPrec) switch(uIndexPrec)
{ {
case 3: aWeights = g_aWeights3; assert(uNumIndices <= 8); __analysis_assume(uNumIndices <= 8); break; case 3: aWeights = g_aWeights3; assert(uNumIndices <= 8); _Analysis_assume_(uNumIndices <= 8); break;
case 4: aWeights = g_aWeights4; assert(uNumIndices <= 16); __analysis_assume(uNumIndices <= 16); break; case 4: aWeights = g_aWeights4; assert(uNumIndices <= 16); _Analysis_assume_(uNumIndices <= 16); break;
default: assert(false); for(size_t i = 0; i < uNumIndices; ++i) aPalette[i] = INTColor(0,0,0); return; default: assert(false); for(size_t i = 0; i < uNumIndices; ++i) aPalette[i] = INTColor(0,0,0); return;
} }
@ -1813,6 +1830,7 @@ void D3DX_BC6H::GeneratePaletteUnquantized(const EncodeParams* pEP, size_t uRegi
} }
} }
_Use_decl_annotations_
float D3DX_BC6H::MapColors(const EncodeParams* pEP, size_t uRegion, size_t np, const size_t* auIndex) const float D3DX_BC6H::MapColors(const EncodeParams* pEP, size_t uRegion, size_t np, const size_t* auIndex) const
{ {
assert( pEP ); assert( pEP );
@ -1837,17 +1855,18 @@ float D3DX_BC6H::MapColors(const EncodeParams* pEP, size_t uRegion, size_t np, c
return fTotalErr; return fTotalErr;
} }
_Use_decl_annotations_
float D3DX_BC6H::RoughMSE(EncodeParams* pEP) const float D3DX_BC6H::RoughMSE(EncodeParams* pEP) const
{ {
assert( pEP ); assert( pEP );
assert( pEP->uShape < BC6H_MAX_SHAPES); assert( pEP->uShape < BC6H_MAX_SHAPES);
__analysis_assume( pEP->uShape < BC6H_MAX_SHAPES); _Analysis_assume_( pEP->uShape < BC6H_MAX_SHAPES);
INTEndPntPair* aEndPts = pEP->aUnqEndPts[pEP->uShape]; INTEndPntPair* aEndPts = pEP->aUnqEndPts[pEP->uShape];
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC6H_MAX_REGIONS ); assert( uPartitions < BC6H_MAX_REGIONS );
__analysis_assume( uPartitions < BC6H_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC6H_MAX_REGIONS );
size_t auPixIdx[NUM_PIXELS_PER_BLOCK]; size_t auPixIdx[NUM_PIXELS_PER_BLOCK];
@ -1904,6 +1923,7 @@ float D3DX_BC6H::RoughMSE(EncodeParams* pEP) const
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC7 Compression // BC7 Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DX_BC7::Decode(HDRColorA* pOut) const void D3DX_BC7::Decode(HDRColorA* pOut) const
{ {
assert( pOut ); assert( pOut );
@ -1916,7 +1936,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const
{ {
const uint8_t uPartitions = ms_aInfo[uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[uMode].uPartitions;
assert( uPartitions < BC7_MAX_REGIONS ); assert( uPartitions < BC7_MAX_REGIONS );
__analysis_assume( uPartitions < BC7_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC7_MAX_REGIONS );
const uint8_t uNumEndPts = (uPartitions + 1) << 1; const uint8_t uNumEndPts = (uPartitions + 1) << 1;
const uint8_t uIndexPrec = ms_aInfo[uMode].uIndexPrec; const uint8_t uIndexPrec = ms_aInfo[uMode].uIndexPrec;
@ -1926,7 +1946,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const
uint8_t P[6]; uint8_t P[6];
uint8_t uShape = GetBits(uStartBit, ms_aInfo[uMode].uPartitionBits); uint8_t uShape = GetBits(uStartBit, ms_aInfo[uMode].uPartitionBits);
assert( uShape < BC7_MAX_SHAPES ); assert( uShape < BC7_MAX_SHAPES );
__analysis_assume( uShape < BC7_MAX_SHAPES ); _Analysis_assume_( uShape < BC7_MAX_SHAPES );
uint8_t uRotation = GetBits(uStartBit, ms_aInfo[uMode].uRotationBits); uint8_t uRotation = GetBits(uStartBit, ms_aInfo[uMode].uRotationBits);
assert( uRotation < 4 ); assert( uRotation < 4 );
@ -2002,7 +2022,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const
// P-bits // P-bits
assert( ms_aInfo[uMode].uPBits <= 6 ); assert( ms_aInfo[uMode].uPBits <= 6 );
__analysis_assume( ms_aInfo[uMode].uPBits <= 6 ); _Analysis_assume_( ms_aInfo[uMode].uPBits <= 6 );
for(i = 0; i < ms_aInfo[uMode].uPBits; i++) for(i = 0; i < ms_aInfo[uMode].uPBits; i++)
{ {
if ( uStartBit > 127 ) if ( uStartBit > 127 )
@ -2111,6 +2131,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const
} }
} }
_Use_decl_annotations_
void D3DX_BC7::Encode(const HDRColorA* const pIn) void D3DX_BC7::Encode(const HDRColorA* const pIn)
{ {
assert( pIn ); assert( pIn );
@ -2131,7 +2152,7 @@ void D3DX_BC7::Encode(const HDRColorA* const pIn)
{ {
const size_t uShapes = 1 << ms_aInfo[EP.uMode].uPartitionBits; const size_t uShapes = 1 << ms_aInfo[EP.uMode].uPartitionBits;
assert( uShapes <= BC7_MAX_SHAPES ); assert( uShapes <= BC7_MAX_SHAPES );
__analysis_assume( uShapes <= BC7_MAX_SHAPES ); _Analysis_assume_( uShapes <= BC7_MAX_SHAPES );
const size_t uNumRots = 1 << ms_aInfo[EP.uMode].uRotationBits; const size_t uNumRots = 1 << ms_aInfo[EP.uMode].uRotationBits;
const size_t uNumIdxMode = 1 << ms_aInfo[EP.uMode].uIndexModeBits; const size_t uNumIdxMode = 1 << ms_aInfo[EP.uMode].uIndexModeBits;
@ -2197,6 +2218,7 @@ void D3DX_BC7::Encode(const HDRColorA* const pIn)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DX_BC7::GeneratePaletteQuantized(const EncodeParams* pEP, size_t uIndexMode, const LDREndPntPair& endPts, LDRColorA aPalette[]) const void D3DX_BC7::GeneratePaletteQuantized(const EncodeParams* pEP, size_t uIndexMode, const LDREndPntPair& endPts, LDRColorA aPalette[]) const
{ {
assert( pEP ); assert( pEP );
@ -2205,9 +2227,9 @@ void D3DX_BC7::GeneratePaletteQuantized(const EncodeParams* pEP, size_t uIndexMo
const size_t uNumIndices = 1 << uIndexPrec; const size_t uNumIndices = 1 << uIndexPrec;
const size_t uNumIndices2 = 1 << uIndexPrec2; const size_t uNumIndices2 = 1 << uIndexPrec2;
assert( uNumIndices > 0 && uNumIndices2 > 0 ); assert( uNumIndices > 0 && uNumIndices2 > 0 );
__analysis_assume( uNumIndices > 0 && uNumIndices2 > 0 ); _Analysis_assume_( uNumIndices > 0 && uNumIndices2 > 0 );
assert( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) ); assert( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) );
__analysis_assume( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) ); _Analysis_assume_( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) );
LDRColorA a = Unquantize(endPts.A, ms_aInfo[pEP->uMode].RGBAPrecWithP); LDRColorA a = Unquantize(endPts.A, ms_aInfo[pEP->uMode].RGBAPrecWithP);
LDRColorA b = Unquantize(endPts.B, ms_aInfo[pEP->uMode].RGBAPrecWithP); LDRColorA b = Unquantize(endPts.B, ms_aInfo[pEP->uMode].RGBAPrecWithP);
@ -2225,6 +2247,7 @@ void D3DX_BC7::GeneratePaletteQuantized(const EncodeParams* pEP, size_t uIndexMo
} }
} }
_Use_decl_annotations_
float D3DX_BC7::PerturbOne(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode, size_t ch, float D3DX_BC7::PerturbOne(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode, size_t ch,
const LDREndPntPair &oldEndPts, LDREndPntPair &newEndPts, float fOldErr, uint8_t do_b) const const LDREndPntPair &oldEndPts, LDREndPntPair &newEndPts, float fOldErr, uint8_t do_b) const
{ {
@ -2266,6 +2289,7 @@ float D3DX_BC7::PerturbOne(const EncodeParams* pEP, const LDRColorA aColors[], s
// perturb the endpoints at least -3 to 3. // perturb the endpoints at least -3 to 3.
// always ensure endpoint ordering is preserved (no need to overlap the scan) // always ensure endpoint ordering is preserved (no need to overlap the scan)
_Use_decl_annotations_
void D3DX_BC7::Exhaustive(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode, size_t ch, void D3DX_BC7::Exhaustive(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode, size_t ch,
float& fOrgErr, LDREndPntPair& optEndPt) const float& fOrgErr, LDREndPntPair& optEndPt) const
{ {
@ -2336,6 +2360,7 @@ void D3DX_BC7::Exhaustive(const EncodeParams* pEP, const LDRColorA aColors[], si
} }
} }
_Use_decl_annotations_
void D3DX_BC7::OptimizeOne(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode, void D3DX_BC7::OptimizeOne(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode,
float fOrgErr, const LDREndPntPair& org, LDREndPntPair& opt) const float fOrgErr, const LDREndPntPair& org, LDREndPntPair& opt) const
{ {
@ -2401,13 +2426,14 @@ void D3DX_BC7::OptimizeOne(const EncodeParams* pEP, const LDRColorA aColors[], s
Exhaustive(pEP, aColors, np, uIndexMode, ch, fOptErr, opt); Exhaustive(pEP, aColors, np, uIndexMode, ch, fOptErr, opt);
} }
_Use_decl_annotations_
void D3DX_BC7::OptimizeEndPoints(const EncodeParams* pEP, size_t uShape, size_t uIndexMode, const float afOrgErr[], void D3DX_BC7::OptimizeEndPoints(const EncodeParams* pEP, size_t uShape, size_t uIndexMode, const float afOrgErr[],
const LDREndPntPair aOrgEndPts[], LDREndPntPair aOptEndPts[]) const const LDREndPntPair aOrgEndPts[], LDREndPntPair aOptEndPts[]) const
{ {
assert( pEP ); assert( pEP );
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC7_MAX_REGIONS && uShape < BC7_MAX_SHAPES ); assert( uPartitions < BC7_MAX_REGIONS && uShape < BC7_MAX_SHAPES );
__analysis_assume( uPartitions < BC7_MAX_REGIONS && uShape < BC7_MAX_SHAPES ); _Analysis_assume_( uPartitions < BC7_MAX_REGIONS && uShape < BC7_MAX_SHAPES );
LDRColorA aPixels[NUM_PIXELS_PER_BLOCK]; LDRColorA aPixels[NUM_PIXELS_PER_BLOCK];
@ -2423,16 +2449,17 @@ void D3DX_BC7::OptimizeEndPoints(const EncodeParams* pEP, size_t uShape, size_t
} }
} }
_Use_decl_annotations_
void D3DX_BC7::AssignIndices(const EncodeParams* pEP, size_t uShape, size_t uIndexMode, LDREndPntPair endPts[], size_t aIndices[], size_t aIndices2[], void D3DX_BC7::AssignIndices(const EncodeParams* pEP, size_t uShape, size_t uIndexMode, LDREndPntPair endPts[], size_t aIndices[], size_t aIndices2[],
float afTotErr[]) const float afTotErr[]) const
{ {
assert( pEP ); assert( pEP );
assert( uShape < BC7_MAX_SHAPES ); assert( uShape < BC7_MAX_SHAPES );
__analysis_assume( uShape < BC7_MAX_SHAPES ); _Analysis_assume_( uShape < BC7_MAX_SHAPES );
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC7_MAX_REGIONS ); assert( uPartitions < BC7_MAX_REGIONS );
__analysis_assume( uPartitions < BC7_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC7_MAX_REGIONS );
const uint8_t uIndexPrec = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec2 : ms_aInfo[pEP->uMode].uIndexPrec; const uint8_t uIndexPrec = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec2 : ms_aInfo[pEP->uMode].uIndexPrec;
const uint8_t uIndexPrec2 = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec : ms_aInfo[pEP->uMode].uIndexPrec2; const uint8_t uIndexPrec2 = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec : ms_aInfo[pEP->uMode].uIndexPrec2;
@ -2440,7 +2467,7 @@ void D3DX_BC7::AssignIndices(const EncodeParams* pEP, size_t uShape, size_t uInd
const uint8_t uNumIndices2 = 1 << uIndexPrec2; const uint8_t uNumIndices2 = 1 << uIndexPrec2;
assert( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) ); assert( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) );
__analysis_assume( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) ); _Analysis_assume_( (uNumIndices <= BC7_MAX_INDICES) && (uNumIndices2 <= BC7_MAX_INDICES) );
const uint8_t uHighestIndexBit = uNumIndices >> 1; const uint8_t uHighestIndexBit = uNumIndices >> 1;
const uint8_t uHighestIndexBit2 = uNumIndices2 >> 1; const uint8_t uHighestIndexBit2 = uNumIndices2 >> 1;
@ -2458,7 +2485,7 @@ void D3DX_BC7::AssignIndices(const EncodeParams* pEP, size_t uShape, size_t uInd
{ {
uint8_t uRegion = g_aPartitionTable[uPartitions][uShape][i]; uint8_t uRegion = g_aPartitionTable[uPartitions][uShape][i];
assert( uRegion < BC7_MAX_REGIONS ); assert( uRegion < BC7_MAX_REGIONS );
__analysis_assume( uRegion < BC7_MAX_REGIONS ); _Analysis_assume_( uRegion < BC7_MAX_REGIONS );
afTotErr[uRegion] += ComputeError(pEP->aLDRPixels[i], aPalette[uRegion], uIndexPrec, uIndexPrec2, &(aIndices[i]), &(aIndices2[i])); afTotErr[uRegion] += ComputeError(pEP->aLDRPixels[i], aPalette[uRegion], uIndexPrec, uIndexPrec2, &(aIndices[i]), &(aIndices2[i]));
} }
@ -2503,12 +2530,13 @@ void D3DX_BC7::AssignIndices(const EncodeParams* pEP, size_t uShape, size_t uInd
} }
} }
_Use_decl_annotations_
void D3DX_BC7::EmitBlock(const EncodeParams* pEP, size_t uShape, size_t uRotation, size_t uIndexMode, const LDREndPntPair aEndPts[], const size_t aIndex[], const size_t aIndex2[]) void D3DX_BC7::EmitBlock(const EncodeParams* pEP, size_t uShape, size_t uRotation, size_t uIndexMode, const LDREndPntPair aEndPts[], const size_t aIndex[], const size_t aIndex2[])
{ {
assert( pEP ); assert( pEP );
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC7_MAX_REGIONS ); assert( uPartitions < BC7_MAX_REGIONS );
__analysis_assume( uPartitions < BC7_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC7_MAX_REGIONS );
const size_t uPBits = ms_aInfo[pEP->uMode].uPBits; const size_t uPBits = ms_aInfo[pEP->uMode].uPBits;
const size_t uIndexPrec = ms_aInfo[pEP->uMode].uIndexPrec; const size_t uIndexPrec = ms_aInfo[pEP->uMode].uIndexPrec;
@ -2544,12 +2572,12 @@ void D3DX_BC7::EmitBlock(const EncodeParams* pEP, size_t uShape, size_t uRotatio
SetBits(uStartBit, RGBAPrec[ch], aEndPts[i].B[ch] >> 1); SetBits(uStartBit, RGBAPrec[ch], aEndPts[i].B[ch] >> 1);
size_t idx = ep++ * uPBits / uNumEP; size_t idx = ep++ * uPBits / uNumEP;
assert(idx < (BC7_MAX_REGIONS << 1)); assert(idx < (BC7_MAX_REGIONS << 1));
__analysis_assume(idx < (BC7_MAX_REGIONS << 1)); _Analysis_assume_(idx < (BC7_MAX_REGIONS << 1));
aPVote[idx] += aEndPts[i].A[ch] & 0x01; aPVote[idx] += aEndPts[i].A[ch] & 0x01;
aCount[idx]++; aCount[idx]++;
idx = ep++ * uPBits / uNumEP; idx = ep++ * uPBits / uNumEP;
assert(idx < (BC7_MAX_REGIONS << 1)); assert(idx < (BC7_MAX_REGIONS << 1));
__analysis_assume(idx < (BC7_MAX_REGIONS << 1)); _Analysis_assume_(idx < (BC7_MAX_REGIONS << 1));
aPVote[idx] += aEndPts[i].B[ch] & 0x01; aPVote[idx] += aEndPts[i].B[ch] & 0x01;
aCount[idx]++; aCount[idx]++;
} }
@ -2589,16 +2617,17 @@ void D3DX_BC7::EmitBlock(const EncodeParams* pEP, size_t uShape, size_t uRotatio
assert(uStartBit == 128); assert(uStartBit == 128);
} }
_Use_decl_annotations_
float D3DX_BC7::Refine(const EncodeParams* pEP, size_t uShape, size_t uRotation, size_t uIndexMode) float D3DX_BC7::Refine(const EncodeParams* pEP, size_t uShape, size_t uRotation, size_t uIndexMode)
{ {
assert( pEP ); assert( pEP );
assert( uShape < BC7_MAX_SHAPES ); assert( uShape < BC7_MAX_SHAPES );
__analysis_assume( uShape < BC7_MAX_SHAPES ); _Analysis_assume_( uShape < BC7_MAX_SHAPES );
const LDREndPntPair* aEndPts = pEP->aEndPts[uShape]; const LDREndPntPair* aEndPts = pEP->aEndPts[uShape];
const size_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const size_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC7_MAX_REGIONS ); assert( uPartitions < BC7_MAX_REGIONS );
__analysis_assume( uPartitions < BC7_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC7_MAX_REGIONS );
LDREndPntPair aOrgEndPts[BC7_MAX_REGIONS]; LDREndPntPair aOrgEndPts[BC7_MAX_REGIONS];
LDREndPntPair aOptEndPts[BC7_MAX_REGIONS]; LDREndPntPair aOptEndPts[BC7_MAX_REGIONS];
@ -2637,6 +2666,7 @@ float D3DX_BC7::Refine(const EncodeParams* pEP, size_t uShape, size_t uRotation,
} }
} }
_Use_decl_annotations_
float D3DX_BC7::MapColors(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode, const LDREndPntPair& endPts, float fMinErr) const float D3DX_BC7::MapColors(const EncodeParams* pEP, const LDRColorA aColors[], size_t np, size_t uIndexMode, const LDREndPntPair& endPts, float fMinErr) const
{ {
assert( pEP ); assert( pEP );
@ -2659,16 +2689,17 @@ float D3DX_BC7::MapColors(const EncodeParams* pEP, const LDRColorA aColors[], si
return fTotalErr; return fTotalErr;
} }
_Use_decl_annotations_
float D3DX_BC7::RoughMSE(EncodeParams* pEP, size_t uShape, size_t uIndexMode) float D3DX_BC7::RoughMSE(EncodeParams* pEP, size_t uShape, size_t uIndexMode)
{ {
assert( pEP ); assert( pEP );
assert( uShape < BC7_MAX_SHAPES ); assert( uShape < BC7_MAX_SHAPES );
__analysis_assume( uShape < BC7_MAX_SHAPES ); _Analysis_assume_( uShape < BC7_MAX_SHAPES );
LDREndPntPair* aEndPts = pEP->aEndPts[uShape]; LDREndPntPair* aEndPts = pEP->aEndPts[uShape];
const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions; const uint8_t uPartitions = ms_aInfo[pEP->uMode].uPartitions;
assert( uPartitions < BC7_MAX_REGIONS ); assert( uPartitions < BC7_MAX_REGIONS );
__analysis_assume( uPartitions < BC7_MAX_REGIONS ); _Analysis_assume_( uPartitions < BC7_MAX_REGIONS );
const uint8_t uIndexPrec = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec2 : ms_aInfo[pEP->uMode].uIndexPrec; const uint8_t uIndexPrec = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec2 : ms_aInfo[pEP->uMode].uIndexPrec;
const uint8_t uIndexPrec2 = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec : ms_aInfo[pEP->uMode].uIndexPrec2; const uint8_t uIndexPrec2 = uIndexMode ? ms_aInfo[pEP->uMode].uIndexPrec : ms_aInfo[pEP->uMode].uIndexPrec2;
@ -2770,6 +2801,7 @@ float D3DX_BC7::RoughMSE(EncodeParams* pEP, size_t uShape, size_t uIndexMode)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC6H Compression // BC6H Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DXDecodeBC6HU(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC6HU(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -2777,6 +2809,7 @@ void D3DXDecodeBC6HU(XMVECTOR *pColor, const uint8_t *pBC)
reinterpret_cast< const D3DX_BC6H* >( pBC )->Decode(false, reinterpret_cast<HDRColorA*>(pColor)); reinterpret_cast< const D3DX_BC6H* >( pBC )->Decode(false, reinterpret_cast<HDRColorA*>(pColor));
} }
_Use_decl_annotations_
void D3DXDecodeBC6HS(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC6HS(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -2784,6 +2817,7 @@ void D3DXDecodeBC6HS(XMVECTOR *pColor, const uint8_t *pBC)
reinterpret_cast< const D3DX_BC6H* >( pBC )->Decode(true, reinterpret_cast<HDRColorA*>(pColor)); reinterpret_cast< const D3DX_BC6H* >( pBC )->Decode(true, reinterpret_cast<HDRColorA*>(pColor));
} }
_Use_decl_annotations_
void D3DXEncodeBC6HU(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags) void D3DXEncodeBC6HU(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
{ {
UNREFERENCED_PARAMETER(flags); UNREFERENCED_PARAMETER(flags);
@ -2792,6 +2826,7 @@ void D3DXEncodeBC6HU(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
reinterpret_cast< D3DX_BC6H* >( pBC )->Encode(false, reinterpret_cast<const HDRColorA*>(pColor)); reinterpret_cast< D3DX_BC6H* >( pBC )->Encode(false, reinterpret_cast<const HDRColorA*>(pColor));
} }
_Use_decl_annotations_
void D3DXEncodeBC6HS(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags) void D3DXEncodeBC6HS(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
{ {
UNREFERENCED_PARAMETER(flags); UNREFERENCED_PARAMETER(flags);
@ -2804,6 +2839,7 @@ void D3DXEncodeBC6HS(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// BC7 Compression // BC7 Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void D3DXDecodeBC7(XMVECTOR *pColor, const uint8_t *pBC) void D3DXDecodeBC7(XMVECTOR *pColor, const uint8_t *pBC)
{ {
assert( pColor && pBC ); assert( pColor && pBC );
@ -2811,6 +2847,7 @@ void D3DXDecodeBC7(XMVECTOR *pColor, const uint8_t *pBC)
reinterpret_cast< const D3DX_BC7* >( pBC )->Decode(reinterpret_cast<HDRColorA*>(pColor)); reinterpret_cast< const D3DX_BC7* >( pBC )->Decode(reinterpret_cast<HDRColorA*>(pColor));
} }
_Use_decl_annotations_
void D3DXEncodeBC7(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags) void D3DXEncodeBC7(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
{ {
UNREFERENCED_PARAMETER(flags); UNREFERENCED_PARAMETER(flags);
@ -2819,4 +2856,4 @@ void D3DXEncodeBC7(uint8_t *pBC, const XMVECTOR *pColor, DWORD flags)
reinterpret_cast< D3DX_BC7* >( pBC )->Encode(reinterpret_cast<const HDRColorA*>(pColor)); reinterpret_cast< D3DX_BC7* >( pBC )->Encode(reinterpret_cast<const HDRColorA*>(pColor));
} }
} // namespace } // namespace

View File

@ -27,10 +27,30 @@
#include <dxgiformat.h> #include <dxgiformat.h>
#include <d3d11.h> #include <d3d11.h>
#define DIRECTX_TEX_VERSION 100 #define DIRECTX_TEX_VERSION 101
#if defined(_MSC_VER) && (_MSC_VER<1610) && !defined(_In_reads_)
#define _Analysis_assume_(exp)
#define _In_reads_(exp)
#define _In_reads_opt_(exp)
#define _Out_writes_(exp)
#define _Out_writes_opt_(exp)
#define _In_reads_bytes_(exp)
#define _Out_writes_bytes_(exp)
#define _Out_writes_bytes_to_opt_(a,b)
#define _Inout_updates_bytes_(exp)
#define _Inout_updates_all_(exp)
#define _Outptr_
#define _When_(a,b)
#endif
#ifndef _Use_decl_annotations_
#define _Use_decl_annotations_
#endif
namespace DirectX namespace DirectX
{ {
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// DXGI Format Utilities // DXGI Format Utilities
bool IsValid( _In_ DXGI_FORMAT fmt ); bool IsValid( _In_ DXGI_FORMAT fmt );
@ -66,9 +86,9 @@ namespace DirectX
enum TEX_DIMENSION enum TEX_DIMENSION
// Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION // Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION
{ {
TEX_DIMENSION_TEXTURE1D = 2, TEX_DIMENSION_TEXTURE1D = 2,
TEX_DIMENSION_TEXTURE2D = 3, TEX_DIMENSION_TEXTURE2D = 3,
TEX_DIMENSION_TEXTURE3D = 4, TEX_DIMENSION_TEXTURE3D = 4,
}; };
enum TEX_MISC_FLAG enum TEX_MISC_FLAG
@ -147,17 +167,17 @@ namespace DirectX
// Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant) // Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant)
}; };
HRESULT GetMetadataFromDDSMemory( _In_bytecount_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags, HRESULT GetMetadataFromDDSMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
_Out_ TexMetadata& metadata ); _Out_ TexMetadata& metadata );
HRESULT GetMetadataFromDDSFile( _In_z_ LPCWSTR szFile, DWORD flags, HRESULT GetMetadataFromDDSFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
_Out_ TexMetadata& metadata ); _Out_ TexMetadata& metadata );
HRESULT GetMetadataFromTGAMemory( _In_bytecount_(size) LPCVOID pSource, _In_ size_t size, HRESULT GetMetadataFromTGAMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size,
_Out_ TexMetadata& metadata ); _Out_ TexMetadata& metadata );
HRESULT GetMetadataFromTGAFile( _In_z_ LPCWSTR szFile, HRESULT GetMetadataFromTGAFile( _In_z_ LPCWSTR szFile,
_Out_ TexMetadata& metadata ); _Out_ TexMetadata& metadata );
HRESULT GetMetadataFromWICMemory( _In_bytecount_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags, HRESULT GetMetadataFromWICMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
_Out_ TexMetadata& metadata ); _Out_ TexMetadata& metadata );
HRESULT GetMetadataFromWICFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags, HRESULT GetMetadataFromWICFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
_Out_ TexMetadata& metadata ); _Out_ TexMetadata& metadata );
@ -188,9 +208,9 @@ namespace DirectX
HRESULT InitializeCube( _In_ DXGI_FORMAT fmt, _In_ size_t width, _In_ size_t height, _In_ size_t nCubes, _In_ size_t mipLevels ); HRESULT InitializeCube( _In_ DXGI_FORMAT fmt, _In_ size_t width, _In_ size_t height, _In_ size_t nCubes, _In_ size_t mipLevels );
HRESULT InitializeFromImage( _In_ const Image& srcImage, _In_ bool allow1D = false ); HRESULT InitializeFromImage( _In_ const Image& srcImage, _In_ bool allow1D = false );
HRESULT InitializeArrayFromImages( _In_count_(nImages) const Image* images, _In_ size_t nImages, _In_ bool allow1D = false ); HRESULT InitializeArrayFromImages( _In_reads_(nImages) const Image* images, _In_ size_t nImages, _In_ bool allow1D = false );
HRESULT InitializeCubeFromImages( _In_count_(nImages) const Image* images, _In_ size_t nImages ); HRESULT InitializeCubeFromImages( _In_reads_(nImages) const Image* images, _In_ size_t nImages );
HRESULT Initialize3DFromImages( _In_count_(depth) const Image* images, _In_ size_t depth ); HRESULT Initialize3DFromImages( _In_reads_(depth) const Image* images, _In_ size_t depth );
void Release(); void Release();
@ -245,21 +265,21 @@ namespace DirectX
// Image I/O // Image I/O
// DDS operations // DDS operations
HRESULT LoadFromDDSMemory( _In_bytecount_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags, HRESULT LoadFromDDSMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image ); _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
HRESULT LoadFromDDSFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags, HRESULT LoadFromDDSFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image ); _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
HRESULT SaveToDDSMemory( _In_ const Image& image, _In_ DWORD flags, HRESULT SaveToDDSMemory( _In_ const Image& image, _In_ DWORD flags,
_Out_ Blob& blob ); _Out_ Blob& blob );
HRESULT SaveToDDSMemory( _In_count_(nimages) const Image* images, _In_ size_t nimages, _In_ const TexMetadata& metadata, _In_ DWORD flags, HRESULT SaveToDDSMemory( _In_reads_(nimages) const Image* images, _In_ size_t nimages, _In_ const TexMetadata& metadata, _In_ DWORD flags,
_Out_ Blob& blob ); _Out_ Blob& blob );
HRESULT SaveToDDSFile( _In_ const Image& image, _In_ DWORD flags, _In_z_ LPCWSTR szFile ); HRESULT SaveToDDSFile( _In_ const Image& image, _In_ DWORD flags, _In_z_ LPCWSTR szFile );
HRESULT SaveToDDSFile( _In_count_(nimages) const Image* images, _In_ size_t nimages, _In_ const TexMetadata& metadata, _In_ DWORD flags, _In_z_ LPCWSTR szFile ); HRESULT SaveToDDSFile( _In_reads_(nimages) const Image* images, _In_ size_t nimages, _In_ const TexMetadata& metadata, _In_ DWORD flags, _In_z_ LPCWSTR szFile );
// TGA operations // TGA operations
HRESULT LoadFromTGAMemory( _In_bytecount_(size) LPCVOID pSource, _In_ size_t size, HRESULT LoadFromTGAMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image ); _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
HRESULT LoadFromTGAFile( _In_z_ LPCWSTR szFile, HRESULT LoadFromTGAFile( _In_z_ LPCWSTR szFile,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image ); _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
@ -268,7 +288,7 @@ namespace DirectX
HRESULT SaveToTGAFile( _In_ const Image& image, _In_z_ LPCWSTR szFile ); HRESULT SaveToTGAFile( _In_ const Image& image, _In_z_ LPCWSTR szFile );
// WIC operations // WIC operations
HRESULT LoadFromWICMemory( _In_bytecount_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags, HRESULT LoadFromWICMemory( _In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DWORD flags,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image ); _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
HRESULT LoadFromWICFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags, HRESULT LoadFromWICFile( _In_z_ LPCWSTR szFile, _In_ DWORD flags,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image ); _Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image );
@ -310,7 +330,7 @@ namespace DirectX
}; };
HRESULT FlipRotate( _In_ const Image& srcImage, _In_ DWORD flags, _Out_ ScratchImage& image ); HRESULT FlipRotate( _In_ const Image& srcImage, _In_ DWORD flags, _Out_ ScratchImage& image );
HRESULT FlipRotate( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT FlipRotate( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DWORD flags, _Out_ ScratchImage& result ); _In_ DWORD flags, _Out_ ScratchImage& result );
// Flip and/or rotate image // Flip and/or rotate image
@ -344,27 +364,27 @@ namespace DirectX
HRESULT Resize( _In_ const Image& srcImage, _In_ size_t width, _In_ size_t height, _In_ DWORD filter, HRESULT Resize( _In_ const Image& srcImage, _In_ size_t width, _In_ size_t height, _In_ DWORD filter,
_Out_ ScratchImage& image ); _Out_ ScratchImage& image );
HRESULT Resize( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT Resize( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ size_t width, _In_ size_t height, _In_ DWORD filter, _Out_ ScratchImage& result ); _In_ size_t width, _In_ size_t height, _In_ DWORD filter, _Out_ ScratchImage& result );
// Resize the image to width x height. Defaults to Fant filtering. // Resize the image to width x height. Defaults to Fant filtering.
// Note for a complex resize, the result will always have mipLevels == 1 // Note for a complex resize, the result will always have mipLevels == 1
HRESULT Convert( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ DWORD filter, _In_ float threshold, HRESULT Convert( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ DWORD filter, _In_ float threshold,
_Out_ ScratchImage& image ); _Out_ ScratchImage& image );
HRESULT Convert( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT Convert( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DXGI_FORMAT format, _In_ DWORD filter, _In_ float threshold, _Out_ ScratchImage& result ); _In_ DXGI_FORMAT format, _In_ DWORD filter, _In_ float threshold, _Out_ ScratchImage& result );
// Convert the image to a new format // Convert the image to a new format
HRESULT GenerateMipMaps( _In_ const Image& baseImage, _In_ DWORD filter, _In_ size_t levels, HRESULT GenerateMipMaps( _In_ const Image& baseImage, _In_ DWORD filter, _In_ size_t levels,
_Out_ ScratchImage& mipChain, bool allow1D = false ); _Inout_ ScratchImage& mipChain, _In_ bool allow1D = false );
HRESULT GenerateMipMaps( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT GenerateMipMaps( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DWORD filter, _In_ size_t levels, _Out_ ScratchImage& mipChain ); _In_ DWORD filter, _In_ size_t levels, _Inout_ ScratchImage& mipChain );
// levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base image) // levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base image)
// Defaults to Fant filtering which is equivalent to a box filter // Defaults to Fant filtering which is equivalent to a box filter
HRESULT GenerateMipMaps3D( _In_count_(depth) const Image* baseImages, _In_ size_t depth, _In_ DWORD filter, _In_ size_t levels, HRESULT GenerateMipMaps3D( _In_reads_(depth) const Image* baseImages, _In_ size_t depth, _In_ DWORD filter, _In_ size_t levels,
_Out_ ScratchImage& mipChain ); _Out_ ScratchImage& mipChain );
HRESULT GenerateMipMaps3D( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT GenerateMipMaps3D( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DWORD filter, _In_ size_t levels, _Out_ ScratchImage& mipChain ); _In_ DWORD filter, _In_ size_t levels, _Out_ ScratchImage& mipChain );
// levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base image) // levels of '0' indicates a full mipchain, otherwise is generates that number of total levels (including the source base image)
// Defaults to Fant filtering which is equivalent to a box filter // Defaults to Fant filtering which is equivalent to a box filter
@ -391,12 +411,12 @@ namespace DirectX
HRESULT Compress( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ DWORD compress, _In_ float alphaRef, HRESULT Compress( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ DWORD compress, _In_ float alphaRef,
_Out_ ScratchImage& cImage ); _Out_ ScratchImage& cImage );
HRESULT Compress( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT Compress( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DXGI_FORMAT format, _In_ DWORD compress, _In_ float alphaRef, _Out_ ScratchImage& cImages ); _In_ DXGI_FORMAT format, _In_ DWORD compress, _In_ float alphaRef, _Out_ ScratchImage& cImages );
// Note that alphaRef is only used by BC1. 0.5f is a typical value to use // Note that alphaRef is only used by BC1. 0.5f is a typical value to use
HRESULT Decompress( _In_ const Image& cImage, _In_ DXGI_FORMAT format, _Out_ ScratchImage& image ); HRESULT Decompress( _In_ const Image& cImage, _In_ DXGI_FORMAT format, _Out_ ScratchImage& image );
HRESULT Decompress( _In_count_(nimages) const Image* cImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT Decompress( _In_reads_(nimages) const Image* cImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DXGI_FORMAT format, _Out_ ScratchImage& images ); _In_ DXGI_FORMAT format, _Out_ ScratchImage& images );
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
@ -428,7 +448,7 @@ namespace DirectX
HRESULT ComputeNormalMap( _In_ const Image& srcImage, _In_ DWORD flags, _In_ float amplitude, HRESULT ComputeNormalMap( _In_ const Image& srcImage, _In_ DWORD flags, _In_ float amplitude,
_In_ DXGI_FORMAT format, _Out_ ScratchImage& normalMap ); _In_ DXGI_FORMAT format, _Out_ ScratchImage& normalMap );
HRESULT ComputeNormalMap( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT ComputeNormalMap( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DWORD flags, _In_ float amplitude, _In_ DXGI_FORMAT format, _Out_ ScratchImage& normalMaps ); _In_ DWORD flags, _In_ float amplitude, _In_ DXGI_FORMAT format, _Out_ ScratchImage& normalMaps );
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
@ -447,25 +467,25 @@ namespace DirectX
HRESULT CopyRectangle( _In_ const Image& srcImage, _In_ const Rect& srcRect, _In_ const Image& dstImage, HRESULT CopyRectangle( _In_ const Image& srcImage, _In_ const Rect& srcRect, _In_ const Image& dstImage,
_In_ DWORD filter, _In_ size_t xOffset, _In_ size_t yOffset ); _In_ DWORD filter, _In_ size_t xOffset, _In_ size_t yOffset );
HRESULT ComputeMSE( _In_ const Image& image1, _In_ const Image& image2, _Out_ float& mse, _Out_opt_cap_c_(4) float* mseV ); HRESULT ComputeMSE( _In_ const Image& image1, _In_ const Image& image2, _Out_ float& mse, _Out_writes_opt_(4) float* mseV );
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// Direct3D 11 functions // Direct3D 11 functions
bool IsSupportedTexture( _In_ ID3D11Device* pDevice, _In_ const TexMetadata& metadata ); bool IsSupportedTexture( _In_ ID3D11Device* pDevice, _In_ const TexMetadata& metadata );
HRESULT CreateTexture( _In_ ID3D11Device* pDevice, _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT CreateTexture( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_Deref_out_ ID3D11Resource** ppResource ); _Outptr_ ID3D11Resource** ppResource );
HRESULT CreateShaderResourceView( _In_ ID3D11Device* pDevice, _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT CreateShaderResourceView( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_Deref_out_ ID3D11ShaderResourceView** ppSRV ); _Outptr_ ID3D11ShaderResourceView** ppSRV );
HRESULT CreateTextureEx( _In_ ID3D11Device* pDevice, _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT CreateTextureEx( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ D3D11_USAGE usage, _In_ unsigned int bindFlags, _In_ unsigned int cpuAccessFlags, _In_ unsigned int miscFlags, _In_ D3D11_USAGE usage, _In_ unsigned int bindFlags, _In_ unsigned int cpuAccessFlags, _In_ unsigned int miscFlags,
_Deref_out_ ID3D11Resource** ppResource ); _Outptr_ ID3D11Resource** ppResource );
HRESULT CreateShaderResourceViewEx( _In_ ID3D11Device* pDevice, _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT CreateShaderResourceViewEx( _In_ ID3D11Device* pDevice, _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ D3D11_USAGE usage, _In_ unsigned int bindFlags, _In_ unsigned int cpuAccessFlags, _In_ unsigned int miscFlags, _In_ D3D11_USAGE usage, _In_ unsigned int bindFlags, _In_ unsigned int cpuAccessFlags, _In_ unsigned int miscFlags,
_Deref_out_ ID3D11ShaderResourceView** ppSRV ); _Outptr_ ID3D11ShaderResourceView** ppSRV );
HRESULT CaptureTexture( _In_ ID3D11Device* pDevice, _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _Out_ ScratchImage& result ); HRESULT CaptureTexture( _In_ ID3D11Device* pDevice, _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _Out_ ScratchImage& result );

View File

@ -21,6 +21,7 @@
// DXGI Format Utilities // DXGI Format Utilities
//===================================================================================== //=====================================================================================
_Use_decl_annotations_
inline bool IsValid( DXGI_FORMAT fmt ) inline bool IsValid( DXGI_FORMAT fmt )
{ {
#ifdef DXGI_1_2_FORMATS #ifdef DXGI_1_2_FORMATS
@ -30,6 +31,7 @@ inline bool IsValid( DXGI_FORMAT fmt )
#endif #endif
} }
_Use_decl_annotations_
inline bool IsCompressed( DXGI_FORMAT fmt ) inline bool IsCompressed( DXGI_FORMAT fmt )
{ {
switch ( fmt ) switch ( fmt )
@ -62,11 +64,14 @@ inline bool IsCompressed( DXGI_FORMAT fmt )
} }
} }
_Use_decl_annotations_
inline bool IsPacked( DXGI_FORMAT fmt ) inline bool IsPacked( DXGI_FORMAT fmt )
{ {
return ( (fmt == DXGI_FORMAT_R8G8_B8G8_UNORM) || (fmt == DXGI_FORMAT_G8R8_G8B8_UNORM) ); return ( (fmt == DXGI_FORMAT_R8G8_B8G8_UNORM) || (fmt == DXGI_FORMAT_G8R8_G8B8_UNORM) );
} }
_Use_decl_annotations_
inline bool IsVideo( DXGI_FORMAT fmt ) inline bool IsVideo( DXGI_FORMAT fmt )
{ {
#ifdef DXGI_1_2_FORMATS #ifdef DXGI_1_2_FORMATS
@ -102,6 +107,7 @@ inline bool IsVideo( DXGI_FORMAT fmt )
#endif #endif
} }
_Use_decl_annotations_
inline bool IsSRGB( DXGI_FORMAT fmt ) inline bool IsSRGB( DXGI_FORMAT fmt )
{ {
switch( fmt ) switch( fmt )
@ -120,6 +126,7 @@ inline bool IsSRGB( DXGI_FORMAT fmt )
} }
} }
_Use_decl_annotations_
inline bool IsTypeless( DXGI_FORMAT fmt ) inline bool IsTypeless( DXGI_FORMAT fmt )
{ {
switch( fmt ) switch( fmt )
@ -157,7 +164,8 @@ inline bool IsTypeless( DXGI_FORMAT fmt )
} }
} }
inline size_t ComputeScanlines( _In_ DXGI_FORMAT fmt, _In_ size_t height ) _Use_decl_annotations_
inline size_t ComputeScanlines( DXGI_FORMAT fmt, size_t height )
{ {
switch ( fmt ) switch ( fmt )
{ {
@ -192,6 +200,7 @@ inline size_t ComputeScanlines( _In_ DXGI_FORMAT fmt, _In_ size_t height )
//===================================================================================== //=====================================================================================
// Image I/O // Image I/O
//===================================================================================== //=====================================================================================
_Use_decl_annotations_
inline HRESULT SaveToDDSMemory( const Image& image, DWORD flags, Blob& blob ) inline HRESULT SaveToDDSMemory( const Image& image, DWORD flags, Blob& blob )
{ {
TexMetadata mdata; TexMetadata mdata;
@ -207,6 +216,7 @@ inline HRESULT SaveToDDSMemory( const Image& image, DWORD flags, Blob& blob )
return SaveToDDSMemory( &image, 1, mdata, flags, blob ); return SaveToDDSMemory( &image, 1, mdata, flags, blob );
} }
_Use_decl_annotations_
inline HRESULT SaveToDDSFile( const Image& image, DWORD flags, LPCWSTR szFile ) inline HRESULT SaveToDDSFile( const Image& image, DWORD flags, LPCWSTR szFile )
{ {
TexMetadata mdata; TexMetadata mdata;

View File

@ -22,6 +22,7 @@
#include "bc.h" #include "bc.h"
namespace DirectX namespace DirectX
{ {
@ -432,6 +433,7 @@ static HRESULT _DecompressBC( _In_ const Image& cImage, _In_ const Image& result
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Compression // Compression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT Compress( const Image& srcImage, DXGI_FORMAT format, DWORD compress, float alphaRef, ScratchImage& image ) HRESULT Compress( const Image& srcImage, DXGI_FORMAT format, DWORD compress, float alphaRef, ScratchImage& image )
{ {
if ( IsCompressed(srcImage.format) || !IsCompressed(format) || IsTypeless(format) ) if ( IsCompressed(srcImage.format) || !IsCompressed(format) || IsTypeless(format) )
@ -490,6 +492,7 @@ HRESULT Compress( const Image& srcImage, DXGI_FORMAT format, DWORD compress, flo
return hr; return hr;
} }
_Use_decl_annotations_
HRESULT Compress( const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT Compress( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
DXGI_FORMAT format, DWORD compress, float alphaRef, ScratchImage& cImages ) DXGI_FORMAT format, DWORD compress, float alphaRef, ScratchImage& cImages )
{ {
@ -585,6 +588,7 @@ HRESULT Compress( const Image* srcImages, size_t nimages, const TexMetadata& met
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Decompression // Decompression
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT Decompress( const Image& cImage, DXGI_FORMAT format, ScratchImage& image ) HRESULT Decompress( const Image& cImage, DXGI_FORMAT format, ScratchImage& image )
{ {
if ( IsCompressed(format) || IsTypeless(format) ) if ( IsCompressed(format) || IsTypeless(format) )
@ -623,6 +627,7 @@ HRESULT Decompress( const Image& cImage, DXGI_FORMAT format, ScratchImage& image
return hr; return hr;
} }
_Use_decl_annotations_
HRESULT Decompress( const Image* cImages, size_t nimages, const TexMetadata& metadata, HRESULT Decompress( const Image* cImages, size_t nimages, const TexMetadata& metadata,
DXGI_FORMAT format, ScratchImage& images ) DXGI_FORMAT format, ScratchImage& images )
{ {

View File

@ -30,7 +30,11 @@ namespace DirectX
// Copies an image row with optional clearing of alpha value to 1.0 // Copies an image row with optional clearing of alpha value to 1.0
// (can be used in place as well) otherwise copies the image row unmodified. // (can be used in place as well) otherwise copies the image row unmodified.
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
void _CopyScanline( LPVOID pDestination, size_t outSize, LPCVOID pSource, size_t inSize, DXGI_FORMAT format, DWORD flags ) void _CopyScanline(_When_(pDestination == pSource, _Inout_updates_bytes_(outSize))
_When_(pDestination != pSource, _Out_writes_bytes_(outSize))
LPVOID pDestination, _In_ size_t outSize,
_In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize,
_In_ DXGI_FORMAT format, _In_ DWORD flags)
{ {
assert( pDestination && outSize > 0 ); assert( pDestination && outSize > 0 );
assert( pSource && inSize > 0 ); assert( pSource && inSize > 0 );
@ -253,6 +257,7 @@ void _CopyScanline( LPVOID pDestination, size_t outSize, LPCVOID pSource, size_t
// Swizzles (RGB <-> BGR) an image row with optional clearing of alpha value to 1.0 // Swizzles (RGB <-> BGR) an image row with optional clearing of alpha value to 1.0
// (can be used in place as well) otherwise copies the image row unmodified. // (can be used in place as well) otherwise copies the image row unmodified.
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void _SwizzleScanline( LPVOID pDestination, size_t outSize, LPCVOID pSource, size_t inSize, DXGI_FORMAT format, DWORD flags ) void _SwizzleScanline( LPVOID pDestination, size_t outSize, LPCVOID pSource, size_t inSize, DXGI_FORMAT format, DWORD flags )
{ {
assert( pDestination && outSize > 0 ); assert( pDestination && outSize > 0 );
@ -365,6 +370,7 @@ void _SwizzleScanline( LPVOID pDestination, size_t outSize, LPCVOID pSource, siz
// Converts an image row with optional clearing of alpha value to 1.0 // Converts an image row with optional clearing of alpha value to 1.0
// Returns true if supported, false if expansion case not supported // Returns true if supported, false if expansion case not supported
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
bool _ExpandScanline( LPVOID pDestination, size_t outSize, DXGI_FORMAT outFormat, bool _ExpandScanline( LPVOID pDestination, size_t outSize, DXGI_FORMAT outFormat,
LPCVOID pSource, size_t inSize, DXGI_FORMAT inFormat, DWORD flags ) LPCVOID pSource, size_t inSize, DXGI_FORMAT inFormat, DWORD flags )
{ {
@ -494,6 +500,7 @@ bool _ExpandScanline( LPVOID pDestination, size_t outSize, DXGI_FORMAT outFormat
}\ }\
return false; return false;
_Use_decl_annotations_
bool _LoadScanline( XMVECTOR* pDestination, size_t count, bool _LoadScanline( XMVECTOR* pDestination, size_t count,
LPCVOID pSource, size_t size, DXGI_FORMAT format ) LPCVOID pSource, size_t size, DXGI_FORMAT format )
{ {
@ -973,6 +980,7 @@ bool _LoadScanline( XMVECTOR* pDestination, size_t count,
}\ }\
return true; return true;
_Use_decl_annotations_
bool _StoreScanline( LPVOID pDestination, size_t size, DXGI_FORMAT format, bool _StoreScanline( LPVOID pDestination, size_t size, DXGI_FORMAT format,
const XMVECTOR* pSource, size_t count ) const XMVECTOR* pSource, size_t count )
{ {
@ -1434,6 +1442,7 @@ bool _StoreScanline( LPVOID pDestination, size_t size, DXGI_FORMAT format,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Convert DXGI image to/from GUID_WICPixelFormat128bppRGBAFloat (no range conversions) // Convert DXGI image to/from GUID_WICPixelFormat128bppRGBAFloat (no range conversions)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT _ConvertToR32G32B32A32( const Image& srcImage, ScratchImage& image ) HRESULT _ConvertToR32G32B32A32( const Image& srcImage, ScratchImage& image )
{ {
if ( !srcImage.pixels ) if ( !srcImage.pixels )
@ -1473,7 +1482,8 @@ HRESULT _ConvertToR32G32B32A32( const Image& srcImage, ScratchImage& image )
return S_OK; return S_OK;
} }
HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ const Image& destImage ) _Use_decl_annotations_
HRESULT _ConvertFromR32G32B32A32( const Image& srcImage, const Image& destImage )
{ {
assert( srcImage.format == DXGI_FORMAT_R32G32B32A32_FLOAT ); assert( srcImage.format == DXGI_FORMAT_R32G32B32A32_FLOAT );
@ -1498,6 +1508,7 @@ HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ const Image&
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT _ConvertFromR32G32B32A32( const Image& srcImage, DXGI_FORMAT format, ScratchImage& image ) HRESULT _ConvertFromR32G32B32A32( const Image& srcImage, DXGI_FORMAT format, ScratchImage& image )
{ {
if ( !srcImage.pixels ) if ( !srcImage.pixels )
@ -1524,6 +1535,7 @@ HRESULT _ConvertFromR32G32B32A32( const Image& srcImage, DXGI_FORMAT format, Scr
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT _ConvertFromR32G32B32A32( const Image* srcImages, size_t nimages, const TexMetadata& metadata, DXGI_FORMAT format, ScratchImage& result ) HRESULT _ConvertFromR32G32B32A32( const Image* srcImages, size_t nimages, const TexMetadata& metadata, DXGI_FORMAT format, ScratchImage& result )
{ {
if ( !srcImages ) if ( !srcImages )
@ -1816,6 +1828,7 @@ static int __cdecl _ConvertCompare( void *context, const void* ptr1, const void
else return (p1->format < p2->format ) ? -1 : 1; else return (p1->format < p2->format ) ? -1 : 1;
} }
_Use_decl_annotations_
DWORD _GetConvertFlags( DXGI_FORMAT format ) DWORD _GetConvertFlags( DXGI_FORMAT format )
{ {
#ifdef _DEBUG #ifdef _DEBUG
@ -1835,6 +1848,7 @@ DWORD _GetConvertFlags( DXGI_FORMAT format )
return (in) ? in->flags : 0; return (in) ? in->flags : 0;
} }
_Use_decl_annotations_
void _ConvertScanline( XMVECTOR* pBuffer, size_t count, DXGI_FORMAT outFormat, DXGI_FORMAT inFormat, DWORD flags ) void _ConvertScanline( XMVECTOR* pBuffer, size_t count, DXGI_FORMAT outFormat, DXGI_FORMAT inFormat, DWORD flags )
{ {
assert( pBuffer && count > 0 && (((uintptr_t)pBuffer & 0xF) == 0) ); assert( pBuffer && count > 0 && (((uintptr_t)pBuffer & 0xF) == 0) );
@ -2031,7 +2045,7 @@ static HRESULT _ConvertUsingWIC( _In_ const Image& srcImage, _In_ const WICPixel
if ( FAILED(hr) ) if ( FAILED(hr) )
return hr; return hr;
// Need to implement usage of TEX_FILTER_SRGB_IN/TEX_FILTER_SRGB_OUT // Need to add logic to use TEX_FILTER_SRGB_IN/TEX_FILTER_SRGB_OUT
BOOL canConvert = FALSE; BOOL canConvert = FALSE;
hr = FC->CanConvert( pfGUID, targetGUID, &canConvert ); hr = FC->CanConvert( pfGUID, targetGUID, &canConvert );
@ -2247,6 +2261,7 @@ static HRESULT _Convert( _In_ const Image& srcImage, _In_ DWORD filter, _In_ con
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Convert image // Convert image
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT Convert( const Image& srcImage, DXGI_FORMAT format, DWORD filter, float threshold, ScratchImage& image ) HRESULT Convert( const Image& srcImage, DXGI_FORMAT format, DWORD filter, float threshold, ScratchImage& image )
{ {
if ( (srcImage.format == format) || !IsValid( format ) ) if ( (srcImage.format == format) || !IsValid( format ) )
@ -2319,6 +2334,7 @@ HRESULT Convert( const Image& srcImage, DXGI_FORMAT format, DWORD filter, float
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Convert image (complex) // Convert image (complex)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT Convert( const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT Convert( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
DXGI_FORMAT format, DWORD filter, float threshold, ScratchImage& result ) DXGI_FORMAT format, DWORD filter, float threshold, ScratchImage& result )
{ {

View File

@ -150,6 +150,7 @@ static HRESULT _Capture( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Determine if given texture metadata is supported on the given device // Determine if given texture metadata is supported on the given device
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
bool IsSupportedTexture( ID3D11Device* pDevice, const TexMetadata& metadata ) bool IsSupportedTexture( ID3D11Device* pDevice, const TexMetadata& metadata )
{ {
if ( !pDevice ) if ( !pDevice )
@ -336,6 +337,7 @@ bool IsSupportedTexture( ID3D11Device* pDevice, const TexMetadata& metadata )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Create a texture resource // Create a texture resource
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT CreateTexture( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT CreateTexture( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
ID3D11Resource** ppResource ) ID3D11Resource** ppResource )
{ {
@ -344,6 +346,7 @@ HRESULT CreateTexture( ID3D11Device* pDevice, const Image* srcImages, size_t nim
ppResource ); ppResource );
} }
_Use_decl_annotations_
HRESULT CreateTextureEx( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT CreateTextureEx( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
D3D11_USAGE usage, unsigned int bindFlags, unsigned int cpuAccessFlags, unsigned int miscFlags, D3D11_USAGE usage, unsigned int bindFlags, unsigned int cpuAccessFlags, unsigned int miscFlags,
ID3D11Resource** ppResource ) ID3D11Resource** ppResource )
@ -530,6 +533,7 @@ HRESULT CreateTextureEx( ID3D11Device* pDevice, const Image* srcImages, size_t n
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Create a shader resource view and associated texture // Create a shader resource view and associated texture
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT CreateShaderResourceView( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT CreateShaderResourceView( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
ID3D11ShaderResourceView** ppSRV ) ID3D11ShaderResourceView** ppSRV )
{ {
@ -538,7 +542,7 @@ HRESULT CreateShaderResourceView( ID3D11Device* pDevice, const Image* srcImages,
ppSRV ); ppSRV );
} }
_Use_decl_annotations_
HRESULT CreateShaderResourceViewEx( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT CreateShaderResourceViewEx( ID3D11Device* pDevice, const Image* srcImages, size_t nimages, const TexMetadata& metadata,
D3D11_USAGE usage, unsigned int bindFlags, unsigned int cpuAccessFlags, unsigned int miscFlags, D3D11_USAGE usage, unsigned int bindFlags, unsigned int cpuAccessFlags, unsigned int miscFlags,
ID3D11ShaderResourceView** ppSRV ) ID3D11ShaderResourceView** ppSRV )
@ -627,6 +631,7 @@ HRESULT CreateShaderResourceViewEx( ID3D11Device* pDevice, const Image* srcImage
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Save a texture resource to a DDS file in memory/on disk // Save a texture resource to a DDS file in memory/on disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT CaptureTexture( ID3D11Device* pDevice, ID3D11DeviceContext* pContext, ID3D11Resource* pSource, ScratchImage& result ) HRESULT CaptureTexture( ID3D11Device* pDevice, ID3D11DeviceContext* pContext, ID3D11Resource* pSource, ScratchImage& result )
{ {
if ( !pDevice || !pContext || !pSource ) if ( !pDevice || !pContext || !pSource )

View File

@ -202,7 +202,7 @@ static DXGI_FORMAT _GetDXGIFormat( const DDS_PIXELFORMAT& ddpf, DWORD flags, _In
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Decodes DDS header including optional DX10 extended header // Decodes DDS header including optional DX10 extended header
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _DecodeDDSHeader( _In_bytecount_(size) LPCVOID pSource, size_t size, DWORD flags, _Out_ TexMetadata& metadata, static HRESULT _DecodeDDSHeader( _In_reads_bytes_(size) LPCVOID pSource, size_t size, DWORD flags, _Out_ TexMetadata& metadata,
_Inout_opt_ DWORD* convFlags ) _Inout_opt_ DWORD* convFlags )
{ {
if ( !pSource ) if ( !pSource )
@ -417,8 +417,9 @@ static HRESULT _DecodeDDSHeader( _In_bytecount_(size) LPCVOID pSource, size_t si
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Encodes DDS file header (magic value, header, optional DX10 extended header) // Encodes DDS file header (magic value, header, optional DX10 extended header)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT _EncodeDDSHeader( _In_ const TexMetadata& metadata, DWORD flags, _Use_decl_annotations_
_Out_opt_cap_x_(maxsize) LPVOID pDestination, _In_ size_t maxsize, _Out_ size_t& required ) HRESULT _EncodeDDSHeader( const TexMetadata& metadata, DWORD flags,
LPVOID pDestination, size_t maxsize, size_t& required )
{ {
assert( IsValid( metadata.format ) && !IsVideo( metadata.format ) ); assert( IsValid( metadata.format ) && !IsVideo( metadata.format ) );
@ -668,9 +669,10 @@ inline static TEXP_LEGACY_FORMAT _FindLegacyFormat( DWORD flags )
return lformat; return lformat;
} }
static bool _LegacyExpandScanline( _Out_bytecap_(outSize) LPVOID pDestination, size_t outSize, _In_ DXGI_FORMAT outFormat, _Success_(return != false)
_In_bytecount_(inSize) LPCVOID pSource, size_t inSize, _In_ TEXP_LEGACY_FORMAT inFormat, static bool _LegacyExpandScanline( _Out_writes_bytes_(outSize) LPVOID pDestination, size_t outSize, _In_ DXGI_FORMAT outFormat,
_In_opt_count_c_(256) const uint32_t* pal8, _In_ DWORD flags ) _In_reads_bytes_(inSize) LPCVOID pSource, size_t inSize, _In_ TEXP_LEGACY_FORMAT inFormat,
_In_reads_opt_(256) const uint32_t* pal8, _In_ DWORD flags )
{ {
assert( pDestination && outSize > 0 ); assert( pDestination && outSize > 0 );
assert( pSource && inSize > 0 ); assert( pSource && inSize > 0 );
@ -881,8 +883,8 @@ static bool _LegacyExpandScanline( _Out_bytecap_(outSize) LPVOID pDestination, s
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Converts or copies image data from pPixels into scratch image data // Converts or copies image data from pPixels into scratch image data
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _CopyImage( _In_bytecount_(size) const void* pPixels, _In_ size_t size, static HRESULT _CopyImage( _In_reads_bytes_(size) const void* pPixels, _In_ size_t size,
_In_ const TexMetadata& metadata, _In_ DWORD cpFlags, _In_ DWORD convFlags, _In_opt_count_c_(256) const uint32_t *pal8, _In_ const ScratchImage& image ) _In_ const TexMetadata& metadata, _In_ DWORD cpFlags, _In_ DWORD convFlags, _In_reads_opt_(256) const uint32_t *pal8, _In_ const ScratchImage& image )
{ {
assert( pPixels ); assert( pPixels );
assert( image.GetPixels() ); assert( image.GetPixels() );
@ -1146,6 +1148,7 @@ static HRESULT _CopyImageInPlace( DWORD convFlags, _In_ const ScratchImage& imag
// Obtain metadata from DDS file in memory/on disk // Obtain metadata from DDS file in memory/on disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT GetMetadataFromDDSMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata& metadata ) HRESULT GetMetadataFromDDSMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata& metadata )
{ {
if ( !pSource || size == 0 ) if ( !pSource || size == 0 )
@ -1154,6 +1157,7 @@ HRESULT GetMetadataFromDDSMemory( LPCVOID pSource, size_t size, DWORD flags, Tex
return _DecodeDDSHeader( pSource, size, flags, metadata, 0 ); return _DecodeDDSHeader( pSource, size, flags, metadata, 0 );
} }
_Use_decl_annotations_
HRESULT GetMetadataFromDDSFile( LPCWSTR szFile, DWORD flags, TexMetadata& metadata ) HRESULT GetMetadataFromDDSFile( LPCWSTR szFile, DWORD flags, TexMetadata& metadata )
{ {
if ( !szFile ) if ( !szFile )
@ -1216,6 +1220,7 @@ HRESULT GetMetadataFromDDSFile( LPCWSTR szFile, DWORD flags, TexMetadata& metada
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Load a DDS file in memory // Load a DDS file in memory
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT LoadFromDDSMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata* metadata, ScratchImage& image ) HRESULT LoadFromDDSMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata* metadata, ScratchImage& image )
{ {
if ( !pSource || size == 0 ) if ( !pSource || size == 0 )
@ -1268,6 +1273,7 @@ HRESULT LoadFromDDSMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadat
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Load a DDS file from disk // Load a DDS file from disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT LoadFromDDSFile( LPCWSTR szFile, DWORD flags, TexMetadata* metadata, ScratchImage& image ) HRESULT LoadFromDDSFile( LPCWSTR szFile, DWORD flags, TexMetadata* metadata, ScratchImage& image )
{ {
if ( !szFile ) if ( !szFile )
@ -1442,6 +1448,7 @@ HRESULT LoadFromDDSFile( LPCWSTR szFile, DWORD flags, TexMetadata* metadata, Scr
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Save a DDS file to memory // Save a DDS file to memory
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT SaveToDDSMemory( const Image* images, size_t nimages, const TexMetadata& metadata, DWORD flags, Blob& blob ) HRESULT SaveToDDSMemory( const Image* images, size_t nimages, const TexMetadata& metadata, DWORD flags, Blob& blob )
{ {
if ( !images || (nimages == 0) ) if ( !images || (nimages == 0) )
@ -1569,6 +1576,7 @@ HRESULT SaveToDDSMemory( const Image* images, size_t nimages, const TexMetadata&
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Save a DDS file to disk // Save a DDS file to disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT SaveToDDSFile( const Image* images, size_t nimages, const TexMetadata& metadata, DWORD flags, LPCWSTR szFile ) HRESULT SaveToDDSFile( const Image* images, size_t nimages, const TexMetadata& metadata, DWORD flags, LPCWSTR szFile )
{ {
if ( !szFile ) if ( !szFile )

View File

@ -126,6 +126,7 @@ static HRESULT _PerformFlipRotateViaF32( _In_ const Image& srcImage, _In_ DWORD
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Flip/rotate image // Flip/rotate image
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT FlipRotate( const Image& srcImage, DWORD flags, ScratchImage& image ) HRESULT FlipRotate( const Image& srcImage, DWORD flags, ScratchImage& image )
{ {
if ( !srcImage.pixels ) if ( !srcImage.pixels )
@ -207,6 +208,7 @@ HRESULT FlipRotate( const Image& srcImage, DWORD flags, ScratchImage& image )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Flip/rotate image (complex) // Flip/rotate image (complex)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT FlipRotate( const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT FlipRotate( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
DWORD flags, ScratchImage& result ) DWORD flags, ScratchImage& result )
{ {

View File

@ -24,6 +24,7 @@ extern bool _CalculateMipLevels3D( _In_ size_t width, _In_ size_t height, _In_ s
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Determines number of image array entries and pixel size // Determines number of image array entries and pixel size
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void _DetermineImageArray( const TexMetadata& metadata, DWORD cpFlags, void _DetermineImageArray( const TexMetadata& metadata, DWORD cpFlags,
size_t& nImages, size_t& pixelSize ) size_t& nImages, size_t& pixelSize )
{ {
@ -102,6 +103,7 @@ void _DetermineImageArray( const TexMetadata& metadata, DWORD cpFlags,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Fills in the image array entries // Fills in the image array entries
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
bool _SetupImageArray( uint8_t *pMemory, size_t pixelSize, bool _SetupImageArray( uint8_t *pMemory, size_t pixelSize,
const TexMetadata& metadata, DWORD cpFlags, const TexMetadata& metadata, DWORD cpFlags,
Image* images, size_t nImages ) Image* images, size_t nImages )
@ -229,6 +231,7 @@ bool _SetupImageArray( uint8_t *pMemory, size_t pixelSize,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Methods // Methods
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT ScratchImage::Initialize( const TexMetadata& mdata ) HRESULT ScratchImage::Initialize( const TexMetadata& mdata )
{ {
if ( !IsValid(mdata.format) || IsVideo(mdata.format) ) if ( !IsValid(mdata.format) || IsVideo(mdata.format) )
@ -309,6 +312,7 @@ HRESULT ScratchImage::Initialize( const TexMetadata& mdata )
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::Initialize1D( DXGI_FORMAT fmt, size_t length, size_t arraySize, size_t mipLevels ) HRESULT ScratchImage::Initialize1D( DXGI_FORMAT fmt, size_t length, size_t arraySize, size_t mipLevels )
{ {
if ( !IsValid(fmt) || IsVideo(fmt) || !length || !arraySize ) if ( !IsValid(fmt) || IsVideo(fmt) || !length || !arraySize )
@ -324,6 +328,7 @@ HRESULT ScratchImage::Initialize1D( DXGI_FORMAT fmt, size_t length, size_t array
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::Initialize2D( DXGI_FORMAT fmt, size_t width, size_t height, size_t arraySize, size_t mipLevels ) HRESULT ScratchImage::Initialize2D( DXGI_FORMAT fmt, size_t width, size_t height, size_t arraySize, size_t mipLevels )
{ {
if ( !IsValid(fmt) || IsVideo(fmt) || !width || !height || !arraySize ) if ( !IsValid(fmt) || IsVideo(fmt) || !width || !height || !arraySize )
@ -369,6 +374,7 @@ HRESULT ScratchImage::Initialize2D( DXGI_FORMAT fmt, size_t width, size_t height
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::Initialize3D( DXGI_FORMAT fmt, size_t width, size_t height, size_t depth, size_t mipLevels ) HRESULT ScratchImage::Initialize3D( DXGI_FORMAT fmt, size_t width, size_t height, size_t depth, size_t mipLevels )
{ {
if ( !IsValid(fmt) || IsVideo(fmt) || !width || !height || !depth ) if ( !IsValid(fmt) || IsVideo(fmt) || !width || !height || !depth )
@ -417,6 +423,7 @@ HRESULT ScratchImage::Initialize3D( DXGI_FORMAT fmt, size_t width, size_t height
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::InitializeCube( DXGI_FORMAT fmt, size_t width, size_t height, size_t nCubes, size_t mipLevels ) HRESULT ScratchImage::InitializeCube( DXGI_FORMAT fmt, size_t width, size_t height, size_t nCubes, size_t mipLevels )
{ {
if ( !IsValid(fmt) || IsVideo(fmt) || !width || !height || !nCubes ) if ( !IsValid(fmt) || IsVideo(fmt) || !width || !height || !nCubes )
@ -432,6 +439,7 @@ HRESULT ScratchImage::InitializeCube( DXGI_FORMAT fmt, size_t width, size_t heig
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::InitializeFromImage( const Image& srcImage, bool allow1D ) HRESULT ScratchImage::InitializeFromImage( const Image& srcImage, bool allow1D )
{ {
HRESULT hr = ( srcImage.height > 1 || !allow1D ) HRESULT hr = ( srcImage.height > 1 || !allow1D )
@ -459,6 +467,7 @@ HRESULT ScratchImage::InitializeFromImage( const Image& srcImage, bool allow1D )
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::InitializeArrayFromImages( const Image* images, size_t nImages, bool allow1D ) HRESULT ScratchImage::InitializeArrayFromImages( const Image* images, size_t nImages, bool allow1D )
{ {
if ( !images || !nImages ) if ( !images || !nImages )
@ -509,6 +518,7 @@ HRESULT ScratchImage::InitializeArrayFromImages( const Image* images, size_t nIm
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::InitializeCubeFromImages( const Image* images, size_t nImages ) HRESULT ScratchImage::InitializeCubeFromImages( const Image* images, size_t nImages )
{ {
if ( !images || !nImages ) if ( !images || !nImages )
@ -527,6 +537,7 @@ HRESULT ScratchImage::InitializeCubeFromImages( const Image* images, size_t nIma
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ScratchImage::Initialize3DFromImages( const Image* images, size_t depth ) HRESULT ScratchImage::Initialize3DFromImages( const Image* images, size_t depth )
{ {
if ( !images || !depth ) if ( !images || !depth )
@ -594,6 +605,7 @@ void ScratchImage::Release()
memset(&_metadata, 0, sizeof(_metadata)); memset(&_metadata, 0, sizeof(_metadata));
} }
_Use_decl_annotations_
bool ScratchImage::OverrideFormat( DXGI_FORMAT f ) bool ScratchImage::OverrideFormat( DXGI_FORMAT f )
{ {
if ( !_image ) if ( !_image )
@ -620,6 +632,7 @@ bool ScratchImage::OverrideFormat( DXGI_FORMAT f )
return true; return true;
} }
_Use_decl_annotations_
const Image* ScratchImage::GetImage(size_t mip, size_t item, size_t slice) const const Image* ScratchImage::GetImage(size_t mip, size_t item, size_t slice) const
{ {
if ( mip >= _metadata.mipLevels ) if ( mip >= _metadata.mipLevels )

View File

@ -29,7 +29,7 @@ inline static bool ispow2( _In_ size_t x )
return ((x != 0) && !(x & (x - 1))); return ((x != 0) && !(x & (x - 1)));
} }
static size_t _CountMips( _In_ size_t width, _In_ size_t height) static size_t _CountMips( _In_ size_t width, _In_ size_t height )
{ {
size_t mipLevels = 1; size_t mipLevels = 1;
@ -66,7 +66,7 @@ bool _CalculateMipLevels( _In_ size_t width, _In_ size_t height, _Inout_ size_t&
return true; return true;
} }
static size_t _CountMips3D( _In_ size_t width, _In_ size_t height, _In_ size_t depth) static size_t _CountMips3D( _In_ size_t width, _In_ size_t height, _In_ size_t depth )
{ {
size_t mipLevels = 1; size_t mipLevels = 1;
@ -337,6 +337,7 @@ HRESULT _ResizeSeparateColorAndAlpha( _In_ IWICImagingFactory* pWIC, _In_ IWICBi
} }
else else
{ {
#pragma prefast( suppress : 26014, "No overflow possible here" );
memcpy_s( colorWithAlphaData + colorWithAlphaIndex, colorWithAlphaBytesPerPixel, colorData + colorIndex, colorBytesInPixel ); memcpy_s( colorWithAlphaData + colorWithAlphaIndex, colorWithAlphaBytesPerPixel, colorData + colorIndex, colorBytesInPixel );
} }
} }
@ -486,7 +487,7 @@ static HRESULT _GenerateMipMapsUsingWIC( _In_ const Image& baseImage, _In_ DWORD
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Generate volume mip-map helpers // Generate volume mip-map helpers
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _Setup3DMips( _In_count_(depth) const Image* baseImages, _In_ size_t depth, size_t levels, static HRESULT _Setup3DMips( _In_reads_(depth) const Image* baseImages, _In_ size_t depth, size_t levels,
_Out_ ScratchImage& mipChain ) _Out_ ScratchImage& mipChain )
{ {
if ( !baseImages || !depth ) if ( !baseImages || !depth )
@ -841,6 +842,7 @@ static HRESULT _Generate3DMipsBoxFilter( _In_ size_t depth, _In_ size_t levels,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Generate mipmap chain // Generate mipmap chain
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT GenerateMipMaps( const Image& baseImage, DWORD filter, size_t levels, ScratchImage& mipChain, bool allow1D ) HRESULT GenerateMipMaps( const Image& baseImage, DWORD filter, size_t levels, ScratchImage& mipChain, bool allow1D )
{ {
if ( !IsValid( baseImage.format ) ) if ( !IsValid( baseImage.format ) )
@ -908,6 +910,7 @@ HRESULT GenerateMipMaps( const Image& baseImage, DWORD filter, size_t levels, Sc
} }
} }
_Use_decl_annotations_
HRESULT GenerateMipMaps( const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT GenerateMipMaps( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
DWORD filter, size_t levels, ScratchImage& mipChain ) DWORD filter, size_t levels, ScratchImage& mipChain )
{ {
@ -1010,6 +1013,7 @@ HRESULT GenerateMipMaps( const Image* srcImages, size_t nimages, const TexMetada
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Generate mipmap chain for volume texture // Generate mipmap chain for volume texture
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT GenerateMipMaps3D( const Image* baseImages, size_t depth, DWORD filter, size_t levels, ScratchImage& mipChain ) HRESULT GenerateMipMaps3D( const Image* baseImages, size_t depth, DWORD filter, size_t levels, ScratchImage& mipChain )
{ {
if ( !baseImages || !depth ) if ( !baseImages || !depth )
@ -1083,6 +1087,7 @@ HRESULT GenerateMipMaps3D( const Image* baseImages, size_t depth, DWORD filter,
} }
} }
_Use_decl_annotations_
HRESULT GenerateMipMaps3D( const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT GenerateMipMaps3D( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
DWORD filter, size_t levels, ScratchImage& mipChain ) DWORD filter, size_t levels, ScratchImage& mipChain )
{ {

View File

@ -20,7 +20,7 @@ namespace DirectX
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _ComputeMSE( _In_ const Image& image1, _In_ const Image& image2, static HRESULT _ComputeMSE( _In_ const Image& image1, _In_ const Image& image2,
_Out_ float& mse, _Out_opt_cap_c_(4) float* mseV ) _Out_ float& mse, _Out_writes_opt_(4) float* mseV )
{ {
if ( !image1.pixels || !image2.pixels ) if ( !image1.pixels || !image2.pixels )
return E_POINTER; return E_POINTER;
@ -89,6 +89,7 @@ static HRESULT _ComputeMSE( _In_ const Image& image1, _In_ const Image& image2,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Copies a rectangle from one image into another // Copies a rectangle from one image into another
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT CopyRectangle( const Image& srcImage, const Rect& srcRect, const Image& dstImage, DWORD filter, size_t xOffset, size_t yOffset ) HRESULT CopyRectangle( const Image& srcImage, const Rect& srcRect, const Image& dstImage, DWORD filter, size_t xOffset, size_t yOffset )
{ {
if ( !srcImage.pixels || !dstImage.pixels ) if ( !srcImage.pixels || !dstImage.pixels )
@ -193,6 +194,7 @@ HRESULT CopyRectangle( const Image& srcImage, const Rect& srcRect, const Image&
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Computes the Mean-Squared-Error (MSE) between two images // Computes the Mean-Squared-Error (MSE) between two images
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT ComputeMSE( const Image& image1, const Image& image2, float& mse, float* mseV ) HRESULT ComputeMSE( const Image& image1, const Image& image2, float& mse, float* mseV )
{ {
if ( !image1.pixels || !image2.pixels ) if ( !image1.pixels || !image2.pixels )

View File

@ -48,7 +48,7 @@ static inline float _EvaluateColor( _In_ FXMVECTOR val, _In_ DWORD flags )
} }
} }
static void _EvaluateRow( _In_count_(width) const XMVECTOR* pSource, _Out_cap_(width+2) float* pDest, static void _EvaluateRow( _In_reads_(width) const XMVECTOR* pSource, _Out_writes_(width+2) float* pDest,
_In_ size_t width, _In_ DWORD flags ) _In_ size_t width, _In_ DWORD flags )
{ {
assert( pSource && pDest ); assert( pSource && pDest );
@ -253,6 +253,7 @@ static HRESULT _ComputeNMap( _In_ const Image& srcImage, _In_ DWORD flags, _In_
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Generates a normal map from a height-map // Generates a normal map from a height-map
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT ComputeNormalMap( const Image& srcImage, DWORD flags, float amplitude, HRESULT ComputeNormalMap( const Image& srcImage, DWORD flags, float amplitude,
DXGI_FORMAT format, ScratchImage& normalMap ) DXGI_FORMAT format, ScratchImage& normalMap )
{ {
@ -301,6 +302,7 @@ HRESULT ComputeNormalMap( const Image& srcImage, DWORD flags, float amplitude,
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT ComputeNormalMap( const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT ComputeNormalMap( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
DWORD flags, float amplitude, DXGI_FORMAT format, ScratchImage& normalMaps ) DWORD flags, float amplitude, DXGI_FORMAT format, ScratchImage& normalMaps )
{ {

View File

@ -122,9 +122,10 @@ namespace DirectX
void _DetermineImageArray( _In_ const TexMetadata& metadata, _In_ DWORD cpFlags, void _DetermineImageArray( _In_ const TexMetadata& metadata, _In_ DWORD cpFlags,
_Out_ size_t& nImages, _Out_ size_t& pixelSize ); _Out_ size_t& nImages, _Out_ size_t& pixelSize );
bool _SetupImageArray( _In_bytecount_(pixelSize) uint8_t *pMemory, _In_ size_t pixelSize, _Success_(return != false)
bool _SetupImageArray( _In_reads_bytes_(pixelSize) uint8_t *pMemory, _In_ size_t pixelSize,
_In_ const TexMetadata& metadata, _In_ DWORD cpFlags, _In_ const TexMetadata& metadata, _In_ DWORD cpFlags,
_Out_cap_(nImages) Image* images, _In_ size_t nImages ); _Out_writes_(nImages) Image* images, _In_ size_t nImages );
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// Conversion helper functions // Conversion helper functions
@ -160,38 +161,45 @@ namespace DirectX
DWORD _GetConvertFlags( _In_ DXGI_FORMAT format ); DWORD _GetConvertFlags( _In_ DXGI_FORMAT format );
void _CopyScanline( _Out_bytecap_(outSize) LPVOID pDestination, _In_ size_t outSize, void _CopyScanline( _When_(pDestination == pSource, _Inout_updates_bytes_(outSize))
_In_bytecount_(inSize) LPCVOID pSource, _In_ size_t inSize, _When_(pDestination != pSource, _Out_writes_bytes_(outSize))
LPVOID pDestination, _In_ size_t outSize,
_In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize,
_In_ DXGI_FORMAT format, _In_ DWORD flags ); _In_ DXGI_FORMAT format, _In_ DWORD flags );
void _SwizzleScanline( _Out_bytecap_(outSize) LPVOID pDestination, _In_ size_t outSize, void _SwizzleScanline( _When_(pDestination == pSource, _In_)
_In_bytecount_(inSize) LPCVOID pSource, _In_ size_t inSize, _When_(pDestination != pSource, _Out_writes_bytes_(outSize))
LPVOID pDestination, _In_ size_t outSize,
_In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize,
_In_ DXGI_FORMAT format, _In_ DWORD flags ); _In_ DXGI_FORMAT format, _In_ DWORD flags );
bool _ExpandScanline( _Out_bytecap_(outSize) LPVOID pDestination, _In_ size_t outSize, _Success_(return != false)
bool _ExpandScanline( _Out_writes_bytes_(outSize) LPVOID pDestination, _In_ size_t outSize,
_In_ DXGI_FORMAT outFormat, _In_ DXGI_FORMAT outFormat,
_In_bytecount_(inSize) LPCVOID pSource, _In_ size_t inSize, _In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize,
_In_ DXGI_FORMAT inFormat, _In_ DWORD flags ); _In_ DXGI_FORMAT inFormat, _In_ DWORD flags );
bool _LoadScanline( _Out_cap_(count) XMVECTOR* pDestination, _In_ size_t count, _Success_(return != false)
_In_bytecount_(size) LPCVOID pSource, _In_ size_t size, _In_ DXGI_FORMAT format ); bool _LoadScanline( _Out_writes_(count) XMVECTOR* pDestination, _In_ size_t count,
_In_reads_bytes_(size) LPCVOID pSource, _In_ size_t size, _In_ DXGI_FORMAT format );
bool _StoreScanline( _Out_bytecap_(size) LPVOID pDestination, _In_ size_t size, _In_ DXGI_FORMAT format, _Success_(return != false)
_In_count_(count) const XMVECTOR* pSource, _In_ size_t count ); bool _StoreScanline( LPVOID pDestination, _In_ size_t size, _In_ DXGI_FORMAT format,
_In_reads_(count) const XMVECTOR* pSource, _In_ size_t count );
HRESULT _ConvertToR32G32B32A32( _In_ const Image& srcImage, _Inout_ ScratchImage& image ); HRESULT _ConvertToR32G32B32A32( _In_ const Image& srcImage, _Inout_ ScratchImage& image );
HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ const Image& destImage ); HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ const Image& destImage );
HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _Inout_ ScratchImage& image ); HRESULT _ConvertFromR32G32B32A32( _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _Inout_ ScratchImage& image );
HRESULT _ConvertFromR32G32B32A32( _In_count_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata, HRESULT _ConvertFromR32G32B32A32( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DXGI_FORMAT format, _Out_ ScratchImage& result ); _In_ DXGI_FORMAT format, _Out_ ScratchImage& result );
void _ConvertScanline( _Inout_count_(count) XMVECTOR* pBuffer, _In_ size_t count, void _ConvertScanline( _Inout_updates_all_(count) XMVECTOR* pBuffer, _In_ size_t count,
_In_ DXGI_FORMAT outFormat, _In_ DXGI_FORMAT inFormat, _In_ DWORD flags ); _In_ DXGI_FORMAT outFormat, _In_ DXGI_FORMAT inFormat, _In_ DWORD flags );
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// DDS helper functions // DDS helper functions
HRESULT _EncodeDDSHeader( _In_ const TexMetadata& metadata, DWORD flags, HRESULT _EncodeDDSHeader( _In_ const TexMetadata& metadata, DWORD flags,
_Out_opt_cap_x_(maxsize) LPVOID pDestination, _In_ size_t maxsize, _Out_ size_t& required ); _Out_writes_bytes_to_opt_(maxsize, required) LPVOID pDestination, _In_ size_t maxsize, _Out_ size_t& required );
}; // namespace }; // namespace

View File

@ -159,6 +159,7 @@ static HRESULT _PerformResizeViaF32( _In_ const Image& srcImage, _In_ DWORD filt
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Resize image // Resize image
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT Resize( const Image& srcImage, size_t width, size_t height, DWORD filter, ScratchImage& image ) HRESULT Resize( const Image& srcImage, size_t width, size_t height, DWORD filter, ScratchImage& image )
{ {
if ( width == 0 || height == 0 ) if ( width == 0 || height == 0 )
@ -216,6 +217,7 @@ HRESULT Resize( const Image& srcImage, size_t width, size_t height, DWORD filter
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Resize image (complex) // Resize image (complex)
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT Resize( const Image* srcImages, size_t nimages, const TexMetadata& metadata, HRESULT Resize( const Image* srcImages, size_t nimages, const TexMetadata& metadata,
size_t width, size_t height, DWORD filter, ScratchImage& result ) size_t width, size_t height, DWORD filter, ScratchImage& result )
{ {

View File

@ -116,7 +116,7 @@ namespace DirectX
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Decodes TGA header // Decodes TGA header
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _DecodeTGAHeader( _In_bytecount_(size) LPCVOID pSource, size_t size, _Out_ TexMetadata& metadata, size_t& offset, static HRESULT _DecodeTGAHeader( _In_reads_bytes_(size) LPCVOID pSource, size_t size, _Out_ TexMetadata& metadata, size_t& offset,
_Inout_opt_ DWORD* convFlags ) _Inout_opt_ DWORD* convFlags )
{ {
if ( !pSource ) if ( !pSource )
@ -253,7 +253,7 @@ static HRESULT _SetAlphaChannelToOpaque( _In_ const Image* image )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Uncompress pixel data from a TGA into the target image // Uncompress pixel data from a TGA into the target image
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _UncompressPixels( _In_bytecount_(size) LPCVOID pSource, size_t size, _In_ const Image* image, DWORD convFlags ) static HRESULT _UncompressPixels( _In_reads_bytes_(size) LPCVOID pSource, size_t size, _In_ const Image* image, _In_ DWORD convFlags )
{ {
assert( pSource && size > 0 ); assert( pSource && size > 0 );
@ -573,7 +573,7 @@ static HRESULT _UncompressPixels( _In_bytecount_(size) LPCVOID pSource, size_t s
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Copies pixel data from a TGA into the target image // Copies pixel data from a TGA into the target image
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _CopyPixels( _In_bytecount_(size) LPCVOID pSource, size_t size, _In_ const Image* image, DWORD convFlags ) static HRESULT _CopyPixels( _In_reads_bytes_(size) LPCVOID pSource, size_t size, _In_ const Image* image, _In_ DWORD convFlags )
{ {
assert( pSource && size > 0 ); assert( pSource && size > 0 );
@ -737,7 +737,7 @@ static HRESULT _CopyPixels( _In_bytecount_(size) LPCVOID pSource, size_t size, _
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Encodes TGA file header // Encodes TGA file header
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _EncodeTGAHeader( _In_ const Image& image, _Out_ TGA_HEADER& header, DWORD& convFlags ) static HRESULT _EncodeTGAHeader( _In_ const Image& image, _Out_ TGA_HEADER& header, _Inout_ DWORD& convFlags )
{ {
assert( IsValid( image.format ) && !IsVideo( image.format ) ); assert( IsValid( image.format ) && !IsVideo( image.format ) );
@ -802,8 +802,8 @@ static HRESULT _EncodeTGAHeader( _In_ const Image& image, _Out_ TGA_HEADER& head
// Copies BGRX data to form BGR 24bpp data // Copies BGRX data to form BGR 24bpp data
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#pragma warning(suppress: 6001 6101) // In the case where outSize is insufficient we do not write to pDestination #pragma warning(suppress: 6001 6101) // In the case where outSize is insufficient we do not write to pDestination
static void _Copy24bppScanline( _Out_bytecap_(outSize) LPVOID pDestination, _In_ size_t outSize, static void _Copy24bppScanline( _Out_writes_bytes_(outSize) LPVOID pDestination, _In_ size_t outSize,
_In_bytecount_(inSize) LPCVOID pSource, _In_ size_t inSize ) _In_reads_bytes_(inSize) LPCVOID pSource, _In_ size_t inSize )
{ {
assert( pDestination && outSize > 0 ); assert( pDestination && outSize > 0 );
assert( pSource && inSize > 0 ); assert( pSource && inSize > 0 );
@ -836,6 +836,7 @@ static void _Copy24bppScanline( _Out_bytecap_(outSize) LPVOID pDestination, _In_
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Obtain metadata from TGA file in memory/on disk // Obtain metadata from TGA file in memory/on disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT GetMetadataFromTGAMemory( LPCVOID pSource, size_t size, TexMetadata& metadata ) HRESULT GetMetadataFromTGAMemory( LPCVOID pSource, size_t size, TexMetadata& metadata )
{ {
if ( !pSource || size == 0 ) if ( !pSource || size == 0 )
@ -845,6 +846,7 @@ HRESULT GetMetadataFromTGAMemory( LPCVOID pSource, size_t size, TexMetadata& met
return _DecodeTGAHeader( pSource, size, metadata, offset, 0 ); return _DecodeTGAHeader( pSource, size, metadata, offset, 0 );
} }
_Use_decl_annotations_
HRESULT GetMetadataFromTGAFile( LPCWSTR szFile, TexMetadata& metadata ) HRESULT GetMetadataFromTGAFile( LPCWSTR szFile, TexMetadata& metadata )
{ {
if ( !szFile ) if ( !szFile )
@ -906,6 +908,7 @@ HRESULT GetMetadataFromTGAFile( LPCWSTR szFile, TexMetadata& metadata )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Load a TGA file in memory // Load a TGA file in memory
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT LoadFromTGAMemory( LPCVOID pSource, size_t size, TexMetadata* metadata, ScratchImage& image ) HRESULT LoadFromTGAMemory( LPCVOID pSource, size_t size, TexMetadata* metadata, ScratchImage& image )
{ {
if ( !pSource || size == 0 ) if ( !pSource || size == 0 )
@ -959,6 +962,7 @@ HRESULT LoadFromTGAMemory( LPCVOID pSource, size_t size, TexMetadata* metadata,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Load a TGA file from disk // Load a TGA file from disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT LoadFromTGAFile( LPCWSTR szFile, TexMetadata* metadata, ScratchImage& image ) HRESULT LoadFromTGAFile( LPCWSTR szFile, TexMetadata* metadata, ScratchImage& image )
{ {
if ( !szFile ) if ( !szFile )
@ -1208,6 +1212,7 @@ HRESULT LoadFromTGAFile( LPCWSTR szFile, TexMetadata* metadata, ScratchImage& im
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Save a TGA file to memory // Save a TGA file to memory
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT SaveToTGAMemory( const Image& image, Blob& blob ) HRESULT SaveToTGAMemory( const Image& image, Blob& blob )
{ {
if ( !image.pixels ) if ( !image.pixels )
@ -1273,6 +1278,7 @@ HRESULT SaveToTGAMemory( const Image& image, Blob& blob )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Save a TGA file to disk // Save a TGA file to disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT SaveToTGAFile( const Image& image, LPCWSTR szFile ) HRESULT SaveToTGAFile( const Image& image, LPCWSTR szFile )
{ {
if ( !szFile ) if ( !szFile )

View File

@ -61,6 +61,7 @@ namespace DirectX
// WIC Utilities // WIC Utilities
//===================================================================================== //=====================================================================================
_Use_decl_annotations_
DXGI_FORMAT _WICToDXGI( const GUID& guid ) DXGI_FORMAT _WICToDXGI( const GUID& guid )
{ {
for( size_t i=0; i < _countof(g_WICFormats); ++i ) for( size_t i=0; i < _countof(g_WICFormats); ++i )
@ -80,6 +81,7 @@ DXGI_FORMAT _WICToDXGI( const GUID& guid )
return DXGI_FORMAT_UNKNOWN; return DXGI_FORMAT_UNKNOWN;
} }
_Use_decl_annotations_
bool _DXGIToWIC( DXGI_FORMAT format, GUID& guid ) bool _DXGIToWIC( DXGI_FORMAT format, GUID& guid )
{ {
switch( format ) switch( format )
@ -195,7 +197,8 @@ IWICImagingFactory* _GetWIC()
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Public helper function to get common WIC codec GUIDs // Public helper function to get common WIC codec GUIDs
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
REFGUID GetWICCodec( _In_ WICCodecs codec ) _Use_decl_annotations_
REFGUID GetWICCodec( WICCodecs codec )
{ {
switch( codec ) switch( codec )
{ {
@ -233,6 +236,7 @@ REFGUID GetWICCodec( _In_ WICCodecs codec )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Returns bits-per-pixel for a given DXGI format, or 0 on failure // Returns bits-per-pixel for a given DXGI format, or 0 on failure
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
size_t BitsPerPixel( DXGI_FORMAT fmt ) size_t BitsPerPixel( DXGI_FORMAT fmt )
{ {
switch( fmt ) switch( fmt )
@ -359,7 +363,6 @@ size_t BitsPerPixel( DXGI_FORMAT fmt )
return 16; return 16;
// We don't support the video formats ( see IsVideo function ) // We don't support the video formats ( see IsVideo function )
#endif // DXGI_1_2_FORMATS #endif // DXGI_1_2_FORMATS
default: default:
@ -372,6 +375,7 @@ size_t BitsPerPixel( DXGI_FORMAT fmt )
// Computes the image row pitch in bytes, and the slice ptich (size in bytes of the image) // Computes the image row pitch in bytes, and the slice ptich (size in bytes of the image)
// based on DXGI format, width, and height // based on DXGI format, width, and height
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
void ComputePitch( DXGI_FORMAT fmt, size_t width, size_t height, void ComputePitch( DXGI_FORMAT fmt, size_t width, size_t height,
size_t& rowPitch, size_t& slicePitch, DWORD flags ) size_t& rowPitch, size_t& slicePitch, DWORD flags )
{ {
@ -429,7 +433,8 @@ void ComputePitch( DXGI_FORMAT fmt, size_t width, size_t height,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Converts to an SRGB equivalent type if available // Converts to an SRGB equivalent type if available
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
DXGI_FORMAT MakeSRGB( _In_ DXGI_FORMAT fmt ) _Use_decl_annotations_
DXGI_FORMAT MakeSRGB( DXGI_FORMAT fmt )
{ {
switch( fmt ) switch( fmt )
{ {
@ -463,7 +468,8 @@ DXGI_FORMAT MakeSRGB( _In_ DXGI_FORMAT fmt )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Converts to a format to an equivalent TYPELESS format if available // Converts to a format to an equivalent TYPELESS format if available
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
DXGI_FORMAT MakeTypeless( _In_ DXGI_FORMAT fmt ) _Use_decl_annotations_
DXGI_FORMAT MakeTypeless( DXGI_FORMAT fmt )
{ {
switch( fmt ) switch( fmt )
{ {
@ -579,7 +585,8 @@ DXGI_FORMAT MakeTypeless( _In_ DXGI_FORMAT fmt )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Converts to a TYPELESS format to an equivalent UNORM format if available // Converts to a TYPELESS format to an equivalent UNORM format if available
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
DXGI_FORMAT MakeTypelessUNORM( _In_ DXGI_FORMAT fmt ) _Use_decl_annotations_
DXGI_FORMAT MakeTypelessUNORM( DXGI_FORMAT fmt )
{ {
switch( fmt ) switch( fmt )
{ {
@ -637,7 +644,8 @@ DXGI_FORMAT MakeTypelessUNORM( _In_ DXGI_FORMAT fmt )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Converts to a TYPELESS format to an equivalent FLOAT format if available // Converts to a TYPELESS format to an equivalent FLOAT format if available
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
DXGI_FORMAT MakeTypelessFLOAT( _In_ DXGI_FORMAT fmt ) _Use_decl_annotations_
DXGI_FORMAT MakeTypelessFLOAT( DXGI_FORMAT fmt )
{ {
switch( fmt ) switch( fmt )
{ {
@ -672,7 +680,8 @@ DXGI_FORMAT MakeTypelessFLOAT( _In_ DXGI_FORMAT fmt )
// TexMetadata // TexMetadata
//===================================================================================== //=====================================================================================
size_t TexMetadata::ComputeIndex( _In_ size_t mip, _In_ size_t item, _In_ size_t slice ) const _Use_decl_annotations_
size_t TexMetadata::ComputeIndex( size_t mip, size_t item, size_t slice ) const
{ {
if ( mip >= mipLevels ) if ( mip >= mipLevels )
return size_t(-1); return size_t(-1);
@ -737,6 +746,7 @@ void Blob::Release()
_size = 0; _size = 0;
} }
_Use_decl_annotations_
HRESULT Blob::Initialize( size_t size ) HRESULT Blob::Initialize( size_t size )
{ {
if ( !size ) if ( !size )

View File

@ -522,7 +522,7 @@ static HRESULT _EncodeSingleFrame( _In_ const Image& image, _In_ DWORD flags,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Encodes an image array // Encodes an image array
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static HRESULT _EncodeMultiframe( _In_count_(nimages) const Image* images, _In_ size_t nimages, _In_ DWORD flags, static HRESULT _EncodeMultiframe( _In_reads_(nimages) const Image* images, _In_ size_t nimages, _In_ DWORD flags,
_In_ REFGUID guidContainerFormat, _Inout_ IStream* stream, _In_opt_ const GUID* targetFormat ) _In_ REFGUID guidContainerFormat, _Inout_ IStream* stream, _In_opt_ const GUID* targetFormat )
{ {
if ( !stream || nimages < 2 ) if ( !stream || nimages < 2 )
@ -585,6 +585,7 @@ static HRESULT _EncodeMultiframe( _In_count_(nimages) const Image* images, _In_
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Obtain metadata from WIC-supported file in memory // Obtain metadata from WIC-supported file in memory
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT GetMetadataFromWICMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata& metadata ) HRESULT GetMetadataFromWICMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata& metadata )
{ {
if ( !pSource || size == 0 ) if ( !pSource || size == 0 )
@ -633,6 +634,7 @@ HRESULT GetMetadataFromWICMemory( LPCVOID pSource, size_t size, DWORD flags, Tex
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Obtain metadata from WIC-supported file on disk // Obtain metadata from WIC-supported file on disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT GetMetadataFromWICFile( LPCWSTR szFile, DWORD flags, TexMetadata& metadata ) HRESULT GetMetadataFromWICFile( LPCWSTR szFile, DWORD flags, TexMetadata& metadata )
{ {
if ( !szFile ) if ( !szFile )
@ -665,6 +667,7 @@ HRESULT GetMetadataFromWICFile( LPCWSTR szFile, DWORD flags, TexMetadata& metada
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Load a WIC-supported file in memory // Load a WIC-supported file in memory
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT LoadFromWICMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata* metadata, ScratchImage& image ) HRESULT LoadFromWICMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadata* metadata, ScratchImage& image )
{ {
if ( !pSource || size == 0 ) if ( !pSource || size == 0 )
@ -734,6 +737,7 @@ HRESULT LoadFromWICMemory( LPCVOID pSource, size_t size, DWORD flags, TexMetadat
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Load a WIC-supported file from disk // Load a WIC-supported file from disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT LoadFromWICFile( LPCWSTR szFile, DWORD flags, TexMetadata* metadata, ScratchImage& image ) HRESULT LoadFromWICFile( LPCWSTR szFile, DWORD flags, TexMetadata* metadata, ScratchImage& image )
{ {
if ( !szFile ) if ( !szFile )
@ -788,6 +792,7 @@ HRESULT LoadFromWICFile( LPCWSTR szFile, DWORD flags, TexMetadata* metadata, Scr
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Save a WIC-supported file to memory // Save a WIC-supported file to memory
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT SaveToWICMemory( const Image& image, DWORD flags, REFGUID guidContainerFormat, Blob& blob, const GUID* targetFormat ) HRESULT SaveToWICMemory( const Image& image, DWORD flags, REFGUID guidContainerFormat, Blob& blob, const GUID* targetFormat )
{ {
if ( !image.pixels ) if ( !image.pixels )
@ -833,6 +838,7 @@ HRESULT SaveToWICMemory( const Image& image, DWORD flags, REFGUID guidContainerF
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT SaveToWICMemory( const Image* images, size_t nimages, DWORD flags, REFGUID guidContainerFormat, Blob& blob, const GUID* targetFormat ) HRESULT SaveToWICMemory( const Image* images, size_t nimages, DWORD flags, REFGUID guidContainerFormat, Blob& blob, const GUID* targetFormat )
{ {
if ( !images || nimages == 0 ) if ( !images || nimages == 0 )
@ -886,6 +892,7 @@ HRESULT SaveToWICMemory( const Image* images, size_t nimages, DWORD flags, REFGU
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Save a WIC-supported file to disk // Save a WIC-supported file to disk
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT SaveToWICFile( const Image& image, DWORD flags, REFGUID guidContainerFormat, LPCWSTR szFile, const GUID* targetFormat ) HRESULT SaveToWICFile( const Image& image, DWORD flags, REFGUID guidContainerFormat, LPCWSTR szFile, const GUID* targetFormat )
{ {
if ( !szFile ) if ( !szFile )
@ -914,6 +921,7 @@ HRESULT SaveToWICFile( const Image& image, DWORD flags, REFGUID guidContainerFor
return S_OK; return S_OK;
} }
_Use_decl_annotations_
HRESULT SaveToWICFile( const Image* images, size_t nimages, DWORD flags, REFGUID guidContainerFormat, LPCWSTR szFile, const GUID* targetFormat ) HRESULT SaveToWICFile( const Image* images, size_t nimages, DWORD flags, REFGUID guidContainerFormat, LPCWSTR szFile, const GUID* targetFormat )
{ {
if ( !szFile || !images || nimages == 0 ) if ( !szFile || !images || nimages == 0 )

View File

@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "DirectXTex_Desktop_2010_SDK80.vcxproj", "{371B9FA9-4C90-4AC6-A123-ACED756D6C77}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Profile|Win32 = Profile|Win32
Profile|x64 = Profile|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.ActiveCfg = Debug|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.Build.0 = Debug|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.ActiveCfg = Debug|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.Build.0 = Debug|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.ActiveCfg = Profile|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.Build.0 = Profile|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.ActiveCfg = Profile|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.Build.0 = Profile|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.ActiveCfg = Release|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.Build.0 = Release|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.ActiveCfg = Release|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,403 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|Win32">
<Configuration>Profile</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|x64">
<Configuration>Profile</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>DirectXTex</ProjectName>
<ProjectGuid>{371B9FA9-4C90-4AC6-A123-ACED756D6C77}</ProjectGuid>
<RootNamespace>DirectXTex</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;DXGI_1_2_FORMATS;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;DXGI_1_2_FORMATS;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;DXGI_1_2_FORMATS;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;DXGI_1_2_FORMATS;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;DXGI_1_2_FORMATS;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;DXGI_1_2_FORMATS;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup />
<ItemGroup>
<CLInclude Include="BC.h" />
<ClCompile Include="BC.cpp" />
<ClCompile Include="BC4BC5.cpp" />
<ClCompile Include="BC6HBC7.cpp" />
<CLInclude Include="DDS.h" />
<CLInclude Include="scoped.h" />
<CLInclude Include="DirectXTex.h" />
<CLInclude Include="DirectXTexp.h" />
<CLInclude Include="DirectXTex.inl" />
<ClCompile Include="DirectXTexCompress.cpp" />
<ClCompile Include="DirectXTexConvert.cpp" />
<ClCompile Include="DirectXTexD3D11.cpp" />
<ClCompile Include="DirectXTexDDS.cpp" />
<ClCompile Include="DirectXTexFlipRotate.cpp" />
<ClCompile Include="DirectXTexImage.cpp" />
<ClCompile Include="DirectXTexMipMaps.cpp" />
<ClCompile Include="DirectXTexMisc.cpp" />
<ClCompile Include="DirectXTexNormalMaps.cpp" />
<ClCompile Include="DirectXTexResize.cpp" />
<ClCompile Include="DirectXTexTGA.cpp" />
<ClCompile Include="DirectXTexUtil.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="DirectXTexWIC.cpp" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns:atg="http://atg.xbox.com" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{8e114980-c1a3-4ada-ad7c-83caadf5daeb}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<CLInclude Include="BC.h" />
<ClCompile Include="BC.cpp" />
<ClCompile Include="BC4BC5.cpp" />
<ClCompile Include="BC6HBC7.cpp" />
<CLInclude Include="DDS.h" />
<CLInclude Include="scoped.h" />
<CLInclude Include="DirectXTex.h" />
<CLInclude Include="DirectXTexp.h" />
<CLInclude Include="DirectXTex.inl" />
<ClCompile Include="DirectXTexCompress.cpp" />
<ClCompile Include="DirectXTexConvert.cpp" />
<ClCompile Include="DirectXTexD3D11.cpp" />
<ClCompile Include="DirectXTexDDS.cpp" />
<ClCompile Include="DirectXTexFlipRotate.cpp" />
<ClCompile Include="DirectXTexImage.cpp" />
<ClCompile Include="DirectXTexMipMaps.cpp" />
<ClCompile Include="DirectXTexMisc.cpp" />
<ClCompile Include="DirectXTexNormalMaps.cpp" />
<ClCompile Include="DirectXTexResize.cpp" />
<ClCompile Include="DirectXTexTGA.cpp" />
<ClCompile Include="DirectXTexUtil.cpp" />
<ClCompile Include="DirectXTexWIC.cpp" />
</ItemGroup>
<ItemGroup></ItemGroup>
<ItemGroup></ItemGroup>
<ItemGroup></ItemGroup>
</Project>

View File

@ -0,0 +1,45 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "texconv", "Texconv_Desktop_2010_SDK80.vcxproj", "{C3A65381-8FD3-4F69-B29E-654B4B0ED136}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\DirectXTex\DirectXTex_Desktop_2010_SDK80.vcxproj", "{371B9FA9-4C90-4AC6-A123-ACED756D6C77}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Profile|Win32 = Profile|Win32
Profile|x64 = Profile|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Debug|Win32.ActiveCfg = Debug|Win32
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Debug|Win32.Build.0 = Debug|Win32
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Debug|x64.ActiveCfg = Debug|x64
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Debug|x64.Build.0 = Debug|x64
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Profile|Win32.ActiveCfg = Profile|Win32
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Profile|Win32.Build.0 = Profile|Win32
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Profile|x64.ActiveCfg = Profile|x64
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Profile|x64.Build.0 = Profile|x64
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Release|Win32.ActiveCfg = Release|Win32
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Release|Win32.Build.0 = Release|Win32
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Release|x64.ActiveCfg = Release|x64
{C3A65381-8FD3-4F69-B29E-654B4B0ED136}.Release|x64.Build.0 = Release|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.ActiveCfg = Debug|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|Win32.Build.0 = Debug|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.ActiveCfg = Debug|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Debug|x64.Build.0 = Debug|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.ActiveCfg = Profile|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|Win32.Build.0 = Profile|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.ActiveCfg = Profile|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Profile|x64.Build.0 = Profile|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.ActiveCfg = Release|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|Win32.Build.0 = Release|Win32
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.ActiveCfg = Release|x64
{371B9FA9-4C90-4AC6-A123-ACED756D6C77}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,370 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|Win32">
<Configuration>Profile</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|x64">
<Configuration>Profile</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>texconv</ProjectName>
<ProjectGuid>{C3A65381-8FD3-4F69-B29E-654B4B0ED136}</ProjectGuid>
<RootNamespace>texconv</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x86.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Windows8SDK_x64.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_CONSOLE;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
<AdditionalIncludeDirectories>..\XNAMath;..\DirectXTex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_CONSOLE;D3DXFX_LARGEADDRESS_HANDLE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>ole32.lib;windowscodecs.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LargeAddressAware>true</LargeAddressAware>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<Manifest>
<EnableDPIAwareness>false</EnableDPIAwareness>
</Manifest>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Texconv.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Texconv.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DirectXTex\DirectXTex_Desktop_2010.vcxproj">
<Project>{371b9fa9-4c90-4ac6-a123-aced756d6c77}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns:atg="http://atg.xbox.com" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{8e114980-c1a3-4ada-ad7c-83caadf5daeb}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Texconv.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Texconv.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

12
Windows8SDK_x64.props Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>$(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(ProgramFiles)\Windows Kits\8.0\bin\x86;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
<IncludePath>$(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include;</IncludePath>
<LibraryPath>$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(ProgramFiles)\Windows Kits\8.0\lib\win8\um\x64;$(FrameworkSDKDir)\lib\x64</LibraryPath>
<ExcludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(FrameworkSDKDir)\include;$(MSBuildToolsPath32);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;</ExcludePath>
</PropertyGroup>
<ItemDefinitionGroup />
</Project>

12
Windows8SDK_x86.props Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(ProgramFiles)\Windows Kits\8.0\bin\x86;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
<IncludePath>$(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include;</IncludePath>
<LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(ProgramFiles)\Windows Kits\8.0\lib\win8\um\x86;$(FrameworkSDKDir)\lib</LibraryPath>
<ExcludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(FrameworkSDKDir)\include;$(MSBuildToolsPath32);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;</ExcludePath>
</PropertyGroup>
<ItemDefinitionGroup />
</Project>