2016-08-22 18:26:36 +00:00
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
// File: ScreenGrab12.h
|
|
|
|
//
|
|
|
|
// Function for capturing a 2D texture and saving it to a file (aka a 'screenshot'
|
|
|
|
// when used on a Direct3D 12 Render Target).
|
|
|
|
//
|
|
|
|
// Note these functions are useful as a light-weight runtime screen grabber. For
|
|
|
|
// full-featured texture capture, DDS writer, and texture processing pipeline,
|
|
|
|
// see the 'Texconv' sample and the 'DirectXTex' library.
|
|
|
|
//
|
2021-02-27 06:59:42 +00:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
2018-02-24 06:24:46 +00:00
|
|
|
// Licensed under the MIT License.
|
2016-08-22 18:26:36 +00:00
|
|
|
//
|
|
|
|
// http://go.microsoft.com/fwlink/?LinkId=248926
|
|
|
|
// http://go.microsoft.com/fwlink/?LinkID=615561
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-05-05 21:50:13 +00:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
#include <unknwn.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
#include <wsl/winadapter.h>
|
|
|
|
#include <wsl/wrladapter.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(_WIN32) || defined(USING_DIRECTX_HEADERS)
|
|
|
|
#include <directx/d3d12.h>
|
|
|
|
#include <dxguids/dxguids.h>
|
|
|
|
#else
|
2016-08-22 18:26:36 +00:00
|
|
|
#include <d3d12.h>
|
2022-05-05 21:50:13 +00:00
|
|
|
#pragma comment(lib,"dxguid.lib")
|
|
|
|
#endif
|
2016-08-22 18:26:36 +00:00
|
|
|
|
2022-05-05 21:50:13 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
|
2021-04-15 00:59:56 +00:00
|
|
|
#include <ocidl.h>
|
|
|
|
#else
|
2019-08-01 00:05:23 +00:00
|
|
|
#include <OCIdl.h>
|
2021-04-15 00:59:56 +00:00
|
|
|
#endif
|
2021-01-08 10:20:55 +00:00
|
|
|
|
2016-08-22 18:26:36 +00:00
|
|
|
#include <functional>
|
2021-01-08 10:20:55 +00:00
|
|
|
#endif
|
2016-08-22 18:26:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DirectX
|
|
|
|
{
|
|
|
|
HRESULT __cdecl SaveDDSTextureToFile(
|
|
|
|
_In_ ID3D12CommandQueue* pCommandQueue,
|
|
|
|
_In_ ID3D12Resource* pSource,
|
|
|
|
_In_z_ const wchar_t* fileName,
|
|
|
|
D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
2020-03-10 08:05:10 +00:00
|
|
|
D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET) noexcept;
|
2016-08-22 18:26:36 +00:00
|
|
|
|
2022-05-05 21:50:13 +00:00
|
|
|
#ifdef _WIN32
|
2016-08-22 18:26:36 +00:00
|
|
|
HRESULT __cdecl SaveWICTextureToFile(
|
|
|
|
_In_ ID3D12CommandQueue* pCommandQ,
|
|
|
|
_In_ ID3D12Resource* pSource,
|
|
|
|
REFGUID guidContainerFormat,
|
|
|
|
_In_z_ const wchar_t* fileName,
|
|
|
|
D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
|
|
|
D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
|
|
|
_In_opt_ const GUID* targetFormat = nullptr,
|
2024-08-15 17:13:49 +00:00
|
|
|
_In_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr,
|
2020-05-31 05:14:59 +00:00
|
|
|
bool forceSRGB = false);
|
2021-01-08 10:20:55 +00:00
|
|
|
#endif
|
2019-08-01 00:05:23 +00:00
|
|
|
}
|