VideoCommon: Move backend_info out of VideoConfig struct.

This commit is contained in:
Jordan Woyak
2025-03-07 14:43:39 -06:00
parent 99e686de34
commit c18c039089
62 changed files with 741 additions and 788 deletions

View File

@ -75,68 +75,67 @@ void VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
void VideoBackend::FillBackendInfo()
{
g_Config.backend_info.api_type = APIType::D3D;
g_Config.backend_info.MaxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
g_Config.backend_info.bUsesLowerLeftOrigin = false;
g_Config.backend_info.bSupportsExclusiveFullscreen = true;
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsPrimitiveRestart = true;
g_Config.backend_info.bSupportsGeometryShaders = true;
g_Config.backend_info.bSupportsComputeShaders = false;
g_Config.backend_info.bSupports3DVision = true;
g_Config.backend_info.bSupportsPostProcessing = true;
g_Config.backend_info.bSupportsPaletteConversion = true;
g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsDepthClamp = true;
g_Config.backend_info.bSupportsReversedDepthRange = false;
g_Config.backend_info.bSupportsMultithreading = false;
g_Config.backend_info.bSupportsGPUTextureDecoding = true;
g_Config.backend_info.bSupportsCopyToVram = true;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = true;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.bSupportsBitfield = false;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = false;
g_Config.backend_info.bSupportsFramebufferFetch = false;
g_Config.backend_info.bSupportsBackgroundCompiling = true;
g_Config.backend_info.bSupportsST3CTextures = true;
g_Config.backend_info.bSupportsBPTCTextures = true;
g_Config.backend_info.bSupportsEarlyZ = true;
g_Config.backend_info.bSupportsBBox = true;
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = true;
g_Config.backend_info.bSupportsGSInstancing = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsShaderBinaries = true;
g_Config.backend_info.bSupportsPipelineCacheData = false;
g_Config.backend_info.bSupportsCoarseDerivatives = true;
g_Config.backend_info.bSupportsTextureQueryLevels = true;
g_Config.backend_info.bSupportsLodBiasInSampler = true;
g_Config.backend_info.bSupportsLogicOp = D3D::SupportsLogicOp(g_Config.iAdapter);
g_Config.backend_info.bSupportsSettingObjectNames = true;
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
g_Config.backend_info.bSupportsDynamicVertexLoader = false;
g_Config.backend_info.bSupportsHDROutput = true;
g_backend_info.api_type = APIType::D3D;
g_backend_info.MaxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
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.bSupportsComputeShaders = false;
g_backend_info.bSupports3DVision = true;
g_backend_info.bSupportsPostProcessing = true;
g_backend_info.bSupportsPaletteConversion = true;
g_backend_info.bSupportsClipControl = true;
g_backend_info.bSupportsDepthClamp = true;
g_backend_info.bSupportsReversedDepthRange = false;
g_backend_info.bSupportsMultithreading = false;
g_backend_info.bSupportsGPUTextureDecoding = true;
g_backend_info.bSupportsCopyToVram = true;
g_backend_info.bSupportsLargePoints = false;
g_backend_info.bSupportsDepthReadback = true;
g_backend_info.bSupportsPartialDepthCopies = false;
g_backend_info.bSupportsBitfield = false;
g_backend_info.bSupportsDynamicSamplerIndexing = false;
g_backend_info.bSupportsFramebufferFetch = false;
g_backend_info.bSupportsBackgroundCompiling = true;
g_backend_info.bSupportsST3CTextures = true;
g_backend_info.bSupportsBPTCTextures = true;
g_backend_info.bSupportsEarlyZ = true;
g_backend_info.bSupportsBBox = true;
g_backend_info.bSupportsFragmentStoresAndAtomics = true;
g_backend_info.bSupportsGSInstancing = true;
g_backend_info.bSupportsSSAA = true;
g_backend_info.bSupportsShaderBinaries = true;
g_backend_info.bSupportsPipelineCacheData = false;
g_backend_info.bSupportsCoarseDerivatives = true;
g_backend_info.bSupportsTextureQueryLevels = true;
g_backend_info.bSupportsLodBiasInSampler = true;
g_backend_info.bSupportsLogicOp = D3D::SupportsLogicOp(g_Config.iAdapter);
g_backend_info.bSupportsSettingObjectNames = true;
g_backend_info.bSupportsPartialMultisampleResolve = true;
g_backend_info.bSupportsDynamicVertexLoader = false;
g_backend_info.bSupportsHDROutput = true;
g_Config.backend_info.Adapters = D3DCommon::GetAdapterNames();
g_Config.backend_info.AAModes = D3D::GetAAModes(g_Config.iAdapter);
g_backend_info.Adapters = D3DCommon::GetAdapterNames();
g_backend_info.AAModes = D3D::GetAAModes(g_Config.iAdapter);
// Override optional features if we are actually booting.
if (D3D::device)
{
g_Config.backend_info.bSupportsST3CTextures =
D3D::SupportsTextureFormat(DXGI_FORMAT_BC1_UNORM) &&
D3D::SupportsTextureFormat(DXGI_FORMAT_BC2_UNORM) &&
D3D::SupportsTextureFormat(DXGI_FORMAT_BC3_UNORM);
g_Config.backend_info.bSupportsBPTCTextures = D3D::SupportsTextureFormat(DXGI_FORMAT_BC7_UNORM);
g_backend_info.bSupportsST3CTextures = D3D::SupportsTextureFormat(DXGI_FORMAT_BC1_UNORM) &&
D3D::SupportsTextureFormat(DXGI_FORMAT_BC2_UNORM) &&
D3D::SupportsTextureFormat(DXGI_FORMAT_BC3_UNORM);
g_backend_info.bSupportsBPTCTextures = D3D::SupportsTextureFormat(DXGI_FORMAT_BC7_UNORM);
// Features only supported with a FL11.0+ device.
const bool shader_model_5_supported = D3D::feature_level >= D3D_FEATURE_LEVEL_11_0;
g_Config.backend_info.bSupportsEarlyZ = shader_model_5_supported;
g_Config.backend_info.bSupportsBBox = shader_model_5_supported;
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = shader_model_5_supported;
g_Config.backend_info.bSupportsGSInstancing = shader_model_5_supported;
g_Config.backend_info.bSupportsSSAA = shader_model_5_supported;
g_Config.backend_info.bSupportsGPUTextureDecoding = shader_model_5_supported;
g_backend_info.bSupportsEarlyZ = shader_model_5_supported;
g_backend_info.bSupportsBBox = shader_model_5_supported;
g_backend_info.bSupportsFragmentStoresAndAtomics = shader_model_5_supported;
g_backend_info.bSupportsGSInstancing = shader_model_5_supported;
g_backend_info.bSupportsSSAA = shader_model_5_supported;
g_backend_info.bSupportsGPUTextureDecoding = shader_model_5_supported;
}
}

View File

@ -35,7 +35,7 @@ void StateManager::Apply()
// our bindings and sets them to null to prevent hazards.
if (m_dirtyFlags.test(DirtyFlag_Framebuffer))
{
if (g_ActiveConfig.backend_info.bSupportsBBox)
if (g_backend_info.bSupportsBBox)
{
D3D::context->OMSetRenderTargetsAndUnorderedAccessViews(
m_pending.framebuffer->GetNumRTVs(),
@ -363,7 +363,7 @@ ID3D11BlendState* StateCache::Get(BlendingState state)
if (it != m_blend.end())
return it->second.Get();
if (state.logicopenable && g_ActiveConfig.backend_info.bSupportsLogicOp)
if (state.logicopenable && g_backend_info.bSupportsLogicOp)
{
D3D11_BLEND_DESC1 desc = {};
D3D11_RENDER_TARGET_BLEND_DESC1& tdesc = desc.RenderTarget[0];

View File

@ -54,8 +54,7 @@ std::unique_ptr<DXPipeline> DXPipeline::Create(const AbstractPipelineConfig& con
nullptr;
// Only use the integer RTV if logic op is supported, and enabled.
const bool use_logic_op =
config.blending_state.logicopenable && g_ActiveConfig.backend_info.bSupportsLogicOp;
const bool use_logic_op = config.blending_state.logicopenable && g_backend_info.bSupportsLogicOp;
return std::make_unique<DXPipeline>(config, input_layout, vertex_shader->GetD3DVertexShader(),
geometry_shader ? geometry_shader->GetD3DGeometryShader() :

View File

@ -452,7 +452,7 @@ DXFramebuffer::Create(DXTexture* color_attachment, DXTexture* depth_attachment,
// Only create the integer RTV when logic ops are supported (Win8+).
DXGI_FORMAT integer_format =
D3DCommon::GetRTVFormatForAbstractFormat(color_attachment->GetFormat(), true);
if (g_ActiveConfig.backend_info.bSupportsLogicOp && integer_format != desc.Format)
if (g_backend_info.bSupportsLogicOp && integer_format != desc.Format)
{
desc.Format = integer_format;
hr = D3D::device->CreateRenderTargetView(color_attachment->GetD3DTexture(), &desc,

View File

@ -23,8 +23,7 @@ namespace DX12
static bool UsesDynamicVertexLoader(const AbstractPipeline* pipeline)
{
const AbstractPipelineUsage usage = static_cast<const DXPipeline*>(pipeline)->GetUsage();
return (g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader &&
usage == AbstractPipelineUsage::GXUber) ||
return (g_backend_info.bSupportsDynamicVertexLoader && usage == AbstractPipelineUsage::GXUber) ||
(g_ActiveConfig.UseVSForLinePointExpand() && usage != AbstractPipelineUsage::Utility);
}

View File

@ -47,59 +47,59 @@ void VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
void VideoBackend::FillBackendInfo()
{
g_Config.backend_info.api_type = APIType::D3D;
g_Config.backend_info.bUsesLowerLeftOrigin = false;
g_Config.backend_info.bSupportsExclusiveFullscreen = true;
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsPrimitiveRestart = true;
g_Config.backend_info.bSupportsGeometryShaders = true;
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bSupportsEarlyZ = true;
g_Config.backend_info.bSupportsBindingLayout = false;
g_Config.backend_info.bSupportsBBox = true;
g_Config.backend_info.bSupportsGSInstancing = true;
g_Config.backend_info.bSupportsPaletteConversion = true;
g_Config.backend_info.bSupportsPostProcessing = true;
g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = true;
g_Config.backend_info.bSupportsDepthClamp = true;
g_Config.backend_info.bSupportsReversedDepthRange = false;
g_Config.backend_info.bSupportsComputeShaders = true;
g_Config.backend_info.bSupportsLogicOp = true;
g_Config.backend_info.bSupportsMultithreading = false;
g_Config.backend_info.bSupportsGPUTextureDecoding = true;
g_Config.backend_info.bSupportsST3CTextures = false;
g_Config.backend_info.bSupportsCopyToVram = true;
g_Config.backend_info.bSupportsBitfield = false;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = false;
g_Config.backend_info.bSupportsBPTCTextures = false;
g_Config.backend_info.bSupportsFramebufferFetch = false;
g_Config.backend_info.bSupportsBackgroundCompiling = true;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = true;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.Adapters = D3DCommon::GetAdapterNames();
g_Config.backend_info.AAModes = DXContext::GetAAModes(g_Config.iAdapter);
g_Config.backend_info.bSupportsShaderBinaries = true;
g_Config.backend_info.bSupportsPipelineCacheData = true;
g_Config.backend_info.bSupportsCoarseDerivatives = true;
g_Config.backend_info.bSupportsTextureQueryLevels = true;
g_Config.backend_info.bSupportsLodBiasInSampler = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
g_Config.backend_info.bSupportsDynamicVertexLoader = true;
g_Config.backend_info.bSupportsVSLinePointExpand = true;
g_Config.backend_info.bSupportsHDROutput = true;
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.bSupportsPostProcessing = 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;
g_backend_info.Adapters = D3DCommon::GetAdapterNames();
g_backend_info.AAModes = DXContext::GetAAModes(g_Config.iAdapter);
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_Config.backend_info.bSupportsST3CTextures =
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_Config.backend_info.bSupportsBPTCTextures =
g_backend_info.bSupportsBPTCTextures =
g_dx_context->SupportsTextureFormat(DXGI_FORMAT_BC7_UNORM);
}
}

View File

@ -334,7 +334,7 @@ void Metal::Gfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool col
static_cast<double>((color >> 24) & 0xFF) / 255.0);
// clang-format on
float z_normalized = static_cast<float>(z & 0xFFFFFF) / 16777216.0f;
if (!g_Config.backend_info.bSupportsReversedDepthRange)
if (!g_backend_info.bSupportsReversedDepthRange)
z_normalized = 1.f - z_normalized;
g_state_tracker->BeginClearRenderPass(clear_color, z_normalized);
return;

View File

@ -81,8 +81,8 @@ bool Metal::VideoBackend::Initialize(const WindowSystemInfo& wsi)
return false;
}
Util::PopulateBackendInfo(&g_Config);
Util::PopulateBackendInfoAdapters(&g_Config, devs);
Util::PopulateBackendInfo(&g_backend_info);
Util::PopulateBackendInfoAdapters(&g_backend_info, devs);
// Since we haven't called InitializeShared yet, iAdapter may be out of range,
// so we have to check it ourselves.
@ -93,7 +93,7 @@ bool Metal::VideoBackend::Initialize(const WindowSystemInfo& wsi)
selected_adapter_index = 0;
}
MRCOwned<id<MTLDevice>> adapter = std::move(devs[selected_adapter_index]);
Util::PopulateBackendInfoFeatures(&g_Config, adapter);
Util::PopulateBackendInfoFeatures(g_Config, &g_backend_info, adapter);
#if TARGET_OS_OSX
// This should be available on all macOS 13.3+ systems but when using OCLP drivers, some devices
@ -143,16 +143,16 @@ void Metal::VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
{
@autoreleasepool
{
Util::PopulateBackendInfo(&g_Config);
Util::PopulateBackendInfo(&g_backend_info);
auto adapters = Util::GetAdapterList();
Util::PopulateBackendInfoAdapters(&g_Config, adapters);
Util::PopulateBackendInfoAdapters(&g_backend_info, adapters);
if (!adapters.empty())
{
// Use the selected adapter, or the first to fill features.
size_t index = static_cast<size_t>(g_Config.iAdapter);
if (index >= adapters.size())
index = 0;
Util::PopulateBackendInfoFeatures(&g_Config, adapters[index]);
Util::PopulateBackendInfoFeatures(g_Config, &g_backend_info, adapters[index]);
}
}
}
@ -165,9 +165,9 @@ void Metal::VideoBackend::PrepareWindow(WindowSystemInfo& wsi)
NSView* view = static_cast<NSView*>(wsi.render_surface);
CAMetalLayer* layer = [CAMetalLayer layer];
Util::PopulateBackendInfo(&g_Config);
Util::PopulateBackendInfo(&g_backend_info);
if (g_Config.backend_info.bSupportsHDROutput && g_Config.bHDR)
if (g_backend_info.bSupportsHDROutput && g_Config.bHDR)
{
[layer setWantsExtendedDynamicRangeContent:YES];
[layer setPixelFormat:MTLPixelFormatRGBA16Float];

View File

@ -57,7 +57,7 @@ void Metal::ObjectCache::Shutdown()
static MTLCompareFunction Convert(CompareMode mode)
{
const bool invert_depth = !g_Config.backend_info.bSupportsReversedDepthRange;
const bool invert_depth = !g_backend_info.bSupportsReversedDepthRange;
switch (mode)
{
case CompareMode::Never: return MTLCompareFunctionNever;

View File

@ -737,9 +737,8 @@ void Metal::StateTracker::PrepareRender()
m_current.depth_stencil = pipe->DepthStencil();
[enc setDepthStencilState:g_object_cache->GetDepthStencil(m_current.depth_stencil)];
}
MTLDepthClipMode clip = is_gx && g_ActiveConfig.backend_info.bSupportsDepthClamp ?
MTLDepthClipModeClamp :
MTLDepthClipModeClip;
MTLDepthClipMode clip =
is_gx && g_backend_info.bSupportsDepthClamp ? MTLDepthClipModeClamp : MTLDepthClipModeClip;
if (clip != m_current.depth_clip_mode)
{
m_current.depth_clip_mode = clip;

View File

@ -41,10 +41,11 @@ struct Viewport
/// Gets the list of Metal devices, ordered so the system default device is first
std::vector<MRCOwned<id<MTLDevice>>> GetAdapterList();
void PopulateBackendInfo(VideoConfig* config);
void PopulateBackendInfoAdapters(VideoConfig* config,
void PopulateBackendInfo(BackendInfo* backend_info);
void PopulateBackendInfoAdapters(BackendInfo* backend_info,
const std::vector<MRCOwned<id<MTLDevice>>>& adapters);
void PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice> device);
void PopulateBackendInfoFeatures(const VideoConfig& config, BackendInfo* backend_info,
id<MTLDevice> device);
AbstractTextureFormat ToAbstract(MTLPixelFormat format);
MTLPixelFormat FromAbstract(AbstractTextureFormat format);

View File

@ -36,58 +36,58 @@ std::vector<MRCOwned<id<MTLDevice>>> Metal::Util::GetAdapterList()
return list;
}
void Metal::Util::PopulateBackendInfo(VideoConfig* config)
void Metal::Util::PopulateBackendInfo(BackendInfo* backend_info)
{
config->backend_info.api_type = APIType::Metal;
config->backend_info.bUsesLowerLeftOrigin = false;
config->backend_info.bSupportsExclusiveFullscreen = false;
config->backend_info.bSupportsDualSourceBlend = true;
config->backend_info.bSupportsPrimitiveRestart = true;
config->backend_info.bSupportsGeometryShaders = false;
config->backend_info.bSupportsComputeShaders = true;
config->backend_info.bSupports3DVision = false;
config->backend_info.bSupportsEarlyZ = true;
config->backend_info.bSupportsBindingLayout = true;
config->backend_info.bSupportsBBox = true;
config->backend_info.bSupportsGSInstancing = false;
config->backend_info.bSupportsPostProcessing = true;
config->backend_info.bSupportsPaletteConversion = true;
config->backend_info.bSupportsClipControl = true;
config->backend_info.bSupportsSSAA = true;
config->backend_info.bSupportsFragmentStoresAndAtomics = true;
config->backend_info.bSupportsReversedDepthRange = false;
config->backend_info.bSupportsLogicOp = false;
config->backend_info.bSupportsMultithreading = false;
config->backend_info.bSupportsGPUTextureDecoding = true;
config->backend_info.bSupportsCopyToVram = true;
config->backend_info.bSupportsBitfield = true;
config->backend_info.bSupportsDynamicSamplerIndexing = true;
config->backend_info.bSupportsFramebufferFetch = false;
config->backend_info.bSupportsBackgroundCompiling = true;
config->backend_info.bSupportsLargePoints = true;
config->backend_info.bSupportsPartialDepthCopies = true;
config->backend_info.bSupportsDepthReadback = true;
config->backend_info.bSupportsShaderBinaries = false;
config->backend_info.bSupportsPipelineCacheData = false;
config->backend_info.bSupportsCoarseDerivatives = false;
config->backend_info.bSupportsTextureQueryLevels = true;
config->backend_info.bSupportsLodBiasInSampler = false;
config->backend_info.bSupportsSettingObjectNames = true;
backend_info->api_type = APIType::Metal;
backend_info->bUsesLowerLeftOrigin = false;
backend_info->bSupportsExclusiveFullscreen = false;
backend_info->bSupportsDualSourceBlend = true;
backend_info->bSupportsPrimitiveRestart = true;
backend_info->bSupportsGeometryShaders = false;
backend_info->bSupportsComputeShaders = true;
backend_info->bSupports3DVision = false;
backend_info->bSupportsEarlyZ = true;
backend_info->bSupportsBindingLayout = true;
backend_info->bSupportsBBox = true;
backend_info->bSupportsGSInstancing = false;
backend_info->bSupportsPostProcessing = true;
backend_info->bSupportsPaletteConversion = true;
backend_info->bSupportsClipControl = true;
backend_info->bSupportsSSAA = true;
backend_info->bSupportsFragmentStoresAndAtomics = true;
backend_info->bSupportsReversedDepthRange = false;
backend_info->bSupportsLogicOp = false;
backend_info->bSupportsMultithreading = false;
backend_info->bSupportsGPUTextureDecoding = true;
backend_info->bSupportsCopyToVram = true;
backend_info->bSupportsBitfield = true;
backend_info->bSupportsDynamicSamplerIndexing = true;
backend_info->bSupportsFramebufferFetch = false;
backend_info->bSupportsBackgroundCompiling = true;
backend_info->bSupportsLargePoints = true;
backend_info->bSupportsPartialDepthCopies = true;
backend_info->bSupportsDepthReadback = true;
backend_info->bSupportsShaderBinaries = false;
backend_info->bSupportsPipelineCacheData = false;
backend_info->bSupportsCoarseDerivatives = false;
backend_info->bSupportsTextureQueryLevels = true;
backend_info->bSupportsLodBiasInSampler = false;
backend_info->bSupportsSettingObjectNames = true;
// Metal requires multisample resolve to be done on a render pass
config->backend_info.bSupportsPartialMultisampleResolve = false;
config->backend_info.bSupportsDynamicVertexLoader = true;
config->backend_info.bSupportsVSLinePointExpand = true;
config->backend_info.bSupportsHDROutput =
backend_info->bSupportsPartialMultisampleResolve = false;
backend_info->bSupportsDynamicVertexLoader = true;
backend_info->bSupportsVSLinePointExpand = true;
backend_info->bSupportsHDROutput =
1.0 < [[NSScreen deepestScreen] maximumPotentialExtendedDynamicRangeColorComponentValue];
}
void Metal::Util::PopulateBackendInfoAdapters(VideoConfig* config,
void Metal::Util::PopulateBackendInfoAdapters(BackendInfo* backend_info,
const std::vector<MRCOwned<id<MTLDevice>>>& adapters)
{
config->backend_info.Adapters.clear();
backend_info->Adapters.clear();
for (id<MTLDevice> adapter : adapters)
{
config->backend_info.Adapters.push_back([[adapter name] UTF8String]);
backend_info->Adapters.push_back([[adapter name] UTF8String]);
}
}
@ -238,7 +238,8 @@ fragment float4 is_helper_test() {
return DetectionResult::Unsure;
}
void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice> device)
void Metal::Util::PopulateBackendInfoFeatures(const VideoConfig& config, BackendInfo* backend_info,
id<MTLDevice> device)
{
// Initialize DriverDetails first so we can use it later
DriverDetails::Vendor vendor = DriverDetails::VENDOR_UNKNOWN;
@ -257,9 +258,9 @@ void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice>
DriverDetails::Family::UNKNOWN, std::move(name));
#if TARGET_OS_OSX
config->backend_info.bSupportsDepthClamp = true;
config->backend_info.bSupportsST3CTextures = true;
config->backend_info.bSupportsBPTCTextures = true;
backend_info->bSupportsDepthClamp = true;
backend_info->bSupportsST3CTextures = true;
backend_info->bSupportsBPTCTextures = true;
#else
bool supports_apple4 = false;
bool supports_bcn = false;
@ -269,21 +270,21 @@ void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice>
supports_apple4 = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1];
if (@available(iOS 16.4, *))
supports_bcn = [device supportsBCTextureCompression];
config->backend_info.bSupportsDepthClamp = supports_apple4;
config->backend_info.bSupportsST3CTextures = supports_bcn;
config->backend_info.bSupportsBPTCTextures = supports_bcn;
backend_info->bSupportsDepthClamp = supports_apple4;
backend_info->bSupportsST3CTextures = supports_bcn;
backend_info->bSupportsBPTCTextures = supports_bcn;
config->backend_info.bSupportsFramebufferFetch = true;
backend_info->bSupportsFramebufferFetch = true;
#endif
config->backend_info.AAModes.clear();
backend_info->AAModes.clear();
for (u32 i = 1; i <= 64; i <<= 1)
{
if ([device supportsTextureSampleCount:i])
config->backend_info.AAModes.push_back(i);
backend_info->AAModes.push_back(i);
}
switch (config->iManuallyUploadBuffers)
switch (config.iManuallyUploadBuffers)
{
case TriState::Off:
g_features.manual_buffer_upload = false;
@ -310,7 +311,7 @@ void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice>
// Requires SIMD-scoped reduction operations
g_features.subgroup_ops =
[device supportsFamily:MTLGPUFamilyMac2] || [device supportsFamily:MTLGPUFamilyApple7];
config->backend_info.bSupportsFramebufferFetch = [device supportsFamily:MTLGPUFamilyApple1];
backend_info->bSupportsFramebufferFetch = [device supportsFamily:MTLGPUFamilyApple1];
}
if (g_features.subgroup_ops)
{
@ -325,10 +326,10 @@ void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice>
#if TARGET_OS_OSX
if (@available(macOS 11, *))
if (vendor == DriverDetails::VENDOR_INTEL)
config->backend_info.bSupportsFramebufferFetch |= DetectIntelGPUFBFetch(device);
backend_info->bSupportsFramebufferFetch |= DetectIntelGPUFBFetch(device);
#endif
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING))
config->backend_info.bSupportsDynamicSamplerIndexing = false;
backend_info->bSupportsDynamicSamplerIndexing = false;
}
// clang-format off

View File

@ -9,7 +9,6 @@
#include "VideoBackends/Null/VideoBackend.h"
#include "Common/Common.h"
#include "Common/MsgHandler.h"
#include "VideoBackends/Null/NullBoundingBox.h"
#include "VideoBackends/Null/NullGfx.h"
@ -17,9 +16,6 @@
#include "VideoBackends/Null/PerfQuery.h"
#include "VideoBackends/Null/TextureCache.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/Present.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
@ -27,46 +23,46 @@ namespace Null
{
void VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
{
g_Config.backend_info.api_type = APIType::Nothing;
g_Config.backend_info.MaxTextureSize = 16384;
g_Config.backend_info.bSupportsExclusiveFullscreen = true;
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsPrimitiveRestart = true;
g_Config.backend_info.bSupportsGeometryShaders = true;
g_Config.backend_info.bSupportsComputeShaders = false;
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bSupportsEarlyZ = true;
g_Config.backend_info.bSupportsBindingLayout = true;
g_Config.backend_info.bSupportsBBox = true;
g_Config.backend_info.bSupportsGSInstancing = true;
g_Config.backend_info.bSupportsPostProcessing = false;
g_Config.backend_info.bSupportsPaletteConversion = true;
g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsDepthClamp = true;
g_Config.backend_info.bSupportsReversedDepthRange = true;
g_Config.backend_info.bSupportsMultithreading = false;
g_Config.backend_info.bSupportsGPUTextureDecoding = false;
g_Config.backend_info.bSupportsST3CTextures = false;
g_Config.backend_info.bSupportsBPTCTextures = false;
g_Config.backend_info.bSupportsFramebufferFetch = false;
g_Config.backend_info.bSupportsBackgroundCompiling = false;
g_Config.backend_info.bSupportsLogicOp = false;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = false;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.bSupportsShaderBinaries = false;
g_Config.backend_info.bSupportsPipelineCacheData = false;
g_Config.backend_info.bSupportsCoarseDerivatives = false;
g_Config.backend_info.bSupportsTextureQueryLevels = false;
g_Config.backend_info.bSupportsLodBiasInSampler = false;
g_Config.backend_info.bSupportsSettingObjectNames = false;
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
g_Config.backend_info.bSupportsDynamicVertexLoader = false;
g_backend_info.api_type = APIType::Nothing;
g_backend_info.MaxTextureSize = 16384;
g_backend_info.bSupportsExclusiveFullscreen = true;
g_backend_info.bSupportsDualSourceBlend = true;
g_backend_info.bSupportsPrimitiveRestart = true;
g_backend_info.bSupportsGeometryShaders = true;
g_backend_info.bSupportsComputeShaders = false;
g_backend_info.bSupports3DVision = false;
g_backend_info.bSupportsEarlyZ = true;
g_backend_info.bSupportsBindingLayout = true;
g_backend_info.bSupportsBBox = true;
g_backend_info.bSupportsGSInstancing = true;
g_backend_info.bSupportsPostProcessing = false;
g_backend_info.bSupportsPaletteConversion = true;
g_backend_info.bSupportsClipControl = true;
g_backend_info.bSupportsSSAA = true;
g_backend_info.bSupportsDepthClamp = true;
g_backend_info.bSupportsReversedDepthRange = true;
g_backend_info.bSupportsMultithreading = false;
g_backend_info.bSupportsGPUTextureDecoding = false;
g_backend_info.bSupportsST3CTextures = false;
g_backend_info.bSupportsBPTCTextures = false;
g_backend_info.bSupportsFramebufferFetch = false;
g_backend_info.bSupportsBackgroundCompiling = false;
g_backend_info.bSupportsLogicOp = false;
g_backend_info.bSupportsLargePoints = false;
g_backend_info.bSupportsDepthReadback = false;
g_backend_info.bSupportsPartialDepthCopies = false;
g_backend_info.bSupportsShaderBinaries = false;
g_backend_info.bSupportsPipelineCacheData = false;
g_backend_info.bSupportsCoarseDerivatives = false;
g_backend_info.bSupportsTextureQueryLevels = false;
g_backend_info.bSupportsLodBiasInSampler = false;
g_backend_info.bSupportsSettingObjectNames = false;
g_backend_info.bSupportsPartialMultisampleResolve = true;
g_backend_info.bSupportsDynamicVertexLoader = false;
// aamodes: We only support 1 sample, so no MSAA
g_Config.backend_info.Adapters.clear();
g_Config.backend_info.AAModes = {1};
g_backend_info.Adapters.clear();
g_backend_info.AAModes = {1};
}
bool VideoBackend::Initialize(const WindowSystemInfo& wsi)

View File

@ -283,25 +283,24 @@ bool PopulateConfig(GLContext* m_main_gl_context)
}
// Copy the GPU name to g_Config, so Analytics can see it.
g_Config.backend_info.AdapterName = g_ogl_config.gl_renderer;
g_backend_info.AdapterName = g_ogl_config.gl_renderer;
g_Config.backend_info.bSupportsDualSourceBlend =
(GLExtensions::Supports("GL_ARB_blend_func_extended") ||
GLExtensions::Supports("GL_EXT_blend_func_extended"));
g_Config.backend_info.bSupportsPrimitiveRestart =
g_backend_info.bSupportsDualSourceBlend = (GLExtensions::Supports("GL_ARB_blend_func_extended") ||
GLExtensions::Supports("GL_EXT_blend_func_extended"));
g_backend_info.bSupportsPrimitiveRestart =
!DriverDetails::HasBug(DriverDetails::BUG_PRIMITIVE_RESTART) &&
((GLExtensions::Version() >= 310) || GLExtensions::Supports("GL_NV_primitive_restart"));
g_Config.backend_info.bSupportsGSInstancing = GLExtensions::Supports("GL_ARB_gpu_shader5");
g_Config.backend_info.bSupportsSSAA = GLExtensions::Supports("GL_ARB_gpu_shader5") &&
GLExtensions::Supports("GL_ARB_sample_shading");
g_Config.backend_info.bSupportsGeometryShaders =
g_backend_info.bSupportsGSInstancing = GLExtensions::Supports("GL_ARB_gpu_shader5");
g_backend_info.bSupportsSSAA = GLExtensions::Supports("GL_ARB_gpu_shader5") &&
GLExtensions::Supports("GL_ARB_sample_shading");
g_backend_info.bSupportsGeometryShaders =
GLExtensions::Version() >= 320 &&
!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_GEOMETRY_SHADERS);
g_Config.backend_info.bSupportsPaletteConversion =
g_backend_info.bSupportsPaletteConversion =
GLExtensions::Supports("GL_ARB_texture_buffer_object") ||
GLExtensions::Supports("GL_OES_texture_buffer") ||
GLExtensions::Supports("GL_EXT_texture_buffer");
g_Config.backend_info.bSupportsClipControl = GLExtensions::Supports("GL_ARB_clip_control");
g_backend_info.bSupportsClipControl = GLExtensions::Supports("GL_ARB_clip_control");
g_ogl_config.bSupportsCopySubImage =
(GLExtensions::Supports("GL_ARB_copy_image") || GLExtensions::Supports("GL_NV_copy_image") ||
GLExtensions::Supports("GL_EXT_copy_image") ||
@ -311,17 +310,15 @@ bool PopulateConfig(GLContext* m_main_gl_context)
// Desktop OpenGL supports the binding layout if it supports 420pack
// OpenGL ES 3.1 supports it implicitly without an extension
g_Config.backend_info.bSupportsBindingLayout =
GLExtensions::Supports("GL_ARB_shading_language_420pack");
g_backend_info.bSupportsBindingLayout = GLExtensions::Supports("GL_ARB_shading_language_420pack");
// Clip distance support is useless without a method to clamp the depth range
g_Config.backend_info.bSupportsDepthClamp = GLExtensions::Supports("GL_ARB_depth_clamp");
g_backend_info.bSupportsDepthClamp = GLExtensions::Supports("GL_ARB_depth_clamp");
// Desktop OpenGL supports bitfield manulipation and dynamic sampler indexing if it supports
// shader5. OpenGL ES 3.1 supports it implicitly without an extension
g_Config.backend_info.bSupportsBitfield = GLExtensions::Supports("GL_ARB_gpu_shader5");
g_Config.backend_info.bSupportsDynamicSamplerIndexing =
GLExtensions::Supports("GL_ARB_gpu_shader5");
g_backend_info.bSupportsBitfield = GLExtensions::Supports("GL_ARB_gpu_shader5");
g_backend_info.bSupportsDynamicSamplerIndexing = GLExtensions::Supports("GL_ARB_gpu_shader5");
g_ogl_config.bIsES = m_main_gl_context->IsGLES();
supports_glsl_cache = GLExtensions::Supports("GL_ARB_get_program_binary");
@ -341,14 +338,12 @@ bool PopulateConfig(GLContext* m_main_gl_context)
g_ogl_config.bSupportsImageLoadStore = GLExtensions::Supports("GL_ARB_shader_image_load_store");
g_ogl_config.bSupportsConservativeDepth = GLExtensions::Supports("GL_ARB_conservative_depth");
g_ogl_config.bSupportsAniso = GLExtensions::Supports("GL_EXT_texture_filter_anisotropic");
g_Config.backend_info.bSupportsComputeShaders = GLExtensions::Supports("GL_ARB_compute_shader");
g_Config.backend_info.bSupportsST3CTextures =
GLExtensions::Supports("GL_EXT_texture_compression_s3tc");
g_Config.backend_info.bSupportsBPTCTextures =
GLExtensions::Supports("GL_ARB_texture_compression_bptc");
g_Config.backend_info.bSupportsCoarseDerivatives =
g_backend_info.bSupportsComputeShaders = GLExtensions::Supports("GL_ARB_compute_shader");
g_backend_info.bSupportsST3CTextures = GLExtensions::Supports("GL_EXT_texture_compression_s3tc");
g_backend_info.bSupportsBPTCTextures = GLExtensions::Supports("GL_ARB_texture_compression_bptc");
g_backend_info.bSupportsCoarseDerivatives =
GLExtensions::Supports("GL_ARB_derivative_control") || GLExtensions::Version() >= 450;
g_Config.backend_info.bSupportsTextureQueryLevels =
g_backend_info.bSupportsTextureQueryLevels =
GLExtensions::Supports("GL_ARB_texture_query_levels") || GLExtensions::Version() >= 430;
if (GLExtensions::Supports("GL_ARB_shader_storage_buffer_object"))
@ -357,13 +352,13 @@ bool PopulateConfig(GLContext* m_main_gl_context)
GLint vs = 0;
glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &fs);
glGetIntegerv(GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS, &vs);
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = fs >= 1;
g_Config.backend_info.bSupportsVSLinePointExpand = vs >= 1;
g_backend_info.bSupportsFragmentStoresAndAtomics = fs >= 1;
g_backend_info.bSupportsVSLinePointExpand = vs >= 1;
}
else
{
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = false;
g_Config.backend_info.bSupportsVSLinePointExpand = false;
g_backend_info.bSupportsFragmentStoresAndAtomics = false;
g_backend_info.bSupportsVSLinePointExpand = false;
}
if (GLExtensions::Supports("GL_EXT_shader_framebuffer_fetch"))
@ -378,7 +373,7 @@ bool PopulateConfig(GLContext* m_main_gl_context)
{
g_ogl_config.SupportedFramebufferFetch = EsFbFetchType::FbFetchNone;
}
g_Config.backend_info.bSupportsFramebufferFetch =
g_backend_info.bSupportsFramebufferFetch =
g_ogl_config.SupportedFramebufferFetch != EsFbFetchType::FbFetchNone;
if (m_main_gl_context->IsGLES())
@ -398,67 +393,67 @@ bool PopulateConfig(GLContext* m_main_gl_context)
// TODO: Implement support for GL_EXT_clip_cull_distance when there is an extension for
// depth clamping.
g_Config.backend_info.bSupportsDepthClamp = false;
g_backend_info.bSupportsDepthClamp = false;
// GLES does not support logic op.
g_Config.backend_info.bSupportsLogicOp = false;
g_backend_info.bSupportsLogicOp = false;
// glReadPixels() can't be used with non-color formats. But, if we support
// ARB_get_texture_sub_image (unlikely, except maybe on NVIDIA), we can use that instead.
g_Config.backend_info.bSupportsDepthReadback = g_ogl_config.bSupportsTextureSubImage;
g_backend_info.bSupportsDepthReadback = g_ogl_config.bSupportsTextureSubImage;
// GL_TEXTURE_LOD_BIAS is not supported on GLES.
g_Config.backend_info.bSupportsLodBiasInSampler = false;
g_backend_info.bSupportsLodBiasInSampler = false;
if (GLExtensions::Version() == 300)
{
g_ogl_config.eSupportedGLSLVersion = GlslEs300;
g_ogl_config.bSupportsAEP = false;
g_ogl_config.bSupportsTextureStorage = true;
g_Config.backend_info.bSupportsGeometryShaders = false;
g_backend_info.bSupportsGeometryShaders = false;
}
else if (GLExtensions::Version() == 310)
{
g_ogl_config.eSupportedGLSLVersion = GlslEs310;
g_ogl_config.bSupportsAEP = GLExtensions::Supports("GL_ANDROID_extension_pack_es31a");
g_Config.backend_info.bSupportsBindingLayout = true;
g_backend_info.bSupportsBindingLayout = true;
g_ogl_config.bSupportsImageLoadStore = true;
g_Config.backend_info.bSupportsGeometryShaders = g_ogl_config.bSupportsAEP;
g_Config.backend_info.bSupportsComputeShaders = true;
g_Config.backend_info.bSupportsGSInstancing =
g_Config.backend_info.bSupportsGeometryShaders &&
g_backend_info.bSupportsGeometryShaders = g_ogl_config.bSupportsAEP;
g_backend_info.bSupportsComputeShaders = true;
g_backend_info.bSupportsGSInstancing =
g_backend_info.bSupportsGeometryShaders &&
g_ogl_config.SupportedESPointSize != EsPointSizeType::PointSizeNone;
g_Config.backend_info.bSupportsSSAA = g_ogl_config.bSupportsAEP;
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = true;
g_backend_info.bSupportsSSAA = g_ogl_config.bSupportsAEP;
g_backend_info.bSupportsFragmentStoresAndAtomics = true;
g_ogl_config.bSupportsMSAA = true;
g_ogl_config.bSupportsTextureStorage = true;
if (GLExtensions::Supports("GL_OES_texture_storage_multisample_2d_array"))
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageOes;
g_Config.backend_info.bSupportsBitfield = true;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = g_ogl_config.bSupportsAEP;
g_backend_info.bSupportsBitfield = true;
g_backend_info.bSupportsDynamicSamplerIndexing = g_ogl_config.bSupportsAEP;
}
else
{
g_ogl_config.eSupportedGLSLVersion = GlslEs320;
g_ogl_config.bSupportsAEP = GLExtensions::Supports("GL_ANDROID_extension_pack_es31a");
g_Config.backend_info.bSupportsBindingLayout = true;
g_backend_info.bSupportsBindingLayout = true;
g_ogl_config.bSupportsImageLoadStore = true;
g_Config.backend_info.bSupportsGeometryShaders = true;
g_Config.backend_info.bSupportsComputeShaders = true;
g_Config.backend_info.bSupportsGSInstancing =
g_backend_info.bSupportsGeometryShaders = true;
g_backend_info.bSupportsComputeShaders = true;
g_backend_info.bSupportsGSInstancing =
g_ogl_config.SupportedESPointSize != EsPointSizeType::PointSizeNone;
g_Config.backend_info.bSupportsPaletteConversion = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = true;
g_backend_info.bSupportsPaletteConversion = true;
g_backend_info.bSupportsSSAA = true;
g_backend_info.bSupportsFragmentStoresAndAtomics = true;
g_ogl_config.bSupportsCopySubImage = true;
g_ogl_config.bSupportsGLBaseVertex = true;
g_ogl_config.bSupportsDebug = true;
g_ogl_config.bSupportsMSAA = true;
g_ogl_config.bSupportsTextureStorage = true;
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageCore;
g_Config.backend_info.bSupportsBitfield = true;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
g_backend_info.bSupportsBitfield = true;
g_backend_info.bSupportsDynamicSamplerIndexing = true;
g_backend_info.bSupportsSettingObjectNames = true;
}
}
else
@ -480,7 +475,7 @@ bool PopulateConfig(GLContext* m_main_gl_context)
g_ogl_config.bSupportsImageLoadStore = false; // layout keyword is only supported on glsl150+
g_ogl_config.bSupportsConservativeDepth =
false; // layout keyword is only supported on glsl150+
g_Config.backend_info.bSupportsGeometryShaders =
g_backend_info.bSupportsGeometryShaders =
false; // geometry shaders are only supported on glsl150+
}
else if (GLExtensions::Version() == 310)
@ -489,7 +484,7 @@ bool PopulateConfig(GLContext* m_main_gl_context)
g_ogl_config.bSupportsImageLoadStore = false; // layout keyword is only supported on glsl150+
g_ogl_config.bSupportsConservativeDepth =
false; // layout keyword is only supported on glsl150+
g_Config.backend_info.bSupportsGeometryShaders =
g_backend_info.bSupportsGeometryShaders =
false; // geometry shaders are only supported on glsl150+
}
else if (GLExtensions::Version() == 320)
@ -517,18 +512,18 @@ bool PopulateConfig(GLContext* m_main_gl_context)
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageCore;
g_ogl_config.bSupportsImageLoadStore = true;
g_ogl_config.bSupportsExplicitLayoutInShader = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
g_backend_info.bSupportsSSAA = true;
g_backend_info.bSupportsSettingObjectNames = true;
// Compute shaders are core in GL4.3.
g_Config.backend_info.bSupportsComputeShaders = true;
g_backend_info.bSupportsComputeShaders = true;
if (GLExtensions::Version() >= 450)
g_ogl_config.bSupportsTextureSubImage = true;
}
else
{
g_ogl_config.eSupportedGLSLVersion = Glsl400;
g_Config.backend_info.bSupportsSSAA = true;
g_backend_info.bSupportsSSAA = true;
if (GLExtensions::Version() == 420)
{
@ -547,16 +542,16 @@ bool PopulateConfig(GLContext* m_main_gl_context)
}
// Supported by all GS-supporting ES and 4.3+
g_Config.backend_info.bSupportsGLLayerInFS = g_Config.backend_info.bSupportsGeometryShaders &&
g_ogl_config.eSupportedGLSLVersion >= Glsl430;
g_backend_info.bSupportsGLLayerInFS =
g_backend_info.bSupportsGeometryShaders && g_ogl_config.eSupportedGLSLVersion >= Glsl430;
g_Config.backend_info.bSupportsBBox = g_Config.backend_info.bSupportsFragmentStoresAndAtomics;
g_backend_info.bSupportsBBox = g_backend_info.bSupportsFragmentStoresAndAtomics;
// Either method can do early-z tests. See PixelShaderGen for details.
g_Config.backend_info.bSupportsEarlyZ =
g_backend_info.bSupportsEarlyZ =
g_ogl_config.bSupportsImageLoadStore || g_ogl_config.bSupportsConservativeDepth;
g_Config.backend_info.AAModes.clear();
g_backend_info.AAModes.clear();
if (g_ogl_config.bSupportsMSAA)
{
bool supportsGetInternalFormat =
@ -628,13 +623,13 @@ bool PopulateConfig(GLContext* m_main_gl_context)
// It also says "Only positive values are returned", but does not specify whether 1 is
// included or not; it seems like NVIDIA and Intel GPUs do not include it.
// We've inserted 1 at the back of both if not present to handle this.
g_Config.backend_info.AAModes.clear();
g_Config.backend_info.AAModes.reserve(std::min(color_aa_modes.size(), depth_aa_modes.size()));
g_backend_info.AAModes.clear();
g_backend_info.AAModes.reserve(std::min(color_aa_modes.size(), depth_aa_modes.size()));
// We only want AA modes that are supported for both the color and depth textures. Probably
// the support is the same, though. views::reverse is used to swap the order ahead of time.
std::ranges::set_intersection(color_aa_modes | std::views::reverse,
depth_aa_modes | std::views::reverse,
std::back_inserter(g_Config.backend_info.AAModes));
std::back_inserter(g_backend_info.AAModes));
}
else
{
@ -656,17 +651,17 @@ bool PopulateConfig(GLContext* m_main_gl_context)
while (supported_max_samples > 1)
{
g_Config.backend_info.AAModes.push_back(supported_max_samples);
g_backend_info.AAModes.push_back(supported_max_samples);
supported_max_samples /= 2;
}
g_Config.backend_info.AAModes.push_back(1);
g_backend_info.AAModes.push_back(1);
// The UI wants ascending order
std::ranges::reverse(g_Config.backend_info.AAModes);
std::ranges::reverse(g_backend_info.AAModes);
}
}
else
{
g_Config.backend_info.AAModes = {1};
g_backend_info.AAModes = {1};
}
const bool bSupportsIsHelperInvocation = g_ogl_config.bIsES ?
@ -690,12 +685,12 @@ bool PopulateConfig(GLContext* m_main_gl_context)
// We require texel buffers, image load store, and compute shaders to enable GPU texture decoding.
// If the driver doesn't expose the extensions, but supports GL4.3/GLES3.1, it will still be
// enabled in the version check below.
g_Config.backend_info.bSupportsGPUTextureDecoding =
g_Config.backend_info.bSupportsPaletteConversion &&
g_Config.backend_info.bSupportsComputeShaders && g_ogl_config.bSupportsImageLoadStore;
g_backend_info.bSupportsGPUTextureDecoding = g_backend_info.bSupportsPaletteConversion &&
g_backend_info.bSupportsComputeShaders &&
g_ogl_config.bSupportsImageLoadStore;
// Background compiling is supported only when shared contexts aren't broken.
g_Config.backend_info.bSupportsBackgroundCompiling =
g_backend_info.bSupportsBackgroundCompiling =
!DriverDetails::HasBug(DriverDetails::BUG_SHARED_CONTEXT_SHADER_COMPILATION);
// Program binaries are supported on GL4.1+, ARB_get_program_binary, or ES3.
@ -706,7 +701,7 @@ bool PopulateConfig(GLContext* m_main_gl_context)
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num_formats);
supports_glsl_cache = num_formats > 0;
}
g_Config.backend_info.bSupportsPipelineCacheData = supports_glsl_cache;
g_backend_info.bSupportsPipelineCacheData = supports_glsl_cache;
int samples;
glGetIntegerv(GL_SAMPLES, &samples);
@ -746,19 +741,19 @@ bool PopulateConfig(GLContext* m_main_gl_context)
const std::string missing_extensions = fmt::format(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
g_ActiveConfig.backend_info.bSupportsEarlyZ ? "" : "EarlyZ ",
g_backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
g_backend_info.bSupportsEarlyZ ? "" : "EarlyZ ",
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
supports_glsl_cache ? "" : "ShaderCache ",
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
g_ogl_config.bSupportsGLBufferStorage ? "" : "BufferStorage ",
g_ogl_config.bSupportsGLSync ? "" : "Sync ", g_ogl_config.bSupportsMSAA ? "" : "MSAA ",
g_ActiveConfig.backend_info.bSupportsSSAA ? "" : "SSAA ",
g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ",
g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl ",
g_backend_info.bSupportsSSAA ? "" : "SSAA ",
g_backend_info.bSupportsGSInstancing ? "" : "GSInstancing ",
g_backend_info.bSupportsClipControl ? "" : "ClipControl ",
g_ogl_config.bSupportsCopySubImage ? "" : "CopyImageSubData ",
g_ActiveConfig.backend_info.bSupportsDepthClamp ? "" : "DepthClamp ");
g_backend_info.bSupportsDepthClamp ? "" : "DepthClamp ");
if (missing_extensions.empty())
INFO_LOG_FMT(VIDEO, "All used OGL Extensions are available.");

View File

@ -177,10 +177,10 @@ OGLGfx::OGLGfx(std::unique_ptr<GLContext> main_gl_context, float backbuffer_scal
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_VSYNC))
m_main_gl_context->SwapInterval(g_ActiveConfig.bVSyncActive);
if (g_ActiveConfig.backend_info.bSupportsClipControl)
if (g_backend_info.bSupportsClipControl)
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
if (g_ActiveConfig.backend_info.bSupportsDepthClamp)
if (g_backend_info.bSupportsDepthClamp)
{
glEnable(GL_CLIP_DISTANCE0);
glEnable(GL_CLIP_DISTANCE1);
@ -192,7 +192,7 @@ OGLGfx::OGLGfx(std::unique_ptr<GLContext> main_gl_context, float backbuffer_scal
glGenFramebuffers(1, &m_shared_read_framebuffer);
glGenFramebuffers(1, &m_shared_draw_framebuffer);
if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
if (g_backend_info.bSupportsPrimitiveRestart)
GLUtil::EnablePrimitiveRestart(m_main_gl_context.get());
UpdateActiveConfig();
@ -487,7 +487,7 @@ void OGLGfx::CheckForSurfaceResize()
void OGLGfx::BeginUtilityDrawing()
{
AbstractGfx::BeginUtilityDrawing();
if (g_ActiveConfig.backend_info.bSupportsDepthClamp)
if (g_backend_info.bSupportsDepthClamp)
{
glDisable(GL_CLIP_DISTANCE0);
glDisable(GL_CLIP_DISTANCE1);
@ -497,7 +497,7 @@ void OGLGfx::BeginUtilityDrawing()
void OGLGfx::EndUtilityDrawing()
{
AbstractGfx::EndUtilityDrawing();
if (g_ActiveConfig.backend_info.bSupportsDepthClamp)
if (g_backend_info.bSupportsDepthClamp)
{
glEnable(GL_CLIP_DISTANCE0);
glEnable(GL_CLIP_DISTANCE1);

View File

@ -113,53 +113,53 @@ bool VideoBackend::FillBackendInfo(GLContext* context)
if (!InitializeGLExtensions(context))
return false;
g_Config.backend_info.api_type = APIType::OpenGL;
g_Config.backend_info.MaxTextureSize = 16384;
g_Config.backend_info.bUsesLowerLeftOrigin = true;
g_Config.backend_info.bSupportsExclusiveFullscreen = false;
g_Config.backend_info.bSupportsGeometryShaders = true;
g_Config.backend_info.bSupportsComputeShaders = false;
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bSupportsPostProcessing = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsReversedDepthRange = true;
g_Config.backend_info.bSupportsLogicOp = true;
g_Config.backend_info.bSupportsMultithreading = false;
g_Config.backend_info.bSupportsCopyToVram = true;
g_Config.backend_info.bSupportsLargePoints = true;
g_Config.backend_info.bSupportsDepthReadback = true;
g_Config.backend_info.bSupportsPartialDepthCopies = true;
g_Config.backend_info.bSupportsShaderBinaries = false;
g_Config.backend_info.bSupportsPipelineCacheData = false;
g_Config.backend_info.bSupportsLodBiasInSampler = true;
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
g_backend_info.api_type = APIType::OpenGL;
g_backend_info.MaxTextureSize = 16384;
g_backend_info.bUsesLowerLeftOrigin = true;
g_backend_info.bSupportsExclusiveFullscreen = false;
g_backend_info.bSupportsGeometryShaders = true;
g_backend_info.bSupportsComputeShaders = false;
g_backend_info.bSupports3DVision = false;
g_backend_info.bSupportsPostProcessing = true;
g_backend_info.bSupportsSSAA = true;
g_backend_info.bSupportsReversedDepthRange = true;
g_backend_info.bSupportsLogicOp = true;
g_backend_info.bSupportsMultithreading = false;
g_backend_info.bSupportsCopyToVram = true;
g_backend_info.bSupportsLargePoints = true;
g_backend_info.bSupportsDepthReadback = true;
g_backend_info.bSupportsPartialDepthCopies = true;
g_backend_info.bSupportsShaderBinaries = false;
g_backend_info.bSupportsPipelineCacheData = false;
g_backend_info.bSupportsLodBiasInSampler = true;
g_backend_info.bSupportsPartialMultisampleResolve = true;
// Unneccessary since OGL doesn't use pipelines
g_Config.backend_info.bSupportsDynamicVertexLoader = false;
g_backend_info.bSupportsDynamicVertexLoader = false;
// TODO: There is a bug here, if texel buffers or SSBOs/atomics are not supported the graphics
// options will show the option when it is not supported. The only way around this would be
// creating a context when calling this function to determine what is available.
g_Config.backend_info.bSupportsGPUTextureDecoding = true;
g_Config.backend_info.bSupportsBBox = true;
g_backend_info.bSupportsGPUTextureDecoding = true;
g_backend_info.bSupportsBBox = true;
// Overwritten in OGLConfig.cpp later
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsPrimitiveRestart = true;
g_Config.backend_info.bSupportsPaletteConversion = true;
g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsDepthClamp = true;
g_Config.backend_info.bSupportsST3CTextures = false;
g_Config.backend_info.bSupportsBPTCTextures = false;
g_Config.backend_info.bSupportsCoarseDerivatives = false;
g_Config.backend_info.bSupportsTextureQueryLevels = false;
g_Config.backend_info.bSupportsSettingObjectNames = false;
g_backend_info.bSupportsDualSourceBlend = true;
g_backend_info.bSupportsPrimitiveRestart = true;
g_backend_info.bSupportsPaletteConversion = true;
g_backend_info.bSupportsClipControl = true;
g_backend_info.bSupportsDepthClamp = true;
g_backend_info.bSupportsST3CTextures = false;
g_backend_info.bSupportsBPTCTextures = false;
g_backend_info.bSupportsCoarseDerivatives = false;
g_backend_info.bSupportsTextureQueryLevels = false;
g_backend_info.bSupportsSettingObjectNames = false;
g_Config.backend_info.bUsesExplictQuadBuffering = true;
g_backend_info.bUsesExplictQuadBuffering = true;
g_Config.backend_info.Adapters.clear();
g_backend_info.Adapters.clear();
// aamodes - 1 is to stay consistent with D3D (means no AA)
g_Config.backend_info.AAModes = {1, 2, 4, 8};
g_backend_info.AAModes = {1, 2, 4, 8};
// check for the max vertex attributes
GLint numvertexattribs = 0;
@ -175,7 +175,7 @@ bool VideoBackend::FillBackendInfo(GLContext* context)
// check the max texture width and height
GLint max_texture_size = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
g_Config.backend_info.MaxTextureSize = static_cast<u32>(max_texture_size);
g_backend_info.MaxTextureSize = static_cast<u32>(max_texture_size);
if (max_texture_size < 1024)
{
PanicAlertFmtT("GL_MAX_TEXTURE_SIZE is {0} - must be at least 1024.", max_texture_size);

View File

@ -50,7 +50,7 @@ AbstractPipeline::CacheData OGLPipeline::GetCacheData() const
// copies of the same program combination, we set a flag on the program object so that it can't
// be retrieved again. When booting, the pipeline cache is loaded in-order, so the additional
// pipelines which use the program combination will re-use the already-created object.
if (!g_ActiveConfig.backend_info.bSupportsPipelineCacheData || m_program->binary_retrieved)
if (!g_backend_info.bSupportsPipelineCacheData || m_program->binary_retrieved)
return {};
GLint program_size = 0;

View File

@ -31,7 +31,7 @@ OGLShader::OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id, std::strin
: AbstractShader(stage), m_id(ProgramShaderCache::GenerateShaderID()), m_type(gl_type),
m_gl_id(gl_id), m_source(std::move(source)), m_name(std::move(name))
{
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
if (!m_name.empty() && g_backend_info.bSupportsSettingObjectNames)
{
glObjectLabel(GL_SHADER, m_gl_id, (GLsizei)m_name.size(), m_name.c_str());
}
@ -42,7 +42,7 @@ OGLShader::OGLShader(GLuint gl_compute_program_id, std::string source, std::stri
m_type(GL_COMPUTE_SHADER), m_gl_compute_program_id(gl_compute_program_id),
m_source(std::move(source)), m_name(std::move(name))
{
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
if (!m_name.empty() && g_backend_info.bSupportsSettingObjectNames)
{
glObjectLabel(GL_PROGRAM, m_gl_compute_program_id, (GLsizei)m_name.size(), m_name.c_str());
}

View File

@ -132,7 +132,7 @@ OGLTexture::OGLTexture(const TextureConfig& tex_config, std::string_view name)
glActiveTexture(GL_MUTABLE_TEXTURE_INDEX);
glBindTexture(target, m_texId);
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
if (!m_name.empty() && g_backend_info.bSupportsSettingObjectNames)
{
glObjectLabel(GL_TEXTURE, m_texId, (GLsizei)m_name.size(), m_name.c_str());
}

View File

@ -38,7 +38,7 @@ VertexManager::VertexManager() = default;
VertexManager::~VertexManager()
{
if (g_ActiveConfig.backend_info.bSupportsPaletteConversion)
if (g_backend_info.bSupportsPaletteConversion)
{
glDeleteTextures(static_cast<GLsizei>(m_texel_buffer_views.size()),
m_texel_buffer_views.data());
@ -58,13 +58,12 @@ bool VertexManager::Initialize()
m_vertex_buffer = StreamBuffer::Create(GL_ARRAY_BUFFER, VERTEX_STREAM_BUFFER_SIZE);
m_index_buffer = StreamBuffer::Create(GL_ELEMENT_ARRAY_BUFFER, INDEX_STREAM_BUFFER_SIZE);
if (g_ActiveConfig.UseVSForLinePointExpand() ||
g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader)
if (g_ActiveConfig.UseVSForLinePointExpand() || g_backend_info.bSupportsDynamicVertexLoader)
{
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_vertex_buffer->GetGLBufferId());
}
if (g_ActiveConfig.backend_info.bSupportsPaletteConversion)
if (g_backend_info.bSupportsPaletteConversion)
{
// The minimum MAX_TEXTURE_BUFFER_SIZE that the spec mandates is 65KB, we are asking for a 1MB
// buffer here. This buffer is also used as storage for undecoded textures when compute shader

View File

@ -88,7 +88,7 @@ static std::string GetGLSLVersionString()
void SHADER::SetProgramVariables()
{
if (g_ActiveConfig.backend_info.bSupportsBindingLayout)
if (g_backend_info.bSupportsBindingLayout)
return;
// To set uniform blocks/uniforms, the program must be active. We restore the
@ -132,7 +132,7 @@ void SHADER::SetProgramBindings(bool is_compute)
}
if (!is_compute)
{
if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend)
if (g_backend_info.bSupportsDualSourceBlend)
{
// So we do support extended blending
// So we need to set a few more things here.
@ -298,8 +298,7 @@ bool ProgramShaderCache::CompileComputeShader(SHADER& shader, std::string_view c
// We need to enable GL_ARB_compute_shader for drivers that support the extension,
// but not GLSL 4.3. Mesa is one example.
std::string full_code;
if (g_ActiveConfig.backend_info.bSupportsComputeShaders &&
g_ogl_config.eSupportedGLSLVersion < Glsl430)
if (g_backend_info.bSupportsComputeShaders && g_ogl_config.eSupportedGLSLVersion < Glsl430)
{
full_code = "#extension GL_ARB_compute_shader : enable\n";
}
@ -616,7 +615,7 @@ PipelineProgram* ProgramShaderCache::GetPipelineProgram(const GLVertexFormat* ve
glAttachShader(prog->shader.glprogid, geometry_shader->GetGLShaderID());
}
if (g_ActiveConfig.backend_info.bSupportsPipelineCacheData)
if (g_backend_info.bSupportsPipelineCacheData)
glProgramParameteri(prog->shader.glprogid, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
// Link program.
@ -709,7 +708,7 @@ void ProgramShaderCache::CreateHeader()
}
std::string earlyz_string;
if (g_ActiveConfig.backend_info.bSupportsEarlyZ)
if (g_backend_info.bSupportsEarlyZ)
{
if (g_ogl_config.bSupportsImageLoadStore)
{
@ -748,7 +747,7 @@ void ProgramShaderCache::CreateHeader()
g_ogl_config.SupportedMultisampleTexStorage != MultisampleTexStorageType::TexStorageNone;
std::string binding_layout;
if (g_ActiveConfig.backend_info.bSupportsBindingLayout)
if (g_backend_info.bSupportsBindingLayout)
{
if (g_ogl_config.bSupportsExplicitLayoutInShader)
{
@ -854,29 +853,28 @@ void ProgramShaderCache::CreateHeader()
,
GetGLSLVersionString(), v < Glsl140 ? "#extension GL_ARB_uniform_buffer_object : enable" : "",
earlyz_string,
(g_ActiveConfig.backend_info.bSupportsBindingLayout && v < GlslEs310) ?
(g_backend_info.bSupportsBindingLayout && v < GlslEs310) ?
"#extension GL_ARB_shading_language_420pack : enable" :
"",
(g_ogl_config.bSupportsMSAA && v < Glsl150) ?
"#extension GL_ARB_texture_multisample : enable" :
"",
binding_layout.c_str(), varying_location.c_str(),
!is_glsles && g_ActiveConfig.backend_info.bSupportsFragmentStoresAndAtomics ?
!is_glsles && g_backend_info.bSupportsFragmentStoresAndAtomics ?
"#extension GL_ARB_shader_storage_buffer_object : enable" :
"",
v < Glsl400 && g_ActiveConfig.backend_info.bSupportsGSInstancing ?
v < Glsl400 && g_backend_info.bSupportsGSInstancing ?
"#extension GL_ARB_gpu_shader5 : enable" :
"",
v < Glsl400 && g_ActiveConfig.backend_info.bSupportsSSAA ?
"#extension GL_ARB_sample_shading : enable" :
"",
v < Glsl400 && g_backend_info.bSupportsSSAA ? "#extension GL_ARB_sample_shading : enable" :
"",
SupportedESPointSize,
g_ogl_config.bSupportsAEP ? "#extension GL_ANDROID_extension_pack_es31a : enable" : "",
v < Glsl140 && g_ActiveConfig.backend_info.bSupportsPaletteConversion ?
v < Glsl140 && g_backend_info.bSupportsPaletteConversion ?
"#extension GL_ARB_texture_buffer_object : enable" :
"",
SupportedESTextureBuffer,
is_glsles && g_ActiveConfig.backend_info.bSupportsDualSourceBlend ?
is_glsles && g_backend_info.bSupportsDualSourceBlend ?
"#extension GL_EXT_blend_func_extended : enable" :
""
@ -886,10 +884,9 @@ void ProgramShaderCache::CreateHeader()
"#extension GL_ARB_shader_image_load_store : enable" :
"",
framebuffer_fetch_string, shader_shuffle_string,
g_ActiveConfig.backend_info.bSupportsCoarseDerivatives ?
"#extension GL_ARB_derivative_control : enable" :
"",
g_ActiveConfig.backend_info.bSupportsTextureQueryLevels ?
g_backend_info.bSupportsCoarseDerivatives ? "#extension GL_ARB_derivative_control : enable" :
"",
g_backend_info.bSupportsTextureQueryLevels ?
"#extension GL_ARB_texture_query_levels : enable" :
"",
// Note: GL_ARB_texture_storage_multisample doesn't have an #extension, as it doesn't
@ -900,9 +897,8 @@ void ProgramShaderCache::CreateHeader()
"",
is_glsles ? "precision highp float;" : "", is_glsles ? "precision highp int;" : "",
is_glsles ? "precision highp sampler2DArray;" : "",
(is_glsles && g_ActiveConfig.backend_info.bSupportsPaletteConversion) ?
"precision highp usamplerBuffer;" :
"",
(is_glsles && g_backend_info.bSupportsPaletteConversion) ? "precision highp usamplerBuffer;" :
"",
use_multisample_2d_array_precision ? "precision highp sampler2DMSArray;" : "",
v >= GlslEs310 ? "precision highp image2DArray;" : "");
}
@ -936,15 +932,15 @@ bool SharedContextAsyncShaderCompiler::WorkerThreadInitWorkerThread(void* param)
// Make the state match the main context to have a better chance of avoiding recompiles.
if (!context->IsGLES())
glEnable(GL_PROGRAM_POINT_SIZE);
if (g_ActiveConfig.backend_info.bSupportsClipControl)
if (g_backend_info.bSupportsClipControl)
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
if (g_ActiveConfig.backend_info.bSupportsDepthClamp)
if (g_backend_info.bSupportsDepthClamp)
{
glEnable(GL_CLIP_DISTANCE0);
glEnable(GL_CLIP_DISTANCE1);
glEnable(GL_DEPTH_CLAMP);
}
if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
if (g_backend_info.bSupportsPrimitiveRestart)
GLUtil::EnablePrimitiveRestart(context);
return true;

View File

@ -97,7 +97,7 @@ void SamplerCache::SetParameters(GLuint sampler_id, const SamplerState& params)
glSamplerParameterf(sampler_id, GL_TEXTURE_MIN_LOD, params.tm1.min_lod / 16.f);
glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_LOD, params.tm1.max_lod / 16.f);
if (g_ActiveConfig.backend_info.bSupportsLodBiasInSampler)
if (g_backend_info.bSupportsLodBiasInSampler)
{
glSamplerParameterf(sampler_id, GL_TEXTURE_LOD_BIAS, params.tm0.lod_bias / 256.f);
}

View File

@ -64,37 +64,37 @@ std::optional<std::string> VideoSoftware::GetWarningMessage() const
void VideoSoftware::InitBackendInfo(const WindowSystemInfo& wsi)
{
g_Config.backend_info.api_type = APIType::Nothing;
g_Config.backend_info.MaxTextureSize = 16384;
g_Config.backend_info.bUsesLowerLeftOrigin = false;
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsEarlyZ = true;
g_Config.backend_info.bSupportsPrimitiveRestart = false;
g_Config.backend_info.bSupportsMultithreading = false;
g_Config.backend_info.bSupportsComputeShaders = false;
g_Config.backend_info.bSupportsGPUTextureDecoding = false;
g_Config.backend_info.bSupportsST3CTextures = false;
g_Config.backend_info.bSupportsBPTCTextures = false;
g_Config.backend_info.bSupportsCopyToVram = false;
g_Config.backend_info.bSupportsLargePoints = false;
g_Config.backend_info.bSupportsDepthReadback = false;
g_Config.backend_info.bSupportsPartialDepthCopies = false;
g_Config.backend_info.bSupportsFramebufferFetch = false;
g_Config.backend_info.bSupportsBackgroundCompiling = false;
g_Config.backend_info.bSupportsLogicOp = true;
g_Config.backend_info.bSupportsShaderBinaries = false;
g_Config.backend_info.bSupportsPipelineCacheData = false;
g_Config.backend_info.bSupportsBBox = true;
g_Config.backend_info.bSupportsCoarseDerivatives = false;
g_Config.backend_info.bSupportsTextureQueryLevels = false;
g_Config.backend_info.bSupportsLodBiasInSampler = false;
g_Config.backend_info.bSupportsSettingObjectNames = false;
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
g_Config.backend_info.bSupportsDynamicVertexLoader = false;
g_backend_info.api_type = APIType::Nothing;
g_backend_info.MaxTextureSize = 16384;
g_backend_info.bUsesLowerLeftOrigin = false;
g_backend_info.bSupports3DVision = false;
g_backend_info.bSupportsDualSourceBlend = true;
g_backend_info.bSupportsEarlyZ = true;
g_backend_info.bSupportsPrimitiveRestart = false;
g_backend_info.bSupportsMultithreading = false;
g_backend_info.bSupportsComputeShaders = false;
g_backend_info.bSupportsGPUTextureDecoding = false;
g_backend_info.bSupportsST3CTextures = false;
g_backend_info.bSupportsBPTCTextures = false;
g_backend_info.bSupportsCopyToVram = false;
g_backend_info.bSupportsLargePoints = false;
g_backend_info.bSupportsDepthReadback = false;
g_backend_info.bSupportsPartialDepthCopies = false;
g_backend_info.bSupportsFramebufferFetch = false;
g_backend_info.bSupportsBackgroundCompiling = false;
g_backend_info.bSupportsLogicOp = true;
g_backend_info.bSupportsShaderBinaries = false;
g_backend_info.bSupportsPipelineCacheData = false;
g_backend_info.bSupportsBBox = true;
g_backend_info.bSupportsCoarseDerivatives = false;
g_backend_info.bSupportsTextureQueryLevels = false;
g_backend_info.bSupportsLodBiasInSampler = false;
g_backend_info.bSupportsSettingObjectNames = false;
g_backend_info.bSupportsPartialMultisampleResolve = true;
g_backend_info.bSupportsDynamicVertexLoader = false;
// aamodes
g_Config.backend_info.AAModes = {1};
g_backend_info.AAModes = {1};
}
bool VideoSoftware::Initialize(const WindowSystemInfo& wsi)

View File

@ -206,18 +206,18 @@ bool ObjectCache::CreateDescriptorSetLayouts()
// Don't set the GS bit if geometry shaders aren't available.
if (g_ActiveConfig.UseVSForLinePointExpand())
{
if (g_ActiveConfig.backend_info.bSupportsGeometryShaders)
if (g_backend_info.bSupportsGeometryShaders)
ubo_bindings[UBO_DESCRIPTOR_SET_BINDING_GS].stageFlags |= VK_SHADER_STAGE_VERTEX_BIT;
else
ubo_bindings[UBO_DESCRIPTOR_SET_BINDING_GS].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
}
else if (!g_ActiveConfig.backend_info.bSupportsGeometryShaders)
else if (!g_backend_info.bSupportsGeometryShaders)
{
create_infos[DESCRIPTOR_SET_LAYOUT_STANDARD_UNIFORM_BUFFERS].bindingCount--;
}
// Remove the dynamic vertex loader's buffer if it'll never be needed
if (!g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader)
if (!g_backend_info.bSupportsDynamicVertexLoader)
create_infos[DESCRIPTOR_SET_LAYOUT_STANDARD_SHADER_STORAGE_BUFFERS].bindingCount--;
for (size_t i = 0; i < create_infos.size(); i++)
@ -286,13 +286,13 @@ bool ObjectCache::CreatePipelineLayouts()
}};
const bool ssbos_in_standard =
g_ActiveConfig.backend_info.bSupportsBBox || g_ActiveConfig.UseVSForLinePointExpand();
g_backend_info.bSupportsBBox || g_ActiveConfig.UseVSForLinePointExpand();
// If bounding box is unsupported, don't bother with the SSBO descriptor set.
if (!ssbos_in_standard)
pipeline_layout_info[PIPELINE_LAYOUT_STANDARD].setLayoutCount--;
// If neither SSBO-using feature is supported, skip in ubershaders too
if (!ssbos_in_standard && !g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader)
if (!ssbos_in_standard && !g_backend_info.bSupportsDynamicVertexLoader)
pipeline_layout_info[PIPELINE_LAYOUT_UBER].setLayoutCount--;
for (size_t i = 0; i < pipeline_layout_info.size(); i++)

View File

@ -387,7 +387,7 @@ bool StateTracker::Bind()
// Re-bind parts of the pipeline
const VkCommandBuffer command_buffer = g_command_buffer_mgr->GetCurrentCommandBuffer();
const bool needs_vertex_buffer = !g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader ||
const bool needs_vertex_buffer = !g_backend_info.bSupportsDynamicVertexLoader ||
m_pipeline->GetUsage() != AbstractPipelineUsage::GXUber;
if (needs_vertex_buffer && (m_dirty_flags & DIRTY_FLAG_VERTEX_BUFFER))
{
@ -481,8 +481,8 @@ void StateTracker::UpdateGXDescriptorSet()
std::array<VkWriteDescriptorSet, MAX_DESCRIPTOR_WRITES> writes;
u32 num_writes = 0;
const bool needs_gs_ubo = g_ActiveConfig.backend_info.bSupportsGeometryShaders ||
g_ActiveConfig.UseVSForLinePointExpand();
const bool needs_gs_ubo =
g_backend_info.bSupportsGeometryShaders || g_ActiveConfig.UseVSForLinePointExpand();
if (m_dirty_flags & DIRTY_FLAG_GX_UBOS || m_gx_descriptor_sets[0] == VK_NULL_HANDLE)
{
@ -535,8 +535,8 @@ void StateTracker::UpdateGXDescriptorSet()
m_dirty_flags = (m_dirty_flags & ~DIRTY_FLAG_GX_SAMPLERS) | DIRTY_FLAG_DESCRIPTOR_SETS;
}
const bool needs_bbox_ssbo = g_ActiveConfig.backend_info.bSupportsBBox;
const bool needs_vertex_ssbo = (g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader &&
const bool needs_bbox_ssbo = g_backend_info.bSupportsBBox;
const bool needs_vertex_ssbo = (g_backend_info.bSupportsDynamicVertexLoader &&
m_pipeline->GetUsage() == AbstractPipelineUsage::GXUber) ||
g_ActiveConfig.UseVSForLinePointExpand();
const bool needs_ssbo = needs_bbox_ssbo || needs_vertex_ssbo;
@ -552,8 +552,7 @@ void StateTracker::UpdateGXDescriptorSet()
VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, nullptr, m_gx_descriptor_sets[2], 0, 0, 1,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, nullptr, &m_bindings.ssbo, nullptr};
if (g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader ||
g_ActiveConfig.UseVSForLinePointExpand())
if (g_backend_info.bSupportsDynamicVertexLoader || g_ActiveConfig.UseVSForLinePointExpand())
{
writes[num_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
nullptr,

View File

@ -118,7 +118,7 @@ void VKGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_en
clear_color_value.color.float32[2] = static_cast<float>((color >> 0) & 0xFF) / 255.0f;
clear_color_value.color.float32[3] = static_cast<float>((color >> 24) & 0xFF) / 255.0f;
clear_depth_value.depthStencil.depth = static_cast<float>(z & 0xFFFFFF) / 16777216.0f;
if (!g_ActiveConfig.backend_info.bSupportsReversedDepthRange)
if (!g_backend_info.bSupportsReversedDepthRange)
clear_depth_value.depthStencil.depth = 1.0f - clear_depth_value.depthStencil.depth;
// If we're not in a render pass (start of the frame), we can use a clear render pass

View File

@ -3,13 +3,10 @@
#include "VideoBackends/Vulkan/VideoBackend.h"
#include <vector>
#include "Common/Logging/LogManager.h"
#include "Common/MsgHandler.h"
#include "VideoBackends/Vulkan/CommandBufferManager.h"
#include "VideoBackends/Vulkan/Constants.h"
#include "VideoBackends/Vulkan/ObjectCache.h"
#include "VideoBackends/Vulkan/StateTracker.h"
#include "VideoBackends/Vulkan/VKBoundingBox.h"
@ -19,9 +16,7 @@
#include "VideoBackends/Vulkan/VKVertexManager.h"
#include "VideoBackends/Vulkan/VulkanContext.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
#if defined(VK_USE_PLATFORM_METAL_EXT)
@ -32,7 +27,7 @@ namespace Vulkan
{
void VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
{
VulkanContext::PopulateBackendInfo(&g_Config);
VulkanContext::PopulateBackendInfo(&g_backend_info);
if (LoadVulkanLibrary())
{
@ -44,7 +39,7 @@ void VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
if (LoadVulkanInstanceFunctions(temp_instance))
{
VulkanContext::GPUList gpu_list = VulkanContext::EnumerateGPUs(temp_instance);
VulkanContext::PopulateBackendInfoAdapters(&g_Config, gpu_list);
VulkanContext::PopulateBackendInfoAdapters(&g_backend_info, gpu_list);
if (!gpu_list.empty())
{
@ -55,8 +50,8 @@ void VideoBackend::InitBackendInfo(const WindowSystemInfo& wsi)
VkPhysicalDevice gpu = gpu_list[device_index];
VulkanContext::PhysicalDeviceInfo properties(gpu);
VulkanContext::PopulateBackendInfoFeatures(&g_Config, gpu, properties);
VulkanContext::PopulateBackendInfoMultisampleModes(&g_Config, gpu, properties);
VulkanContext::PopulateBackendInfoFeatures(&g_backend_info, gpu, properties);
VulkanContext::PopulateBackendInfoMultisampleModes(&g_backend_info, gpu, properties);
}
}
@ -144,8 +139,8 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
}
// Populate BackendInfo with as much information as we can at this point.
VulkanContext::PopulateBackendInfo(&g_Config);
VulkanContext::PopulateBackendInfoAdapters(&g_Config, gpu_list);
VulkanContext::PopulateBackendInfo(&g_backend_info);
VulkanContext::PopulateBackendInfoAdapters(&g_backend_info, gpu_list);
// We need the surface before we can create a device, as some parameters depend on it.
VkSurfaceKHR surface = VK_NULL_HANDLE;
@ -183,11 +178,11 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
// Since VulkanContext maintains a copy of the device features and properties, we can use this
// to initialize the backend information, so that we don't need to enumerate everything again.
VulkanContext::PopulateBackendInfoFeatures(&g_Config, g_vulkan_context->GetPhysicalDevice(),
VulkanContext::PopulateBackendInfoFeatures(&g_backend_info, g_vulkan_context->GetPhysicalDevice(),
g_vulkan_context->GetDeviceInfo());
VulkanContext::PopulateBackendInfoMultisampleModes(
&g_Config, g_vulkan_context->GetPhysicalDevice(), g_vulkan_context->GetDeviceInfo());
g_Config.backend_info.bSupportsExclusiveFullscreen =
&g_backend_info, g_vulkan_context->GetPhysicalDevice(), g_vulkan_context->GetDeviceInfo());
g_backend_info.bSupportsExclusiveFullscreen =
enable_surface && g_vulkan_context->SupportsExclusiveFullscreen(wsi, surface);
UpdateActiveConfig();

View File

@ -46,7 +46,7 @@ GetVulkanRasterizationState(const RasterizationState& state)
{VK_CULL_MODE_NONE, VK_CULL_MODE_BACK_BIT, VK_CULL_MODE_FRONT_BIT,
VK_CULL_MODE_FRONT_AND_BACK}};
bool depth_clamp = g_ActiveConfig.backend_info.bSupportsDepthClamp;
bool depth_clamp = g_backend_info.bSupportsDepthClamp;
return {
VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // VkStructureType sType
@ -85,7 +85,7 @@ static VkPipelineDepthStencilStateCreateInfo GetVulkanDepthStencilState(const De
{
// Less/greater are swapped due to inverted depth.
VkCompareOp compare_op;
bool inverted_depth = !g_ActiveConfig.backend_info.bSupportsReversedDepthRange;
bool inverted_depth = !g_backend_info.bSupportsReversedDepthRange;
switch (state.func)
{
case CompareMode::Never:
@ -215,7 +215,7 @@ GetVulkanColorBlendState(const BlendingState& state,
VK_LOGIC_OP_COPY_INVERTED, VK_LOGIC_OP_OR_INVERTED, VK_LOGIC_OP_NAND, VK_LOGIC_OP_SET}};
VkBool32 vk_logic_op_enable = static_cast<VkBool32>(state.logicopenable);
if (vk_logic_op_enable && !g_ActiveConfig.backend_info.bSupportsLogicOp)
if (vk_logic_op_enable && !g_backend_info.bSupportsLogicOp)
{
// At the time of writing, Adreno and Mali drivers didn't support logic ops.
// The "emulation" through blending path has been removed, so just disable it completely.
@ -306,7 +306,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
// VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY,
// VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY or VK_PRIMITIVE_TOPOLOGY_PATCH_LIST,
// primitiveRestartEnable must be VK_FALSE
if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart &&
if (g_backend_info.bSupportsPrimitiveRestart &&
IsStripPrimitiveTopology(input_assembly_state.topology))
{
input_assembly_state.primitiveRestartEnable = VK_TRUE;

View File

@ -19,7 +19,7 @@ VKShader::VKShader(ShaderStage stage, std::vector<u32> spv, VkShaderModule mod,
: AbstractShader(stage), m_spv(std::move(spv)), m_module(mod),
m_compute_pipeline(VK_NULL_HANDLE), m_name(name)
{
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
if (!m_name.empty() && g_backend_info.bSupportsSettingObjectNames)
{
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
@ -34,7 +34,7 @@ VKShader::VKShader(std::vector<u32> spv, VkPipeline compute_pipeline, std::strin
: AbstractShader(ShaderStage::Compute), m_spv(std::move(spv)), m_module(VK_NULL_HANDLE),
m_compute_pipeline(compute_pipeline), m_name(name)
{
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
if (!m_name.empty() && g_backend_info.bSupportsSettingObjectNames)
{
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;

View File

@ -377,8 +377,7 @@ bool SwapChain::CreateSwapChain()
// Try without exclusive fullscreen.
WARN_LOG_FMT(VIDEO, "Failed to create exclusive fullscreen swapchain, trying without.");
swap_chain_info.pNext = nullptr;
g_Config.backend_info.bSupportsExclusiveFullscreen = false;
g_ActiveConfig.backend_info.bSupportsExclusiveFullscreen = false;
g_backend_info.bSupportsExclusiveFullscreen = false;
m_fullscreen_supported = false;
}
}
@ -601,8 +600,7 @@ bool SwapChain::RecreateSurface(void* native_handle)
// Update exclusive fullscreen support (unlikely to change).
m_fullscreen_supported = g_vulkan_context->SupportsExclusiveFullscreen(m_wsi, m_surface);
g_Config.backend_info.bSupportsExclusiveFullscreen = m_fullscreen_supported;
g_ActiveConfig.backend_info.bSupportsExclusiveFullscreen = m_fullscreen_supported;
g_backend_info.bSupportsExclusiveFullscreen = m_fullscreen_supported;
m_current_fullscreen_state = false;
m_next_fullscreen_state = false;

View File

@ -32,7 +32,7 @@ VKTexture::VKTexture(const TextureConfig& tex_config, VmaAllocation alloc, VkIma
: AbstractTexture(tex_config), m_alloc(alloc), m_image(image), m_layout(layout),
m_compute_layout(compute_layout), m_name(name)
{
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
if (!m_name.empty() && g_backend_info.bSupportsSettingObjectNames)
{
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;

View File

@ -8,11 +8,8 @@
#include <cstring>
#include "Common/Assert.h"
#include "Common/CommonFuncs.h"
#include "Common/Contains.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/VideoCommon.h"
@ -387,7 +384,7 @@ bool VulkanContext::SelectInstanceExtensions(std::vector<const char*>* extension
// VK_EXT_debug_utils
if (AddExtension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, false))
{
g_Config.backend_info.bSupportsSettingObjectNames = true;
g_backend_info.bSupportsSettingObjectNames = true;
}
else if (enable_debug_utils)
{
@ -420,96 +417,96 @@ VulkanContext::GPUList VulkanContext::EnumerateGPUs(VkInstance instance)
return gpus;
}
void VulkanContext::PopulateBackendInfo(VideoConfig* config)
void VulkanContext::PopulateBackendInfo(BackendInfo* backend_info)
{
config->backend_info.api_type = APIType::Vulkan;
config->backend_info.bSupports3DVision = false; // D3D-exclusive.
config->backend_info.bSupportsEarlyZ = true; // Assumed support.
config->backend_info.bSupportsPrimitiveRestart = true; // Assumed support.
config->backend_info.bSupportsBindingLayout = false; // Assumed support.
config->backend_info.bSupportsPaletteConversion = true; // Assumed support.
config->backend_info.bSupportsClipControl = true; // Assumed support.
config->backend_info.bSupportsMultithreading = true; // Assumed support.
config->backend_info.bSupportsComputeShaders = true; // Assumed support.
config->backend_info.bSupportsGPUTextureDecoding = true; // Assumed support.
config->backend_info.bSupportsBitfield = true; // Assumed support.
config->backend_info.bSupportsPartialDepthCopies = true; // Assumed support.
config->backend_info.bSupportsShaderBinaries = true; // Assumed support.
config->backend_info.bSupportsPipelineCacheData = false; // Handled via pipeline caches.
config->backend_info.bSupportsDynamicSamplerIndexing = true; // Assumed support.
config->backend_info.bSupportsPostProcessing = true; // Assumed support.
config->backend_info.bSupportsBackgroundCompiling = true; // Assumed support.
config->backend_info.bSupportsCopyToVram = true; // Assumed support.
config->backend_info.bSupportsReversedDepthRange = true; // Assumed support.
config->backend_info.bSupportsExclusiveFullscreen = false; // Dependent on OS and features.
config->backend_info.bSupportsDualSourceBlend = false; // Dependent on features.
config->backend_info.bSupportsGeometryShaders = false; // Dependent on features.
config->backend_info.bSupportsGSInstancing = false; // Dependent on features.
config->backend_info.bSupportsBBox = false; // Dependent on features.
config->backend_info.bSupportsFragmentStoresAndAtomics = false; // Dependent on features.
config->backend_info.bSupportsSSAA = false; // Dependent on features.
config->backend_info.bSupportsDepthClamp = false; // Dependent on features.
config->backend_info.bSupportsST3CTextures = false; // Dependent on features.
config->backend_info.bSupportsBPTCTextures = false; // Dependent on features.
config->backend_info.bSupportsLogicOp = false; // Dependent on features.
config->backend_info.bSupportsLargePoints = false; // Dependent on features.
config->backend_info.bSupportsFramebufferFetch = false; // Dependent on OS and features.
config->backend_info.bSupportsCoarseDerivatives = true; // Assumed support.
config->backend_info.bSupportsTextureQueryLevels = true; // Assumed support.
config->backend_info.bSupportsLodBiasInSampler = false; // Dependent on OS.
config->backend_info.bSupportsSettingObjectNames = false; // Dependent on features.
config->backend_info.bSupportsPartialMultisampleResolve = true; // Assumed support.
config->backend_info.bSupportsDynamicVertexLoader = true; // Assumed support.
config->backend_info.bSupportsVSLinePointExpand = true; // Assumed support.
config->backend_info.bSupportsHDROutput = true; // Assumed support.
backend_info->api_type = APIType::Vulkan;
backend_info->bSupports3DVision = false; // D3D-exclusive.
backend_info->bSupportsEarlyZ = true; // Assumed support.
backend_info->bSupportsPrimitiveRestart = true; // Assumed support.
backend_info->bSupportsBindingLayout = false; // Assumed support.
backend_info->bSupportsPaletteConversion = true; // Assumed support.
backend_info->bSupportsClipControl = true; // Assumed support.
backend_info->bSupportsMultithreading = true; // Assumed support.
backend_info->bSupportsComputeShaders = true; // Assumed support.
backend_info->bSupportsGPUTextureDecoding = true; // Assumed support.
backend_info->bSupportsBitfield = true; // Assumed support.
backend_info->bSupportsPartialDepthCopies = true; // Assumed support.
backend_info->bSupportsShaderBinaries = true; // Assumed support.
backend_info->bSupportsPipelineCacheData = false; // Handled via pipeline caches.
backend_info->bSupportsDynamicSamplerIndexing = true; // Assumed support.
backend_info->bSupportsPostProcessing = true; // Assumed support.
backend_info->bSupportsBackgroundCompiling = true; // Assumed support.
backend_info->bSupportsCopyToVram = true; // Assumed support.
backend_info->bSupportsReversedDepthRange = true; // Assumed support.
backend_info->bSupportsExclusiveFullscreen = false; // Dependent on OS and features.
backend_info->bSupportsDualSourceBlend = false; // Dependent on features.
backend_info->bSupportsGeometryShaders = false; // Dependent on features.
backend_info->bSupportsGSInstancing = false; // Dependent on features.
backend_info->bSupportsBBox = false; // Dependent on features.
backend_info->bSupportsFragmentStoresAndAtomics = false; // Dependent on features.
backend_info->bSupportsSSAA = false; // Dependent on features.
backend_info->bSupportsDepthClamp = false; // Dependent on features.
backend_info->bSupportsST3CTextures = false; // Dependent on features.
backend_info->bSupportsBPTCTextures = false; // Dependent on features.
backend_info->bSupportsLogicOp = false; // Dependent on features.
backend_info->bSupportsLargePoints = false; // Dependent on features.
backend_info->bSupportsFramebufferFetch = false; // Dependent on OS and features.
backend_info->bSupportsCoarseDerivatives = true; // Assumed support.
backend_info->bSupportsTextureQueryLevels = true; // Assumed support.
backend_info->bSupportsLodBiasInSampler = false; // Dependent on OS.
backend_info->bSupportsSettingObjectNames = false; // Dependent on features.
backend_info->bSupportsPartialMultisampleResolve = true; // Assumed support.
backend_info->bSupportsDynamicVertexLoader = true; // Assumed support.
backend_info->bSupportsVSLinePointExpand = true; // Assumed support.
backend_info->bSupportsHDROutput = true; // Assumed support.
}
void VulkanContext::PopulateBackendInfoAdapters(VideoConfig* config, const GPUList& gpu_list)
void VulkanContext::PopulateBackendInfoAdapters(BackendInfo* backend_info, const GPUList& gpu_list)
{
config->backend_info.Adapters.clear();
backend_info->Adapters.clear();
for (VkPhysicalDevice physical_device : gpu_list)
{
VkPhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties(physical_device, &properties);
config->backend_info.Adapters.push_back(properties.deviceName);
backend_info->Adapters.push_back(properties.deviceName);
}
}
void VulkanContext::PopulateBackendInfoFeatures(VideoConfig* config, VkPhysicalDevice gpu,
void VulkanContext::PopulateBackendInfoFeatures(BackendInfo* backend_info, VkPhysicalDevice gpu,
const PhysicalDeviceInfo& info)
{
config->backend_info.MaxTextureSize = info.maxImageDimension2D;
config->backend_info.bUsesLowerLeftOrigin = false;
config->backend_info.bSupportsDualSourceBlend = info.dualSrcBlend;
config->backend_info.bSupportsGeometryShaders = info.geometryShader;
config->backend_info.bSupportsGSInstancing = info.geometryShader;
config->backend_info.bSupportsBBox = config->backend_info.bSupportsFragmentStoresAndAtomics =
backend_info->MaxTextureSize = info.maxImageDimension2D;
backend_info->bUsesLowerLeftOrigin = false;
backend_info->bSupportsDualSourceBlend = info.dualSrcBlend;
backend_info->bSupportsGeometryShaders = info.geometryShader;
backend_info->bSupportsGSInstancing = info.geometryShader;
backend_info->bSupportsBBox = backend_info->bSupportsFragmentStoresAndAtomics =
info.fragmentStoresAndAtomics;
config->backend_info.bSupportsSSAA = info.sampleRateShading;
config->backend_info.bSupportsLogicOp = info.logicOp;
backend_info->bSupportsSSAA = info.sampleRateShading;
backend_info->bSupportsLogicOp = info.logicOp;
// Metal doesn't support this.
config->backend_info.bSupportsLodBiasInSampler = info.driverID != VK_DRIVER_ID_MOLTENVK;
backend_info->bSupportsLodBiasInSampler = info.driverID != VK_DRIVER_ID_MOLTENVK;
// Disable geometry shader when shaderTessellationAndGeometryPointSize is not supported.
// Seems this is needed for gl_Layer.
if (!info.shaderTessellationAndGeometryPointSize)
{
config->backend_info.bSupportsGeometryShaders = VK_FALSE;
config->backend_info.bSupportsGSInstancing = VK_FALSE;
backend_info->bSupportsGeometryShaders = VK_FALSE;
backend_info->bSupportsGSInstancing = VK_FALSE;
}
// Depth clamping implies shaderClipDistance and depthClamp
config->backend_info.bSupportsDepthClamp = info.depthClamp && info.shaderClipDistance;
backend_info->bSupportsDepthClamp = info.depthClamp && info.shaderClipDistance;
// textureCompressionBC implies BC1 through BC7, which is a superset of DXT1/3/5, which we need.
config->backend_info.bSupportsST3CTextures = info.textureCompressionBC;
config->backend_info.bSupportsBPTCTextures = info.textureCompressionBC;
backend_info->bSupportsST3CTextures = info.textureCompressionBC;
backend_info->bSupportsBPTCTextures = info.textureCompressionBC;
// Some devices don't support point sizes >1 (e.g. Adreno).
// If we can't use a point size above our maximum IR, use triangles instead for EFB pokes.
// This means a 6x increase in the size of the vertices, though.
config->backend_info.bSupportsLargePoints =
backend_info->bSupportsLargePoints =
info.largePoints && info.pointSizeRange[0] <= 1.0f && info.pointSizeRange[1] >= 16;
std::string device_name = info.deviceName;
@ -520,25 +517,26 @@ void VulkanContext::PopulateBackendInfoFeatures(VideoConfig* config, VkPhysicalD
// We currently use a hacked MoltenVK to implement this, so don't attempt outside of MVK
if (is_moltenvk && (vendor_id == 0x106B || device_name.find("Apple") != std::string::npos))
{
config->backend_info.bSupportsFramebufferFetch = true;
backend_info->bSupportsFramebufferFetch = true;
}
// Our usage of primitive restart appears to be broken on AMD's binary drivers.
// Seems to be fine on GCN Gen 1-2, unconfirmed on GCN Gen 3, causes driver resets on GCN Gen 4.
if (DriverDetails::HasBug(DriverDetails::BUG_PRIMITIVE_RESTART))
config->backend_info.bSupportsPrimitiveRestart = false;
backend_info->bSupportsPrimitiveRestart = false;
// Reversed depth range is broken on some drivers, or is broken when used in combination
// with depth clamping. Fall back to inverted depth range for these.
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_REVERSED_DEPTH_RANGE))
config->backend_info.bSupportsReversedDepthRange = false;
backend_info->bSupportsReversedDepthRange = false;
// Dynamic sampler indexing locks up Intel GPUs on MoltenVK/Metal
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING))
config->backend_info.bSupportsDynamicSamplerIndexing = false;
backend_info->bSupportsDynamicSamplerIndexing = false;
}
void VulkanContext::PopulateBackendInfoMultisampleModes(VideoConfig* config, VkPhysicalDevice gpu,
void VulkanContext::PopulateBackendInfoMultisampleModes(BackendInfo* backend_info,
VkPhysicalDevice gpu,
const PhysicalDeviceInfo& info)
{
// Query image support for the EFB texture formats.
@ -557,32 +555,32 @@ void VulkanContext::PopulateBackendInfoMultisampleModes(VideoConfig* config, VkP
efb_color_properties.sampleCounts & efb_depth_properties.sampleCounts;
// No AA
config->backend_info.AAModes.clear();
config->backend_info.AAModes.emplace_back(1);
backend_info->AAModes.clear();
backend_info->AAModes.emplace_back(1);
// 2xMSAA/SSAA
if (supported_sample_counts & VK_SAMPLE_COUNT_2_BIT)
config->backend_info.AAModes.emplace_back(2);
backend_info->AAModes.emplace_back(2);
// 4xMSAA/SSAA
if (supported_sample_counts & VK_SAMPLE_COUNT_4_BIT)
config->backend_info.AAModes.emplace_back(4);
backend_info->AAModes.emplace_back(4);
// 8xMSAA/SSAA
if (supported_sample_counts & VK_SAMPLE_COUNT_8_BIT)
config->backend_info.AAModes.emplace_back(8);
backend_info->AAModes.emplace_back(8);
// 16xMSAA/SSAA
if (supported_sample_counts & VK_SAMPLE_COUNT_16_BIT)
config->backend_info.AAModes.emplace_back(16);
backend_info->AAModes.emplace_back(16);
// 32xMSAA/SSAA
if (supported_sample_counts & VK_SAMPLE_COUNT_32_BIT)
config->backend_info.AAModes.emplace_back(32);
backend_info->AAModes.emplace_back(32);
// 64xMSAA/SSAA
if (supported_sample_counts & VK_SAMPLE_COUNT_64_BIT)
config->backend_info.AAModes.emplace_back(64);
backend_info->AAModes.emplace_back(64);
}
std::unique_ptr<VulkanContext> VulkanContext::Create(VkInstance instance, VkPhysicalDevice gpu,

View File

@ -72,11 +72,11 @@ public:
// Populates backend/video config.
// These are public so that the backend info can be populated without creating a context.
static void PopulateBackendInfo(VideoConfig* config);
static void PopulateBackendInfoAdapters(VideoConfig* config, const GPUList& gpu_list);
static void PopulateBackendInfoFeatures(VideoConfig* config, VkPhysicalDevice gpu,
static void PopulateBackendInfo(BackendInfo* backend_info);
static void PopulateBackendInfoAdapters(BackendInfo* backend_info, const GPUList& gpu_list);
static void PopulateBackendInfoFeatures(BackendInfo* backend_info, VkPhysicalDevice gpu,
const PhysicalDeviceInfo& info);
static void PopulateBackendInfoMultisampleModes(VideoConfig* config, VkPhysicalDevice gpu,
static void PopulateBackendInfoMultisampleModes(BackendInfo* backend_info, VkPhysicalDevice gpu,
const PhysicalDeviceInfo& info);
// Creates a Vulkan device context.