mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-21 13:15:57 +00:00
Add marker regions for self-hosted captures in GL
This commit is contained in:
@@ -4692,7 +4692,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(vector<EventUsage> eve
|
||||
if(details.texFmt == DXGI_FORMAT_UNKNOWN)
|
||||
return history;
|
||||
|
||||
MarkerRegion historyMarker(
|
||||
D3D11MarkerRegion historyMarker(
|
||||
StringFormat::Fmt("Doing PixelHistory on %llu, (%u,%u) %u, %u, %u over %u events", target, x,
|
||||
y, slice, mip, sampleIdx, (uint32_t)events.size()));
|
||||
|
||||
@@ -6435,12 +6435,12 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(vector<EventUsage> eve
|
||||
if(draw->flags & eDraw_Clear)
|
||||
continue;
|
||||
|
||||
MarkerRegion historyData(
|
||||
D3D11MarkerRegion historyData(
|
||||
StringFormat::Fmt("Fetching history data for %u: %s", draw->eventID, draw->name.c_str()));
|
||||
|
||||
if(prev != history[h].eventID)
|
||||
{
|
||||
MarkerRegion predraw("fetching pre-draw");
|
||||
D3D11MarkerRegion predraw("fetching pre-draw");
|
||||
|
||||
m_WrappedDevice->ReplayLog(0, history[h].eventID, eReplay_WithoutDraw);
|
||||
prev = history[h].eventID;
|
||||
@@ -6574,7 +6574,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(vector<EventUsage> eve
|
||||
// if we're not the last modification in our event, need to fetch post fragment value
|
||||
if(h + 1 < history.size() && history[h].eventID == history[h + 1].eventID)
|
||||
{
|
||||
MarkerRegion middraw("fetching mid-draw");
|
||||
D3D11MarkerRegion middraw("fetching mid-draw");
|
||||
|
||||
m_pImmediateContext->OMSetRenderTargets(rtIndex + 1, RTVs, shaddepthOutputDSV);
|
||||
|
||||
@@ -6598,7 +6598,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(vector<EventUsage> eve
|
||||
|
||||
// fetch shader output value
|
||||
{
|
||||
MarkerRegion shadout("fetching shader-out");
|
||||
D3D11MarkerRegion shadout("fetching shader-out");
|
||||
|
||||
ID3D11RenderTargetView *sparseRTVs[8] = {0};
|
||||
sparseRTVs[rtIndex] = shadOutputRTV;
|
||||
@@ -6620,7 +6620,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(vector<EventUsage> eve
|
||||
|
||||
// fetch primitive ID
|
||||
{
|
||||
MarkerRegion primid("fetching prim ID");
|
||||
D3D11MarkerRegion primid("fetching prim ID");
|
||||
|
||||
m_pImmediateContext->OMSetRenderTargets(1, &shadOutputRTV, shaddepthOutputDSV);
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include "serialise/serialiser.h"
|
||||
#include "serialise/string_utils.h"
|
||||
|
||||
WrappedID3D11Device *MarkerRegion::device;
|
||||
WrappedID3D11Device *D3D11MarkerRegion::device;
|
||||
|
||||
MarkerRegion::MarkerRegion(const std::string &marker)
|
||||
D3D11MarkerRegion::D3D11MarkerRegion(const std::string &marker)
|
||||
{
|
||||
if(device == NULL)
|
||||
return;
|
||||
@@ -43,7 +43,7 @@ MarkerRegion::MarkerRegion(const std::string &marker)
|
||||
annot->BeginEvent(StringFormat::UTF82Wide(marker).c_str());
|
||||
}
|
||||
|
||||
void MarkerRegion::Set(const std::string &marker)
|
||||
void D3D11MarkerRegion::Set(const std::string &marker)
|
||||
{
|
||||
if(device == NULL)
|
||||
return;
|
||||
@@ -54,7 +54,7 @@ void MarkerRegion::Set(const std::string &marker)
|
||||
annot->SetMarker(StringFormat::UTF82Wide(marker).c_str());
|
||||
}
|
||||
|
||||
MarkerRegion::~MarkerRegion()
|
||||
D3D11MarkerRegion::~D3D11MarkerRegion()
|
||||
{
|
||||
if(device == NULL)
|
||||
return;
|
||||
|
||||
@@ -38,10 +38,10 @@ class WrappedID3D11Device;
|
||||
struct D3D11RenderState;
|
||||
|
||||
// replay only class for handling marker regions
|
||||
struct MarkerRegion
|
||||
struct D3D11MarkerRegion
|
||||
{
|
||||
MarkerRegion(const std::string &marker);
|
||||
~MarkerRegion();
|
||||
D3D11MarkerRegion(const std::string &marker);
|
||||
~D3D11MarkerRegion();
|
||||
static void Set(const std::string &marker);
|
||||
|
||||
static WrappedID3D11Device *device;
|
||||
|
||||
@@ -364,7 +364,7 @@ WrappedID3D11Device::WrappedID3D11Device(ID3D11Device *realDevice, D3D11InitPara
|
||||
m_State = READING;
|
||||
m_pSerialiser = NULL;
|
||||
|
||||
MarkerRegion::device = this;
|
||||
D3D11MarkerRegion::device = this;
|
||||
|
||||
string shaderSearchPathString = RenderDoc::Inst().GetConfigSetting("shader.debug.searchPaths");
|
||||
split(shaderSearchPathString, m_ShaderSearchPaths, ';');
|
||||
@@ -480,7 +480,7 @@ WrappedID3D11Device::~WrappedID3D11Device()
|
||||
if(m_pCurrentWrappedDevice == this)
|
||||
m_pCurrentWrappedDevice = NULL;
|
||||
|
||||
MarkerRegion::device = NULL;
|
||||
D3D11MarkerRegion::device = NULL;
|
||||
|
||||
RenderDoc::Inst().RemoveDeviceFrameCapturer((ID3D11Device *)this);
|
||||
|
||||
@@ -2459,7 +2459,7 @@ void WrappedID3D11Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
|
||||
|
||||
if(!partial)
|
||||
{
|
||||
MarkerRegion apply("ApplyInitialContents");
|
||||
D3D11MarkerRegion apply("ApplyInitialContents");
|
||||
GetResourceManager()->ApplyInitialContents();
|
||||
GetResourceManager()->ReleaseInFrameResources();
|
||||
}
|
||||
@@ -2468,20 +2468,20 @@ void WrappedID3D11Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
|
||||
|
||||
if(replayType == eReplay_Full)
|
||||
{
|
||||
MarkerRegion exec(
|
||||
D3D11MarkerRegion exec(
|
||||
StringFormat::Fmt("Replay: Full %u->%u (partial %u)", startEventID, endEventID, partial));
|
||||
m_pImmediateContext->ReplayLog(EXECUTING, startEventID, endEventID, partial);
|
||||
}
|
||||
else if(replayType == eReplay_WithoutDraw)
|
||||
{
|
||||
MarkerRegion exec(StringFormat::Fmt("Replay: W/O Draw %u->%u (partial %u)", startEventID,
|
||||
endEventID, partial));
|
||||
D3D11MarkerRegion exec(StringFormat::Fmt("Replay: W/O Draw %u->%u (partial %u)", startEventID,
|
||||
endEventID, partial));
|
||||
m_pImmediateContext->ReplayLog(EXECUTING, startEventID, RDCMAX(1U, endEventID) - 1, partial);
|
||||
}
|
||||
else if(replayType == eReplay_OnlyDraw)
|
||||
{
|
||||
MarkerRegion exec(StringFormat::Fmt("Replay: Draw Only %u->%u (partial %u)", startEventID,
|
||||
endEventID, partial));
|
||||
D3D11MarkerRegion exec(StringFormat::Fmt("Replay: Draw Only %u->%u (partial %u)", endEventID,
|
||||
endEventID, partial));
|
||||
m_pImmediateContext->ReplayLog(EXECUTING, endEventID, endEventID, partial);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -657,6 +657,33 @@ void DoVendorChecks(const GLHookSet &gl, GLPlatform &platform, GLWindowingData c
|
||||
VendorCheck[VendorCheck_AMD_vertex_array_elem_buffer_query] = true;
|
||||
}
|
||||
|
||||
const GLHookSet *GLMarkerRegion::gl;
|
||||
|
||||
GLMarkerRegion::GLMarkerRegion(const std::string &marker)
|
||||
{
|
||||
if(gl == NULL || !HasExt[KHR_debug] || !gl->glPushDebugGroup)
|
||||
return;
|
||||
|
||||
gl->glPushDebugGroup(eGL_DEBUG_SOURCE_APPLICATION, 0, -1, marker.c_str());
|
||||
}
|
||||
|
||||
void GLMarkerRegion::Set(const std::string &marker)
|
||||
{
|
||||
if(gl == NULL || !HasExt[KHR_debug] || !gl->glDebugMessageInsert)
|
||||
return;
|
||||
|
||||
gl->glDebugMessageInsert(eGL_DEBUG_SOURCE_APPLICATION, eGL_DEBUG_TYPE_MARKER, 0,
|
||||
eGL_DEBUG_SEVERITY_NOTIFICATION, -1, marker.c_str());
|
||||
}
|
||||
|
||||
GLMarkerRegion::~GLMarkerRegion()
|
||||
{
|
||||
if(gl == NULL || !HasExt[KHR_debug] || !gl->glPopDebugGroup)
|
||||
return;
|
||||
|
||||
gl->glPopDebugGroup();
|
||||
}
|
||||
|
||||
size_t BufferIdx(GLenum buf)
|
||||
{
|
||||
switch(buf)
|
||||
|
||||
@@ -218,6 +218,16 @@ const GLenum eGL_ONE = (GLenum)1;
|
||||
class WrappedOpenGL;
|
||||
struct GLHookSet;
|
||||
|
||||
// replay only class for handling marker regions
|
||||
struct GLMarkerRegion
|
||||
{
|
||||
GLMarkerRegion(const std::string &marker);
|
||||
~GLMarkerRegion();
|
||||
static void Set(const std::string &marker);
|
||||
|
||||
static const GLHookSet *gl;
|
||||
};
|
||||
|
||||
size_t BufferIdx(GLenum buf);
|
||||
GLenum BufferEnum(size_t idx);
|
||||
|
||||
|
||||
@@ -2154,6 +2154,8 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin
|
||||
|
||||
MakeCurrentReplayContext(&m_ReplayCtx);
|
||||
|
||||
GLMarkerRegion renderoverlay(StringFormat::Fmt("RenderOverlay %d", overlay));
|
||||
|
||||
void *ctx = m_ReplayCtx.ctx;
|
||||
|
||||
GLRenderState rs(&gl.GetHookset(), NULL, READING);
|
||||
|
||||
@@ -763,6 +763,8 @@ WrappedOpenGL::WrappedOpenGL(const char *logfile, const GLHookSet &funcs, GLPlat
|
||||
m_pSerialiser = new Serialiser(4, dummy, false);
|
||||
}
|
||||
|
||||
GLMarkerRegion::gl = &m_Real;
|
||||
|
||||
// once GL driver is more tested, this can be disabled
|
||||
if(HasExt[KHR_debug] && m_Real.glDebugMessageCallback)
|
||||
{
|
||||
@@ -4213,18 +4215,31 @@ void WrappedOpenGL::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
|
||||
|
||||
if(!partial)
|
||||
{
|
||||
GLMarkerRegion apply("ApplyInitialContents");
|
||||
GetResourceManager()->ApplyInitialContents();
|
||||
GetResourceManager()->ReleaseInFrameResources();
|
||||
}
|
||||
|
||||
if(replayType == eReplay_Full)
|
||||
{
|
||||
if(replayType == eReplay_Full)
|
||||
ContextReplayLog(EXECUTING, startEventID, endEventID, partial);
|
||||
else if(replayType == eReplay_WithoutDraw)
|
||||
ContextReplayLog(EXECUTING, startEventID, RDCMAX(1U, endEventID) - 1, partial);
|
||||
else if(replayType == eReplay_OnlyDraw)
|
||||
ContextReplayLog(EXECUTING, endEventID, endEventID, partial);
|
||||
else
|
||||
RDCFATAL("Unexpected replay type");
|
||||
GLMarkerRegion exec(
|
||||
StringFormat::Fmt("Replay: Full %u->%u (partial %u)", startEventID, endEventID, partial));
|
||||
ContextReplayLog(EXECUTING, startEventID, endEventID, partial);
|
||||
}
|
||||
else if(replayType == eReplay_WithoutDraw)
|
||||
{
|
||||
GLMarkerRegion exec(StringFormat::Fmt("Replay: W/O Draw %u->%u (partial %u)", startEventID,
|
||||
endEventID, partial));
|
||||
ContextReplayLog(EXECUTING, startEventID, RDCMAX(1U, endEventID) - 1, partial);
|
||||
}
|
||||
else if(replayType == eReplay_OnlyDraw)
|
||||
{
|
||||
GLMarkerRegion exec(StringFormat::Fmt("Replay: Draw Only %u->%u (partial %u)", endEventID,
|
||||
endEventID, partial));
|
||||
ContextReplayLog(EXECUTING, endEventID, endEventID, partial);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCFATAL("Unexpected replay type");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user