mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-24 13:20:13 +00:00
Xbox One platform changes
This commit is contained in:
parent
1e0d861ee3
commit
48e969aac7
@ -3833,6 +3833,17 @@ static inline bool _UseWICConversion( _In_ DWORD filter, _In_ DXGI_FORMAT sforma
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
if ( sformat == DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||
|| sformat == DXGI_FORMAT_R16_FLOAT
|
||||
|| tformat == DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||
|| tformat == DXGI_FORMAT_R16_FLOAT )
|
||||
{
|
||||
// Use non-WIC code paths as these conversions are not supported by Xbox One XDK
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check for special cases
|
||||
switch ( sformat )
|
||||
{
|
||||
|
@ -138,6 +138,17 @@ static HRESULT _EnsureWicBitmapPixelFormat( _In_ IWICImagingFactory* pWIC, _In_
|
||||
{
|
||||
ComPtr<IWICFormatConverter> converter;
|
||||
hr = pWIC->CreateFormatConverter( converter.GetAddressOf() );
|
||||
|
||||
if ( SUCCEEDED(hr) )
|
||||
{
|
||||
BOOL canConvert = FALSE;
|
||||
hr = converter->CanConvert( actualPixelFormat, desiredPixelFormat, &canConvert );
|
||||
if ( FAILED(hr) || !canConvert )
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
if ( SUCCEEDED(hr) )
|
||||
{
|
||||
hr = converter->Initialize( src, desiredPixelFormat, _GetWICDither(filter), 0, 0, WICBitmapPaletteTypeCustom );
|
||||
@ -381,6 +392,15 @@ static bool _UseWICFiltering( _In_ DXGI_FORMAT format, _In_ DWORD filter )
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
if ( format == DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||
|| format == DXGI_FORMAT_R16_FLOAT )
|
||||
{
|
||||
// Use non-WIC code paths as these conversions are not supported by Xbox One XDK
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static_assert( TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MASK" );
|
||||
|
||||
switch ( filter & TEX_FILTER_MASK )
|
||||
@ -530,6 +550,13 @@ static HRESULT _GenerateMipMapsUsingWIC( _In_ const Image& baseImage, _In_ DWORD
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
BOOL canConvert = FALSE;
|
||||
hr = FC->CanConvert( pfScaler, pfGUID, &canConvert );
|
||||
if ( FAILED(hr) || !canConvert )
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
hr = FC->Initialize( scaler.Get(), pfGUID, _GetWICDither( filter ), 0, 0, WICBitmapPaletteTypeCustom );
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
@ -101,6 +101,13 @@ static HRESULT _PerformResizeUsingWIC( _In_ const Image& srcImage, _In_ DWORD fi
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
BOOL canConvert = FALSE;
|
||||
hr = FC->CanConvert( pfScaler, pfGUID, &canConvert );
|
||||
if ( FAILED(hr) || !canConvert )
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
hr = FC->Initialize( scaler.Get(), pfGUID, _GetWICDither( filter ), 0, 0, WICBitmapPaletteTypeCustom );
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
@ -177,6 +184,15 @@ static bool _UseWICFiltering( _In_ DXGI_FORMAT format, _In_ DWORD filter )
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
if ( format == DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||
|| format == DXGI_FORMAT_R16_FLOAT )
|
||||
{
|
||||
// Use non-WIC code paths as these conversions are not supported by Xbox One XDK
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static_assert( TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MASK" );
|
||||
|
||||
switch ( filter & TEX_FILTER_MASK )
|
||||
|
@ -355,6 +355,18 @@ static HRESULT _DecodeSingleFrame( _In_ DWORD flags, _In_ const TexMetadata& met
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
WICPixelFormatGUID pixelFormat;
|
||||
hr = frame->GetPixelFormat( &pixelFormat );
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
BOOL canConvert = FALSE;
|
||||
hr = FC->CanConvert( pixelFormat, convertGUID, &canConvert );
|
||||
if ( FAILED(hr) || !canConvert )
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
hr = FC->Initialize( frame, convertGUID, _GetWICDither( flags ), 0, 0, WICBitmapPaletteTypeCustom );
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
@ -444,6 +456,13 @@ static HRESULT _DecodeMultiframe( _In_ DWORD flags, _In_ const TexMetadata& meta
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
BOOL canConvert = FALSE;
|
||||
hr = FC->CanConvert( sourceGUID, pfGuid, &canConvert );
|
||||
if ( FAILED(hr) || !canConvert )
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
hr = FC->Initialize( frame.Get(), pfGuid, _GetWICDither( flags ), 0, 0, WICBitmapPaletteTypeCustom );
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
@ -602,6 +621,13 @@ static HRESULT _EncodeImage( _In_ const Image& image, _In_ DWORD flags, _In_ REF
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
BOOL canConvert = FALSE;
|
||||
hr = FC->CanConvert( pfGuid, targetGuid, &canConvert );
|
||||
if ( FAILED(hr) || !canConvert )
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
hr = FC->Initialize( source.Get(), targetGuid, _GetWICDither( flags ), 0, 0, WICBitmapPaletteTypeCustom );
|
||||
if ( FAILED(hr) )
|
||||
return hr;
|
||||
|
Loading…
Reference in New Issue
Block a user