2019-03-09 13:31:35 +00:00
|
|
|
// Copyright 2019 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-03-09 13:31:35 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <d3dcompiler.h>
|
|
|
|
#include <dxgiformat.h>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2019-11-10 14:51:43 +00:00
|
|
|
#include <wrl/client.h>
|
2019-03-09 13:31:35 +00:00
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
|
2019-05-12 04:42:16 +00:00
|
|
|
struct IDXGIFactory;
|
2019-03-09 13:31:35 +00:00
|
|
|
|
|
|
|
enum class AbstractTextureFormat : u32;
|
|
|
|
|
|
|
|
namespace D3DCommon
|
|
|
|
{
|
|
|
|
// Loading dxgi.dll and d3dcompiler.dll
|
|
|
|
bool LoadLibraries();
|
|
|
|
void UnloadLibraries();
|
|
|
|
|
|
|
|
// Returns a list of D3D device names.
|
|
|
|
std::vector<std::string> GetAdapterNames();
|
|
|
|
|
|
|
|
// Helper function which creates a DXGI factory.
|
2019-11-10 14:51:43 +00:00
|
|
|
Microsoft::WRL::ComPtr<IDXGIFactory> CreateDXGIFactory(bool debug_device);
|
2019-03-09 13:31:35 +00:00
|
|
|
|
|
|
|
// Globally-accessible D3DCompiler function.
|
|
|
|
extern pD3DCompile d3d_compile;
|
|
|
|
|
|
|
|
// Helpers for texture format conversion.
|
|
|
|
DXGI_FORMAT GetDXGIFormatForAbstractFormat(AbstractTextureFormat format, bool typeless);
|
|
|
|
DXGI_FORMAT GetSRVFormatForAbstractFormat(AbstractTextureFormat format);
|
|
|
|
DXGI_FORMAT GetRTVFormatForAbstractFormat(AbstractTextureFormat format, bool integer);
|
|
|
|
DXGI_FORMAT GetDSVFormatForAbstractFormat(AbstractTextureFormat format);
|
|
|
|
AbstractTextureFormat GetAbstractFormatForDXGIFormat(DXGI_FORMAT format);
|
|
|
|
|
|
|
|
// This function will assign a name to the given resource.
|
|
|
|
// The DirectX debug layer will make it easier to identify resources that way,
|
|
|
|
// e.g. when listing up all resources who have unreleased references.
|
2019-11-10 15:05:23 +00:00
|
|
|
void SetDebugObjectName(IUnknown* resource, std::string_view name);
|
2019-03-09 13:31:35 +00:00
|
|
|
} // namespace D3DCommon
|