mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 08:26:50 +00:00
Offset and Size consistency display in PipelineState UI
Use Formatter::HumanFormat() to get consistent formatting and to apply the UI formatting configuration mode for Offsets and Sizes i.e. Auto, Decimal, Hexadecimal.
This commit is contained in:
@@ -1198,15 +1198,22 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, RD
|
||||
|
||||
QString sizestr;
|
||||
if(bytesize == (uint32_t)length)
|
||||
sizestr = tr("%1 Variables, %2 bytes").arg(numvars).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
else
|
||||
sizestr =
|
||||
tr("%1 Variables, %2 bytes needed, %3 provided").arg(numvars).arg(bytesize).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes needed, %3 provided")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(bytesize, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
|
||||
if(length < bytesize)
|
||||
filledSlot = false;
|
||||
|
||||
QString vecrange = QFormatStr("%1 - %2").arg(b.vecOffset).arg(b.vecOffset + b.vecCount);
|
||||
QString vecrange =
|
||||
QFormatStr("%1 - %2")
|
||||
.arg(Formatter::HumanFormat(b.vecOffset, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(b.vecOffset + b.vecCount, Formatter::OffsetSize));
|
||||
|
||||
RDTreeWidgetItem *node =
|
||||
new RDTreeWidgetItem({slotname, b.resourceId, vecrange, sizestr, QString()});
|
||||
@@ -1379,7 +1386,7 @@ void D3D11PipelineStateViewer::setState()
|
||||
int i = 0;
|
||||
for(const D3D11Pipe::Layout &l : state.inputAssembly.layouts)
|
||||
{
|
||||
QString byteOffs = QString::number(l.byteOffset);
|
||||
QString byteOffs = Formatter::HumanFormat(l.byteOffset, Formatter::OffsetSize);
|
||||
|
||||
// D3D11 specific value
|
||||
if(l.byteOffset == ~0U)
|
||||
@@ -1466,10 +1473,14 @@ void D3D11PipelineStateViewer::setState()
|
||||
if(buf)
|
||||
length = buf->length;
|
||||
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem(
|
||||
{tr("Index"), state.inputAssembly.indexBuffer.resourceId,
|
||||
state.inputAssembly.indexBuffer.byteStride, state.inputAssembly.indexBuffer.byteOffset,
|
||||
(qulonglong)length, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
tr("Index"),
|
||||
state.inputAssembly.indexBuffer.resourceId,
|
||||
Formatter::HumanFormat(state.inputAssembly.indexBuffer.byteStride, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(state.inputAssembly.indexBuffer.byteOffset, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
QString iformat;
|
||||
|
||||
@@ -1554,7 +1565,14 @@ void D3D11PipelineStateViewer::setState()
|
||||
RDTreeWidgetItem *node = NULL;
|
||||
|
||||
if(filledSlot)
|
||||
node = new RDTreeWidgetItem({i, v.resourceId, v.byteStride, v.byteOffset, length, QString()});
|
||||
node = new RDTreeWidgetItem({
|
||||
i,
|
||||
v.resourceId,
|
||||
Formatter::HumanFormat(v.byteStride, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(v.byteOffset, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
else
|
||||
node =
|
||||
new RDTreeWidgetItem({i, tr("No Buffer Set"), lit("-"), lit("-"), lit("-"), QString()});
|
||||
@@ -1673,8 +1691,13 @@ void D3D11PipelineStateViewer::setState()
|
||||
if(buf)
|
||||
length = buf->length;
|
||||
|
||||
RDTreeWidgetItem *node =
|
||||
new RDTreeWidgetItem({i, s.resourceId, length, s.byteOffset, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
i,
|
||||
s.resourceId,
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(s.byteOffset, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
node->setTag(QVariant::fromValue(s.resourceId));
|
||||
|
||||
|
||||
@@ -1569,10 +1569,14 @@ void D3D12PipelineStateViewer::setShaderState(
|
||||
}
|
||||
QString sizestr;
|
||||
if(bytesize == (uint32_t)length)
|
||||
sizestr = tr("%1 Variables, %2 bytes").arg(numvars).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
else
|
||||
sizestr =
|
||||
tr("%1 Variables, %2 bytes needed, %3 provided").arg(numvars).arg(bytesize).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes needed, %3 provided")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(bytesize, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
|
||||
if(length < bytesize)
|
||||
filledSlot = false;
|
||||
@@ -1580,9 +1584,17 @@ void D3D12PipelineStateViewer::setShaderState(
|
||||
QString spaceStr = QString::number(rootElements[i].registerSpace);
|
||||
if(directHeapAccess)
|
||||
spaceStr = tr("");
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem(
|
||||
{rootel, spaceStr, regname, b.resourceId,
|
||||
QFormatStr("%1 - %2").arg(offset).arg(offset + bytesize), sizestr, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
rootel,
|
||||
spaceStr,
|
||||
regname,
|
||||
b.resourceId,
|
||||
QFormatStr("%1 - %2")
|
||||
.arg(Formatter::HumanFormat(offset, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(offset + bytesize, Formatter::OffsetSize)),
|
||||
sizestr,
|
||||
QString(),
|
||||
});
|
||||
|
||||
node->setTag(cbuftag);
|
||||
|
||||
@@ -1709,7 +1721,7 @@ void D3D12PipelineStateViewer::setState()
|
||||
int i = 0;
|
||||
for(const D3D12Pipe::Layout &l : state.inputAssembly.layouts)
|
||||
{
|
||||
QString byteOffs = QString::number(l.byteOffset);
|
||||
QString byteOffs = Formatter::HumanFormat(l.byteOffset, Formatter::OffsetSize);
|
||||
|
||||
// D3D12 specific value
|
||||
if(l.byteOffset == ~0U)
|
||||
@@ -2046,9 +2058,15 @@ void D3D12PipelineStateViewer::setState()
|
||||
|
||||
BufferDescription *buf = m_Ctx.GetBuffer(s.resourceId);
|
||||
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem(
|
||||
{i, s.resourceId, (qulonglong)s.byteOffset, length, s.writtenCountResourceId,
|
||||
(qulonglong)s.writtenCountByteOffset, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
i,
|
||||
s.resourceId,
|
||||
Formatter::HumanFormat(s.byteOffset, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
s.writtenCountResourceId,
|
||||
Formatter::HumanFormat(s.writtenCountByteOffset, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
node->setTag(QVariant::fromValue(s.resourceId));
|
||||
|
||||
|
||||
@@ -1098,15 +1098,21 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, RDLabel
|
||||
}
|
||||
|
||||
if(length == byteSize)
|
||||
sizestr = tr("%1 Variables, %2 bytes").arg(numvars).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
else
|
||||
sizestr =
|
||||
tr("%1 Variables, %2 bytes needed, %3 provided").arg(numvars).arg(byteSize).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes needed, %3 provided")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(byteSize, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
|
||||
if(length < byteSize)
|
||||
filledSlot = false;
|
||||
|
||||
byterange = QFormatStr("%1 - %2").arg(offset).arg(offset + length);
|
||||
byterange = QFormatStr("%1 - %2")
|
||||
.arg(Formatter::HumanFormat(offset, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(offset + length, Formatter::OffsetSize));
|
||||
|
||||
RDTreeWidgetItem *node =
|
||||
new RDTreeWidgetItem({slotname, b.resourceId, byterange, sizestr, QString()});
|
||||
@@ -1410,9 +1416,15 @@ void GLPipelineStateViewer::setState()
|
||||
else if(a.floatCast)
|
||||
format += tr(" Cast to float");
|
||||
|
||||
RDTreeWidgetItem *node =
|
||||
new RDTreeWidgetItem({i, a.enabled ? tr("Enabled") : tr("Disabled"), name, format,
|
||||
a.vertexBufferSlot, a.byteOffset, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
i,
|
||||
a.enabled ? tr("Enabled") : tr("Disabled"),
|
||||
name,
|
||||
format,
|
||||
a.vertexBufferSlot,
|
||||
Formatter::HumanFormat(a.byteOffset, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
node->setTag(i);
|
||||
|
||||
@@ -1483,9 +1495,15 @@ void GLPipelineStateViewer::setState()
|
||||
if(buf)
|
||||
length = buf->length;
|
||||
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({tr("Element"), state.vertexInput.indexBuffer,
|
||||
state.vertexInput.indexByteStride, 0, 0,
|
||||
(qulonglong)length, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
tr("Element"),
|
||||
state.vertexInput.indexBuffer,
|
||||
Formatter::HumanFormat(state.vertexInput.indexByteStride, Formatter::OffsetSize),
|
||||
0,
|
||||
0,
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
QString iformat;
|
||||
if(action)
|
||||
@@ -1568,9 +1586,15 @@ void GLPipelineStateViewer::setState()
|
||||
if(buf)
|
||||
length = buf->length;
|
||||
|
||||
RDTreeWidgetItem *node =
|
||||
new RDTreeWidgetItem({i, v.resourceId, v.byteStride, (qulonglong)offset,
|
||||
v.instanceDivisor, (qulonglong)length, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
i,
|
||||
v.resourceId,
|
||||
Formatter::HumanFormat(v.byteStride, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(offset, Formatter::OffsetSize),
|
||||
v.instanceDivisor,
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
node->setTag(QVariant::fromValue(
|
||||
GLVBIBTag(v.resourceId, v.byteOffset, m_Common.GetVBufferFormatString(i))));
|
||||
@@ -1653,9 +1677,13 @@ void GLPipelineStateViewer::setState()
|
||||
if(buf)
|
||||
length = buf->length;
|
||||
|
||||
RDTreeWidgetItem *node =
|
||||
new RDTreeWidgetItem({i, state.transformFeedback.bufferResourceId[i], length,
|
||||
(qulonglong)state.transformFeedback.byteOffset[i], QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
i,
|
||||
state.transformFeedback.bufferResourceId[i],
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(state.transformFeedback.byteOffset[i], Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
node->setTag(QVariant::fromValue(state.transformFeedback.bufferResourceId[i]));
|
||||
|
||||
|
||||
@@ -778,9 +778,9 @@ bool VulkanPipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const bin
|
||||
if(view.byteOffset > 0 || view.byteSize < buf->length)
|
||||
{
|
||||
text += tr("The view covers bytes %1-%2.\nThe buffer is %3 bytes in length.\n")
|
||||
.arg(view.byteOffset)
|
||||
.arg(view.byteOffset + view.byteSize)
|
||||
.arg(buf->length);
|
||||
.arg(Formatter::HumanFormat(view.byteOffset, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(view.byteOffset + view.byteSize, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(buf->length, Formatter::OffsetSize));
|
||||
}
|
||||
else if(stageBitsIncluded)
|
||||
{
|
||||
@@ -824,14 +824,17 @@ QString VulkanPipelineStateViewer::formatByteRange(const BufferDescription *buf,
|
||||
else if(descriptorBind->byteSize == UINT64_MAX)
|
||||
{
|
||||
return QFormatStr("%1 - %2 (VK_WHOLE_SIZE)")
|
||||
.arg(descriptorBind->byteOffset)
|
||||
.arg(descriptorBind->byteOffset + (buf->length - descriptorBind->byteOffset));
|
||||
.arg(Formatter::HumanFormat(descriptorBind->byteOffset, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(
|
||||
descriptorBind->byteOffset + (buf->length - descriptorBind->byteOffset),
|
||||
Formatter::OffsetSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
return QFormatStr("%1 - %2")
|
||||
.arg(descriptorBind->byteOffset)
|
||||
.arg(descriptorBind->byteOffset + descriptorBind->byteSize);
|
||||
.arg(Formatter::HumanFormat(descriptorBind->byteOffset, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(descriptorBind->byteOffset + descriptorBind->byteSize,
|
||||
Formatter::OffsetSize));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1517,7 +1520,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails,
|
||||
slotname,
|
||||
ToQStr(bindType),
|
||||
descriptorBind ? descriptorBind->resourceResourceId : ResourceId(),
|
||||
tr("%1 bytes").arg(len),
|
||||
tr("%1 bytes").arg(Formatter::HumanFormat(len, Formatter::OffsetSize)),
|
||||
QFormatStr("Viewing bytes %1").arg(formatByteRange(buf, descriptorBind)),
|
||||
QString(),
|
||||
});
|
||||
@@ -1948,22 +1951,29 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta
|
||||
|
||||
if(descriptorBind && descriptorBind->inlineBlock)
|
||||
{
|
||||
vecrange = QFormatStr("%1 - %2 bytes")
|
||||
.arg(descriptorBind->byteOffset)
|
||||
.arg(descriptorBind->byteOffset + descriptorBind->byteSize);
|
||||
vecrange =
|
||||
QFormatStr("%1 - %2 bytes")
|
||||
.arg(Formatter::HumanFormat(descriptorBind->byteOffset, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(descriptorBind->byteOffset + descriptorBind->byteSize,
|
||||
Formatter::OffsetSize));
|
||||
}
|
||||
else if(!cblock->compileConstants)
|
||||
{
|
||||
vecrange = QFormatStr("%1 - %2 bytes")
|
||||
.arg(stage.pushConstantRangeByteOffset)
|
||||
.arg(stage.pushConstantRangeByteOffset + stage.pushConstantRangeByteSize);
|
||||
.arg(Formatter::HumanFormat(stage.pushConstantRangeByteOffset,
|
||||
Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(
|
||||
stage.pushConstantRangeByteOffset + stage.pushConstantRangeByteSize,
|
||||
Formatter::OffsetSize));
|
||||
|
||||
if(stage.pushConstantRangeByteOffset + stage.pushConstantRangeByteSize >
|
||||
m_Ctx.CurVulkanPipelineState()->pushconsts.size())
|
||||
{
|
||||
filledSlot = false;
|
||||
vecrange +=
|
||||
tr(", only %1 bytes pushed").arg(m_Ctx.CurVulkanPipelineState()->pushconsts.size());
|
||||
tr(", only %1 bytes pushed")
|
||||
.arg(Formatter::HumanFormat(m_Ctx.CurVulkanPipelineState()->pushconsts.size(),
|
||||
Formatter::OffsetSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1972,14 +1982,18 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta
|
||||
if(descriptorBind && descriptorBind->inlineBlock)
|
||||
{
|
||||
name = tr("Inline block");
|
||||
vecrange = tr("%1 bytes").arg(length);
|
||||
vecrange = tr("%1 bytes").arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
}
|
||||
|
||||
if(length == byteSize)
|
||||
sizestr = tr("%1 Variables, %2 bytes").arg(numvars).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
else
|
||||
sizestr =
|
||||
tr("%1 Variables, %2 bytes needed, %3 provided").arg(numvars).arg(byteSize).arg(length);
|
||||
sizestr = tr("%1 Variables, %2 bytes needed, %3 provided")
|
||||
.arg(numvars)
|
||||
.arg(Formatter::HumanFormat(byteSize, Formatter::OffsetSize))
|
||||
.arg(Formatter::HumanFormat(length, Formatter::OffsetSize));
|
||||
|
||||
if(length < byteSize)
|
||||
filledSlot = false;
|
||||
@@ -2664,9 +2678,16 @@ void VulkanPipelineStateViewer::setState()
|
||||
if(buf && length == UINT64_MAX)
|
||||
length = buf->length - s.byteOffset;
|
||||
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem(
|
||||
{i, s.active ? tr("Active") : tr("Inactive"), s.bufferResourceId, (qulonglong)s.byteOffset,
|
||||
length, s.counterBufferResourceId, (qulonglong)s.counterBufferOffset, QString()});
|
||||
RDTreeWidgetItem *node = new RDTreeWidgetItem({
|
||||
i,
|
||||
s.active ? tr("Active") : tr("Inactive"),
|
||||
s.bufferResourceId,
|
||||
Formatter::HumanFormat(s.byteOffset, Formatter::OffsetSize),
|
||||
Formatter::HumanFormat(length, Formatter::OffsetSize),
|
||||
s.counterBufferResourceId,
|
||||
Formatter::HumanFormat(s.counterBufferOffset, Formatter::OffsetSize),
|
||||
QString(),
|
||||
});
|
||||
|
||||
node->setTag(QVariant::fromValue(
|
||||
VulkanBufferTag(false, ~0U, ResourceFormat(), s.bufferResourceId, s.byteOffset, length)));
|
||||
|
||||
Reference in New Issue
Block a user