mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 13:49:53 -06:00
VideoBackends / VideoCommon: allow the ability to set debug names for shaders / textures. These names are visible in applications like RenderDoc
This commit is contained in:
@ -15,9 +15,15 @@
|
||||
|
||||
namespace DX11
|
||||
{
|
||||
DXTexture::DXTexture(const TextureConfig& config, ComPtr<ID3D11Texture2D> texture)
|
||||
: AbstractTexture(config), m_texture(std::move(texture))
|
||||
DXTexture::DXTexture(const TextureConfig& config, ComPtr<ID3D11Texture2D> texture,
|
||||
std::string_view name)
|
||||
: AbstractTexture(config), m_texture(std::move(texture)), m_name(name)
|
||||
{
|
||||
if (!m_name.empty())
|
||||
{
|
||||
m_texture->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(m_name.size()),
|
||||
m_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
DXTexture::~DXTexture()
|
||||
@ -26,7 +32,7 @@ DXTexture::~DXTexture()
|
||||
D3D::stateman->ApplyTextures();
|
||||
}
|
||||
|
||||
std::unique_ptr<DXTexture> DXTexture::Create(const TextureConfig& config)
|
||||
std::unique_ptr<DXTexture> DXTexture::Create(const TextureConfig& config, std::string_view name)
|
||||
{
|
||||
// Use typeless to create the texture when it's a render target, so we can alias it with an
|
||||
// integer format (for EFB).
|
||||
@ -49,7 +55,7 @@ std::unique_ptr<DXTexture> DXTexture::Create(const TextureConfig& config)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<DXTexture> tex(new DXTexture(config, std::move(d3d_texture)));
|
||||
std::unique_ptr<DXTexture> tex(new DXTexture(config, std::move(d3d_texture), name));
|
||||
if (!tex->CreateSRV() || (config.IsComputeImage() && !tex->CreateUAV()))
|
||||
return nullptr;
|
||||
|
||||
@ -70,7 +76,7 @@ std::unique_ptr<DXTexture> DXTexture::CreateAdopted(ComPtr<ID3D11Texture2D> text
|
||||
if (desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS)
|
||||
config.flags |= AbstractTextureFlag_ComputeImage;
|
||||
|
||||
std::unique_ptr<DXTexture> tex(new DXTexture(config, std::move(texture)));
|
||||
std::unique_ptr<DXTexture> tex(new DXTexture(config, std::move(texture), ""));
|
||||
if (desc.BindFlags & D3D11_BIND_SHADER_RESOURCE && !tex->CreateSRV())
|
||||
return nullptr;
|
||||
if (desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS && !tex->CreateUAV())
|
||||
|
Reference in New Issue
Block a user