mirror of https://github.com/PCSX2/pcsx2.git
GS/DX11: Use annotations for debug messages
This commit is contained in:
parent
e1d6dfc324
commit
d10621c201
|
@ -29,6 +29,7 @@
|
|||
#include <sstream>
|
||||
#include <VersionHelpers.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <dxgidebug.h>
|
||||
|
||||
static bool SupportsTextureFormat(ID3D11Device* dev, DXGI_FORMAT format)
|
||||
{
|
||||
|
@ -90,6 +91,8 @@ bool GSDevice11::Create()
|
|||
|
||||
m_dev = static_cast<ID3D11Device*>(g_host_display->GetDevice());
|
||||
m_ctx = static_cast<ID3D11DeviceContext*>(g_host_display->GetContext());
|
||||
if (GSConfig.UseDebugDevice)
|
||||
m_annotation = m_ctx.try_query<ID3DUserDefinedAnnotation>();
|
||||
level = m_dev->GetFeatureLevel();
|
||||
const bool support_feature_level_11_0 = (level >= D3D_FEATURE_LEVEL_11_0);
|
||||
|
||||
|
@ -451,6 +454,40 @@ void GSDevice11::ClearStencil(GSTexture* t, u8 c)
|
|||
m_ctx->ClearDepthStencilView(*(GSTexture11*)t, D3D11_CLEAR_STENCIL, 0, c);
|
||||
}
|
||||
|
||||
void GSDevice11::PushDebugGroup(const char* fmt, ...)
|
||||
{
|
||||
if (!m_annotation)
|
||||
return;
|
||||
|
||||
std::va_list ap;
|
||||
va_start(ap, fmt);
|
||||
std::string str(StringUtil::StdStringFromFormatV(fmt, ap));
|
||||
va_end(ap);
|
||||
|
||||
m_annotation->BeginEvent(StringUtil::UTF8StringToWideString(str).c_str());
|
||||
}
|
||||
|
||||
void GSDevice11::PopDebugGroup()
|
||||
{
|
||||
if (!m_annotation)
|
||||
return;
|
||||
|
||||
m_annotation->EndEvent();
|
||||
}
|
||||
|
||||
void GSDevice11::InsertDebugMessage(DebugMessageCategory category, const char* fmt, ...)
|
||||
{
|
||||
if (!m_annotation)
|
||||
return;
|
||||
|
||||
std::va_list ap;
|
||||
va_start(ap, fmt);
|
||||
std::string str(StringUtil::StdStringFromFormatV(fmt, ap));
|
||||
va_end(ap);
|
||||
|
||||
m_annotation->SetMarker(StringUtil::UTF8StringToWideString(str).c_str());
|
||||
}
|
||||
|
||||
GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int width, int height, int levels, GSTexture::Format format)
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC desc = {};
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <unordered_map>
|
||||
#include <wil/com.h>
|
||||
#include <dxgi1_3.h>
|
||||
#include <d3d11_1.h>
|
||||
|
||||
struct GSVertexShader11
|
||||
{
|
||||
|
@ -130,6 +131,7 @@ private:
|
|||
|
||||
wil::com_ptr_nothrow<ID3D11Device> m_dev;
|
||||
wil::com_ptr_nothrow<ID3D11DeviceContext> m_ctx;
|
||||
wil::com_ptr_nothrow<ID3DUserDefinedAnnotation> m_annotation;
|
||||
wil::com_ptr_nothrow<IDXGISwapChain1> m_swapchain;
|
||||
wil::com_ptr_nothrow<ID3D11Buffer> m_vb;
|
||||
wil::com_ptr_nothrow<ID3D11Buffer> m_ib;
|
||||
|
@ -257,6 +259,10 @@ public:
|
|||
void ClearDepth(GSTexture* t) override;
|
||||
void ClearStencil(GSTexture* t, u8 c) override;
|
||||
|
||||
void PushDebugGroup(const char* fmt, ...) override;
|
||||
void PopDebugGroup() override;
|
||||
void InsertDebugMessage(DebugMessageCategory category, const char* fmt, ...) override;
|
||||
|
||||
void CloneTexture(GSTexture* src, GSTexture** dest, const GSVector4i& rect);
|
||||
|
||||
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r, u32 destX, u32 destY) override;
|
||||
|
|
Loading…
Reference in New Issue