From 3b396e230397bee48278f727755c0e303bf74c21 Mon Sep 17 00:00:00 2001 From: walbourn_cp Date: Thu, 3 Apr 2014 12:43:46 -0700 Subject: [PATCH] Sync with latest DirectXTK versions of DDSTextureLoader, ScreenGrab, and WICTextureLoader --- DDSTextureLoader/DDSTextureLoader.cpp | 5 ++--- DDSTextureLoader/DDSTextureLoader.h | 8 +++++++- ScreenGrab/ScreenGrab.cpp | 10 +++++----- ScreenGrab/ScreenGrab.h | 10 ++++++++-- WICTextureLoader/WICTextureLoader.cpp | 7 +++---- WICTextureLoader/WICTextureLoader.h | 12 +++++++++--- 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/DDSTextureLoader/DDSTextureLoader.cpp b/DDSTextureLoader/DDSTextureLoader.cpp index 96b4fcb..50e1ef5 100644 --- a/DDSTextureLoader/DDSTextureLoader.cpp +++ b/DDSTextureLoader/DDSTextureLoader.cpp @@ -18,14 +18,13 @@ // http://go.microsoft.com/fwlink/?LinkId=248929 //-------------------------------------------------------------------------------------- -#include #include #include #include #include "DDSTextureLoader.h" -#if defined(_DEBUG) || defined(PROFILE) +#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) #pragma comment(lib,"dxguid.lib") #endif @@ -1777,7 +1776,7 @@ HRESULT DirectX::CreateDDSTextureFromFileEx( ID3D11Device* d3dDevice, if ( SUCCEEDED(hr) ) { -#if defined(_DEBUG) || defined(PROFILE) +#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) if (texture != 0 || textureView != 0) { CHAR strFileA[MAX_PATH]; diff --git a/DDSTextureLoader/DDSTextureLoader.h b/DDSTextureLoader/DDSTextureLoader.h index be40f25..fa6b48a 100644 --- a/DDSTextureLoader/DDSTextureLoader.h +++ b/DDSTextureLoader/DDSTextureLoader.h @@ -22,7 +22,13 @@ #pragma once #endif -#include +#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC +#include +#define DCOMMON_H_INCLUDED +#define NO_D3D11_DEBUG_NAME +#else +#include +#endif #pragma warning(push) #pragma warning(disable : 4005) diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index 2310226..45d9b9b 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -25,10 +25,10 @@ // For 2D array textures and cubemaps, it captures only the first image in the array -#include #include -#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8) + // VS 2010's stdint.h conflicts with intsafe.h #pragma warning(push) #pragma warning(disable : 4005) @@ -669,7 +669,7 @@ static HRESULT CaptureTexture( _In_ ID3D11DeviceContext* pContext, //-------------------------------------------------------------------------------------- -#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8) static bool g_WIC2 = false; @@ -885,7 +885,7 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, } //-------------------------------------------------------------------------------------- -#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8) HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, @@ -1162,4 +1162,4 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, return S_OK; } -#endif // !WINAPI_FAMILY || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#endif // !WINAPI_FAMILY || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8) diff --git a/ScreenGrab/ScreenGrab.h b/ScreenGrab/ScreenGrab.h index f1aecac..f58f5eb 100644 --- a/ScreenGrab/ScreenGrab.h +++ b/ScreenGrab/ScreenGrab.h @@ -23,7 +23,13 @@ #pragma once #endif -#include +#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC +#include +#define DCOMMON_H_INCLUDED +#define NO_D3D11_DEBUG_NAME +#else +#include +#endif #include @@ -40,7 +46,7 @@ namespace DirectX _In_ ID3D11Resource* pSource, _In_z_ LPCWSTR fileName ); -#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8) HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, diff --git a/WICTextureLoader/WICTextureLoader.cpp b/WICTextureLoader/WICTextureLoader.cpp index f986a58..bb9b53f 100644 --- a/WICTextureLoader/WICTextureLoader.cpp +++ b/WICTextureLoader/WICTextureLoader.cpp @@ -28,7 +28,6 @@ // We could load multi-frame images (TIFF/GIF) into a texture array. // For now, we just load the first frame (note: DirectXTex supports multi-frame images) -#include #include // VS 2010's stdint.h conflicts with intsafe.h @@ -42,7 +41,7 @@ #include "WICTextureLoader.h" -#if defined(_DEBUG) || defined(PROFILE) +#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) #pragma comment(lib,"dxguid.lib") #endif @@ -53,7 +52,7 @@ using Microsoft::WRL::ComPtr; template inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char (&name)[TNameLength]) { -#if defined(_DEBUG) || defined(PROFILE) +#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name); #else UNREFERENCED_PARAMETER(resource); @@ -878,7 +877,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx( ID3D11Device* d3dDevice, usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB, texture, textureView ); -#if defined(_DEBUG) || defined(PROFILE) +#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) if ( SUCCEEDED(hr) ) { if (texture != 0 || textureView != 0) diff --git a/WICTextureLoader/WICTextureLoader.h b/WICTextureLoader/WICTextureLoader.h index f5fee1c..fd21bc2 100644 --- a/WICTextureLoader/WICTextureLoader.h +++ b/WICTextureLoader/WICTextureLoader.h @@ -29,11 +29,17 @@ #pragma once #endif -#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -#error WIC is not supported on Windows Phone +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (_WIN32_WINNT <= _WIN32_WINNT_WIN8) +#error WIC is not supported on Windows Phone 8.0 #endif -#include +#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC +#include +#define DCOMMON_H_INCLUDED +#define NO_D3D11_DEBUG_NAME +#else +#include +#endif #pragma warning(push) #pragma warning(disable : 4005)