Fix texture-as-buffer view format string generation

This commit is contained in:
baldurk
2022-05-23 14:43:08 +01:00
parent 6db5e339bb
commit c5a588d2e4
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -2214,7 +2214,7 @@ QString BufferFormatter::GetTextureFormatString(const TextureDescription &tex)
if(tex.type == TextureType::Buffer)
return QFormatStr("%1 %2;").arg(baseType).arg(varName);
return QFormatStr("%1 %2[%3];").arg(baseType).arg(varName).arg(w);
return QFormatStr("struct row\n{\n %1 %2[%3];\n};\n\nrow r[];").arg(baseType).arg(varName).arg(w);
}
QString BufferFormatter::GetBufferFormatString(Packing::Rules pack, const ShaderResource &res,
@@ -150,6 +150,8 @@ void BufferFormatSpecifier::setAutoFormat(QString autoFormat)
setFormat(autoFormat);
formatText->emptyUndoBuffer();
on_apply_clicked();
}
void BufferFormatSpecifier::setContext(ICaptureContext *ctx)
+2 -5
View File
@@ -4163,8 +4163,6 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId
m_PagingByteOffset = 0;
ui->formatSpecifier->setAutoFormat(format);
processFormat(format);
}
BufferViewer *BufferViewer::HasCBufferView(ShaderStage stage, uint32_t slot, uint32_t idx)
@@ -4214,8 +4212,7 @@ void BufferViewer::ViewCBuffer(const ShaderStage stage, uint32_t slot, uint32_t
ui->formatSpecifier->setFormat(QString());
ui->formatSpecifier->setVisible(false);
processFormat(QString());
ui->formatSpecifier->setAutoFormat(QString());
m_CBufferViews.push_back(this);
}
@@ -4239,7 +4236,7 @@ void BufferViewer::ViewTexture(ResourceId id, const Subresource &sub, const rdcs
m_PagingByteOffset = 0;
processFormat(format);
ui->formatSpecifier->setAutoFormat(format);
}
void BufferViewer::ScrollToRow(int32_t row, MeshDataStage stage)