Skip to content

Commit

Permalink
Sync with latest DirectXTK versions of DDSTextureLoader, ScreenGrab, …
Browse files Browse the repository at this point in the history
…and WICTextureLoader
  • Loading branch information
walbourn_cp authored and walbourn_cp committed Apr 3, 2014
1 parent b2f914f commit 3b396e2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
5 changes: 2 additions & 3 deletions DDSTextureLoader/DDSTextureLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------

#include <dxgiformat.h>
#include <assert.h>
#include <algorithm>
#include <memory>

#include "DDSTextureLoader.h"

#if defined(_DEBUG) || defined(PROFILE)
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
#pragma comment(lib,"dxguid.lib")
#endif

Expand Down Expand Up @@ -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];
Expand Down
8 changes: 7 additions & 1 deletion DDSTextureLoader/DDSTextureLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
#pragma once
#endif

#include <d3d11.h>
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
#include <d3d11_x.h>
#define DCOMMON_H_INCLUDED
#define NO_D3D11_DEBUG_NAME
#else
#include <d3d11_1.h>
#endif

#pragma warning(push)
#pragma warning(disable : 4005)
Expand Down
10 changes: 5 additions & 5 deletions ScreenGrab/ScreenGrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

// For 2D array textures and cubemaps, it captures only the first image in the array

#include <dxgiformat.h>
#include <assert.h>

#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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
10 changes: 8 additions & 2 deletions ScreenGrab/ScreenGrab.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
#pragma once
#endif

#include <d3d11.h>
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
#include <d3d11_x.h>
#define DCOMMON_H_INCLUDED
#define NO_D3D11_DEBUG_NAME
#else
#include <d3d11_1.h>
#endif

#include <ocidl.h>

Expand All @@ -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,
Expand Down
7 changes: 3 additions & 4 deletions WICTextureLoader/WICTextureLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dxgiformat.h>
#include <assert.h>

// VS 2010's stdint.h conflicts with intsafe.h
Expand All @@ -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

Expand All @@ -53,7 +52,7 @@ using Microsoft::WRL::ComPtr;
template<UINT TNameLength>
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);
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 9 additions & 3 deletions WICTextureLoader/WICTextureLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <d3d11.h>
#if defined(_XBOX_ONE) && defined(_TITLE) && MONOLITHIC
#include <d3d11_x.h>
#define DCOMMON_H_INCLUDED
#define NO_D3D11_DEBUG_NAME
#else
#include <d3d11_1.h>
#endif

#pragma warning(push)
#pragma warning(disable : 4005)
Expand Down

0 comments on commit 3b396e2

Please sign in to comment.