2020-06-19 17:33:34 +00:00
|
|
|
#include "d3d11_host_display.h"
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "common/d3d11/shader_compiler.h"
|
|
|
|
#include "common/log.h"
|
2020-06-19 17:33:49 +00:00
|
|
|
#include "common/string_util.h"
|
2020-06-19 17:33:34 +00:00
|
|
|
#include "display_ps.hlsl.h"
|
|
|
|
#include "display_vs.hlsl.h"
|
|
|
|
#include <array>
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-19 17:33:34 +00:00
|
|
|
#include <dxgi1_5.h>
|
2020-09-01 02:46:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_IMGUI
|
|
|
|
#include "imgui.h"
|
|
|
|
#include "imgui_impl_dx11.h"
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-19 17:33:34 +00:00
|
|
|
Log_SetChannel(D3D11HostDisplay);
|
|
|
|
|
|
|
|
namespace FrontendCommon {
|
|
|
|
|
|
|
|
class D3D11HostDisplayTexture : public HostDisplayTexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
template<typename T>
|
|
|
|
using ComPtr = Microsoft::WRL::ComPtr<T>;
|
|
|
|
|
|
|
|
D3D11HostDisplayTexture(ComPtr<ID3D11Texture2D> texture, ComPtr<ID3D11ShaderResourceView> srv, u32 width, u32 height,
|
|
|
|
bool dynamic)
|
|
|
|
: m_texture(std::move(texture)), m_srv(std::move(srv)), m_width(width), m_height(height), m_dynamic(dynamic)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
~D3D11HostDisplayTexture() override = default;
|
|
|
|
|
|
|
|
void* GetHandle() const override { return m_srv.Get(); }
|
|
|
|
u32 GetWidth() const override { return m_width; }
|
|
|
|
u32 GetHeight() const override { return m_height; }
|
|
|
|
|
|
|
|
ID3D11Texture2D* GetD3DTexture() const { return m_texture.Get(); }
|
|
|
|
ID3D11ShaderResourceView* GetD3DSRV() const { return m_srv.Get(); }
|
|
|
|
ID3D11ShaderResourceView* const* GetD3DSRVArray() const { return m_srv.GetAddressOf(); }
|
|
|
|
bool IsDynamic() const { return m_dynamic; }
|
|
|
|
|
|
|
|
static std::unique_ptr<D3D11HostDisplayTexture> Create(ID3D11Device* device, u32 width, u32 height, const void* data,
|
|
|
|
u32 data_stride, bool dynamic)
|
|
|
|
{
|
|
|
|
const CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8G8B8A8_UNORM, width, height, 1, 1, D3D11_BIND_SHADER_RESOURCE,
|
|
|
|
dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT,
|
|
|
|
dynamic ? D3D11_CPU_ACCESS_WRITE : 0, 1, 0, 0);
|
|
|
|
const D3D11_SUBRESOURCE_DATA srd{data, data_stride, data_stride * height};
|
|
|
|
ComPtr<ID3D11Texture2D> texture;
|
|
|
|
HRESULT hr = device->CreateTexture2D(&desc, data ? &srd : nullptr, texture.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
return {};
|
|
|
|
|
|
|
|
const CD3D11_SHADER_RESOURCE_VIEW_DESC srv_desc(D3D11_SRV_DIMENSION_TEXTURE2D, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 1, 0,
|
|
|
|
1);
|
|
|
|
ComPtr<ID3D11ShaderResourceView> srv;
|
|
|
|
hr = device->CreateShaderResourceView(texture.Get(), &srv_desc, srv.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
return {};
|
|
|
|
|
|
|
|
return std::make_unique<D3D11HostDisplayTexture>(std::move(texture), std::move(srv), width, height, dynamic);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ComPtr<ID3D11Texture2D> m_texture;
|
|
|
|
ComPtr<ID3D11ShaderResourceView> m_srv;
|
|
|
|
u32 m_width;
|
|
|
|
u32 m_height;
|
|
|
|
bool m_dynamic;
|
|
|
|
};
|
|
|
|
|
|
|
|
D3D11HostDisplay::D3D11HostDisplay() = default;
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
D3D11HostDisplay::~D3D11HostDisplay()
|
|
|
|
{
|
|
|
|
AssertMsg(!m_context, "Context should have been destroyed by now");
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-29 16:46:57 +00:00
|
|
|
AssertMsg(!m_swap_chain, "Swap chain should have been destroyed by now");
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HostDisplay::RenderAPI D3D11HostDisplay::GetRenderAPI() const
|
|
|
|
{
|
|
|
|
return HostDisplay::RenderAPI::D3D11;
|
|
|
|
}
|
|
|
|
|
|
|
|
void* D3D11HostDisplay::GetRenderDevice() const
|
|
|
|
{
|
|
|
|
return m_device.Get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void* D3D11HostDisplay::GetRenderContext() const
|
|
|
|
{
|
|
|
|
return m_context.Get();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::HasRenderDevice() const
|
|
|
|
{
|
|
|
|
return static_cast<bool>(m_device);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::HasRenderSurface() const
|
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-29 16:46:57 +00:00
|
|
|
return static_cast<bool>(m_swap_chain);
|
2020-07-10 04:01:48 +00:00
|
|
|
#else
|
|
|
|
return true;
|
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
}
|
2020-06-19 17:33:34 +00:00
|
|
|
|
|
|
|
std::unique_ptr<HostDisplayTexture> D3D11HostDisplay::CreateTexture(u32 width, u32 height, const void* initial_data,
|
|
|
|
u32 initial_data_stride, bool dynamic)
|
|
|
|
{
|
|
|
|
return D3D11HostDisplayTexture::Create(m_device.Get(), width, height, initial_data, initial_data_stride, dynamic);
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3D11HostDisplay::UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height,
|
|
|
|
const void* texture_data, u32 texture_data_stride)
|
|
|
|
{
|
|
|
|
D3D11HostDisplayTexture* d3d11_texture = static_cast<D3D11HostDisplayTexture*>(texture);
|
|
|
|
if (!d3d11_texture->IsDynamic())
|
|
|
|
{
|
|
|
|
const CD3D11_BOX dst_box(x, y, 0, x + width, y + height, 1);
|
|
|
|
m_context->UpdateSubresource(d3d11_texture->GetD3DTexture(), 0, &dst_box, texture_data, texture_data_stride,
|
|
|
|
texture_data_stride * height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
D3D11_MAPPED_SUBRESOURCE sr;
|
|
|
|
HRESULT hr = m_context->Map(d3d11_texture->GetD3DTexture(), 0, D3D11_MAP_WRITE_DISCARD, 0, &sr);
|
|
|
|
if (FAILED(hr))
|
|
|
|
Panic("Failed to map dynamic host display texture");
|
|
|
|
|
|
|
|
char* dst_ptr = static_cast<char*>(sr.pData) + (y * sr.RowPitch) + (x * sizeof(u32));
|
|
|
|
const char* src_ptr = static_cast<const char*>(texture_data);
|
|
|
|
if (sr.RowPitch == texture_data_stride)
|
|
|
|
{
|
|
|
|
std::memcpy(dst_ptr, src_ptr, texture_data_stride * height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (u32 row = 0; row < height; row++)
|
|
|
|
{
|
|
|
|
std::memcpy(dst_ptr, src_ptr, width * sizeof(u32));
|
|
|
|
src_ptr += texture_data_stride;
|
|
|
|
dst_ptr += sr.RowPitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_context->Unmap(d3d11_texture->GetD3DTexture(), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::DownloadTexture(const void* texture_handle, u32 x, u32 y, u32 width, u32 height, void* out_data,
|
|
|
|
u32 out_data_stride)
|
|
|
|
{
|
|
|
|
ID3D11ShaderResourceView* srv =
|
|
|
|
const_cast<ID3D11ShaderResourceView*>(static_cast<const ID3D11ShaderResourceView*>(texture_handle));
|
|
|
|
ID3D11Resource* srv_resource;
|
|
|
|
D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc;
|
|
|
|
srv->GetResource(&srv_resource);
|
|
|
|
srv->GetDesc(&srv_desc);
|
|
|
|
|
|
|
|
if (!m_readback_staging_texture.EnsureSize(m_context.Get(), width, height, srv_desc.Format, false))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
m_readback_staging_texture.CopyFromTexture(m_context.Get(), srv_resource, 0, x, y, 0, 0, width, height);
|
|
|
|
return m_readback_staging_texture.ReadPixels<u32>(m_context.Get(), 0, 0, width, height, out_data_stride / sizeof(u32),
|
|
|
|
static_cast<u32*>(out_data));
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3D11HostDisplay::SetVSync(bool enabled)
|
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-19 17:33:34 +00:00
|
|
|
m_vsync = enabled;
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-19 17:33:34 +00:00
|
|
|
}
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device)
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-19 17:33:34 +00:00
|
|
|
UINT create_flags = 0;
|
|
|
|
if (debug_device)
|
|
|
|
create_flags |= D3D11_CREATE_DEVICE_DEBUG;
|
|
|
|
|
2020-06-19 17:33:57 +00:00
|
|
|
ComPtr<IDXGIFactory> temp_dxgi_factory;
|
|
|
|
HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(temp_dxgi_factory.GetAddressOf()));
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
Log_ErrorPrintf("Failed to create DXGI factory: 0x%08X", hr);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 adapter_index;
|
|
|
|
if (!adapter_name.empty())
|
|
|
|
{
|
|
|
|
std::vector<std::string> adapter_names = EnumerateAdapterNames(temp_dxgi_factory.Get());
|
|
|
|
for (adapter_index = 0; adapter_index < static_cast<u32>(adapter_names.size()); adapter_index++)
|
|
|
|
{
|
|
|
|
if (adapter_name == adapter_names[adapter_index])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (adapter_index == static_cast<u32>(adapter_names.size()))
|
|
|
|
{
|
|
|
|
Log_WarningPrintf("Could not find adapter '%s', using first (%s)", std::string(adapter_name).c_str(),
|
|
|
|
adapter_names[0].c_str());
|
|
|
|
adapter_index = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Log_InfoPrintf("No adapter selected, using first.");
|
|
|
|
adapter_index = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ComPtr<IDXGIAdapter> dxgi_adapter;
|
|
|
|
hr = temp_dxgi_factory->EnumAdapters(adapter_index, dxgi_adapter.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
Log_WarningPrintf("Failed to enumerate adapter %u, using default", adapter_index);
|
|
|
|
|
2020-07-09 03:00:31 +00:00
|
|
|
static constexpr std::array<D3D_FEATURE_LEVEL, 3> requested_feature_levels = {
|
2020-07-11 11:23:39 +00:00
|
|
|
{D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0}};
|
2020-07-09 03:00:31 +00:00
|
|
|
|
|
|
|
hr =
|
|
|
|
D3D11CreateDevice(dxgi_adapter.Get(), dxgi_adapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, nullptr,
|
|
|
|
create_flags, requested_feature_levels.data(), static_cast<UINT>(requested_feature_levels.size()),
|
|
|
|
D3D11_SDK_VERSION, m_device.GetAddressOf(), nullptr, m_context.GetAddressOf());
|
2020-06-19 17:33:57 +00:00
|
|
|
|
|
|
|
// we re-grab these later, see below
|
|
|
|
dxgi_adapter.Reset();
|
|
|
|
temp_dxgi_factory.Reset();
|
2020-06-19 17:33:34 +00:00
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
Log_ErrorPrintf("Failed to create D3D device: 0x%08X", hr);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (debug_device && IsDebuggerPresent())
|
|
|
|
{
|
|
|
|
ComPtr<ID3D11InfoQueue> info;
|
|
|
|
hr = m_device.As(&info);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
info->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, TRUE);
|
|
|
|
info->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// we need the specific factory for the device, otherwise MakeWindowAssociation() is flaky.
|
|
|
|
ComPtr<IDXGIDevice> dxgi_device;
|
|
|
|
if (FAILED(m_device.As(&dxgi_device)) || FAILED(dxgi_device->GetParent(IID_PPV_ARGS(dxgi_adapter.GetAddressOf()))) ||
|
|
|
|
FAILED(dxgi_adapter->GetParent(IID_PPV_ARGS(m_dxgi_factory.GetAddressOf()))))
|
|
|
|
{
|
|
|
|
Log_WarningPrint("Failed to get parent adapter/device/factory");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DXGI_ADAPTER_DESC adapter_desc;
|
|
|
|
if (SUCCEEDED(dxgi_adapter->GetDesc(&adapter_desc)))
|
|
|
|
{
|
|
|
|
char adapter_name_buffer[128];
|
|
|
|
const int name_length =
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, adapter_desc.Description, static_cast<int>(std::wcslen(adapter_desc.Description)),
|
|
|
|
adapter_name_buffer, countof(adapter_name_buffer), 0, nullptr);
|
|
|
|
if (name_length >= 0)
|
|
|
|
{
|
|
|
|
adapter_name_buffer[name_length] = 0;
|
|
|
|
Log_InfoPrintf("D3D Adapter: %s", adapter_name_buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_allow_tearing_supported = false;
|
|
|
|
ComPtr<IDXGIFactory5> dxgi_factory5;
|
|
|
|
hr = m_dxgi_factory.As(&dxgi_factory5);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
BOOL allow_tearing_supported = false;
|
|
|
|
hr = dxgi_factory5->CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allow_tearing_supported,
|
|
|
|
sizeof(allow_tearing_supported));
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
m_allow_tearing_supported = (allow_tearing_supported == TRUE);
|
|
|
|
}
|
2020-07-09 03:24:56 +00:00
|
|
|
#endif
|
2020-06-19 17:33:34 +00:00
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
m_window_info = wi;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device)
|
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-07-04 07:37:50 +00:00
|
|
|
if (m_window_info.type != WindowInfo::Type::Surfaceless && m_window_info.type != WindowInfo::Type::Libretro &&
|
|
|
|
!CreateSwapChain())
|
|
|
|
{
|
2020-06-29 16:46:57 +00:00
|
|
|
return false;
|
2020-07-04 07:37:50 +00:00
|
|
|
}
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
|
|
|
|
if (!CreateResources())
|
|
|
|
return false;
|
|
|
|
|
2020-09-01 02:46:58 +00:00
|
|
|
#ifdef WITH_IMGUI
|
2020-06-29 16:46:57 +00:00
|
|
|
if (ImGui::GetCurrentContext() && !CreateImGuiContext())
|
|
|
|
return false;
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
|
|
|
|
return true;
|
2020-06-19 17:33:34 +00:00
|
|
|
}
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
void D3D11HostDisplay::DestroyRenderDevice()
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
2020-09-01 02:46:58 +00:00
|
|
|
#ifdef WITH_IMGUI
|
2020-06-29 16:46:57 +00:00
|
|
|
if (ImGui::GetCurrentContext())
|
|
|
|
DestroyImGuiContext();
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
|
|
|
|
DestroyResources();
|
|
|
|
DestroyRenderSurface();
|
2020-06-19 17:33:34 +00:00
|
|
|
m_context.Reset();
|
|
|
|
m_device.Reset();
|
|
|
|
}
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
bool D3D11HostDisplay::MakeRenderContextCurrent()
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
2020-06-29 16:46:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::DoneRenderContextCurrent()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
bool D3D11HostDisplay::CreateSwapChain()
|
|
|
|
{
|
|
|
|
if (m_window_info.type != WindowInfo::Type::Win32)
|
2020-06-19 17:33:34 +00:00
|
|
|
return false;
|
|
|
|
|
2020-07-10 04:01:48 +00:00
|
|
|
m_using_flip_model_swap_chain = true;
|
2020-06-19 17:33:34 +00:00
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
const HWND window_hwnd = reinterpret_cast<HWND>(m_window_info.window_handle);
|
2020-06-19 17:33:34 +00:00
|
|
|
RECT client_rc{};
|
|
|
|
GetClientRect(window_hwnd, &client_rc);
|
|
|
|
const u32 width = static_cast<u32>(client_rc.right - client_rc.left);
|
|
|
|
const u32 height = static_cast<u32>(client_rc.bottom - client_rc.top);
|
|
|
|
|
|
|
|
DXGI_SWAP_CHAIN_DESC swap_chain_desc = {};
|
|
|
|
swap_chain_desc.BufferDesc.Width = width;
|
|
|
|
swap_chain_desc.BufferDesc.Height = height;
|
|
|
|
swap_chain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
swap_chain_desc.SampleDesc.Count = 1;
|
|
|
|
swap_chain_desc.BufferCount = 3;
|
|
|
|
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
|
|
|
swap_chain_desc.OutputWindow = window_hwnd;
|
|
|
|
swap_chain_desc.Windowed = TRUE;
|
|
|
|
swap_chain_desc.SwapEffect = m_using_flip_model_swap_chain ? DXGI_SWAP_EFFECT_FLIP_DISCARD : DXGI_SWAP_EFFECT_DISCARD;
|
|
|
|
|
|
|
|
m_using_allow_tearing = (m_allow_tearing_supported && m_using_flip_model_swap_chain);
|
|
|
|
if (m_using_allow_tearing)
|
|
|
|
swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
|
|
|
|
|
|
|
|
Log_InfoPrintf("Creating a %dx%d %s %s swap chain", width, height,
|
|
|
|
m_using_flip_model_swap_chain ? "flip-discard" : "discard",
|
|
|
|
swap_chain_desc.Windowed ? "windowed" : "full-screen");
|
|
|
|
|
|
|
|
HRESULT hr = m_dxgi_factory->CreateSwapChain(m_device.Get(), &swap_chain_desc, m_swap_chain.GetAddressOf());
|
|
|
|
if (FAILED(hr) && m_using_flip_model_swap_chain)
|
|
|
|
{
|
|
|
|
Log_WarningPrintf("Failed to create a flip-discard swap chain, trying discard.");
|
|
|
|
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
|
|
|
swap_chain_desc.Flags = 0;
|
|
|
|
m_using_flip_model_swap_chain = false;
|
|
|
|
m_using_allow_tearing = false;
|
|
|
|
|
|
|
|
hr = m_dxgi_factory->CreateSwapChain(m_device.Get(), &swap_chain_desc, m_swap_chain.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
Log_ErrorPrintf("CreateSwapChain failed: 0x%08X", hr);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = m_dxgi_factory->MakeWindowAssociation(swap_chain_desc.OutputWindow, DXGI_MWA_NO_WINDOW_CHANGES);
|
|
|
|
if (FAILED(hr))
|
|
|
|
Log_WarningPrintf("MakeWindowAssociation() to disable ALT+ENTER failed");
|
|
|
|
|
|
|
|
return CreateSwapChainRTV();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::CreateSwapChainRTV()
|
|
|
|
{
|
|
|
|
ComPtr<ID3D11Texture2D> backbuffer;
|
|
|
|
HRESULT hr = m_swap_chain->GetBuffer(0, IID_PPV_ARGS(backbuffer.GetAddressOf()));
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
Log_ErrorPrintf("GetBuffer for RTV failed: 0x%08X", hr);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
D3D11_TEXTURE2D_DESC backbuffer_desc;
|
|
|
|
backbuffer->GetDesc(&backbuffer_desc);
|
|
|
|
|
|
|
|
CD3D11_RENDER_TARGET_VIEW_DESC rtv_desc(D3D11_RTV_DIMENSION_TEXTURE2D, backbuffer_desc.Format, 0, 0,
|
|
|
|
backbuffer_desc.ArraySize);
|
|
|
|
hr = m_device->CreateRenderTargetView(backbuffer.Get(), &rtv_desc, m_swap_chain_rtv.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
Log_ErrorPrintf("CreateRenderTargetView for swap chain failed: 0x%08X", hr);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
m_window_info.surface_width = backbuffer_desc.Width;
|
|
|
|
m_window_info.surface_height = backbuffer_desc.Height;
|
|
|
|
|
|
|
|
if (ImGui::GetCurrentContext())
|
|
|
|
{
|
|
|
|
ImGui::GetIO().DisplaySize.x = static_cast<float>(backbuffer_desc.Width);
|
|
|
|
ImGui::GetIO().DisplaySize.y = static_cast<float>(backbuffer_desc.Height);
|
|
|
|
}
|
|
|
|
|
2020-06-19 17:33:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
bool D3D11HostDisplay::ChangeRenderWindow(const WindowInfo& new_wi)
|
2020-06-19 17:33:37 +00:00
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-29 16:46:57 +00:00
|
|
|
DestroyRenderSurface();
|
|
|
|
|
|
|
|
m_window_info = new_wi;
|
|
|
|
return CreateSwapChain();
|
2020-07-10 04:01:48 +00:00
|
|
|
#else
|
|
|
|
m_window_info = new_wi;
|
|
|
|
return true;
|
|
|
|
#endif
|
2020-06-19 17:33:37 +00:00
|
|
|
}
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
void D3D11HostDisplay::DestroyRenderSurface()
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-19 17:33:34 +00:00
|
|
|
m_swap_chain_rtv.Reset();
|
|
|
|
m_swap_chain.Reset();
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-19 17:33:34 +00:00
|
|
|
}
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
void D3D11HostDisplay::ResizeRenderWindow(s32 new_window_width, s32 new_window_height)
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-19 17:33:34 +00:00
|
|
|
if (!m_swap_chain)
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_swap_chain_rtv.Reset();
|
|
|
|
|
|
|
|
HRESULT hr = m_swap_chain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN,
|
|
|
|
m_using_allow_tearing ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0);
|
|
|
|
if (FAILED(hr))
|
|
|
|
Log_ErrorPrintf("ResizeBuffers() failed: 0x%08X", hr);
|
|
|
|
|
|
|
|
if (!CreateSwapChainRTV())
|
|
|
|
Panic("Failed to recreate swap chain RTV after resize");
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-19 17:33:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::CreateResources()
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
m_display_vertex_shader =
|
|
|
|
D3D11::ShaderCompiler::CreateVertexShader(m_device.Get(), s_display_vs_bytecode, sizeof(s_display_vs_bytecode));
|
|
|
|
m_display_pixel_shader =
|
|
|
|
D3D11::ShaderCompiler::CreatePixelShader(m_device.Get(), s_display_ps_bytecode, sizeof(s_display_ps_bytecode));
|
|
|
|
if (!m_display_vertex_shader || !m_display_pixel_shader)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!m_display_uniform_buffer.Create(m_device.Get(), D3D11_BIND_CONSTANT_BUFFER, DISPLAY_UNIFORM_BUFFER_SIZE))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
CD3D11_RASTERIZER_DESC rasterizer_desc = CD3D11_RASTERIZER_DESC(CD3D11_DEFAULT());
|
|
|
|
rasterizer_desc.CullMode = D3D11_CULL_NONE;
|
|
|
|
hr = m_device->CreateRasterizerState(&rasterizer_desc, m_display_rasterizer_state.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
CD3D11_DEPTH_STENCIL_DESC depth_stencil_desc = CD3D11_DEPTH_STENCIL_DESC(CD3D11_DEFAULT());
|
|
|
|
depth_stencil_desc.DepthEnable = FALSE;
|
|
|
|
depth_stencil_desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
|
|
|
|
hr = m_device->CreateDepthStencilState(&depth_stencil_desc, m_display_depth_stencil_state.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
CD3D11_BLEND_DESC blend_desc = CD3D11_BLEND_DESC(CD3D11_DEFAULT());
|
|
|
|
hr = m_device->CreateBlendState(&blend_desc, m_display_blend_state.GetAddressOf());
|
2020-06-30 14:34:30 +00:00
|
|
|
if (FAILED(hr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
blend_desc.RenderTarget[0] = {TRUE,
|
|
|
|
D3D11_BLEND_SRC_ALPHA,
|
|
|
|
D3D11_BLEND_INV_SRC_ALPHA,
|
|
|
|
D3D11_BLEND_OP_ADD,
|
|
|
|
D3D11_BLEND_ONE,
|
|
|
|
D3D11_BLEND_ZERO,
|
|
|
|
D3D11_BLEND_OP_ADD,
|
|
|
|
D3D11_COLOR_WRITE_ENABLE_ALL};
|
|
|
|
hr = m_device->CreateBlendState(&blend_desc, m_software_cursor_blend_state.GetAddressOf());
|
2020-06-19 17:33:34 +00:00
|
|
|
if (FAILED(hr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
CD3D11_SAMPLER_DESC sampler_desc = CD3D11_SAMPLER_DESC(CD3D11_DEFAULT());
|
|
|
|
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
|
|
|
hr = m_device->CreateSamplerState(&sampler_desc, m_point_sampler.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
|
|
|
hr = m_device->CreateSamplerState(&sampler_desc, m_linear_sampler.GetAddressOf());
|
|
|
|
if (FAILED(hr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3D11HostDisplay::DestroyResources()
|
|
|
|
{
|
|
|
|
m_display_uniform_buffer.Release();
|
|
|
|
m_linear_sampler.Reset();
|
|
|
|
m_point_sampler.Reset();
|
|
|
|
m_display_pixel_shader.Reset();
|
|
|
|
m_display_vertex_shader.Reset();
|
|
|
|
m_display_blend_state.Reset();
|
|
|
|
m_display_depth_stencil_state.Reset();
|
|
|
|
m_display_rasterizer_state.Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3D11HostDisplay::CreateImGuiContext()
|
|
|
|
{
|
2020-09-01 02:46:58 +00:00
|
|
|
#ifdef WITH_IMGUI
|
2020-06-29 16:46:57 +00:00
|
|
|
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
|
|
|
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
2020-06-19 17:33:34 +00:00
|
|
|
|
|
|
|
if (!ImGui_ImplDX11_Init(m_device.Get(), m_context.Get()))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
ImGui_ImplDX11_NewFrame();
|
2020-09-01 02:46:58 +00:00
|
|
|
#endif
|
2020-06-19 17:33:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3D11HostDisplay::DestroyImGuiContext()
|
|
|
|
{
|
2020-09-01 02:46:58 +00:00
|
|
|
#ifdef WITH_IMGUI
|
2020-06-19 17:33:34 +00:00
|
|
|
ImGui_ImplDX11_Shutdown();
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-09-01 02:46:58 +00:00
|
|
|
}
|
2020-06-19 17:33:34 +00:00
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
bool D3D11HostDisplay::Render()
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
2020-06-19 17:33:34 +00:00
|
|
|
static constexpr std::array<float, 4> clear_color = {};
|
|
|
|
m_context->ClearRenderTargetView(m_swap_chain_rtv.Get(), clear_color.data());
|
|
|
|
m_context->OMSetRenderTargets(1, m_swap_chain_rtv.GetAddressOf(), nullptr);
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
RenderDisplay();
|
|
|
|
|
2020-09-01 02:46:58 +00:00
|
|
|
#ifdef WITH_IMGUI
|
2020-06-29 16:46:57 +00:00
|
|
|
if (ImGui::GetCurrentContext())
|
|
|
|
RenderImGui();
|
2020-09-01 02:46:58 +00:00
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
|
|
|
|
RenderSoftwareCursor();
|
|
|
|
|
|
|
|
if (!m_vsync && m_using_allow_tearing)
|
|
|
|
m_swap_chain->Present(0, DXGI_PRESENT_ALLOW_TEARING);
|
|
|
|
else
|
|
|
|
m_swap_chain->Present(BoolToUInt32(m_vsync), 0);
|
|
|
|
|
2020-09-01 02:46:58 +00:00
|
|
|
#ifdef WITH_IMGUI
|
2020-06-29 16:46:57 +00:00
|
|
|
if (ImGui::GetCurrentContext())
|
|
|
|
ImGui_ImplDX11_NewFrame();
|
2020-09-01 02:46:58 +00:00
|
|
|
#endif
|
2020-07-10 04:01:48 +00:00
|
|
|
#else
|
|
|
|
RenderDisplay();
|
|
|
|
RenderSoftwareCursor();
|
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
|
2020-06-19 17:33:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3D11HostDisplay::RenderImGui()
|
|
|
|
{
|
2020-09-01 02:46:58 +00:00
|
|
|
#ifdef WITH_IMGUI
|
2020-06-19 17:33:34 +00:00
|
|
|
ImGui::Render();
|
|
|
|
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-09-01 02:46:58 +00:00
|
|
|
}
|
2020-07-10 04:01:48 +00:00
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
void D3D11HostDisplay::RenderDisplay()
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
2020-06-29 16:46:57 +00:00
|
|
|
if (!HasDisplayTexture())
|
|
|
|
return;
|
2020-06-19 17:33:34 +00:00
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
const auto [left, top, width, height] = CalculateDrawRect(GetWindowWidth(), GetWindowHeight(), m_display_top_margin);
|
|
|
|
RenderDisplay(left, top, width, height, m_display_texture_handle, m_display_texture_width, m_display_texture_height,
|
|
|
|
m_display_texture_view_x, m_display_texture_view_y, m_display_texture_view_width,
|
|
|
|
m_display_texture_view_height, m_display_linear_filtering);
|
2020-06-19 17:33:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void D3D11HostDisplay::RenderDisplay(s32 left, s32 top, s32 width, s32 height, void* texture_handle, u32 texture_width,
|
2020-06-29 16:46:57 +00:00
|
|
|
s32 texture_height, s32 texture_view_x, s32 texture_view_y, s32 texture_view_width,
|
|
|
|
s32 texture_view_height, bool linear_filter)
|
2020-06-19 17:33:34 +00:00
|
|
|
{
|
|
|
|
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
|
|
|
m_context->VSSetShader(m_display_vertex_shader.Get(), nullptr, 0);
|
|
|
|
m_context->PSSetShader(m_display_pixel_shader.Get(), nullptr, 0);
|
|
|
|
m_context->PSSetShaderResources(0, 1, reinterpret_cast<ID3D11ShaderResourceView**>(&texture_handle));
|
|
|
|
m_context->PSSetSamplers(0, 1, linear_filter ? m_linear_sampler.GetAddressOf() : m_point_sampler.GetAddressOf());
|
|
|
|
|
|
|
|
const float uniforms[4] = {static_cast<float>(texture_view_x) / static_cast<float>(texture_width),
|
|
|
|
static_cast<float>(texture_view_y) / static_cast<float>(texture_height),
|
|
|
|
(static_cast<float>(texture_view_width) - 0.5f) / static_cast<float>(texture_width),
|
|
|
|
(static_cast<float>(texture_view_height) - 0.5f) / static_cast<float>(texture_height)};
|
|
|
|
const auto map = m_display_uniform_buffer.Map(m_context.Get(), sizeof(uniforms), sizeof(uniforms));
|
|
|
|
std::memcpy(map.pointer, uniforms, sizeof(uniforms));
|
|
|
|
m_display_uniform_buffer.Unmap(m_context.Get(), sizeof(uniforms));
|
|
|
|
m_context->VSSetConstantBuffers(0, 1, m_display_uniform_buffer.GetD3DBufferArray());
|
|
|
|
|
|
|
|
const CD3D11_VIEWPORT vp(static_cast<float>(left), static_cast<float>(top), static_cast<float>(width),
|
|
|
|
static_cast<float>(height));
|
|
|
|
m_context->RSSetViewports(1, &vp);
|
|
|
|
m_context->RSSetState(m_display_rasterizer_state.Get());
|
|
|
|
m_context->OMSetDepthStencilState(m_display_depth_stencil_state.Get(), 0);
|
|
|
|
m_context->OMSetBlendState(m_display_blend_state.Get(), nullptr, 0xFFFFFFFFu);
|
|
|
|
|
|
|
|
m_context->Draw(3, 0);
|
|
|
|
}
|
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
void D3D11HostDisplay::RenderSoftwareCursor()
|
|
|
|
{
|
|
|
|
if (!HasSoftwareCursor())
|
|
|
|
return;
|
|
|
|
|
|
|
|
const auto [left, top, width, height] = CalculateSoftwareCursorDrawRect();
|
|
|
|
RenderSoftwareCursor(left, top, width, height, m_cursor_texture.get());
|
|
|
|
}
|
|
|
|
|
2020-06-19 17:33:34 +00:00
|
|
|
void D3D11HostDisplay::RenderSoftwareCursor(s32 left, s32 top, s32 width, s32 height,
|
|
|
|
HostDisplayTexture* texture_handle)
|
|
|
|
{
|
|
|
|
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
|
|
|
m_context->VSSetShader(m_display_vertex_shader.Get(), nullptr, 0);
|
|
|
|
m_context->PSSetShader(m_display_pixel_shader.Get(), nullptr, 0);
|
|
|
|
m_context->PSSetShaderResources(0, 1, static_cast<D3D11HostDisplayTexture*>(texture_handle)->GetD3DSRVArray());
|
|
|
|
m_context->PSSetSamplers(0, 1, m_linear_sampler.GetAddressOf());
|
|
|
|
|
|
|
|
const float uniforms[4] = {0.0f, 0.0f, 1.0f, 1.0f};
|
|
|
|
const auto map = m_display_uniform_buffer.Map(m_context.Get(), sizeof(uniforms), sizeof(uniforms));
|
|
|
|
std::memcpy(map.pointer, uniforms, sizeof(uniforms));
|
|
|
|
m_display_uniform_buffer.Unmap(m_context.Get(), sizeof(uniforms));
|
|
|
|
m_context->VSSetConstantBuffers(0, 1, m_display_uniform_buffer.GetD3DBufferArray());
|
|
|
|
|
|
|
|
const CD3D11_VIEWPORT vp(static_cast<float>(left), static_cast<float>(top), static_cast<float>(width),
|
|
|
|
static_cast<float>(height));
|
|
|
|
m_context->RSSetViewports(1, &vp);
|
|
|
|
m_context->RSSetState(m_display_rasterizer_state.Get());
|
|
|
|
m_context->OMSetDepthStencilState(m_display_depth_stencil_state.Get(), 0);
|
|
|
|
m_context->OMSetBlendState(m_software_cursor_blend_state.Get(), nullptr, 0xFFFFFFFFu);
|
|
|
|
|
|
|
|
m_context->Draw(3, 0);
|
|
|
|
}
|
|
|
|
|
2020-07-10 04:01:48 +00:00
|
|
|
#ifndef LIBRETRO
|
|
|
|
|
2020-06-19 17:33:49 +00:00
|
|
|
std::vector<std::string> D3D11HostDisplay::EnumerateAdapterNames()
|
|
|
|
{
|
|
|
|
ComPtr<IDXGIFactory> dxgi_factory;
|
|
|
|
HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(dxgi_factory.GetAddressOf()));
|
2020-06-19 17:33:57 +00:00
|
|
|
if (FAILED(hr))
|
|
|
|
return {};
|
|
|
|
|
|
|
|
return EnumerateAdapterNames(dxgi_factory.Get());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::string> D3D11HostDisplay::EnumerateAdapterNames(IDXGIFactory* dxgi_factory)
|
|
|
|
{
|
|
|
|
std::vector<std::string> adapter_names;
|
|
|
|
ComPtr<IDXGIAdapter> current_adapter;
|
|
|
|
while (SUCCEEDED(
|
|
|
|
dxgi_factory->EnumAdapters(static_cast<UINT>(adapter_names.size()), current_adapter.ReleaseAndGetAddressOf())))
|
2020-06-19 17:33:49 +00:00
|
|
|
{
|
2020-06-19 17:33:57 +00:00
|
|
|
DXGI_ADAPTER_DESC adapter_desc;
|
|
|
|
std::string adapter_name;
|
|
|
|
if (SUCCEEDED(current_adapter->GetDesc(&adapter_desc)))
|
2020-06-19 17:33:49 +00:00
|
|
|
{
|
2020-06-19 17:33:57 +00:00
|
|
|
char adapter_name_buffer[128];
|
|
|
|
const int name_length = WideCharToMultiByte(CP_UTF8, 0, adapter_desc.Description,
|
|
|
|
static_cast<int>(std::wcslen(adapter_desc.Description)),
|
|
|
|
adapter_name_buffer, countof(adapter_name_buffer), 0, nullptr);
|
|
|
|
if (name_length >= 0)
|
|
|
|
adapter_name.assign(adapter_name_buffer, static_cast<size_t>(name_length));
|
2020-06-19 17:33:49 +00:00
|
|
|
else
|
|
|
|
adapter_name.assign("(Unknown)");
|
2020-06-19 17:33:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
adapter_name.assign("(Unknown)");
|
|
|
|
}
|
2020-06-19 17:33:49 +00:00
|
|
|
|
2020-06-19 17:33:57 +00:00
|
|
|
// handle duplicate adapter names
|
|
|
|
if (std::any_of(adapter_names.begin(), adapter_names.end(),
|
|
|
|
[&adapter_name](const std::string& other) { return (adapter_name == other); }))
|
|
|
|
{
|
|
|
|
std::string original_adapter_name = std::move(adapter_name);
|
2020-06-19 17:33:49 +00:00
|
|
|
|
2020-06-19 17:33:57 +00:00
|
|
|
u32 current_extra = 2;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
adapter_name = StringUtil::StdStringFromFormat("%s (%u)", original_adapter_name.c_str(), current_extra);
|
|
|
|
current_extra++;
|
|
|
|
} while (std::any_of(adapter_names.begin(), adapter_names.end(),
|
|
|
|
[&adapter_name](const std::string& other) { return (adapter_name == other); }));
|
2020-06-19 17:33:49 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 17:33:57 +00:00
|
|
|
adapter_names.push_back(std::move(adapter_name));
|
2020-06-19 17:33:49 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 17:33:57 +00:00
|
|
|
return adapter_names;
|
2020-06-19 17:33:49 +00:00
|
|
|
}
|
|
|
|
|
2020-07-10 04:01:48 +00:00
|
|
|
#endif
|
2020-06-29 16:46:57 +00:00
|
|
|
|
2020-06-19 17:33:57 +00:00
|
|
|
} // namespace FrontendCommon
|