From fe8cbfcc8ce8c221aae4e6d48c3c73862a71a008 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 4 Jun 2018 20:12:27 +0100 Subject: [PATCH] Handle different actual indices vs. displayed indices exporting VS Out * For VS Out data the actual offsets may be different than displayed, so we calculate manually rather than querying the model for each index. --- qrenderdoc/Windows/BufferViewer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index ab56067b9..e7ef137cc 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -3212,7 +3212,18 @@ void BufferViewer::exportData(const BufferExport ¶ms) // offset and sizes for(int i = 0; i < model->rowCount(); i++) { - uint32_t idx = model->data(model->index(i, 1), Qt::DisplayRole).toUInt(); + // manually calculate the index so that we get the real offset (not the displayed offset) + // in the case of vertex output. + uint32_t idx = i; + + if(model->indices && model->indices->data) + { + idx = CalcIndex(model->indices, i, model->baseVertex); + + // completely omit primitive restart indices + if(model->primRestart && idx == model->primRestart) + continue; + } for(int col = 0; col < cache.count(); col++) {