mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Add selection of primitive to pixel debug from pixel history
* This means when multiple fragments are writing to a pixel you can choose precisely the one you want to debug, rather than the debugging always running the approximately last fragment to pass
This commit is contained in:
@@ -153,9 +153,9 @@ extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_GetResolve(ReplayRende
|
||||
extern "C" RENDERDOC_API ShaderReflection* RENDERDOC_CC ReplayRenderer_GetShaderDetails(ReplayRenderer *rend, ResourceId shader);
|
||||
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_PixelHistory(ReplayRenderer *rend, ResourceId target, uint32_t x, uint32_t y, rdctype::array<PixelModification> *history);
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_VSGetDebugStates(ReplayRenderer *rend, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace);
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_PSGetDebugStates(ReplayRenderer *rend, uint32_t x, uint32_t y, ShaderDebugTrace *trace);
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_CSGetDebugStates(ReplayRenderer *rend, uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace);
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_DebugVertex(ReplayRenderer *rend, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace);
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_DebugPixel(ReplayRenderer *rend, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive, ShaderDebugTrace *trace);
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_DebugThread(ReplayRenderer *rend, uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace);
|
||||
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_GetUsage(ReplayRenderer *rend, ResourceId id, rdctype::array<EventUsage> *usage);
|
||||
|
||||
|
||||
@@ -827,7 +827,7 @@ bool ProxySerialiser::Tick()
|
||||
DebugVertex(0, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case eCommand_DebugPixel:
|
||||
DebugPixel(0, 0, 0, 0);
|
||||
DebugPixel(0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case eCommand_DebugThread:
|
||||
{
|
||||
@@ -1571,7 +1571,7 @@ ShaderDebugTrace ProxySerialiser::DebugVertex(uint32_t frameID, uint32_t eventID
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShaderDebugTrace ProxySerialiser::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y)
|
||||
ShaderDebugTrace ProxySerialiser::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive)
|
||||
{
|
||||
ShaderDebugTrace ret;
|
||||
|
||||
@@ -1579,10 +1579,12 @@ ShaderDebugTrace ProxySerialiser::DebugPixel(uint32_t frameID, uint32_t eventID,
|
||||
m_ToReplaySerialiser->Serialise("", eventID);
|
||||
m_ToReplaySerialiser->Serialise("", x);
|
||||
m_ToReplaySerialiser->Serialise("", y);
|
||||
m_ToReplaySerialiser->Serialise("", sample);
|
||||
m_ToReplaySerialiser->Serialise("", primitive);
|
||||
|
||||
if(m_ReplayHost)
|
||||
{
|
||||
ret = m_Remote->DebugPixel(frameID, eventID, x, y);
|
||||
ret = m_Remote->DebugPixel(frameID, eventID, x, y, sample, primitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -301,7 +301,7 @@ class ProxySerialiser : public IReplayDriver, Callstack::StackResolver
|
||||
|
||||
vector<PixelModification> PixelHistory(uint32_t frameID, vector<EventUsage> events, ResourceId target, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugVertex(uint32_t frameID, uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive);
|
||||
ShaderDebugTrace DebugThread(uint32_t frameID, uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
|
||||
|
||||
void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStageType type, ResourceId *id, string *errors);
|
||||
|
||||
@@ -1145,7 +1145,7 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t frameID, uint32_t event
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y)
|
||||
ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive)
|
||||
{
|
||||
using namespace DXBC;
|
||||
using namespace ShaderDebug;
|
||||
@@ -1371,17 +1371,10 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t frameID, uint32_t eventI
|
||||
}
|
||||
|
||||
// if we encounter multiple hits at our destination pixel co-ord (or any other) we
|
||||
// really need to check depth state here, but that's difficult so skip it for now
|
||||
// we can iterate over the hits and get the depth of each from the second element
|
||||
// in each struct, but we also need the test depth AND need to be able to resolve
|
||||
// the depth test in the same way for each fragment.
|
||||
//
|
||||
// For now, just take the first. Later need to modify buf to point at the data of
|
||||
// the actual passing fragment.
|
||||
// also with alpha blending on we'd need to be able to pick the right one anyway.
|
||||
// so really here we just need to be able to get the depth result of each hit and
|
||||
// let the user choose, since multiple might pass & apply.
|
||||
|
||||
// check to see if a specific primitive was requested (via primitive parameter not
|
||||
// being set to ~0U). If it was, debug that pixel, otherwise do a best-estimate
|
||||
// of which fragment was the last to successfully depth test and debug that, just by
|
||||
// checking if the depth test is ordered and picking the final fragment in the series
|
||||
|
||||
// our debugging quad. Order is TL, TR, BL, BR
|
||||
State quad[4];
|
||||
@@ -1410,29 +1403,50 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t frameID, uint32_t eventI
|
||||
|
||||
DebugHit *winner = NULL;
|
||||
|
||||
for(size_t i=0; i < buf[0].numHits && i < overdrawLevels; i++)
|
||||
if(primitive != ~0U)
|
||||
{
|
||||
DebugHit *hit = (DebugHit *)(initialData+i*structStride);
|
||||
|
||||
// only interested in destination pixel
|
||||
if(hit->posx != (float)x + 0.5 || hit->posy != (float)y + 0.5)
|
||||
continue;
|
||||
|
||||
if(winner == NULL || depthFunc == D3D11_COMPARISON_ALWAYS || depthFunc == D3D11_COMPARISON_NEVER ||
|
||||
depthFunc == D3D11_COMPARISON_NOT_EQUAL || depthFunc == D3D11_COMPARISON_EQUAL)
|
||||
for(size_t i=0; i < buf[0].numHits && i < overdrawLevels; i++)
|
||||
{
|
||||
winner = hit;
|
||||
continue;
|
||||
DebugHit *hit = (DebugHit *)(initialData+i*structStride);
|
||||
|
||||
// only interested in destination pixel
|
||||
if(hit->posx != (float)x + 0.5 || hit->posy != (float)y + 0.5)
|
||||
continue;
|
||||
|
||||
if(hit->primitive == primitive)
|
||||
{
|
||||
winner = hit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(
|
||||
(depthFunc == D3D11_COMPARISON_LESS && hit->depth < winner->depth) ||
|
||||
(depthFunc == D3D11_COMPARISON_LESS_EQUAL && hit->depth <= winner->depth) ||
|
||||
(depthFunc == D3D11_COMPARISON_GREATER && hit->depth > winner->depth) ||
|
||||
(depthFunc == D3D11_COMPARISON_GREATER_EQUAL && hit->depth >= winner->depth)
|
||||
)
|
||||
}
|
||||
|
||||
if(winner == NULL)
|
||||
{
|
||||
for(size_t i=0; i < buf[0].numHits && i < overdrawLevels; i++)
|
||||
{
|
||||
winner = hit;
|
||||
DebugHit *hit = (DebugHit *)(initialData+i*structStride);
|
||||
|
||||
// only interested in destination pixel
|
||||
if(hit->posx != (float)x + 0.5 || hit->posy != (float)y + 0.5)
|
||||
continue;
|
||||
|
||||
if(winner == NULL || depthFunc == D3D11_COMPARISON_ALWAYS || depthFunc == D3D11_COMPARISON_NEVER ||
|
||||
depthFunc == D3D11_COMPARISON_NOT_EQUAL || depthFunc == D3D11_COMPARISON_EQUAL)
|
||||
{
|
||||
winner = hit;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(
|
||||
(depthFunc == D3D11_COMPARISON_LESS && hit->depth < winner->depth) ||
|
||||
(depthFunc == D3D11_COMPARISON_LESS_EQUAL && hit->depth <= winner->depth) ||
|
||||
(depthFunc == D3D11_COMPARISON_GREATER && hit->depth > winner->depth) ||
|
||||
(depthFunc == D3D11_COMPARISON_GREATER_EQUAL && hit->depth >= winner->depth)
|
||||
)
|
||||
{
|
||||
winner = hit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ class D3D11DebugManager
|
||||
|
||||
vector<PixelModification> PixelHistory(uint32_t frameID, vector<EventUsage> events, ResourceId target, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugVertex(uint32_t frameID, uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive);
|
||||
ShaderDebugTrace DebugThread(uint32_t frameID, uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
|
||||
void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample, float pixel[4]);
|
||||
|
||||
|
||||
@@ -1309,9 +1309,9 @@ ShaderDebugTrace D3D11Replay::DebugVertex(uint32_t frameID, uint32_t eventID, ui
|
||||
return m_pDevice->GetDebugManager()->DebugVertex(frameID, eventID, vertid, instid, idx, instOffset, vertOffset);
|
||||
}
|
||||
|
||||
ShaderDebugTrace D3D11Replay::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y)
|
||||
ShaderDebugTrace D3D11Replay::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive)
|
||||
{
|
||||
return m_pDevice->GetDebugManager()->DebugPixel(frameID, eventID, x, y);
|
||||
return m_pDevice->GetDebugManager()->DebugPixel(frameID, eventID, x, y, sample, primitive);
|
||||
}
|
||||
|
||||
ShaderDebugTrace D3D11Replay::DebugThread(uint32_t frameID, uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3])
|
||||
|
||||
@@ -111,7 +111,7 @@ class D3D11Replay : public IReplayDriver
|
||||
|
||||
vector<PixelModification> PixelHistory(uint32_t frameID, vector<EventUsage> events, ResourceId target, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugVertex(uint32_t frameID, uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive);
|
||||
ShaderDebugTrace DebugThread(uint32_t frameID, uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
|
||||
void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample, float pixel[4]);
|
||||
|
||||
|
||||
@@ -1432,7 +1432,7 @@ ShaderDebugTrace GLReplay::DebugVertex(uint32_t frameID, uint32_t eventID, uint3
|
||||
return ShaderDebugTrace();
|
||||
}
|
||||
|
||||
ShaderDebugTrace GLReplay::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y)
|
||||
ShaderDebugTrace GLReplay::DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive)
|
||||
{
|
||||
RDCUNIMPLEMENTED("DebugPixel");
|
||||
return ShaderDebugTrace();
|
||||
|
||||
@@ -111,7 +111,7 @@ class GLReplay : public IReplayDriver
|
||||
|
||||
vector<PixelModification> PixelHistory(uint32_t frameID, vector<EventUsage> events, ResourceId target, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugVertex(uint32_t frameID, uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y);
|
||||
ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive);
|
||||
ShaderDebugTrace DebugThread(uint32_t frameID, uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
|
||||
void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample, float pixel[4]);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class IRemoteDriver
|
||||
|
||||
virtual vector<PixelModification> PixelHistory(uint32_t frameID, vector<EventUsage> events, ResourceId target, uint32_t x, uint32_t y) = 0;
|
||||
virtual ShaderDebugTrace DebugVertex(uint32_t frameID, uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset) = 0;
|
||||
virtual ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y) = 0;
|
||||
virtual ShaderDebugTrace DebugPixel(uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive) = 0;
|
||||
virtual ShaderDebugTrace DebugThread(uint32_t frameID, uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]) = 0;
|
||||
|
||||
virtual ResourceId RenderOverlay(ResourceId texid, TextureDisplayOverlay overlay, uint32_t frameID, uint32_t eventID, const vector<uint32_t> &passEvents) = 0;
|
||||
|
||||
@@ -1092,7 +1092,7 @@ bool ReplayRenderer::PixelHistory(ResourceId target, uint32_t x, uint32_t y, rdc
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayRenderer::VSGetDebugStates(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace)
|
||||
bool ReplayRenderer::DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace)
|
||||
{
|
||||
if(trace == NULL) return false;
|
||||
|
||||
@@ -1103,18 +1103,18 @@ bool ReplayRenderer::VSGetDebugStates(uint32_t vertid, uint32_t instid, uint32_t
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayRenderer::PSGetDebugStates(uint32_t x, uint32_t y, ShaderDebugTrace *trace)
|
||||
bool ReplayRenderer::DebugPixel(uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive, ShaderDebugTrace *trace)
|
||||
{
|
||||
if(trace == NULL) return false;
|
||||
|
||||
*trace = m_pDevice->DebugPixel(m_FrameID, m_EventID, x, y);
|
||||
*trace = m_pDevice->DebugPixel(m_FrameID, m_EventID, x, y, sample, primitive);
|
||||
|
||||
SetFrameEvent(m_FrameID, m_EventID, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayRenderer::CSGetDebugStates(uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace)
|
||||
bool ReplayRenderer::DebugThread(uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace)
|
||||
{
|
||||
if(trace == NULL) return false;
|
||||
|
||||
@@ -1462,12 +1462,12 @@ extern "C" RENDERDOC_API ShaderReflection* RENDERDOC_CC ReplayRenderer_GetShader
|
||||
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_PixelHistory(ReplayRenderer *rend, ResourceId target, uint32_t x, uint32_t y, rdctype::array<PixelModification> *history)
|
||||
{ return rend->PixelHistory(target, x, y, history); }
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_VSGetDebugStates(ReplayRenderer *rend, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace)
|
||||
{ return rend->VSGetDebugStates(vertid, instid, idx, instOffset, vertOffset, trace); }
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_PSGetDebugStates(ReplayRenderer *rend, uint32_t x, uint32_t y, ShaderDebugTrace *trace)
|
||||
{ return rend->PSGetDebugStates(x, y, trace); }
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_CSGetDebugStates(ReplayRenderer *rend, uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace)
|
||||
{ return rend->CSGetDebugStates(groupid, threadid, trace); }
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_DebugVertex(ReplayRenderer *rend, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace)
|
||||
{ return rend->DebugVertex(vertid, instid, idx, instOffset, vertOffset, trace); }
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_DebugPixel(ReplayRenderer *rend, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive, ShaderDebugTrace *trace)
|
||||
{ return rend->DebugPixel(x, y, sample, primitive, trace); }
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_DebugThread(ReplayRenderer *rend, uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace)
|
||||
{ return rend->DebugThread(groupid, threadid, trace); }
|
||||
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC ReplayRenderer_GetUsage(ReplayRenderer *rend, ResourceId id, rdctype::array<EventUsage> *usage)
|
||||
{ return rend->GetUsage(id, usage); }
|
||||
|
||||
@@ -161,9 +161,9 @@ struct ReplayRenderer
|
||||
ShaderReflection *GetShaderDetails(ResourceId shader);
|
||||
|
||||
bool PixelHistory(ResourceId target, uint32_t x, uint32_t y, rdctype::array<PixelModification> *history);
|
||||
bool VSGetDebugStates(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace);
|
||||
bool PSGetDebugStates(uint32_t x, uint32_t y, ShaderDebugTrace *trace);
|
||||
bool CSGetDebugStates(uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace);
|
||||
bool DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace);
|
||||
bool DebugPixel(uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive, ShaderDebugTrace *trace);
|
||||
bool DebugThread(uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace);
|
||||
|
||||
bool GetPostVSData(MeshDataStage stage, PostVSMeshData *data);
|
||||
|
||||
|
||||
@@ -213,11 +213,11 @@ namespace renderdoc
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_PixelHistory(IntPtr real, ResourceId target, UInt32 x, UInt32 y, IntPtr history);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_VSGetDebugStates(IntPtr real, UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset, IntPtr outtrace);
|
||||
private static extern bool ReplayRenderer_DebugVertex(IntPtr real, UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset, IntPtr outtrace);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_PSGetDebugStates(IntPtr real, UInt32 x, UInt32 y, IntPtr outtrace);
|
||||
private static extern bool ReplayRenderer_DebugPixel(IntPtr real, UInt32 x, UInt32 y, UInt32 sample, UInt32 primitive, IntPtr outtrace);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_CSGetDebugStates(IntPtr real, UInt32[] groupid, UInt32[] threadid, IntPtr outtrace);
|
||||
private static extern bool ReplayRenderer_DebugThread(IntPtr real, UInt32[] groupid, UInt32[] threadid, IntPtr outtrace);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_GetUsage(IntPtr real, ResourceId id, IntPtr outusage);
|
||||
@@ -506,11 +506,11 @@ namespace renderdoc
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ShaderDebugTrace VSGetDebugStates(UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset)
|
||||
public ShaderDebugTrace DebugVertex(UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset)
|
||||
{
|
||||
IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace));
|
||||
|
||||
bool success = ReplayRenderer_VSGetDebugStates(m_Real, vertid, instid, idx, instOffset, vertOffset, mem);
|
||||
bool success = ReplayRenderer_DebugVertex(m_Real, vertid, instid, idx, instOffset, vertOffset, mem);
|
||||
|
||||
ShaderDebugTrace ret = null;
|
||||
|
||||
@@ -522,11 +522,11 @@ namespace renderdoc
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ShaderDebugTrace PSGetDebugStates(UInt32 x, UInt32 y)
|
||||
public ShaderDebugTrace DebugPixel(UInt32 x, UInt32 y, UInt32 sample, UInt32 primitive)
|
||||
{
|
||||
IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace));
|
||||
|
||||
bool success = ReplayRenderer_PSGetDebugStates(m_Real, x, y, mem);
|
||||
bool success = ReplayRenderer_DebugPixel(m_Real, x, y, sample, primitive, mem);
|
||||
|
||||
ShaderDebugTrace ret = null;
|
||||
|
||||
@@ -538,11 +538,11 @@ namespace renderdoc
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ShaderDebugTrace CSGetDebugStates(UInt32[] groupid, UInt32[] threadid)
|
||||
public ShaderDebugTrace DebugThread(UInt32[] groupid, UInt32[] threadid)
|
||||
{
|
||||
IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace));
|
||||
|
||||
bool success = ReplayRenderer_CSGetDebugStates(m_Real, groupid, threadid, mem);
|
||||
bool success = ReplayRenderer_DebugThread(m_Real, groupid, threadid, mem);
|
||||
|
||||
ShaderDebugTrace ret = null;
|
||||
|
||||
|
||||
@@ -2172,7 +2172,7 @@ namespace renderdocui.Windows
|
||||
|
||||
m_Core.Renderer.Invoke((ReplayRenderer r) =>
|
||||
{
|
||||
trace = r.VSGetDebugStates((UInt32)row, (UInt32)m_CurInst, idx, draw.instanceOffset, draw.vertexOffset);
|
||||
trace = r.DebugVertex((UInt32)row, (UInt32)m_CurInst, idx, draw.instanceOffset, draw.vertexOffset);
|
||||
});
|
||||
|
||||
this.BeginInvoke(new Action(() =>
|
||||
|
||||
@@ -2030,7 +2030,7 @@ namespace renderdocui.Windows.PipelineState
|
||||
|
||||
m_Core.Renderer.Invoke((ReplayRenderer r) =>
|
||||
{
|
||||
trace = r.CSGetDebugStates(new uint[] { gx, gy, gz }, new uint[] { tx, ty, tz });
|
||||
trace = r.DebugThread(new uint[] { gx, gy, gz }, new uint[] { tx, ty, tz });
|
||||
});
|
||||
|
||||
if (trace == null || trace.states.Length == 0)
|
||||
|
||||
@@ -39,9 +39,22 @@ namespace renderdocui.Windows
|
||||
{
|
||||
public partial class PixelHistoryView : DockContent, ILogViewerForm
|
||||
{
|
||||
struct EventTag
|
||||
{
|
||||
public EventTag(uint eid, uint prim)
|
||||
{
|
||||
EID = eid;
|
||||
Primitive = prim;
|
||||
}
|
||||
|
||||
public uint EID;
|
||||
public uint Primitive;
|
||||
};
|
||||
|
||||
Core m_Core;
|
||||
FetchTexture texture;
|
||||
Point pixel;
|
||||
uint sample;
|
||||
PixelModification[] modifications;
|
||||
bool[] visibleChannels;
|
||||
float rangeMin, rangeMax;
|
||||
@@ -61,6 +74,7 @@ namespace renderdocui.Windows
|
||||
rangeMin = rangemin;
|
||||
rangeMax = rangemax;
|
||||
visibleChannels = channels;
|
||||
sample = 0;
|
||||
|
||||
Text = String.Format("Pixel History on {0} for ({1}, {2})", tex.name, pt.X, pt.Y);
|
||||
|
||||
@@ -276,7 +290,7 @@ namespace renderdocui.Windows
|
||||
node = new TreelistView.Node(new object[] { name, shadOutVal, "", postModVal, "" });
|
||||
}
|
||||
|
||||
node.Tag = mod.eventID;
|
||||
node.Tag = new EventTag(mod.eventID, mod.uavWrite ? uint.MaxValue : mod.primitiveID);
|
||||
|
||||
if (floatTex || depth)
|
||||
{
|
||||
@@ -360,7 +374,7 @@ namespace renderdocui.Windows
|
||||
var node = new TreelistView.Node(new object[] { name, preModVal, "", postModVal, "" });
|
||||
|
||||
node.DefaultBackColor = passed ? Color.FromArgb(235, 255, 235) : Color.FromArgb(255, 235, 235);
|
||||
node.Tag = mods[0].eventID;
|
||||
node.Tag = new EventTag(mods[0].eventID, uint.MaxValue);
|
||||
|
||||
if (uavnowrite)
|
||||
node.DefaultBackColor = Color.FromArgb(235, 235, 235);
|
||||
@@ -427,9 +441,9 @@ namespace renderdocui.Windows
|
||||
|
||||
private void events_NodeDoubleClicked(TreelistView.Node node)
|
||||
{
|
||||
if (node.Tag is uint)
|
||||
if (node.Tag is EventTag)
|
||||
{
|
||||
m_Core.SetEventID(this, m_Core.CurFrame, (uint)node.Tag);
|
||||
m_Core.SetEventID(this, m_Core.CurFrame, ((EventTag)node.Tag).EID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,11 +455,12 @@ namespace renderdocui.Windows
|
||||
|
||||
debugToolStripMenuItem.Text = "Debug Pixel";
|
||||
|
||||
if (events.SelectedNode != null && events.SelectedNode.Tag != null && events.SelectedNode.Tag is uint)
|
||||
if (events.SelectedNode != null && events.SelectedNode.Tag != null && events.SelectedNode.Tag is EventTag)
|
||||
{
|
||||
EventTag tag = (EventTag)events.SelectedNode.Tag;
|
||||
debugToolStripMenuItem.Enabled = true;
|
||||
debugToolStripMenuItem.Text = String.Format("Debug Pixel ({0}, {1}) at Event {2}",
|
||||
pixel.X, pixel.Y, (uint)events.SelectedNode.Tag);
|
||||
debugToolStripMenuItem.Text = String.Format("Debug Pixel ({0}, {1}) primitive {2} at Event {3}",
|
||||
pixel.X, pixel.Y, tag.Primitive, tag.EID);
|
||||
}
|
||||
|
||||
rightclickMenu.Show(events.PointToScreen(e.Location));
|
||||
@@ -458,9 +473,11 @@ namespace renderdocui.Windows
|
||||
|
||||
var node = events.SelectedNode;
|
||||
|
||||
if (node.Tag is uint)
|
||||
if (node.Tag is EventTag)
|
||||
{
|
||||
m_Core.SetEventID(this, m_Core.CurFrame, (uint)node.Tag);
|
||||
EventTag tag = (EventTag)node.Tag;
|
||||
|
||||
m_Core.SetEventID(this, m_Core.CurFrame, tag.EID);
|
||||
|
||||
ShaderDebugTrace trace = null;
|
||||
|
||||
@@ -468,7 +485,7 @@ namespace renderdocui.Windows
|
||||
|
||||
m_Core.Renderer.Invoke((ReplayRenderer r) =>
|
||||
{
|
||||
trace = r.PSGetDebugStates((UInt32)pixel.X, (UInt32)pixel.Y);
|
||||
trace = r.DebugPixel((UInt32)pixel.X, (UInt32)pixel.Y, sample, tag.Primitive);
|
||||
});
|
||||
|
||||
if (trace == null || trace.states.Length == 0)
|
||||
|
||||
@@ -2681,7 +2681,7 @@ namespace renderdocui.Windows
|
||||
|
||||
m_Core.Renderer.Invoke((ReplayRenderer r) =>
|
||||
{
|
||||
trace = r.PSGetDebugStates((UInt32)m_PickedPoint.X, (UInt32)m_PickedPoint.Y);
|
||||
trace = r.DebugPixel((UInt32)m_PickedPoint.X, (UInt32)m_PickedPoint.Y, m_TexDisplay.sampleIdx, uint.MaxValue);
|
||||
});
|
||||
|
||||
if (trace == null || trace.states.Length == 0)
|
||||
|
||||
Reference in New Issue
Block a user