From 51c50e0da3b9ee5cd4f364ae853c72a7a1d439d2 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 17 May 2019 12:04:45 +0100 Subject: [PATCH] Localise addressing mode state display for GL * On GL addressing modes are called wrap modes, and the wrap value is then known as repeat. If we don't 'localise' this then it can be confusing to show that it is "Wrap". --- qrenderdoc/Code/QRDUtils.cpp | 30 +++++++++++++++++++ qrenderdoc/Code/QRDUtils.h | 3 ++ .../D3D11PipelineStateViewer.cpp | 8 +++-- .../D3D12PipelineStateViewer.cpp | 8 +++-- .../PipelineState/GLPipelineStateViewer.cpp | 8 +++-- .../VulkanPipelineStateViewer.cpp | 5 ++-- renderdoc/api/replay/renderdoc_tostr.inl | 2 +- renderdoc/api/replay/replay_enums.h | 15 ++++++++++ 8 files changed, 70 insertions(+), 9 deletions(-) diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 3f04915b5..221ae134f 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -807,6 +807,36 @@ QString ToQStr(const ShaderStage stage, const GraphicsAPI apitype) return lit("Unknown"); } +QString ToQStr(const AddressMode addr, const GraphicsAPI apitype) +{ + if(IsD3D(apitype)) + { + switch(addr) + { + case AddressMode::Wrap: return lit("Wrap"); + case AddressMode::Mirror: return lit("Mirror"); + case AddressMode::MirrorOnce: return lit("MirrorOnce"); + case AddressMode::ClampEdge: return lit("ClampEdge"); + case AddressMode::ClampBorder: return lit("ClampBorder"); + default: break; + } + } + else + { + switch(addr) + { + case AddressMode::Repeat: return lit("Repeat"); + case AddressMode::MirrorRepeat: return lit("MirrorRepeat"); + case AddressMode::MirrorClamp: return lit("MirrorClamp"); + case AddressMode::ClampEdge: return lit("ClampEdge"); + case AddressMode::ClampBorder: return lit("ClampBorder"); + default: break; + } + } + + return lit("Unknown"); +} + QString TypeString(const SigParameter &sig) { QString ret = lit(""); diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index ee95fa56d..f71cd4539 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -61,6 +61,9 @@ QString ToQStr(const ResourceUsage usage, const GraphicsAPI apitype); // overload for a couple of things that need to know the pipeline type when converting QString ToQStr(const ShaderStage stage, const GraphicsAPI apitype); +// overload for a couple of things that need to know the pipeline type when converting +QString ToQStr(const AddressMode addr, const GraphicsAPI apitype); + inline QMetaType::Type GetVariantMetatype(const QVariant &v) { // this is explicitly called out by the documentation as the recommended process: diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp index 52a2df327..9101a94eb 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp @@ -1006,7 +1006,9 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, RD QString addPrefix; QString addVal; - QString addr[] = {ToQStr(s.addressU), ToQStr(s.addressV), ToQStr(s.addressW)}; + QString addr[] = {ToQStr(s.addressU, GraphicsAPI::D3D11), + ToQStr(s.addressV, GraphicsAPI::D3D11), + ToQStr(s.addressW, GraphicsAPI::D3D11)}; // arrange like either UVW: WRAP or UV: WRAP, W: CLAMP for(int a = 0; a < 3; a++) @@ -2625,7 +2627,9 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe QString addPrefix; QString addVal; - QString addr[] = {ToQStr(s.addressU), ToQStr(s.addressV), ToQStr(s.addressW)}; + QString addr[] = {ToQStr(s.addressU, GraphicsAPI::D3D11), + ToQStr(s.addressV, GraphicsAPI::D3D11), + ToQStr(s.addressW, GraphicsAPI::D3D11)}; // arrange like either UVW: WRAP or UV: WRAP, W: CLAMP for(int a = 0; a < 3; a++) diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp index 240c16f73..12ff8911d 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp @@ -1062,7 +1062,9 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, RD QString addPrefix; QString addVal; - QString addr[] = {ToQStr(s.addressU), ToQStr(s.addressV), ToQStr(s.addressW)}; + QString addr[] = {ToQStr(s.addressU, GraphicsAPI::D3D12), + ToQStr(s.addressV, GraphicsAPI::D3D12), + ToQStr(s.addressW, GraphicsAPI::D3D12)}; // arrange like either UVW: WRAP or UV: WRAP, W: CLAMP for(int a = 0; a < 3; a++) @@ -2569,7 +2571,9 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe QString addPrefix; QString addVal; - QString addr[] = {ToQStr(s.addressU), ToQStr(s.addressV), ToQStr(s.addressW)}; + QString addr[] = {ToQStr(s.addressU, GraphicsAPI::D3D12), + ToQStr(s.addressV, GraphicsAPI::D3D12), + ToQStr(s.addressW, GraphicsAPI::D3D12)}; // arrange like either UVW: WRAP or UV: WRAP, W: CLAMP for(int a = 0; a < 3; a++) diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index 516155931..04d26b06f 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -793,7 +793,9 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, RDLabel QString addPrefix; QString addVal; - QString addr[] = {ToQStr(s.addressS), ToQStr(s.addressT), ToQStr(s.addressR)}; + QString addr[] = {ToQStr(s.addressS, GraphicsAPI::OpenGL), + ToQStr(s.addressT, GraphicsAPI::OpenGL), + ToQStr(s.addressR, GraphicsAPI::OpenGL)}; // arrange like either STR: WRAP or ST: WRAP, R: CLAMP for(int a = 0; a < 3; a++) @@ -2670,7 +2672,9 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad QString addPrefix; QString addVal; - QString addr[] = {ToQStr(s.addressS), ToQStr(s.addressT), ToQStr(s.addressR)}; + QString addr[] = {ToQStr(s.addressS, GraphicsAPI::OpenGL), + ToQStr(s.addressT, GraphicsAPI::OpenGL), + ToQStr(s.addressR, GraphicsAPI::OpenGL)}; // arrange like either STR: WRAP or ST: WRAP, R: CLAMP for(int a = 0; a < 3; a++) diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index 118e4d8cf..336f07ecd 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -738,8 +738,9 @@ QVariantList VulkanPipelineStateViewer::makeSampler(const QString &bindset, cons QString filter; - QString addr[] = {ToQStr(descriptor.addressU), ToQStr(descriptor.addressV), - ToQStr(descriptor.addressW)}; + QString addr[] = {ToQStr(descriptor.addressU, GraphicsAPI::Vulkan), + ToQStr(descriptor.addressV, GraphicsAPI::Vulkan), + ToQStr(descriptor.addressW, GraphicsAPI::Vulkan)}; // arrange like either UVW: WRAP or UV: WRAP, W: CLAMP for(int a = 0; a < 3; a++) diff --git a/renderdoc/api/replay/renderdoc_tostr.inl b/renderdoc/api/replay/renderdoc_tostr.inl index af344e146..38a54ac70 100644 --- a/renderdoc/api/replay/renderdoc_tostr.inl +++ b/renderdoc/api/replay/renderdoc_tostr.inl @@ -424,7 +424,7 @@ rdcstr DoStringise(const TextureFilter &el) if(a == 0 || filters[a] == filters[a - 1]) { if(filtPrefix != "") - filtPrefix += "/"; + filtPrefix += "&"; filtPrefix += filterPrefixes[a]; } else diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index 7d8dbf787..d768909fd 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -327,15 +327,27 @@ DOCUMENT(R"(A texture addressing mode in a single direction (U,V or W). The texture is tiled at every multiple of 1.0. +.. data:: Repeat + + Alias of :data:`Wrap`. + .. data:: Mirror The texture is tiled as with :data:`Wrap`, but with the absolute value of the texture co-ordinate. +.. data:: MirrorRepeat + + Alias of :data:`Mirror`. + .. data:: MirrorOnce The texture is mirrored with :data:`Mirror`, but the texture does not tile as with :data:`ClampEdge`. +.. data:: MirrorClamp + + Alias of :data:`MirrorOnce`. + .. data:: ClampEdge The texture is clamped to the range of ``[0.0, 1.0]`` and the texture value at each end used. @@ -348,8 +360,11 @@ DOCUMENT(R"(A texture addressing mode in a single direction (U,V or W). enum class AddressMode : uint32_t { Wrap, + Repeat = Wrap, Mirror, + MirrorRepeat = Mirror, MirrorOnce, + MirrorClamp = MirrorOnce, ClampEdge, ClampBorder, };