mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Tweak a few things in the pipeline state & config interfaces
* Remove reference out parameters that aren't a good fit for python bindings, and change a few names to make a better interface.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "QRDInterface.h"
|
||||
|
||||
QString CommonPipelineState::GetImageLayout(ResourceId id)
|
||||
QString CommonPipelineState::GetResourceLayout(ResourceId id)
|
||||
{
|
||||
if(LogLoaded())
|
||||
{
|
||||
@@ -496,42 +496,36 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CommonPipelineState::GetIBuffer(ResourceId &buf, uint64_t &ByteOffset)
|
||||
QPair<ResourceId, uint64_t> CommonPipelineState::GetIBuffer()
|
||||
{
|
||||
ResourceId buf;
|
||||
uint64_t ByteOffset = 0;
|
||||
|
||||
if(LogLoaded())
|
||||
{
|
||||
if(IsLogD3D11())
|
||||
{
|
||||
buf = m_D3D11->m_IA.ibuffer.Buffer;
|
||||
ByteOffset = m_D3D11->m_IA.ibuffer.Offset;
|
||||
|
||||
return;
|
||||
}
|
||||
else if(IsLogD3D12())
|
||||
{
|
||||
buf = m_D3D12->m_IA.ibuffer.Buffer;
|
||||
ByteOffset = m_D3D12->m_IA.ibuffer.Offset;
|
||||
|
||||
return;
|
||||
}
|
||||
else if(IsLogGL())
|
||||
{
|
||||
buf = m_GL->m_VtxIn.ibuffer;
|
||||
ByteOffset = 0; // GL only has per-draw index offset
|
||||
|
||||
return;
|
||||
}
|
||||
else if(IsLogVK())
|
||||
{
|
||||
buf = m_Vulkan->IA.ibuffer.buf;
|
||||
ByteOffset = m_Vulkan->IA.ibuffer.offs;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
buf = ResourceId();
|
||||
ByteOffset = 0;
|
||||
return qMakePair(buf, ByteOffset);
|
||||
}
|
||||
|
||||
bool CommonPipelineState::IsStripRestartEnabled()
|
||||
@@ -888,9 +882,13 @@ QVector<VertexInputAttribute> CommonPipelineState::GetVertexInputs()
|
||||
return QVector<VertexInputAttribute>();
|
||||
}
|
||||
|
||||
void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx, uint32_t ArrayIdx,
|
||||
ResourceId &buf, uint64_t &ByteOffset, uint64_t &ByteSize)
|
||||
BoundCBuffer CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx,
|
||||
uint32_t ArrayIdx)
|
||||
{
|
||||
ResourceId buf;
|
||||
uint64_t ByteOffset = 0;
|
||||
uint64_t ByteSize = 0;
|
||||
|
||||
if(LogLoaded())
|
||||
{
|
||||
if(IsLogD3D11())
|
||||
@@ -902,8 +900,6 @@ void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx,
|
||||
buf = s.ConstantBuffers[BufIdx].Buffer;
|
||||
ByteOffset = s.ConstantBuffers[BufIdx].VecOffset * 4 * sizeof(float);
|
||||
ByteSize = s.ConstantBuffers[BufIdx].VecCount * 4 * sizeof(float);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(IsLogD3D12())
|
||||
@@ -916,20 +912,13 @@ void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx,
|
||||
s.BindpointMapping.ConstantBlocks[s.ShaderDetails->ConstantBlocks[BufIdx].bindPoint];
|
||||
|
||||
if(bind.bindset >= s.Spaces.count || bind.bind >= s.Spaces[bind.bindset].ConstantBuffers.count)
|
||||
{
|
||||
buf = ResourceId();
|
||||
ByteOffset = 0;
|
||||
ByteSize = 0;
|
||||
return;
|
||||
}
|
||||
return BoundCBuffer();
|
||||
|
||||
const D3D12Pipe::CBuffer &descriptor = s.Spaces[bind.bindset].ConstantBuffers[bind.bind];
|
||||
|
||||
buf = descriptor.Buffer;
|
||||
ByteOffset = descriptor.Offset;
|
||||
ByteSize = descriptor.ByteSize;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(IsLogGL())
|
||||
@@ -949,8 +938,6 @@ void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx,
|
||||
buf = b.Resource;
|
||||
ByteOffset = b.Offset;
|
||||
ByteSize = b.Size;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -967,11 +954,10 @@ void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx,
|
||||
|
||||
if(s.ShaderDetails->ConstantBlocks[BufIdx].bufferBacked == false)
|
||||
{
|
||||
// dummy values, it would be nice to fetch these properly
|
||||
buf = ResourceId();
|
||||
ByteOffset = 0;
|
||||
ByteSize = 1024;
|
||||
return;
|
||||
BoundCBuffer ret;
|
||||
// dummy value, it would be nice to fetch this properly
|
||||
ret.ByteSize = 1024;
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto &descriptorBind = pipe.DescSets[bind.bindset].bindings[bind.bind].binds[ArrayIdx];
|
||||
@@ -979,15 +965,17 @@ void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx,
|
||||
buf = descriptorBind.res;
|
||||
ByteOffset = descriptorBind.offset;
|
||||
ByteSize = descriptorBind.size;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buf = ResourceId();
|
||||
ByteOffset = 0;
|
||||
ByteSize = 0;
|
||||
BoundCBuffer ret;
|
||||
|
||||
ret.Buffer = buf;
|
||||
ret.ByteOffset = ByteOffset;
|
||||
ret.ByteSize = ByteSize;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QMap<BindpointMap, QVector<BoundResource>> CommonPipelineState::GetReadOnlyResources(ShaderStage stage)
|
||||
|
||||
@@ -61,6 +61,15 @@ struct BoundVBuffer
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(BoundVBuffer);
|
||||
|
||||
struct BoundCBuffer
|
||||
{
|
||||
ResourceId Buffer;
|
||||
uint64_t ByteOffset = 0;
|
||||
uint32_t ByteSize = 0;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(BoundCBuffer);
|
||||
|
||||
struct VertexInputAttribute
|
||||
{
|
||||
QString Name;
|
||||
@@ -153,7 +162,7 @@ public:
|
||||
// or transform feedback have tightly packed data, but APIs that rewrite
|
||||
// shaders to dump data might have these alignment requirements
|
||||
bool HasAlignedPostVSData() { return LogLoaded() && IsLogVK(); }
|
||||
QString GetImageLayout(ResourceId id);
|
||||
QString GetResourceLayout(ResourceId id);
|
||||
QString Abbrev(ShaderStage stage);
|
||||
QString OutputAbbrev();
|
||||
|
||||
@@ -164,13 +173,12 @@ public:
|
||||
ResourceId GetShader(ShaderStage stage);
|
||||
QString GetShaderName(ShaderStage stage);
|
||||
QString GetShaderExtension();
|
||||
void GetIBuffer(ResourceId &buf, uint64_t &ByteOffset);
|
||||
QPair<ResourceId, uint64_t> GetIBuffer();
|
||||
bool IsStripRestartEnabled();
|
||||
uint32_t GetStripRestartIndex(uint32_t indexByteWidth);
|
||||
QVector<BoundVBuffer> GetVBuffers();
|
||||
QVector<VertexInputAttribute> GetVertexInputs();
|
||||
void GetConstantBuffer(ShaderStage stage, uint32_t BufIdx, uint32_t ArrayIdx, ResourceId &buf,
|
||||
uint64_t &ByteOffset, uint64_t &ByteSize);
|
||||
BoundCBuffer GetConstantBuffer(ShaderStage stage, uint32_t BufIdx, uint32_t ArrayIdx);
|
||||
QMap<BindpointMap, QVector<BoundResource>> GetReadOnlyResources(ShaderStage stage);
|
||||
QMap<BindpointMap, QVector<BoundResource>> GetReadWriteResources(ShaderStage stage);
|
||||
BoundResource GetDepthTarget();
|
||||
|
||||
@@ -61,8 +61,6 @@ DECLARE_REFLECTION_STRUCT(SPIRVDisassembler);
|
||||
\
|
||||
CONFIG_SETTING(public, QVariantList, QList<QString>, RecentCaptureSettings) \
|
||||
\
|
||||
CONFIG_SETTING_VAL(public, int, int, CallstackLevelSkip, 0) \
|
||||
\
|
||||
CONFIG_SETTING_VAL(public, QString, QString, TemporaryCaptureDirectory, "") \
|
||||
\
|
||||
CONFIG_SETTING_VAL(public, QString, QString, DefaultCaptureSaveDirectory, "") \
|
||||
@@ -132,15 +130,15 @@ enum class TimeUnit : int
|
||||
Count,
|
||||
};
|
||||
|
||||
inline QString UnitPrefix(TimeUnit t)
|
||||
inline QString UnitSuffix(TimeUnit unit)
|
||||
{
|
||||
if(t == TimeUnit::Seconds)
|
||||
if(unit == TimeUnit::Seconds)
|
||||
return "s";
|
||||
else if(t == TimeUnit::Milliseconds)
|
||||
else if(unit == TimeUnit::Milliseconds)
|
||||
return "ms";
|
||||
else if(t == TimeUnit::Microseconds)
|
||||
else if(unit == TimeUnit::Microseconds)
|
||||
return "µs";
|
||||
else if(t == TimeUnit::Nanoseconds)
|
||||
else if(unit == TimeUnit::Nanoseconds)
|
||||
return "ns";
|
||||
|
||||
return "s";
|
||||
|
||||
@@ -1295,15 +1295,13 @@ void BufferViewer::RT_FetchMeshData(IReplayController *r)
|
||||
{
|
||||
const DrawcallDescription *draw = m_Ctx.CurDrawcall();
|
||||
|
||||
ResourceId ib;
|
||||
uint64_t ioffset = 0;
|
||||
m_Ctx.CurPipelineState().GetIBuffer(ib, ioffset);
|
||||
QPair<ResourceId, uint64_t> ib = m_Ctx.CurPipelineState().GetIBuffer();
|
||||
|
||||
QVector<BoundVBuffer> vbs = m_Ctx.CurPipelineState().GetVBuffers();
|
||||
|
||||
rdctype::array<byte> idata;
|
||||
if(ib != ResourceId() && draw && (draw->flags & DrawFlags::UseIBuffer))
|
||||
idata = r->GetBufferData(ib, ioffset + draw->indexOffset * draw->indexByteWidth,
|
||||
if(ib.first != ResourceId() && draw && (draw->flags & DrawFlags::UseIBuffer))
|
||||
idata = r->GetBufferData(ib.first, ib.second + draw->indexOffset * draw->indexByteWidth,
|
||||
draw->numIndices * draw->indexByteWidth);
|
||||
|
||||
uint32_t *indices = NULL;
|
||||
@@ -1416,7 +1414,7 @@ void BufferViewer::RT_FetchMeshData(IReplayController *r)
|
||||
m_ModelVSOut->numRows = m_PostVS.numVerts;
|
||||
|
||||
if(draw && m_PostVS.idxbuf != ResourceId() && (draw->flags & DrawFlags::UseIBuffer))
|
||||
idata = r->GetBufferData(m_PostVS.idxbuf, ioffset + draw->indexOffset * draw->indexByteWidth,
|
||||
idata = r->GetBufferData(m_PostVS.idxbuf, ib.second + draw->indexOffset * draw->indexByteWidth,
|
||||
draw->numIndices * draw->indexByteWidth);
|
||||
|
||||
indices = NULL;
|
||||
@@ -1824,7 +1822,9 @@ void BufferViewer::updatePreviewColumns()
|
||||
m_VSInPosition.topo = draw->topology;
|
||||
m_VSInPosition.idxByteWidth = draw->indexByteWidth;
|
||||
m_VSInPosition.baseVertex = draw->baseVertex;
|
||||
m_Ctx.CurPipelineState().GetIBuffer(m_VSInPosition.idxbuf, m_VSInPosition.idxoffs);
|
||||
QPair<ResourceId, uint64_t> ib = m_Ctx.CurPipelineState().GetIBuffer();
|
||||
m_VSInPosition.idxbuf = ib.first;
|
||||
m_VSInPosition.idxoffs = ib.second;
|
||||
|
||||
{
|
||||
const FormatElement &el = m_ModelVSIn->columns[elIdx];
|
||||
|
||||
@@ -92,9 +92,10 @@ void ConstantBufferPreviewer::OnLogfileClosed()
|
||||
|
||||
void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
uint64_t offs = 0;
|
||||
uint64_t size = 0;
|
||||
m_Ctx.CurPipelineState().GetConstantBuffer(m_stage, m_slot, m_arrayIdx, m_cbuffer, offs, size);
|
||||
BoundCBuffer cb = m_Ctx.CurPipelineState().GetConstantBuffer(m_stage, m_slot, m_arrayIdx);
|
||||
m_cbuffer = cb.Buffer;
|
||||
uint64_t offs = cb.ByteOffset;
|
||||
uint64_t size = cb.ByteSize;
|
||||
|
||||
m_shader = m_Ctx.CurPipelineState().GetShader(m_stage);
|
||||
QString entryPoint = m_Ctx.CurPipelineState().GetShaderEntryPoint(m_stage);
|
||||
|
||||
@@ -46,7 +46,7 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
|
||||
for(int i = 0; i < (int)TimeUnit::Count; i++)
|
||||
{
|
||||
ui->EventBrowser_TimeUnit->addItem(UnitPrefix((TimeUnit)i));
|
||||
ui->EventBrowser_TimeUnit->addItem(UnitSuffix((TimeUnit)i));
|
||||
}
|
||||
|
||||
ui->pages->clearSelection();
|
||||
|
||||
@@ -1793,7 +1793,7 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array<
|
||||
if(m_Ctx.CurPipelineState().SupportsBarriers())
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
imageLayout.setText(tr("Image is in layout ") + m_Ctx.CurPipelineState().GetImageLayout(id));
|
||||
imageLayout.setText(tr("Image is in layout ") + m_Ctx.CurPipelineState().GetResourceLayout(id));
|
||||
contextMenu.addAction(&imageLayout);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user