texconv: Enable multithreaded BC6H/BC7 compression using OpenMP

- Added '-singleproc' command-line to turn off MT usage.
This commit is contained in:
walbourn_cp 2013-07-12 15:12:03 -07:00
parent 3f1f4acfda
commit af7856c1e3
5 changed files with 49 additions and 25 deletions

View File

@ -129,7 +129,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
@ -169,7 +169,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
@ -207,7 +207,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -248,7 +248,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -288,7 +288,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -329,7 +329,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>

View File

@ -117,7 +117,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
@ -157,7 +157,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
@ -195,7 +195,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -236,7 +236,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -276,7 +276,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -317,7 +317,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>

View File

@ -136,7 +136,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
@ -176,7 +176,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
@ -214,7 +214,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -255,7 +255,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -295,7 +295,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -336,7 +336,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>

View File

@ -136,7 +136,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
@ -176,7 +176,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
<ExceptionHandling>Sync</ExceptionHandling>
@ -214,7 +214,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -255,7 +255,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -295,7 +295,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>
@ -336,7 +336,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<OpenMPSupport>false</OpenMPSupport>
<OpenMPSupport>true</OpenMPSupport>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FloatingPointModel>Fast</FloatingPointModel>

View File

@ -42,6 +42,7 @@ enum OPTIONS // Note: dwOptions below assumes 32 or less options.
OPT_EXPAND_LUMINANCE,
OPT_TA_WRAP,
OPT_TA_MIRROR,
OPT_FORCE_SINGLEPROC,
};
struct SConversion
@ -88,6 +89,7 @@ SValue g_pOptions[] =
{ L"xlum", OPT_EXPAND_LUMINANCE },
{ L"wrap", OPT_TA_WRAP },
{ L"mirror", OPT_TA_MIRROR },
{ L"singleproc", OPT_FORCE_SINGLEPROC },
{ nullptr, 0 }
};
@ -366,6 +368,9 @@ void PrintUsage()
wprintf( L"\n (DDS output only)\n");
wprintf( L" -dx10 Force use of 'DX10' extended header\n");
wprintf( L"\n -nologo suppress copyright message\n");
#ifdef _OPENMP
wprintf( L" -singleproc Do not use multi-threaded compression\n");
#endif
wprintf( L"\n");
wprintf( L" <format>: ");
@ -448,6 +453,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
if( (OPT_NOLOGO != dwOption) && (OPT_TYPELESS_UNORM != dwOption) && (OPT_TYPELESS_FLOAT != dwOption)
&& (OPT_SEPALPHA != dwOption) && (OPT_PREMUL_ALPHA != dwOption) && (OPT_EXPAND_LUMINANCE != dwOption)
&& (OPT_TA_WRAP != dwOption) && (OPT_TA_MIRROR != dwOption)
&& (OPT_FORCE_SINGLEPROC != dwOption)
&& (OPT_SRGB != dwOption) && (OPT_SRGBI != dwOption) && (OPT_SRGBO != dwOption)
&& (OPT_HFLIP != dwOption) && (OPT_VFLIP != dwOption)
&& (OPT_DDS_DWORD_ALIGN != dwOption) && (OPT_USE_DX10 != dwOption) )
@ -1087,7 +1093,25 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
goto LError;
}
hr = Compress( img, nimg, info, tformat, TEX_COMPRESS_DEFAULT, 0.5f, *timage );
DWORD cflags = TEX_COMPRESS_DEFAULT;
#ifdef _OPENMP
switch( tformat )
{
case DXGI_FORMAT_BC6H_TYPELESS:
case DXGI_FORMAT_BC6H_UF16:
case DXGI_FORMAT_BC6H_SF16:
case DXGI_FORMAT_BC7_TYPELESS:
case DXGI_FORMAT_BC7_UNORM:
case DXGI_FORMAT_BC7_UNORM_SRGB:
if ( !(dwOptions & (1 << OPT_FORCE_SINGLEPROC) ) )
{
cflags |= TEX_COMPRESS_PARALLEL;
}
break;
}
#endif
hr = Compress( img, nimg, info, tformat, cflags, 0.5f, *timage );
if ( FAILED(hr) )
{
wprintf( L" FAILED [compress] (%x)\n", hr);