diff --git a/renderdocui/Interop/Enums.cs b/renderdocui/Interop/Enums.cs index 1947ba3d9..4e7fa9034 100644 --- a/renderdocui/Interop/Enums.cs +++ b/renderdocui/Interop/Enums.cs @@ -575,6 +575,11 @@ namespace renderdoc return Topology_VertexOffset(topology, primitiveIndex); } + public static bool IsD3D(this GraphicsAPI apitype) + { + return (apitype == GraphicsAPI.D3D11 || apitype == GraphicsAPI.D3D12); + } + public static string Str(this DebugMessageSource source) { switch (source) @@ -693,7 +698,7 @@ namespace renderdoc public static string Str(this ResourceUsage usage, GraphicsAPI apitype) { - if (apitype == GraphicsAPI.D3D11) + if (apitype.IsD3D()) { switch (usage) { @@ -795,7 +800,7 @@ namespace renderdoc public static string Str(this ShaderStageType stage, GraphicsAPI apitype) { - if (apitype == GraphicsAPI.D3D11) + if (apitype.IsD3D()) { switch (stage) { diff --git a/renderdocui/Interop/FetchInfo.cs b/renderdocui/Interop/FetchInfo.cs index 012183f2b..a451b2235 100644 --- a/renderdocui/Interop/FetchInfo.cs +++ b/renderdocui/Interop/FetchInfo.cs @@ -779,7 +779,7 @@ namespace renderdoc { get { - return pipelineType == GraphicsAPI.D3D11 ? ".hlsl" : ".glsl"; + return pipelineType.IsD3D() ? ".hlsl" : ".glsl"; } } }; diff --git a/renderdocui/Windows/Dialogs/ConstantBufferPreviewer.cs b/renderdocui/Windows/Dialogs/ConstantBufferPreviewer.cs index 7ddad0889..3903601ce 100644 --- a/renderdocui/Windows/Dialogs/ConstantBufferPreviewer.cs +++ b/renderdocui/Windows/Dialogs/ConstantBufferPreviewer.cs @@ -235,7 +235,7 @@ namespace renderdocui.Controls string ret = String.Format("{0} {1} {2}", Stage.Str(pipeType), - pipeType == GraphicsAPI.D3D11 ? "CB" : "UBO", + pipeType.IsD3D() ? "CB" : "UBO", Slot); if (m_Core != null && m_Core.CurPipelineState.SupportsResourceArrays) diff --git a/renderdocui/Windows/ShaderViewer.cs b/renderdocui/Windows/ShaderViewer.cs index 935ffa121..7fc578a73 100644 --- a/renderdocui/Windows/ShaderViewer.cs +++ b/renderdocui/Windows/ShaderViewer.cs @@ -259,7 +259,7 @@ namespace renderdocui.Windows m_CloseCallback = closeCallback; if (m_Core.LogLoaded) - pointLinearSamplersToolStripMenuItem.Visible = (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11); + pointLinearSamplersToolStripMenuItem.Visible = m_Core.APIProps.pipelineType.IsD3D(); DockContent sel = null; @@ -481,7 +481,7 @@ namespace renderdocui.Windows var disasm = shader != null ? shader.Disassembly : ""; if (m_Core.Config.ShaderViewer_FriendlyNaming && m_ShaderDetails != null && - m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + m_Core.APIProps.pipelineType.IsD3D()) { for (int i = 0; i < m_ShaderDetails.ConstantBlocks.Length; i++) { @@ -1708,7 +1708,7 @@ namespace renderdocui.Windows public void OnLogfileLoaded() { - pointLinearSamplersToolStripMenuItem.Visible = (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11); + pointLinearSamplersToolStripMenuItem.Visible = (m_Core.APIProps.pipelineType.IsD3D()); } public void OnEventSelected(UInt32 eventID) @@ -2066,7 +2066,7 @@ namespace renderdocui.Windows private int GetPostVersionInsertPosition() { - if (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + if (m_Core.APIProps.pipelineType.IsD3D()) return 0; int ver = CurrentScintilla.Text.IndexOf("#version"); @@ -2097,7 +2097,7 @@ namespace renderdocui.Windows if (CurrentScintilla == null) return; - if (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + if (m_Core.APIProps.pipelineType.IsD3D()) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uint4 RENDERDOC_TexDim; // xyz == width, height, depth. w == # mips" + Environment.NewLine + Environment.NewLine); else if (m_Core.APIProps.pipelineType == GraphicsAPI.OpenGL) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uniform uvec4 RENDERDOC_TexDim; // xyz == width, height, depth. w == # mips" + Environment.NewLine + Environment.NewLine); @@ -2113,7 +2113,7 @@ namespace renderdocui.Windows if (m_Core.APIProps.pipelineType == GraphicsAPI.Vulkan) InsertVulkanUBO(); - else if (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + else if (m_Core.APIProps.pipelineType.IsD3D()) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uint RENDERDOC_SelectedMip; // selected mip in UI" + Environment.NewLine + Environment.NewLine); else if (m_Core.APIProps.pipelineType == GraphicsAPI.OpenGL) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uniform uint RENDERDOC_SelectedMip; // selected mip in UI" + Environment.NewLine + Environment.NewLine); @@ -2127,7 +2127,7 @@ namespace renderdocui.Windows if (m_Core.APIProps.pipelineType == GraphicsAPI.Vulkan) InsertVulkanUBO(); - else if (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + else if (m_Core.APIProps.pipelineType.IsD3D()) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uint RENDERDOC_SelectedSliceFace; // selected array slice or cubemap face in UI" + Environment.NewLine + Environment.NewLine); else if (m_Core.APIProps.pipelineType == GraphicsAPI.OpenGL) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uniform uint RENDERDOC_SelectedSliceFace; // selected array slice or cubemap face in UI" + Environment.NewLine + Environment.NewLine); @@ -2141,7 +2141,7 @@ namespace renderdocui.Windows if (m_Core.APIProps.pipelineType == GraphicsAPI.Vulkan) InsertVulkanUBO(); - else if (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + else if (m_Core.APIProps.pipelineType.IsD3D()) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "int RENDERDOC_SelectedSample; // selected MSAA sample or -numSamples for resolve. See docs" + Environment.NewLine + Environment.NewLine); else if (m_Core.APIProps.pipelineType == GraphicsAPI.OpenGL) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uniform int RENDERDOC_SelectedSample; // selected MSAA sample or -numSamples for resolve. See docs" + Environment.NewLine + Environment.NewLine); @@ -2153,7 +2153,7 @@ namespace renderdocui.Windows if (CurrentScintilla == null) return; - if(m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + if(m_Core.APIProps.pipelineType.IsD3D()) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uint RENDERDOC_TextureType; // 1 = 1D, 2 = 2D, 3 = 3D, 4 = Depth, 5 = Depth + Stencil, 6 = Depth (MS), 7 = Depth + Stencil (MS)" + Environment.NewLine + Environment.NewLine); else if (m_Core.APIProps.pipelineType == GraphicsAPI.OpenGL) CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "uniform uint RENDERDOC_TextureType; // 1 = 1D, 2 = 2D, 3 = 3D, 4 = Cube, 5 = 1DArray, 6 = 2DArray, 7 = CubeArray, 8 = Rect, 9 = Buffer, 10 = 2DMS" + Environment.NewLine + Environment.NewLine); @@ -2167,7 +2167,7 @@ namespace renderdocui.Windows if (CurrentScintilla == null) return; - if (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + if (m_Core.APIProps.pipelineType.IsD3D()) { CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "// Samplers" + Environment.NewLine + "SamplerState pointSampler : register(s0);" + Environment.NewLine + @@ -2182,7 +2182,7 @@ namespace renderdocui.Windows if (CurrentScintilla == null) return; - if (m_Core.APIProps.pipelineType == GraphicsAPI.D3D11) + if (m_Core.APIProps.pipelineType.IsD3D()) { CurrentScintilla.InsertText(GetPostVersionInsertPosition(), "// Textures" + Environment.NewLine + "Texture1DArray texDisplayTex1DArray : register(t1);" + Environment.NewLine +