Resync'd DDSTextureLoader, ScreenGrab, WICTextureLoader

This commit is contained in:
Chuck Walbourn 2020-11-17 21:42:19 -08:00
Родитель c4a2b4beb9
Коммит d9479c1930
5 изменённых файлов: 45 добавлений и 48 удалений

Просмотреть файл

@ -430,22 +430,6 @@ namespace
case DXGI_FORMAT_R8_SNORM:
case DXGI_FORMAT_R8_SINT:
case DXGI_FORMAT_A8_UNORM:
case DXGI_FORMAT_AI44:
case DXGI_FORMAT_IA44:
case DXGI_FORMAT_P8:
return 8;
case DXGI_FORMAT_R1_UNORM:
return 1;
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC4_SNORM:
return 4;
case DXGI_FORMAT_BC2_TYPELESS:
case DXGI_FORMAT_BC2_UNORM:
case DXGI_FORMAT_BC2_UNORM_SRGB:
@ -461,8 +445,22 @@ namespace
case DXGI_FORMAT_BC7_TYPELESS:
case DXGI_FORMAT_BC7_UNORM:
case DXGI_FORMAT_BC7_UNORM_SRGB:
case DXGI_FORMAT_AI44:
case DXGI_FORMAT_IA44:
case DXGI_FORMAT_P8:
return 8;
case DXGI_FORMAT_R1_UNORM:
return 1;
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC4_SNORM:
return 4;
default:
return 0;
}

Просмотреть файл

@ -364,22 +364,6 @@ namespace
case DXGI_FORMAT_R8_SNORM:
case DXGI_FORMAT_R8_SINT:
case DXGI_FORMAT_A8_UNORM:
case DXGI_FORMAT_AI44:
case DXGI_FORMAT_IA44:
case DXGI_FORMAT_P8:
return 8;
case DXGI_FORMAT_R1_UNORM:
return 1;
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC4_SNORM:
return 4;
case DXGI_FORMAT_BC2_TYPELESS:
case DXGI_FORMAT_BC2_UNORM:
case DXGI_FORMAT_BC2_UNORM_SRGB:
@ -395,8 +379,22 @@ namespace
case DXGI_FORMAT_BC7_TYPELESS:
case DXGI_FORMAT_BC7_UNORM:
case DXGI_FORMAT_BC7_UNORM_SRGB:
case DXGI_FORMAT_AI44:
case DXGI_FORMAT_IA44:
case DXGI_FORMAT_P8:
return 8;
case DXGI_FORMAT_R1_UNORM:
return 1;
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC4_SNORM:
return 4;
default:
return 0;
}

Просмотреть файл

@ -65,11 +65,11 @@ namespace
//-------------------------------------------------------------------------------------
struct WICTranslate
{
GUID wic;
const GUID& wic;
DXGI_FORMAT format;
};
const WICTranslate g_WICFormats[] =
constexpr WICTranslate g_WICFormats[] =
{
{ GUID_WICPixelFormat128bppRGBAFloat, DXGI_FORMAT_R32G32B32A32_FLOAT },
@ -100,11 +100,11 @@ namespace
struct WICConvert
{
GUID source;
GUID target;
const GUID& source;
const GUID& target;
};
const WICConvert g_WICConvert[] =
constexpr WICConvert g_WICConvert[] =
{
// Note target GUID in this conversion table must be one of those directly supported formats (above).
@ -354,7 +354,7 @@ namespace
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ unsigned int loadFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept
{
@ -572,7 +572,7 @@ namespace
// Allocate temporary memory for image
uint64_t rowBytes = (uint64_t(twidth) * uint64_t(bpp) + 7u) / 8u;
uint64_t numBytes = rowBytes * uint64_t(height);
uint64_t numBytes = rowBytes * uint64_t(theight);
if (rowBytes > UINT32_MAX || numBytes > UINT32_MAX)
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
@ -857,7 +857,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx(
unsigned int bindFlags,
unsigned int cpuAccessFlags,
unsigned int miscFlags,
unsigned int loadFlags,
WIC_LOADER_FLAGS loadFlags,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView) noexcept
{
@ -880,7 +880,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx(
unsigned int bindFlags,
unsigned int cpuAccessFlags,
unsigned int miscFlags,
unsigned int loadFlags,
WIC_LOADER_FLAGS loadFlags,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView) noexcept
{
@ -998,7 +998,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(
unsigned int bindFlags,
unsigned int cpuAccessFlags,
unsigned int miscFlags,
unsigned int loadFlags,
WIC_LOADER_FLAGS loadFlags,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView) noexcept
{
@ -1020,7 +1020,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(
unsigned int bindFlags,
unsigned int cpuAccessFlags,
unsigned int miscFlags,
unsigned int loadFlags,
WIC_LOADER_FLAGS loadFlags,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView) noexcept
{

Просмотреть файл

@ -87,7 +87,7 @@ namespace DirectX
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ unsigned int loadFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
@ -99,7 +99,7 @@ namespace DirectX
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ unsigned int loadFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
@ -114,7 +114,7 @@ namespace DirectX
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ unsigned int loadFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
@ -127,7 +127,7 @@ namespace DirectX
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ unsigned int loadFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
}

Просмотреть файл

@ -841,7 +841,8 @@ HRESULT CDXUTResourceCache::CreateTextureFromFile( ID3D11Device* pDevice, ID3D11
else
{
hr = DirectX::CreateWICTextureFromFileEx( pDevice, pContext, pSrcFile, 0,
D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, bSRGB,
D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0,
bSRGB ? DirectX::WIC_LOADER_FORCE_SRGB : DirectX::WIC_LOADER_DEFAULT,
nullptr, ppOutputRV );
}