mirror of https://github.com/PCSX2/pcsx2.git
GS: Move texture object labels to base class
This commit is contained in:
parent
46a68e2118
commit
f036cdaaad
|
@ -16,6 +16,7 @@
|
||||||
#include "common/BitUtils.h"
|
#include "common/BitUtils.h"
|
||||||
#include "common/DynamicLibrary.h"
|
#include "common/DynamicLibrary.h"
|
||||||
#include "common/Path.h"
|
#include "common/Path.h"
|
||||||
|
#include "common/SmallString.h"
|
||||||
#include "common/StringUtil.h"
|
#include "common/StringUtil.h"
|
||||||
#include "common/Threading.h"
|
#include "common/Threading.h"
|
||||||
|
|
||||||
|
@ -838,6 +839,10 @@ bool GSCapture::DeliverVideoFrame(GSTexture* stex)
|
||||||
Console.Error("GSCapture: Failed to create %x%d download texture", stex->GetWidth(), stex->GetHeight());
|
Console.Error("GSCapture: Failed to create %x%d download texture", stex->GetWidth(), stex->GetHeight());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
pf.tex->SetDebugName(TinyString::from_fmt("GSCapture {}x{} Download Texture", stex->GetWidth(), stex->GetHeight()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const GSVector4i rc(0, 0, stex->GetWidth(), stex->GetHeight());
|
const GSVector4i rc(0, 0, stex->GetWidth(), stex->GetHeight());
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "common/BitUtils.h"
|
#include "common/BitUtils.h"
|
||||||
#include "common/FileSystem.h"
|
#include "common/FileSystem.h"
|
||||||
#include "common/Path.h"
|
#include "common/Path.h"
|
||||||
|
#include "common/SmallString.h"
|
||||||
#include "common/StringUtil.h"
|
#include "common/StringUtil.h"
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
@ -78,9 +79,111 @@ static int MipmapLevelsForSize(int width, int height)
|
||||||
return std::min(static_cast<int>(std::log2(std::max(width, height))) + 1, MAXIMUM_TEXTURE_MIPMAP_LEVELS);
|
return std::min(static_cast<int>(std::log2(std::max(width, height))) + 1, MAXIMUM_TEXTURE_MIPMAP_LEVELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
enum class TextureLabel
|
||||||
|
{
|
||||||
|
ColorRT,
|
||||||
|
HDRRT,
|
||||||
|
U16RT,
|
||||||
|
U32RT,
|
||||||
|
DepthStencil,
|
||||||
|
PrimIDTexture,
|
||||||
|
RWTexture,
|
||||||
|
CLUTTexture,
|
||||||
|
Texture,
|
||||||
|
ReplacementTexture,
|
||||||
|
Other,
|
||||||
|
Last = Other,
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::array<u32, static_cast<u32>(TextureLabel::Last) + 1> s_texture_counts;
|
||||||
|
|
||||||
|
static TextureLabel GetTextureLabel(GSTexture::Type type, GSTexture::Format format)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case GSTexture::Type::RenderTarget:
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case GSTexture::Format::Color:
|
||||||
|
return TextureLabel::ColorRT;
|
||||||
|
case GSTexture::Format::HDRColor:
|
||||||
|
return TextureLabel::HDRRT;
|
||||||
|
case GSTexture::Format::UInt16:
|
||||||
|
return TextureLabel::U16RT;
|
||||||
|
case GSTexture::Format::UInt32:
|
||||||
|
return TextureLabel::U32RT;
|
||||||
|
case GSTexture::Format::PrimID:
|
||||||
|
return TextureLabel::PrimIDTexture;
|
||||||
|
default:
|
||||||
|
return TextureLabel::Other;
|
||||||
|
}
|
||||||
|
case GSTexture::Type::Texture:
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case GSTexture::Format::Color:
|
||||||
|
return TextureLabel::Texture;
|
||||||
|
case GSTexture::Format::UNorm8:
|
||||||
|
return TextureLabel::CLUTTexture;
|
||||||
|
case GSTexture::Format::BC1:
|
||||||
|
case GSTexture::Format::BC2:
|
||||||
|
case GSTexture::Format::BC3:
|
||||||
|
case GSTexture::Format::BC7:
|
||||||
|
return TextureLabel::ReplacementTexture;
|
||||||
|
default:
|
||||||
|
return TextureLabel::Other;
|
||||||
|
}
|
||||||
|
case GSTexture::Type::DepthStencil:
|
||||||
|
return TextureLabel::DepthStencil;
|
||||||
|
case GSTexture::Type::RWTexture:
|
||||||
|
return TextureLabel::RWTexture;
|
||||||
|
case GSTexture::Type::Invalid:
|
||||||
|
default:
|
||||||
|
return TextureLabel::Other;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char* TextureLabelString(TextureLabel label)
|
||||||
|
{
|
||||||
|
switch (label)
|
||||||
|
{
|
||||||
|
case TextureLabel::ColorRT:
|
||||||
|
return "Color RT";
|
||||||
|
case TextureLabel::HDRRT:
|
||||||
|
return "HDR RT";
|
||||||
|
case TextureLabel::U16RT:
|
||||||
|
return "U16 RT";
|
||||||
|
case TextureLabel::U32RT:
|
||||||
|
return "U32 RT";
|
||||||
|
case TextureLabel::DepthStencil:
|
||||||
|
return "Depth Stencil";
|
||||||
|
case TextureLabel::PrimIDTexture:
|
||||||
|
return "PrimID";
|
||||||
|
case TextureLabel::RWTexture:
|
||||||
|
return "RW Texture";
|
||||||
|
case TextureLabel::CLUTTexture:
|
||||||
|
return "CLUT Texture";
|
||||||
|
case TextureLabel::Texture:
|
||||||
|
return "Texture";
|
||||||
|
case TextureLabel::ReplacementTexture:
|
||||||
|
return "Replacement Texture";
|
||||||
|
case TextureLabel::Other:
|
||||||
|
default:
|
||||||
|
return "Unknown Texture";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
std::unique_ptr<GSDevice> g_gs_device;
|
std::unique_ptr<GSDevice> g_gs_device;
|
||||||
|
|
||||||
GSDevice::GSDevice() = default;
|
GSDevice::GSDevice()
|
||||||
|
{
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
s_texture_counts.fill(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
GSDevice::~GSDevice()
|
GSDevice::~GSDevice()
|
||||||
{
|
{
|
||||||
|
@ -327,6 +430,15 @@ GSTexture* GSDevice::FetchSurface(GSTexture::Type type, int width, int height, i
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
if (GSConfig.UseDebugDevice)
|
||||||
|
{
|
||||||
|
const TextureLabel label = GetTextureLabel(type, format);
|
||||||
|
const u32 id = ++s_texture_counts[static_cast<u32>(label)];
|
||||||
|
t->SetDebugName(TinyString::from_fmt("{} {}", TextureLabelString(label), id));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
GSTexture::GSTexture() = default;
|
GSTexture::GSTexture() = default;
|
||||||
|
|
||||||
|
GSTexture::~GSTexture() = default;
|
||||||
|
|
||||||
bool GSTexture::Save(const std::string& fn)
|
bool GSTexture::Save(const std::string& fn)
|
||||||
{
|
{
|
||||||
// Depth textures need special treatment - we have a stencil component.
|
// Depth textures need special treatment - we have a stencil component.
|
||||||
|
@ -62,6 +64,25 @@ bool GSTexture::Save(const std::string& fn)
|
||||||
return GSPng::Save(format, fn, dl->GetMapPointer(), m_size.x, m_size.y, dl->GetMapPitch(), compression, g_gs_device->IsRBSwapped());
|
return GSPng::Save(format, fn, dl->GetMapPointer(), m_size.x, m_size.y, dl->GetMapPitch(), compression, g_gs_device->IsRBSwapped());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* GSTexture::GetFormatName(Format format)
|
||||||
|
{
|
||||||
|
static constexpr const char* format_names[] = {
|
||||||
|
"Invalid",
|
||||||
|
"Color",
|
||||||
|
"HDRColor",
|
||||||
|
"DepthStencil",
|
||||||
|
"UNorm8",
|
||||||
|
"UInt16",
|
||||||
|
"UInt32",
|
||||||
|
"PrimID",
|
||||||
|
"BC1",
|
||||||
|
"BC2",
|
||||||
|
"BC3",
|
||||||
|
"BC7",
|
||||||
|
};
|
||||||
|
return format_names[(static_cast<u32>(format) < std::size(format_names)) ? static_cast<u32>(format) : 0];
|
||||||
|
}
|
||||||
|
|
||||||
u32 GSTexture::GetCompressedBytesPerBlock() const
|
u32 GSTexture::GetCompressedBytesPerBlock() const
|
||||||
{
|
{
|
||||||
return GetCompressedBytesPerBlock(m_format);
|
return GetCompressedBytesPerBlock(m_format);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "GS/GSVector.h"
|
#include "GS/GSVector.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
class GSTexture
|
class GSTexture
|
||||||
{
|
{
|
||||||
|
@ -70,15 +71,19 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSTexture();
|
GSTexture();
|
||||||
virtual ~GSTexture() {}
|
virtual ~GSTexture();
|
||||||
|
|
||||||
// Returns the native handle of a texture.
|
// Returns the native handle of a texture.
|
||||||
virtual void* GetNativeHandle() const = 0;
|
virtual void* GetNativeHandle() const = 0;
|
||||||
|
|
||||||
virtual bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0) = 0;
|
virtual bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0) = 0;
|
||||||
virtual bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) = 0;
|
virtual bool Map(GSMap& m, const GSVector4i* r = nullptr, int layer = 0) = 0;
|
||||||
virtual void Unmap() = 0;
|
virtual void Unmap() = 0;
|
||||||
virtual void GenerateMipmap() {}
|
virtual void GenerateMipmap() = 0;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
virtual void SetDebugName(std::string_view name) = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool Save(const std::string& fn);
|
bool Save(const std::string& fn);
|
||||||
|
|
||||||
|
@ -94,6 +99,7 @@ public:
|
||||||
__fi Format GetFormat() const { return m_format; }
|
__fi Format GetFormat() const { return m_format; }
|
||||||
__fi bool IsCompressedFormat() const { return IsCompressedFormat(m_format); }
|
__fi bool IsCompressedFormat() const { return IsCompressedFormat(m_format); }
|
||||||
|
|
||||||
|
static const char* GetFormatName(Format format);
|
||||||
static u32 GetCompressedBytesPerBlock(Format format);
|
static u32 GetCompressedBytesPerBlock(Format format);
|
||||||
static u32 GetCompressedBlockSize(Format format);
|
static u32 GetCompressedBlockSize(Format format);
|
||||||
static u32 CalcUploadPitch(Format format, u32 width);
|
static u32 CalcUploadPitch(Format format, u32 width);
|
||||||
|
@ -197,6 +203,11 @@ public:
|
||||||
/// call to CopyFromTexture() and the Flush() call.
|
/// call to CopyFromTexture() and the Flush() call.
|
||||||
virtual void Flush() = 0;
|
virtual void Flush() = 0;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
/// Sets object name that will be displayed in graphics debuggers.
|
||||||
|
virtual void SetDebugName(std::string_view name) = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Reads the specified rectangle from the staging texture to out_ptr, with the specified stride
|
/// Reads the specified rectangle from the staging texture to out_ptr, with the specified stride
|
||||||
/// (length in bytes of each row). CopyFromTexture() must be called first. The contents of any
|
/// (length in bytes of each row). CopyFromTexture() must be called first. The contents of any
|
||||||
/// texels outside of the rectangle used for CopyFromTexture is undefined.
|
/// texels outside of the rectangle used for CopyFromTexture is undefined.
|
||||||
|
|
|
@ -60,6 +60,21 @@ GSDevice11::GSDevice11()
|
||||||
|
|
||||||
GSDevice11::~GSDevice11() = default;
|
GSDevice11::~GSDevice11() = default;
|
||||||
|
|
||||||
|
void GSDevice11::SetD3DDebugObjectName(ID3D11DeviceChild* obj, std::string_view name)
|
||||||
|
{
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
// WKPDID_D3DDebugObjectName
|
||||||
|
static constexpr GUID guid = {0x429b8c22, 0x9188, 0x4b0c, {0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00}};
|
||||||
|
|
||||||
|
UINT existing_data_size;
|
||||||
|
HRESULT hr = obj->GetPrivateData(guid, &existing_data_size, nullptr);
|
||||||
|
if (SUCCEEDED(hr) && existing_data_size > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
obj->SetPrivateData(guid, static_cast<UINT>(name.length()), name.data());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
RenderAPI GSDevice11::GetRenderAPI() const
|
RenderAPI GSDevice11::GetRenderAPI() const
|
||||||
{
|
{
|
||||||
return RenderAPI::D3D11;
|
return RenderAPI::D3D11;
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
#include "GS/GSVector.h"
|
#include "GS/GSVector.h"
|
||||||
#include "GS/Renderers/Common/GSDevice.h"
|
#include "GS/Renderers/Common/GSDevice.h"
|
||||||
#include "GS/Renderers/DX11/D3D11ShaderCache.h"
|
#include "GS/Renderers/DX11/D3D11ShaderCache.h"
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <wil/com.h>
|
#include <wil/com.h>
|
||||||
#include <dxgi1_5.h>
|
#include <dxgi1_5.h>
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
|
@ -265,6 +268,8 @@ public:
|
||||||
GSDevice11();
|
GSDevice11();
|
||||||
~GSDevice11() override;
|
~GSDevice11() override;
|
||||||
|
|
||||||
|
static void SetD3DDebugObjectName(ID3D11DeviceChild* obj, std::string_view name);
|
||||||
|
|
||||||
__fi static GSDevice11* GetInstance() { return static_cast<GSDevice11*>(g_gs_device.get()); }
|
__fi static GSDevice11* GetInstance() { return static_cast<GSDevice11*>(g_gs_device.get()); }
|
||||||
__fi ID3D11Device1* GetD3DDevice() const { return m_dev.get(); }
|
__fi ID3D11Device1* GetD3DDevice() const { return m_dev.get(); }
|
||||||
__fi ID3D11DeviceContext1* GetD3DContext() const { return m_ctx.get(); }
|
__fi ID3D11DeviceContext1* GetD3DContext() const { return m_ctx.get(); }
|
||||||
|
|
|
@ -5,9 +5,12 @@
|
||||||
#include "GSTexture11.h"
|
#include "GSTexture11.h"
|
||||||
#include "GS/GSPng.h"
|
#include "GS/GSPng.h"
|
||||||
#include "GS/GSPerfMon.h"
|
#include "GS/GSPerfMon.h"
|
||||||
|
|
||||||
#include "common/Console.h"
|
#include "common/Console.h"
|
||||||
#include "common/BitUtils.h"
|
#include "common/BitUtils.h"
|
||||||
|
|
||||||
|
#include "fmt/format.h"
|
||||||
|
|
||||||
GSTexture11::GSTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> texture, const D3D11_TEXTURE2D_DESC& desc,
|
GSTexture11::GSTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> texture, const D3D11_TEXTURE2D_DESC& desc,
|
||||||
GSTexture::Type type, GSTexture::Format format)
|
GSTexture::Type type, GSTexture::Format format)
|
||||||
: m_texture(std::move(texture))
|
: m_texture(std::move(texture))
|
||||||
|
@ -85,6 +88,22 @@ void GSTexture11::GenerateMipmap()
|
||||||
GSDevice11::GetInstance()->GetD3DContext()->GenerateMips(operator ID3D11ShaderResourceView*());
|
GSDevice11::GetInstance()->GetD3DContext()->GenerateMips(operator ID3D11ShaderResourceView*());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSTexture11::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
GSDevice11::SetD3DDebugObjectName(m_texture.get(), name);
|
||||||
|
if (m_srv)
|
||||||
|
GSDevice11::SetD3DDebugObjectName(m_srv.get(), fmt::format("{} SRV", name));
|
||||||
|
if (m_rtv)
|
||||||
|
GSDevice11::SetD3DDebugObjectName(m_srv.get(), fmt::format("{} RTV", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
GSTexture11::operator ID3D11Texture2D*()
|
GSTexture11::operator ID3D11Texture2D*()
|
||||||
{
|
{
|
||||||
return m_texture.get();
|
return m_texture.get();
|
||||||
|
@ -258,3 +277,15 @@ void GSDownloadTexture11::Flush()
|
||||||
|
|
||||||
// Handled when mapped.
|
// Handled when mapped.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSDownloadTexture11::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
GSDevice11::SetD3DDebugObjectName(m_texture.get(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -33,6 +33,10 @@ public:
|
||||||
void Unmap() override;
|
void Unmap() override;
|
||||||
void GenerateMipmap() override;
|
void GenerateMipmap() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
operator ID3D11Texture2D*();
|
operator ID3D11Texture2D*();
|
||||||
operator ID3D11ShaderResourceView*();
|
operator ID3D11ShaderResourceView*();
|
||||||
operator ID3D11RenderTargetView*();
|
operator ID3D11RenderTargetView*();
|
||||||
|
@ -55,6 +59,10 @@ public:
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GSDownloadTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> tex, u32 width, u32 height, GSTexture::Format format);
|
GSDownloadTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> tex, u32 width, u32 height, GSTexture::Format format);
|
||||||
|
|
||||||
|
|
|
@ -354,20 +354,12 @@ u32 D3D12::RootSignatureBuilder::AddDescriptorTable(
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef PCSX2_DEVBUILD
|
||||||
#include "common/StringUtil.h"
|
#include "common/StringUtil.h"
|
||||||
|
|
||||||
void D3D12::SetObjectName(ID3D12Object* object, const char* name)
|
void D3D12::SetObjectName(ID3D12Object* object, std::string_view name)
|
||||||
{
|
{
|
||||||
object->SetName(StringUtil::UTF8StringToWideString(name).c_str());
|
object->SetName(StringUtil::UTF8StringToWideString(name).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3D12::SetObjectNameFormatted(ID3D12Object* object, const char* format, ...)
|
|
||||||
{
|
|
||||||
std::va_list ap;
|
|
||||||
va_start(ap, format);
|
|
||||||
SetObjectName(object, StringUtil::StdStringFromFormatV(format, ap).c_str());
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
class D3D12ShaderCache;
|
class D3D12ShaderCache;
|
||||||
|
|
||||||
|
@ -130,15 +131,9 @@ namespace D3D12
|
||||||
D3D12_COMPUTE_PIPELINE_STATE_DESC m_desc;
|
D3D12_COMPUTE_PIPELINE_STATE_DESC m_desc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef PCSX2_DEVBUILD
|
||||||
void SetObjectName(ID3D12Object* object, const char* name);
|
void SetObjectName(ID3D12Object* object, std::string_view name);
|
||||||
void SetObjectNameFormatted(ID3D12Object* object, const char* format, ...);
|
|
||||||
#else
|
#else
|
||||||
static inline void SetObjectName(ID3D12Object* object, const char* name)
|
static inline void SetObjectName(ID3D12Object* object, std::string_view name) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
static inline void SetObjectNameFormatted(ID3D12Object* object, const char* format, ...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
} // namespace D3D12
|
} // namespace D3D12
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "common/BitUtils.h"
|
#include "common/BitUtils.h"
|
||||||
#include "common/HostSys.h"
|
#include "common/HostSys.h"
|
||||||
#include "common/ScopedGuard.h"
|
#include "common/ScopedGuard.h"
|
||||||
|
#include "common/SmallString.h"
|
||||||
#include "common/StringUtil.h"
|
#include "common/StringUtil.h"
|
||||||
|
|
||||||
#include "D3D12MemAlloc.h"
|
#include "D3D12MemAlloc.h"
|
||||||
|
@ -2438,7 +2439,7 @@ bool GSDevice12::CompileConvertPipelines()
|
||||||
if (!m_convert[index])
|
if (!m_convert[index])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
D3D12::SetObjectNameFormatted(m_convert[index].get(), "Convert pipeline %d", i);
|
D3D12::SetObjectName(m_convert[index].get(), TinyString::from_fmt("Convert pipeline {}", static_cast<int>(i)));
|
||||||
|
|
||||||
if (i == ShaderConvert::COPY)
|
if (i == ShaderConvert::COPY)
|
||||||
{
|
{
|
||||||
|
@ -2454,8 +2455,8 @@ bool GSDevice12::CompileConvertPipelines()
|
||||||
if (!m_color_copy[i])
|
if (!m_color_copy[i])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
D3D12::SetObjectNameFormatted(m_color_copy[i].get(), "Color copy pipeline (r=%u, g=%u, b=%u, a=%u)",
|
D3D12::SetObjectName(m_color_copy[i].get(), TinyString::from_fmt("Color copy pipeline (r={}, g={}, b={}, a={})",
|
||||||
i & 1u, (i >> 1) & 1u, (i >> 2) & 1u, (i >> 3) & 1u);
|
i & 1u, (i >> 1) & 1u, (i >> 2) & 1u, (i >> 3) & 1u));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i == ShaderConvert::HDR_INIT || i == ShaderConvert::HDR_RESOLVE)
|
else if (i == ShaderConvert::HDR_INIT || i == ShaderConvert::HDR_RESOLVE)
|
||||||
|
@ -2472,8 +2473,7 @@ bool GSDevice12::CompileConvertPipelines()
|
||||||
if (!arr[ds])
|
if (!arr[ds])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
D3D12::SetObjectNameFormatted(
|
D3D12::SetObjectName(arr[ds].get(), TinyString::from_fmt("HDR {}/copy pipeline (ds={})", is_setup ? "setup" : "finish", ds));
|
||||||
arr[ds].get(), "HDR %s/copy pipeline (ds=%u)", is_setup ? "setup" : "finish", ds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2500,8 +2500,8 @@ bool GSDevice12::CompileConvertPipelines()
|
||||||
if (!m_date_image_setup_pipelines[ds][datm])
|
if (!m_date_image_setup_pipelines[ds][datm])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
D3D12::SetObjectNameFormatted(
|
D3D12::SetObjectName(m_date_image_setup_pipelines[ds][datm].get(),
|
||||||
m_date_image_setup_pipelines[ds][datm].get(), "DATE image clear pipeline (ds=%u, datm=%u)", ds, datm);
|
TinyString::from_fmt("DATE image clear pipeline (ds={}, datm={})", ds, datm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2546,7 +2546,7 @@ bool GSDevice12::CompilePresentPipelines()
|
||||||
if (!m_present[index])
|
if (!m_present[index])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
D3D12::SetObjectNameFormatted(m_present[index].get(), "Present pipeline %d", i);
|
D3D12::SetObjectName(m_present[index].get(), TinyString::from_fmt("Present pipeline {}", static_cast<int>(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2582,7 +2582,7 @@ bool GSDevice12::CompileInterlacePipelines()
|
||||||
if (!m_interlace[i])
|
if (!m_interlace[i])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
D3D12::SetObjectNameFormatted(m_convert[i].get(), "Interlace pipeline %d", i);
|
D3D12::SetObjectName(m_convert[i].get(), TinyString::from_fmt("Interlace pipeline {}", static_cast<int>(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2619,7 +2619,7 @@ bool GSDevice12::CompileMergePipelines()
|
||||||
if (!m_merge[i])
|
if (!m_merge[i])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
D3D12::SetObjectNameFormatted(m_convert[i].get(), "Merge pipeline %d", i);
|
D3D12::SetObjectName(m_convert[i].get(), TinyString::from_fmt("Merge pipeline {}", i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2946,8 +2946,8 @@ GSDevice12::ComPtr<ID3D12PipelineState> GSDevice12::CreateTFXPipeline(const Pipe
|
||||||
ComPtr<ID3D12PipelineState> pipeline(gpb.Create(m_device.get(), m_shader_cache));
|
ComPtr<ID3D12PipelineState> pipeline(gpb.Create(m_device.get(), m_shader_cache));
|
||||||
if (pipeline)
|
if (pipeline)
|
||||||
{
|
{
|
||||||
D3D12::SetObjectNameFormatted(
|
D3D12::SetObjectName(
|
||||||
pipeline.get(), "TFX Pipeline %08X/%" PRIX64 "%08X", p.vs.key, p.ps.key_hi, p.ps.key_lo);
|
pipeline.get(), TinyString::from_fmt("TFX Pipeline {:08X}/{:08X}{:016X}", p.vs.key, p.ps.key_hi, p.ps.key_lo));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|
|
@ -190,15 +190,8 @@ std::unique_ptr<GSTexture12> GSTexture12::Create(Type type, Format format, int w
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case Type::Texture:
|
|
||||||
{
|
|
||||||
D3D12::SetObjectNameFormatted(resource.get(), "%dx%d texture", width, height);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Type::RenderTarget:
|
case Type::RenderTarget:
|
||||||
{
|
{
|
||||||
D3D12::SetObjectNameFormatted(resource.get(), "%dx%d render target", width, height);
|
|
||||||
write_descriptor_type = WriteDescriptorType::RTV;
|
write_descriptor_type = WriteDescriptorType::RTV;
|
||||||
if (!CreateRTVDescriptor(resource.get(), rtv_format, &write_descriptor))
|
if (!CreateRTVDescriptor(resource.get(), rtv_format, &write_descriptor))
|
||||||
{
|
{
|
||||||
|
@ -210,7 +203,6 @@ std::unique_ptr<GSTexture12> GSTexture12::Create(Type type, Format format, int w
|
||||||
|
|
||||||
case Type::DepthStencil:
|
case Type::DepthStencil:
|
||||||
{
|
{
|
||||||
D3D12::SetObjectNameFormatted(resource.get(), "%dx%d depth stencil", width, height);
|
|
||||||
write_descriptor_type = WriteDescriptorType::DSV;
|
write_descriptor_type = WriteDescriptorType::DSV;
|
||||||
if (!CreateDSVDescriptor(resource.get(), dsv_format, &write_descriptor))
|
if (!CreateDSVDescriptor(resource.get(), dsv_format, &write_descriptor))
|
||||||
{
|
{
|
||||||
|
@ -220,12 +212,6 @@ std::unique_ptr<GSTexture12> GSTexture12::Create(Type type, Format format, int w
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type::RWTexture:
|
|
||||||
{
|
|
||||||
D3D12::SetObjectNameFormatted(resource.get(), "%dx%d RW texture", width, height);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -601,6 +587,18 @@ void GSTexture12::GenerateMipmap()
|
||||||
SetUseFenceCounter(GSDevice12::GetInstance()->GetCurrentFenceValue());
|
SetUseFenceCounter(GSDevice12::GetInstance()->GetCurrentFenceValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSTexture12::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
D3D12::SetObjectName(m_resource.get(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void GSTexture12::TransitionToState(D3D12_RESOURCE_STATES state)
|
void GSTexture12::TransitionToState(D3D12_RESOURCE_STATES state)
|
||||||
{
|
{
|
||||||
TransitionToState(GSDevice12::GetInstance()->GetCommandList(), state);
|
TransitionToState(GSDevice12::GetInstance()->GetCommandList(), state);
|
||||||
|
@ -800,3 +798,15 @@ void GSDownloadTexture12::Flush()
|
||||||
else
|
else
|
||||||
dev->WaitForFence(m_copy_fence_value, GSConfig.HWSpinGPUForReadbacks);
|
dev->WaitForFence(m_copy_fence_value, GSConfig.HWSpinGPUForReadbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSDownloadTexture12::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
D3D12::SetObjectName(m_buffer.get(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -42,6 +42,10 @@ public:
|
||||||
void Unmap() override;
|
void Unmap() override;
|
||||||
void GenerateMipmap() override;
|
void GenerateMipmap() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
void TransitionToState(D3D12_RESOURCE_STATES state);
|
void TransitionToState(D3D12_RESOURCE_STATES state);
|
||||||
void CommitClear();
|
void CommitClear();
|
||||||
void CommitClear(ID3D12GraphicsCommandList* cmdlist);
|
void CommitClear(ID3D12GraphicsCommandList* cmdlist);
|
||||||
|
@ -112,6 +116,10 @@ public:
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GSDownloadTexture12(u32 width, u32 height, GSTexture::Format format);
|
GSDownloadTexture12(u32 width, u32 height, GSTexture::Format format);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "common/Console.h"
|
#include "common/Console.h"
|
||||||
#include "common/BitUtils.h"
|
#include "common/BitUtils.h"
|
||||||
#include "common/HashCombine.h"
|
#include "common/HashCombine.h"
|
||||||
|
#include "common/SmallString.h"
|
||||||
|
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
||||||
|
@ -2781,6 +2782,11 @@ bool GSTextureCache::PrepareDownloadTexture(u32 width, u32 height, GSTexture::Fo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
(*tex)->SetDebugName(TinyString::from_fmt("Texture Cache {}x{} {} Readback",
|
||||||
|
new_width, new_height, GSTexture::GetFormatName(format)));
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,24 +321,6 @@ public:
|
||||||
std::vector<DebugEntry> m_debug_entries;
|
std::vector<DebugEntry> m_debug_entries;
|
||||||
u32 m_debug_group_level = 0;
|
u32 m_debug_group_level = 0;
|
||||||
|
|
||||||
enum class TextureLabel
|
|
||||||
{
|
|
||||||
ColorRT,
|
|
||||||
HDRRT,
|
|
||||||
U16RT,
|
|
||||||
U32RT,
|
|
||||||
DepthStencil,
|
|
||||||
PrimIDTexture,
|
|
||||||
RWTexture,
|
|
||||||
Unorm8Texture,
|
|
||||||
Texture,
|
|
||||||
ReplacementTexture,
|
|
||||||
Other,
|
|
||||||
Last = Other,
|
|
||||||
};
|
|
||||||
u32 m_texture_counts[static_cast<u32>(TextureLabel::Last) + 1] = {};
|
|
||||||
u32 m_dl_texture_count = 0;
|
|
||||||
|
|
||||||
GSDeviceMTL();
|
GSDeviceMTL();
|
||||||
~GSDeviceMTL() override;
|
~GSDeviceMTL() override;
|
||||||
|
|
||||||
|
|
|
@ -500,74 +500,6 @@ static constexpr MTLPixelFormat ConvertPixelFormat(GSTexture::Format format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSDeviceMTL::TextureLabel GetTextureLabel(GSTexture::Type type, GSTexture::Format format)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case GSTexture::Type::RenderTarget:
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case GSTexture::Format::Color: return GSDeviceMTL::TextureLabel::ColorRT;
|
|
||||||
case GSTexture::Format::HDRColor: return GSDeviceMTL::TextureLabel::HDRRT;
|
|
||||||
case GSTexture::Format::UInt16: return GSDeviceMTL::TextureLabel::U16RT;
|
|
||||||
case GSTexture::Format::UInt32: return GSDeviceMTL::TextureLabel::U32RT;
|
|
||||||
case GSTexture::Format::PrimID: return GSDeviceMTL::TextureLabel::PrimIDTexture;
|
|
||||||
case GSTexture::Format::Invalid:
|
|
||||||
case GSTexture::Format::DepthStencil:
|
|
||||||
case GSTexture::Format::UNorm8:
|
|
||||||
case GSTexture::Format::BC1:
|
|
||||||
case GSTexture::Format::BC2:
|
|
||||||
case GSTexture::Format::BC3:
|
|
||||||
case GSTexture::Format::BC7:
|
|
||||||
return GSDeviceMTL::TextureLabel::Other;
|
|
||||||
}
|
|
||||||
case GSTexture::Type::Texture:
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case GSTexture::Format::Color:
|
|
||||||
return GSDeviceMTL::TextureLabel::Texture;
|
|
||||||
case GSTexture::Format::UNorm8:
|
|
||||||
return GSDeviceMTL::TextureLabel::Unorm8Texture;
|
|
||||||
case GSTexture::Format::BC1:
|
|
||||||
case GSTexture::Format::BC2:
|
|
||||||
case GSTexture::Format::BC3:
|
|
||||||
case GSTexture::Format::BC7:
|
|
||||||
return GSDeviceMTL::TextureLabel::ReplacementTexture;
|
|
||||||
case GSTexture::Format::Invalid:
|
|
||||||
case GSTexture::Format::HDRColor:
|
|
||||||
case GSTexture::Format::DepthStencil:
|
|
||||||
case GSTexture::Format::UInt16:
|
|
||||||
case GSTexture::Format::UInt32:
|
|
||||||
case GSTexture::Format::PrimID:
|
|
||||||
return GSDeviceMTL::TextureLabel::Other;
|
|
||||||
}
|
|
||||||
case GSTexture::Type::DepthStencil:
|
|
||||||
return GSDeviceMTL::TextureLabel::DepthStencil;
|
|
||||||
case GSTexture::Type::RWTexture:
|
|
||||||
return GSDeviceMTL::TextureLabel::RWTexture;
|
|
||||||
case GSTexture::Type::Invalid:
|
|
||||||
return GSDeviceMTL::TextureLabel::Other;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char* TextureLabelString(GSDeviceMTL::TextureLabel label)
|
|
||||||
{
|
|
||||||
switch (label)
|
|
||||||
{
|
|
||||||
case GSDeviceMTL::TextureLabel::ColorRT: return "Color RT";
|
|
||||||
case GSDeviceMTL::TextureLabel::HDRRT: return "HDR RT";
|
|
||||||
case GSDeviceMTL::TextureLabel::U16RT: return "U16 RT";
|
|
||||||
case GSDeviceMTL::TextureLabel::U32RT: return "U32 RT";
|
|
||||||
case GSDeviceMTL::TextureLabel::DepthStencil: return "Depth Stencil";
|
|
||||||
case GSDeviceMTL::TextureLabel::PrimIDTexture: return "PrimID";
|
|
||||||
case GSDeviceMTL::TextureLabel::RWTexture: return "RW Texture";
|
|
||||||
case GSDeviceMTL::TextureLabel::Unorm8Texture: return "Unorm8 Texture";
|
|
||||||
case GSDeviceMTL::TextureLabel::Texture: return "Texture";
|
|
||||||
case GSDeviceMTL::TextureLabel::ReplacementTexture: return "Replacement Texture";
|
|
||||||
case GSDeviceMTL::TextureLabel::Other: return "Unknown Texture";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GSTexture* GSDeviceMTL::CreateSurface(GSTexture::Type type, int width, int height, int levels, GSTexture::Format format)
|
GSTexture* GSDeviceMTL::CreateSurface(GSTexture::Type type, int width, int height, int levels, GSTexture::Format format)
|
||||||
{ @autoreleasepool {
|
{ @autoreleasepool {
|
||||||
MTLPixelFormat fmt = ConvertPixelFormat(format);
|
MTLPixelFormat fmt = ConvertPixelFormat(format);
|
||||||
|
@ -604,8 +536,6 @@ GSTexture* GSDeviceMTL::CreateSurface(GSTexture::Type type, int width, int heigh
|
||||||
MRCOwned<id<MTLTexture>> tex = MRCTransfer([m_dev.dev newTextureWithDescriptor:desc]);
|
MRCOwned<id<MTLTexture>> tex = MRCTransfer([m_dev.dev newTextureWithDescriptor:desc]);
|
||||||
if (tex)
|
if (tex)
|
||||||
{
|
{
|
||||||
TextureLabel label = GetTextureLabel(type, format);
|
|
||||||
[tex setLabel:[NSString stringWithFormat:@"%s %d", TextureLabelString(label), m_texture_counts[static_cast<u32>(label)]++]];
|
|
||||||
GSTextureMTL* t = new GSTextureMTL(this, tex, type, format);
|
GSTextureMTL* t = new GSTextureMTL(this, tex, type, format);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include "GS/Renderers/Common/GSTexture.h"
|
#include "GS/Renderers/Common/GSTexture.h"
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#ifndef __OBJC__
|
#ifndef __OBJC__
|
||||||
#error "This header is for use with Objective-C++ only.
|
#error "This header is for use with Objective-C++ only.
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,6 +42,10 @@ public:
|
||||||
void Unmap() override;
|
void Unmap() override;
|
||||||
void GenerateMipmap() override;
|
void GenerateMipmap() override;
|
||||||
id<MTLTexture> GetTexture() { return m_texture; }
|
id<MTLTexture> GetTexture() { return m_texture; }
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class GSDownloadTextureMTL final : public GSDownloadTexture
|
class GSDownloadTextureMTL final : public GSDownloadTexture
|
||||||
|
@ -56,6 +62,10 @@ public:
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GSDownloadTextureMTL(GSDeviceMTL* dev, MRCOwned<id<MTLBuffer>> buffer, u32 width, u32 height, GSTexture::Format format);
|
GSDownloadTextureMTL(GSDeviceMTL* dev, MRCOwned<id<MTLBuffer>> buffer, u32 width, u32 height, GSTexture::Format format);
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,24 @@ void GSTextureMTL::GenerateMipmap()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSTextureMTL::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
@autoreleasepool {
|
||||||
|
NSString* label = [[[NSString alloc] autorelease]
|
||||||
|
initWithBytes:name.data()
|
||||||
|
length:static_cast<NSUInteger>(name.length())
|
||||||
|
encoding:NSUTF8StringEncoding];
|
||||||
|
[m_texture setLabel:label];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
GSDownloadTextureMTL::GSDownloadTextureMTL(GSDeviceMTL* dev, MRCOwned<id<MTLBuffer>> buffer,
|
GSDownloadTextureMTL::GSDownloadTextureMTL(GSDeviceMTL* dev, MRCOwned<id<MTLBuffer>> buffer,
|
||||||
u32 width, u32 height, GSTexture::Format format)
|
u32 width, u32 height, GSTexture::Format format)
|
||||||
: GSDownloadTexture(width, height, format)
|
: GSDownloadTexture(width, height, format)
|
||||||
|
@ -150,7 +168,6 @@ std::unique_ptr<GSDownloadTextureMTL> GSDownloadTextureMTL::Create(GSDeviceMTL*
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
[buffer setLabel:[NSString stringWithFormat:@"Download Texture %d", dev->m_dl_texture_count++]];
|
|
||||||
return std::unique_ptr<GSDownloadTextureMTL>(new GSDownloadTextureMTL(dev, buffer, width, height, format));
|
return std::unique_ptr<GSDownloadTextureMTL>(new GSDownloadTextureMTL(dev, buffer, width, height, format));
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -244,4 +261,22 @@ void GSDownloadTextureMTL::Flush()
|
||||||
m_copy_cmdbuffer = nil;
|
m_copy_cmdbuffer = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSDownloadTextureMTL::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
@autoreleasepool {
|
||||||
|
NSString* label = [[[NSString alloc] autorelease]
|
||||||
|
initWithBytes:name.data()
|
||||||
|
length:static_cast<NSUInteger>(name.length())
|
||||||
|
encoding:NSUTF8StringEncoding];
|
||||||
|
[m_buffer setLabel:label];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -316,6 +316,19 @@ void GSTextureOGL::GenerateMipmap()
|
||||||
glGenerateTextureMipmap(m_texture_id);
|
glGenerateTextureMipmap(m_texture_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSTextureOGL::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (glObjectLabel)
|
||||||
|
glObjectLabel(GL_TEXTURE, m_texture_id, static_cast<GLsizei>(name.length()), static_cast<const GLchar*>(name.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
GSDownloadTextureOGL::GSDownloadTextureOGL(u32 width, u32 height, GSTexture::Format format)
|
GSDownloadTextureOGL::GSDownloadTextureOGL(u32 width, u32 height, GSTexture::Format format)
|
||||||
: GSDownloadTexture(width, height, format)
|
: GSDownloadTexture(width, height, format)
|
||||||
{
|
{
|
||||||
|
@ -469,3 +482,16 @@ void GSDownloadTextureOGL::Flush()
|
||||||
glDeleteSync(m_sync);
|
glDeleteSync(m_sync);
|
||||||
m_sync = {};
|
m_sync = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSDownloadTextureOGL::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (glObjectLabel)
|
||||||
|
glObjectLabel(GL_BUFFER, m_buffer_id, name.length(), name.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -36,10 +36,14 @@ public:
|
||||||
|
|
||||||
void* GetNativeHandle() const override;
|
void* GetNativeHandle() const override;
|
||||||
|
|
||||||
bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0) final;
|
bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0) override;
|
||||||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) final;
|
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) override;
|
||||||
void Unmap() final;
|
void Unmap() override;
|
||||||
void GenerateMipmap() final;
|
void GenerateMipmap() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool IsIntegerFormat() const
|
bool IsIntegerFormat() const
|
||||||
{
|
{
|
||||||
|
@ -67,6 +71,10 @@ public:
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GSDownloadTextureOGL(u32 width, u32 height, GSTexture::Format format);
|
GSDownloadTextureOGL(u32 width, u32 height, GSTexture::Format format);
|
||||||
|
|
||||||
|
|
|
@ -165,28 +165,6 @@ std::unique_ptr<GSTextureVK> GSTextureVK::Create(Type type, Format format, int w
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case Type::Texture:
|
|
||||||
Vulkan::SetObjectName(GSDeviceVK::GetInstance()->GetDevice(), image, "%dx%d texture", width, height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Type::RenderTarget:
|
|
||||||
Vulkan::SetObjectName(GSDeviceVK::GetInstance()->GetDevice(), image, "%dx%d render target", width, height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Type::DepthStencil:
|
|
||||||
Vulkan::SetObjectName(GSDeviceVK::GetInstance()->GetDevice(), image, "%dx%d depth stencil", width, height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Type::RWTexture:
|
|
||||||
Vulkan::SetObjectName(GSDeviceVK::GetInstance()->GetDevice(), image, "%dx%d RW texture", width, height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::unique_ptr<GSTextureVK>(
|
return std::unique_ptr<GSTextureVK>(
|
||||||
new GSTextureVK(type, format, width, height, levels, image, allocation, view, vk_format));
|
new GSTextureVK(type, format, width, height, levels, image, allocation, view, vk_format));
|
||||||
}
|
}
|
||||||
|
@ -517,6 +495,19 @@ void GSTextureVK::GenerateMipmap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSTextureVK::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vulkan::SetObjectName(GSDeviceVK::GetInstance()->GetDevice(), m_image, "%.*s", static_cast<int>(name.size()), name.data());
|
||||||
|
Vulkan::SetObjectName(GSDeviceVK::GetInstance()->GetDevice(), m_view, "%.*s", static_cast<int>(name.size()), name.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void GSTextureVK::CommitClear()
|
void GSTextureVK::CommitClear()
|
||||||
{
|
{
|
||||||
if (m_state != GSTexture::State::Cleared)
|
if (m_state != GSTexture::State::Cleared)
|
||||||
|
@ -937,3 +928,15 @@ void GSDownloadTextureVK::Flush()
|
||||||
else
|
else
|
||||||
GSDeviceVK::GetInstance()->WaitForFenceCounter(m_copy_fence_counter);
|
GSDeviceVK::GetInstance()->WaitForFenceCounter(m_copy_fence_counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
|
void GSDownloadTextureVK::SetDebugName(std::string_view name)
|
||||||
|
{
|
||||||
|
if (name.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vulkan::SetObjectName(GSDeviceVK::GetInstance()->GetDevice(), m_buffer, "%.*s", static_cast<int>(name.size()), name.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -53,6 +53,10 @@ public:
|
||||||
void Unmap() override;
|
void Unmap() override;
|
||||||
void GenerateMipmap() override;
|
void GenerateMipmap() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
void TransitionToLayout(Layout layout);
|
void TransitionToLayout(Layout layout);
|
||||||
void CommitClear();
|
void CommitClear();
|
||||||
void CommitClear(VkCommandBuffer cmdbuf);
|
void CommitClear(VkCommandBuffer cmdbuf);
|
||||||
|
@ -117,6 +121,10 @@ public:
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
void SetDebugName(std::string_view name) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GSDownloadTextureVK(u32 width, u32 height, GSTexture::Format format);
|
GSDownloadTextureVK(u32 width, u32 height, GSTexture::Format format);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef PCSX2_DEVBUILD
|
||||||
#define ENABLE_VULKAN_DEBUG_OBJECTS 1
|
#define ENABLE_VULKAN_DEBUG_OBJECTS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue