mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-04 22:01:07 +00:00
Support choosing multiview viewport in vertex debugging on vulkan
This commit is contained in:
@@ -4184,12 +4184,13 @@ void BufferViewer::debugVertex()
|
||||
m_CurView->model()->data(m_CurView->model()->index(idx.row(), 0), Qt::DisplayRole).toUInt();
|
||||
uint32_t index =
|
||||
m_CurView->model()->data(m_CurView->model()->index(idx.row(), 1), Qt::DisplayRole).toUInt();
|
||||
uint32_t view = m_Config.curView;
|
||||
|
||||
bool done = false;
|
||||
ShaderDebugTrace *trace = NULL;
|
||||
|
||||
m_Ctx.Replay().AsyncInvoke([this, &done, &trace, vertid, index](IReplayController *r) {
|
||||
trace = r->DebugVertex(vertid, m_Config.curInstance, index);
|
||||
m_Ctx.Replay().AsyncInvoke([this, &done, &trace, vertid, index, view](IReplayController *r) {
|
||||
trace = r->DebugVertex(vertid, m_Config.curInstance, index, view);
|
||||
|
||||
if(trace->debugger == NULL)
|
||||
{
|
||||
|
||||
@@ -836,11 +836,13 @@ bucket when the pixel values are divided between ``minval`` and ``maxval``.
|
||||
:param int instid: The instance ID as a 0-based index up to the number of instances in the draw.
|
||||
:param int idx: The actual index used to look up vertex inputs, either from the vertex ID for non-
|
||||
indexed draws or drawn from the index buffer. This must have all drawcall offsets applied.
|
||||
:param int view: The index of the multiview viewport to use, or 0 if multiview is not in use.
|
||||
:return: The resulting trace resulting from debugging. Destroy with
|
||||
:meth:`FreeTrace`.
|
||||
:rtype: ShaderDebugTrace
|
||||
)");
|
||||
virtual ShaderDebugTrace *DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx) = 0;
|
||||
virtual ShaderDebugTrace *DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view) = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve a debugging trace from running a pixel shader.
|
||||
|
||||
|
||||
@@ -273,7 +273,8 @@ public:
|
||||
{
|
||||
return rdcarray<PixelModification>();
|
||||
}
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx)
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view)
|
||||
{
|
||||
return new ShaderDebugTrace();
|
||||
}
|
||||
|
||||
@@ -1455,7 +1455,8 @@ rdcarray<PixelModification> ReplayProxy::PixelHistory(rdcarray<EventUsage> event
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
ShaderDebugTrace *ReplayProxy::Proxied_DebugVertex(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser, uint32_t eventId,
|
||||
uint32_t vertid, uint32_t instid, uint32_t idx)
|
||||
uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view)
|
||||
{
|
||||
const ReplayProxyPacket expectedPacket = eReplayProxy_DebugVertex;
|
||||
ReplayProxyPacket packet = eReplayProxy_DebugVertex;
|
||||
@@ -1467,13 +1468,14 @@ ShaderDebugTrace *ReplayProxy::Proxied_DebugVertex(ParamSerialiser ¶mser,
|
||||
SERIALISE_ELEMENT(vertid);
|
||||
SERIALISE_ELEMENT(instid);
|
||||
SERIALISE_ELEMENT(idx);
|
||||
SERIALISE_ELEMENT(view);
|
||||
END_PARAMS();
|
||||
}
|
||||
|
||||
{
|
||||
REMOTE_EXECUTION();
|
||||
if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored)
|
||||
ret = m_Remote->DebugVertex(eventId, vertid, instid, idx);
|
||||
ret = m_Remote->DebugVertex(eventId, vertid, instid, idx, view);
|
||||
else
|
||||
ret = new ShaderDebugTrace;
|
||||
}
|
||||
@@ -1484,9 +1486,9 @@ ShaderDebugTrace *ReplayProxy::Proxied_DebugVertex(ParamSerialiser ¶mser,
|
||||
}
|
||||
|
||||
ShaderDebugTrace *ReplayProxy::DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid,
|
||||
uint32_t idx)
|
||||
uint32_t idx, uint32_t view)
|
||||
{
|
||||
PROXY_FUNCTION(DebugVertex, eventId, vertid, instid, idx);
|
||||
PROXY_FUNCTION(DebugVertex, eventId, vertid, instid, idx, view);
|
||||
}
|
||||
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
@@ -2819,7 +2821,7 @@ bool ReplayProxy::Tick(int type)
|
||||
}
|
||||
case eReplayProxy_ReplaceResource: ReplaceResource(ResourceId(), ResourceId()); break;
|
||||
case eReplayProxy_RemoveReplacement: RemoveReplacement(ResourceId()); break;
|
||||
case eReplayProxy_DebugVertex: DebugVertex(0, 0, 0, 0); break;
|
||||
case eReplayProxy_DebugVertex: DebugVertex(0, 0, 0, 0, 0); break;
|
||||
case eReplayProxy_DebugPixel: DebugPixel(0, 0, 0, 0, 0); break;
|
||||
case eReplayProxy_DebugThread:
|
||||
{
|
||||
|
||||
@@ -524,7 +524,7 @@ public:
|
||||
ResourceId target, uint32_t x, uint32_t y, const Subresource &sub,
|
||||
CompType typeCast);
|
||||
IMPLEMENT_FUNCTION_PROXIED(ShaderDebugTrace *, DebugVertex, uint32_t eventId, uint32_t vertid,
|
||||
uint32_t instid, uint32_t idx);
|
||||
uint32_t instid, uint32_t idx, uint32_t view);
|
||||
IMPLEMENT_FUNCTION_PROXIED(ShaderDebugTrace *, DebugPixel, uint32_t eventId, uint32_t x,
|
||||
uint32_t y, uint32_t sample, uint32_t primitive);
|
||||
IMPLEMENT_FUNCTION_PROXIED(ShaderDebugTrace *, DebugThread, uint32_t eventId,
|
||||
|
||||
@@ -231,7 +231,8 @@ public:
|
||||
|
||||
rdcarray<PixelModification> PixelHistory(rdcarray<EventUsage> events, ResourceId target, uint32_t x,
|
||||
uint32_t y, const Subresource &sub, CompType typeCast);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view);
|
||||
ShaderDebugTrace *DebugPixel(uint32_t eventId, uint32_t x, uint32_t y, uint32_t sample,
|
||||
uint32_t primitive);
|
||||
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
|
||||
|
||||
@@ -1709,7 +1709,7 @@ void AddCBuffersToGlobalState(const DXBCBytecode::Program &program, D3D11DebugMa
|
||||
}
|
||||
|
||||
ShaderDebugTrace *D3D11Replay::DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid,
|
||||
uint32_t idx)
|
||||
uint32_t idx, uint32_t view)
|
||||
{
|
||||
using namespace DXBCBytecode;
|
||||
using namespace DXBCDebug;
|
||||
|
||||
@@ -186,7 +186,8 @@ public:
|
||||
|
||||
rdcarray<PixelModification> PixelHistory(rdcarray<EventUsage> events, ResourceId target, uint32_t x,
|
||||
uint32_t y, const Subresource &sub, CompType typeCast);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view);
|
||||
ShaderDebugTrace *DebugPixel(uint32_t eventId, uint32_t x, uint32_t y, uint32_t sample,
|
||||
uint32_t primitive);
|
||||
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
|
||||
|
||||
@@ -1749,7 +1749,7 @@ void GatherConstantBuffers(WrappedID3D12Device *pDevice, const DXBCBytecode::Pro
|
||||
}
|
||||
|
||||
ShaderDebugTrace *D3D12Replay::DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid,
|
||||
uint32_t idx)
|
||||
uint32_t idx, uint32_t view)
|
||||
{
|
||||
using namespace DXBCBytecode;
|
||||
using namespace DXBCDebug;
|
||||
|
||||
@@ -3657,7 +3657,7 @@ rdcarray<PixelModification> GLReplay::PixelHistory(rdcarray<EventUsage> events,
|
||||
}
|
||||
|
||||
ShaderDebugTrace *GLReplay::DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid,
|
||||
uint32_t idx)
|
||||
uint32_t idx, uint32_t view)
|
||||
{
|
||||
GLNOTIMP("DebugVertex");
|
||||
return new ShaderDebugTrace();
|
||||
|
||||
@@ -218,7 +218,8 @@ public:
|
||||
|
||||
rdcarray<PixelModification> PixelHistory(rdcarray<EventUsage> events, ResourceId target, uint32_t x,
|
||||
uint32_t y, const Subresource &sub, CompType typeCast);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view);
|
||||
ShaderDebugTrace *DebugPixel(uint32_t eventId, uint32_t x, uint32_t y, uint32_t sample,
|
||||
uint32_t primitive);
|
||||
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
|
||||
|
||||
@@ -376,7 +376,8 @@ public:
|
||||
|
||||
rdcarray<PixelModification> PixelHistory(rdcarray<EventUsage> events, ResourceId target, uint32_t x,
|
||||
uint32_t y, const Subresource &sub, CompType typeCast);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view);
|
||||
ShaderDebugTrace *DebugPixel(uint32_t eventId, uint32_t x, uint32_t y, uint32_t sample,
|
||||
uint32_t primitive);
|
||||
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
|
||||
|
||||
@@ -3435,7 +3435,7 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
|
||||
}
|
||||
|
||||
ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid,
|
||||
uint32_t idx)
|
||||
uint32_t idx, uint32_t view)
|
||||
{
|
||||
if(!GetAPIProperties().shaderDebugging)
|
||||
{
|
||||
@@ -3447,7 +3447,7 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u
|
||||
VulkanCreationInfo &c = m_pDriver->m_CreationInfo;
|
||||
|
||||
rdcstr regionName =
|
||||
StringFormat::Fmt("DebugVertex @ %u of (%u,%u,%u)", eventId, vertid, instid, idx);
|
||||
StringFormat::Fmt("DebugVertex @ %u of (%u,%u,%u,%u)", eventId, vertid, instid, idx, view);
|
||||
|
||||
VkMarkerRegion region(regionName);
|
||||
|
||||
@@ -3491,6 +3491,13 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u
|
||||
VulkanAPIWrapper *apiWrapper =
|
||||
new VulkanAPIWrapper(m_pDriver, c, VK_SHADER_STAGE_VERTEX_BIT, eventId);
|
||||
|
||||
// clamp the view index to the number of multiviews, just to be sure
|
||||
size_t numViews = c.m_RenderPass[state.renderPass].subpasses[state.subpass].multiviews.size();
|
||||
if(numViews > 1)
|
||||
view = RDCMIN((uint32_t)numViews - 1, view);
|
||||
else
|
||||
view = 0;
|
||||
|
||||
std::map<ShaderBuiltin, ShaderVariable> &builtins = apiWrapper->builtin_inputs;
|
||||
builtins[ShaderBuiltin::BaseInstance] = ShaderVariable(rdcstr(), draw->instanceOffset, 0U, 0U, 0U);
|
||||
builtins[ShaderBuiltin::BaseVertex] = ShaderVariable(
|
||||
@@ -3503,6 +3510,7 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u
|
||||
else
|
||||
builtins[ShaderBuiltin::VertexIndex] = ShaderVariable(rdcstr(), vertid + vertOffset, 0U, 0U, 0U);
|
||||
builtins[ShaderBuiltin::InstanceIndex] = ShaderVariable(rdcstr(), instid + instOffset, 0U, 0U, 0U);
|
||||
builtins[ShaderBuiltin::ViewportIndex] = ShaderVariable(rdcstr(), view, 0U, 0U, 0U);
|
||||
|
||||
rdcarray<ShaderVariable> &locations = apiWrapper->location_inputs;
|
||||
for(const VulkanCreationInfo::Pipeline::Attribute &attr : pipe.vertexAttrs)
|
||||
|
||||
@@ -1582,11 +1582,12 @@ rdcarray<uint32_t> ReplayController::GetHistogram(ResourceId textureId, const Su
|
||||
return hist;
|
||||
}
|
||||
|
||||
ShaderDebugTrace *ReplayController::DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx)
|
||||
ShaderDebugTrace *ReplayController::DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx,
|
||||
uint32_t view)
|
||||
{
|
||||
CHECK_REPLAY_THREAD();
|
||||
|
||||
ShaderDebugTrace *ret = m_pDevice->DebugVertex(m_EventID, vertid, instid, idx);
|
||||
ShaderDebugTrace *ret = m_pDevice->DebugVertex(m_EventID, vertid, instid, idx, view);
|
||||
|
||||
SetFrameEvent(m_EventID, true);
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
float minval, float maxval, bool channels[4]);
|
||||
rdcarray<PixelModification> PixelHistory(ResourceId target, uint32_t x, uint32_t y,
|
||||
const Subresource &sub, CompType typeCast);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx);
|
||||
ShaderDebugTrace *DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t view);
|
||||
ShaderDebugTrace *DebugPixel(uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive);
|
||||
ShaderDebugTrace *DebugThread(const uint32_t groupid[3], const uint32_t threadid[3]);
|
||||
rdcarray<ShaderDebugState> ContinueDebug(ShaderDebugger *debugger);
|
||||
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
uint32_t x, uint32_t y, const Subresource &sub,
|
||||
CompType typeCast) = 0;
|
||||
virtual ShaderDebugTrace *DebugVertex(uint32_t eventId, uint32_t vertid, uint32_t instid,
|
||||
uint32_t idx) = 0;
|
||||
uint32_t idx, uint32_t view) = 0;
|
||||
virtual ShaderDebugTrace *DebugPixel(uint32_t eventId, uint32_t x, uint32_t y, uint32_t sample,
|
||||
uint32_t primitive) = 0;
|
||||
virtual ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
|
||||
|
||||
Reference in New Issue
Block a user