Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoConfig: Add flag for whether the system supports setting object names #10422

Merged
merged 11 commits into from
Jan 31, 2022
Merged
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/D3D/D3DMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void VideoBackend::FillBackendInfo()
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.Adapters = D3DCommon::GetAdapterNames();
g_Config.backend_info.AAModes = D3D::GetAAModes(g_Config.iAdapter);
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/D3D12/VideoBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void VideoBackend::FillBackendInfo()
g_Config.backend_info.bSupportsCoarseDerivatives = true;
g_Config.backend_info.bSupportsTextureQueryLevels = true;
g_Config.backend_info.bSupportsLodBiasInSampler = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;

// We can only check texture support once we have a device.
if (g_dx_context)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/Null/NullBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsCoarseDerivatives = false;
g_Config.backend_info.bSupportsTextureQueryLevels = false;
g_Config.backend_info.bSupportsLodBiasInSampler = false;
g_Config.backend_info.bSupportsSettingObjectNames = false;

// aamodes: We only support 1 sample, so no MSAA
g_Config.backend_info.Adapters.clear();
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/VideoBackends/OGL/OGLRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_ogl_config.bSupports3DTextureStorageMultisample = true;
g_Config.backend_info.bSupportsBitfield = true;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
}
}
else
Expand Down Expand Up @@ -628,6 +629,7 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_ogl_config.bSupportsTextureStorage = true;
g_ogl_config.bSupportsImageLoadStore = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;

// Compute shaders are core in GL4.3.
g_Config.backend_info.bSupportsComputeShaders = true;
Expand Down
6 changes: 4 additions & 2 deletions Source/Core/VideoBackends/OGL/OGLShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "VideoBackends/OGL/ProgramShaderCache.h"

#include "VideoCommon/VideoConfig.h"

namespace OGL
{
static GLenum GetGLShaderTypeForStage(ShaderStage stage)
Expand All @@ -29,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())
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{
glObjectLabel(GetGLShaderTypeForStage(stage), m_gl_id, -1, m_name.c_str());
}
Expand All @@ -40,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())
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{
glObjectLabel(GL_COMPUTE_SHADER, m_gl_compute_program_id, -1, m_name.c_str());
}
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/VideoBackends/OGL/OGLTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "VideoBackends/OGL/SamplerCache.h"

#include "VideoCommon/VideoConfig.h"

namespace OGL
{
namespace
Expand Down Expand Up @@ -116,7 +118,7 @@ OGLTexture::OGLTexture(const TextureConfig& tex_config, std::string_view name)
glActiveTexture(GL_MUTABLE_TEXTURE_INDEX);
glBindTexture(target, m_texId);

if (!m_name.empty())
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{
glObjectLabel(GL_TEXTURE, m_texId, -1, m_name.c_str());
}
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/Software/SWmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void VideoSoftware::InitBackendInfo()
g_Config.backend_info.bSupportsCoarseDerivatives = false;
g_Config.backend_info.bSupportsTextureQueryLevels = false;
g_Config.backend_info.bSupportsLodBiasInSampler = false;
g_Config.backend_info.bSupportsSettingObjectNames = false;

// aamodes
g_Config.backend_info.AAModes = {1};
Expand Down
6 changes: 4 additions & 2 deletions Source/Core/VideoBackends/Vulkan/VKShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
#include "VideoBackends/Vulkan/ShaderCompiler.h"
#include "VideoBackends/Vulkan/VulkanContext.h"

#include "VideoCommon/VideoConfig.h"

namespace Vulkan
{
VKShader::VKShader(ShaderStage stage, std::vector<u32> spv, VkShaderModule mod,
std::string_view name)
: AbstractShader(stage), m_spv(std::move(spv)), m_module(mod),
m_compute_pipeline(VK_NULL_HANDLE), m_name(name)
{
if (!m_name.empty() && vkSetDebugUtilsObjectNameEXT)
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
Expand All @@ -32,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() && vkSetDebugUtilsObjectNameEXT)
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/VideoBackends/Vulkan/VKTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "VideoBackends/Vulkan/VKStreamBuffer.h"
#include "VideoBackends/Vulkan/VulkanContext.h"

#include "VideoCommon/VideoConfig.h"

namespace Vulkan
{
VKTexture::VKTexture(const TextureConfig& tex_config, VkDeviceMemory device_memory, VkImage image,
Expand All @@ -29,7 +31,7 @@ VKTexture::VKTexture(const TextureConfig& tex_config, VkDeviceMemory device_memo
: AbstractTexture(tex_config), m_device_memory(device_memory), m_image(image), m_layout(layout),
m_compute_layout(compute_layout), m_name(name)
{
if (!m_name.empty() && vkSetDebugUtilsObjectNameEXT)
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
Expand Down
7 changes: 6 additions & 1 deletion Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ bool VulkanContext::SelectInstanceExtensions(std::vector<const char*>* extension

AddExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, false);
AddExtension(VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME, false);
AddExtension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, false);

if (AddExtension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, false))
{
g_Config.backend_info.bSupportsSettingObjectNames = true;
}

return true;
}
Expand Down Expand Up @@ -290,6 +294,7 @@ void VulkanContext::PopulateBackendInfo(VideoConfig* config)
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.
}

void VulkanContext::PopulateBackendInfoAdapters(VideoConfig* config, const GPUList& gpu_list)
Expand Down
3 changes: 1 addition & 2 deletions Source/Core/VideoBackends/Vulkan/VulkanEntryPoints.inl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ VULKAN_INSTANCE_ENTRY_POINT(vkDestroyDebugReportCallbackEXT, false)
VULKAN_INSTANCE_ENTRY_POINT(vkDebugReportMessageEXT, false)
VULKAN_INSTANCE_ENTRY_POINT(vkGetPhysicalDeviceProperties2, false)
VULKAN_INSTANCE_ENTRY_POINT(vkGetPhysicalDeviceSurfaceCapabilities2KHR, false)
VULKAN_INSTANCE_ENTRY_POINT(vkSetDebugUtilsObjectNameEXT, false)

#endif // VULKAN_INSTANCE_ENTRY_POINT

Expand Down Expand Up @@ -197,6 +198,4 @@ VULKAN_DEVICE_ENTRY_POINT(vkAcquireFullScreenExclusiveModeEXT, false)
VULKAN_DEVICE_ENTRY_POINT(vkReleaseFullScreenExclusiveModeEXT, false)
#endif

VULKAN_DEVICE_ENTRY_POINT(vkSetDebugUtilsObjectNameEXT, false)

#endif // VULKAN_DEVICE_ENTRY_POINT
1 change: 1 addition & 0 deletions Source/Core/VideoCommon/VideoConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ struct VideoConfig final
bool bSupportsCoarseDerivatives = false;
bool bSupportsTextureQueryLevels = false;
bool bSupportsLodBiasInSampler = false;
bool bSupportsSettingObjectNames = false;
} backend_info;

// Utility
Expand Down