Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Updated DirectXTK, DXUT, DirectXTex, Effects 11 for November 2015
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Dec 1, 2015
1 parent 00169e9 commit 972bb1f
Show file tree
Hide file tree
Showing 23 changed files with 493 additions and 112 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*.i
*.vspscc
*.opensdf
*.opendb
*.ipch
*.cache
*.tlog
Expand Down
31 changes: 29 additions & 2 deletions DXUT/Core/DDSTextureLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct DDS_PIXELFORMAT
#define DDS_RGB 0x00000040 // DDPF_RGB
#define DDS_LUMINANCE 0x00020000 // DDPF_LUMINANCE
#define DDS_ALPHA 0x00000002 // DDPF_ALPHA
#define DDS_BUMPDUDV 0x00080000 // DDPF_BUMPDUDV

#define DDS_HEADER_FLAGS_VOLUME 0x00800000 // DDSD_DEPTH

Expand Down Expand Up @@ -579,7 +580,7 @@ static DXGI_FORMAT GetDXGIFormat( const DDS_PIXELFORMAT& ddpf )
// No DXGI format maps to ISBITMASK(0x000000ff,0x0000ff00,0x00ff0000,0x00000000) aka D3DFMT_X8B8G8R8

// Note that many common DDS reader/writers (including D3DX) swap the
// the RED/BLUE masks for 10:10:10:2 formats. We assumme
// the RED/BLUE masks for 10:10:10:2 formats. We assume
// below that the 'backwards' header mask is being used since it is most
// likely written by D3DX. The more robust solution is to use the 'DX10'
// header extension and specify the DXGI_FORMAT_R10G10B10A2_UNORM format directly
Expand Down Expand Up @@ -662,6 +663,32 @@ static DXGI_FORMAT GetDXGIFormat( const DDS_PIXELFORMAT& ddpf )
return DXGI_FORMAT_A8_UNORM;
}
}
else if (ddpf.flags & DDS_BUMPDUDV)
{
if (16 == ddpf.RGBBitCount)
{
if (ISBITMASK(0x00ff, 0xff00, 0x0000, 0x0000))
{
return DXGI_FORMAT_R8G8_SNORM; // D3DX10/11 writes this out as DX10 extension
}
}

if (32 == ddpf.RGBBitCount)
{
if (ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000))
{
return DXGI_FORMAT_R8G8B8A8_SNORM; // D3DX10/11 writes this out as DX10 extension
}
if (ISBITMASK(0x0000ffff, 0xffff0000, 0x00000000, 0x00000000))
{
return DXGI_FORMAT_R16G16_SNORM; // D3DX10/11 writes this out as DX10 extension
}

// No DXGI format maps to ISBITMASK(0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000) aka D3DFMT_A2W10V10U10
}
}


else if (ddpf.flags & DDS_FOURCC)
{
if (MAKEFOURCC( 'D', 'X', 'T', '1' ) == ddpf.fourCC)
Expand All @@ -677,7 +704,7 @@ static DXGI_FORMAT GetDXGIFormat( const DDS_PIXELFORMAT& ddpf )
return DXGI_FORMAT_BC3_UNORM;
}

// While pre-mulitplied alpha isn't directly supported by the DXGI formats,
// While pre-multiplied alpha isn't directly supported by the DXGI formats,
// they are basically the same as these BC formats so they can be mapped
if (MAKEFOURCC( 'D', 'X', 'T', '2' ) == ddpf.fourCC)
{
Expand Down
2 changes: 1 addition & 1 deletion DXUT/Core/DXUT.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
((DWORD)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#endif

#define DXUT_VERSION 1110
#define DXUT_VERSION 1111

//--------------------------------------------------------------------------------------
// Structs
Expand Down
2 changes: 1 addition & 1 deletion DXUT/Core/DXUT_2015_Win10.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ProjectGuid>{85344B7F-5AA0-4e12-A065-D1333D11F6CA}</ProjectGuid>
<RootNamespace>DXUT</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down
15 changes: 14 additions & 1 deletion DXUT/Core/ScreenGrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct DDS_PIXELFORMAT
#define DDS_LUMINANCE 0x00020000 // DDPF_LUMINANCE
#define DDS_LUMINANCEA 0x00020001 // DDPF_LUMINANCE | DDPF_ALPHAPIXELS
#define DDS_ALPHA 0x00000002 // DDPF_ALPHA
#define DDS_BUMPDUDV 0x00080000 // DDPF_BUMPDUDV

#define DDS_HEADER_FLAGS_TEXTURE 0x00001007 // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT
#define DDS_HEADER_FLAGS_MIPMAP 0x00020000 // DDSD_MIPMAPCOUNT
Expand Down Expand Up @@ -183,6 +184,15 @@ static const DDS_PIXELFORMAT DDSPF_A8L8 =
static const DDS_PIXELFORMAT DDSPF_A8 =
{ sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0x00, 0x00, 0x00, 0xff };

static const DDS_PIXELFORMAT DDSPF_V8U8 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 16, 0x00ff, 0xff00, 0x0000, 0x0000 };

static const DDS_PIXELFORMAT DDSPF_Q8W8V8U8 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };

static const DDS_PIXELFORMAT DDSPF_V16U16 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 };

// DXGI_FORMAT_R10G10B10A2_UNORM should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue

// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat)
Expand Down Expand Up @@ -763,6 +773,9 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
case DXGI_FORMAT_BC5_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_BC5_SNORM, sizeof(DDS_PIXELFORMAT) ); break;
case DXGI_FORMAT_B5G6R5_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_R5G6B5, sizeof(DDS_PIXELFORMAT) ); break;
case DXGI_FORMAT_B5G5R5A1_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A1R5G5B5, sizeof(DDS_PIXELFORMAT) ); break;
case DXGI_FORMAT_R8G8_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_V8U8, sizeof(DDS_PIXELFORMAT) ); break;
case DXGI_FORMAT_R8G8B8A8_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_Q8W8V8U8, sizeof(DDS_PIXELFORMAT) ); break;
case DXGI_FORMAT_R16G16_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_V16U16, sizeof(DDS_PIXELFORMAT) ); break;
case DXGI_FORMAT_B8G8R8A8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A8R8G8B8, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.1
case DXGI_FORMAT_B8G8R8X8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_X8R8G8B8, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.1
case DXGI_FORMAT_YUY2: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_YUY2, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.2
Expand Down Expand Up @@ -1062,7 +1075,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,

if ( sRGB )
{
// Set JPEG EXIF Colorspace of sRGB
// Set EXIF Colorspace of sRGB
value.vt = VT_UI2;
value.uiVal = 1;
(void)metawriter->SetMetadataByName( L"System.Image.ColorSpace", &value );
Expand Down
10 changes: 6 additions & 4 deletions DXUT/Core/dxerr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3275,9 +3275,9 @@ const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr )
// xapo.h error codes
// -------------------------------------------------------------
CHK_ERRA(XAPO_E_FORMAT_UNSUPPORTED)
}

return L"Unknown";
default: return L"Unknown error.";
}
}

//--------------------------------------------------------------------------------------
Expand All @@ -3289,11 +3289,11 @@ const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr )

#define CHK_ERRA(hrchk) \
case hrchk: \
wcscpy_s( desc, count, L#hrchk );
wcscpy_s( desc, count, L#hrchk ); break;

#define CHK_ERR(hrchk, strOut) \
case hrchk: \
wcscpy_s( desc, count, L##strOut );
wcscpy_s( desc, count, L##strOut ); break;


//--------------------------------------------------------------------------------------
Expand Down Expand Up @@ -3602,6 +3602,8 @@ void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) WCHAR* des
// xapo.h error codes
// -------------------------------------------------------------
CHK_ERR(XAPO_E_FORMAT_UNSUPPORTED, "Requested audio format unsupported.")

default: wcscpy_s( desc, count, L"Unknown error." ); break;
}
}

Expand Down
2 changes: 0 additions & 2 deletions DXUT/Core/dxerr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

// This version only supports UNICODE.

#ifdef _MSC_VER
#pragma once
#endif

#include <windows.h>
#include <sal.h>
Expand Down
2 changes: 1 addition & 1 deletion DXUT/Optional/DXUTOpt_2015_Win10.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ProjectGuid>{61B333C2-C4F7-4cc1-A9BF-83F6D95588EB}</ProjectGuid>
<RootNamespace>DXUTOpt</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down
6 changes: 5 additions & 1 deletion DXUT/ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DXUT FOR DIRECT3D 11

Copyright (c) Microsoft Corporation. All rights reserved.

July 29, 2015
November 30, 2015

DXUT is a "GLUT"-like framework for Direct3D 11.x Win32 desktop applications; primarily samples, demos, and prototypes.

Expand Down Expand Up @@ -55,6 +55,10 @@ This version of DXUT only supports Direct3D 11, and therefore is not compatible
RELEASE HISTORY
---------------

November 30, 2015 (11.11)
Updated DDSTextureLoader, ScreenGrab, DXERR
Updated for VS 2015 Update 1 and Windows 10 SDK (10586)

July 29, 2015 (11.10)
Updated for VS 2015 and Windows 10 SDK RTM
Retired VS 2010 projects
Expand Down
6 changes: 3 additions & 3 deletions DXUT/Windows10SDKVS13_x64.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>$(ProgramFiles)\Windows Kits\10\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\winrt;$(IncludePath)</IncludePath>
<LibraryPath>$(ProgramFiles)\Windows Kits\10\lib\10.0.10240.0\um\x64;$(LibraryPath)</LibraryPath>
<ExcludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\winrt;$(ExcludePath)</ExcludePath>
<IncludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\winrt;$(IncludePath)</IncludePath>
<LibraryPath>$(ProgramFiles)\Windows Kits\10\lib\10.0.10586.0\um\x64;$(LibraryPath)</LibraryPath>
<ExcludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\winrt;$(ExcludePath)</ExcludePath>
</PropertyGroup>
<ItemDefinitionGroup />
</Project>
6 changes: 3 additions & 3 deletions DXUT/Windows10SDKVS13_x86.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>$(ProgramFiles)\Windows Kits\10\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\winrt;$(IncludePath)</IncludePath>
<LibraryPath>$(ProgramFiles)\Windows Kits\10\lib\10.0.10240.0\um\x86;$(LibraryPath)</LibraryPath>
<ExcludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\winrt;$(ExcludePath)</ExcludePath>
<IncludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\winrt;$(IncludePath)</IncludePath>
<LibraryPath>$(ProgramFiles)\Windows Kits\10\lib\10.0.10586.0\um\x86;$(LibraryPath)</LibraryPath>
<ExcludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.10586.0\winrt;$(ExcludePath)</ExcludePath>
</PropertyGroup>
<ItemDefinitionGroup />
</Project>
10 changes: 6 additions & 4 deletions DirectXTK/Inc/Keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ namespace DirectX
bool Reserved15 : 7;
bool Reserved16 : 8;
bool Reserved17 : 8;
bool Reserved18 : 1;
bool Reserved18 : 3;
bool OemOpenBrackets : 1; // VK_OEM_4, 0xDB
bool OemPipe : 1; // VK_OEM_5, 0xDC
bool OemCloseBrackets : 1; // VK_OEM_6, 0xDD
Expand All @@ -395,21 +395,23 @@ namespace DirectX
bool OemBackslash : 1; // VK_OEM_102, 0xE2
bool Reserved20 : 2;
bool ProcessKey : 1; // VK_PROCESSKEY, 0xE5
bool Reserved21 : 4;
bool Reserved21 : 2;
bool Reserved22 : 8;
bool Reserved23 : 2;
bool OemCopy : 1; // 0XF2
bool OemAuto : 1; // 0xF3
bool OemEnlW : 1; // 0xF4
bool Reserved23 : 1;
bool Reserved24 : 1;
bool Attn : 1; // VK_ATTN, 0xF6
bool Crsel : 1; // VK_CRSEL, 0xF7
bool Exsel : 1; // VK_EXSEL, 0xF8
bool EraseEof : 1; // VK_EREOF, 0xF9
bool Play : 1; // VK_PLAY, 0xFA
bool Zoom : 1; // VK_ZOOM, 0xFB
bool Reserved24 : 1;
bool Reserved25 : 1;
bool Pa1 : 1; // VK_PA1, 0xFD
bool OemClear : 1; // VK_OEM_CLEAR, 0xFE
bool Reserved26: 1;

bool __cdecl IsKeyDown(Keys key) const
{
Expand Down
Loading

0 comments on commit 972bb1f

Please sign in to comment.