mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
VideoCommon: Move backend_info out of VideoConfig struct.
This commit is contained in:
@ -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++)
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user