mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
List GenerateMips, Copy and Resolve calls in event browser with draws
* What gets listed as a 'drawcall' is a bit fuzzy - previously it was drawing calls, dispatches and clears, but you could make a good argument for these to be included as well. As a semi-experiment, these calls are now included and will be listed in the event browser. * Other calls can change resources like direct buffer or texture uploads and Map() type calls, but these remain as API calls listed between draw calls. Again this is mostly an arbitrary distinction. * D3D11 logs are backwards compatible, GL logs are not (although it'd be relatively simple, GL logs will likely break backwards compat soon anyway, so not worth supporting it now only to break it soon).
This commit is contained in:
@@ -345,6 +345,14 @@ enum ResourceUsage
|
||||
eUsage_OM_DSV,
|
||||
|
||||
eUsage_Clear,
|
||||
|
||||
eUsage_GenMips,
|
||||
eUsage_Resolve,
|
||||
eUsage_ResolveSrc,
|
||||
eUsage_ResolveDst,
|
||||
eUsage_Copy,
|
||||
eUsage_CopySrc,
|
||||
eUsage_CopyDst,
|
||||
};
|
||||
|
||||
enum DrawcallFlags
|
||||
@@ -358,14 +366,17 @@ enum DrawcallFlags
|
||||
eDraw_PushMarker = 0x20,
|
||||
eDraw_Present = 0x40,
|
||||
eDraw_MultiDraw = 0x80,
|
||||
eDraw_Copy = 0x100,
|
||||
eDraw_Resolve = 0x200,
|
||||
eDraw_GenMips = 0x400,
|
||||
|
||||
// flags
|
||||
eDraw_UseIBuffer = 0x0100,
|
||||
eDraw_Instanced = 0x0200,
|
||||
eDraw_Auto = 0x0400,
|
||||
eDraw_Indirect = 0x0800,
|
||||
eDraw_ClearColour = 0x1000,
|
||||
eDraw_ClearDepth = 0x2000,
|
||||
eDraw_UseIBuffer = 0x01000,
|
||||
eDraw_Instanced = 0x02000,
|
||||
eDraw_Auto = 0x04000,
|
||||
eDraw_Indirect = 0x08000,
|
||||
eDraw_ClearColour = 0x10000,
|
||||
eDraw_ClearDepth = 0x20000,
|
||||
};
|
||||
|
||||
enum SolidShadeMode
|
||||
|
||||
@@ -4797,6 +4797,44 @@ bool WrappedID3D11DeviceContext::Serialise_CopySubresourceRegion( ID3D11Resource
|
||||
SourceSubresource, box);
|
||||
}
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
// version 5 added this as a drawcall, we can assume for older logs there's just no debug messages
|
||||
if(m_pDevice->GetLogVersion() >= 0x000006)
|
||||
Serialise_DebugMessages();
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
std::string dstName = GetDebugName(m_pDevice->GetResourceManager()->GetLiveResource(Destination));
|
||||
std::string srcName = GetDebugName(m_pDevice->GetResourceManager()->GetLiveResource(Source));
|
||||
|
||||
if(dstName == "") dstName = ToStr::Get(Destination);
|
||||
if(srcName == "") srcName = ToStr::Get(Source);
|
||||
|
||||
AddEvent(COPY_SUBRESOURCE_REGION, desc);
|
||||
string name = "CopySubresourceRegion(" + dstName + ", " + srcName + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.flags |= eDraw_Copy;
|
||||
|
||||
AddDrawcall(draw, true);
|
||||
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(Destination) &&
|
||||
m_pDevice->GetResourceManager()->HasLiveResource(Source))
|
||||
{
|
||||
if(Destination == Source)
|
||||
{
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back(EventUsage(m_CurEventID, eUsage_Copy));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back(EventUsage(m_CurEventID, eUsage_CopyDst));
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Source)].push_back(EventUsage(m_CurEventID, eUsage_CopySrc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4890,6 +4928,44 @@ bool WrappedID3D11DeviceContext::Serialise_CopyResource(ID3D11Resource *pDstReso
|
||||
m_pDevice->GetResourceManager()->UnwrapResource((ID3D11Resource*)m_pDevice->GetResourceManager()->GetLiveResource(Source)));
|
||||
}
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
// version 5 added this as a drawcall, we can assume for older logs there's just no debug messages
|
||||
if(m_pDevice->GetLogVersion() >= 0x000006)
|
||||
Serialise_DebugMessages();
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
std::string dstName = GetDebugName(m_pDevice->GetResourceManager()->GetLiveResource(Destination));
|
||||
std::string srcName = GetDebugName(m_pDevice->GetResourceManager()->GetLiveResource(Source));
|
||||
|
||||
if(dstName == "") dstName = ToStr::Get(Destination);
|
||||
if(srcName == "") srcName = ToStr::Get(Source);
|
||||
|
||||
AddEvent(COPY_RESOURCE, desc);
|
||||
string name = "CopyResource(" + dstName + ", " + srcName + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.flags |= eDraw_Copy;
|
||||
|
||||
AddDrawcall(draw, true);
|
||||
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(Destination) &&
|
||||
m_pDevice->GetResourceManager()->HasLiveResource(Source))
|
||||
{
|
||||
if(Destination == Source)
|
||||
{
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back(EventUsage(m_CurEventID, eUsage_Copy));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back(EventUsage(m_CurEventID, eUsage_CopyDst));
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Source)].push_back(EventUsage(m_CurEventID, eUsage_CopySrc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5307,6 +5383,44 @@ bool WrappedID3D11DeviceContext::Serialise_ResolveSubresource(ID3D11Resource *pD
|
||||
SourceSubresource, Format);
|
||||
}
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
// version 5 added this as a drawcall, we can assume for older logs there's just no debug messages
|
||||
if(m_pDevice->GetLogVersion() >= 0x000006)
|
||||
Serialise_DebugMessages();
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
std::string dstName = GetDebugName(m_pDevice->GetResourceManager()->GetLiveResource(DestResource));
|
||||
std::string srcName = GetDebugName(m_pDevice->GetResourceManager()->GetLiveResource(SourceResource));
|
||||
|
||||
if(dstName == "") dstName = ToStr::Get(DestResource);
|
||||
if(srcName == "") srcName = ToStr::Get(SourceResource);
|
||||
|
||||
AddEvent(RESOLVE_SUBRESOURCE, desc);
|
||||
string name = "ResolveSubresource(" + dstName + ", " + srcName + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.flags |= eDraw_Resolve;
|
||||
|
||||
AddDrawcall(draw, true);
|
||||
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(DestResource) &&
|
||||
m_pDevice->GetResourceManager()->HasLiveResource(SourceResource))
|
||||
{
|
||||
if(DestResource == SourceResource)
|
||||
{
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(DestResource)].push_back(EventUsage(m_CurEventID, eUsage_Resolve));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(DestResource)].push_back(EventUsage(m_CurEventID, eUsage_ResolveDst));
|
||||
m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(SourceResource)].push_back(EventUsage(m_CurEventID, eUsage_ResolveSrc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5395,6 +5509,41 @@ bool WrappedID3D11DeviceContext::Serialise_GenerateMips(ID3D11ShaderResourceView
|
||||
m_pRealContext->GenerateMips(UNWRAP(WrappedID3D11ShaderResourceView, m_pDevice->GetResourceManager()->GetLiveResource(ShaderResourceView)));
|
||||
}
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
// version 5 added this as a drawcall, we can assume for older logs there's just no debug messages
|
||||
if(m_pDevice->GetLogVersion() >= 0x000006)
|
||||
Serialise_DebugMessages();
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
ResourceId id = ShaderResourceView;
|
||||
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(ShaderResourceView))
|
||||
{
|
||||
id = ((WrappedID3D11ShaderResourceView *)m_pDevice->GetResourceManager()->GetLiveResource(ShaderResourceView))->GetResourceResID();
|
||||
m_ResourceUses[id].push_back(EventUsage(m_CurEventID, eUsage_GenMips));
|
||||
id = m_pDevice->GetResourceManager()->GetOriginalID(id);
|
||||
}
|
||||
|
||||
std::string resName = GetDebugName(m_pDevice->GetResourceManager()->GetLiveResource(id));
|
||||
|
||||
if(resName == "") resName = ToStr::Get(id);
|
||||
|
||||
AddEvent(GENERATE_MIPS, desc);
|
||||
string name = "GenerateMips(" + resName + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.flags |= eDraw_GenMips;
|
||||
|
||||
AddDrawcall(draw, true);
|
||||
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(ShaderResourceView))
|
||||
m_ResourceUses[((WrappedID3D11ShaderResourceView *)m_pDevice->GetResourceManager()->GetLiveResource(ShaderResourceView))->GetResourceResID()]
|
||||
.push_back(EventUsage(m_CurEventID, eUsage_GenMips));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5617,7 +5766,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearUnorderedAccessViewUint(ID3D11Un
|
||||
ToStr::Get(Values[0]) + ", " +
|
||||
ToStr::Get(Values[1]) + ", " +
|
||||
ToStr::Get(Values[2]) + ", " +
|
||||
ToStr::Get(Values[3]) + ", " +
|
||||
ToStr::Get(Values[3]) +
|
||||
")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
|
||||
@@ -205,6 +205,7 @@ D3D11InitParams::D3D11InitParams()
|
||||
// Here we list which non-current versions we support, and what changed
|
||||
const uint32_t D3D11InitParams::D3D11_OLD_VERSIONS[D3D11InitParams::D3D11_NUM_SUPPORTED_OLD_VERSIONS] = {
|
||||
0x0000004, // from 0x4 to 0x5, we added the stream-out hidden counters in the context's Serialise_BeginCaptureFrame
|
||||
0x0000005, // from 0x5 to 0x6, several new calls were made 'drawcalls', like Copy & GenerateMips, with serialised debug messages
|
||||
};
|
||||
|
||||
ReplayCreateStatus D3D11InitParams::Serialise()
|
||||
|
||||
@@ -66,10 +66,10 @@ struct D3D11InitParams : public RDCInitParams
|
||||
UINT NumFeatureLevels;
|
||||
D3D_FEATURE_LEVEL FeatureLevels[16];
|
||||
|
||||
static const uint32_t D3D11_SERIALISE_VERSION = 0x0000005;
|
||||
static const uint32_t D3D11_SERIALISE_VERSION = 0x0000006;
|
||||
|
||||
// backwards compatibility for old logs described at the declaration of this array
|
||||
static const uint32_t D3D11_NUM_SUPPORTED_OLD_VERSIONS = 1;
|
||||
static const uint32_t D3D11_NUM_SUPPORTED_OLD_VERSIONS = 2;
|
||||
static const uint32_t D3D11_OLD_VERSIONS[D3D11_NUM_SUPPORTED_OLD_VERSIONS];
|
||||
|
||||
// version number internal to d3d11 stream
|
||||
|
||||
@@ -55,7 +55,7 @@ struct GLInitParams : public RDCInitParams
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
||||
static const uint32_t GL_SERIALISE_VERSION = 0x0000009;
|
||||
static const uint32_t GL_SERIALISE_VERSION = 0x000000A;
|
||||
|
||||
// version number internal to opengl stream
|
||||
uint32_t SerialiseVersion;
|
||||
|
||||
@@ -1259,6 +1259,24 @@ bool WrappedOpenGL::Serialise_glBlitNamedFramebuffer(GLuint readFramebuffer, GLu
|
||||
m_Real.glBlitNamedFramebuffer(readFramebuffer, drawFramebuffer, sX0, sY0, sX1, sY1, dX0, dY0, dX1, dY1, msk, flt);
|
||||
}
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
Serialise_DebugMessages();
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
AddEvent(BLIT_FRAMEBUFFER, desc);
|
||||
string name = "glBlitFramebuffer(" +
|
||||
ToStr::Get(readId) + ", " +
|
||||
ToStr::Get(drawId) + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.flags |= eDraw_Resolve;
|
||||
|
||||
AddDrawcall(draw, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,7 +633,7 @@ bool WrappedOpenGL::Serialise_glGenerateTextureMipmapEXT(GLuint texture, GLenum
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(GetCtx(), texture)));
|
||||
|
||||
if(m_State == READING)
|
||||
if(m_State <= EXECUTING)
|
||||
{
|
||||
if(Target != eGL_NONE)
|
||||
m_Real.glGenerateTextureMipmapEXT(GetResourceManager()->GetLiveResource(id).name, Target);
|
||||
@@ -641,6 +641,22 @@ bool WrappedOpenGL::Serialise_glGenerateTextureMipmapEXT(GLuint texture, GLenum
|
||||
m_Real.glGenerateTextureMipmap(GetResourceManager()->GetLiveResource(id).name);
|
||||
}
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
Serialise_DebugMessages();
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
AddEvent(GENERATE_MIPMAP, desc);
|
||||
string name = "glGenerateMipmap(" + ToStr::Get(id) + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.flags |= eDraw_GenMips;
|
||||
|
||||
AddDrawcall(draw, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -659,10 +675,7 @@ void WrappedOpenGL::Common_glGenerateTextureMipmapEXT(GLResourceRecord *record,
|
||||
}
|
||||
else if(m_State == WRITING_IDLE)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(GENERATE_MIPMAP);
|
||||
Serialise_glGenerateTextureMipmapEXT(record->Resource.name, target);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
GetResourceManager()->MarkDirtyResource(record->GetResourceID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,6 +755,25 @@ bool WrappedOpenGL::Serialise_glCopyImageSubData(GLuint srcName, GLenum srcTarge
|
||||
dstres.name, DestTarget, DestLevel, DestX, DestY, DestZ,
|
||||
SourceWidth, SourceHeight, SourceDepth);
|
||||
}
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
Serialise_DebugMessages();
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
AddEvent(COPY_SUBIMAGE, desc);
|
||||
string name = "glCopyImageSubData(" +
|
||||
ToStr::Get(srcid) + ", " +
|
||||
ToStr::Get(dstid) + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.flags |= eDraw_Copy;
|
||||
|
||||
AddDrawcall(draw, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ string ToStrHelper<false, ResourceId>::Get(const ResourceId &el)
|
||||
{
|
||||
char tostrBuf[256] = {0};
|
||||
|
||||
StringFormat::snprintf(tostrBuf, 255, "Resource ID %llu", el.id);
|
||||
StringFormat::snprintf(tostrBuf, 255, "ID %llu", el.id);
|
||||
|
||||
return tostrBuf;
|
||||
}
|
||||
|
||||
@@ -342,28 +342,39 @@ namespace renderdoc
|
||||
OM_DSV,
|
||||
|
||||
Clear,
|
||||
|
||||
GenMips,
|
||||
Resolve,
|
||||
ResolveSrc,
|
||||
ResolveDst,
|
||||
Copy,
|
||||
CopySrc,
|
||||
CopyDst,
|
||||
};
|
||||
|
||||
[Flags]
|
||||
public enum DrawcallFlags
|
||||
{
|
||||
// types
|
||||
Clear = 0x01,
|
||||
Drawcall = 0x02,
|
||||
Dispatch = 0x04,
|
||||
CmdList = 0x08,
|
||||
SetMarker = 0x10,
|
||||
PushMarker = 0x20,
|
||||
Present = 0x40,
|
||||
MultiDraw = 0x80,
|
||||
Clear = 0x01,
|
||||
Drawcall = 0x02,
|
||||
Dispatch = 0x04,
|
||||
CmdList = 0x08,
|
||||
SetMarker = 0x10,
|
||||
PushMarker = 0x20,
|
||||
Present = 0x40,
|
||||
MultiDraw = 0x80,
|
||||
Copy = 0x100,
|
||||
Resolve = 0x200,
|
||||
GenMips = 0x400,
|
||||
|
||||
// flags
|
||||
UseIBuffer = 0x100,
|
||||
Instanced = 0x200,
|
||||
Auto = 0x400,
|
||||
Indirect = 0x800,
|
||||
ClearColour = 0x1000,
|
||||
ClearDepth = 0x2000,
|
||||
UseIBuffer = 0x01000,
|
||||
Instanced = 0x02000,
|
||||
Auto = 0x04000,
|
||||
Indirect = 0x08000,
|
||||
ClearColour = 0x10000,
|
||||
ClearDepth = 0x20000,
|
||||
};
|
||||
|
||||
public enum SolidShadeMode
|
||||
@@ -560,6 +571,14 @@ namespace renderdoc
|
||||
case ResourceUsage.OM_DSV: return "Depthstencil";
|
||||
|
||||
case ResourceUsage.Clear: return "Clear";
|
||||
|
||||
case ResourceUsage.GenMips: return "Generate Mips";
|
||||
case ResourceUsage.Resolve: return "Resolve";
|
||||
case ResourceUsage.ResolveSrc: return "Resolve - Source";
|
||||
case ResourceUsage.ResolveDst: return "Resolve - Dest";
|
||||
case ResourceUsage.Copy: return "Copy";
|
||||
case ResourceUsage.CopySrc: return "Copy - Source";
|
||||
case ResourceUsage.CopyDst: return "Copy - Dest";
|
||||
}
|
||||
|
||||
return "Unknown Usage String";
|
||||
|
||||
@@ -621,7 +621,10 @@ namespace renderdocui.Windows
|
||||
{
|
||||
// read/write
|
||||
if (u.usage == ResourceUsage.CS_UAV ||
|
||||
u.usage == ResourceUsage.PS_UAV)
|
||||
u.usage == ResourceUsage.PS_UAV ||
|
||||
u.usage == ResourceUsage.GenMips ||
|
||||
u.usage == ResourceUsage.Copy ||
|
||||
u.usage == ResourceUsage.Resolve)
|
||||
{
|
||||
DrawPip(g, Color.Orchid, highlightBarRect, 3, d, s.draws.Count, start, widths[i], "");
|
||||
DrawPip(g, Color.Lime, highlightBarRect, 4, d, s.draws.Count, start, widths[i], "");
|
||||
@@ -630,7 +633,9 @@ namespace renderdocui.Windows
|
||||
// write
|
||||
else if (u.usage == ResourceUsage.SO ||
|
||||
u.usage == ResourceUsage.OM_DSV ||
|
||||
u.usage == ResourceUsage.OM_RTV)
|
||||
u.usage == ResourceUsage.OM_RTV ||
|
||||
u.usage == ResourceUsage.CopyDst ||
|
||||
u.usage == ResourceUsage.ResolveDst)
|
||||
{
|
||||
DrawPip(g, Color.Orchid, highlightBarRect, 1, d, s.draws.Count, start, widths[i], "");
|
||||
MarkWrite(s.draws[d].eventID);
|
||||
|
||||
Reference in New Issue
Block a user