mirror of
https://github.com/libretro/parallel-gx1.git
synced 2026-11-07 04:26:01 -10:00
The frontend picks the adapter and hands over its device, so the core no longer loads dxgi.dll, creates DXGI factories, enumerates adapters or creates throwaway D3D11/D3D12 devices to query AA modes and logic op support at load. Until the device arrives the AA modes are the counts every device has; the context reset fills them in from the real device (D3D12 now too) and re-validates the MSAA setting against them.
123 lines
4.1 KiB
C++
123 lines
4.1 KiB
C++
// Copyright 2016 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "VideoBackends/D3D12/VideoBackend.h"
|
|
|
|
#include <string>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
#include "Common/StringUtil.h"
|
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
#include "VideoBackends/D3D12/Common.h"
|
|
#include "VideoBackends/D3D12/D3D12BoundingBox.h"
|
|
#include "VideoBackends/D3D12/D3D12Gfx.h"
|
|
#include "VideoBackends/D3D12/D3D12PerfQuery.h"
|
|
#include "VideoBackends/D3D12/D3D12VertexManager.h"
|
|
#include "VideoBackends/D3D12/DX12Context.h"
|
|
|
|
#include "VideoCommon/FramebufferManager.h"
|
|
#include "VideoCommon/ShaderCache.h"
|
|
#include "VideoCommon/TextureCacheBase.h"
|
|
#include "VideoCommon/VideoCommon.h"
|
|
#include "VideoCommon/VideoConfig.h"
|
|
|
|
namespace DX12
|
|
{
|
|
std::string VideoBackend::GetConfigName() const
|
|
{
|
|
return CONFIG_NAME;
|
|
}
|
|
|
|
std::string VideoBackend::GetDisplayName() const
|
|
{
|
|
return "Direct3D 12";
|
|
}
|
|
|
|
void VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
|
|
{
|
|
FillBackendInfo();
|
|
}
|
|
|
|
void VideoBackend::FillBackendInfo()
|
|
{
|
|
g_backend_info.api_type = APIType::D3D;
|
|
g_backend_info.bUsesLowerLeftOrigin = false;
|
|
g_backend_info.bSupportsExclusiveFullscreen = true;
|
|
g_backend_info.bSupportsDualSourceBlend = true;
|
|
g_backend_info.bSupportsPrimitiveRestart = true;
|
|
g_backend_info.bSupportsGeometryShaders = true;
|
|
g_backend_info.bSupports3DVision = false;
|
|
g_backend_info.bSupportsEarlyZ = true;
|
|
g_backend_info.bSupportsBindingLayout = false;
|
|
g_backend_info.bSupportsBBox = true;
|
|
g_backend_info.bSupportsGSInstancing = true;
|
|
g_backend_info.bSupportsPaletteConversion = true;
|
|
g_backend_info.bSupportsClipControl = true;
|
|
g_backend_info.bSupportsSSAA = true;
|
|
g_backend_info.bSupportsFragmentStoresAndAtomics = true;
|
|
g_backend_info.bSupportsDepthClamp = true;
|
|
g_backend_info.bSupportsReversedDepthRange = false;
|
|
g_backend_info.bSupportsComputeShaders = true;
|
|
g_backend_info.bSupportsLogicOp = true;
|
|
g_backend_info.bSupportsMultithreading = false;
|
|
g_backend_info.bSupportsGPUTextureDecoding = true;
|
|
g_backend_info.bSupportsST3CTextures = false;
|
|
g_backend_info.bSupportsCopyToVram = true;
|
|
g_backend_info.bSupportsBitfield = false;
|
|
g_backend_info.bSupportsDynamicSamplerIndexing = false;
|
|
g_backend_info.bSupportsBPTCTextures = false;
|
|
g_backend_info.bSupportsFramebufferFetch = false;
|
|
g_backend_info.bSupportsBackgroundCompiling = true;
|
|
g_backend_info.bSupportsLargePoints = false;
|
|
g_backend_info.bSupportsDepthReadback = true;
|
|
g_backend_info.bSupportsPartialDepthCopies = false;
|
|
// The frontend picks the adapter and hands over its device: until then,
|
|
// the counts every D3D12 device has, narrowed to the device's own after.
|
|
g_backend_info.Adapters.clear();
|
|
if (g_dx_context)
|
|
g_backend_info.AAModes = g_dx_context->GetAAModes();
|
|
else
|
|
g_backend_info.AAModes = {1, 2, 4, 8};
|
|
g_backend_info.bSupportsShaderBinaries = true;
|
|
g_backend_info.bSupportsPipelineCacheData = true;
|
|
g_backend_info.bSupportsCoarseDerivatives = true;
|
|
g_backend_info.bSupportsTextureQueryLevels = true;
|
|
g_backend_info.bSupportsLodBiasInSampler = true;
|
|
g_backend_info.bSupportsSettingObjectNames = true;
|
|
g_backend_info.bSupportsPartialMultisampleResolve = true;
|
|
g_backend_info.bSupportsDynamicVertexLoader = true;
|
|
g_backend_info.bSupportsVSLinePointExpand = true;
|
|
g_backend_info.bSupportsHDROutput = true;
|
|
|
|
// We can only check texture support once we have a device.
|
|
if (g_dx_context)
|
|
{
|
|
g_backend_info.bSupportsST3CTextures =
|
|
g_dx_context->SupportsTextureFormat(DXGI_FORMAT_BC1_UNORM) &&
|
|
g_dx_context->SupportsTextureFormat(DXGI_FORMAT_BC2_UNORM) &&
|
|
g_dx_context->SupportsTextureFormat(DXGI_FORMAT_BC3_UNORM);
|
|
g_backend_info.bSupportsBPTCTextures =
|
|
g_dx_context->SupportsTextureFormat(DXGI_FORMAT_BC7_UNORM);
|
|
}
|
|
}
|
|
|
|
/* The frontend owns the device and the window: Libretro::Video brings
|
|
* the backend up on the device and queue it is handed. */
|
|
bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
void VideoBackend::Shutdown()
|
|
{
|
|
// Keep the debug runtime happy...
|
|
if (g_gfx)
|
|
Gfx::GetInstance()->ExecuteCommandList(true);
|
|
|
|
ShutdownShared();
|
|
DXContext::Destroy();
|
|
}
|
|
} // namespace DX12
|