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

@ -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);
}