From a0b3bffda6d0d5f890eebb5266495e2add7f6116 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 8 Jul 2020 13:54:35 +0100 Subject: [PATCH] Display slices in texture details in GL pipeline state view --- .../PipelineState/GLPipelineStateViewer.cpp | 54 ++++++++++++++----- .../PipelineState/GLPipelineStateViewer.h | 3 +- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index d1124b25a..5727a8cd5 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -472,16 +472,16 @@ void GLPipelineStateViewer::setEmptyRow(RDTreeWidgetItem *node) } void GLPipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, TextureDescription *tex, - uint32_t firstMip, uint32_t numMips, - const rdcstr &completeStatus) + uint32_t firstMip, uint32_t numMips, uint32_t firstSlice, + uint32_t numSlices, const rdcstr &completeStatus) { - if((tex->mips > 1 && firstMip > 0) || numMips < tex->mips || !completeStatus.isEmpty()) + QString text; + + if(!completeStatus.isEmpty()) + text += tr("The texture is incomplete:\n%1\n\n").arg(completeStatus); + + if((tex->mips > 1 && firstMip > 0) || numMips < tex->mips) { - QString text; - - if(!completeStatus.isEmpty()) - text += tr("The texture is incomplete:\n%1\n\n").arg(completeStatus); - if(numMips == 1) text += tr("The texture has %1 mips, the view covers mip %2.").arg(tex->mips).arg(firstMip); else @@ -489,7 +489,24 @@ void GLPipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, TextureDescri .arg(tex->mips) .arg(firstMip) .arg(firstMip + numMips - 1); + } + if((tex->arraysize > 1 && firstSlice > 0) || numSlices < tex->arraysize) + { + if(numSlices == 1) + text += + tr("The texture has %1 slices, the view covers slice %2.").arg(tex->arraysize).arg(firstSlice); + else + text += tr("The texture has %1 slices, the view covers slices %2-%3.") + .arg(tex->arraysize) + .arg(firstSlice) + .arg(firstSlice + numSlices - 1); + } + + text = text.trimmed(); + + if(!text.isEmpty()) + { node->setToolTip(text); node->setBackgroundColor(QColor(127, 255, 212)); @@ -771,7 +788,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, RDLabel node->setTag(QVariant::fromValue(r.resourceId)); if(tex) - setViewDetails(node, tex, r.firstMip, r.numMips, r.completeStatus); + setViewDetails(node, tex, r.firstMip, r.numMips, 0, ~0U, r.completeStatus); if(!filledSlot) setEmptyRow(node); @@ -1140,7 +1157,8 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, RDLabel node->setTag(tag); if(im && tex) - setViewDetails(node, tex, im->mipLevel, 1); + setViewDetails(node, tex, im->mipLevel, 1, im->layered ? 0 : im->slice, + im->layered ? ~0U : 1U); if(!filledSlot) setEmptyRow(node); @@ -1873,7 +1891,7 @@ void GLPipelineStateViewer::setState() if(tex) { if(r) - setViewDetails(node, tex, r->mipLevel, 1); + setViewDetails(node, tex, r->mipLevel, 1, r->slice, r->numSlices); node->setTag(QVariant::fromValue(p)); } @@ -1902,10 +1920,22 @@ void GLPipelineStateViewer::setState() state.framebuffer.drawFBO.stencilAttachment.mipLevel, }; + uint32_t dsSlice[] = { + state.framebuffer.drawFBO.depthAttachment.slice, + state.framebuffer.drawFBO.stencilAttachment.slice, + }; + + uint32_t dsNumSlices[] = { + state.framebuffer.drawFBO.depthAttachment.numSlices, + state.framebuffer.drawFBO.stencilAttachment.numSlices, + }; + for(int dsIdx = 0; dsIdx < 2; dsIdx++) { ResourceId ds = dsObjects[dsIdx]; uint32_t mip = dsMips[dsIdx]; + uint32_t slice = dsSlice[dsIdx]; + uint32_t numSlices = dsNumSlices[dsIdx]; bool filledSlot = (ds != ResourceId()); bool usedSlot = filledSlot; @@ -1953,7 +1983,7 @@ void GLPipelineStateViewer::setState() if(tex) { - setViewDetails(node, tex, mip, 1); + setViewDetails(node, tex, mip, 1, slice, numSlices); node->setTag(QVariant::fromValue(ds)); } diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h index 3bc576f18..f871e1680 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h @@ -106,7 +106,8 @@ private: bool showNode(bool usedSlot, bool filledSlot); void setViewDetails(RDTreeWidgetItem *node, TextureDescription *tex, uint32_t firstMip, - uint32_t numMips, const rdcstr &completeStatus = rdcstr()); + uint32_t numMips, uint32_t firstSlice, uint32_t numSlices, + const rdcstr &completeStatus = rdcstr()); void exportHTML(QXmlStreamWriter &xml, const GLPipe::VertexInput &vtx); void exportHTML(QXmlStreamWriter &xml, const GLPipe::Shader &sh);