mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-09 00:01:07 +00:00
Display generic mesh input attrs, and add ---s for out of bounds access
This commit is contained in:
@@ -697,6 +697,7 @@ QVector<VertexInputAttribute> CommonPipelineState::GetVertexInputs()
|
||||
ret[i].Format = layouts[i].Format;
|
||||
memset(&ret[i].GenericValue, 0, sizeof(PixelValue));
|
||||
ret[i].Used = false;
|
||||
ret[i].GenericEnabled = false;
|
||||
|
||||
if(m_D3D11->m_IA.Bytecode != NULL)
|
||||
{
|
||||
@@ -754,6 +755,7 @@ QVector<VertexInputAttribute> CommonPipelineState::GetVertexInputs()
|
||||
ret[i].Format = layouts[i].Format;
|
||||
memset(&ret[i].GenericValue, 0, sizeof(PixelValue));
|
||||
ret[i].Used = false;
|
||||
ret[i].GenericEnabled = false;
|
||||
|
||||
if(m_D3D12->m_VS.ShaderDetails != NULL)
|
||||
{
|
||||
@@ -801,6 +803,7 @@ QVector<VertexInputAttribute> CommonPipelineState::GetVertexInputs()
|
||||
ret[a].InstanceRate = (int)m_GL->m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor;
|
||||
ret[a].Format = attrs[i].Format;
|
||||
ret[a].Used = true;
|
||||
ret[a].GenericEnabled = false;
|
||||
|
||||
if(m_GL->m_VS.ShaderDetails != NULL)
|
||||
{
|
||||
@@ -831,6 +834,8 @@ QVector<VertexInputAttribute> CommonPipelineState::GetVertexInputs()
|
||||
ret[a].GenericValue.value_f[c] = (float)attrs[i].GenericValue.value_i[c];
|
||||
}
|
||||
|
||||
ret[a].GenericEnabled = true;
|
||||
|
||||
ret[a].PerInstance = false;
|
||||
ret[a].InstanceRate = 0;
|
||||
ret[a].Format.compByteWidth = 4;
|
||||
@@ -880,6 +885,7 @@ QVector<VertexInputAttribute> CommonPipelineState::GetVertexInputs()
|
||||
ret[a].InstanceRate = 1;
|
||||
ret[a].Format = attrs[i].format;
|
||||
ret[a].Used = true;
|
||||
ret[a].GenericEnabled = false;
|
||||
|
||||
if(m_Vulkan->m_VS.ShaderDetails != NULL)
|
||||
{
|
||||
|
||||
@@ -105,6 +105,8 @@ from the vertex buffer before advancing to the next value.
|
||||
no VB bound.
|
||||
)");
|
||||
PixelValue GenericValue;
|
||||
DOCUMENT("``True`` if this attribute is using :data:`GenericValue` for its data.");
|
||||
bool GenericEnabled;
|
||||
DOCUMENT("``True`` if this attribute is enabled and used by the vertex shader.");
|
||||
bool Used;
|
||||
};
|
||||
|
||||
@@ -590,7 +590,7 @@ public:
|
||||
return col == 1 ? lit("--") : lit(" Restart");
|
||||
|
||||
if(idx == ~0U)
|
||||
return QVariant();
|
||||
return outOfBounds();
|
||||
}
|
||||
|
||||
if(col == 1 && meshView)
|
||||
@@ -599,11 +599,17 @@ public:
|
||||
if(displayIndices && displayIndices->data)
|
||||
idx = CalcIndex(displayIndices, row, baseVertex);
|
||||
|
||||
if(idx == ~0U)
|
||||
return outOfBounds();
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
const FormatElement &el = elementForColumn(col);
|
||||
|
||||
if(useGenerics(col))
|
||||
return interpretGeneric(col, el);
|
||||
|
||||
uint32_t instIdx = 0;
|
||||
if(el.instancerate > 0)
|
||||
instIdx = curInstance / el.instancerate;
|
||||
@@ -647,6 +653,8 @@ public:
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return outOfBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -669,6 +677,8 @@ public:
|
||||
BufferData *indices = NULL;
|
||||
|
||||
QList<FormatElement> columns;
|
||||
QVector<PixelValue> generics;
|
||||
QVector<bool> genericsEnabled;
|
||||
QList<BufferData *> buffers;
|
||||
uint32_t primRestart = 0;
|
||||
|
||||
@@ -741,6 +751,12 @@ public:
|
||||
return columns[columnLookup[col - reservedColumnCount()]];
|
||||
}
|
||||
|
||||
bool useGenerics(int col) const
|
||||
{
|
||||
col = columnLookup[col - reservedColumnCount()];
|
||||
return col < genericsEnabled.size() && genericsEnabled[col];
|
||||
}
|
||||
|
||||
private:
|
||||
// maps from column number (0-based from data, so excluding VTX/IDX columns)
|
||||
// to the column element in the columns list, and lists its component.
|
||||
@@ -829,7 +845,33 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
QString interpretVariant(QVariant &v, const FormatElement &el) const
|
||||
QString outOfBounds() const { return lit("---"); }
|
||||
QString interpretGeneric(int col, const FormatElement &el) const
|
||||
{
|
||||
int comp = componentForIndex(col);
|
||||
|
||||
col = columnLookup[col - reservedColumnCount()];
|
||||
|
||||
if(col < generics.size())
|
||||
{
|
||||
if(el.format.compType == CompType::Float)
|
||||
{
|
||||
return interpretVariant(QVariant(generics[col].value_f[comp]), el);
|
||||
}
|
||||
else if(el.format.compType == CompType::SInt)
|
||||
{
|
||||
return interpretVariant(QVariant(generics[col].value_i[comp]), el);
|
||||
}
|
||||
else if(el.format.compType == CompType::UInt)
|
||||
{
|
||||
return interpretVariant(QVariant(generics[col].value_u[comp]), el);
|
||||
}
|
||||
}
|
||||
|
||||
return outOfBounds();
|
||||
}
|
||||
|
||||
QString interpretVariant(const QVariant &v, const FormatElement &el) const
|
||||
{
|
||||
QString ret;
|
||||
|
||||
@@ -2180,6 +2222,8 @@ void BufferViewer::configureMeshColumns()
|
||||
QVector<VertexInputAttribute> vinputs = m_Ctx.CurPipelineState().GetVertexInputs();
|
||||
|
||||
m_ModelVSIn->columns.reserve(vinputs.count());
|
||||
m_ModelVSIn->genericsEnabled.resize(vinputs.count());
|
||||
m_ModelVSIn->generics.resize(vinputs.count());
|
||||
|
||||
for(const VertexInputAttribute &a : vinputs)
|
||||
{
|
||||
@@ -2191,6 +2235,14 @@ void BufferViewer::configureMeshColumns()
|
||||
1, // matrix dimension
|
||||
a.Format, false, false);
|
||||
|
||||
m_ModelVSIn->genericsEnabled[m_ModelVSIn->columns.size()] = false;
|
||||
|
||||
if(a.GenericEnabled)
|
||||
{
|
||||
m_ModelVSIn->genericsEnabled[m_ModelVSIn->columns.size()] = true;
|
||||
m_ModelVSIn->generics[m_ModelVSIn->columns.size()] = a.GenericValue;
|
||||
}
|
||||
|
||||
m_ModelVSIn->columns.push_back(f);
|
||||
}
|
||||
|
||||
@@ -2716,6 +2768,8 @@ void BufferViewer::ClearModels()
|
||||
|
||||
m->buffers.clear();
|
||||
m->columns.clear();
|
||||
m->generics.clear();
|
||||
m->genericsEnabled.clear();
|
||||
m->numRows = 0;
|
||||
|
||||
m->endReset();
|
||||
|
||||
Reference in New Issue
Block a user