From d40fc8471deef084d3e84b5a13383d561db83626 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 6 Apr 2017 14:09:00 +0100 Subject: [PATCH] Change API enums to enum class, remove now redundant prefixing * This gives a little nicer syntax, a bit better type safety, and also reflects better for SWIG bindings. Overall it's a minor change but better. * We don't update the C# UI at all, since it's soon to be removed and not worth the effort/code churn. * For now so we're ABI compatible with C#, all enums are uint32_t, but that is an obvious optimisation in future to reduce struct packing. * We avoid 'None' as an enum value, because it's a reserved word in python so will cause problems generating bindings. --- qrenderdoc/Code/CaptureContext.cpp | 28 +- qrenderdoc/Code/CommonPipelineState.cpp | 318 +++-- qrenderdoc/Code/CommonPipelineState.h | 98 +- qrenderdoc/Code/FormatElement.cpp | 154 +-- qrenderdoc/Code/QRDUtils.cpp | 198 +-- qrenderdoc/Code/QRDUtils.h | 400 +++--- qrenderdoc/Code/RemoteHost.cpp | 9 +- qrenderdoc/Code/RenderManager.cpp | 6 +- qrenderdoc/Code/RenderManager.h | 42 +- qrenderdoc/Code/qrenderdoc.cpp | 12 +- qrenderdoc/Windows/BufferViewer.cpp | 176 +-- qrenderdoc/Windows/BufferViewer.h | 6 +- .../Windows/ConstantBufferPreviewer.cpp | 5 +- qrenderdoc/Windows/ConstantBufferPreviewer.h | 6 +- qrenderdoc/Windows/DebugMessageView.cpp | 12 +- qrenderdoc/Windows/Dialogs/CaptureDialog.cpp | 16 +- .../Windows/Dialogs/EnvironmentEditor.cpp | 17 +- qrenderdoc/Windows/Dialogs/LiveCapture.cpp | 8 +- qrenderdoc/Windows/Dialogs/RemoteManager.cpp | 4 +- .../Windows/Dialogs/TextureSaveDialog.cpp | 54 +- .../Windows/Dialogs/VirtualFileDialog.cpp | 37 +- qrenderdoc/Windows/EventBrowser.cpp | 4 +- qrenderdoc/Windows/MainWindow.cpp | 14 +- .../D3D11PipelineStateViewer.cpp | 160 ++- .../PipelineState/D3D11PipelineStateViewer.h | 16 +- .../D3D12PipelineStateViewer.cpp | 120 +- .../PipelineState/D3D12PipelineStateViewer.h | 13 +- .../PipelineState/GLPipelineStateViewer.cpp | 110 +- .../PipelineState/GLPipelineStateViewer.h | 6 +- .../PipelineState/PipelineStateViewer.cpp | 18 +- .../PipelineState/PipelineStateViewer.h | 2 +- .../VulkanPipelineStateViewer.cpp | 142 +- .../PipelineState/VulkanPipelineStateViewer.h | 8 +- qrenderdoc/Windows/PixelHistoryView.cpp | 26 +- qrenderdoc/Windows/ShaderViewer.cpp | 48 +- qrenderdoc/Windows/ShaderViewer.h | 11 +- qrenderdoc/Windows/StatisticsViewer.cpp | 65 +- qrenderdoc/Windows/TextureViewer.cpp | 146 +-- qrenderdoc/Windows/TextureViewer.h | 27 +- renderdoc/api/replay/control_types.h | 23 +- renderdoc/api/replay/d3d11_pipestate.h | 26 +- renderdoc/api/replay/d3d12_pipestate.h | 28 +- renderdoc/api/replay/data_types.h | 56 +- renderdoc/api/replay/gl_pipestate.h | 52 +- renderdoc/api/replay/renderdoc_replay.h | 82 +- renderdoc/api/replay/replay_enums.h | 1153 ++++++++++------- renderdoc/api/replay/shader_types.h | 20 +- renderdoc/api/replay/vk_pipestate.h | 36 +- renderdoc/common/common.cpp | 22 +- renderdoc/common/common.h | 70 +- renderdoc/common/dds_readwrite.cpp | 358 ++--- renderdoc/common/timing.h | 2 +- renderdoc/core/core.cpp | 89 +- renderdoc/core/core.h | 20 +- renderdoc/core/image_viewer.cpp | 55 +- renderdoc/core/remote_server.cpp | 75 +- renderdoc/core/replay_proxy.cpp | 203 +-- renderdoc/core/replay_proxy.h | 37 +- renderdoc/core/target_control.cpp | 26 +- renderdoc/driver/d3d11/d3d11_analyse.cpp | 278 ++-- renderdoc/driver/d3d11/d3d11_common.cpp | 38 +- renderdoc/driver/d3d11/d3d11_context.cpp | 90 +- renderdoc/driver/d3d11/d3d11_context.h | 9 +- .../driver/d3d11/d3d11_context1_wrap.cpp | 53 +- renderdoc/driver/d3d11/d3d11_context_wrap.cpp | 154 +-- renderdoc/driver/d3d11/d3d11_counters.cpp | 197 +-- renderdoc/driver/d3d11/d3d11_debug.cpp | 123 +- renderdoc/driver/d3d11/d3d11_debug.h | 37 +- renderdoc/driver/d3d11/d3d11_device.cpp | 70 +- renderdoc/driver/d3d11/d3d11_device.h | 5 +- renderdoc/driver/d3d11/d3d11_renderstate.cpp | 28 +- renderdoc/driver/d3d11/d3d11_replay.cpp | 191 ++- renderdoc/driver/d3d11/d3d11_replay.h | 31 +- .../driver/d3d12/d3d12_command_list_wrap.cpp | 104 +- .../driver/d3d12/d3d12_command_queue_wrap.cpp | 14 +- renderdoc/driver/d3d12/d3d12_commands.cpp | 55 +- renderdoc/driver/d3d12/d3d12_common.cpp | 54 +- renderdoc/driver/d3d12/d3d12_common.h | 2 +- renderdoc/driver/d3d12/d3d12_counters.cpp | 142 +- renderdoc/driver/d3d12/d3d12_debug.cpp | 212 ++- renderdoc/driver/d3d12/d3d12_debug.h | 23 +- renderdoc/driver/d3d12/d3d12_device.cpp | 60 +- renderdoc/driver/d3d12/d3d12_device.h | 5 +- renderdoc/driver/d3d12/d3d12_replay.cpp | 137 +- renderdoc/driver/d3d12/d3d12_replay.h | 33 +- renderdoc/driver/d3d9/d3d9_replay.cpp | 4 +- renderdoc/driver/dxgi/dxgi_common.cpp | 320 ++--- renderdoc/driver/dxgi/dxgi_common.h | 6 +- renderdoc/driver/gl/gl_common.cpp | 334 ++--- renderdoc/driver/gl/gl_common.h | 4 +- renderdoc/driver/gl/gl_counters.cpp | 170 +-- renderdoc/driver/gl/gl_debug.cpp | 251 ++-- renderdoc/driver/gl/gl_driver.cpp | 111 +- renderdoc/driver/gl/gl_driver.h | 9 +- renderdoc/driver/gl/gl_hooks_egl.cpp | 6 +- renderdoc/driver/gl/gl_hooks_linux.cpp | 4 +- renderdoc/driver/gl/gl_hooks_win32.cpp | 2 +- renderdoc/driver/gl/gl_manager.cpp | 4 +- renderdoc/driver/gl/gl_replay.cpp | 321 +++-- renderdoc/driver/gl/gl_replay.h | 40 +- renderdoc/driver/gl/gl_replay_apple.cpp | 4 +- renderdoc/driver/gl/gl_replay_egl.cpp | 24 +- renderdoc/driver/gl/gl_replay_linux.cpp | 26 +- renderdoc/driver/gl/gl_replay_win32.cpp | 38 +- renderdoc/driver/gl/gl_shader_refl.cpp | 390 +++--- .../driver/gl/wrappers/gl_debug_funcs.cpp | 6 +- .../driver/gl/wrappers/gl_draw_funcs.cpp | 173 +-- renderdoc/driver/gl/wrappers/gl_emulated.cpp | 8 +- .../gl/wrappers/gl_framebuffer_funcs.cpp | 24 +- .../driver/gl/wrappers/gl_texture_funcs.cpp | 29 +- renderdoc/driver/shaders/dxbc/dxbc_debug.cpp | 147 ++- renderdoc/driver/shaders/dxbc/dxbc_debug.h | 8 +- .../driver/shaders/dxbc/dxbc_disassemble.cpp | 48 +- .../driver/shaders/dxbc/dxbc_disassemble.h | 47 +- .../driver/shaders/dxbc/dxbc_inspect.cpp | 143 +- renderdoc/driver/shaders/spirv/spirv_common.h | 2 +- .../shaders/spirv/spirv_disassemble.cpp | 122 +- renderdoc/driver/vulkan/vk_android.cpp | 4 +- renderdoc/driver/vulkan/vk_apple.cpp | 2 +- renderdoc/driver/vulkan/vk_common.cpp | 368 +++--- renderdoc/driver/vulkan/vk_common.h | 4 +- renderdoc/driver/vulkan/vk_core.cpp | 108 +- renderdoc/driver/vulkan/vk_core.h | 15 +- renderdoc/driver/vulkan/vk_counters.cpp | 156 +-- renderdoc/driver/vulkan/vk_debug.cpp | 118 +- renderdoc/driver/vulkan/vk_debug.h | 6 +- renderdoc/driver/vulkan/vk_info.cpp | 30 +- renderdoc/driver/vulkan/vk_info.h | 2 +- renderdoc/driver/vulkan/vk_layer.cpp | 16 +- renderdoc/driver/vulkan/vk_linux.cpp | 24 +- renderdoc/driver/vulkan/vk_posix.cpp | 6 +- renderdoc/driver/vulkan/vk_replay.cpp | 270 ++-- renderdoc/driver/vulkan/vk_replay.h | 33 +- renderdoc/driver/vulkan/vk_win32.cpp | 12 +- .../driver/vulkan/wrappers/vk_cmd_funcs.cpp | 32 +- .../vulkan/wrappers/vk_device_funcs.cpp | 14 +- .../driver/vulkan/wrappers/vk_draw_funcs.cpp | 215 +-- .../driver/vulkan/wrappers/vk_queue_funcs.cpp | 6 +- .../driver/vulkan/wrappers/vk_wsi_funcs.cpp | 3 +- renderdoc/os/os_specific.h | 44 +- renderdoc/os/posix/posix_process.cpp | 104 +- renderdoc/os/posix/posix_stringio.cpp | 14 +- renderdoc/os/win32/win32_process.cpp | 93 +- renderdoc/os/win32/win32_stringio.cpp | 16 +- renderdoc/replay/entry_points.cpp | 247 ++-- renderdoc/replay/replay_driver.h | 40 +- renderdoc/replay/replay_output.cpp | 138 +- renderdoc/replay/replay_renderer.cpp | 303 ++--- renderdoc/replay/replay_renderer.h | 32 +- renderdoc/serialise/serialiser.h | 4 + renderdoccmd/renderdoccmd.cpp | 73 +- renderdoccmd/renderdoccmd_android.cpp | 7 +- renderdoccmd/renderdoccmd_linux.cpp | 33 +- renderdoccmd/renderdoccmd_win32.cpp | 5 +- renderdocui/Interop/FetchInfo.cs | 6 - renderdocui/Interop/ReplayRenderer.cs | 6 - renderdocui/Windows/BufferViewer.cs | 4 - renderdocui/Windows/TextureViewer.cs | 4 - 158 files changed, 6386 insertions(+), 6176 deletions(-) diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 17150b762..b0841e0df 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -225,21 +225,21 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString & r->GetSupportedWindowSystems(&m_WinSystems); #if defined(RENDERDOC_PLATFORM_WIN32) - m_CurWinSystem = eWindowingSystem_Win32; + m_CurWinSystem = WindowingSystem::Win32; #elif defined(RENDERDOC_PLATFORM_LINUX) - m_CurWinSystem = eWindowingSystem_Xlib; + m_CurWinSystem = WindowingSystem::Xlib; // prefer XCB, if supported for(WindowingSystem sys : m_WinSystems) { - if(sys == eWindowingSystem_XCB) + if(sys == WindowingSystem::XCB) { - m_CurWinSystem = eWindowingSystem_XCB; + m_CurWinSystem = WindowingSystem::XCB; break; } } - if(m_CurWinSystem == eWindowingSystem_XCB) + if(m_CurWinSystem == WindowingSystem::XCB) m_XCBConnection = QX11Info::connection(); else m_X11Display = QX11Info::display(); @@ -300,11 +300,11 @@ bool CaptureContext::PassEquivalent(const FetchDrawcall &a, const FetchDrawcall return false; // don't group draws and compute executes - if((a.flags & eDraw_Dispatch) != (b.flags & eDraw_Dispatch)) + if((a.flags & DrawFlags::Dispatch) != (b.flags & DrawFlags::Dispatch)) return false; // don't group present with anything - if((a.flags & eDraw_Present) != (b.flags & eDraw_Present)) + if((a.flags & DrawFlags::Present) != (b.flags & DrawFlags::Present)) return false; // don't group things with different depth outputs @@ -373,7 +373,8 @@ bool CaptureContext::ContainsMarker(const rdctype::array &draws) for(const FetchDrawcall &d : draws) { - ret |= (d.flags & eDraw_PushMarker) && !(d.flags & eDraw_CmdList) && !d.children.empty(); + ret |= + (d.flags & DrawFlags::PushMarker) && !(d.flags & DrawFlags::CmdList) && !d.children.empty(); ret |= ContainsMarker(d.children); if(ret) @@ -400,7 +401,8 @@ void CaptureContext::AddFakeProfileMarkers() int start = 0; int refdraw = 0; - uint32_t drawFlags = eDraw_Copy | eDraw_Resolve | eDraw_SetMarker | eDraw_CmdList; + DrawFlags drawFlags = + DrawFlags::Copy | DrawFlags::Resolve | DrawFlags::SetMarker | DrawFlags::CmdList; for(int i = 1; i < draws.count; i++) { @@ -436,7 +438,7 @@ void CaptureContext::AddFakeProfileMarkers() { int outCount = 0; - if(!(draws[j].flags & (eDraw_Copy | eDraw_Resolve | eDraw_Clear))) + if(!(draws[j].flags & (DrawFlags::Copy | DrawFlags::Resolve | DrawFlags::Clear))) copyOnly = false; for(ResourceId o : draws[j].outputs) @@ -451,7 +453,7 @@ void CaptureContext::AddFakeProfileMarkers() mark.eventID = draws[start].eventID; mark.drawcallID = draws[start].drawcallID; - mark.flags = eDraw_PushMarker; + mark.flags = DrawFlags::PushMarker; memcpy(mark.outputs, draws[end].outputs, sizeof(mark.outputs)); mark.depthOut = draws[end].depthOut; @@ -464,7 +466,7 @@ void CaptureContext::AddFakeProfileMarkers() .arg(copypassID++) .toUtf8() .data(); - else if(draws[refdraw].flags & eDraw_Dispatch) + else if(draws[refdraw].flags & DrawFlags::Dispatch) mark.name = QApplication::translate("CaptureContext", "Compute Pass #%1") .arg(computepassID++) .toUtf8() @@ -593,7 +595,7 @@ void *CaptureContext::FillWindowingData(WId widget) static XCBWindowData xcb; static XlibWindowData xlib; - if(m_CurWinSystem == eWindowingSystem_XCB) + if(m_CurWinSystem == WindowingSystem::XCB) { xcb.connection = m_XCBConnection; xcb.window = (xcb_window_t)widget; diff --git a/qrenderdoc/Code/CommonPipelineState.cpp b/qrenderdoc/Code/CommonPipelineState.cpp index e48f94f34..6d44bde2a 100644 --- a/qrenderdoc/Code/CommonPipelineState.cpp +++ b/qrenderdoc/Code/CommonPipelineState.cpp @@ -51,33 +51,33 @@ QString CommonPipelineState::GetImageLayout(ResourceId id) return "Unknown"; } -QString CommonPipelineState::Abbrev(ShaderStageType stage) +QString CommonPipelineState::Abbrev(ShaderStage stage) { - if(IsLogD3D11() || (!LogLoaded() && DefaultType == eGraphicsAPI_D3D11) || IsLogD3D12() || - (!LogLoaded() && DefaultType == eGraphicsAPI_D3D12)) + if(IsLogD3D11() || (!LogLoaded() && DefaultType == GraphicsAPI::D3D11) || IsLogD3D12() || + (!LogLoaded() && DefaultType == GraphicsAPI::D3D12)) { switch(stage) { - case eShaderStage_Vertex: return "VS"; - case eShaderStage_Hull: return "HS"; - case eShaderStage_Domain: return "DS"; - case eShaderStage_Geometry: return "GS"; - case eShaderStage_Pixel: return "PS"; - case eShaderStage_Compute: return "CS"; + case ShaderStage::Vertex: return "VS"; + case ShaderStage::Hull: return "HS"; + case ShaderStage::Domain: return "DS"; + case ShaderStage::Geometry: return "GS"; + case ShaderStage::Pixel: return "PS"; + case ShaderStage::Compute: return "CS"; default: break; } } - else if(IsLogGL() || (!LogLoaded() && DefaultType == eGraphicsAPI_OpenGL) || IsLogVK() || - (!LogLoaded() && DefaultType == eGraphicsAPI_Vulkan)) + else if(IsLogGL() || (!LogLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsLogVK() || + (!LogLoaded() && DefaultType == GraphicsAPI::Vulkan)) { switch(stage) { - case eShaderStage_Vertex: return "VS"; - case eShaderStage_Tess_Control: return "TCS"; - case eShaderStage_Tess_Eval: return "TES"; - case eShaderStage_Geometry: return "GS"; - case eShaderStage_Fragment: return "FS"; - case eShaderStage_Compute: return "CS"; + case ShaderStage::Vertex: return "VS"; + case ShaderStage::Tess_Control: return "TCS"; + case ShaderStage::Tess_Eval: return "TES"; + case ShaderStage::Geometry: return "GS"; + case ShaderStage::Fragment: return "FS"; + case ShaderStage::Compute: return "CS"; default: break; } } @@ -87,8 +87,8 @@ QString CommonPipelineState::Abbrev(ShaderStageType stage) QString CommonPipelineState::OutputAbbrev() { - if(IsLogGL() || (!LogLoaded() && DefaultType == eGraphicsAPI_OpenGL) || IsLogVK() || - (!LogLoaded() && DefaultType == eGraphicsAPI_Vulkan)) + if(IsLogGL() || (!LogLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsLogVK() || + (!LogLoaded() && DefaultType == GraphicsAPI::Vulkan)) { return "FB"; } @@ -98,8 +98,8 @@ QString CommonPipelineState::OutputAbbrev() QString CommonPipelineState::GetShaderExtension() { - if(IsLogGL() || (!LogLoaded() && DefaultType == eGraphicsAPI_OpenGL) || IsLogVK() || - (!LogLoaded() && DefaultType == eGraphicsAPI_Vulkan)) + if(IsLogGL() || (!LogLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsLogVK() || + (!LogLoaded() && DefaultType == GraphicsAPI::Vulkan)) { return "glsl"; } @@ -150,7 +150,7 @@ Viewport CommonPipelineState::GetViewport(int index) return ret; } -const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderStageType stage) +const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderStage stage) { if(LogLoaded()) { @@ -158,12 +158,12 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta { switch(stage) { - case eShaderStage_Vertex: return m_D3D11->m_VS.BindpointMapping; - case eShaderStage_Domain: return m_D3D11->m_DS.BindpointMapping; - case eShaderStage_Hull: return m_D3D11->m_HS.BindpointMapping; - case eShaderStage_Geometry: return m_D3D11->m_GS.BindpointMapping; - case eShaderStage_Pixel: return m_D3D11->m_PS.BindpointMapping; - case eShaderStage_Compute: return m_D3D11->m_CS.BindpointMapping; + case ShaderStage::Vertex: return m_D3D11->m_VS.BindpointMapping; + case ShaderStage::Domain: return m_D3D11->m_DS.BindpointMapping; + case ShaderStage::Hull: return m_D3D11->m_HS.BindpointMapping; + case ShaderStage::Geometry: return m_D3D11->m_GS.BindpointMapping; + case ShaderStage::Pixel: return m_D3D11->m_PS.BindpointMapping; + case ShaderStage::Compute: return m_D3D11->m_CS.BindpointMapping; default: break; } } @@ -171,12 +171,12 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta { switch(stage) { - case eShaderStage_Vertex: return m_D3D12->m_VS.BindpointMapping; - case eShaderStage_Domain: return m_D3D12->m_DS.BindpointMapping; - case eShaderStage_Hull: return m_D3D12->m_HS.BindpointMapping; - case eShaderStage_Geometry: return m_D3D12->m_GS.BindpointMapping; - case eShaderStage_Pixel: return m_D3D12->m_PS.BindpointMapping; - case eShaderStage_Compute: return m_D3D12->m_CS.BindpointMapping; + case ShaderStage::Vertex: return m_D3D12->m_VS.BindpointMapping; + case ShaderStage::Domain: return m_D3D12->m_DS.BindpointMapping; + case ShaderStage::Hull: return m_D3D12->m_HS.BindpointMapping; + case ShaderStage::Geometry: return m_D3D12->m_GS.BindpointMapping; + case ShaderStage::Pixel: return m_D3D12->m_PS.BindpointMapping; + case ShaderStage::Compute: return m_D3D12->m_CS.BindpointMapping; default: break; } } @@ -184,12 +184,12 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta { switch(stage) { - case eShaderStage_Vertex: return m_GL->m_VS.BindpointMapping; - case eShaderStage_Tess_Control: return m_GL->m_TCS.BindpointMapping; - case eShaderStage_Tess_Eval: return m_GL->m_TES.BindpointMapping; - case eShaderStage_Geometry: return m_GL->m_GS.BindpointMapping; - case eShaderStage_Fragment: return m_GL->m_FS.BindpointMapping; - case eShaderStage_Compute: return m_GL->m_CS.BindpointMapping; + case ShaderStage::Vertex: return m_GL->m_VS.BindpointMapping; + case ShaderStage::Tess_Control: return m_GL->m_TCS.BindpointMapping; + case ShaderStage::Tess_Eval: return m_GL->m_TES.BindpointMapping; + case ShaderStage::Geometry: return m_GL->m_GS.BindpointMapping; + case ShaderStage::Fragment: return m_GL->m_FS.BindpointMapping; + case ShaderStage::Compute: return m_GL->m_CS.BindpointMapping; default: break; } } @@ -197,12 +197,12 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta { switch(stage) { - case eShaderStage_Vertex: return m_Vulkan->m_VS.BindpointMapping; - case eShaderStage_Tess_Control: return m_Vulkan->m_TCS.BindpointMapping; - case eShaderStage_Tess_Eval: return m_Vulkan->m_TES.BindpointMapping; - case eShaderStage_Geometry: return m_Vulkan->m_GS.BindpointMapping; - case eShaderStage_Fragment: return m_Vulkan->m_FS.BindpointMapping; - case eShaderStage_Compute: return m_Vulkan->m_CS.BindpointMapping; + case ShaderStage::Vertex: return m_Vulkan->m_VS.BindpointMapping; + case ShaderStage::Tess_Control: return m_Vulkan->m_TCS.BindpointMapping; + case ShaderStage::Tess_Eval: return m_Vulkan->m_TES.BindpointMapping; + case ShaderStage::Geometry: return m_Vulkan->m_GS.BindpointMapping; + case ShaderStage::Fragment: return m_Vulkan->m_FS.BindpointMapping; + case ShaderStage::Compute: return m_Vulkan->m_CS.BindpointMapping; default: break; } } @@ -213,7 +213,7 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta return empty; } -const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType stage) +const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStage stage) { if(LogLoaded()) { @@ -221,12 +221,12 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType { switch(stage) { - case eShaderStage_Vertex: return m_D3D11->m_VS.ShaderDetails; - case eShaderStage_Domain: return m_D3D11->m_DS.ShaderDetails; - case eShaderStage_Hull: return m_D3D11->m_HS.ShaderDetails; - case eShaderStage_Geometry: return m_D3D11->m_GS.ShaderDetails; - case eShaderStage_Pixel: return m_D3D11->m_PS.ShaderDetails; - case eShaderStage_Compute: return m_D3D11->m_CS.ShaderDetails; + case ShaderStage::Vertex: return m_D3D11->m_VS.ShaderDetails; + case ShaderStage::Domain: return m_D3D11->m_DS.ShaderDetails; + case ShaderStage::Hull: return m_D3D11->m_HS.ShaderDetails; + case ShaderStage::Geometry: return m_D3D11->m_GS.ShaderDetails; + case ShaderStage::Pixel: return m_D3D11->m_PS.ShaderDetails; + case ShaderStage::Compute: return m_D3D11->m_CS.ShaderDetails; default: break; } } @@ -234,12 +234,12 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType { switch(stage) { - case eShaderStage_Vertex: return m_D3D12->m_VS.ShaderDetails; - case eShaderStage_Domain: return m_D3D12->m_DS.ShaderDetails; - case eShaderStage_Hull: return m_D3D12->m_HS.ShaderDetails; - case eShaderStage_Geometry: return m_D3D12->m_GS.ShaderDetails; - case eShaderStage_Pixel: return m_D3D12->m_PS.ShaderDetails; - case eShaderStage_Compute: return m_D3D12->m_CS.ShaderDetails; + case ShaderStage::Vertex: return m_D3D12->m_VS.ShaderDetails; + case ShaderStage::Domain: return m_D3D12->m_DS.ShaderDetails; + case ShaderStage::Hull: return m_D3D12->m_HS.ShaderDetails; + case ShaderStage::Geometry: return m_D3D12->m_GS.ShaderDetails; + case ShaderStage::Pixel: return m_D3D12->m_PS.ShaderDetails; + case ShaderStage::Compute: return m_D3D12->m_CS.ShaderDetails; default: break; } } @@ -247,12 +247,12 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType { switch(stage) { - case eShaderStage_Vertex: return m_GL->m_VS.ShaderDetails; - case eShaderStage_Tess_Control: return m_GL->m_TCS.ShaderDetails; - case eShaderStage_Tess_Eval: return m_GL->m_TES.ShaderDetails; - case eShaderStage_Geometry: return m_GL->m_GS.ShaderDetails; - case eShaderStage_Fragment: return m_GL->m_FS.ShaderDetails; - case eShaderStage_Compute: return m_GL->m_CS.ShaderDetails; + case ShaderStage::Vertex: return m_GL->m_VS.ShaderDetails; + case ShaderStage::Tess_Control: return m_GL->m_TCS.ShaderDetails; + case ShaderStage::Tess_Eval: return m_GL->m_TES.ShaderDetails; + case ShaderStage::Geometry: return m_GL->m_GS.ShaderDetails; + case ShaderStage::Fragment: return m_GL->m_FS.ShaderDetails; + case ShaderStage::Compute: return m_GL->m_CS.ShaderDetails; default: break; } } @@ -260,12 +260,12 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType { switch(stage) { - case eShaderStage_Vertex: return m_Vulkan->m_VS.ShaderDetails; - case eShaderStage_Tess_Control: return m_Vulkan->m_TCS.ShaderDetails; - case eShaderStage_Tess_Eval: return m_Vulkan->m_TES.ShaderDetails; - case eShaderStage_Geometry: return m_Vulkan->m_GS.ShaderDetails; - case eShaderStage_Fragment: return m_Vulkan->m_FS.ShaderDetails; - case eShaderStage_Compute: return m_Vulkan->m_CS.ShaderDetails; + case ShaderStage::Vertex: return m_Vulkan->m_VS.ShaderDetails; + case ShaderStage::Tess_Control: return m_Vulkan->m_TCS.ShaderDetails; + case ShaderStage::Tess_Eval: return m_Vulkan->m_TES.ShaderDetails; + case ShaderStage::Geometry: return m_Vulkan->m_GS.ShaderDetails; + case ShaderStage::Fragment: return m_Vulkan->m_FS.ShaderDetails; + case ShaderStage::Compute: return m_Vulkan->m_CS.ShaderDetails; default: break; } } @@ -274,7 +274,7 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType return NULL; } -QString CommonPipelineState::GetShaderEntryPoint(ShaderStageType stage) +QString CommonPipelineState::GetShaderEntryPoint(ShaderStage stage) { QString ret; @@ -282,12 +282,12 @@ QString CommonPipelineState::GetShaderEntryPoint(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: ret = m_Vulkan->m_VS.entryPoint; break; - case eShaderStage_Tess_Control: ret = m_Vulkan->m_TCS.entryPoint; break; - case eShaderStage_Tess_Eval: ret = m_Vulkan->m_TES.entryPoint; break; - case eShaderStage_Geometry: ret = m_Vulkan->m_GS.entryPoint; break; - case eShaderStage_Fragment: ret = m_Vulkan->m_FS.entryPoint; break; - case eShaderStage_Compute: ret = m_Vulkan->m_CS.entryPoint; break; + case ShaderStage::Vertex: ret = m_Vulkan->m_VS.entryPoint; break; + case ShaderStage::Tess_Control: ret = m_Vulkan->m_TCS.entryPoint; break; + case ShaderStage::Tess_Eval: ret = m_Vulkan->m_TES.entryPoint; break; + case ShaderStage::Geometry: ret = m_Vulkan->m_GS.entryPoint; break; + case ShaderStage::Fragment: ret = m_Vulkan->m_FS.entryPoint; break; + case ShaderStage::Compute: ret = m_Vulkan->m_CS.entryPoint; break; default: break; } } @@ -295,7 +295,7 @@ QString CommonPipelineState::GetShaderEntryPoint(ShaderStageType stage) return ret; } -ResourceId CommonPipelineState::GetShader(ShaderStageType stage) +ResourceId CommonPipelineState::GetShader(ShaderStage stage) { if(LogLoaded()) { @@ -303,12 +303,12 @@ ResourceId CommonPipelineState::GetShader(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: return m_D3D11->m_VS.Shader; - case eShaderStage_Domain: return m_D3D11->m_DS.Shader; - case eShaderStage_Hull: return m_D3D11->m_HS.Shader; - case eShaderStage_Geometry: return m_D3D11->m_GS.Shader; - case eShaderStage_Pixel: return m_D3D11->m_PS.Shader; - case eShaderStage_Compute: return m_D3D11->m_CS.Shader; + case ShaderStage::Vertex: return m_D3D11->m_VS.Object; + case ShaderStage::Domain: return m_D3D11->m_DS.Object; + case ShaderStage::Hull: return m_D3D11->m_HS.Object; + case ShaderStage::Geometry: return m_D3D11->m_GS.Object; + case ShaderStage::Pixel: return m_D3D11->m_PS.Object; + case ShaderStage::Compute: return m_D3D11->m_CS.Object; default: break; } } @@ -316,12 +316,12 @@ ResourceId CommonPipelineState::GetShader(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: return m_D3D12->m_VS.Shader; - case eShaderStage_Domain: return m_D3D12->m_DS.Shader; - case eShaderStage_Hull: return m_D3D12->m_HS.Shader; - case eShaderStage_Geometry: return m_D3D12->m_GS.Shader; - case eShaderStage_Pixel: return m_D3D12->m_PS.Shader; - case eShaderStage_Compute: return m_D3D12->m_CS.Shader; + case ShaderStage::Vertex: return m_D3D12->m_VS.Object; + case ShaderStage::Domain: return m_D3D12->m_DS.Object; + case ShaderStage::Hull: return m_D3D12->m_HS.Object; + case ShaderStage::Geometry: return m_D3D12->m_GS.Object; + case ShaderStage::Pixel: return m_D3D12->m_PS.Object; + case ShaderStage::Compute: return m_D3D12->m_CS.Object; default: break; } } @@ -329,12 +329,12 @@ ResourceId CommonPipelineState::GetShader(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: return m_GL->m_VS.Shader; - case eShaderStage_Tess_Control: return m_GL->m_TCS.Shader; - case eShaderStage_Tess_Eval: return m_GL->m_TES.Shader; - case eShaderStage_Geometry: return m_GL->m_GS.Shader; - case eShaderStage_Fragment: return m_GL->m_FS.Shader; - case eShaderStage_Compute: return m_GL->m_CS.Shader; + case ShaderStage::Vertex: return m_GL->m_VS.Object; + case ShaderStage::Tess_Control: return m_GL->m_TCS.Object; + case ShaderStage::Tess_Eval: return m_GL->m_TES.Object; + case ShaderStage::Geometry: return m_GL->m_GS.Object; + case ShaderStage::Fragment: return m_GL->m_FS.Object; + case ShaderStage::Compute: return m_GL->m_CS.Object; default: break; } } @@ -342,12 +342,12 @@ ResourceId CommonPipelineState::GetShader(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: return m_Vulkan->m_VS.Shader; - case eShaderStage_Tess_Control: return m_Vulkan->m_TCS.Shader; - case eShaderStage_Tess_Eval: return m_Vulkan->m_TES.Shader; - case eShaderStage_Geometry: return m_Vulkan->m_GS.Shader; - case eShaderStage_Fragment: return m_Vulkan->m_FS.Shader; - case eShaderStage_Compute: return m_Vulkan->m_CS.Shader; + case ShaderStage::Vertex: return m_Vulkan->m_VS.Object; + case ShaderStage::Tess_Control: return m_Vulkan->m_TCS.Object; + case ShaderStage::Tess_Eval: return m_Vulkan->m_TES.Object; + case ShaderStage::Geometry: return m_Vulkan->m_GS.Object; + case ShaderStage::Fragment: return m_Vulkan->m_FS.Object; + case ShaderStage::Compute: return m_Vulkan->m_CS.Object; default: break; } } @@ -356,7 +356,7 @@ ResourceId CommonPipelineState::GetShader(ShaderStageType stage) return ResourceId(); } -QString CommonPipelineState::GetShaderName(ShaderStageType stage) +QString CommonPipelineState::GetShaderName(ShaderStage stage) { QString ret; @@ -366,12 +366,12 @@ QString CommonPipelineState::GetShaderName(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: ret = m_D3D11->m_VS.ShaderName; break; - case eShaderStage_Domain: ret = m_D3D11->m_DS.ShaderName; break; - case eShaderStage_Hull: ret = m_D3D11->m_HS.ShaderName; break; - case eShaderStage_Geometry: ret = m_D3D11->m_GS.ShaderName; break; - case eShaderStage_Pixel: ret = m_D3D11->m_PS.ShaderName; break; - case eShaderStage_Compute: ret = m_D3D11->m_CS.ShaderName; break; + case ShaderStage::Vertex: ret = m_D3D11->m_VS.ShaderName; break; + case ShaderStage::Domain: ret = m_D3D11->m_DS.ShaderName; break; + case ShaderStage::Hull: ret = m_D3D11->m_HS.ShaderName; break; + case ShaderStage::Geometry: ret = m_D3D11->m_GS.ShaderName; break; + case ShaderStage::Pixel: ret = m_D3D11->m_PS.ShaderName; break; + case ShaderStage::Compute: ret = m_D3D11->m_CS.ShaderName; break; default: break; } } @@ -379,12 +379,12 @@ QString CommonPipelineState::GetShaderName(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: ret = QString(m_D3D12->PipelineName) + " VS"; break; - case eShaderStage_Domain: ret = QString(m_D3D12->PipelineName) + " DS"; break; - case eShaderStage_Hull: ret = QString(m_D3D12->PipelineName) + " HS"; break; - case eShaderStage_Geometry: ret = QString(m_D3D12->PipelineName) + " GS"; break; - case eShaderStage_Pixel: ret = QString(m_D3D12->PipelineName) + " PS"; break; - case eShaderStage_Compute: ret = QString(m_D3D12->PipelineName) + " CS"; break; + case ShaderStage::Vertex: ret = QString(m_D3D12->PipelineName) + " VS"; break; + case ShaderStage::Domain: ret = QString(m_D3D12->PipelineName) + " DS"; break; + case ShaderStage::Hull: ret = QString(m_D3D12->PipelineName) + " HS"; break; + case ShaderStage::Geometry: ret = QString(m_D3D12->PipelineName) + " GS"; break; + case ShaderStage::Pixel: ret = QString(m_D3D12->PipelineName) + " PS"; break; + case ShaderStage::Compute: ret = QString(m_D3D12->PipelineName) + " CS"; break; default: break; } } @@ -392,12 +392,12 @@ QString CommonPipelineState::GetShaderName(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: ret = m_GL->m_VS.ShaderName; break; - case eShaderStage_Tess_Control: ret = m_GL->m_TCS.ShaderName; break; - case eShaderStage_Tess_Eval: ret = m_GL->m_TES.ShaderName; break; - case eShaderStage_Geometry: ret = m_GL->m_GS.ShaderName; break; - case eShaderStage_Fragment: ret = m_GL->m_FS.ShaderName; break; - case eShaderStage_Compute: ret = m_GL->m_CS.ShaderName; break; + case ShaderStage::Vertex: ret = m_GL->m_VS.ShaderName; break; + case ShaderStage::Tess_Control: ret = m_GL->m_TCS.ShaderName; break; + case ShaderStage::Tess_Eval: ret = m_GL->m_TES.ShaderName; break; + case ShaderStage::Geometry: ret = m_GL->m_GS.ShaderName; break; + case ShaderStage::Fragment: ret = m_GL->m_FS.ShaderName; break; + case ShaderStage::Compute: ret = m_GL->m_CS.ShaderName; break; default: break; } } @@ -405,12 +405,12 @@ QString CommonPipelineState::GetShaderName(ShaderStageType stage) { switch(stage) { - case eShaderStage_Vertex: ret = m_Vulkan->m_VS.ShaderName; break; - case eShaderStage_Domain: ret = m_Vulkan->m_TCS.ShaderName; break; - case eShaderStage_Hull: ret = m_Vulkan->m_TES.ShaderName; break; - case eShaderStage_Geometry: ret = m_Vulkan->m_GS.ShaderName; break; - case eShaderStage_Pixel: ret = m_Vulkan->m_FS.ShaderName; break; - case eShaderStage_Compute: ret = m_Vulkan->m_CS.ShaderName; break; + case ShaderStage::Vertex: ret = m_Vulkan->m_VS.ShaderName; break; + case ShaderStage::Domain: ret = m_Vulkan->m_TCS.ShaderName; break; + case ShaderStage::Hull: ret = m_Vulkan->m_TES.ShaderName; break; + case ShaderStage::Geometry: ret = m_Vulkan->m_GS.ShaderName; break; + case ShaderStage::Pixel: ret = m_Vulkan->m_FS.ShaderName; break; + case ShaderStage::Compute: ret = m_Vulkan->m_CS.ShaderName; break; default: break; } } @@ -721,19 +721,19 @@ QVector CommonPipelineState::GetVertexInputs() if(!attrs[i].Enabled) { uint32_t compCount = m_GL->m_VS.ShaderDetails->InputSig[attrib].compCount; - FormatComponentType compType = m_GL->m_VS.ShaderDetails->InputSig[attrib].compType; + CompType compType = m_GL->m_VS.ShaderDetails->InputSig[attrib].compType; for(uint32_t c = 0; c < compCount; c++) { - if(compType == eCompType_Float) + if(compType == CompType::Float) ret[a].GenericValue.value_f[c] = attrs[i].GenericValue.f[c]; - else if(compType == eCompType_UInt) + else if(compType == CompType::UInt) ret[a].GenericValue.value_u[c] = attrs[i].GenericValue.u[c]; - else if(compType == eCompType_SInt) + else if(compType == CompType::SInt) ret[a].GenericValue.value_i[c] = attrs[i].GenericValue.i[c]; - else if(compType == eCompType_UScaled) + else if(compType == CompType::UScaled) ret[a].GenericValue.value_f[c] = (float)attrs[i].GenericValue.u[c]; - else if(compType == eCompType_SScaled) + else if(compType == CompType::SScaled) ret[a].GenericValue.value_f[c] = (float)attrs[i].GenericValue.i[c]; } @@ -811,15 +811,14 @@ QVector CommonPipelineState::GetVertexInputs() return QVector(); } -void CommonPipelineState::GetConstantBuffer(ShaderStageType stage, uint32_t BufIdx, - uint32_t ArrayIdx, ResourceId &buf, - uint64_t &ByteOffset, uint64_t &ByteSize) +void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx, uint32_t ArrayIdx, + ResourceId &buf, uint64_t &ByteOffset, uint64_t &ByteSize) { if(LogLoaded()) { if(IsLogD3D11()) { - const D3D11PipelineState::ShaderStage &s = GetD3D11Stage(stage); + const D3D11PipelineState::Shader &s = GetD3D11Stage(stage); if(BufIdx < (uint32_t)s.ConstantBuffers.count) { @@ -832,7 +831,7 @@ void CommonPipelineState::GetConstantBuffer(ShaderStageType stage, uint32_t BufI } else if(IsLogD3D12()) { - const D3D12PipelineState::ShaderStage &s = GetD3D12Stage(stage); + const D3D12PipelineState::Shader &s = GetD3D12Stage(stage); if(s.ShaderDetails != NULL && BufIdx < (uint32_t)s.ShaderDetails->ConstantBlocks.count) { @@ -859,7 +858,7 @@ void CommonPipelineState::GetConstantBuffer(ShaderStageType stage, uint32_t BufI } else if(IsLogGL()) { - const GLPipelineState::ShaderStage &s = GetGLStage(stage); + const GLPipelineState::Shader &s = GetGLStage(stage); if(s.ShaderDetails != NULL && BufIdx < (uint32_t)s.ShaderDetails->ConstantBlocks.count) { @@ -883,8 +882,8 @@ void CommonPipelineState::GetConstantBuffer(ShaderStageType stage, uint32_t BufI else if(IsLogVK()) { VulkanPipelineState::Pipeline &pipe = - stage == eShaderStage_Compute ? m_Vulkan->compute : m_Vulkan->graphics; - const VulkanPipelineState::ShaderStage &s = GetVulkanStage(stage); + stage == ShaderStage::Compute ? m_Vulkan->compute : m_Vulkan->graphics; + const VulkanPipelineState::Shader &s = GetVulkanStage(stage); if(s.ShaderDetails != NULL && BufIdx < (uint32_t)s.ShaderDetails->ConstantBlocks.count) { @@ -916,7 +915,7 @@ void CommonPipelineState::GetConstantBuffer(ShaderStageType stage, uint32_t BufI ByteSize = 0; } -QMap> CommonPipelineState::GetReadOnlyResources(ShaderStageType stage) +QMap> CommonPipelineState::GetReadOnlyResources(ShaderStage stage) { QMap> ret; @@ -924,7 +923,7 @@ QMap> CommonPipelineState::GetReadOnlyResou { if(IsLogD3D11()) { - const D3D11PipelineState::ShaderStage &s = GetD3D11Stage(stage); + const D3D11PipelineState::Shader &s = GetD3D11Stage(stage); for(int i = 0; i < s.SRVs.count; i++) { @@ -943,7 +942,7 @@ QMap> CommonPipelineState::GetReadOnlyResou } else if(IsLogD3D12()) { - const D3D12PipelineState::ShaderStage &s = GetD3D12Stage(stage); + const D3D12PipelineState::Shader &s = GetD3D12Stage(stage); for(int space = 0; space < s.Spaces.count; space++) { @@ -974,7 +973,7 @@ QMap> CommonPipelineState::GetReadOnlyResou val.Id = m_GL->Textures[i].Resource; val.HighestMip = (int)m_GL->Textures[i].HighestMip; val.FirstSlice = (int)m_GL->Textures[i].FirstSlice; - val.typeHint = eCompType_None; + val.typeHint = CompType::Typeless; ret[key] = {val}; } @@ -984,9 +983,9 @@ QMap> CommonPipelineState::GetReadOnlyResou else if(IsLogVK()) { const auto &descsets = - stage == eShaderStage_Compute ? m_Vulkan->compute.DescSets : m_Vulkan->graphics.DescSets; + stage == ShaderStage::Compute ? m_Vulkan->compute.DescSets : m_Vulkan->graphics.DescSets; - ShaderStageBits mask = (ShaderStageBits)(1 << (int)stage); + ShaderStageMask mask = MaskForStage(stage); for(int set = 0; set < descsets.count; set++) { @@ -994,8 +993,8 @@ QMap> CommonPipelineState::GetReadOnlyResou for(int slot = 0; slot < descset.bindings.count; slot++) { const auto &bind = descset.bindings[slot]; - if((bind.type == eBindType_ImageSampler || bind.type == eBindType_InputAttachment || - bind.type == eBindType_ReadOnlyImage || bind.type == eBindType_ReadOnlyTBuffer) && + if((bind.type == BindType::ImageSampler || bind.type == BindType::InputAttachment || + bind.type == BindType::ReadOnlyImage || bind.type == BindType::ReadOnlyTBuffer) && (bind.stageFlags & mask) == mask) { BindpointMap key(set, slot); @@ -1021,8 +1020,7 @@ QMap> CommonPipelineState::GetReadOnlyResou return ret; } -QMap> CommonPipelineState::GetReadWriteResources( - ShaderStageType stage) +QMap> CommonPipelineState::GetReadWriteResources(ShaderStage stage) { QMap> ret; @@ -1030,7 +1028,7 @@ QMap> CommonPipelineState::GetReadWriteReso { if(IsLogD3D11()) { - if(stage == eShaderStage_Compute) + if(stage == ShaderStage::Compute) { for(int i = 0; i < m_D3D11->m_CS.UAVs.count; i++) { @@ -1074,7 +1072,7 @@ QMap> CommonPipelineState::GetReadWriteReso } else if(IsLogD3D12()) { - const D3D12PipelineState::ShaderStage &s = GetD3D12Stage(stage); + const D3D12PipelineState::Shader &s = GetD3D12Stage(stage); for(int space = 0; space < s.Spaces.count; space++) { @@ -1111,9 +1109,9 @@ QMap> CommonPipelineState::GetReadWriteReso else if(IsLogVK()) { const auto &descsets = - stage == eShaderStage_Compute ? m_Vulkan->compute.DescSets : m_Vulkan->graphics.DescSets; + stage == ShaderStage::Compute ? m_Vulkan->compute.DescSets : m_Vulkan->graphics.DescSets; - ShaderStageBits mask = (ShaderStageBits)(1 << (int)stage); + ShaderStageMask mask = MaskForStage(stage); for(int set = 0; set < descsets.count; set++) { @@ -1121,8 +1119,8 @@ QMap> CommonPipelineState::GetReadWriteReso for(int slot = 0; slot < descset.bindings.count; slot++) { const auto &bind = descset.bindings[slot]; - if((bind.type == eBindType_ReadWriteBuffer || bind.type == eBindType_ReadWriteImage || - bind.type == eBindType_ReadWriteTBuffer) && + if((bind.type == BindType::ReadWriteBuffer || bind.type == BindType::ReadWriteImage || + bind.type == BindType::ReadWriteTBuffer) && (bind.stageFlags & mask) == mask) { BindpointMap key(set, slot); @@ -1174,7 +1172,7 @@ BoundResource CommonPipelineState::GetDepthTarget() ret.Id = m_GL->m_FB.m_DrawFBO.Depth.Obj; ret.HighestMip = (int)m_GL->m_FB.m_DrawFBO.Depth.Mip; ret.FirstSlice = (int)m_GL->m_FB.m_DrawFBO.Depth.Layer; - ret.typeHint = eCompType_None; + ret.typeHint = CompType::Typeless; return ret; } else if(IsLogVK()) @@ -1239,7 +1237,7 @@ QVector CommonPipelineState::GetOutputTargets() ret[i].Id = m_GL->m_FB.m_DrawFBO.Color[db].Obj; ret[i].HighestMip = (int)m_GL->m_FB.m_DrawFBO.Color[db].Mip; ret[i].FirstSlice = (int)m_GL->m_FB.m_DrawFBO.Color[db].Layer; - ret[i].typeHint = eCompType_None; + ret[i].typeHint = CompType::Typeless; } } } diff --git a/qrenderdoc/Code/CommonPipelineState.h b/qrenderdoc/Code/CommonPipelineState.h index a03de886d..32a62d2f6 100644 --- a/qrenderdoc/Code/CommonPipelineState.h +++ b/qrenderdoc/Code/CommonPipelineState.h @@ -37,20 +37,20 @@ struct BoundResource Id = ResourceId(); HighestMip = -1; FirstSlice = -1; - typeHint = eCompType_None; + typeHint = CompType::Typeless; } BoundResource(ResourceId id) { Id = id; HighestMip = -1; FirstSlice = -1; - typeHint = eCompType_None; + typeHint = CompType::Typeless; } ResourceId Id; int HighestMip; int FirstSlice; - FormatComponentType typeHint; + CompType typeHint; }; struct BoundVBuffer @@ -91,7 +91,7 @@ public: m_Vulkan = vk; } - GraphicsAPI DefaultType = eGraphicsAPI_D3D11; + GraphicsAPI DefaultType = GraphicsAPI::D3D11; bool LogLoaded() { @@ -100,22 +100,22 @@ public: bool IsLogD3D11() { - return LogLoaded() && m_APIProps.pipelineType == eGraphicsAPI_D3D11 && m_D3D11 != NULL; + return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::D3D11 && m_D3D11 != NULL; } bool IsLogD3D12() { - return LogLoaded() && m_APIProps.pipelineType == eGraphicsAPI_D3D12 && m_D3D12 != NULL; + return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::D3D12 && m_D3D12 != NULL; } bool IsLogGL() { - return LogLoaded() && m_APIProps.pipelineType == eGraphicsAPI_OpenGL && m_GL != NULL; + return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::OpenGL && m_GL != NULL; } bool IsLogVK() { - return LogLoaded() && m_APIProps.pipelineType == eGraphicsAPI_Vulkan && m_Vulkan != NULL; + return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::Vulkan && m_Vulkan != NULL; } // add a bunch of generic properties that people can check to save having to see which pipeline @@ -126,16 +126,16 @@ public: if(LogLoaded()) { if(IsLogD3D11()) - return m_D3D11 != NULL && m_D3D11->m_HS.Shader != ResourceId(); + return m_D3D11 != NULL && m_D3D11->m_HS.Object != ResourceId(); if(IsLogD3D12()) - return m_D3D12 != NULL && m_D3D12->m_HS.Shader != ResourceId(); + return m_D3D12 != NULL && m_D3D12->m_HS.Object != ResourceId(); if(IsLogGL()) - return m_GL != NULL && m_GL->m_TES.Shader != ResourceId(); + return m_GL != NULL && m_GL->m_TES.Object != ResourceId(); if(IsLogVK()) - return m_Vulkan != NULL && m_Vulkan->m_TES.Shader != ResourceId(); + return m_Vulkan != NULL && m_Vulkan->m_TES.Object != ResourceId(); } return false; @@ -149,24 +149,24 @@ public: // shaders to dump data might have these alignment requirements bool HasAlignedPostVSData() { return LogLoaded() && IsLogVK(); } QString GetImageLayout(ResourceId id); - QString Abbrev(ShaderStageType stage); + QString Abbrev(ShaderStage stage); QString OutputAbbrev(); Viewport GetViewport(int index); - const ShaderBindpointMapping &GetBindpointMapping(ShaderStageType stage); - const ShaderReflection *GetShaderReflection(ShaderStageType stage); - QString GetShaderEntryPoint(ShaderStageType stage); - ResourceId GetShader(ShaderStageType stage); - QString GetShaderName(ShaderStageType stage); + const ShaderBindpointMapping &GetBindpointMapping(ShaderStage stage); + const ShaderReflection *GetShaderReflection(ShaderStage stage); + QString GetShaderEntryPoint(ShaderStage stage); + ResourceId GetShader(ShaderStage stage); + QString GetShaderName(ShaderStage stage); void GetIBuffer(ResourceId &buf, uint64_t &ByteOffset); bool IsStripRestartEnabled(); uint32_t GetStripRestartIndex(uint32_t indexByteWidth); QVector GetVBuffers(); QVector GetVertexInputs(); - void GetConstantBuffer(ShaderStageType stage, uint32_t BufIdx, uint32_t ArrayIdx, ResourceId &buf, + void GetConstantBuffer(ShaderStage stage, uint32_t BufIdx, uint32_t ArrayIdx, ResourceId &buf, uint64_t &ByteOffset, uint64_t &ByteSize); - QMap> GetReadOnlyResources(ShaderStageType stage); - QMap> GetReadWriteResources(ShaderStageType stage); + QMap> GetReadOnlyResources(ShaderStage stage); + QMap> GetReadWriteResources(ShaderStage stage); BoundResource GetDepthTarget(); QVector GetOutputTargets(); @@ -177,76 +177,76 @@ private: VulkanPipelineState *m_Vulkan = NULL; APIProperties m_APIProps; - const D3D11PipelineState::ShaderStage &GetD3D11Stage(ShaderStageType stage) + const D3D11PipelineState::Shader &GetD3D11Stage(ShaderStage stage) { - if(stage == eShaderStage_Vertex) + if(stage == ShaderStage::Vertex) return m_D3D11->m_VS; - if(stage == eShaderStage_Domain) + if(stage == ShaderStage::Domain) return m_D3D11->m_DS; - if(stage == eShaderStage_Hull) + if(stage == ShaderStage::Hull) return m_D3D11->m_HS; - if(stage == eShaderStage_Geometry) + if(stage == ShaderStage::Geometry) return m_D3D11->m_GS; - if(stage == eShaderStage_Pixel) + if(stage == ShaderStage::Pixel) return m_D3D11->m_PS; - if(stage == eShaderStage_Compute) + if(stage == ShaderStage::Compute) return m_D3D11->m_CS; qCritical() << "Error - invalid stage " << (int)stage; return m_D3D11->m_CS; } - const D3D12PipelineState::ShaderStage &GetD3D12Stage(ShaderStageType stage) + const D3D12PipelineState::Shader &GetD3D12Stage(ShaderStage stage) { - if(stage == eShaderStage_Vertex) + if(stage == ShaderStage::Vertex) return m_D3D12->m_VS; - if(stage == eShaderStage_Domain) + if(stage == ShaderStage::Domain) return m_D3D12->m_DS; - if(stage == eShaderStage_Hull) + if(stage == ShaderStage::Hull) return m_D3D12->m_HS; - if(stage == eShaderStage_Geometry) + if(stage == ShaderStage::Geometry) return m_D3D12->m_GS; - if(stage == eShaderStage_Pixel) + if(stage == ShaderStage::Pixel) return m_D3D12->m_PS; - if(stage == eShaderStage_Compute) + if(stage == ShaderStage::Compute) return m_D3D12->m_CS; qCritical() << "Error - invalid stage " << (int)stage; return m_D3D12->m_CS; } - const GLPipelineState::ShaderStage &GetGLStage(ShaderStageType stage) + const GLPipelineState::Shader &GetGLStage(ShaderStage stage) { - if(stage == eShaderStage_Vertex) + if(stage == ShaderStage::Vertex) return m_GL->m_VS; - if(stage == eShaderStage_Tess_Control) + if(stage == ShaderStage::Tess_Control) return m_GL->m_TCS; - if(stage == eShaderStage_Tess_Eval) + if(stage == ShaderStage::Tess_Eval) return m_GL->m_TES; - if(stage == eShaderStage_Geometry) + if(stage == ShaderStage::Geometry) return m_GL->m_GS; - if(stage == eShaderStage_Fragment) + if(stage == ShaderStage::Fragment) return m_GL->m_FS; - if(stage == eShaderStage_Compute) + if(stage == ShaderStage::Compute) return m_GL->m_CS; qCritical() << "Error - invalid stage " << (int)stage; return m_GL->m_CS; } - const VulkanPipelineState::ShaderStage &GetVulkanStage(ShaderStageType stage) + const VulkanPipelineState::Shader &GetVulkanStage(ShaderStage stage) { - if(stage == eShaderStage_Vertex) + if(stage == ShaderStage::Vertex) return m_Vulkan->m_VS; - if(stage == eShaderStage_Tess_Control) + if(stage == ShaderStage::Tess_Control) return m_Vulkan->m_TCS; - if(stage == eShaderStage_Tess_Eval) + if(stage == ShaderStage::Tess_Eval) return m_Vulkan->m_TES; - if(stage == eShaderStage_Geometry) + if(stage == ShaderStage::Geometry) return m_Vulkan->m_GS; - if(stage == eShaderStage_Fragment) + if(stage == ShaderStage::Fragment) return m_Vulkan->m_FS; - if(stage == eShaderStage_Compute) + if(stage == ShaderStage::Compute) return m_Vulkan->m_CS; qCritical() << "Error - invalid stage " << (int)stage; diff --git a/qrenderdoc/Code/FormatElement.cpp b/qrenderdoc/Code/FormatElement.cpp index e5936f10b..2f13b09ad 100644 --- a/qrenderdoc/Code/FormatElement.cpp +++ b/qrenderdoc/Code/FormatElement.cpp @@ -28,30 +28,30 @@ static QVariant interpret(const ResourceFormat &f, uint16_t comp) { - if(f.compByteWidth != 2 || f.compType == eCompType_Float) + if(f.compByteWidth != 2 || f.compType == CompType::Float) return QVariant(); - if(f.compType == eCompType_SInt) + if(f.compType == CompType::SInt) { return (int16_t)comp; } - else if(f.compType == eCompType_UInt) + else if(f.compType == CompType::UInt) { return comp; } - else if(f.compType == eCompType_SScaled) + else if(f.compType == CompType::SScaled) { return (float)((int16_t)comp); } - else if(f.compType == eCompType_UScaled) + else if(f.compType == CompType::UScaled) { return (float)comp; } - else if(f.compType == eCompType_UNorm) + else if(f.compType == CompType::UNorm) { return (float)comp / (float)0xffff; } - else if(f.compType == eCompType_SNorm) + else if(f.compType == CompType::SNorm) { int16_t cast = (int16_t)comp; @@ -70,30 +70,30 @@ static QVariant interpret(const ResourceFormat &f, uint16_t comp) static QVariant interpret(const ResourceFormat &f, byte comp) { - if(f.compByteWidth != 1 || f.compType == eCompType_Float) + if(f.compByteWidth != 1 || f.compType == CompType::Float) return QVariant(); - if(f.compType == eCompType_SInt) + if(f.compType == CompType::SInt) { return (int8_t)comp; } - else if(f.compType == eCompType_UInt) + else if(f.compType == CompType::UInt) { return comp; } - else if(f.compType == eCompType_SScaled) + else if(f.compType == CompType::SScaled) { return (float)((int8_t)comp); } - else if(f.compType == eCompType_UScaled) + else if(f.compType == CompType::UScaled) { return (float)comp; } - else if(f.compType == eCompType_UNorm) + else if(f.compType == CompType::UNorm) { return ((float)comp) / 255.0f; } - else if(f.compType == eCompType_SNorm) + else if(f.compType == CompType::SNorm) { int8_t cast = (int8_t)comp; @@ -120,7 +120,7 @@ FormatElement::FormatElement() rowmajor = false; matrixdim = 0; hex = false; - systemValue = eAttr_None; + systemValue = ShaderBuiltin::Undefined; } FormatElement::FormatElement(const QString &Name, int buf, uint offs, bool perInst, int instRate, @@ -135,7 +135,7 @@ FormatElement::FormatElement(const QString &Name, int buf, uint offs, bool perIn rowmajor = rowMat; matrixdim = matDim; hex = hexDisplay; - systemValue = eAttr_None; + systemValue = ShaderBuiltin::Undefined; } QList FormatElement::ParseFormatString(const QString &formatString, uint64_t maxLen, @@ -211,11 +211,11 @@ QList FormatElement::ParseFormatString(const QString &formatStrin } ResourceFormat fmt; - fmt.compType = eCompType_None; + fmt.compType = CompType::Typeless; bool hex = false; - FormatComponentType type = eCompType_Float; + CompType type = CompType::Float; uint32_t count = 0; uint32_t arrayCount = 1; uint32_t matrixCount = 0; @@ -254,97 +254,97 @@ QList FormatElement::ParseFormatString(const QString &formatStrin if(basetype == "bool") { - type = eCompType_UInt; + type = CompType::UInt; width = 4; } else if(basetype == "byte") { - type = eCompType_SInt; + type = CompType::SInt; width = 1; } else if(basetype == "ubyte" || basetype == "xbyte") { - type = eCompType_UInt; + type = CompType::UInt; width = 1; } else if(basetype == "short") { - type = eCompType_SInt; + type = CompType::SInt; width = 2; } else if(basetype == "ushort" || basetype == "xshort") { - type = eCompType_UInt; + type = CompType::UInt; width = 2; } else if(basetype == "int" || basetype == "ivec" || basetype == "imat") { - type = eCompType_SInt; + type = CompType::SInt; width = 4; } else if(basetype == "uint" || basetype == "xint" || basetype == "uvec" || basetype == "umat") { - type = eCompType_UInt; + type = CompType::UInt; width = 4; } else if(basetype == "half") { - type = eCompType_Float; + type = CompType::Float; width = 2; } else if(basetype == "float" || basetype == "vec" || basetype == "mat") { - type = eCompType_Float; + type = CompType::Float; width = 4; } else if(basetype == "double") { - type = eCompType_Double; + type = CompType::Double; width = 8; } else if(basetype == "unormh") { - type = eCompType_UNorm; + type = CompType::UNorm; width = 2; } else if(basetype == "unormb") { - type = eCompType_UNorm; + type = CompType::UNorm; width = 1; } else if(basetype == "snormh") { - type = eCompType_SNorm; + type = CompType::SNorm; width = 2; } else if(basetype == "snormb") { - type = eCompType_SNorm; + type = CompType::SNorm; width = 1; } else if(basetype == "uintten") { - fmt.compType = eCompType_UInt; + fmt.compType = CompType::UInt; fmt.compCount = 4 * count; fmt.compByteWidth = 1; fmt.special = true; - fmt.specialFormat = eSpecial_R10G10B10A2; + fmt.specialFormat = SpecialFormat::R10G10B10A2; } else if(basetype == "unormten") { - fmt.compType = eCompType_UInt; + fmt.compType = CompType::UInt; fmt.compCount = 4 * count; fmt.compByteWidth = 1; fmt.special = true; - fmt.specialFormat = eSpecial_R10G10B10A2; + fmt.specialFormat = SpecialFormat::R10G10B10A2; } else if(basetype == "floateleven") { - fmt.compType = eCompType_Float; + fmt.compType = CompType::Float; fmt.compCount = 3 * count; fmt.compByteWidth = 1; fmt.special = true; - fmt.specialFormat = eSpecial_R11G11B10; + fmt.specialFormat = SpecialFormat::R11G11B10; } else { @@ -357,7 +357,7 @@ QList FormatElement::ParseFormatString(const QString &formatStrin if(basetype == "xint" || basetype == "xshort" || basetype == "xbyte") hex = true; - if(fmt.compType == eCompType_None) + if(fmt.compType == CompType::Typeless) { fmt.compType = type; fmt.compCount = count; @@ -423,7 +423,7 @@ QList FormatElement::ParseFormatString(const QString &formatStrin elems.clear(); ResourceFormat fmt; - fmt.compType = eCompType_UInt; + fmt.compType = CompType::UInt; fmt.compByteWidth = 4; fmt.compCount = 4; @@ -460,7 +460,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons bool ok = true; - if(format.special && format.specialFormat == eSpecial_R5G5B5A1) + if(format.special && format.specialFormat == SpecialFormat::R5G5B5A1) { uint16_t packed = readObj(data, end, ok); @@ -476,7 +476,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons ret[0] = tmp; } } - else if(format.special && format.specialFormat == eSpecial_R5G6B5) + else if(format.special && format.specialFormat == SpecialFormat::R5G6B5) { uint16_t packed = readObj(data, end, ok); @@ -491,7 +491,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons ret[0] = tmp; } } - else if(format.special && format.specialFormat == eSpecial_R4G4B4A4) + else if(format.special && format.specialFormat == SpecialFormat::R4G4B4A4) { uint16_t packed = readObj(data, end, ok); @@ -507,7 +507,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons ret[0] = tmp; } } - else if(format.special && format.specialFormat == eSpecial_R10G10B10A2) + else if(format.special && format.specialFormat == SpecialFormat::R10G10B10A2) { // allow for vectors of this format - for raw buffer viewer for(int i = 0; i < int(format.compCount / 4); i++) @@ -526,21 +526,21 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons r = tmp; } - if(format.compType == eCompType_UInt) + if(format.compType == CompType::UInt) { ret.push_back(r); ret.push_back(g); ret.push_back(b); ret.push_back(a); } - else if(format.compType == eCompType_UScaled) + else if(format.compType == CompType::UScaled) { ret.push_back((float)r); ret.push_back((float)g); ret.push_back((float)b); ret.push_back((float)a); } - else if(format.compType == eCompType_SInt || format.compType == eCompType_SScaled) + else if(format.compType == CompType::SInt || format.compType == CompType::SScaled) { int ir, ig, ib, ia; @@ -566,14 +566,14 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons else ia = ((int)a) - 4; - if(format.compType == eCompType_SInt) + if(format.compType == CompType::SInt) { ret.push_back(ir); ret.push_back(ig); ret.push_back(ib); ret.push_back(ia); } - else if(format.compType == eCompType_SScaled) + else if(format.compType == CompType::SScaled) { ret.push_back((float)ir); ret.push_back((float)ig); @@ -590,7 +590,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons } } } - else if(format.special && format.specialFormat == eSpecial_R11G11B10) + else if(format.special && format.specialFormat == SpecialFormat::R11G11B10) { uint32_t packed = readObj(data, end, ok); @@ -645,7 +645,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons for(int i = 0; i < dim; i++) { - if(format.compType == eCompType_Float) + if(format.compType == CompType::Float) { if(format.compByteWidth == 8) ret.push_back(readObj(data, end, ok)); @@ -654,7 +654,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons else if(format.compByteWidth == 2) ret.push_back(Maths_HalfToFloat(readObj(data, end, ok))); } - else if(format.compType == eCompType_SInt) + else if(format.compType == CompType::SInt) { if(format.compByteWidth == 4) ret.push_back((int)readObj(data, end, ok)); @@ -663,7 +663,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons else if(format.compByteWidth == 1) ret.push_back((int)readObj(data, end, ok)); } - else if(format.compType == eCompType_UInt) + else if(format.compType == CompType::UInt) { if(format.compByteWidth == 4) ret.push_back((uint32_t)readObj(data, end, ok)); @@ -672,7 +672,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons else if(format.compByteWidth == 1) ret.push_back((uint32_t)readObj(data, end, ok)); } - else if(format.compType == eCompType_UScaled) + else if(format.compType == CompType::UScaled) { if(format.compByteWidth == 4) ret.push_back((float)readObj(data, end, ok)); @@ -681,7 +681,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons else if(format.compByteWidth == 1) ret.push_back((float)readObj(data, end, ok)); } - else if(format.compType == eCompType_SScaled) + else if(format.compType == CompType::SScaled) { if(format.compByteWidth == 4) ret.push_back((float)readObj(data, end, ok)); @@ -690,7 +690,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons else if(format.compByteWidth == 1) ret.push_back((float)readObj(data, end, ok)); } - else if(format.compType == eCompType_Depth) + else if(format.compType == CompType::Depth) { if(format.compByteWidth == 4) { @@ -711,7 +711,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons ret.push_back(f / (float)0x0000ffff); } } - else if(format.compType == eCompType_Double) + else if(format.compType == CompType::Double) { ret.push_back(readObj(data, end, ok)); } @@ -758,13 +758,13 @@ ShaderVariable FormatElement::GetShaderVar(const byte *&data, const byte *end) c ShaderVariable ret; ret.name = name.toUtf8().data(); - ret.type = eVar_Float; - if(format.compType == eCompType_UInt) - ret.type = eVar_UInt; - if(format.compType == eCompType_SInt) - ret.type = eVar_Int; - if(format.compType == eCompType_Double) - ret.type = eVar_Double; + ret.type = VarType::Float; + if(format.compType == CompType::UInt) + ret.type = VarType::UInt; + if(format.compType == CompType::SInt) + ret.type = VarType::Int; + if(format.compType == CompType::Double) + ret.type = VarType::Double; ret.columns = qMin(format.compCount, 4U); ret.rows = qMin(matrixdim, 4U); @@ -788,11 +788,11 @@ ShaderVariable FormatElement::GetShaderVar(const byte *&data, const byte *end) c const QVariant &o = objs[src]; - if(ret.type == eVar_Double) + if(ret.type == VarType::Double) ret.value.dv[dst] = o.toDouble(); - else if(ret.type == eVar_UInt) + else if(ret.type == VarType::UInt) ret.value.uv[dst] = o.toUInt(); - else if(ret.type == eVar_Int) + else if(ret.type == VarType::Int) ret.value.iv[dst] = o.toInt(); else ret.value.fv[dst] = o.toFloat(); @@ -808,11 +808,13 @@ uint32_t FormatElement::byteSize() const if(format.special) { - if(format.specialFormat == eSpecial_R5G5B5A1 || format.specialFormat == eSpecial_R5G6B5 || - format.specialFormat == eSpecial_R4G4B4A4) + if(format.specialFormat == SpecialFormat::R5G5B5A1 || + format.specialFormat == SpecialFormat::R5G6B5 || + format.specialFormat == SpecialFormat::R4G4B4A4) vecSize = 2; - if(format.specialFormat == eSpecial_R10G10B10A2 || format.specialFormat == eSpecial_R11G11B10) + if(format.specialFormat == SpecialFormat::R10G10B10A2 || + format.specialFormat == SpecialFormat::R11G11B10) vecSize = 4; } @@ -831,7 +833,7 @@ QString TypeString(const ShaderVariable &v) QString typeStr = ToQStr(v.type); - if(v.displayAsHex && v.type == eVar_UInt) + if(v.displayAsHex && v.type == VarType::UInt) typeStr = "xint"; if(v.rows == 1 && v.columns == 1) @@ -858,18 +860,18 @@ static QString RowValuesToString(int cols, el x, el y, el z, el w) QString RowString(const ShaderVariable &v, uint32_t row, VarType type) { - if(type == eVar_Unknown) + if(type == VarType::Unknown) type = v.type; - if(type == eVar_Double) + if(type == VarType::Double) return RowValuesToString((int)v.columns, v.value.dv[row * v.columns + 0], v.value.dv[row * v.columns + 1], v.value.dv[row * v.columns + 2], v.value.dv[row * v.columns + 3]); - else if(type == eVar_Int) + else if(type == VarType::Int) return RowValuesToString((int)v.columns, v.value.iv[row * v.columns + 0], v.value.iv[row * v.columns + 1], v.value.iv[row * v.columns + 2], v.value.iv[row * v.columns + 3]); - else if(type == eVar_UInt) + else if(type == VarType::UInt) return RowValuesToString((int)v.columns, v.value.uv[row * v.columns + 0], v.value.uv[row * v.columns + 1], v.value.uv[row * v.columns + 2], v.value.uv[row * v.columns + 3]); @@ -913,7 +915,7 @@ QString RowTypeString(const ShaderVariable &v) QString typeStr = ToQStr(v.type); - if(v.displayAsHex && v.type == eVar_UInt) + if(v.displayAsHex && v.type == VarType::UInt) typeStr = "xint"; if(v.columns == 1) diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 5f9a22f0b..fff4efc01 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -44,107 +44,107 @@ QString ToQStr(const ResourceUsage usage, const GraphicsAPI apitype) { switch(usage) { - case eUsage_VertexBuffer: return "Vertex Buffer"; - case eUsage_IndexBuffer: return "Index Buffer"; + case ResourceUsage::VertexBuffer: return "Vertex Buffer"; + case ResourceUsage::IndexBuffer: return "Index Buffer"; - case eUsage_VS_Constants: return "VS - Constant Buffer"; - case eUsage_GS_Constants: return "GS - Constant Buffer"; - case eUsage_HS_Constants: return "HS - Constant Buffer"; - case eUsage_DS_Constants: return "DS - Constant Buffer"; - case eUsage_CS_Constants: return "CS - Constant Buffer"; - case eUsage_PS_Constants: return "PS - Constant Buffer"; - case eUsage_All_Constants: return "All - Constant Buffer"; + case ResourceUsage::VS_Constants: return "VS - Constant Buffer"; + case ResourceUsage::GS_Constants: return "GS - Constant Buffer"; + case ResourceUsage::HS_Constants: return "HS - Constant Buffer"; + case ResourceUsage::DS_Constants: return "DS - Constant Buffer"; + case ResourceUsage::CS_Constants: return "CS - Constant Buffer"; + case ResourceUsage::PS_Constants: return "PS - Constant Buffer"; + case ResourceUsage::All_Constants: return "All - Constant Buffer"; - case eUsage_SO: return "Stream Out"; + case ResourceUsage::StreamOut: return "Stream Out"; - case eUsage_VS_Resource: return "VS - Resource"; - case eUsage_GS_Resource: return "GS - Resource"; - case eUsage_HS_Resource: return "HS - Resource"; - case eUsage_DS_Resource: return "DS - Resource"; - case eUsage_CS_Resource: return "CS - Resource"; - case eUsage_PS_Resource: return "PS - Resource"; - case eUsage_All_Resource: return "All - Resource"; + case ResourceUsage::VS_Resource: return "VS - Resource"; + case ResourceUsage::GS_Resource: return "GS - Resource"; + case ResourceUsage::HS_Resource: return "HS - Resource"; + case ResourceUsage::DS_Resource: return "DS - Resource"; + case ResourceUsage::CS_Resource: return "CS - Resource"; + case ResourceUsage::PS_Resource: return "PS - Resource"; + case ResourceUsage::All_Resource: return "All - Resource"; - case eUsage_VS_RWResource: return "VS - UAV"; - case eUsage_HS_RWResource: return "HS - UAV"; - case eUsage_DS_RWResource: return "DS - UAV"; - case eUsage_GS_RWResource: return "GS - UAV"; - case eUsage_PS_RWResource: return "PS - UAV"; - case eUsage_CS_RWResource: return "CS - UAV"; - case eUsage_All_RWResource: return "All - UAV"; + case ResourceUsage::VS_RWResource: return "VS - UAV"; + case ResourceUsage::HS_RWResource: return "HS - UAV"; + case ResourceUsage::DS_RWResource: return "DS - UAV"; + case ResourceUsage::GS_RWResource: return "GS - UAV"; + case ResourceUsage::PS_RWResource: return "PS - UAV"; + case ResourceUsage::CS_RWResource: return "CS - UAV"; + case ResourceUsage::All_RWResource: return "All - UAV"; - case eUsage_InputTarget: return "Colour Input"; - case eUsage_ColourTarget: return "Rendertarget"; - case eUsage_DepthStencilTarget: return "Depthstencil"; + case ResourceUsage::InputTarget: return "Colour Input"; + case ResourceUsage::ColourTarget: return "Rendertarget"; + case ResourceUsage::DepthStencilTarget: return "Depthstencil"; - case eUsage_Indirect: return "Indirect argument"; + case ResourceUsage::Indirect: return "Indirect argument"; - case eUsage_Clear: return "Clear"; + case ResourceUsage::Clear: return "Clear"; - case eUsage_GenMips: return "Generate Mips"; - case eUsage_Resolve: return "Resolve"; - case eUsage_ResolveSrc: return "Resolve - Source"; - case eUsage_ResolveDst: return "Resolve - Dest"; - case eUsage_Copy: return "Copy"; - case eUsage_CopySrc: return "Copy - Source"; - case eUsage_CopyDst: return "Copy - Dest"; + case ResourceUsage::GenMips: return "Generate Mips"; + case ResourceUsage::Resolve: return "Resolve"; + case ResourceUsage::ResolveSrc: return "Resolve - Source"; + case ResourceUsage::ResolveDst: return "Resolve - Dest"; + case ResourceUsage::Copy: return "Copy"; + case ResourceUsage::CopySrc: return "Copy - Source"; + case ResourceUsage::CopyDst: return "Copy - Dest"; - case eUsage_Barrier: return "Barrier"; + case ResourceUsage::Barrier: return "Barrier"; default: break; } } - else if(apitype == eGraphicsAPI_OpenGL || apitype == eGraphicsAPI_Vulkan) + else if(apitype == GraphicsAPI::OpenGL || apitype == GraphicsAPI::Vulkan) { - const bool vk = (apitype == eGraphicsAPI_Vulkan); + const bool vk = (apitype == GraphicsAPI::Vulkan); switch(usage) { - case eUsage_VertexBuffer: return "Vertex Buffer"; - case eUsage_IndexBuffer: return "Index Buffer"; + case ResourceUsage::VertexBuffer: return "Vertex Buffer"; + case ResourceUsage::IndexBuffer: return "Index Buffer"; - case eUsage_VS_Constants: return "VS - Uniform Buffer"; - case eUsage_GS_Constants: return "GS - Uniform Buffer"; - case eUsage_HS_Constants: return "HS - Uniform Buffer"; - case eUsage_DS_Constants: return "DS - Uniform Buffer"; - case eUsage_CS_Constants: return "CS - Uniform Buffer"; - case eUsage_PS_Constants: return "PS - Uniform Buffer"; - case eUsage_All_Constants: return "All - Uniform Buffer"; + case ResourceUsage::VS_Constants: return "VS - Uniform Buffer"; + case ResourceUsage::GS_Constants: return "GS - Uniform Buffer"; + case ResourceUsage::HS_Constants: return "HS - Uniform Buffer"; + case ResourceUsage::DS_Constants: return "DS - Uniform Buffer"; + case ResourceUsage::CS_Constants: return "CS - Uniform Buffer"; + case ResourceUsage::PS_Constants: return "PS - Uniform Buffer"; + case ResourceUsage::All_Constants: return "All - Uniform Buffer"; - case eUsage_SO: return "Transform Feedback"; + case ResourceUsage::StreamOut: return "Transform Feedback"; - case eUsage_VS_Resource: return "VS - Texture"; - case eUsage_GS_Resource: return "GS - Texture"; - case eUsage_HS_Resource: return "HS - Texture"; - case eUsage_DS_Resource: return "DS - Texture"; - case eUsage_CS_Resource: return "CS - Texture"; - case eUsage_PS_Resource: return "PS - Texture"; - case eUsage_All_Resource: return "All - Texture"; + case ResourceUsage::VS_Resource: return "VS - Texture"; + case ResourceUsage::GS_Resource: return "GS - Texture"; + case ResourceUsage::HS_Resource: return "HS - Texture"; + case ResourceUsage::DS_Resource: return "DS - Texture"; + case ResourceUsage::CS_Resource: return "CS - Texture"; + case ResourceUsage::PS_Resource: return "PS - Texture"; + case ResourceUsage::All_Resource: return "All - Texture"; - case eUsage_VS_RWResource: return "VS - Image/SSBO"; - case eUsage_HS_RWResource: return "HS - Image/SSBO"; - case eUsage_DS_RWResource: return "DS - Image/SSBO"; - case eUsage_GS_RWResource: return "GS - Image/SSBO"; - case eUsage_PS_RWResource: return "PS - Image/SSBO"; - case eUsage_CS_RWResource: return "CS - Image/SSBO"; - case eUsage_All_RWResource: return "All - Image/SSBO"; + case ResourceUsage::VS_RWResource: return "VS - Image/SSBO"; + case ResourceUsage::HS_RWResource: return "HS - Image/SSBO"; + case ResourceUsage::DS_RWResource: return "DS - Image/SSBO"; + case ResourceUsage::GS_RWResource: return "GS - Image/SSBO"; + case ResourceUsage::PS_RWResource: return "PS - Image/SSBO"; + case ResourceUsage::CS_RWResource: return "CS - Image/SSBO"; + case ResourceUsage::All_RWResource: return "All - Image/SSBO"; - case eUsage_InputTarget: return "FBO Input"; - case eUsage_ColourTarget: return "FBO Colour"; - case eUsage_DepthStencilTarget: return "FBO Depthstencil"; + case ResourceUsage::InputTarget: return "FBO Input"; + case ResourceUsage::ColourTarget: return "FBO Colour"; + case ResourceUsage::DepthStencilTarget: return "FBO Depthstencil"; - case eUsage_Indirect: return "Indirect argument"; + case ResourceUsage::Indirect: return "Indirect argument"; - case eUsage_Clear: return "Clear"; + case ResourceUsage::Clear: return "Clear"; - case eUsage_GenMips: return "Generate Mips"; - case eUsage_Resolve: return vk ? "Resolve" : "Framebuffer blit"; - case eUsage_ResolveSrc: return vk ? "Resolve - Source" : "Framebuffer blit - Source"; - case eUsage_ResolveDst: return vk ? "Resolve - Dest" : "Framebuffer blit - Dest"; - case eUsage_Copy: return "Copy"; - case eUsage_CopySrc: return "Copy - Source"; - case eUsage_CopyDst: return "Copy - Dest"; + case ResourceUsage::GenMips: return "Generate Mips"; + case ResourceUsage::Resolve: return vk ? "Resolve" : "Framebuffer blit"; + case ResourceUsage::ResolveSrc: return vk ? "Resolve - Source" : "Framebuffer blit - Source"; + case ResourceUsage::ResolveDst: return vk ? "Resolve - Dest" : "Framebuffer blit - Dest"; + case ResourceUsage::Copy: return "Copy"; + case ResourceUsage::CopySrc: return "Copy - Source"; + case ResourceUsage::CopyDst: return "Copy - Dest"; - case eUsage_Barrier: return "Barrier"; + case ResourceUsage::Barrier: return "Barrier"; default: break; } } @@ -152,31 +152,31 @@ QString ToQStr(const ResourceUsage usage, const GraphicsAPI apitype) return "Unknown"; } -QString ToQStr(const ShaderStageType stage, const GraphicsAPI apitype) +QString ToQStr(const ShaderStage stage, const GraphicsAPI apitype) { if(IsD3D(apitype)) { switch(stage) { - case eShaderStage_Vertex: return "Vertex"; - case eShaderStage_Hull: return "Hull"; - case eShaderStage_Domain: return "Domain"; - case eShaderStage_Geometry: return "Geometry"; - case eShaderStage_Pixel: return "Pixel"; - case eShaderStage_Compute: return "Compute"; + case ShaderStage::Vertex: return "Vertex"; + case ShaderStage::Hull: return "Hull"; + case ShaderStage::Domain: return "Domain"; + case ShaderStage::Geometry: return "Geometry"; + case ShaderStage::Pixel: return "Pixel"; + case ShaderStage::Compute: return "Compute"; default: break; } } - else if(apitype == eGraphicsAPI_OpenGL || apitype == eGraphicsAPI_Vulkan) + else if(apitype == GraphicsAPI::OpenGL || apitype == GraphicsAPI::Vulkan) { switch(stage) { - case eShaderStage_Vertex: return "Vertex"; - case eShaderStage_Tess_Control: return "Tess. Control"; - case eShaderStage_Tess_Eval: return "Tess. Eval"; - case eShaderStage_Geometry: return "Geometry"; - case eShaderStage_Fragment: return "Fragment"; - case eShaderStage_Compute: return "Compute"; + case ShaderStage::Vertex: return "Vertex"; + case ShaderStage::Tess_Control: return "Tess. Control"; + case ShaderStage::Tess_Eval: return "Tess. Eval"; + case ShaderStage::Geometry: return "Geometry"; + case ShaderStage::Fragment: return "Fragment"; + case ShaderStage::Compute: return "Compute"; default: break; } } @@ -188,17 +188,17 @@ QString TypeString(const SigParameter &sig) { QString ret = ""; - if(sig.compType == eCompType_Float) + if(sig.compType == CompType::Float) ret += "float"; - else if(sig.compType == eCompType_UInt || sig.compType == eCompType_UScaled) + else if(sig.compType == CompType::UInt || sig.compType == CompType::UScaled) ret += "uint"; - else if(sig.compType == eCompType_SInt || sig.compType == eCompType_SScaled) + else if(sig.compType == CompType::SInt || sig.compType == CompType::SScaled) ret += "int"; - else if(sig.compType == eCompType_UNorm) + else if(sig.compType == CompType::UNorm) ret += "unorm float"; - else if(sig.compType == eCompType_SNorm) + else if(sig.compType == CompType::SNorm) ret += "snorm float"; - else if(sig.compType == eCompType_Depth) + else if(sig.compType == CompType::Depth) ret += "float"; if(sig.compCount > 1) @@ -209,14 +209,14 @@ QString TypeString(const SigParameter &sig) QString D3DSemanticString(const SigParameter &sig) { - if(sig.systemValue == eAttr_None) + if(sig.systemValue == ShaderBuiltin::Undefined) return ToQStr(sig.semanticIdxName); QString ret = ToQStr(sig.systemValue); // need to include the index if it's a system value semantic that's numbered - if(sig.systemValue == eAttr_ColourOutput || sig.systemValue == eAttr_CullDistance || - sig.systemValue == eAttr_ClipDistance) + if(sig.systemValue == ShaderBuiltin::ColourOutput || + sig.systemValue == ShaderBuiltin::CullDistance || sig.systemValue == ShaderBuiltin::ClipDistance) ret += QString::number(sig.semanticIndex); return ret; diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index 6d227e853..c1fee77ab 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -56,45 +56,45 @@ struct ToStr return QString::number(el.id).toStdString(); } - static std::string Get(const ReplayCreateStatus &el) + static std::string Get(const ReplayStatus &el) { switch(el) { - case eReplayCreate_Success: return "Success"; - case eReplayCreate_UnknownError: return "Unknown error"; - case eReplayCreate_InternalError: return "Internal error"; - case eReplayCreate_FileNotFound: return "File not found"; - case eReplayCreate_InjectionFailed: return "RenderDoc injection failed"; - case eReplayCreate_IncompatibleProcess: return "Process is incompatible"; - case eReplayCreate_NetworkIOFailed: return "Network I/O operation failed"; - case eReplayCreate_NetworkRemoteBusy: return "Remote side of network connection is busy"; - case eReplayCreate_NetworkVersionMismatch: return "Version mismatch between network clients"; - case eReplayCreate_FileIOFailed: return "File I/O failed"; - case eReplayCreate_FileIncompatibleVersion: return "File of incompatible version"; - case eReplayCreate_FileCorrupted: return "File corrupted"; - case eReplayCreate_APIUnsupported: return "API unsupported"; - case eReplayCreate_APIInitFailed: return "API initialisation failed"; - case eReplayCreate_APIIncompatibleVersion: return "API incompatible version"; - case eReplayCreate_APIHardwareUnsupported: return "API hardware unsupported"; + case ReplayStatus::Succeeded: return "Success"; + case ReplayStatus::UnknownError: return "Unknown error"; + case ReplayStatus::InternalError: return "Internal error"; + case ReplayStatus::FileNotFound: return "File not found"; + case ReplayStatus::InjectionFailed: return "RenderDoc injection failed"; + case ReplayStatus::IncompatibleProcess: return "Process is incompatible"; + case ReplayStatus::NetworkIOFailed: return "Network I/O operation failed"; + case ReplayStatus::NetworkRemoteBusy: return "Remote side of network connection is busy"; + case ReplayStatus::NetworkVersionMismatch: return "Version mismatch between network clients"; + case ReplayStatus::FileIOFailed: return "File I/O failed"; + case ReplayStatus::FileIncompatibleVersion: return "File of incompatible version"; + case ReplayStatus::FileCorrupted: return "File corrupted"; + case ReplayStatus::APIUnsupported: return "API unsupported"; + case ReplayStatus::APIInitFailed: return "API initialisation failed"; + case ReplayStatus::APIIncompatibleVersion: return "API incompatible version"; + case ReplayStatus::APIHardwareUnsupported: return "API hardware unsupported"; default: break; } return "Invalid error code"; } - static std::string Get(const FormatComponentType &el) + static std::string Get(const CompType &el) { switch(el) { - case eCompType_None: return "Typeless"; - case eCompType_Float: return "Float"; - case eCompType_UNorm: return "UNorm"; - case eCompType_SNorm: return "SNorm"; - case eCompType_UInt: return "UInt"; - case eCompType_SInt: return "SInt"; - case eCompType_UScaled: return "UScaled"; - case eCompType_SScaled: return "SScaled"; - case eCompType_Depth: return "Depth/Stencil"; - case eCompType_Double: return "Double"; + case CompType::Typeless: return "Typeless"; + case CompType::Float: return "Float"; + case CompType::UNorm: return "UNorm"; + case CompType::SNorm: return "SNorm"; + case CompType::UInt: return "UInt"; + case CompType::SInt: return "SInt"; + case CompType::UScaled: return "UScaled"; + case CompType::SScaled: return "SScaled"; + case CompType::Depth: return "Depth/Stencil"; + case CompType::Double: return "Double"; default: break; } return "Invalid component type"; @@ -104,13 +104,13 @@ struct ToStr { switch(el) { - case eFileType_DDS: return "DDS"; - case eFileType_PNG: return "PNG"; - case eFileType_JPG: return "JPG"; - case eFileType_BMP: return "BMP"; - case eFileType_TGA: return "TGA"; - case eFileType_HDR: return "HDR"; - case eFileType_EXR: return "EXR"; + case FileType::DDS: return "DDS"; + case FileType::PNG: return "PNG"; + case FileType::JPG: return "JPG"; + case FileType::BMP: return "BMP"; + case FileType::TGA: return "TGA"; + case FileType::HDR: return "HDR"; + case FileType::EXR: return "EXR"; default: break; } return "Invalid file type"; @@ -120,245 +120,245 @@ struct ToStr { switch(el) { - case eAlphaMap_Discard: return "Discard"; - case eAlphaMap_BlendToColour: return "Blend to Colour"; - case eAlphaMap_BlendToCheckerboard: return "Blend to Checkerboard"; - case eAlphaMap_Preserve: return "Preserve"; + case AlphaMapping::Discard: return "Discard"; + case AlphaMapping::BlendToColour: return "Blend to Colour"; + case AlphaMapping::BlendToCheckerboard: return "Blend to Checkerboard"; + case AlphaMapping::Preserve: return "Preserve"; default: break; } return "Invalid mapping"; } - static std::string Get(const EnvironmentModificationType &el) + static std::string Get(const EnvMod &el) { switch(el) { - case eEnvMod_Set: return "Set"; - case eEnvMod_Append: return "Append"; - case eEnvMod_Prepend: return "Prepend"; + case EnvMod::Set: return "Set"; + case EnvMod::Append: return "Append"; + case EnvMod::Prepend: return "Prepend"; default: break; } return "Invalid modification"; } - static std::string Get(const EnvironmentSeparator &el) + static std::string Get(const EnvSep &el) { switch(el) { - case eEnvSep_Platform: return "Platform style"; - case eEnvSep_SemiColon: return "Semi-colon (;)"; - case eEnvSep_Colon: return "Colon (:)"; - case eEnvSep_None: return "No Separator"; + case EnvSep::Platform: return "Platform style"; + case EnvSep::SemiColon: return "Semi-colon (;)"; + case EnvSep::Colon: return "Colon (:)"; + case EnvSep::NoSep: return "No Separator"; default: break; } return "Invalid separator"; } - static std::string Get(const PrimitiveTopology &el) + static std::string Get(const Topology &el) { switch(el) { - case eTopology_Unknown: return "Unknown"; - case eTopology_PointList: return "Point List"; - case eTopology_LineList: return "Line List"; - case eTopology_LineStrip: return "Line Strip"; - case eTopology_LineLoop: return "Line Loop"; - case eTopology_TriangleList: return "Triangle List"; - case eTopology_TriangleStrip: return "Triangle Strip"; - case eTopology_TriangleFan: return "Triangle Fan"; - case eTopology_LineList_Adj: return "Line List with Adjacency"; - case eTopology_LineStrip_Adj: return "Line Strip with Adjacency"; - case eTopology_TriangleList_Adj: return "Triangle List with Adjacency"; - case eTopology_TriangleStrip_Adj: return "Triangle Strip with Adjacency"; - case eTopology_PatchList_1CPs: - case eTopology_PatchList_2CPs: - case eTopology_PatchList_3CPs: - case eTopology_PatchList_4CPs: - case eTopology_PatchList_5CPs: - case eTopology_PatchList_6CPs: - case eTopology_PatchList_7CPs: - case eTopology_PatchList_8CPs: - case eTopology_PatchList_9CPs: - case eTopology_PatchList_10CPs: - case eTopology_PatchList_11CPs: - case eTopology_PatchList_12CPs: - case eTopology_PatchList_13CPs: - case eTopology_PatchList_14CPs: - case eTopology_PatchList_15CPs: - case eTopology_PatchList_16CPs: - case eTopology_PatchList_17CPs: - case eTopology_PatchList_18CPs: - case eTopology_PatchList_19CPs: - case eTopology_PatchList_20CPs: - case eTopology_PatchList_21CPs: - case eTopology_PatchList_22CPs: - case eTopology_PatchList_23CPs: - case eTopology_PatchList_24CPs: - case eTopology_PatchList_25CPs: - case eTopology_PatchList_26CPs: - case eTopology_PatchList_27CPs: - case eTopology_PatchList_28CPs: - case eTopology_PatchList_29CPs: - case eTopology_PatchList_30CPs: - case eTopology_PatchList_31CPs: - case eTopology_PatchList_32CPs: return "Patch List"; + case Topology::Unknown: return "Unknown"; + case Topology::PointList: return "Point List"; + case Topology::LineList: return "Line List"; + case Topology::LineStrip: return "Line Strip"; + case Topology::LineLoop: return "Line Loop"; + case Topology::TriangleList: return "Triangle List"; + case Topology::TriangleStrip: return "Triangle Strip"; + case Topology::TriangleFan: return "Triangle Fan"; + case Topology::LineList_Adj: return "Line List with Adjacency"; + case Topology::LineStrip_Adj: return "Line Strip with Adjacency"; + case Topology::TriangleList_Adj: return "Triangle List with Adjacency"; + case Topology::TriangleStrip_Adj: return "Triangle Strip with Adjacency"; + case Topology::PatchList_1CPs: + case Topology::PatchList_2CPs: + case Topology::PatchList_3CPs: + case Topology::PatchList_4CPs: + case Topology::PatchList_5CPs: + case Topology::PatchList_6CPs: + case Topology::PatchList_7CPs: + case Topology::PatchList_8CPs: + case Topology::PatchList_9CPs: + case Topology::PatchList_10CPs: + case Topology::PatchList_11CPs: + case Topology::PatchList_12CPs: + case Topology::PatchList_13CPs: + case Topology::PatchList_14CPs: + case Topology::PatchList_15CPs: + case Topology::PatchList_16CPs: + case Topology::PatchList_17CPs: + case Topology::PatchList_18CPs: + case Topology::PatchList_19CPs: + case Topology::PatchList_20CPs: + case Topology::PatchList_21CPs: + case Topology::PatchList_22CPs: + case Topology::PatchList_23CPs: + case Topology::PatchList_24CPs: + case Topology::PatchList_25CPs: + case Topology::PatchList_26CPs: + case Topology::PatchList_27CPs: + case Topology::PatchList_28CPs: + case Topology::PatchList_29CPs: + case Topology::PatchList_30CPs: + case Topology::PatchList_31CPs: + case Topology::PatchList_32CPs: return "Patch List"; default: break; } return "Unknown topology"; } - static std::string Get(const TriangleFillMode &el) + static std::string Get(const FillMode &el) { switch(el) { - case eFill_Solid: return "Solid"; - case eFill_Wireframe: return "Wireframe"; - case eFill_Point: return "Point"; + case FillMode::Solid: return "Solid"; + case FillMode::Wireframe: return "Wireframe"; + case FillMode::Point: return "Point"; default: break; } return "Unknown"; } - static std::string Get(const TriangleCullMode &el) + static std::string Get(const CullMode &el) { switch(el) { - case eCull_None: return "None"; - case eCull_Front: return "Front"; - case eCull_Back: return "Back"; - case eCull_FrontAndBack: return "Front & Back"; + case CullMode::NoCull: return "None"; + case CullMode::Front: return "Front"; + case CullMode::Back: return "Back"; + case CullMode::FrontAndBack: return "Front & Back"; default: break; } return "Unknown"; } - static std::string Get(const ShaderResourceType &el) + static std::string Get(const TextureDim &el) { switch(el) { - case eResType_None: return "None"; - case eResType_Buffer: return "Buffer"; - case eResType_Texture1D: return "Texture 1D"; - case eResType_Texture1DArray: return "Texture 1D Array"; - case eResType_Texture2D: return "Texture 2D"; - case eResType_TextureRect: return "Texture Rect"; - case eResType_Texture2DArray: return "Texture 2D Array"; - case eResType_Texture2DMS: return "Texture 2D MS"; - case eResType_Texture2DMSArray: return "Texture 2D MS Array"; - case eResType_Texture3D: return "Texture 3D"; - case eResType_TextureCube: return "Texture Cube"; - case eResType_TextureCubeArray: return "Texture Cube Array"; + case TextureDim::Unknown: return "Unknown"; + case TextureDim::Buffer: return "Buffer"; + case TextureDim::Texture1D: return "Texture 1D"; + case TextureDim::Texture1DArray: return "Texture 1D Array"; + case TextureDim::Texture2D: return "Texture 2D"; + case TextureDim::TextureRect: return "Texture Rect"; + case TextureDim::Texture2DArray: return "Texture 2D Array"; + case TextureDim::Texture2DMS: return "Texture 2D MS"; + case TextureDim::Texture2DMSArray: return "Texture 2D MS Array"; + case TextureDim::Texture3D: return "Texture 3D"; + case TextureDim::TextureCube: return "Texture Cube"; + case TextureDim::TextureCubeArray: return "Texture Cube Array"; default: break; } return "Unknown"; } - static std::string Get(const SystemAttribute &el) + static std::string Get(const ShaderBuiltin &el) { switch(el) { - case eAttr_None: return "None"; - case eAttr_Position: return "Position"; - case eAttr_PointSize: return "Point Size"; - case eAttr_ClipDistance: return "Clip Distance"; - case eAttr_CullDistance: return "Cull Distance"; - case eAttr_RTIndex: return "RT Index"; - case eAttr_ViewportIndex: return "Viewport Index"; - case eAttr_VertexIndex: return "Vertex Index"; - case eAttr_PrimitiveIndex: return "Primitive Index"; - case eAttr_InstanceIndex: return "Instance Index"; - case eAttr_InvocationIndex: return "Invocation Index"; - case eAttr_DispatchSize: return "Dispatch Size"; - case eAttr_DispatchThreadIndex: return "Dispatch Thread Index"; - case eAttr_GroupIndex: return "Group Index"; - case eAttr_GroupFlatIndex: return "Group Flat Index"; - case eAttr_GroupThreadIndex: return "Group Thread Index"; - case eAttr_GSInstanceIndex: return "GS Instance Index"; - case eAttr_OutputControlPointIndex: return "Output Control Point Index"; - case eAttr_DomainLocation: return "Domain Location"; - case eAttr_IsFrontFace: return "Is FrontFace"; - case eAttr_MSAACoverage: return "MSAA Coverage"; - case eAttr_MSAASamplePosition: return "MSAA Sample Position"; - case eAttr_MSAASampleIndex: return "MSAA Sample Index"; - case eAttr_PatchNumVertices: return "Patch NumVertices"; - case eAttr_OuterTessFactor: return "Outer TessFactor"; - case eAttr_InsideTessFactor: return "Inside TessFactor"; - case eAttr_ColourOutput: return "Colour Output"; - case eAttr_DepthOutput: return "Depth Output"; - case eAttr_DepthOutputGreaterEqual: return "Depth Output (GEqual)"; - case eAttr_DepthOutputLessEqual: return "Depth Output (LEqual)"; + case ShaderBuiltin::Undefined: return "Undefined"; + case ShaderBuiltin::Position: return "Position"; + case ShaderBuiltin::PointSize: return "Point Size"; + case ShaderBuiltin::ClipDistance: return "Clip Distance"; + case ShaderBuiltin::CullDistance: return "Cull Distance"; + case ShaderBuiltin::RTIndex: return "RT Index"; + case ShaderBuiltin::ViewportIndex: return "Viewport Index"; + case ShaderBuiltin::VertexIndex: return "Vertex Index"; + case ShaderBuiltin::PrimitiveIndex: return "Primitive Index"; + case ShaderBuiltin::InstanceIndex: return "Instance Index"; + case ShaderBuiltin::InvocationIndex: return "Invocation Index"; + case ShaderBuiltin::DispatchSize: return "Dispatch Size"; + case ShaderBuiltin::DispatchThreadIndex: return "Dispatch Thread Index"; + case ShaderBuiltin::GroupIndex: return "Group Index"; + case ShaderBuiltin::GroupFlatIndex: return "Group Flat Index"; + case ShaderBuiltin::GroupThreadIndex: return "Group Thread Index"; + case ShaderBuiltin::GSInstanceIndex: return "GS Instance Index"; + case ShaderBuiltin::OutputControlPointIndex: return "Output Control Point Index"; + case ShaderBuiltin::DomainLocation: return "Domain Location"; + case ShaderBuiltin::IsFrontFace: return "Is FrontFace"; + case ShaderBuiltin::MSAACoverage: return "MSAA Coverage"; + case ShaderBuiltin::MSAASamplePosition: return "MSAA Sample Position"; + case ShaderBuiltin::MSAASampleIndex: return "MSAA Sample Index"; + case ShaderBuiltin::PatchNumVertices: return "Patch NumVertices"; + case ShaderBuiltin::OuterTessFactor: return "Outer TessFactor"; + case ShaderBuiltin::InsideTessFactor: return "Inside TessFactor"; + case ShaderBuiltin::ColourOutput: return "Colour Output"; + case ShaderBuiltin::DepthOutput: return "Depth Output"; + case ShaderBuiltin::DepthOutputGreaterEqual: return "Depth Output (GEqual)"; + case ShaderBuiltin::DepthOutputLessEqual: return "Depth Output (LEqual)"; default: break; } return "Unknown"; } - static std::string Get(const ShaderBindType &el) + static std::string Get(const BindType &el) { switch(el) { - case eBindType_ConstantBuffer: return "Constants"; - case eBindType_Sampler: return "Sampler"; - case eBindType_ImageSampler: return "Image&Sampler"; - case eBindType_ReadOnlyImage: return "Image"; - case eBindType_ReadWriteImage: return "RW Image"; - case eBindType_ReadOnlyTBuffer: return "TexBuffer"; - case eBindType_ReadWriteTBuffer: return "RW TexBuffer"; - case eBindType_ReadOnlyBuffer: return "Buffer"; - case eBindType_ReadWriteBuffer: return "RW Buffer"; - case eBindType_InputAttachment: return "Input"; + case BindType::ConstantBuffer: return "Constants"; + case BindType::Sampler: return "Sampler"; + case BindType::ImageSampler: return "Image&Sampler"; + case BindType::ReadOnlyImage: return "Image"; + case BindType::ReadWriteImage: return "RW Image"; + case BindType::ReadOnlyTBuffer: return "TexBuffer"; + case BindType::ReadWriteTBuffer: return "RW TexBuffer"; + case BindType::ReadOnlyBuffer: return "Buffer"; + case BindType::ReadWriteBuffer: return "RW Buffer"; + case BindType::InputAttachment: return "Input"; default: break; } return "Unknown"; } - static std::string Get(const DebugMessageSource &el) + static std::string Get(const MessageSource &el) { switch(el) { - case eDbgSource_API: return "API"; - case eDbgSource_RedundantAPIUse: return "Redundant API Use"; - case eDbgSource_IncorrectAPIUse: return "Incorrect API Use"; - case eDbgSource_GeneralPerformance: return "General Performance"; - case eDbgSource_GCNPerformance: return "GCN Performance"; - case eDbgSource_RuntimeWarning: return "Runtime Warning"; - case eDbgSoruce_UnsupportedConfiguration: return "Unsupported Configuration"; + case MessageSource::API: return "API"; + case MessageSource::RedundantAPIUse: return "Redundant API Use"; + case MessageSource::IncorrectAPIUse: return "Incorrect API Use"; + case MessageSource::GeneralPerformance: return "General Performance"; + case MessageSource::GCNPerformance: return "GCN Performance"; + case MessageSource::RuntimeWarning: return "Runtime Warning"; + case MessageSource::UnsupportedConfiguration: return "Unsupported Configuration"; default: break; } return "Unknown"; } - static std::string Get(const DebugMessageSeverity &el) + static std::string Get(const MessageSeverity &el) { switch(el) { - case eDbgSeverity_High: return "High"; - case eDbgSeverity_Medium: return "Medium"; - case eDbgSeverity_Low: return "Low"; - case eDbgSeverity_Info: return "Info"; + case MessageSeverity::High: return "High"; + case MessageSeverity::Medium: return "Medium"; + case MessageSeverity::Low: return "Low"; + case MessageSeverity::Info: return "Info"; default: break; } return "Unknown"; } - static std::string Get(const DebugMessageCategory &el) + static std::string Get(const MessageCategory &el) { switch(el) { - case eDbgCategory_Application_Defined: return "Application Defined"; - case eDbgCategory_Miscellaneous: return "Miscellaneous"; - case eDbgCategory_Initialization: return "Initialization"; - case eDbgCategory_Cleanup: return "Cleanup"; - case eDbgCategory_Compilation: return "Compilation"; - case eDbgCategory_State_Creation: return "State Creation"; - case eDbgCategory_State_Setting: return "State Setting"; - case eDbgCategory_State_Getting: return "State Getting"; - case eDbgCategory_Resource_Manipulation: return "Resource Manipulation"; - case eDbgCategory_Execution: return "Execution"; - case eDbgCategory_Shaders: return "Shaders"; - case eDbgCategory_Deprecated: return "Deprecated"; - case eDbgCategory_Undefined: return "Undefined"; - case eDbgCategory_Portability: return "Portability"; - case eDbgCategory_Performance: return "Performance"; + case MessageCategory::Application_Defined: return "Application Defined"; + case MessageCategory::Miscellaneous: return "Miscellaneous"; + case MessageCategory::Initialization: return "Initialization"; + case MessageCategory::Cleanup: return "Cleanup"; + case MessageCategory::Compilation: return "Compilation"; + case MessageCategory::State_Creation: return "State Creation"; + case MessageCategory::State_Setting: return "State Setting"; + case MessageCategory::State_Getting: return "State Getting"; + case MessageCategory::Resource_Manipulation: return "Resource Manipulation"; + case MessageCategory::Execution: return "Execution"; + case MessageCategory::Shaders: return "Shaders"; + case MessageCategory::Deprecated: return "Deprecated"; + case MessageCategory::Undefined: return "Undefined"; + case MessageCategory::Portability: return "Portability"; + case MessageCategory::Performance: return "Performance"; default: break; } return "Unknown"; @@ -368,12 +368,12 @@ struct ToStr { switch(el) { - case eSwizzle_Red: return "R"; - case eSwizzle_Green: return "G"; - case eSwizzle_Blue: return "B"; - case eSwizzle_Alpha: return "A"; - case eSwizzle_Zero: return "0"; - case eSwizzle_One: return "1"; + case TextureSwizzle::Red: return "R"; + case TextureSwizzle::Green: return "G"; + case TextureSwizzle::Blue: return "B"; + case TextureSwizzle::Alpha: return "A"; + case TextureSwizzle::Zero: return "0"; + case TextureSwizzle::One: return "1"; } return "Unknown"; } @@ -382,11 +382,11 @@ struct ToStr { switch(el) { - case eVar_Float: return "float"; - case eVar_Int: return "int"; - case eVar_UInt: return "uint"; - case eVar_Double: return "double"; - case eVar_Unknown: break; + case VarType::Float: return "float"; + case VarType::Int: return "int"; + case VarType::UInt: return "uint"; + case VarType::Double: return "double"; + case VarType::Unknown: break; } return "Unknown"; } @@ -412,7 +412,7 @@ inline QString ToQStr(const rdctype::str &el) 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 ShaderStageType stage, const GraphicsAPI apitype); +QString ToQStr(const ShaderStage stage, const GraphicsAPI apitype); struct FormatElement { @@ -439,11 +439,11 @@ struct FormatElement uint32_t matrixdim; ResourceFormat format; bool hex; - SystemAttribute systemValue; + ShaderBuiltin systemValue; }; QString TypeString(const ShaderVariable &v); -QString RowString(const ShaderVariable &v, uint32_t row, VarType type = eVar_Unknown); +QString RowString(const ShaderVariable &v, uint32_t row, VarType type = VarType::Unknown); QString VarString(const ShaderVariable &v); QString RowTypeString(const ShaderVariable &v); diff --git a/qrenderdoc/Code/RemoteHost.cpp b/qrenderdoc/Code/RemoteHost.cpp index 21aece5c4..9d275ca6a 100644 --- a/qrenderdoc/Code/RemoteHost.cpp +++ b/qrenderdoc/Code/RemoteHost.cpp @@ -63,21 +63,20 @@ void RemoteHost::CheckStatus() } IRemoteServer *rend = NULL; - ReplayCreateStatus status = - RENDERDOC_CreateRemoteServerConnection(Hostname.toUtf8().data(), 0, &rend); + ReplayStatus status = RENDERDOC_CreateRemoteServerConnection(Hostname.toUtf8().data(), 0, &rend); - if(status == eReplayCreate_Success) + if(status == ReplayStatus::Succeeded) { ServerRunning = true; VersionMismatch = Busy = false; } - else if(status == eReplayCreate_NetworkRemoteBusy) + else if(status == ReplayStatus::NetworkRemoteBusy) { ServerRunning = true; Busy = true; VersionMismatch = false; } - else if(status == eReplayCreate_NetworkVersionMismatch) + else if(status == ReplayStatus::NetworkVersionMismatch) { ServerRunning = true; Busy = true; diff --git a/qrenderdoc/Code/RenderManager.cpp b/qrenderdoc/Code/RenderManager.cpp index 07a6cb270..bdb6406d7 100644 --- a/qrenderdoc/Code/RenderManager.cpp +++ b/qrenderdoc/Code/RenderManager.cpp @@ -293,14 +293,14 @@ void RenderManager::CloseThread() m_Thread = NULL; } -ReplayCreateStatus RenderManager::ConnectToRemoteServer(RemoteHost *host) +ReplayStatus RenderManager::ConnectToRemoteServer(RemoteHost *host) { - ReplayCreateStatus status = + ReplayStatus status = RENDERDOC_CreateRemoteServerConnection(host->Hostname.toUtf8().data(), 0, &m_Remote); m_RemoteHost = host; - if(status == eReplayCreate_Success) + if(status == ReplayStatus::Succeeded) { m_RemoteHost->Connected = true; return status; diff --git a/qrenderdoc/Code/RenderManager.h b/qrenderdoc/Code/RenderManager.h index 969a8992c..a390cf6ab 100644 --- a/qrenderdoc/Code/RenderManager.h +++ b/qrenderdoc/Code/RenderManager.h @@ -49,16 +49,16 @@ struct EnvironmentModification QString variable; QString value; - EnvironmentModificationType type; - EnvironmentSeparator separator; + EnvMod type; + EnvSep separator; QString GetTypeString() const { QString ret; - if(type == eEnvMod_Append) + if(type == EnvMod::Append) ret = QString("Append, %1").arg(ToQStr(separator)); - else if(type == eEnvMod_Prepend) + else if(type == EnvMod::Prepend) ret = QString("Prepend, %1").arg(ToQStr(separator)); else ret = "Set"; @@ -70,9 +70,9 @@ struct EnvironmentModification { QString ret; - if(type == eEnvMod_Append) + if(type == EnvMod::Append) ret = QString("Append %1 with %2 using %3").arg(variable).arg(value).arg(ToQStr(separator)); - else if(type == eEnvMod_Prepend) + else if(type == EnvMod::Prepend) ret = QString("Prepend %1 with %2 using %3").arg(variable).arg(value).arg(ToQStr(separator)); else ret = QString("Set %1 to %2").arg(variable).arg(value); @@ -97,23 +97,23 @@ struct EnvironmentModification QString t = data["type"].toString(); - if(t == ToQStr(eEnvMod_Append)) - type = eEnvMod_Append; - else if(t == ToQStr(eEnvMod_Prepend)) - type = eEnvMod_Prepend; + if(t == ToQStr(EnvMod::Append)) + type = EnvMod::Append; + else if(t == ToQStr(EnvMod::Prepend)) + type = EnvMod::Prepend; else - type = eEnvMod_Set; + type = EnvMod::Set; QString s = data["separator"].toString(); - if(s == ToQStr(eEnvSep_SemiColon)) - separator = eEnvSep_SemiColon; - else if(s == ToQStr(eEnvSep_Colon)) - separator = eEnvSep_Colon; - else if(s == ToQStr(eEnvSep_Platform)) - separator = eEnvSep_Platform; + if(s == ToQStr(EnvSep::SemiColon)) + separator = EnvSep::SemiColon; + else if(s == ToQStr(EnvSep::Colon)) + separator = EnvSep::Colon; + else if(s == ToQStr(EnvSep::Platform)) + separator = EnvSep::Platform; else - separator = eEnvSep_None; + separator = EnvSep::NoSep; } }; @@ -130,7 +130,7 @@ public: void DeleteCapture(const QString &logfile, bool local); bool IsRunning(); - ReplayCreateStatus GetCreateStatus() { return m_CreateStatus; } + ReplayStatus GetCreateStatus() { return m_CreateStatus; } // this tagged version is for cases when we might send a request - e.g. to pick a vertex or pixel // - and want to pre-empt it with a new request before the first has returned. Either because some // other work is taking a while or because we're sending requests faster than they can be @@ -143,7 +143,7 @@ public: void CloseThread(); - ReplayCreateStatus ConnectToRemoteServer(RemoteHost *host); + ReplayStatus ConnectToRemoteServer(RemoteHost *host); void DisconnectFromRemoteServer(); void ShutdownServer(); void PingRemote(); @@ -194,5 +194,5 @@ private: volatile bool m_Running; LambdaThread *m_Thread; - ReplayCreateStatus m_CreateStatus; + ReplayStatus m_CreateStatus; }; diff --git a/qrenderdoc/Code/qrenderdoc.cpp b/qrenderdoc/Code/qrenderdoc.cpp index f8a2e03c9..0e6f8a4c7 100644 --- a/qrenderdoc/Code/qrenderdoc.cpp +++ b/qrenderdoc/Code/qrenderdoc.cpp @@ -35,15 +35,15 @@ void sharedLogOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { - LogMessageType logtype = eLogType_Comment; + LogType logtype = LogType::Comment; switch(type) { - case QtDebugMsg: logtype = eLogType_Debug; break; - case QtInfoMsg: logtype = eLogType_Comment; break; - case QtWarningMsg: logtype = eLogType_Warning; break; - case QtCriticalMsg: logtype = eLogType_Error; break; - case QtFatalMsg: logtype = eLogType_Fatal; break; + case QtDebugMsg: logtype = LogType::Debug; break; + case QtInfoMsg: logtype = LogType::Comment; break; + case QtWarningMsg: logtype = LogType::Warning; break; + case QtCriticalMsg: logtype = LogType::Error; break; + case QtFatalMsg: logtype = LogType::Fatal; break; } RENDERDOC_LogMessage(logtype, "QTRD", context.file, context.line, msg.toUtf8().data()); diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index e169c9e64..d6000c662 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -723,28 +723,28 @@ private: switch(fmt.format.specialFormat) { - case eSpecial_BC6: - case eSpecial_ETC2: - case eSpecial_R11G11B10: - case eSpecial_R5G6B5: - case eSpecial_R9G9B9E5: compCount = 3; break; - case eSpecial_BC1: - case eSpecial_BC7: - case eSpecial_BC3: - case eSpecial_BC2: - case eSpecial_R10G10B10A2: - case eSpecial_R5G5B5A1: - case eSpecial_R4G4B4A4: - case eSpecial_ASTC: compCount = 4; break; - case eSpecial_BC5: - case eSpecial_R4G4: - case eSpecial_D16S8: - case eSpecial_D24S8: - case eSpecial_D32S8: compCount = 2; break; - case eSpecial_BC4: - case eSpecial_S8: compCount = 1; break; - case eSpecial_YUV: - case eSpecial_EAC: + case SpecialFormat::BC6: + case SpecialFormat::ETC2: + case SpecialFormat::R11G11B10: + case SpecialFormat::R5G6B5: + case SpecialFormat::R9G9B9E5: compCount = 3; break; + case SpecialFormat::BC1: + case SpecialFormat::BC7: + case SpecialFormat::BC3: + case SpecialFormat::BC2: + case SpecialFormat::R10G10B10A2: + case SpecialFormat::R5G5B5A1: + case SpecialFormat::R4G4B4A4: + case SpecialFormat::ASTC: compCount = 4; break; + case SpecialFormat::BC5: + case SpecialFormat::R4G4: + case SpecialFormat::D16S8: + case SpecialFormat::D24S8: + case SpecialFormat::D32S8: compCount = 2; break; + case SpecialFormat::BC4: + case SpecialFormat::S8: compCount = 1; break; + case SpecialFormat::YUV: + case SpecialFormat::EAC: default: compCount = fmt.format.compCount; } @@ -823,11 +823,11 @@ BufferViewer::BufferViewer(CaptureContext &ctx, bool meshview, QWidget *parent) m_Output = NULL; memset(&m_Config, 0, sizeof(m_Config)); - m_Config.type = eMeshDataStage_VSIn; + m_Config.type = MeshDataStage::VSIn; m_Config.wireframeDraw = true; ui->outputTabs->setCurrentIndex(0); - m_CurStage = eMeshDataStage_VSIn; + m_CurStage = MeshDataStage::VSIn; ui->vsinData->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); ui->vsoutData->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); @@ -873,19 +873,19 @@ BufferViewer::BufferViewer(CaptureContext &ctx, bool meshview, QWidget *parent) QMenu *menu = new QMenu(this); QObject::connect(ui->vsinData, &RDTableView::customContextMenuRequested, - [this, menu](const QPoint &pos) { stageRowMenu(eMeshDataStage_VSIn, menu, pos); }); + [this, menu](const QPoint &pos) { stageRowMenu(MeshDataStage::VSIn, menu, pos); }); menu = new QMenu(this); QObject::connect( ui->vsoutData, &RDTableView::customContextMenuRequested, - [this, menu](const QPoint &pos) { stageRowMenu(eMeshDataStage_VSOut, menu, pos); }); + [this, menu](const QPoint &pos) { stageRowMenu(MeshDataStage::VSOut, menu, pos); }); menu = new QMenu(this); QObject::connect( ui->gsoutData, &RDTableView::customContextMenuRequested, - [this, menu](const QPoint &pos) { stageRowMenu(eMeshDataStage_GSOut, menu, pos); }); + [this, menu](const QPoint &pos) { stageRowMenu(MeshDataStage::GSOut, menu, pos); }); ui->dockarea->setAllowFloatingWindow(false); ui->dockarea->setRubberBandLineWidth(50); @@ -1040,14 +1040,16 @@ void BufferViewer::SetupMeshView() QObject::connect(m_SelectSecondColumn, &QAction::triggered, [this]() { BufferItemModel *model = (BufferItemModel *)m_CurView->model(); - model->setSecondaryColumn(m_ContextColumn, m_Config.solidShadeMode == eShade_Secondary, false); + model->setSecondaryColumn(m_ContextColumn, m_Config.solidShadeMode == SolidShade::Secondary, + false); updatePreviewColumns(); INVOKE_MEMFN(RT_UpdateAndDisplay); }); QObject::connect(m_SelectSecondAlphaColumn, &QAction::triggered, [this]() { BufferItemModel *model = (BufferItemModel *)m_CurView->model(); - model->setSecondaryColumn(m_ContextColumn, m_Config.solidShadeMode == eShade_Secondary, true); + model->setSecondaryColumn(m_ContextColumn, m_Config.solidShadeMode == SolidShade::Secondary, + true); updatePreviewColumns(); INVOKE_MEMFN(RT_UpdateAndDisplay); }); @@ -1057,11 +1059,11 @@ void BufferViewer::SetupMeshView() ui->gsoutData->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu); QObject::connect(ui->vsinData->horizontalHeader(), &QHeaderView::customContextMenuRequested, - [this](const QPoint &pos) { meshHeaderMenu(eMeshDataStage_VSIn, pos); }); + [this](const QPoint &pos) { meshHeaderMenu(MeshDataStage::VSIn, pos); }); QObject::connect(ui->vsoutData->horizontalHeader(), &QHeaderView::customContextMenuRequested, - [this](const QPoint &pos) { meshHeaderMenu(eMeshDataStage_VSOut, pos); }); + [this](const QPoint &pos) { meshHeaderMenu(MeshDataStage::VSOut, pos); }); QObject::connect(ui->gsoutData->horizontalHeader(), &QHeaderView::customContextMenuRequested, - [this](const QPoint &pos) { meshHeaderMenu(eMeshDataStage_GSOut, pos); }); + [this](const QPoint &pos) { meshHeaderMenu(MeshDataStage::GSOut, pos); }); QVBoxLayout *vertical = new QVBoxLayout(this); @@ -1100,7 +1102,7 @@ void BufferViewer::stageRowMenu(MeshDataStage stage, QMenu *menu, const QPoint & menu->clear(); - if(m_MeshView && stage != eMeshDataStage_GSOut) + if(m_MeshView && stage != MeshDataStage::GSOut) { menu->addAction(m_DebugVert); menu->addSeparator(); @@ -1150,13 +1152,10 @@ void BufferViewer::OnLogfileLoaded() m_Ctx.Renderer().BlockInvoke([renderID, this](IReplayRenderer *r) { m_Output = r->CreateOutput(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(renderID), - eOutputType_MeshDisplay); + ReplayOutputType::Mesh); ui->render->setOutput(m_Output); - OutputConfig c = {eOutputType_MeshDisplay}; - m_Output->SetOutputConfig(c); - RT_UpdateAndDisplay(r); }); } @@ -1304,7 +1303,7 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) QVector vbs = m_Ctx.CurPipelineState.GetVBuffers(); rdctype::array idata; - if(ib != ResourceId() && draw && (draw->flags & eDraw_UseIBuffer)) + if(ib != ResourceId() && draw && (draw->flags & DrawFlags::UseIBuffer)) r->GetBufferData(ib, ioffset + draw->indexOffset * draw->indexByteWidth, draw->numIndices * draw->indexByteWidth, &idata); @@ -1414,11 +1413,11 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) m_ModelVSIn->buffers.push_back(buf); } - r->GetPostVSData(m_Config.curInstance, eMeshDataStage_VSOut, &m_PostVS); + r->GetPostVSData(m_Config.curInstance, MeshDataStage::VSOut, &m_PostVS); m_ModelVSOut->numRows = m_PostVS.numVerts; - if(draw && m_PostVS.idxbuf != ResourceId() && (draw->flags & eDraw_UseIBuffer)) + if(draw && m_PostVS.idxbuf != ResourceId() && (draw->flags & DrawFlags::UseIBuffer)) r->GetBufferData(m_PostVS.idxbuf, ioffset + draw->indexOffset * draw->indexByteWidth, draw->numIndices * draw->indexByteWidth, &idata); @@ -1468,7 +1467,7 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) m_ModelVSOut->buffers.push_back(postvs); } - r->GetPostVSData(m_Config.curInstance, eMeshDataStage_GSOut, &m_PostGS); + r->GetPostVSData(m_Config.curInstance, MeshDataStage::GSOut, &m_PostGS); m_ModelGSOut->numRows = m_PostGS.numVerts; @@ -1712,7 +1711,7 @@ void BufferViewer::guessPositionColumn(BufferItemModel *model) { const FormatElement &el = model->columns[i]; - if(el.systemValue == eAttr_Position) + if(el.systemValue == ShaderBuiltin::Position) { posEl = i; break; @@ -1806,7 +1805,7 @@ void BufferViewer::guessSecondaryColumn(BufferItemModel *model) } } - model->setSecondaryColumn(secondEl, m_Config.solidShadeMode == eShade_Secondary, false); + model->setSecondaryColumn(secondEl, m_Config.solidShadeMode == SolidShade::Secondary, false); } void BufferViewer::updatePreviewColumns() @@ -1843,7 +1842,8 @@ void BufferViewer::updatePreviewColumns() m_VSInPosition.compByteWidth = el.format.compByteWidth; m_VSInPosition.compType = el.format.compType; m_VSInPosition.bgraOrder = el.format.bgraOrder; - m_VSInPosition.specialFormat = el.format.special ? el.format.specialFormat : eSpecial_Unknown; + m_VSInPosition.specialFormat = + el.format.special ? el.format.specialFormat : SpecialFormat::Unknown; } elIdx = m_ModelVSIn->secondaryColumn(); @@ -1862,7 +1862,7 @@ void BufferViewer::updatePreviewColumns() m_VSInSecondary.compType = el.format.compType; m_VSInSecondary.bgraOrder = el.format.bgraOrder; m_VSInSecondary.specialFormat = - el.format.special ? el.format.specialFormat : eSpecial_Unknown; + el.format.special ? el.format.specialFormat : SpecialFormat::Unknown; m_VSInSecondary.showAlpha = m_ModelVSIn->secondaryAlpha(); } } @@ -1913,7 +1913,7 @@ void BufferViewer::updatePreviewColumns() m_PostGSPosition.idxByteWidth = 0; - if(!(draw->flags & eDraw_UseIBuffer)) + if(!(draw->flags & DrawFlags::UseIBuffer)) m_PostVSPosition.idxByteWidth = m_VSInPosition.idxByteWidth = 0; m_PostGSPosition.unproject = true; @@ -1977,7 +1977,7 @@ void BufferViewer::configureMeshColumns() if(ui->farGuess->value() > 0.0) m_PostVS.farPlane = m_PostGS.farPlane = ui->farGuess->value(); - const ShaderReflection *vs = m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Vertex); + const ShaderReflection *vs = m_Ctx.CurPipelineState.GetShaderReflection(ShaderStage::Vertex); m_ModelVSOut->columns.clear(); @@ -2003,7 +2003,7 @@ void BufferViewer::configureMeshColumns() f.matrixdim = 1; f.systemValue = sig.systemValue; - if(f.systemValue == eAttr_Position) + if(f.systemValue == ShaderBuiltin::Position) posidx = i; m_ModelVSOut->columns.push_back(f); @@ -2024,7 +2024,7 @@ void BufferViewer::configureMeshColumns() for(const FormatElement &sig : m_ModelVSOut->columns) { uint numComps = sig.format.compCount; - uint elemSize = sig.format.compType == eCompType_Double ? 8U : 4U; + uint elemSize = sig.format.compType == CompType::Double ? 8U : 4U; if(m_Ctx.CurPipelineState.HasAlignedPostVSData()) { @@ -2044,9 +2044,9 @@ void BufferViewer::configureMeshColumns() if(draw) { - const ShaderReflection *last = m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Geometry); + const ShaderReflection *last = m_Ctx.CurPipelineState.GetShaderReflection(ShaderStage::Geometry); if(last == NULL) - last = m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Domain); + last = m_Ctx.CurPipelineState.GetShaderReflection(ShaderStage::Domain); if(last) { @@ -2070,7 +2070,7 @@ void BufferViewer::configureMeshColumns() f.matrixdim = 1; f.systemValue = sig.systemValue; - if(f.systemValue == eAttr_Position) + if(f.systemValue == ShaderBuiltin::Position) posidx = i; m_ModelGSOut->columns.push_back(f); @@ -2091,7 +2091,7 @@ void BufferViewer::configureMeshColumns() for(const FormatElement &sig : m_ModelGSOut->columns) { uint numComps = sig.format.compCount; - uint elemSize = sig.format.compType == eCompType_Double ? 8U : 4U; + uint elemSize = sig.format.compType == CompType::Double ? 8U : 4U; if(m_Ctx.CurPipelineState.HasAlignedPostVSData()) { @@ -2139,15 +2139,15 @@ void BufferViewer::UpdateMeshConfig() m_Config.type = m_CurStage; switch(m_CurStage) { - case eMeshDataStage_VSIn: + case MeshDataStage::VSIn: m_Config.position = m_VSInPosition; m_Config.second = m_VSInSecondary; break; - case eMeshDataStage_VSOut: + case MeshDataStage::VSOut: m_Config.position = m_PostVSPosition; m_Config.second = m_PostVSSecondary; break; - case eMeshDataStage_GSOut: + case MeshDataStage::GSOut: m_Config.position = m_PostGSPosition; m_Config.second = m_PostGSSecondary; break; @@ -2304,11 +2304,11 @@ void BufferViewer::RT_UpdateAndDisplay(IReplayRenderer *) RDTableView *BufferViewer::tableForStage(MeshDataStage stage) { - if(stage == eMeshDataStage_VSIn) + if(stage == MeshDataStage::VSIn) return ui->vsinData; - else if(stage == eMeshDataStage_VSOut) + else if(stage == MeshDataStage::VSOut) return ui->vsoutData; - else if(stage == eMeshDataStage_GSOut) + else if(stage == MeshDataStage::GSOut) return ui->gsoutData; return NULL; @@ -2316,11 +2316,11 @@ RDTableView *BufferViewer::tableForStage(MeshDataStage stage) BufferItemModel *BufferViewer::modelForStage(MeshDataStage stage) { - if(stage == eMeshDataStage_VSIn) + if(stage == MeshDataStage::VSIn) return m_ModelVSIn; - else if(stage == eMeshDataStage_VSOut) + else if(stage == MeshDataStage::VSOut) return m_ModelVSOut; - else if(stage == eMeshDataStage_GSOut) + else if(stage == MeshDataStage::GSOut) return m_ModelGSOut; return NULL; @@ -2328,18 +2328,18 @@ BufferItemModel *BufferViewer::modelForStage(MeshDataStage stage) bool BufferViewer::isCurrentRasterOut() { - if(m_CurStage == eMeshDataStage_VSIn) + if(m_CurStage == MeshDataStage::VSIn) { return false; } - else if(m_CurStage == eMeshDataStage_VSOut) + else if(m_CurStage == MeshDataStage::VSOut) { if(m_Ctx.LogLoaded() && m_Ctx.CurPipelineState.IsTessellationEnabled()) return false; return true; } - else if(m_CurStage == eMeshDataStage_GSOut) + else if(m_CurStage == MeshDataStage::GSOut) { return true; } @@ -2349,11 +2349,11 @@ bool BufferViewer::isCurrentRasterOut() int BufferViewer::currentStageIndex() { - if(m_CurStage == eMeshDataStage_VSIn) + if(m_CurStage == MeshDataStage::VSIn) return 0; - else if(m_CurStage == eMeshDataStage_VSOut) + else if(m_CurStage == MeshDataStage::VSOut) return 1; - else if(m_CurStage == eMeshDataStage_GSOut) + else if(m_CurStage == MeshDataStage::GSOut) return 2; return 0; @@ -2426,12 +2426,12 @@ void BufferViewer::CalcColumnWidth() ResourceFormat floatFmt; floatFmt.compByteWidth = 4; - floatFmt.compType = eCompType_Float; + floatFmt.compType = CompType::Float; floatFmt.compCount = 1; ResourceFormat intFmt; floatFmt.compByteWidth = 4; - floatFmt.compType = eCompType_UInt; + floatFmt.compType = CompType::UInt; floatFmt.compCount = 1; FormatElement("ColumnSizeTest", 0, 0, false, 1, false, 1, floatFmt, false); @@ -2546,9 +2546,9 @@ void BufferViewer::camGuess_changed(double value) // hasn't overridden the values m_Config.position.nearPlane = 0.1f; - if(m_CurStage == eMeshDataStage_VSOut) + if(m_CurStage == MeshDataStage::VSOut) m_Config.position.nearPlane = m_PostVS.nearPlane; - else if(m_CurStage == eMeshDataStage_GSOut) + else if(m_CurStage == MeshDataStage::GSOut) m_Config.position.nearPlane = m_PostGS.nearPlane; if(ui->nearGuess->value() > 0.0) @@ -2556,9 +2556,9 @@ void BufferViewer::camGuess_changed(double value) m_Config.position.farPlane = 100.0f; - if(m_CurStage == eMeshDataStage_VSOut) + if(m_CurStage == MeshDataStage::VSOut) m_Config.position.farPlane = m_PostVS.farPlane; - else if(m_CurStage == eMeshDataStage_GSOut) + else if(m_CurStage == MeshDataStage::GSOut) m_Config.position.farPlane = m_PostGS.farPlane; if(ui->nearGuess->value() > 0.0) @@ -2763,13 +2763,13 @@ void BufferViewer::debugVertex() debugContext += tr(", Instance %1").arg(m_Config.curInstance); const ShaderReflection *shaderDetails = - m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Pixel); + m_Ctx.CurPipelineState.GetShaderReflection(ShaderStage::Pixel); const ShaderBindpointMapping &bindMapping = - m_Ctx.CurPipelineState.GetBindpointMapping(eShaderStage_Pixel); + m_Ctx.CurPipelineState.GetBindpointMapping(ShaderStage::Pixel); // viewer takes ownership of the trace ShaderViewer *s = ShaderViewer::debugShader(m_Ctx, &bindMapping, shaderDetails, - eShaderStage_Pixel, trace, debugContext, this); + ShaderStage::Pixel, trace, debugContext, this); m_Ctx.setupDockWindow(s); @@ -2853,11 +2853,11 @@ void BufferViewer::on_outputTabs_currentChanged(int index) ui->outputTabs->widget(index)->layout()->addWidget(ui->renderContainer); if(index == 0) - m_CurStage = eMeshDataStage_VSIn; + m_CurStage = MeshDataStage::VSIn; else if(index == 1) - m_CurStage = eMeshDataStage_VSOut; + m_CurStage = MeshDataStage::VSOut; else if(index == 2) - m_CurStage = eMeshDataStage_GSOut; + m_CurStage = MeshDataStage::GSOut; ui->drawRange->setEnabled(index > 0); @@ -2907,16 +2907,16 @@ void BufferViewer::on_solidShading_currentIndexChanged(int index) m_Config.wireframeDraw = true; } - m_Config.solidShadeMode = (SolidShadeMode)index; + m_Config.solidShadeMode = (SolidShade)index; m_ModelVSIn->setSecondaryColumn(m_ModelVSIn->secondaryColumn(), - m_Config.solidShadeMode == eShade_Secondary, + m_Config.solidShadeMode == SolidShade::Secondary, m_ModelVSIn->secondaryAlpha()); m_ModelVSOut->setSecondaryColumn(m_ModelVSOut->secondaryColumn(), - m_Config.solidShadeMode == eShade_Secondary, + m_Config.solidShadeMode == SolidShade::Secondary, m_ModelVSOut->secondaryAlpha()); m_ModelGSOut->setSecondaryColumn(m_ModelGSOut->secondaryColumn(), - m_Config.solidShadeMode == eShade_Secondary, + m_Config.solidShadeMode == SolidShade::Secondary, m_ModelGSOut->secondaryAlpha()); INVOKE_MEMFN(RT_UpdateAndDisplay); @@ -2991,7 +2991,7 @@ void BufferViewer::on_rowOffset_valueChanged(int value) void BufferViewer::on_autofitCamera_clicked() { - if(m_CurStage != eMeshDataStage_VSIn) + if(m_CurStage != MeshDataStage::VSIn) return; ui->controlType->setCurrentIndex(1); @@ -3008,15 +3008,15 @@ void BufferViewer::on_autofitCamera_clicked() switch(m_CurStage) { - case eMeshDataStage_VSIn: + case MeshDataStage::VSIn: model = m_ModelVSIn; stage = 0; break; - case eMeshDataStage_VSOut: + case MeshDataStage::VSOut: model = m_ModelVSOut; stage = 1; break; - case eMeshDataStage_GSOut: + case MeshDataStage::GSOut: model = m_ModelGSOut; stage = 2; break; diff --git a/qrenderdoc/Windows/BufferViewer.h b/qrenderdoc/Windows/BufferViewer.h index f8e0bc7ca..03fcab962 100644 --- a/qrenderdoc/Windows/BufferViewer.h +++ b/qrenderdoc/Windows/BufferViewer.h @@ -68,11 +68,11 @@ public: void OnSelectedEventChanged(uint32_t eventID) {} void OnEventChanged(uint32_t eventID); - void ScrollToRow(int row, MeshDataStage stage = eMeshDataStage_VSIn) + void ScrollToRow(int row, MeshDataStage stage = MeshDataStage::VSIn) { - if(stage == eMeshDataStage_VSOut) + if(stage == MeshDataStage::VSOut) ScrollToRow(m_ModelVSOut, row); - else if(stage == eMeshDataStage_GSOut) + else if(stage == MeshDataStage::GSOut) ScrollToRow(m_ModelGSOut, row); else ScrollToRow(m_ModelVSIn, row); diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index baa14fcb2..1a73cbb59 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -28,7 +28,7 @@ QList ConstantBufferPreviewer::m_Previews; -ConstantBufferPreviewer::ConstantBufferPreviewer(CaptureContext &ctx, const ShaderStageType stage, +ConstantBufferPreviewer::ConstantBufferPreviewer(CaptureContext &ctx, const ShaderStage stage, uint32_t slot, uint32_t idx, QWidget *parent) : QFrame(parent), ui(new Ui::ConstantBufferPreviewer), m_Ctx(ctx) { @@ -67,8 +67,7 @@ ConstantBufferPreviewer::~ConstantBufferPreviewer() delete ui; } -ConstantBufferPreviewer *ConstantBufferPreviewer::has(ShaderStageType stage, uint32_t slot, - uint32_t idx) +ConstantBufferPreviewer *ConstantBufferPreviewer::has(ShaderStage stage, uint32_t slot, uint32_t idx) { for(ConstantBufferPreviewer *c : m_Previews) { diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.h b/qrenderdoc/Windows/ConstantBufferPreviewer.h index 13cbc7ade..bc34fe0f6 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.h +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.h @@ -39,11 +39,11 @@ class ConstantBufferPreviewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit ConstantBufferPreviewer(CaptureContext &ctx, const ShaderStageType stage, uint32_t slot, + explicit ConstantBufferPreviewer(CaptureContext &ctx, const ShaderStage stage, uint32_t slot, uint32_t idx, QWidget *parent = 0); ~ConstantBufferPreviewer(); - static ConstantBufferPreviewer *has(ShaderStageType stage, uint32_t slot, uint32_t idx); + static ConstantBufferPreviewer *has(ShaderStage stage, uint32_t slot, uint32_t idx); void OnLogfileLoaded(); void OnLogfileClosed(); @@ -64,7 +64,7 @@ private: ResourceId m_cbuffer; ResourceId m_shader; - ShaderStageType m_stage = eShaderStage_Vertex; + ShaderStage m_stage = ShaderStage::Vertex; uint32_t m_slot = 0; uint32_t m_arrayIdx = 0; diff --git a/qrenderdoc/Windows/DebugMessageView.cpp b/qrenderdoc/Windows/DebugMessageView.cpp index e0b5f6b17..ecd580c5e 100644 --- a/qrenderdoc/Windows/DebugMessageView.cpp +++ b/qrenderdoc/Windows/DebugMessageView.cpp @@ -127,16 +127,16 @@ public: { } - typedef QPair, uint32_t> DebugMessageType; - static DebugMessageType makeType(const DebugMessage &msg) + typedef QPair, uint32_t> MessageType; + static MessageType makeType(const DebugMessage &msg) { return qMakePair(qMakePair(msg.source, msg.category), msg.messageID); } - QList m_HiddenSources; - QList m_HiddenCategories; - QList m_HiddenSeverities; - QList m_HiddenTypes; + QList m_HiddenSources; + QList m_HiddenCategories; + QList m_HiddenSeverities; + QList m_HiddenTypes; bool showHidden = false; diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp index ace183375..8ef802279 100644 --- a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp @@ -282,20 +282,20 @@ void CaptureDialog::on_vulkanLayerWarn_clicked() { QString caption = tr("Configure Vulkan layer settings in registry?"); - uint32_t flags = 0; + VulkanLayerFlags flags = VulkanLayerFlags::NoFlags; rdctype::array myJSONs; rdctype::array otherJSONs; RENDERDOC_NeedVulkanLayerRegistration(&flags, &myJSONs, &otherJSONs); - const bool hasOtherJSON = (flags & eVulkan_OtherInstallsRegistered); - const bool thisRegistered = (flags & eVulkan_ThisInstallRegistered); - const bool needElevation = (flags & eVulkan_NeedElevation); - const bool couldElevate = (flags & eVulkan_CouldElevate); - const bool registerAll = (flags & eVulkan_RegisterAll); - const bool updateAllowed = (flags & eVulkan_UpdateAllowed); + const bool hasOtherJSON = bool(flags & VulkanLayerFlags::OtherInstallsRegistered); + const bool thisRegistered = bool(flags & VulkanLayerFlags::ThisInstallRegistered); + const bool needElevation = bool(flags & VulkanLayerFlags::NeedElevation); + const bool couldElevate = bool(flags & VulkanLayerFlags::CouldElevate); + const bool registerAll = bool(flags & VulkanLayerFlags::RegisterAll); + const bool updateAllowed = bool(flags & VulkanLayerFlags::UpdateAllowed); - if(flags & eVulkan_Unfixable) + if(flags & VulkanLayerFlags::Unfixable) { QString msg = tr("There is an unfixable problem with your vulkan layer configuration. Please consult the " diff --git a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp index 5806cc718..4c17958ba 100644 --- a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp +++ b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp @@ -51,7 +51,8 @@ EnvironmentEditor::EnvironmentEditor(QWidget *parent) QObject::connect(ui->appendValue, &QRadioButton::toggled, separatorLambda); ui->separator->addItems({ - ToQStr(eEnvSep_Platform), ToQStr(eEnvSep_SemiColon), ToQStr(eEnvSep_Colon), ToQStr(eEnvSep_None), + ToQStr(EnvSep::Platform), ToQStr(EnvSep::SemiColon), ToQStr(EnvSep::Colon), + ToQStr(EnvSep::NoSep), }); ui->separator->setCurrentIndex(0); @@ -120,11 +121,11 @@ void EnvironmentEditor::on_variables_currentItemChanged(QTreeWidgetItem *current ui->value->setText(mod.value); ui->separator->setCurrentIndex((int)mod.separator); - if(mod.type == eEnvMod_Set) + if(mod.type == EnvMod::Set) ui->setValue->setChecked(true); - else if(mod.type == eEnvMod_Append) + else if(mod.type == EnvMod::Append) ui->appendValue->setChecked(true); - else if(mod.type == eEnvMod_Prepend) + else if(mod.type == EnvMod::Prepend) ui->prependValue->setChecked(true); } } @@ -134,14 +135,14 @@ void EnvironmentEditor::on_addUpdate_clicked() EnvironmentModification mod; mod.variable = ui->name->text(); mod.value = ui->value->text(); - mod.separator = (EnvironmentSeparator)ui->separator->currentIndex(); + mod.separator = (EnvSep)ui->separator->currentIndex(); if(ui->appendValue->isChecked()) - mod.type = eEnvMod_Append; + mod.type = EnvMod::Append; else if(ui->prependValue->isChecked()) - mod.type = eEnvMod_Prepend; + mod.type = EnvMod::Prepend; else - mod.type = eEnvMod_Set; + mod.type = EnvMod::Set; addModification(mod, false); diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp index 2739d992b..c2bc029e1 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp @@ -994,7 +994,7 @@ void LiveCapture::connectionThreadEntry() TargetControlMessage msg; m_Connection->ReceiveMessage(&msg); - if(msg.Type == eTargetControlMsg_RegisterAPI) + if(msg.Type == TargetControlMessageType::RegisterAPI) { QString api = ToQStr(msg.RegisterAPI.APIName); GUIInvoke::call([this, api]() { @@ -1016,7 +1016,7 @@ void LiveCapture::connectionThreadEntry() }); } - if(msg.Type == eTargetControlMsg_NewCapture) + if(msg.Type == TargetControlMessageType::NewCapture) { uint32_t capID = msg.NewCapture.ID; QDateTime timestamp = QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0)); @@ -1033,7 +1033,7 @@ void LiveCapture::connectionThreadEntry() }); } - if(msg.Type == eTargetControlMsg_CaptureCopied) + if(msg.Type == TargetControlMessageType::CaptureCopied) { uint32_t capID = msg.NewCapture.ID; QString path = ToQStr(msg.NewCapture.path); @@ -1041,7 +1041,7 @@ void LiveCapture::connectionThreadEntry() GUIInvoke::call([=]() { captureCopied(capID, path); }); } - if(msg.Type == eTargetControlMsg_NewChild) + if(msg.Type == TargetControlMessageType::NewChild) { if(msg.NewChild.PID != 0) { diff --git a/qrenderdoc/Windows/Dialogs/RemoteManager.cpp b/qrenderdoc/Windows/Dialogs/RemoteManager.cpp index fc8346a23..0f3e9a243 100644 --- a/qrenderdoc/Windows/Dialogs/RemoteManager.cpp +++ b/qrenderdoc/Windows/Dialogs/RemoteManager.cpp @@ -604,13 +604,13 @@ void RemoteManager::on_connect_clicked() else { IRemoteServer *server = NULL; - ReplayCreateStatus status = + ReplayStatus status = RENDERDOC_CreateRemoteServerConnection(host->Hostname.toUtf8().data(), 0, &server); if(server) server->ShutdownServerAndConnection(); setRemoteServerLive(node, false, false); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) RDDialog::critical(this, tr("Shutdown error"), tr("Error shutting down remote server: %1").arg(ToQStr(status))); } diff --git a/qrenderdoc/Windows/Dialogs/TextureSaveDialog.cpp b/qrenderdoc/Windows/Dialogs/TextureSaveDialog.cpp index af3f752fb..08157a494 100644 --- a/qrenderdoc/Windows/Dialogs/TextureSaveDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/TextureSaveDialog.cpp @@ -42,14 +42,14 @@ TextureSaveDialog::TextureSaveDialog(const FetchTexture &t, const TextureSave &s ui->fileFormat->clear(); QStringList strs; - for(int i = 0; i < eFileType_Count; i++) - strs << ToQStr((FileType)i); + for(FileType i : values()) + strs << ToQStr(i); ui->fileFormat->addItems(strs); strs.clear(); - for(int i = 0; i < eAlphaMap_Count; i++) - strs << ToQStr((AlphaMapping)i); + for(AlphaMapping i : values()) + strs << ToQStr(i); ui->alphaMap->addItems(strs); @@ -114,7 +114,7 @@ TextureSaveDialog::TextureSaveDialog(const FetchTexture &t, const TextureSave &s ui->sliceGroup->setVisible(tex.depth > 1 || tex.arraysize > 1 || tex.msSamp > 1); - if(saveData.destType != eFileType_DDS) + if(saveData.destType != FileType::DDS) { ui->cubeCruciform->setEnabled(tex.cubemap && tex.arraysize == 6); @@ -142,10 +142,10 @@ void TextureSaveDialog::SetFiletypeFromFilename() QFileInfo path(ui->filename->text()); QString ext = path.suffix().toUpper(); - for(int i = 0; i < eFileType_Count; i++) + for(FileType i : values()) { - if(ToQStr((FileType)i) == ext) - ui->fileFormat->setCurrentIndex(i); + if(ToQStr(i) == ext) + ui->fileFormat->setCurrentIndex(uint32_t(i)); } } @@ -156,7 +156,7 @@ void TextureSaveDialog::SetFilenameFromFiletype() int idx = ui->fileFormat->currentIndex(); - if(idx >= 0 && idx < eFileType_Count) + if(idx >= 0 && idx < (int)FileType::Count) { QString selectedExt = ToQStr((FileType)idx).toLower(); @@ -174,20 +174,20 @@ void TextureSaveDialog::on_fileFormat_currentIndexChanged(int index) { saveData.destType = (FileType)ui->fileFormat->currentIndex(); - ui->jpegCompression->setEnabled(saveData.destType == eFileType_JPG); + ui->jpegCompression->setEnabled(saveData.destType == FileType::JPG); - ui->alphaGroup->setVisible(saveData.destType != eFileType_HDR && - saveData.destType != eFileType_EXR && - saveData.destType != eFileType_DDS); + ui->alphaGroup->setVisible(saveData.destType != FileType::HDR && + saveData.destType != FileType::EXR && + saveData.destType != FileType::DDS); - bool noAlphaFormat = (saveData.destType == eFileType_BMP || saveData.destType == eFileType_JPG); + bool noAlphaFormat = (saveData.destType == FileType::BMP || saveData.destType == FileType::JPG); ui->alphaMap->setEnabled(tex.format.compCount == 4 && noAlphaFormat); - ui->alphaCol->setEnabled(saveData.alpha == eAlphaMap_BlendToColour && tex.format.compCount == 4 && - noAlphaFormat); + ui->alphaCol->setEnabled(saveData.alpha == AlphaMapping::BlendToColour && + tex.format.compCount == 4 && noAlphaFormat); - if(saveData.destType == eFileType_DDS) + if(saveData.destType == FileType::DDS) { ui->exportAllMips->setEnabled(true); ui->exportAllMips->setChecked(true); @@ -242,7 +242,7 @@ void TextureSaveDialog::on_oneMip_toggled(bool checked) ui->exportAllMips->setChecked(!ui->oneMip->isChecked()); ui->mipSelect->setEnabled(ui->oneMip->isChecked()); - if(saveData.destType != eFileType_DDS) + if(saveData.destType != FileType::DDS) { ui->oneMip->setChecked(true); ui->exportAllMips->setChecked(false); @@ -336,7 +336,7 @@ void TextureSaveDialog::on_exportAllSlices_toggled(bool checked) m_Recurse = true; ui->oneSlice->setChecked(!ui->exportAllSlices->isChecked()); - if(saveData.destType == eFileType_DDS) + if(saveData.destType == FileType::DDS) { ui->mapSlicesToGrid->setEnabled(false); ui->gridWidth->setEnabled(false); @@ -368,7 +368,7 @@ void TextureSaveDialog::on_oneSlice_toggled(bool checked) m_Recurse = true; ui->exportAllSlices->setChecked(!ui->oneSlice->isChecked()); - if(saveData.destType == eFileType_DDS) + if(saveData.destType == FileType::DDS) { ui->mapSlicesToGrid->setEnabled(false); ui->gridWidth->setEnabled(false); @@ -403,7 +403,7 @@ void TextureSaveDialog::on_mapSlicesToGrid_toggled(bool checked) { ui->cubeCruciform->setChecked(false); } - else if(saveData.destType != eFileType_DDS) + else if(saveData.destType != FileType::DDS) { ui->oneSlice->setChecked(true); ui->exportAllSlices->setChecked(false); @@ -415,7 +415,7 @@ void TextureSaveDialog::on_mapSlicesToGrid_toggled(bool checked) m_Recurse = false; - if(saveData.destType == eFileType_DDS) + if(saveData.destType == FileType::DDS) ui->gridWidth->setEnabled(false); else ui->gridWidth->setEnabled(ui->mapSlicesToGrid->isChecked()); @@ -432,7 +432,7 @@ void TextureSaveDialog::on_cubeCruciform_toggled(bool checked) { ui->mapSlicesToGrid->setChecked(false); } - else if(saveData.destType != eFileType_DDS) + else if(saveData.destType != FileType::DDS) { ui->oneSlice->setChecked(true); ui->exportAllSlices->setChecked(false); @@ -471,7 +471,7 @@ void TextureSaveDialog::on_alphaMap_currentIndexChanged(int index) { saveData.alpha = (AlphaMapping)index; - ui->alphaCol->setEnabled(saveData.alpha == eAlphaMap_BlendToColour); + ui->alphaCol->setEnabled(saveData.alpha == AlphaMapping::BlendToColour); } void TextureSaveDialog::on_blackPoint_textEdited(const QString &arg) @@ -496,9 +496,9 @@ void TextureSaveDialog::on_browse_clicked() { QString filter = ""; - for(int i = 0; i < eFileType_Count; i++) + for(FileType i : values()) { - QString ext = ToQStr((FileType)i); + QString ext = ToQStr(i); if(filter.length() > 0) filter += ";;"; @@ -529,7 +529,7 @@ void TextureSaveDialog::on_saveCancelButtons_accepted() { saveData.alpha = (AlphaMapping)ui->alphaMap->currentIndex(); - if(saveData.alpha == eAlphaMap_BlendToCheckerboard) + if(saveData.alpha == AlphaMapping::BlendToCheckerboard) { saveData.alphaCol = FloatVector(0.666f, 0.666f, 0.666f, 1.0f); } diff --git a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp index 46baba9e9..1aa82d5f9 100644 --- a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp @@ -85,7 +85,7 @@ public: node->parent = NULL; node->parentIndex = 0; node->file.filename = "/"; - node->file.flags = eFileProp_Directory; + node->file.flags = FileProperty::Directory; roots.push_back(node); home = indexForPath(homeDir); @@ -236,11 +236,11 @@ public: return ret; // if it's not a dir, there are no children - if(getNode(index)->file.flags & eFileProp_Directory) + if(getNode(index)->file.flags & FileProperty::Directory) ret &= ~Qt::ItemNeverHasChildren; // if we can't populate it, set it as disabled - if(getNode(index)->file.flags & eFileProp_ErrorAccessDenied) + if(getNode(index)->file.flags & FileProperty::ErrorAccessDenied) ret &= ~Qt::ItemIsEnabled; return ret; @@ -306,15 +306,15 @@ public: } case 1: { - if(node->file.flags & eFileProp_Directory) + if(node->file.flags & FileProperty::Directory) return QVariant(); return qulonglong(node->file.size); } case 2: { - if(node->file.flags & eFileProp_Directory) + if(node->file.flags & FileProperty::Directory) return tr("Directory"); - else if(node->file.flags & eFileProp_Executable) + else if(node->file.flags & FileProperty::Executable) return tr("Executable file"); else return tr("File"); @@ -332,11 +332,11 @@ public: case Qt::DecorationRole: if(index.column() == 0) { - int hideIndex = (node->file.flags & eFileProp_Hidden) ? 1 : 0; + int hideIndex = (node->file.flags & FileProperty::Hidden) ? 1 : 0; - if(node->file.flags & eFileProp_Directory) + if(node->file.flags & FileProperty::Directory) return dirIcon[hideIndex]; - else if(node->file.flags & eFileProp_Executable) + else if(node->file.flags & FileProperty::Executable) return exeIcon[hideIndex]; else return fileIcon[hideIndex]; @@ -345,11 +345,12 @@ public: if(index.column() == 1) return Qt::AlignRight; break; - case FileIsDirRole: return bool(node->file.flags & eFileProp_Directory); - case FileIsHiddenRole: return bool(node->file.flags & eFileProp_Hidden); - case FileIsExecutableRole: return bool(node->file.flags & eFileProp_Executable); + case FileIsDirRole: return bool(node->file.flags & FileProperty::Directory); + case FileIsHiddenRole: return bool(node->file.flags & FileProperty::Hidden); + case FileIsExecutableRole: return bool(node->file.flags & FileProperty::Executable); case FileIsRootRole: return roots.contains(node); - case FileIsAccessDeniedRole: return bool(node->file.flags & eFileProp_ErrorAccessDenied); + case FileIsAccessDeniedRole: + return bool(node->file.flags & FileProperty::ErrorAccessDenied); case FilePathRole: return makePath(node); case FileNameRole: return ToQStr(node->file.filename); default: break; @@ -443,16 +444,16 @@ private: node->populated = true; // nothing to do for non-directories - if(!(node->file.flags & eFileProp_Directory)) + if(!(node->file.flags & FileProperty::Directory)) return; Renderer.ListFolder( makePath(node), true, [this, node](const char *path, const rdctype::array &files) { - if(files.count == 1 && files[0].flags & eFileProp_ErrorAccessDenied) + if(files.count == 1 && (files[0].flags & FileProperty::ErrorAccessDenied)) { - node->file.flags |= eFileProp_ErrorAccessDenied; + node->file.flags |= FileProperty::ErrorAccessDenied; return; } @@ -464,8 +465,8 @@ private: qSort(sortedFiles.begin(), sortedFiles.end(), [](const DirectoryFile &a, const DirectoryFile &b) { // sort greater than so that files with the flag are sorted before those without - if((a.flags & eFileProp_Directory) != (b.flags & eFileProp_Directory)) - return (a.flags & eFileProp_Directory) > (b.flags & eFileProp_Directory); + if((a.flags & FileProperty::Directory) != (b.flags & FileProperty::Directory)) + return (a.flags & FileProperty::Directory) > (b.flags & FileProperty::Directory); return strcmp(a.filename.c_str(), b.filename.c_str()) < 0; }); diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index 35f49f0e8..2c009c249 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -180,7 +180,7 @@ uint EventBrowser::AddDrawcalls(QTreeWidgetItem *parent, const rdctype::array results; r->FetchCounters(counters, 1, &results); diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index dc72548f5..505fee911 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -426,7 +426,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local rdctype::str driver; rdctype::str machineIdent; - ReplaySupport support = eReplaySupport_Unsupported; + ReplaySupport support = ReplaySupport::Unsupported; bool remoteReplay = !local || (m_Ctx.Renderer().remote() && m_Ctx.Renderer().remote()->Connected); @@ -437,7 +437,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local // if the return value suggests remote replay, and it's not already selected, AND the user // hasn't previously chosen to always replay locally without being prompted, ask if they'd // prefer to switch to a remote context for replaying. - if(support == eReplaySupport_SuggestRemote && !remoteReplay && !m_Ctx.Config.AlwaysReplayLocally) + if(support == ReplaySupport::SuggestRemote && !remoteReplay && !m_Ctx.Config.AlwaysReplayLocally) { SuggestRemoteDialog dialog(ToQStr(driver), ToQStr(machineIdent), this); @@ -493,14 +493,14 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local if(remoteReplay) { - support = eReplaySupport_Unsupported; + support = ReplaySupport::Unsupported; QStringList remoteDrivers = m_Ctx.Renderer().GetRemoteSupport(); for(const QString &d : remoteDrivers) { if(driver == d) - support = eReplaySupport_Supported; + support = ReplaySupport::Supported; } } } @@ -509,7 +509,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local // if driver is empty something went wrong loading the log, let it be handled as usual // below. Otherwise indicate that support is missing. - if(driver.count > 0 && support == eReplaySupport_Unsupported) + if(driver.count > 0 && support == ReplaySupport::Unsupported) { if(remoteReplay) { @@ -1153,7 +1153,7 @@ void MainWindow::switchContext() host->CheckStatus(); } - ReplayCreateStatus status = eReplayCreate_Success; + ReplayStatus status = ReplayStatus::Succeeded; if(host->ServerRunning && !host->Busy) { @@ -1164,7 +1164,7 @@ void MainWindow::switchContext() contextChooser->setIcon(host->ServerRunning && !host->Busy ? Icons::connect() : Icons::disconnect()); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) { contextChooser->setIcon(Icons::cross()); contextChooser->setText(tr("Replay Context: %1").arg("Local")); diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp index 062905b4a..5d076ed91 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp @@ -63,14 +63,14 @@ struct ViewTag }; ViewTag() {} - ViewTag(ResType t, int i, const D3D11PipelineState::ShaderStage::ResourceView &r) + ViewTag(ResType t, int i, const D3D11PipelineState::Shader::ResourceView &r) : type(t), index(i), res(r) { } ResType type; int index; - D3D11PipelineState::ShaderStage::ResourceView res; + D3D11PipelineState::Shader::ResourceView res; }; Q_DECLARE_METATYPE(ViewTag); @@ -386,7 +386,7 @@ void D3D11PipelineStateViewer::setEmptyRow(QTreeWidgetItem *node) } bool D3D11PipelineStateViewer::HasImportantViewParams( - const D3D11PipelineState::ShaderStage::ResourceView &view, FetchTexture *tex) + const D3D11PipelineState::Shader::ResourceView &view, FetchTexture *tex) { // we don't count 'upgrade typeless to typed' as important, we just display the typed format // in the row since there's no real hidden important information there. The formats can't be @@ -400,14 +400,14 @@ bool D3D11PipelineStateViewer::HasImportantViewParams( // in the case of the swapchain case, types can be different and it won't have shown // up as taking the view's format because the swapchain already has one. Make sure to mark it // as important - if(view.Format.compType != eCompType_None && view.Format != tex->format) + if(view.Format.compType != CompType::Typeless && view.Format != tex->format) return true; return false; } bool D3D11PipelineStateViewer::HasImportantViewParams( - const D3D11PipelineState::ShaderStage::ResourceView &view, FetchBuffer *buf) + const D3D11PipelineState::Shader::ResourceView &view, FetchBuffer *buf) { if(view.FirstElement > 0 || view.NumElements * view.ElementSize < buf->length) return true; @@ -423,7 +423,7 @@ void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT QString text; - const D3D11PipelineState::ShaderStage::ResourceView &res = view.res; + const D3D11PipelineState::Shader::ResourceView &res = view.res; bool viewdetails = false; @@ -495,7 +495,7 @@ void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT QString text; - const D3D11PipelineState::ShaderStage::ResourceView &res = view.res; + const D3D11PipelineState::Shader::ResourceView &res = view.res; if((res.FirstElement * res.ElementSize) > 0 || (res.NumElements * res.ElementSize) < buf->length) { @@ -526,7 +526,7 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR const QIcon &action = Icons::action(); const QIcon &action_hover = Icons::action_hover(); - const D3D11PipelineState::ShaderStage::ResourceView &r = view.res; + const D3D11PipelineState::Shader::ResourceView &r = view.res; bool viewDetails = false; @@ -574,7 +574,7 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR name = tex->name; typeName = ToQStr(tex->resType); - if(tex->resType == eResType_Texture2DMS || tex->resType == eResType_Texture2DMSArray) + if(tex->resType == TextureDim::Texture2DMS || tex->resType == TextureDim::Texture2DMSArray) { typeName += QString(" %1x").arg(tex->msSamp); } @@ -598,7 +598,7 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR name = buf->name; typeName = "Buffer"; - if(r.Flags & RawBuffer) + if(r.Flags & D3DBufferViewFlags::Raw) { typeName = QString("%1ByteAddressBuffer").arg(view.type == ViewTag::UAV ? "RW" : ""); } @@ -610,7 +610,7 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR .arg(buf->length / r.ElementSize); } - if(r.Flags & (AppendBuffer | CounterBuffer)) + if(r.Flags & (D3DBufferViewFlags::Append | D3DBufferViewFlags::Counter)) { typeName += QString(" (Count: %1)").arg(r.BufferStructCount); } @@ -618,7 +618,7 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR // get the buffer type, whether it's just a basic type or a complex struct if(shaderInput && !shaderInput->IsTexture) { - if(r.Format.compType == eCompType_None) + if(r.Format.compType == CompType::Typeless) { if(!shaderInput->variableType.members.empty()) format = "struct " + ToQStr(shaderInput->variableType.descriptor.name); @@ -679,7 +679,7 @@ bool D3D11PipelineStateViewer::showNode(bool usedSlot, bool filledSlot) return false; } -const D3D11PipelineState::ShaderStage *D3D11PipelineStateViewer::stageForSender(QWidget *widget) +const D3D11PipelineState::Shader *D3D11PipelineStateViewer::stageForSender(QWidget *widget) { if(!m_Ctx.LogLoaded()) return NULL; @@ -784,14 +784,13 @@ void D3D11PipelineStateViewer::clearState() ui->stencils->clear(); } -void D3D11PipelineStateViewer::setShaderState(const D3D11PipelineState::ShaderStage &stage, - QLabel *shader, RDTreeWidget *resources, - RDTreeWidget *samplers, RDTreeWidget *cbuffers, - RDTreeWidget *classes) +void D3D11PipelineStateViewer::setShaderState(const D3D11PipelineState::Shader &stage, QLabel *shader, + RDTreeWidget *resources, RDTreeWidget *samplers, + RDTreeWidget *cbuffers, RDTreeWidget *classes) { ShaderReflection *shaderDetails = stage.ShaderDetails; - if(stage.Shader == ResourceId()) + if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); else shader->setText(ToQStr(stage.ShaderName)); @@ -842,7 +841,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11PipelineState::ShaderSt samplers->clear(); for(int i = 0; i < stage.Samplers.count; i++) { - const D3D11PipelineState::ShaderStage::Sampler &s = stage.Samplers[i]; + const D3D11PipelineState::Shader::Sampler &s = stage.Samplers[i]; const ShaderResource *shaderInput = NULL; @@ -939,7 +938,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11PipelineState::ShaderSt cbuffers->clear(); for(int i = 0; i < stage.ConstantBuffers.count; i++) { - const D3D11PipelineState::ShaderStage::CBuffer &b = stage.ConstantBuffers[i]; + const D3D11PipelineState::Shader::CBuffer &b = stage.ConstantBuffers[i]; const ConstantBlock *shaderCBuf = NULL; @@ -1086,7 +1085,7 @@ void D3D11PipelineStateViewer::setState() for(int e = 0; e < excess; e++) { if(state.m_VS.ShaderDetails->InputSig[state.m_VS.ShaderDetails->InputSig.count - 1 - e] - .systemValue == eAttr_None) + .systemValue == ShaderBuiltin::Undefined) { allSystem = false; break; @@ -1132,8 +1131,8 @@ void D3D11PipelineStateViewer::setState() .arg(i) .arg(IAname) .arg(VSname) - .arg(IA[i].compType) - .arg(VS[i].compType); + .arg(ToQStr(IA[i].compType)) + .arg(ToQStr(VS[i].compType)); } } @@ -1211,12 +1210,11 @@ void D3D11PipelineStateViewer::setState() ui->iaLayouts->setUpdatesEnabled(true); ui->iaLayouts->verticalScrollBar()->setValue(vs); - PrimitiveTopology topo = draw ? draw->topology : eTopology_Unknown; + Topology topo = draw ? draw->topology : Topology::Unknown; - if(topo > eTopology_PatchList) + int numCPs = PatchList_Count(topo); + if(numCPs > 0) { - int numCPs = (int)topo - (int)eTopology_PatchList_1CPs + 1; - ui->topology->setText(QString("PatchList (%1 Control Points)").arg(numCPs)); } else @@ -1226,27 +1224,27 @@ void D3D11PipelineStateViewer::setState() switch(topo) { - case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; - case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; - case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; - case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; - case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; - case eTopology_LineList_Adj: + case Topology::PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; + case Topology::LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; + case Topology::LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; + case Topology::TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; + case Topology::TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; + case Topology::LineList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj()); break; - case eTopology_LineStrip_Adj: + case Topology::LineStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj()); break; - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj()); break; - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj()); break; default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break; } - bool ibufferUsed = draw && (draw->flags & eDraw_UseIBuffer); + bool ibufferUsed = draw && (draw->flags & DrawFlags::UseIBuffer); vs = ui->iaBuffers->verticalScrollBar()->value(); ui->iaBuffers->setUpdatesEnabled(false); @@ -1502,8 +1500,8 @@ void D3D11PipelineStateViewer::setState() ui->scissors->verticalScrollBar()->setValue(vs); ui->scissors->setUpdatesEnabled(true); - ui->fillMode->setText(ToQStr(state.m_RS.m_State.FillMode)); - ui->cullMode->setText(ToQStr(state.m_RS.m_State.CullMode)); + ui->fillMode->setText(ToQStr(state.m_RS.m_State.fillMode)); + ui->cullMode->setText(ToQStr(state.m_RS.m_State.cullMode)); ui->frontCCW->setPixmap(state.m_RS.m_State.FrontCCW ? tick : cross); ui->scissorEnabled->setPixmap(state.m_RS.m_State.ScissorEnable ? tick : cross); @@ -1543,9 +1541,9 @@ void D3D11PipelineStateViewer::setState() // this search will just boil down to only PS. // When multiple stages use the UAV, we allow the last stage to 'win' and define its type, // although it would be very surprising if the types were actually different anyway. - const D3D11PipelineState::ShaderStage *nonCS[] = {&state.m_VS, &state.m_DS, &state.m_HS, - &state.m_GS, &state.m_PS}; - for(const D3D11PipelineState::ShaderStage *stage : nonCS) + const D3D11PipelineState::Shader *nonCS[] = {&state.m_VS, &state.m_DS, &state.m_HS, + &state.m_GS, &state.m_PS}; + for(const D3D11PipelineState::Shader *stage : nonCS) { if(stage->ShaderDetails) { @@ -1659,15 +1657,15 @@ void D3D11PipelineStateViewer::setState() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); } - else if(draw->flags & eDraw_Dispatch) + else if(draw->flags & DrawFlags::Dispatch) { ui->pipeFlow->setStagesEnabled({false, false, false, false, false, false, false, false, true}); } else { ui->pipeFlow->setStagesEnabled( - {true, true, state.m_HS.Shader != ResourceId(), state.m_DS.Shader != ResourceId(), - state.m_GS.Shader != ResourceId(), true, state.m_PS.Shader != ResourceId(), true, false}); + {true, true, state.m_HS.Object != ResourceId(), state.m_DS.Object != ResourceId(), + state.m_GS.Object != ResourceId(), true, state.m_PS.Object != ResourceId(), true, false}); } } @@ -1708,7 +1706,7 @@ QString D3D11PipelineStateViewer::formatMembers(int indent, const QString &namep void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) { - const D3D11PipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const D3D11PipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -1733,7 +1731,7 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int if(tex) { - if(tex->resType == eResType_Buffer) + if(tex->resType == TextureDim::Buffer) { BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); @@ -1774,7 +1772,7 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int { // last thing, see if it's a streamout buffer - if(stage->stage == eShaderStage_Geometry) + if(stage->stage == ShaderStage::Geometry) { for(int i = 0; i < m_Ctx.CurD3D11PipelineState.m_SO.Outputs.count; i++) { @@ -1801,15 +1799,15 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int // in multiple places. Most likely the bindings are equivalent anyway. // The main point is that it allows us to pick up the binding if it's not // bound in the PS but only in an earlier stage. - if(view.type == ViewTag::UAV && stage->stage != eShaderStage_Compute) + if(view.type == ViewTag::UAV && stage->stage != ShaderStage::Compute) { const D3D11PipelineState &state = m_Ctx.CurD3D11PipelineState; - const D3D11PipelineState::ShaderStage *nonCS[] = {&state.m_VS, &state.m_DS, &state.m_HS, - &state.m_GS, &state.m_PS}; + const D3D11PipelineState::Shader *nonCS[] = {&state.m_VS, &state.m_DS, &state.m_HS, + &state.m_GS, &state.m_PS}; bind += state.m_OM.UAVStartSlot; - for(const D3D11PipelineState::ShaderStage *searchstage : nonCS) + for(const D3D11PipelineState::Shader *searchstage : nonCS) { if(searchstage->ShaderDetails) { @@ -1878,14 +1876,14 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int const ResourceFormat &fmt = view.res.Format; if(fmt.special) { - if(fmt.specialFormat == eSpecial_R10G10B10A2) + if(fmt.specialFormat == SpecialFormat::R10G10B10A2) { - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "uintten"; - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormten"; } - else if(fmt.specialFormat == eSpecial_R11G11B10) + else if(fmt.specialFormat == SpecialFormat::R11G11B10) { format = "floateleven"; } @@ -1896,47 +1894,47 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int { case 1: { - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormb"; - if(fmt.compType == eCompType_SNorm) + if(fmt.compType == CompType::SNorm) format = "snormb"; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "ubyte"; - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) format = "byte"; break; } case 2: { - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormh"; - if(fmt.compType == eCompType_SNorm) + if(fmt.compType == CompType::SNorm) format = "snormh"; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "ushort"; - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) format = "short"; - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) format = "half"; break; } case 4: { - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormf"; - if(fmt.compType == eCompType_SNorm) + if(fmt.compType == CompType::SNorm) format = "snormf"; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "uint"; - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) format = "int"; - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) format = "float"; break; } } - if(view.res.Flags & RawBuffer) + if(view.res.Flags & D3DBufferViewFlags::Raw) format = "xint"; format += QString::number(fmt.compCount); @@ -1962,7 +1960,7 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int void D3D11PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int column) { - const D3D11PipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const D3D11PipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -2184,7 +2182,7 @@ void D3D11PipelineStateViewer::vertex_leave(QEvent *e) void D3D11PipelineStateViewer::shaderView_clicked() { - ShaderStageType shaderStage = eShaderStage_Vertex; + ShaderStage shaderStage = ShaderStage::Vertex; ShaderReflection *shaderDetails = NULL; const ShaderBindpointMapping *bindMap = NULL; @@ -2196,9 +2194,9 @@ void D3D11PipelineStateViewer::shaderView_clicked() } else { - const D3D11PipelineState::ShaderStage *stage = stageForSender(sender); + const D3D11PipelineState::Shader *stage = stageForSender(sender); - if(stage == NULL || stage->Shader == ResourceId()) + if(stage == NULL || stage->Object == ResourceId()) return; bindMap = &stage->BindpointMapping; @@ -2220,9 +2218,9 @@ void D3D11PipelineStateViewer::shaderView_clicked() void D3D11PipelineStateViewer::shaderEdit_clicked() { QWidget *sender = qobject_cast(QObject::sender()); - const D3D11PipelineState::ShaderStage *stage = stageForSender(sender); + const D3D11PipelineState::Shader *stage = stageForSender(sender); - if(!stage || stage->Shader == ResourceId()) + if(!stage || stage->Object == ResourceId()) return; const ShaderReflection *shaderDetails = stage->ShaderDetails; @@ -2230,7 +2228,7 @@ void D3D11PipelineStateViewer::shaderEdit_clicked() if(!shaderDetails) return; - QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, eGraphicsAPI_D3D11)[0]); + QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, GraphicsAPI::D3D11)[0]); QString mainfile = ""; @@ -2250,12 +2248,12 @@ void D3D11PipelineStateViewer::shaderEdit_clicked() if(files.empty()) return; - m_Common.EditShader(stage->stage, stage->Shader, shaderDetails, entryFunc, files, mainfile); + m_Common.EditShader(stage->stage, stage->Object, shaderDetails, entryFunc, files, mainfile); } void D3D11PipelineStateViewer::shaderSave_clicked() { - const D3D11PipelineState::ShaderStage *stage = + const D3D11PipelineState::Shader *stage = stageForSender(qobject_cast(QObject::sender())); if(stage == NULL) @@ -2263,7 +2261,7 @@ void D3D11PipelineStateViewer::shaderSave_clicked() ShaderReflection *shaderDetails = stage->ShaderDetails; - if(stage->Shader == ResourceId()) + if(stage->Object == ResourceId()) return; m_Common.SaveShaderFile(shaderDetails); diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h index 8c7cc04f6..ccc8116dc 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h @@ -77,14 +77,7 @@ private: CaptureContext &m_Ctx; PipelineStateViewer &m_Common; - enum D3DBufferViewFlags - { - RawBuffer = 0x1, - AppendBuffer = 0x2, - CounterBuffer = 0x4, - }; - - void setShaderState(const D3D11PipelineState::ShaderStage &stage, QLabel *shader, RDTreeWidget *tex, + void setShaderState(const D3D11PipelineState::Shader &stage, QLabel *shader, RDTreeWidget *tex, RDTreeWidget *samp, RDTreeWidget *cbuffer, RDTreeWidget *classes); void addResourceRow(const ViewTag &view, const ShaderResource *shaderInput, @@ -101,12 +94,11 @@ private: QString formatMembers(int indent, const QString &nameprefix, const rdctype::array &vars); - const D3D11PipelineState::ShaderStage *stageForSender(QWidget *widget); + const D3D11PipelineState::Shader *stageForSender(QWidget *widget); - bool HasImportantViewParams(const D3D11PipelineState::ShaderStage::ResourceView &view, + bool HasImportantViewParams(const D3D11PipelineState::Shader::ResourceView &view, FetchTexture *tex); - bool HasImportantViewParams(const D3D11PipelineState::ShaderStage::ResourceView &view, - FetchBuffer *buf); + bool HasImportantViewParams(const D3D11PipelineState::Shader::ResourceView &view, FetchBuffer *buf); void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, FetchTexture *tex); void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, FetchBuffer *buf); diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp index cc183e19b..dc18d84e6 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp @@ -436,7 +436,7 @@ bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12PipelineState:: // in the case of the swapchain case, types can be different and it won't have shown // up as taking the view's format because the swapchain already has one. Make sure to mark it // as important - if(view.Format.compType != eCompType_None && view.Format != tex->format) + if(view.Format.compType != CompType::Typeless && view.Format != tex->format) return true; return false; @@ -581,7 +581,7 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT } void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, - const D3D12PipelineState::ShaderStage *stage, + const D3D12PipelineState::Shader *stage, RDTreeWidget *resources) { const QIcon &action = Icons::action(); @@ -675,7 +675,7 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, name = tex->name; typeName = ToQStr(tex->resType); - if(tex->resType == eResType_Texture2DMS || tex->resType == eResType_Texture2DMSArray) + if(tex->resType == TextureDim::Texture2DMS || tex->resType == TextureDim::Texture2DMSArray) { typeName += QString(" %1x").arg(tex->msSamp); } @@ -699,7 +699,7 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, name = buf->name; typeName = "Buffer"; - if(r.BufferFlags & RawBuffer) + if(r.BufferFlags & D3DBufferViewFlags::Raw) { typeName = QString("%1ByteAddressBuffer").arg(uav ? "RW" : ""); } @@ -720,7 +720,7 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, { if(!shaderInput->variableType.members.empty()) format = "struct " + ToQStr(shaderInput->variableType.descriptor.name); - else if(r.Format.compType == eCompType_None) + else if(r.Format.compType == CompType::Typeless) format = ToQStr(shaderInput->variableType.descriptor.name); else format = r.Format.strname; @@ -775,7 +775,7 @@ bool D3D12PipelineStateViewer::showNode(bool usedSlot, bool filledSlot) return false; } -const D3D12PipelineState::ShaderStage *D3D12PipelineStateViewer::stageForSender(QWidget *widget) +const D3D12PipelineState::Shader *D3D12PipelineStateViewer::stageForSender(QWidget *widget) { if(!m_Ctx.LogLoaded()) return NULL; @@ -876,20 +876,19 @@ void D3D12PipelineStateViewer::clearState() ui->stencils->clear(); } -void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::ShaderStage &stage, - QLabel *shader, RDTreeWidget *resources, - RDTreeWidget *samplers, RDTreeWidget *cbuffers, - RDTreeWidget *uavs) +void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::Shader &stage, QLabel *shader, + RDTreeWidget *resources, RDTreeWidget *samplers, + RDTreeWidget *cbuffers, RDTreeWidget *uavs) { ShaderReflection *shaderDetails = stage.ShaderDetails; const D3D12PipelineState &state = m_Ctx.CurD3D12PipelineState; - if(stage.Shader == ResourceId()) + if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); else if(state.customName) shader->setText(ToQStr(state.PipelineName) + " - " + m_Ctx.CurPipelineState.Abbrev(stage.stage)); else - shader->setText(ToQStr(state.PipelineName) + " - " + ToQStr(stage.stage, eGraphicsAPI_D3D12) + + shader->setText(ToQStr(state.PipelineName) + " - " + ToQStr(stage.stage, GraphicsAPI::D3D12) + " Shader"); if(shaderDetails && !shaderDetails->DebugInfo.entryFunc.empty() && @@ -1252,12 +1251,11 @@ void D3D12PipelineStateViewer::setState() ui->iaLayouts->setUpdatesEnabled(true); ui->iaLayouts->verticalScrollBar()->setValue(vs); - PrimitiveTopology topo = draw ? draw->topology : eTopology_Unknown; + Topology topo = draw ? draw->topology : Topology::Unknown; - if(topo > eTopology_PatchList) + int numCPs = PatchList_Count(topo); + if(numCPs > 0) { - int numCPs = (int)topo - (int)eTopology_PatchList_1CPs + 1; - ui->topology->setText(QString("PatchList (%1 Control Points)").arg(numCPs)); } else @@ -1267,27 +1265,27 @@ void D3D12PipelineStateViewer::setState() switch(topo) { - case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; - case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; - case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; - case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; - case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; - case eTopology_LineList_Adj: + case Topology::PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; + case Topology::LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; + case Topology::LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; + case Topology::TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; + case Topology::TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; + case Topology::LineList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj()); break; - case eTopology_LineStrip_Adj: + case Topology::LineStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj()); break; - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj()); break; - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj()); break; default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break; } - bool ibufferUsed = draw && (draw->flags & eDraw_UseIBuffer); + bool ibufferUsed = draw && (draw->flags & DrawFlags::UseIBuffer); vs = ui->iaBuffers->verticalScrollBar()->value(); ui->iaBuffers->setUpdatesEnabled(false); @@ -1507,8 +1505,8 @@ void D3D12PipelineStateViewer::setState() ui->scissors->verticalScrollBar()->setValue(vs); ui->scissors->setUpdatesEnabled(true); - ui->fillMode->setText(ToQStr(state.m_RS.m_State.FillMode)); - ui->cullMode->setText(ToQStr(state.m_RS.m_State.CullMode)); + ui->fillMode->setText(ToQStr(state.m_RS.m_State.fillMode)); + ui->cullMode->setText(ToQStr(state.m_RS.m_State.cullMode)); ui->frontCCW->setPixmap(state.m_RS.m_State.FrontCCW ? tick : cross); ui->lineAA->setPixmap(state.m_RS.m_State.AntialiasedLineEnable ? tick : cross); @@ -1633,15 +1631,15 @@ void D3D12PipelineStateViewer::setState() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); } - else if(draw->flags & eDraw_Dispatch) + else if(draw->flags & DrawFlags::Dispatch) { ui->pipeFlow->setStagesEnabled({false, false, false, false, false, false, false, false, true}); } else { ui->pipeFlow->setStagesEnabled( - {true, true, state.m_HS.Shader != ResourceId(), state.m_DS.Shader != ResourceId(), - state.m_GS.Shader != ResourceId(), true, state.m_PS.Shader != ResourceId(), true, false}); + {true, true, state.m_HS.Object != ResourceId(), state.m_DS.Object != ResourceId(), + state.m_GS.Object != ResourceId(), true, state.m_PS.Object != ResourceId(), true, false}); } } @@ -1682,7 +1680,7 @@ QString D3D12PipelineStateViewer::formatMembers(int indent, const QString &namep void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) { - const D3D12PipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const D3D12PipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -1707,7 +1705,7 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int if(tex) { - if(tex->resType == eResType_Buffer) + if(tex->resType == TextureDim::Buffer) { BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); @@ -1824,14 +1822,14 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int const ResourceFormat &fmt = view.res.Format; if(fmt.special) { - if(fmt.specialFormat == eSpecial_R10G10B10A2) + if(fmt.specialFormat == SpecialFormat::R10G10B10A2) { - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "uintten"; - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormten"; } - else if(fmt.specialFormat == eSpecial_R11G11B10) + else if(fmt.specialFormat == SpecialFormat::R11G11B10) { format = "floateleven"; } @@ -1842,47 +1840,47 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int { case 1: { - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormb"; - if(fmt.compType == eCompType_SNorm) + if(fmt.compType == CompType::SNorm) format = "snormb"; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "ubyte"; - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) format = "byte"; break; } case 2: { - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormh"; - if(fmt.compType == eCompType_SNorm) + if(fmt.compType == CompType::SNorm) format = "snormh"; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "ushort"; - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) format = "short"; - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) format = "half"; break; } case 4: { - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) format = "unormf"; - if(fmt.compType == eCompType_SNorm) + if(fmt.compType == CompType::SNorm) format = "snormf"; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) format = "uint"; - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) format = "int"; - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) format = "float"; break; } } - if(view.res.BufferFlags & RawBuffer) + if(view.res.BufferFlags & D3DBufferViewFlags::Raw) format = "xint"; format += fmt.compCount; @@ -1908,7 +1906,7 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int void D3D12PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int column) { - const D3D12PipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const D3D12PipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -2150,9 +2148,9 @@ void D3D12PipelineStateViewer::on_pipeFlow_stageSelected(int index) void D3D12PipelineStateViewer::shaderView_clicked() { QWidget *sender = qobject_cast(QObject::sender()); - const D3D12PipelineState::ShaderStage *stage = stageForSender(sender); + const D3D12PipelineState::Shader *stage = stageForSender(sender); - if(stage == NULL || stage->Shader == ResourceId()) + if(stage == NULL || stage->Object == ResourceId()) return; ShaderViewer *shad = ShaderViewer::viewShader( @@ -2169,9 +2167,9 @@ void D3D12PipelineStateViewer::shaderView_clicked() void D3D12PipelineStateViewer::shaderEdit_clicked() { QWidget *sender = qobject_cast(QObject::sender()); - const D3D12PipelineState::ShaderStage *stage = stageForSender(sender); + const D3D12PipelineState::Shader *stage = stageForSender(sender); - if(!stage || stage->Shader == ResourceId()) + if(!stage || stage->Object == ResourceId()) return; const ShaderReflection *shaderDetails = stage->ShaderDetails; @@ -2179,7 +2177,7 @@ void D3D12PipelineStateViewer::shaderEdit_clicked() if(!shaderDetails) return; - QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, eGraphicsAPI_D3D12)[0]); + QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, GraphicsAPI::D3D12)[0]); QString mainfile = ""; @@ -2199,12 +2197,12 @@ void D3D12PipelineStateViewer::shaderEdit_clicked() if(files.empty()) return; - m_Common.EditShader(stage->stage, stage->Shader, shaderDetails, entryFunc, files, mainfile); + m_Common.EditShader(stage->stage, stage->Object, shaderDetails, entryFunc, files, mainfile); } void D3D12PipelineStateViewer::shaderSave_clicked() { - const D3D12PipelineState::ShaderStage *stage = + const D3D12PipelineState::Shader *stage = stageForSender(qobject_cast(QObject::sender())); if(stage == NULL) @@ -2212,7 +2210,7 @@ void D3D12PipelineStateViewer::shaderSave_clicked() ShaderReflection *shaderDetails = stage->ShaderDetails; - if(stage->Shader == ResourceId()) + if(stage->Object == ResourceId()) return; m_Common.SaveShaderFile(shaderDetails); diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h index e174d36a6..ffcf17ad3 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h @@ -76,17 +76,10 @@ private: CaptureContext &m_Ctx; PipelineStateViewer &m_Common; - enum D3DBufferViewFlags - { - RawBuffer = 0x1, - AppendBuffer = 0x2, - CounterBuffer = 0x4, - }; - - void setShaderState(const D3D12PipelineState::ShaderStage &stage, QLabel *shader, RDTreeWidget *tex, + void setShaderState(const D3D12PipelineState::Shader &stage, QLabel *shader, RDTreeWidget *tex, RDTreeWidget *samp, RDTreeWidget *cbuffer, RDTreeWidget *uavs); - void addResourceRow(const ViewTag &view, const D3D12PipelineState::ShaderStage *stage, + void addResourceRow(const ViewTag &view, const D3D12PipelineState::Shader *stage, RDTreeWidget *resources); void clearShaderState(QLabel *shader, RDTreeWidget *tex, RDTreeWidget *samp, @@ -100,7 +93,7 @@ private: QString formatMembers(int indent, const QString &nameprefix, const rdctype::array &vars); - const D3D12PipelineState::ShaderStage *stageForSender(QWidget *widget); + const D3D12PipelineState::Shader *stageForSender(QWidget *widget); bool HasImportantViewParams(const D3D12PipelineState::ResourceView &view, FetchTexture *tex); bool HasImportantViewParams(const D3D12PipelineState::ResourceView &view, FetchBuffer *buf); diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index 8215d6e4a..4dce8ce10 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -412,7 +412,7 @@ bool GLPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) return false; } -const GLPipelineState::ShaderStage *GLPipelineStateViewer::stageForSender(QWidget *widget) +const GLPipelineState::Shader *GLPipelineStateViewer::stageForSender(QWidget *widget) { if(!m_Ctx.LogLoaded()) return NULL; @@ -532,10 +532,10 @@ void GLPipelineStateViewer::clearState() ui->stencils->clear(); } -void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &stage, - QLabel *shader, RDTreeWidget *textures, - RDTreeWidget *samplers, RDTreeWidget *ubos, - RDTreeWidget *subs, RDTreeWidget *readwrites) +void GLPipelineStateViewer::setShaderState(const GLPipelineState::Shader &stage, QLabel *shader, + RDTreeWidget *textures, RDTreeWidget *samplers, + RDTreeWidget *ubos, RDTreeWidget *subs, + RDTreeWidget *readwrites) { ShaderReflection *shaderDetails = stage.ShaderDetails; const ShaderBindpointMapping &mapping = stage.BindpointMapping; @@ -544,17 +544,17 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s const QIcon &action = Icons::action(); const QIcon &action_hover = Icons::action_hover(); - if(stage.Shader == ResourceId()) + if(stage.Object == ResourceId()) { shader->setText(tr("Unbound Shader")); } else { - QString shaderName = ToQStr(stage.stage, eGraphicsAPI_OpenGL) + " Shader"; + QString shaderName = ToQStr(stage.stage, GraphicsAPI::OpenGL) + " Shader"; if(!stage.customShaderName && !stage.customProgramName && !stage.customPipelineName) { - shader->setText(shaderName + " " + ToQStr(stage.Shader)); + shader->setText(shaderName + " " + ToQStr(stage.Object)); } else { @@ -640,17 +640,17 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s name = tex->name; typeName = ToQStr(tex->resType); - if(tex->format.special && (tex->format.specialFormat == eSpecial_D16S8 || - tex->format.specialFormat == eSpecial_D24S8 || - tex->format.specialFormat == eSpecial_D32S8)) + if(tex->format.special && (tex->format.specialFormat == SpecialFormat::D16S8 || + tex->format.specialFormat == SpecialFormat::D24S8 || + tex->format.specialFormat == SpecialFormat::D32S8)) { if(r.DepthReadChannel == 0) format += " Depth-Read"; else if(r.DepthReadChannel == 1) format += " Stencil-Read"; } - else if(r.Swizzle[0] != eSwizzle_Red || r.Swizzle[1] != eSwizzle_Green || - r.Swizzle[2] != eSwizzle_Blue || r.Swizzle[3] != eSwizzle_Alpha) + else if(r.Swizzle[0] != TextureSwizzle::Red || r.Swizzle[1] != TextureSwizzle::Green || + r.Swizzle[2] != TextureSwizzle::Blue || r.Swizzle[3] != TextureSwizzle::Alpha) { format += QString(" swizzle[%1%2%3%4]") .arg(ToQStr(r.Swizzle[0])) @@ -715,7 +715,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s if(s.UseBorder) addressing += QString("<%1>").arg(borderColor); - if(r.ResType == eResType_TextureCube || r.ResType == eResType_TextureCubeArray) + if(r.ResType == TextureDim::TextureCube || r.ResType == TextureDim::TextureCubeArray) { addressing += s.SeamlessCube ? " Seamless" : " Non-Seamless"; } @@ -981,8 +981,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s } QString GLPipelineStateViewer::MakeGenericValueString( - uint32_t compCount, FormatComponentType compType, - const GLPipelineState::VertexInput::VertexAttribute &val) + uint32_t compCount, CompType compType, const GLPipelineState::VertexInput::VertexAttribute &val) { QString ret = ""; if(compCount == 1) @@ -994,14 +993,14 @@ QString GLPipelineStateViewer::MakeGenericValueString( else if(compCount == 4) ret = "<%1, %2, %3, %4>"; - if(compType == eCompType_UInt) + if(compType == CompType::UInt) { for(uint32_t i = 0; i < compCount; i++) ret = ret.arg(val.GenericValue.u[i]); return ret; } - else if(compType == eCompType_SInt) + else if(compType == CompType::SInt) { for(uint32_t i = 0; i < compCount; i++) ret = ret.arg(val.GenericValue.i[i]); @@ -1028,7 +1027,7 @@ GLPipelineStateViewer::GLReadWriteType GLPipelineStateViewer::GetGLReadWriteType else { if(res.variableType.descriptor.rows == 1 && res.variableType.descriptor.cols == 1 && - res.variableType.descriptor.type == eVar_UInt) + res.variableType.descriptor.type == VarType::UInt) { ret = GLReadWriteType::Atomic; } @@ -1081,9 +1080,9 @@ void GLPipelineStateViewer::setState() QString name = tr("Attribute %1").arg(i); uint32_t compCount = 4; - FormatComponentType compType = eCompType_Float; + CompType compType = CompType::Float; - if(state.m_VS.Shader != ResourceId()) + if(state.m_VS.Object != ResourceId()) { int attrib = -1; if(i < state.m_VS.BindpointMapping.InputAttributes.count) @@ -1124,12 +1123,11 @@ void GLPipelineStateViewer::setState() ui->viAttrs->setUpdatesEnabled(true); ui->viAttrs->verticalScrollBar()->setValue(vs); - PrimitiveTopology topo = draw ? draw->topology : eTopology_Unknown; + Topology topo = draw ? draw->topology : Topology::Unknown; - if(topo > eTopology_PatchList) + int numCPs = PatchList_Count(topo); + if(numCPs > 0) { - int numCPs = (int)topo - (int)eTopology_PatchList_1CPs + 1; - ui->topology->setText(QString("PatchList (%1 Control Points)").arg(numCPs)); } else @@ -1137,7 +1135,7 @@ void GLPipelineStateViewer::setState() ui->topology->setText(ToQStr(topo)); } - bool ibufferUsed = draw && (draw->flags & eDraw_UseIBuffer); + bool ibufferUsed = draw && (draw->flags & DrawFlags::UseIBuffer); if(ibufferUsed) { @@ -1155,21 +1153,21 @@ void GLPipelineStateViewer::setState() switch(topo) { - case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; - case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; - case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; - case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; - case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; - case eTopology_LineList_Adj: + case Topology::PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; + case Topology::LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; + case Topology::LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; + case Topology::TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; + case Topology::TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; + case Topology::LineList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj()); break; - case eTopology_LineStrip_Adj: + case Topology::LineStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj()); break; - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj()); break; - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj()); break; default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break; @@ -1497,8 +1495,8 @@ void GLPipelineStateViewer::setState() ui->scissors->verticalScrollBar()->setValue(vs); ui->scissors->setUpdatesEnabled(true); - ui->fillMode->setText(ToQStr(state.m_Rasterizer.m_State.FillMode)); - ui->cullMode->setText(ToQStr(state.m_Rasterizer.m_State.CullMode)); + ui->fillMode->setText(ToQStr(state.m_Rasterizer.m_State.fillMode)); + ui->cullMode->setText(ToQStr(state.m_Rasterizer.m_State.cullMode)); ui->frontCCW->setPixmap(state.m_Rasterizer.m_State.FrontCCW ? tick : cross); ui->scissorEnabled->setPixmap(anyScissorEnable ? tick : cross); @@ -1652,8 +1650,8 @@ void GLPipelineStateViewer::setState() for(int s = 0; s < state.m_FS.ShaderDetails->OutputSig.count; s++) { if(state.m_FS.ShaderDetails->OutputSig[s].regIndex == (uint32_t)db && - (state.m_FS.ShaderDetails->OutputSig[s].systemValue == eAttr_None || - state.m_FS.ShaderDetails->OutputSig[s].systemValue == eAttr_ColourOutput)) + (state.m_FS.ShaderDetails->OutputSig[s].systemValue == ShaderBuiltin::Undefined || + state.m_FS.ShaderDetails->OutputSig[s].systemValue == ShaderBuiltin::ColourOutput)) { name = QString("<%1>").arg(ToQStr(state.m_FS.ShaderDetails->OutputSig[s].varName)); } @@ -1661,8 +1659,8 @@ void GLPipelineStateViewer::setState() } } - if(r && (r->Swizzle[0] != eSwizzle_Red || r->Swizzle[1] != eSwizzle_Green || - r->Swizzle[2] != eSwizzle_Blue || r->Swizzle[3] != eSwizzle_Alpha)) + if(r && (r->Swizzle[0] != TextureSwizzle::Red || r->Swizzle[1] != TextureSwizzle::Green || + r->Swizzle[2] != TextureSwizzle::Blue || r->Swizzle[3] != TextureSwizzle::Alpha)) { format += tr(" swizzle[%1%2%3%4]") .arg(ToQStr(r->Swizzle[0])) @@ -1892,15 +1890,15 @@ void GLPipelineStateViewer::setState() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); } - else if(draw->flags & eDraw_Dispatch) + else if(draw->flags & DrawFlags::Dispatch) { ui->pipeFlow->setStagesEnabled({false, false, false, false, false, false, false, false, true}); } else { ui->pipeFlow->setStagesEnabled( - {true, true, state.m_TCS.Shader != ResourceId(), state.m_TES.Shader != ResourceId(), - state.m_GS.Shader != ResourceId(), true, state.m_FS.Shader != ResourceId(), true, false}); + {true, true, state.m_TCS.Object != ResourceId(), state.m_TES.Object != ResourceId(), + state.m_GS.Object != ResourceId(), true, state.m_FS.Object != ResourceId(), true, false}); } } @@ -1941,7 +1939,7 @@ QString GLPipelineStateViewer::formatMembers(int indent, const QString &namepref void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) { - const GLPipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const GLPipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -1954,7 +1952,7 @@ void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int co if(tex) { - if(tex->resType == eResType_Buffer) + if(tex->resType == TextureDim::Buffer) { BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); @@ -2039,7 +2037,7 @@ void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int co void GLPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int column) { - const GLPipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const GLPipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -2246,10 +2244,9 @@ void GLPipelineStateViewer::on_pipeFlow_stageSelected(int index) void GLPipelineStateViewer::shaderView_clicked() { - const GLPipelineState::ShaderStage *stage = - stageForSender(qobject_cast(QObject::sender())); + const GLPipelineState::Shader *stage = stageForSender(qobject_cast(QObject::sender())); - if(stage == NULL || stage->Shader == ResourceId()) + if(stage == NULL || stage->Object == ResourceId()) return; ShaderReflection *shaderDetails = stage->ShaderDetails; @@ -2268,9 +2265,9 @@ void GLPipelineStateViewer::shaderView_clicked() void GLPipelineStateViewer::shaderEdit_clicked() { QWidget *sender = qobject_cast(QObject::sender()); - const GLPipelineState::ShaderStage *stage = stageForSender(sender); + const GLPipelineState::Shader *stage = stageForSender(sender); - if(!stage || stage->Shader == ResourceId()) + if(!stage || stage->Object == ResourceId()) return; const ShaderReflection *shaderDetails = stage->ShaderDetails; @@ -2278,7 +2275,7 @@ void GLPipelineStateViewer::shaderEdit_clicked() if(!shaderDetails) return; - QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, eGraphicsAPI_OpenGL)[0]); + QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, GraphicsAPI::OpenGL)[0]); QString mainfile = ""; @@ -2298,20 +2295,19 @@ void GLPipelineStateViewer::shaderEdit_clicked() if(files.empty()) return; - m_Common.EditShader(stage->stage, stage->Shader, shaderDetails, entryFunc, files, mainfile); + m_Common.EditShader(stage->stage, stage->Object, shaderDetails, entryFunc, files, mainfile); } void GLPipelineStateViewer::shaderSave_clicked() { - const GLPipelineState::ShaderStage *stage = - stageForSender(qobject_cast(QObject::sender())); + const GLPipelineState::Shader *stage = stageForSender(qobject_cast(QObject::sender())); if(stage == NULL) return; ShaderReflection *shaderDetails = stage->ShaderDetails; - if(stage->Shader == ResourceId()) + if(stage->Object == ResourceId()) return; m_Common.SaveShaderFile(shaderDetails); diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h index 6496b58e3..b01878f90 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h @@ -82,11 +82,11 @@ private: Image, }; - QString MakeGenericValueString(uint32_t compCount, FormatComponentType compType, + QString MakeGenericValueString(uint32_t compCount, CompType compType, const GLPipelineState::VertexInput::VertexAttribute &val); GLReadWriteType GetGLReadWriteType(ShaderResource res); - void setShaderState(const GLPipelineState::ShaderStage &stage, QLabel *shader, RDTreeWidget *tex, + void setShaderState(const GLPipelineState::Shader &stage, QLabel *shader, RDTreeWidget *tex, RDTreeWidget *samp, RDTreeWidget *ubo, RDTreeWidget *sub, RDTreeWidget *rw); void clearShaderState(QLabel *shader, RDTreeWidget *tex, RDTreeWidget *samp, RDTreeWidget *ubo, RDTreeWidget *sub, RDTreeWidget *rw); @@ -99,7 +99,7 @@ private: QString formatMembers(int indent, const QString &nameprefix, const rdctype::array &vars); - const GLPipelineState::ShaderStage *stageForSender(QWidget *widget); + const GLPipelineState::Shader *stageForSender(QWidget *widget); bool showNode(bool usedSlot, bool filledSlot); diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp index 72bf97f81..5dda58f49 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp @@ -61,13 +61,13 @@ PipelineStateViewer::~PipelineStateViewer() void PipelineStateViewer::OnLogfileLoaded() { - if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_D3D11) + if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D11) setToD3D11(); - else if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_D3D12) + else if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D12) setToD3D12(); - else if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) + else if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) setToGL(); - else if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_Vulkan) + else if(m_Ctx.APIProps().pipelineType == GraphicsAPI::Vulkan) setToVulkan(); if(m_Current) @@ -146,7 +146,7 @@ void PipelineStateViewer::setToD3D11() m_D3D11 = new D3D11PipelineStateViewer(m_Ctx, *this, this); ui->layout->addWidget(m_D3D11); m_Current = m_D3D11; - m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_D3D11; + m_Ctx.CurPipelineState.DefaultType = GraphicsAPI::D3D11; } void PipelineStateViewer::setToD3D12() @@ -159,7 +159,7 @@ void PipelineStateViewer::setToD3D12() m_D3D12 = new D3D12PipelineStateViewer(m_Ctx, *this, this); ui->layout->addWidget(m_D3D12); m_Current = m_D3D12; - m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_D3D12; + m_Ctx.CurPipelineState.DefaultType = GraphicsAPI::D3D12; } void PipelineStateViewer::setToGL() @@ -172,7 +172,7 @@ void PipelineStateViewer::setToGL() m_GL = new GLPipelineStateViewer(m_Ctx, *this, this); ui->layout->addWidget(m_GL); m_Current = m_GL; - m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_OpenGL; + m_Ctx.CurPipelineState.DefaultType = GraphicsAPI::OpenGL; } void PipelineStateViewer::setToVulkan() @@ -185,7 +185,7 @@ void PipelineStateViewer::setToVulkan() m_Vulkan = new VulkanPipelineStateViewer(m_Ctx, *this, this); ui->layout->addWidget(m_Vulkan); m_Current = m_Vulkan; - m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_Vulkan; + m_Ctx.CurPipelineState.DefaultType = GraphicsAPI::Vulkan; } bool PipelineStateViewer::PrepareShaderEditing(const ShaderReflection *shaderDetails, @@ -223,7 +223,7 @@ bool PipelineStateViewer::PrepareShaderEditing(const ShaderReflection *shaderDet return false; } -void PipelineStateViewer::EditShader(ShaderStageType shaderType, ResourceId id, +void PipelineStateViewer::EditShader(ShaderStage shaderType, ResourceId id, const ShaderReflection *shaderDetails, const QString &entryFunc, const QStringMap &files, const QString &mainfile) { diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h index c9637837c..1aea264e4 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h @@ -58,7 +58,7 @@ public: bool SaveShaderFile(const ShaderReflection *shader); bool PrepareShaderEditing(const ShaderReflection *shaderDetails, QString &entryFunc, QStringMap &files, QString &mainfile); - void EditShader(ShaderStageType shaderType, ResourceId id, const ShaderReflection *shaderDetails, + void EditShader(ShaderStage shaderType, ResourceId id, const ShaderReflection *shaderDetails, const QString &entryFunc, const QStringMap &files, const QString &mainfile); private: diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index cd5677226..f3d5d9dde 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -479,7 +479,7 @@ bool VulkanPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) return false; } -const VulkanPipelineState::ShaderStage *VulkanPipelineStateViewer::stageForSender(QWidget *widget) +const VulkanPipelineState::Shader *VulkanPipelineStateViewer::stageForSender(QWidget *widget) { if(!m_Ctx.LogLoaded()) return NULL; @@ -664,9 +664,8 @@ QVariantList VulkanPipelineStateViewer::makeSampler( } void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, - const VulkanPipelineState::ShaderStage &stage, - int bindset, int bind, - const VulkanPipelineState::Pipeline &pipe, + const VulkanPipelineState::Shader &stage, int bindset, + int bind, const VulkanPipelineState::Pipeline &pipe, RDTreeWidget *resources, QMap &samplers) { @@ -711,8 +710,8 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, const rdctype::array *slotBinds = NULL; - ShaderBindType bindType = eBindType_Unknown; - ShaderStageBits stageBits = (ShaderStageBits)0; + BindType bindType = BindType::Unknown; + ShaderStageMask stageBits = ShaderStageMask::Unknown; if(bindset < pipe.DescSets.count && bind < pipe.DescSets[bindset].bindings.count) { @@ -723,23 +722,23 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, else { if(shaderRes->IsSampler) - bindType = eBindType_Sampler; + bindType = BindType::Sampler; else if(shaderRes->IsSampler && shaderRes->IsTexture) - bindType = eBindType_ImageSampler; - else if(shaderRes->resType == eResType_Buffer) - bindType = eBindType_ReadOnlyTBuffer; + bindType = BindType::ImageSampler; + else if(shaderRes->resType == TextureDim::Buffer) + bindType = BindType::ReadOnlyTBuffer; else - bindType = eBindType_ReadOnlyImage; + bindType = BindType::ReadOnlyImage; } bool usedSlot = bindMap != NULL && bindMap->used; - bool stageBitsIncluded = stageBits & ((ShaderStageBits)(1 << (int)stage.stage)); + bool stageBitsIncluded = bool(stageBits & MaskForStage(stage.stage)); // skip descriptors that aren't for this shader stage if(!usedSlot && !stageBitsIncluded) return; - if(bindType == eBindType_ConstantBuffer) + if(bindType == BindType::ConstantBuffer) return; // TODO - check compatibility between bindType and shaderRes.resType ? @@ -749,7 +748,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, for(int idx = 0; slotBinds != NULL && idx < slotBinds->count; idx++) { filledSlot |= (*slotBinds)[idx].res != ResourceId(); - if(bindType == eBindType_Sampler || bindType == eBindType_ImageSampler) + if(bindType == BindType::Sampler || bindType == BindType::ImageSampler) filledSlot |= (*slotBinds)[idx].sampler != ResourceId(); } @@ -814,7 +813,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, uint64_t len = 0; QString format = "Unknown"; QString name = "Empty"; - ShaderResourceType restype = eResType_None; + TextureDim restype = TextureDim::Unknown; QVariant tag; FetchTexture *tex = NULL; @@ -851,7 +850,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, d = 0; a = 0; name = buf->name; - restype = eResType_Buffer; + restype = TextureDim::Buffer; ulong descriptorLen = descriptorBind->size; @@ -874,8 +873,8 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, QTreeWidgetItem *node = NULL; QTreeWidgetItem *samplerNode = NULL; - if(bindType == eBindType_ReadWriteBuffer || bindType == eBindType_ReadOnlyTBuffer || - bindType == eBindType_ReadWriteTBuffer) + if(bindType == BindType::ReadWriteBuffer || bindType == BindType::ReadOnlyTBuffer || + bindType == BindType::ReadWriteTBuffer) { if(!isbuf) { @@ -906,7 +905,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, setInactiveRow(node); } } - else if(bindType == eBindType_Sampler) + else if(bindType == BindType::Sampler) { if(descriptorBind == NULL || descriptorBind->sampler == ResourceId()) { @@ -950,17 +949,17 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, QString dim; - if(restype == eResType_Texture3D) + if(restype == TextureDim::Texture3D) dim = QString("%1x%2x%3").arg(w).arg(h).arg(d); - else if(restype == eResType_Texture1D || restype == eResType_Texture1DArray) + else if(restype == TextureDim::Texture1D || restype == TextureDim::Texture1DArray) dim = QString::number(w); else dim = QString("%1x%2").arg(w).arg(h); - if(descriptorBind->swizzle[0] != eSwizzle_Red || - descriptorBind->swizzle[1] != eSwizzle_Green || - descriptorBind->swizzle[2] != eSwizzle_Blue || - descriptorBind->swizzle[3] != eSwizzle_Alpha) + if(descriptorBind->swizzle[0] != TextureSwizzle::Red || + descriptorBind->swizzle[1] != TextureSwizzle::Green || + descriptorBind->swizzle[2] != TextureSwizzle::Blue || + descriptorBind->swizzle[3] != TextureSwizzle::Alpha) { format += tr(" swizzle[%1%2%3%4]") .arg(ToQStr(descriptorBind->swizzle[0])) @@ -969,13 +968,13 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, .arg(ToQStr(descriptorBind->swizzle[3])); } - if(restype == eResType_Texture1DArray || restype == eResType_Texture2DArray || - restype == eResType_Texture2DMSArray || restype == eResType_TextureCubeArray) + if(restype == TextureDim::Texture1DArray || restype == TextureDim::Texture2DArray || + restype == TextureDim::Texture2DMSArray || restype == TextureDim::TextureCubeArray) { dim += QString(" %1[%2]").arg(ToQStr(restype)).arg(a); } - if(restype == eResType_Texture2DMS || restype == eResType_Texture2DMSArray) + if(restype == TextureDim::Texture2DMS || restype == TextureDim::Texture2DMSArray) dim += QString(", %1x MSAA").arg(samples); node = makeTreeNode({ @@ -993,12 +992,12 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, setInactiveRow(node); } - if(bindType == eBindType_ImageSampler) + if(bindType == BindType::ImageSampler) { if(descriptorBind == NULL || descriptorBind->sampler == ResourceId()) { samplerNode = makeTreeNode({ - "", bindset, slotname, bindType, "-", "-", "", + "", bindset, slotname, ToQStr(bindType), "-", "-", "", }); setEmptyRow(node); @@ -1045,7 +1044,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, } void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDetails, - const VulkanPipelineState::ShaderStage &stage, + const VulkanPipelineState::Shader &stage, int bindset, int bind, const VulkanPipelineState::Pipeline &pipe, RDTreeWidget *ubos) @@ -1077,8 +1076,8 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta const rdctype::array *slotBinds = NULL; - ShaderBindType bindType = eBindType_ConstantBuffer; - ShaderStageBits stageBits = (ShaderStageBits)0; + BindType bindType = BindType::ConstantBuffer; + ShaderStageMask stageBits = ShaderStageMask::Unknown; if(bindset < pipe.DescSets.count && bind < pipe.DescSets[bindset].bindings.count) { @@ -1088,13 +1087,13 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta } bool usedSlot = bindMap != NULL && bindMap->used; - bool stageBitsIncluded = stageBits & ((ShaderStageBits)(1 << (int)stage.stage)); + bool stageBitsIncluded = bool(stageBits & MaskForStage(stage.stage)); // skip descriptors that aren't for this shader stage if(!usedSlot && !stageBitsIncluded) return; - if(bindType != eBindType_ConstantBuffer) + if(bindType != BindType::ConstantBuffer) return; // consider it filled if any array element is filled (or it's push constants) @@ -1224,7 +1223,7 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta } } -void VulkanPipelineStateViewer::setShaderState(const VulkanPipelineState::ShaderStage &stage, +void VulkanPipelineStateViewer::setShaderState(const VulkanPipelineState::Shader &stage, const VulkanPipelineState::Pipeline &pipe, QLabel *shader, RDTreeWidget *resources, RDTreeWidget *ubos) @@ -1234,7 +1233,7 @@ void VulkanPipelineStateViewer::setShaderState(const VulkanPipelineState::Shader const QIcon &action = Icons::action(); const QIcon &action_hover = Icons::action_hover(); - if(stage.Shader == ResourceId()) + if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); else shader->setText(ToQStr(stage.ShaderName)); @@ -1464,7 +1463,7 @@ void VulkanPipelineStateViewer::setState() QString name = tr("Attribute %1").arg(i); - if(state.m_VS.Shader != ResourceId()) + if(state.m_VS.Object != ResourceId()) { int attrib = -1; if((int32_t)a.location < state.m_VS.BindpointMapping.InputAttributes.count) @@ -1501,12 +1500,11 @@ void VulkanPipelineStateViewer::setState() m_BindNodes.clear(); - PrimitiveTopology topo = draw != NULL ? draw->topology : eTopology_Unknown; + Topology topo = draw != NULL ? draw->topology : Topology::Unknown; - if(topo > eTopology_PatchList) + int numCPs = PatchList_Count(topo); + if(numCPs > 0) { - int numCPs = (int)topo - (int)eTopology_PatchList_1CPs + 1; - ui->topology->setText(QString("PatchList (%1 Control Points)").arg(numCPs)); } else @@ -1518,21 +1516,21 @@ void VulkanPipelineStateViewer::setState() switch(topo) { - case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; - case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; - case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; - case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; - case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; - case eTopology_LineList_Adj: + case Topology::PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break; + case Topology::LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break; + case Topology::LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break; + case Topology::TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break; + case Topology::TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break; + case Topology::LineList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj()); break; - case eTopology_LineStrip_Adj: + case Topology::LineStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj()); break; - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj()); break; - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj()); break; default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break; @@ -1542,7 +1540,7 @@ void VulkanPipelineStateViewer::setState() ui->viBuffers->setUpdatesEnabled(false); ui->viBuffers->clear(); - bool ibufferUsed = draw != NULL && (draw->flags & eDraw_UseIBuffer); + bool ibufferUsed = draw != NULL && (draw->flags & DrawFlags::UseIBuffer); if(state.IA.ibuffer.buf != ResourceId()) { @@ -1756,8 +1754,8 @@ void VulkanPipelineStateViewer::setState() ui->viewports->setUpdatesEnabled(true); ui->scissors->setUpdatesEnabled(true); - ui->fillMode->setText(ToQStr(state.RS.FillMode)); - ui->cullMode->setText(ToQStr(state.RS.CullMode)); + ui->fillMode->setText(ToQStr(state.RS.fillMode)); + ui->cullMode->setText(ToQStr(state.RS.cullMode)); ui->frontCCW->setPixmap(state.RS.FrontCCW ? tick : cross); ui->depthBias->setText(Formatter::Format(state.RS.depthBias)); @@ -1830,8 +1828,8 @@ void VulkanPipelineStateViewer::setState() for(int s = 0; s < state.m_FS.ShaderDetails->OutputSig.count; s++) { if(state.m_FS.ShaderDetails->OutputSig[s].regIndex == (uint32_t)colIdx && - (state.m_FS.ShaderDetails->OutputSig[s].systemValue == eAttr_None || - state.m_FS.ShaderDetails->OutputSig[s].systemValue == eAttr_ColourOutput)) + (state.m_FS.ShaderDetails->OutputSig[s].systemValue == ShaderBuiltin::Undefined || + state.m_FS.ShaderDetails->OutputSig[s].systemValue == ShaderBuiltin::ColourOutput)) { name = QString("<%1>").arg(ToQStr(state.m_FS.ShaderDetails->OutputSig[s].varName)); } @@ -1839,8 +1837,8 @@ void VulkanPipelineStateViewer::setState() } } - if(p.swizzle[0] != eSwizzle_Red || p.swizzle[1] != eSwizzle_Green || - p.swizzle[2] != eSwizzle_Blue || p.swizzle[3] != eSwizzle_Alpha) + if(p.swizzle[0] != TextureSwizzle::Red || p.swizzle[1] != TextureSwizzle::Green || + p.swizzle[2] != TextureSwizzle::Blue || p.swizzle[3] != TextureSwizzle::Alpha) { format += tr(" swizzle[%1%2%3%4]") .arg(ToQStr(p.swizzle[0])) @@ -1978,15 +1976,15 @@ void VulkanPipelineStateViewer::setState() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); } - else if(draw->flags & eDraw_Dispatch) + else if(draw->flags & DrawFlags::Dispatch) { ui->pipeFlow->setStagesEnabled({false, false, false, false, false, false, false, false, true}); } else { ui->pipeFlow->setStagesEnabled( - {true, true, state.m_TCS.Shader != ResourceId(), state.m_TES.Shader != ResourceId(), - state.m_GS.Shader != ResourceId(), true, state.m_FS.Shader != ResourceId(), true, false}); + {true, true, state.m_TCS.Object != ResourceId(), state.m_TES.Object != ResourceId(), + state.m_GS.Object != ResourceId(), true, state.m_FS.Object != ResourceId(), true, false}); } } @@ -2027,7 +2025,7 @@ QString VulkanPipelineStateViewer::formatMembers(int indent, const QString &name void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) { - const VulkanPipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const VulkanPipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -2040,7 +2038,7 @@ void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, in if(tex) { - if(tex->resType == eResType_Buffer) + if(tex->resType == TextureDim::Buffer) { BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); @@ -2127,7 +2125,7 @@ void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, in void VulkanPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int column) { - const VulkanPipelineState::ShaderStage *stage = stageForSender(item->treeWidget()); + const VulkanPipelineState::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -2343,10 +2341,10 @@ void VulkanPipelineStateViewer::on_pipeFlow_stageSelected(int index) void VulkanPipelineStateViewer::shaderView_clicked() { - const VulkanPipelineState::ShaderStage *stage = + const VulkanPipelineState::Shader *stage = stageForSender(qobject_cast(QObject::sender())); - if(stage == NULL || stage->Shader == ResourceId()) + if(stage == NULL || stage->Object == ResourceId()) return; ShaderReflection *shaderDetails = stage->ShaderDetails; @@ -2365,9 +2363,9 @@ void VulkanPipelineStateViewer::shaderView_clicked() void VulkanPipelineStateViewer::shaderEdit_clicked() { QWidget *sender = qobject_cast(QObject::sender()); - const VulkanPipelineState::ShaderStage *stage = stageForSender(sender); + const VulkanPipelineState::Shader *stage = stageForSender(sender); - if(!stage || stage->Shader == ResourceId()) + if(!stage || stage->Object == ResourceId()) return; const ShaderReflection *shaderDetails = stage->ShaderDetails; @@ -2375,7 +2373,7 @@ void VulkanPipelineStateViewer::shaderEdit_clicked() if(!shaderDetails) return; - QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, eGraphicsAPI_Vulkan)[0]); + QString entryFunc = QString("EditedShader%1S").arg(ToQStr(stage->stage, GraphicsAPI::Vulkan)[0]); QString mainfile = ""; @@ -2401,7 +2399,7 @@ void VulkanPipelineStateViewer::shaderEdit_clicked() if(files.empty()) return; - m_Common.EditShader(stage->stage, stage->Shader, shaderDetails, entryFunc, files, mainfile); + m_Common.EditShader(stage->stage, stage->Object, shaderDetails, entryFunc, files, mainfile); } QString VulkanPipelineStateViewer::disassembleSPIRV(const ShaderReflection *shaderDetails) @@ -2490,7 +2488,7 @@ QString VulkanPipelineStateViewer::disassembleSPIRV(const ShaderReflection *shad void VulkanPipelineStateViewer::shaderSave_clicked() { - const VulkanPipelineState::ShaderStage *stage = + const VulkanPipelineState::Shader *stage = stageForSender(qobject_cast(QObject::sender())); if(stage == NULL) @@ -2498,7 +2496,7 @@ void VulkanPipelineStateViewer::shaderSave_clicked() ShaderReflection *shaderDetails = stage->ShaderDetails; - if(stage->Shader == ResourceId()) + if(stage->Object == ResourceId()) return; m_Common.SaveShaderFile(shaderDetails); diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h index 2e1fd33ef..219c8595b 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h @@ -86,14 +86,14 @@ private: QVariantList makeSampler( const QString &bindset, const QString &slotname, const VulkanPipelineState::Pipeline::DescriptorSet::DescriptorBinding::BindingElement &descriptor); - void addResourceRow(ShaderReflection *shaderDetails, const VulkanPipelineState::ShaderStage &stage, + void addResourceRow(ShaderReflection *shaderDetails, const VulkanPipelineState::Shader &stage, int bindset, int bind, const VulkanPipelineState::Pipeline &pipe, RDTreeWidget *resources, QMap &samplers); void addConstantBlockRow(ShaderReflection *shaderDetails, - const VulkanPipelineState::ShaderStage &stage, int bindset, int bind, + const VulkanPipelineState::Shader &stage, int bindset, int bind, const VulkanPipelineState::Pipeline &pipe, RDTreeWidget *ubos); - void setShaderState(const VulkanPipelineState::ShaderStage &stage, + void setShaderState(const VulkanPipelineState::Shader &stage, const VulkanPipelineState::Pipeline &pipe, QLabel *shader, RDTreeWidget *res, RDTreeWidget *ubo); void clearShaderState(QLabel *shader, RDTreeWidget *res, RDTreeWidget *ubo); @@ -106,7 +106,7 @@ private: QString formatMembers(int indent, const QString &nameprefix, const rdctype::array &vars); - const VulkanPipelineState::ShaderStage *stageForSender(QWidget *widget); + const VulkanPipelineState::Shader *stageForSender(QWidget *widget); QString disassembleSPIRV(const ShaderReflection *shaderDetails); diff --git a/qrenderdoc/Windows/PixelHistoryView.cpp b/qrenderdoc/Windows/PixelHistoryView.cpp index 440fba715..b6c920e4f 100644 --- a/qrenderdoc/Windows/PixelHistoryView.cpp +++ b/qrenderdoc/Windows/PixelHistoryView.cpp @@ -50,26 +50,26 @@ public: m_Tex = m_Ctx.GetTexture(tex); m_Display = display; - FormatComponentType compType = m_Tex->format.compType; + CompType compType = m_Tex->format.compType; - if(compType == eCompType_None) + if(compType == CompType::Typeless) compType = display.typeHint; - m_IsUint = (compType == eCompType_UInt); - m_IsSint = (compType == eCompType_SInt); + m_IsUint = (compType == CompType::UInt); + m_IsSint = (compType == CompType::SInt); m_IsFloat = (!m_IsUint && !m_IsSint); - if(compType == eCompType_Depth) + if(compType == CompType::Depth) m_IsDepth = true; if(m_Tex->format.special) { switch(m_Tex->format.specialFormat) { - case eSpecial_D16S8: - case eSpecial_D24S8: - case eSpecial_D32S8: - case eSpecial_S8: m_IsDepth = true; break; + case SpecialFormat::D16S8: + case SpecialFormat::D24S8: + case SpecialFormat::D32S8: + case SpecialFormat::S8: m_IsDepth = true; break; default: break; } } @@ -140,7 +140,7 @@ public: const QList &mods = getMods(parent); const FetchDrawcall *draw = m_Ctx.GetDrawcall(mods.front().eventID); - if(draw->flags & eDraw_Clear) + if(draw->flags & DrawFlags::Clear) return 0; return mods.count(); @@ -657,13 +657,13 @@ void PixelHistoryView::startDebug(EventTag tag) QString debugContext = QString("Pixel %1,%2").arg(m_Pixel.x()).arg(m_Pixel.y()); const ShaderReflection *shaderDetails = - m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Pixel); + m_Ctx.CurPipelineState.GetShaderReflection(ShaderStage::Pixel); const ShaderBindpointMapping &bindMapping = - m_Ctx.CurPipelineState.GetBindpointMapping(eShaderStage_Pixel); + m_Ctx.CurPipelineState.GetBindpointMapping(ShaderStage::Pixel); // viewer takes ownership of the trace ShaderViewer *s = ShaderViewer::debugShader(m_Ctx, &bindMapping, shaderDetails, - eShaderStage_Pixel, trace, debugContext, this); + ShaderStage::Pixel, trace, debugContext, this); m_Ctx.setupDockWindow(s); diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp index 43b393d2f..dad19a80d 100644 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ b/qrenderdoc/Windows/ShaderViewer.cpp @@ -87,7 +87,7 @@ ShaderViewer::ShaderViewer(CaptureContext &ctx, QWidget *parent) { m_DisassemblyView = MakeEditor("scintillaDisassem", "", - m_Ctx.APIProps().pipelineType == eGraphicsAPI_Vulkan ? SCLEX_GLSL : SCLEX_HLSL); + m_Ctx.APIProps().pipelineType == GraphicsAPI::Vulkan ? SCLEX_GLSL : SCLEX_HLSL); m_DisassemblyView->setReadOnly(true); m_DisassemblyView->setWindowTitle(tr("Disassembly")); @@ -250,7 +250,7 @@ void ShaderViewer::editShader(bool customShader, const QString &entryPoint, cons } void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderReflection *shader, - ShaderStageType stage, ShaderDebugTrace *trace, + ShaderStage stage, ShaderDebugTrace *trace, const QString &debugContext) { m_Mapping = bind; @@ -504,7 +504,7 @@ ScintillaEdit *ShaderViewer::AddFileScintilla(const QString &name, const QString { ScintillaEdit *scintilla = MakeEditor("scintilla" + name, text, - m_Ctx.APIProps().localRenderer == eGraphicsAPI_OpenGL ? SCLEX_GLSL : SCLEX_HLSL); + m_Ctx.APIProps().localRenderer == GraphicsAPI::OpenGL ? SCLEX_GLSL : SCLEX_HLSL); scintilla->setReadOnly(true); scintilla->setWindowTitle(name); ((QWidget *)scintilla)->setProperty("name", name); @@ -664,12 +664,12 @@ int ShaderViewer::instructionForLine(sptr_t line) void ShaderViewer::runToSample() { - runTo(-1, true, eShaderDbg_SampleLoadGather); + runTo(-1, true, ShaderEvents::SampleLoadGather); } void ShaderViewer::runToNanOrInf() { - runTo(-1, true, eShaderDbg_GeneratedNanOrInf); + runTo(-1, true, ShaderEvents::GeneratedNanOrInf); } void ShaderViewer::runBack() @@ -682,7 +682,7 @@ void ShaderViewer::run() runTo(-1, true); } -void ShaderViewer::runTo(int runToInstruction, bool forward, ShaderDebugStateFlags condition) +void ShaderViewer::runTo(int runToInstruction, bool forward, ShaderEvents condition) { if(!m_Trace) return; @@ -717,13 +717,13 @@ void ShaderViewer::runTo(int runToInstruction, bool forward, ShaderDebugStateFla QString ShaderViewer::stringRep(const ShaderVariable &var, bool useType) { - if(ui->intView->isChecked() || (useType && var.type == eVar_Int)) - return RowString(var, 0, eVar_Int); + if(ui->intView->isChecked() || (useType && var.type == VarType::Int)) + return RowString(var, 0, VarType::Int); - if(useType && var.type == eVar_UInt) - return RowString(var, 0, eVar_UInt); + if(useType && var.type == VarType::UInt) + return RowString(var, 0, VarType::UInt); - return RowString(var, 0, eVar_Float); + return RowString(var, 0, VarType::Float); } QTreeWidgetItem *ShaderViewer::makeResourceRegister(const BindpointMap &bind, uint32_t idx, @@ -750,7 +750,7 @@ QTreeWidgetItem *ShaderViewer::makeResourceRegister(const BindpointMap &bind, ui const char *fmt = "%1%2"; - if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_D3D12) + if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D12) fmt = bind.arraySize == 1 ? "t%3:%2" : "t%3:%2[%4]"; QString regname = QString(fmt).arg(regChar).arg(bind.bind).arg(bind.bindset).arg(idx); @@ -1136,13 +1136,13 @@ void ShaderViewer::snippet_textureDimensions() "// xyz == width, height, depth. w == # mips\n" "uint4 RENDERDOC_TexDim; \n\n"); } - else if(api == eGraphicsAPI_OpenGL) + else if(api == GraphicsAPI::OpenGL) { m_Scintillas[0]->insertText(snippetPos(), "// xyz == width, height, depth. w == # mips\n" "uniform uvec4 RENDERDOC_TexDim;\n\n"); } - else if(api == eGraphicsAPI_Vulkan) + else if(api == GraphicsAPI::Vulkan) { insertVulkanUBO(); } @@ -1163,13 +1163,13 @@ void ShaderViewer::snippet_selectedMip() "// selected mip in UI\n" "uint RENDERDOC_SelectedMip;\n\n"); } - else if(api == eGraphicsAPI_OpenGL) + else if(api == GraphicsAPI::OpenGL) { m_Scintillas[0]->insertText(snippetPos(), "// selected mip in UI\n" "uniform uint RENDERDOC_SelectedMip;\n\n"); } - else if(api == eGraphicsAPI_Vulkan) + else if(api == GraphicsAPI::Vulkan) { insertVulkanUBO(); } @@ -1190,13 +1190,13 @@ void ShaderViewer::snippet_selectedSlice() "// selected array slice or cubemap face in UI\n" "uint RENDERDOC_SelectedSliceFace;\n\n"); } - else if(api == eGraphicsAPI_OpenGL) + else if(api == GraphicsAPI::OpenGL) { m_Scintillas[0]->insertText(snippetPos(), "// selected array slice or cubemap face in UI\n" "uniform uint RENDERDOC_SelectedSliceFace;\n\n"); } - else if(api == eGraphicsAPI_Vulkan) + else if(api == GraphicsAPI::Vulkan) { insertVulkanUBO(); } @@ -1217,13 +1217,13 @@ void ShaderViewer::snippet_selectedSample() "// selected MSAA sample or -numSamples for resolve. See docs\n" "int RENDERDOC_SelectedSample;\n\n"); } - else if(api == eGraphicsAPI_OpenGL) + else if(api == GraphicsAPI::OpenGL) { m_Scintillas[0]->insertText(snippetPos(), "// selected MSAA sample or -numSamples for resolve. See docs\n" "uniform int RENDERDOC_SelectedSample;\n\n"); } - else if(api == eGraphicsAPI_Vulkan) + else if(api == GraphicsAPI::Vulkan) { insertVulkanUBO(); } @@ -1245,7 +1245,7 @@ void ShaderViewer::snippet_selectedType() "// 6 = Depth (MS), 7 = Depth + Stencil (MS)\n" "uint RENDERDOC_TextureType;\n\n"); } - else if(api == eGraphicsAPI_OpenGL) + else if(api == GraphicsAPI::OpenGL) { m_Scintillas[0]->insertText(snippetPos(), "// 1 = 1D, 2 = 2D, 3 = 3D, 4 = Cube\n" @@ -1253,7 +1253,7 @@ void ShaderViewer::snippet_selectedType() "// 8 = Rect, 9 = Buffer, 10 = 2DMS\n" "uniform uint RENDERDOC_TextureType;\n\n"); } - else if(api == eGraphicsAPI_Vulkan) + else if(api == GraphicsAPI::Vulkan) { insertVulkanUBO(); } @@ -1312,7 +1312,7 @@ void ShaderViewer::snippet_resources() "Texture2DMSArray texDisplayIntTex2DMSArray : register(t29);\n" "// End Textures\n\n\n"); } - else if(api == eGraphicsAPI_OpenGL) + else if(api == GraphicsAPI::OpenGL) { m_Scintillas[0]->insertText(snippetPos(), "// Textures\n" @@ -1353,7 +1353,7 @@ void ShaderViewer::snippet_resources() "layout (binding = 10) uniform sampler2DMS tex2DMS;\n" "// End Textures\n\n\n"); } - else if(api == eGraphicsAPI_Vulkan) + else if(api == GraphicsAPI::Vulkan) { m_Scintillas[0]->insertText(snippetPos(), "// Textures\n" diff --git a/qrenderdoc/Windows/ShaderViewer.h b/qrenderdoc/Windows/ShaderViewer.h index 686ffb7a1..6e492388e 100644 --- a/qrenderdoc/Windows/ShaderViewer.h +++ b/qrenderdoc/Windows/ShaderViewer.h @@ -61,7 +61,7 @@ public: } static ShaderViewer *debugShader(CaptureContext &ctx, const ShaderBindpointMapping *bind, - const ShaderReflection *shader, ShaderStageType stage, + const ShaderReflection *shader, ShaderStage stage, ShaderDebugTrace *trace, const QString &debugContext, QWidget *parent) { @@ -71,8 +71,7 @@ public: } static ShaderViewer *viewShader(CaptureContext &ctx, const ShaderBindpointMapping *bind, - const ShaderReflection *shader, ShaderStageType stage, - QWidget *parent) + const ShaderReflection *shader, ShaderStage stage, QWidget *parent) { return ShaderViewer::debugShader(ctx, bind, shader, stage, NULL, "", parent); } @@ -128,13 +127,13 @@ private: explicit ShaderViewer(CaptureContext &ctx, QWidget *parent = 0); void editShader(bool customShader, const QString &entryPoint, const QStringMap &files); void debugShader(const ShaderBindpointMapping *bind, const ShaderReflection *shader, - ShaderStageType stage, ShaderDebugTrace *trace, const QString &debugContext); + ShaderStage stage, ShaderDebugTrace *trace, const QString &debugContext); Ui::ShaderViewer *ui; CaptureContext &m_Ctx; const ShaderBindpointMapping *m_Mapping = NULL; const ShaderReflection *m_ShaderDetails = NULL; - ShaderStageType m_Stage; + ShaderStage m_Stage; ScintillaEdit *m_DisassemblyView = NULL; ScintillaEdit *m_Errors = NULL; ScintillaEdit *m_FindResults = NULL; @@ -191,7 +190,7 @@ private: void find(bool down); - void runTo(int runToInstruction, bool forward, ShaderDebugStateFlags condition = eShaderDbg_None); + void runTo(int runToInstruction, bool forward, ShaderEvents condition = ShaderEvents::NoEvent); QString stringRep(const ShaderVariable &var, bool useType); QTreeWidgetItem *makeResourceRegister(const BindpointMap &bind, uint32_t idx, diff --git a/qrenderdoc/Windows/StatisticsViewer.cpp b/qrenderdoc/Windows/StatisticsViewer.cpp index 3253cb6e5..3a150403d 100644 --- a/qrenderdoc/Windows/StatisticsViewer.cpp +++ b/qrenderdoc/Windows/StatisticsViewer.cpp @@ -174,7 +174,7 @@ void AppendShaderStatistics(CaptureContext &ctx, QString &statisticsLog, const FetchFrameShaderStats *shaders = frameInfo.stats.shaders; FetchFrameShaderStats totalShadersPerStage; memset(&totalShadersPerStage, 0, sizeof(totalShadersPerStage)); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { totalShadersPerStage.calls += shaders[s].calls; totalShadersPerStage.sets += shaders[s].sets; @@ -184,11 +184,11 @@ void AppendShaderStatistics(CaptureContext &ctx, QString &statisticsLog, statisticsLog.append("\n*** Shader Set Statistics ***\n\n"); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { statisticsLog.append(QString("%1 calls: %2, non-null shader sets: %3, null shader sets: %4, " "redundant shader sets: %5\n") - .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev(StageFromIndex(s))) .arg(shaders[s].calls) .arg(shaders[s].sets) .arg(shaders[s].nulls) @@ -215,9 +215,9 @@ void AppendConstantBindStatistics(CaptureContext &ctx, QString &statisticsLog, // structure for a given type with known integral types (or arrays // thereof), but given we're heading for a Qt/C++ rewrite of the UI // perhaps best not to dwell too long on that - FetchFrameConstantBindStats totalConstantsPerStage[eShaderStage_Count]; + FetchFrameConstantBindStats totalConstantsPerStage[ENUM_ARRAY_SIZE(ShaderStage)]; memset(&totalConstantsPerStage, 0, sizeof(totalConstantsPerStage)); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { totalConstantsPerStage[s].bindslots.create(reference.bindslots.count); totalConstantsPerStage[s].sizes.create(reference.sizes.count); @@ -225,7 +225,7 @@ void AppendConstantBindStatistics(CaptureContext &ctx, QString &statisticsLog, { const FetchFrameConstantBindStats *constants = frameInfo.stats.constants; - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { totalConstantsPerStage[s].calls += constants[s].calls; totalConstantsPerStage[s].sets += constants[s].sets; @@ -244,7 +244,7 @@ void AppendConstantBindStatistics(CaptureContext &ctx, QString &statisticsLog, totalConstantsForAllStages.bindslots.create(totalConstantsPerStage[0].bindslots.count); totalConstantsForAllStages.sizes.create(totalConstantsPerStage[0].sizes.count); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { const FetchFrameConstantBindStats &perStage = totalConstantsPerStage[s]; totalConstantsForAllStages.calls += perStage.calls; @@ -260,10 +260,10 @@ void AppendConstantBindStatistics(CaptureContext &ctx, QString &statisticsLog, statisticsLog.append("\n*** Constant Bind Statistics ***\n\n"); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { statisticsLog.append(QString("%1 calls: %2, non-null buffer sets: %3, null buffer sets: %4\n") - .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev(StageFromIndex(s))) .arg(totalConstantsPerStage[s].calls) .arg(totalConstantsPerStage[s].sets) .arg(totalConstantsPerStage[s].nulls)); @@ -305,16 +305,16 @@ void AppendSamplerBindStatistics(CaptureContext &ctx, QString &statisticsLog, // #mivance see AppendConstantBindStatistics const FetchFrameSamplerBindStats &reference = frameInfo.stats.samplers[0]; - FetchFrameSamplerBindStats totalSamplersPerStage[eShaderStage_Count]; + FetchFrameSamplerBindStats totalSamplersPerStage[ENUM_ARRAY_SIZE(ShaderStage)]; memset(&totalSamplersPerStage, 0, sizeof(totalSamplersPerStage)); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { totalSamplersPerStage[s].bindslots.create(reference.bindslots.count); } { const FetchFrameSamplerBindStats *samplers = frameInfo.stats.samplers; - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { totalSamplersPerStage[s].calls += samplers[s].calls; totalSamplersPerStage[s].sets += samplers[s].sets; @@ -331,7 +331,7 @@ void AppendSamplerBindStatistics(CaptureContext &ctx, QString &statisticsLog, memset(&totalSamplersForAllStages, 0, sizeof(totalSamplersForAllStages)); totalSamplersForAllStages.bindslots.create(totalSamplersPerStage[0].bindslots.count); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { FetchFrameSamplerBindStats perStage = totalSamplersPerStage[s]; totalSamplersForAllStages.calls += perStage.calls; @@ -345,10 +345,10 @@ void AppendSamplerBindStatistics(CaptureContext &ctx, QString &statisticsLog, statisticsLog.append("\n*** Sampler Bind Statistics ***\n\n"); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { statisticsLog.append(QString("%1 calls: %2, non-null sampler sets: %3, null sampler sets: %4\n") - .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev(StageFromIndex(s))) .arg(totalSamplersPerStage[s].calls) .arg(totalSamplersPerStage[s].sets) .arg(totalSamplersPerStage[s].nulls)); @@ -370,9 +370,9 @@ void AppendResourceBindStatistics(CaptureContext &ctx, QString &statisticsLog, // #mivance see AppendConstantBindStatistics const FetchFrameResourceBindStats &reference = frameInfo.stats.resources[0]; - FetchFrameResourceBindStats totalResourcesPerStage[eShaderStage_Count]; + FetchFrameResourceBindStats totalResourcesPerStage[ENUM_ARRAY_SIZE(ShaderStage)]; memset(&totalResourcesPerStage, 0, sizeof(totalResourcesPerStage)); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { totalResourcesPerStage[s].types.create(reference.types.count); totalResourcesPerStage[s].bindslots.create(reference.bindslots.count); @@ -380,7 +380,7 @@ void AppendResourceBindStatistics(CaptureContext &ctx, QString &statisticsLog, { const FetchFrameResourceBindStats *resources = frameInfo.stats.resources; - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { totalResourcesPerStage[s].calls += resources[s].calls; totalResourcesPerStage[s].sets += resources[s].sets; @@ -403,7 +403,7 @@ void AppendResourceBindStatistics(CaptureContext &ctx, QString &statisticsLog, totalResourcesForAllStages.types.create(totalResourcesPerStage[0].types.count); totalResourcesForAllStages.bindslots.create(totalResourcesPerStage[0].bindslots.count); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { FetchFrameResourceBindStats perStage = totalResourcesPerStage[s]; totalResourcesForAllStages.calls += perStage.calls; @@ -421,10 +421,10 @@ void AppendResourceBindStatistics(CaptureContext &ctx, QString &statisticsLog, statisticsLog.append("\n*** Resource Bind Statistics ***\n\n"); - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { statisticsLog.append(QString("%1 calls: %2 non-null resource sets: %3 null resource sets: %4\n") - .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev(StageFromIndex(s))) .arg(totalResourcesPerStage[s].calls) .arg(totalResourcesPerStage[s].sets) .arg(totalResourcesPerStage[s].nulls)); @@ -452,7 +452,7 @@ void AppendResourceBindStatistics(CaptureContext &ctx, QString &statisticsLog, { uint32_t count = totalResourcesForAllStages.types[s]; int slice = SliceForString(Stars, count, maxCount); - ShaderResourceType type = (ShaderResourceType)s; + TextureDim type = (TextureDim)s; statisticsLog.append( QString("%1: %2 %3\n").arg(ToQStr(type), 20).arg(Stars.left(slice)).arg(CountOrEmpty(count))); } @@ -508,7 +508,7 @@ void AppendUpdateStatistics(QString &statisticsLog, const FetchFrameInfo &frameI { uint32_t count = totalUpdates.types[s]; int slice = SliceForString(Stars, count, maxCount); - ShaderResourceType type = (ShaderResourceType)s; + TextureDim type = (TextureDim)s; statisticsLog.append( QString("%1: %2 %3\n").arg(ToQStr(type), 20).arg(Stars.left(slice)).arg(CountOrEmpty(count))); } @@ -607,16 +607,17 @@ void AppendDetailedInformation(CaptureContext &ctx, QString &statisticsLog, void CountContributingEvents(const FetchDrawcall &draw, uint32_t &drawCount, uint32_t &dispatchCount, uint32_t &diagnosticCount) { - const uint32_t diagnosticMask = eDraw_SetMarker | eDraw_PushMarker | eDraw_PopMarker; - uint32_t diagnosticMasked = draw.flags & diagnosticMask; + const DrawFlags diagnosticMask = + DrawFlags::SetMarker | DrawFlags::PushMarker | DrawFlags::PopMarker; + DrawFlags diagnosticMasked = draw.flags & diagnosticMask; - if(diagnosticMasked != 0) + if(diagnosticMasked != DrawFlags::NoFlags) diagnosticCount += 1; - if((draw.flags & eDraw_Drawcall) != 0) + if(draw.flags & DrawFlags::Drawcall) drawCount += 1; - if((draw.flags & eDraw_Dispatch) != 0) + if(draw.flags & DrawFlags::Dispatch) dispatchCount += 1; for(const FetchDrawcall &c : draw.children) @@ -633,7 +634,7 @@ QString AppendAPICallSummary(const FetchFrameInfo &frameInfo, uint numAPICalls) uint numResourceSets = 0; uint numShaderSets = 0; - for(int s = eShaderStage_First; s < eShaderStage_Count; s++) + for(auto s : indices()) { numConstantSets += frameInfo.stats.constants[s].calls; numSamplerSets += frameInfo.stats.samplers[s].calls; @@ -692,9 +693,9 @@ QString GenerateReport(CaptureContext &ctx) { BufBytes += b.length; - if((b.creationFlags & eBufferCreate_IB) != 0) + if(b.creationFlags & BufferCategory::Index) IBBytes += b.length; - if((b.creationFlags & eBufferCreate_VB) != 0) + if(b.creationFlags & BufferCategory::Vertex) VBBytes += b.length; } @@ -708,7 +709,7 @@ QString GenerateReport(CaptureContext &ctx) int texCount = 0, largeTexCount = 0; for(const FetchTexture &t : ctx.GetTextures()) { - if(t.creationFlags & (eTextureCreate_RTV | eTextureCreate_DSV)) + if(t.creationFlags & (TextureCategory::ColorTarget | TextureCategory::DepthTarget)) { numRTs++; diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 0675eb533..6b2df84d2 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -62,7 +62,7 @@ Q_DECLARE_METATYPE(ResourceId); const Following Following::Default = Following(); -Following::Following(FollowType t, ShaderStageType s, int i, int a) +Following::Following(FollowType t, ShaderStage s, int i, int a) { Type = t; Stage = s; @@ -73,7 +73,7 @@ Following::Following(FollowType t, ShaderStageType s, int i, int a) Following::Following() { Type = FollowType::OutputColour; - Stage = eShaderStage_Pixel; + Stage = ShaderStage::Pixel; index = 0; arrayEl = 0; } @@ -91,9 +91,9 @@ bool Following::operator==(const Following &o) void Following::GetDrawContext(CaptureContext &ctx, bool ©, bool &compute) { const FetchDrawcall *curDraw = ctx.CurDrawcall(); - copy = curDraw != NULL && (curDraw->flags & (eDraw_Copy | eDraw_Resolve)); - compute = curDraw != NULL && (curDraw->flags & eDraw_Dispatch) && - ctx.CurPipelineState.GetShader(eShaderStage_Compute) != ResourceId(); + copy = curDraw != NULL && (curDraw->flags & (DrawFlags::Copy | DrawFlags::Resolve)); + compute = curDraw != NULL && (curDraw->flags & DrawFlags::Dispatch) && + ctx.CurPipelineState.GetShader(ShaderStage::Compute) != ResourceId(); } int Following::GetHighestMip(CaptureContext &ctx) @@ -106,7 +106,7 @@ int Following::GetFirstArraySlice(CaptureContext &ctx) return GetBoundResource(ctx, arrayEl).FirstSlice; } -FormatComponentType Following::GetTypeHint(CaptureContext &ctx) +CompType Following::GetTypeHint(CaptureContext &ctx) { return GetBoundResource(ctx, arrayEl).typeHint; } @@ -181,14 +181,14 @@ QVector Following::GetOutputTargets(CaptureContext &ctx) { QVector ret = ctx.CurPipelineState.GetOutputTargets(); - if(ret.isEmpty() && curDraw != NULL && (curDraw->flags & eDraw_Present)) + if(ret.isEmpty() && curDraw != NULL && (curDraw->flags & DrawFlags::Present)) { if(curDraw->copyDestination != ResourceId()) return {BoundResource(curDraw->copyDestination)}; for(const FetchTexture &tex : ctx.GetTextures()) { - if(tex.creationFlags & eTextureCreate_SwapBuffer) + if(tex.creationFlags & TextureCategory::SwapBuffer) return {BoundResource(tex.ID)}; } } @@ -209,7 +209,7 @@ BoundResource Following::GetDepthTarget(CaptureContext &ctx) } QMap> Following::GetReadWriteResources(CaptureContext &ctx, - ShaderStageType stage) + ShaderStage stage) { bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -221,8 +221,8 @@ QMap> Following::GetReadWriteResources(Capt else if(compute) { // only return compute resources for one stage - if(stage == eShaderStage_Pixel || stage == eShaderStage_Compute) - return ctx.CurPipelineState.GetReadWriteResources(eShaderStage_Compute); + if(stage == ShaderStage::Pixel || stage == ShaderStage::Compute) + return ctx.CurPipelineState.GetReadWriteResources(ShaderStage::Compute); else return QMap>(); } @@ -238,7 +238,7 @@ QMap> Following::GetReadWriteResources(Capt } QMap> Following::GetReadOnlyResources(CaptureContext &ctx, - ShaderStageType stage) + ShaderStage stage) { const FetchDrawcall *curDraw = ctx.CurDrawcall(); bool copy = false, compute = false; @@ -249,7 +249,7 @@ QMap> Following::GetReadOnlyResources(Captu QMap> ret; // only return copy source for one stage - if(stage == eShaderStage_Pixel) + if(stage == ShaderStage::Pixel) ret[BindpointMap(0, 0)] = {BoundResource(curDraw->copySource)}; return ret; @@ -257,8 +257,8 @@ QMap> Following::GetReadOnlyResources(Captu else if(compute) { // only return compute resources for one stage - if(stage == eShaderStage_Pixel || stage == eShaderStage_Compute) - return ctx.CurPipelineState.GetReadOnlyResources(eShaderStage_Compute); + if(stage == ShaderStage::Pixel || stage == ShaderStage::Compute) + return ctx.CurPipelineState.GetReadOnlyResources(ShaderStage::Compute); else return QMap>(); } @@ -273,7 +273,7 @@ QMap> Following::GetReadOnlyResources(Captu return GetReadOnlyResources(ctx, Stage); } -const ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStageType stage) +const ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStage stage) { bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -281,7 +281,7 @@ const ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStag if(copy) return NULL; else if(compute) - return ctx.CurPipelineState.GetShaderReflection(eShaderStage_Compute); + return ctx.CurPipelineState.GetShaderReflection(ShaderStage::Compute); else return ctx.CurPipelineState.GetShaderReflection(stage); } @@ -291,7 +291,7 @@ const ShaderReflection *Following::GetReflection(CaptureContext &ctx) return GetReflection(ctx, Stage); } -const ShaderBindpointMapping &Following::GetMapping(CaptureContext &ctx, ShaderStageType stage) +const ShaderBindpointMapping &Following::GetMapping(CaptureContext &ctx, ShaderStage stage) { bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -301,7 +301,7 @@ const ShaderBindpointMapping &Following::GetMapping(CaptureContext &ctx, ShaderS static ShaderBindpointMapping mapping; // for PS only add a single mapping to get the copy source - if(stage == eShaderStage_Pixel) + if(stage == ShaderStage::Pixel) mapping.ReadOnlyResources = {BindpointMap(0, 0)}; else mapping.ReadOnlyResources.clear(); @@ -310,7 +310,7 @@ const ShaderBindpointMapping &Following::GetMapping(CaptureContext &ctx, ShaderS } else if(compute) { - return ctx.CurPipelineState.GetBindpointMapping(eShaderStage_Compute); + return ctx.CurPipelineState.GetBindpointMapping(ShaderStage::Compute); } else { @@ -343,13 +343,13 @@ public: emit beginResetModel(); - int rtFlags = eTextureCreate_RTV | eTextureCreate_DSV; + TextureCategory rtFlags = TextureCategory::ColorTarget | TextureCategory::DepthTarget; for(const FetchTexture &t : src) { if(type == Textures) { - if((t.creationFlags & rtFlags) == 0) + if(!(t.creationFlags & rtFlags)) texs.push_back(t); } else if(type == RenderTargets) @@ -750,13 +750,13 @@ void TextureViewer::UI_UpdateStatusText() FetchTexture &tex = *texptr; - bool dsv = - ((tex.creationFlags & eTextureCreate_DSV) != 0) || (tex.format.compType == eCompType_Depth); - bool uintTex = (tex.format.compType == eCompType_UInt); - bool sintTex = (tex.format.compType == eCompType_SInt); + bool dsv = (tex.creationFlags & TextureCategory::DepthTarget) || + (tex.format.compType == CompType::Depth); + bool uintTex = (tex.format.compType == CompType::UInt); + bool sintTex = (tex.format.compType == CompType::SInt); - if(m_TexDisplay.overlay == eTexOverlay_QuadOverdrawPass || - m_TexDisplay.overlay == eTexOverlay_QuadOverdrawDraw) + if(m_TexDisplay.overlay == DebugOverlay::QuadOverdrawPass || + m_TexDisplay.overlay == DebugOverlay::QuadOverdrawDraw) { dsv = false; uintTex = false; @@ -775,7 +775,7 @@ void TextureViewer::UI_UpdateStatusText() float g = qBound(0.0f, m_CurHoverValue.value_f[1], 1.0f); float b = qBound(0.0f, m_CurHoverValue.value_f[2], 1.0f); - if(tex.format.srgbCorrected || (tex.creationFlags & eTextureCreate_SwapBuffer) > 0) + if(tex.format.srgbCorrected || (tex.creationFlags & TextureCategory::SwapBuffer)) { r = powf(r, 1.0f / 2.2f); g = powf(g, 1.0f / 2.2f); @@ -799,7 +799,7 @@ void TextureViewer::UI_UpdateStatusText() uint32_t mipWidth = qMax(1U, tex.width >> (int)m_TexDisplay.mip); uint32_t mipHeight = qMax(1U, tex.height >> (int)m_TexDisplay.mip); - if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) y = (int)(mipHeight - 1) - y; if(m_TexDisplay.FlipY) y = (int)(mipHeight - 1) - y; @@ -828,7 +828,7 @@ void TextureViewer::UI_UpdateStatusText() { x = m_PickedPoint.x() >> (int)m_TexDisplay.mip; y = m_PickedPoint.y() >> (int)m_TexDisplay.mip; - if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) y = (int)(mipHeight - 1) - y; if(m_TexDisplay.FlipY) y = (int)(mipHeight - 1) - y; @@ -1010,7 +1010,7 @@ void TextureViewer::UI_UpdateTextureDetails() status += " - " + QString(current.format.strname); - if(current.format.compType != m_TexDisplay.typeHint && m_TexDisplay.typeHint != eCompType_None) + if(current.format.compType != m_TexDisplay.typeHint && m_TexDisplay.typeHint != CompType::Typeless) { status += tr(" Viewed as %1").arg(ToQStr(m_TexDisplay.typeHint)); } @@ -1061,10 +1061,10 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) if(!currentTextureIsLocked()) m_TexDisplay.typeHint = m_Following.GetTypeHint(m_Ctx); else - m_TexDisplay.typeHint = eCompType_None; + m_TexDisplay.typeHint = CompType::Typeless; // if there is no such type or it isn't being followed, use the last seen interpretation - if(m_TexDisplay.typeHint == eCompType_None && m_TextureSettings.contains(m_TexDisplay.texid)) + if(m_TexDisplay.typeHint == CompType::Typeless && m_TextureSettings.contains(m_TexDisplay.texid)) m_TexDisplay.typeHint = m_TextureSettings[m_TexDisplay.texid].typeHint; // try to maintain the pan in the new texture. If the new texture @@ -1124,8 +1124,8 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) // add an option to display unweighted average resolved value, // to get an idea of how the samples average - if(tex.format.compType != eCompType_UInt && tex.format.compType != eCompType_SInt && - tex.format.compType != eCompType_Depth && (tex.creationFlags & eTextureCreate_DSV) == 0) + if(tex.format.compType != CompType::UInt && tex.format.compType != CompType::SInt && + tex.format.compType != CompType::Depth && !(tex.creationFlags & TextureCategory::DepthTarget)) ui->mipLevel->addItem(tr("Average val")); ui->mipLabel->setText(tr("Sample")); @@ -1304,9 +1304,9 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) }); } -void TextureViewer::UI_SetHistogramRange(const FetchTexture *tex, FormatComponentType typeHint) +void TextureViewer::UI_SetHistogramRange(const FetchTexture *tex, CompType typeHint) { - if(tex != NULL && (tex->format.compType == eCompType_SNorm || typeHint == eCompType_SNorm)) + if(tex != NULL && (tex->format.compType == CompType::SNorm || typeHint == CompType::SNorm)) ui->rangeHistogram->setRange(-1.0f, 1.0f); else ui->rangeHistogram->setRange(0.0f, 1.0f); @@ -1321,7 +1321,7 @@ void TextureViewer::UI_UpdateChannels() #define ENABLE(widget) widget->setEnabled(true) #define DISABLE(widget) widget->setEnabled(false) - if(tex != NULL && (tex->creationFlags & eTextureCreate_SwapBuffer)) + if(tex != NULL && (tex->creationFlags & TextureCategory::SwapBuffer)) { // swapbuffer is always srgb for 8-bit types, linear for 16-bit types DISABLE(ui->gammaDisplay); @@ -1347,8 +1347,8 @@ void TextureViewer::UI_UpdateChannels() bool dsv = false; if(tex != NULL) - dsv = ((tex->creationFlags & eTextureCreate_DSV) != 0) || - (tex->format.compType == eCompType_Depth); + dsv = (tex->creationFlags & TextureCategory::DepthTarget) || + (tex->format.compType == CompType::Depth); if(dsv && ui->channels->currentIndex() != 2) { @@ -1637,7 +1637,7 @@ void TextureViewer::GotoLocation(int x, int y) m_PickedPoint = QPoint(x, y); uint32_t mipHeight = qMax(1U, tex->height >> (int)m_TexDisplay.mip); - if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.y()); if(m_TexDisplay.FlipY) m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.x()); @@ -1825,7 +1825,7 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array< uint32_t start = 0; uint32_t end = 0; - ResourceUsage us = eUsage_IndexBuffer; + ResourceUsage us = ResourceUsage::IndexBuffer; for(const EventUsage u : usage) { @@ -1856,7 +1856,7 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array< while(prev != NULL && prev->eventID > end) { - if((prev->flags & (eDraw_Dispatch | eDraw_Drawcall | eDraw_CmdList)) == 0) + if(!(prev->flags & (DrawFlags::Dispatch | DrawFlags::Drawcall | DrawFlags::CmdList))) { prev = m_Ctx.GetDrawcall(prev->previous); } @@ -1892,9 +1892,9 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array< } } -void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, - FormatComponentType typeHint, bool force, Following &follow, - const QString &bindName, const QString &slotName) +void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, CompType typeHint, + bool force, Following &follow, const QString &bindName, + const QString &slotName) { if(id != ResourceId() || force) { @@ -1935,7 +1935,7 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, WId handle = prev->thumbWinId(); m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) { m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(), - eCompType_None); + CompType::Typeless); }); } else @@ -1944,7 +1944,7 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, WId handle = prev->thumbWinId(); m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) { m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(), - eCompType_None); + CompType::Typeless); }); } @@ -1962,7 +1962,7 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, WId handle = prev->thumbWinId(); m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) { m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(), - eCompType_None); + CompType::Typeless); }); } else @@ -1973,7 +1973,7 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, } } -void TextureViewer::InitStageResourcePreviews(ShaderStageType stage, +void TextureViewer::InitStageResourcePreviews(ShaderStage stage, const rdctype::array &resourceDetails, const rdctype::array &mapping, QMap> &ResList, @@ -1994,8 +1994,7 @@ void TextureViewer::InitStageResourcePreviews(ShaderStageType stage, for(int arrayIdx = 0; arrayIdx < arrayLen; arrayIdx++) { ResourceId id = resArray != NULL ? resArray->at(arrayIdx).Id : ResourceId(); - FormatComponentType typeHint = - resArray != NULL ? resArray->at(arrayIdx).typeHint : eCompType_None; + CompType typeHint = resArray != NULL ? resArray->at(arrayIdx).typeHint : CompType::Typeless; bool used = key.used; bool samplerBind = false; @@ -2488,16 +2487,13 @@ void TextureViewer::OnLogfileLoaded() m_Ctx.Renderer().BlockInvoke([renderID, contextID, this](IReplayRenderer *r) { m_Output = r->CreateOutput(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(renderID), - eOutputType_TexDisplay); + ReplayOutputType::Texture); m_Output->SetPixelContext(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(contextID)); ui->render->setOutput(m_Output); ui->pixelContext->setOutput(m_Output); - OutputConfig c = {eOutputType_TexDisplay}; - m_Output->SetOutputConfig(c); - RT_UpdateAndDisplay(r); GUIInvoke::call([this]() { OnEventChanged(m_Ctx.CurEvent()); }); @@ -2619,7 +2615,7 @@ void TextureViewer::OnEventChanged(uint32_t eventID) outIndex++; - Following follow(FollowType::OutputColour, eShaderStage_Pixel, rt, 0); + Following follow(FollowType::OutputColour, ShaderStage::Pixel, rt, 0); QString bindName = copy ? tr("Destination") : ""; QString slotName = copy ? tr("DST") : (m_Ctx.CurPipelineState.OutputAbbrev() + QString::number(rt)); @@ -2638,19 +2634,19 @@ void TextureViewer::OnEventChanged(uint32_t eventID) outIndex++; - Following follow(FollowType::OutputDepth, eShaderStage_Pixel, 0, 0); + Following follow(FollowType::OutputDepth, ShaderStage::Pixel, 0, 0); InitResourcePreview(prev, Depth.Id, Depth.typeHint, false, follow, "", tr("DS")); } - ShaderStageType stages[] = {eShaderStage_Vertex, eShaderStage_Hull, eShaderStage_Domain, - eShaderStage_Geometry, eShaderStage_Pixel}; + ShaderStage stages[] = {ShaderStage::Vertex, ShaderStage::Hull, ShaderStage::Domain, + ShaderStage::Geometry, ShaderStage::Pixel}; int count = 5; if(compute) { - stages[0] = eShaderStage_Compute; + stages[0] = ShaderStage::Compute; count = 1; } @@ -2659,7 +2655,7 @@ void TextureViewer::OnEventChanged(uint32_t eventID) // display resources used for all stages for(int i = 0; i < count; i++) { - ShaderStageType stage = stages[i]; + ShaderStage stage = stages[i]; QMap> RWs = Following::GetReadWriteResources(m_Ctx, stage); QMap> ROs = Following::GetReadOnlyResources(m_Ctx, stage); @@ -2861,10 +2857,10 @@ void TextureViewer::zoomOption_returnPressed() void TextureViewer::on_overlay_currentIndexChanged(int index) { - m_TexDisplay.overlay = eTexOverlay_None; + m_TexDisplay.overlay = DebugOverlay::NoOverlay; if(ui->overlay->currentIndex() > 0) - m_TexDisplay.overlay = (TextureDisplayOverlay)ui->overlay->currentIndex(); + m_TexDisplay.overlay = (DebugOverlay)ui->overlay->currentIndex(); INVOKE_MEMFN(RT_UpdateAndDisplay); } @@ -3004,17 +3000,17 @@ void TextureViewer::AutoFitRange() if(m_TexDisplay.CustomShader != ResourceId()) { - fmt.compType = eCompType_Float; + fmt.compType = CompType::Float; } for(int i = 0; i < 4; i++) { - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) { min.value_f[i] = min.value_u[i]; max.value_f[i] = max.value_u[i]; } - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) { min.value_f[i] = min.value_i[i]; max.value_f[i] = max.value_i[i]; @@ -3201,7 +3197,7 @@ void TextureViewer::ShowGotoPopup() uint32_t mipHeight = qMax(1U, texptr->height >> (int)m_TexDisplay.mip); - if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) p.setY((int)(mipHeight - 1) - p.y()); if(m_TexDisplay.FlipY) p.setY((int)(mipHeight - 1) - p.y()); @@ -3260,9 +3256,9 @@ void TextureViewer::on_saveTex_clicked() config.comp.blackPoint = m_TexDisplay.rangemin; config.comp.whitePoint = m_TexDisplay.rangemax; config.alphaCol = m_TexDisplay.lightBackgroundColour; - config.alpha = m_TexDisplay.Alpha ? eAlphaMap_BlendToCheckerboard : eAlphaMap_Discard; + config.alpha = m_TexDisplay.Alpha ? AlphaMapping::BlendToCheckerboard : AlphaMapping::Discard; if(m_TexDisplay.Alpha && !ui->checkerBack->isChecked()) - config.alpha = eAlphaMap_BlendToColour; + config.alpha = AlphaMapping::BlendToColour; if(m_TexDisplay.CustomShader != ResourceId()) { @@ -3323,13 +3319,13 @@ void TextureViewer::on_debugPixelContext_clicked() QString debugContext = tr("Pixel %1,%2").arg(x).arg(y); const ShaderReflection *shaderDetails = - m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Pixel); + m_Ctx.CurPipelineState.GetShaderReflection(ShaderStage::Pixel); const ShaderBindpointMapping &bindMapping = - m_Ctx.CurPipelineState.GetBindpointMapping(eShaderStage_Pixel); + m_Ctx.CurPipelineState.GetBindpointMapping(ShaderStage::Pixel); // viewer takes ownership of the trace ShaderViewer *s = ShaderViewer::debugShader(m_Ctx, &bindMapping, shaderDetails, - eShaderStage_Pixel, trace, debugContext, this); + ShaderStage::Pixel, trace, debugContext, this); m_Ctx.setupDockWindow(s); @@ -3515,7 +3511,7 @@ void TextureViewer::reloadCustomShaders(const QString &filter) rdctype::str errors; ResourceId id = - r->BuildCustomShader("main", source.toUtf8().data(), 0, eShaderStage_Pixel, &errors); + r->BuildCustomShader("main", source.toUtf8().data(), 0, ShaderStage::Pixel, &errors); if(m_CustomShaderEditor.contains(key)) { diff --git a/qrenderdoc/Windows/TextureViewer.h b/qrenderdoc/Windows/TextureViewer.h index 782a024a3..405e316b5 100644 --- a/qrenderdoc/Windows/TextureViewer.h +++ b/qrenderdoc/Windows/TextureViewer.h @@ -51,7 +51,7 @@ enum struct FollowType struct Following { FollowType Type; - ShaderStageType Stage; + ShaderStage Stage; int index; int arrayEl; @@ -59,7 +59,7 @@ struct Following Following(); - Following(FollowType t, ShaderStageType s, int i, int a); + Following(FollowType t, ShaderStage s, int i, int a); bool operator==(const Following &o); bool operator!=(const Following &o); @@ -67,7 +67,7 @@ struct Following int GetHighestMip(CaptureContext &ctx); int GetFirstArraySlice(CaptureContext &ctx); - FormatComponentType GetTypeHint(CaptureContext &ctx); + CompType GetTypeHint(CaptureContext &ctx); ResourceId GetResourceId(CaptureContext &ctx); BoundResource GetBoundResource(CaptureContext &ctx, int arrayIdx); @@ -79,18 +79,18 @@ struct Following QMap> GetReadWriteResources(CaptureContext &ctx); static QMap> GetReadWriteResources(CaptureContext &ctx, - ShaderStageType stage); + ShaderStage stage); QMap> GetReadOnlyResources(CaptureContext &ctx); static QMap> GetReadOnlyResources(CaptureContext &ctx, - ShaderStageType stage); + ShaderStage stage); const ShaderReflection *GetReflection(CaptureContext &ctx); - static const ShaderReflection *GetReflection(CaptureContext &ctx, ShaderStageType stage); + static const ShaderReflection *GetReflection(CaptureContext &ctx, ShaderStage stage); const ShaderBindpointMapping &GetMapping(CaptureContext &ctx); - static const ShaderBindpointMapping &GetMapping(CaptureContext &ctx, ShaderStageType stage); + static const ShaderBindpointMapping &GetMapping(CaptureContext &ctx, ShaderStage stage); }; struct TexSettings @@ -103,7 +103,7 @@ struct TexSettings slice = 0; minrange = 0.0f; maxrange = 1.0f; - typeHint = eCompType_None; + typeHint = CompType::Typeless; } int displayType; // RGBA, RGBM, Custom @@ -112,7 +112,7 @@ struct TexSettings bool depth, stencil; int mip, slice; float minrange, maxrange; - FormatComponentType typeHint; + CompType typeHint; }; class TextureViewer : public QFrame, public ILogViewerForm @@ -213,7 +213,7 @@ private: void UI_UpdateTextureDetails(); void UI_OnTextureSelectionChanged(bool newdraw); - void UI_SetHistogramRange(const FetchTexture *tex, FormatComponentType typeHint); + void UI_SetHistogramRange(const FetchTexture *tex, CompType typeHint); void UI_UpdateChannels(); @@ -223,11 +223,10 @@ private: ResourcePreview *UI_CreateThumbnail(ThumbnailStrip *strip); void UI_CreateThumbnails(); - void InitResourcePreview(ResourcePreview *prev, ResourceId id, FormatComponentType typeHint, - bool force, Following &follow, const QString &bindName, - const QString &slotName); + void InitResourcePreview(ResourcePreview *prev, ResourceId id, CompType typeHint, bool force, + Following &follow, const QString &bindName, const QString &slotName); - void InitStageResourcePreviews(ShaderStageType stage, + void InitStageResourcePreviews(ShaderStage stage, const rdctype::array &resourceDetails, const rdctype::array &mapping, QMap> &ResList, diff --git a/renderdoc/api/replay/control_types.h b/renderdoc/api/replay/control_types.h index 756210de2..cd7af2fd3 100644 --- a/renderdoc/api/replay/control_types.h +++ b/renderdoc/api/replay/control_types.h @@ -28,11 +28,6 @@ #include "data_types.h" #include "replay_enums.h" -struct OutputConfig -{ - OutputType m_Type; -}; - struct MeshFormat { MeshFormat() @@ -44,11 +39,11 @@ struct MeshFormat stride = 0; compCount = 0; compByteWidth = 0; - compType = eCompType_None; + compType = CompType::Typeless; bgraOrder = false; - specialFormat = eSpecial_Unknown; + specialFormat = SpecialFormat::Unknown; showAlpha = false; - topo = eTopology_Unknown; + topo = Topology::Unknown; numVerts = 0; unproject = false; nearPlane = farPlane = 0.0f; @@ -65,7 +60,7 @@ struct MeshFormat uint32_t compCount; uint32_t compByteWidth; - FormatComponentType compType; + CompType compType; bool32 bgraOrder; SpecialFormat specialFormat; @@ -73,7 +68,7 @@ struct MeshFormat bool showAlpha; - PrimitiveTopology topo; + Topology topo; uint32_t numVerts; bool32 unproject; @@ -105,14 +100,14 @@ struct MeshDisplay FloatVector maxBounds; bool32 showBBox; - SolidShadeMode solidShadeMode; + SolidShade solidShadeMode; bool32 wireframeDraw; }; struct TextureDisplay { ResourceId texid; - FormatComponentType typeHint; + CompType typeHint; float rangemin; float rangemax; float scale; @@ -131,14 +126,14 @@ struct TextureDisplay FloatVector lightBackgroundColour; FloatVector darkBackgroundColour; - TextureDisplayOverlay overlay; + DebugOverlay overlay; }; struct TextureSave { ResourceId id; - FormatComponentType typeHint; + CompType typeHint; FileType destType; diff --git a/renderdoc/api/replay/d3d11_pipestate.h b/renderdoc/api/replay/d3d11_pipestate.h index 226c6134f..254debbf9 100644 --- a/renderdoc/api/replay/d3d11_pipestate.h +++ b/renderdoc/api/replay/d3d11_pipestate.h @@ -70,16 +70,16 @@ struct D3D11PipelineState } ibuffer; } m_IA; - struct ShaderStage + struct Shader { - ShaderStage() : Shader(), customName(false), ShaderDetails(NULL), stage(eShaderStage_Vertex) {} - ResourceId Shader; + Shader() : Object(), customName(false), ShaderDetails(NULL), stage(ShaderStage::Vertex) {} + ResourceId Object; rdctype::str ShaderName; bool32 customName; ShaderReflection *ShaderDetails; ShaderBindpointMapping BindpointMapping; - ShaderStageType stage; + ShaderStage stage; struct ResourceView { @@ -94,7 +94,7 @@ struct D3D11PipelineState ElementWidth(0), FirstElement(0), NumElements(1), - Flags(0), + Flags(D3DBufferViewFlags::NoFlags), HighestMip(0), NumMipLevels(1), ArraySize(1), @@ -120,7 +120,7 @@ struct D3D11PipelineState uint32_t NumElements; // BufferEx - uint32_t Flags; + D3DBufferViewFlags Flags; // Texture uint32_t HighestMip; @@ -224,8 +224,8 @@ struct D3D11PipelineState { RasterizerState() : State(), - FillMode(eFill_Solid), - CullMode(eCull_None), + fillMode(FillMode::Solid), + cullMode(CullMode::NoCull), FrontCCW(false), DepthBias(0), DepthBiasClamp(0.0f), @@ -239,8 +239,8 @@ struct D3D11PipelineState { } ResourceId State; - TriangleFillMode FillMode; - TriangleCullMode CullMode; + FillMode fillMode; + CullMode cullMode; bool32 FrontCCW; int32_t DepthBias; float DepthBiasClamp; @@ -322,12 +322,12 @@ struct D3D11PipelineState uint32_t SampleMask; } m_BlendState; - rdctype::array RenderTargets; + rdctype::array RenderTargets; uint32_t UAVStartSlot; - rdctype::array UAVs; + rdctype::array UAVs; - ShaderStage::ResourceView DepthTarget; + Shader::ResourceView DepthTarget; bool32 DepthReadOnly; bool32 StencilReadOnly; } m_OM; diff --git a/renderdoc/api/replay/d3d12_pipestate.h b/renderdoc/api/replay/d3d12_pipestate.h index 240db4fd2..f340982c1 100644 --- a/renderdoc/api/replay/d3d12_pipestate.h +++ b/renderdoc/api/replay/d3d12_pipestate.h @@ -86,7 +86,7 @@ struct D3D12PipelineState TableIndex(~0U), Resource(), Format(), - BufferFlags(0), + BufferFlags(D3DBufferViewFlags::NoFlags), BufferStructCount(0), ElementSize(0), FirstElement(0), @@ -98,10 +98,10 @@ struct D3D12PipelineState FirstArraySlice(0), MinLODClamp(0.0f) { - swizzle[0] = eSwizzle_Red; - swizzle[1] = eSwizzle_Green; - swizzle[2] = eSwizzle_Blue; - swizzle[3] = eSwizzle_Alpha; + swizzle[0] = TextureSwizzle::Red; + swizzle[1] = TextureSwizzle::Green; + swizzle[2] = TextureSwizzle::Blue; + swizzle[3] = TextureSwizzle::Alpha; } // parameters from descriptor @@ -115,7 +115,7 @@ struct D3D12PipelineState ResourceFormat Format; TextureSwizzle swizzle[4]; - uint32_t BufferFlags; + D3DBufferViewFlags BufferFlags; uint32_t BufferStructCount; uint32_t ElementSize; uint64_t FirstElement; @@ -185,14 +185,14 @@ struct D3D12PipelineState rdctype::array RootValues; }; - struct ShaderStage + struct Shader { - ShaderStage() : ShaderDetails(NULL), stage(eShaderStage_Vertex) {} - ResourceId Shader; + Shader() : ShaderDetails(NULL), stage(ShaderStage::Vertex) {} + ResourceId Object; ShaderReflection *ShaderDetails; ShaderBindpointMapping BindpointMapping; - ShaderStageType stage; + ShaderStage stage; struct RegisterSpace { @@ -254,8 +254,8 @@ struct D3D12PipelineState struct RasterizerState { RasterizerState() - : FillMode(eFill_Solid), - CullMode(eCull_None), + : fillMode(FillMode::Solid), + cullMode(CullMode::NoCull), FrontCCW(false), DepthBias(0), DepthBiasClamp(0.0f), @@ -267,8 +267,8 @@ struct D3D12PipelineState ConservativeRasterization(false) { } - TriangleFillMode FillMode; - TriangleCullMode CullMode; + FillMode fillMode; + CullMode cullMode; bool32 FrontCCW; int32_t DepthBias; float DepthBiasClamp; diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index 5ea8db90d..496f2e2b0 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -37,7 +37,7 @@ struct FloatVector struct DirectoryFile { rdctype::str filename; - uint32_t flags; + FileProperty flags; uint32_t lastmod; uint64_t size; }; @@ -48,10 +48,10 @@ struct ResourceFormat { rawType = 0; special = true; - specialFormat = eSpecial_Unknown; + specialFormat = SpecialFormat::Unknown; compCount = compByteWidth = 0; - compType = eCompType_Float; + compType = CompType::Float; bgraOrder = false; srgbCorrected = false; @@ -78,7 +78,7 @@ struct ResourceFormat uint32_t compCount; uint32_t compByteWidth; - FormatComponentType compType; + CompType compType; bool32 bgraOrder; bool32 srgbCorrected; @@ -89,7 +89,7 @@ struct FetchBuffer ResourceId ID; rdctype::str name; bool32 customName; - uint32_t creationFlags; + BufferCategory creationFlags; uint64_t length; }; @@ -99,13 +99,13 @@ struct FetchTexture bool32 customName; ResourceFormat format; uint32_t dimension; - ShaderResourceType resType; + TextureDim resType; uint32_t width, height, depth; ResourceId ID; bool32 cubemap; uint32_t mips; uint32_t arraysize; - uint32_t creationFlags; + TextureCategory creationFlags; uint32_t msQual, msSamp; uint64_t byteSize; }; @@ -126,9 +126,9 @@ struct FetchAPIEvent struct DebugMessage { uint32_t eventID; - DebugMessageCategory category; - DebugMessageSeverity severity; - DebugMessageSource source; + MessageCategory category; + MessageSeverity severity; + MessageSource source; uint32_t messageID; rdctype::str description; }; @@ -273,16 +273,16 @@ struct FetchFrameOutputStats struct FetchFrameStatistics { uint32_t recorded; - FetchFrameConstantBindStats constants[eShaderStage_Count]; - FetchFrameSamplerBindStats samplers[eShaderStage_Count]; - FetchFrameResourceBindStats resources[eShaderStage_Count]; + FetchFrameConstantBindStats constants[ENUM_ARRAY_SIZE(ShaderStage)]; + FetchFrameSamplerBindStats samplers[ENUM_ARRAY_SIZE(ShaderStage)]; + FetchFrameResourceBindStats resources[ENUM_ARRAY_SIZE(ShaderStage)]; FetchFrameUpdateStats updates; FetchFrameDrawStats draws; FetchFrameDispatchStats dispatches; FetchFrameIndexBindStats indices; FetchFrameVertexBindStats vertices; FetchFrameLayoutBindStats layouts; - FetchFrameShaderStats shaders[eShaderStage_Count]; + FetchFrameShaderStats shaders[ENUM_ARRAY_SIZE(ShaderStage)]; FetchFrameBlendStats blends; FetchFrameDepthStencilStats depths; FetchFrameRasterizationStats rasters; @@ -317,7 +317,7 @@ struct FetchFrameInfo struct EventUsage { - EventUsage() : eventID(0), usage(eUsage_None) {} + EventUsage() : eventID(0), usage(ResourceUsage::Unused) {} EventUsage(uint32_t e, ResourceUsage u) : eventID(e), usage(u) {} EventUsage(uint32_t e, ResourceUsage u, ResourceId v) : eventID(e), usage(u), view(v) {} bool operator<(const EventUsage &o) const @@ -340,7 +340,7 @@ struct FetchDrawcall { eventID = 0; drawcallID = 0; - flags = 0; + flags = DrawFlags::NoFlags; markerColour[0] = markerColour[1] = markerColour[2] = markerColour[3] = 0.0f; numIndices = 0; numInstances = 0; @@ -353,7 +353,7 @@ struct FetchDrawcall dispatchThreadsDimension[0] = dispatchThreadsDimension[1] = dispatchThreadsDimension[2] = 0; indexByteWidth = 0; - topology = eTopology_Unknown; + topology = Topology::Unknown; copySource = ResourceId(); copyDestination = ResourceId(); @@ -371,7 +371,7 @@ struct FetchDrawcall rdctype::str name; - uint32_t flags; + DrawFlags flags; float markerColour[4]; @@ -386,7 +386,7 @@ struct FetchDrawcall uint32_t dispatchThreadsDimension[3]; uint32_t indexByteWidth; - PrimitiveTopology topology; + Topology topology; ResourceId copySource; ResourceId copyDestination; @@ -416,30 +416,30 @@ struct APIProperties struct CounterDescription { - uint32_t counterID; + GPUCounter counterID; rdctype::str name; rdctype::str description; - FormatComponentType resultCompType; + CompType resultType; uint32_t resultByteWidth; - CounterUnits units; + CounterUnit unit; }; struct CounterResult { - CounterResult() : eventID(0), counterID(0) { value.u64 = 0; } - CounterResult(uint32_t EID, uint32_t c, float data) : eventID(EID), counterID(c) + CounterResult() : eventID(0), counterID(GPUCounter::EventGPUDuration) { value.u64 = 0; } + CounterResult(uint32_t EID, GPUCounter c, float data) : eventID(EID), counterID(c) { value.f = data; } - CounterResult(uint32_t EID, uint32_t c, double data) : eventID(EID), counterID(c) + CounterResult(uint32_t EID, GPUCounter c, double data) : eventID(EID), counterID(c) { value.d = data; } - CounterResult(uint32_t EID, uint32_t c, uint32_t data) : eventID(EID), counterID(c) + CounterResult(uint32_t EID, GPUCounter c, uint32_t data) : eventID(EID), counterID(c) { value.u32 = data; } - CounterResult(uint32_t EID, uint32_t c, uint64_t data) : eventID(EID), counterID(c) + CounterResult(uint32_t EID, GPUCounter c, uint64_t data) : eventID(EID), counterID(c) { value.u64 = data; } @@ -462,7 +462,7 @@ struct CounterResult } uint32_t eventID; - uint32_t counterID; + GPUCounter counterID; union { float f; diff --git a/renderdoc/api/replay/gl_pipestate.h b/renderdoc/api/replay/gl_pipestate.h index 357ace38e..9fa8e4feb 100644 --- a/renderdoc/api/replay/gl_pipestate.h +++ b/renderdoc/api/replay/gl_pipestate.h @@ -69,19 +69,19 @@ struct GLPipelineState bool32 provokingVertexLast; } m_VtxIn; - struct ShaderStage + struct Shader { - ShaderStage() - : Shader(), + Shader() + : Object(), customShaderName(false), customProgramName(false), PipelineActive(false), customPipelineName(false), ShaderDetails(NULL), - stage(eShaderStage_Vertex) + stage(ShaderStage::Vertex) { } - ResourceId Shader; + ResourceId Object; rdctype::str ShaderName; bool32 customShaderName; @@ -96,7 +96,7 @@ struct GLPipelineState ShaderReflection *ShaderDetails; ShaderBindpointMapping BindpointMapping; - ShaderStageType stage; + ShaderStage stage; rdctype::array Subroutines; } m_VS, m_TCS, m_TES, m_GS, m_FS, m_CS; @@ -123,17 +123,17 @@ struct GLPipelineState struct Texture { - Texture() : Resource(), FirstSlice(0), ResType(eResType_None), DepthReadChannel(-1) + Texture() : Resource(), FirstSlice(0), ResType(TextureDim::Unknown), DepthReadChannel(-1) { - Swizzle[0] = eSwizzle_Red; - Swizzle[1] = eSwizzle_Green; - Swizzle[2] = eSwizzle_Blue; - Swizzle[3] = eSwizzle_Alpha; + Swizzle[0] = TextureSwizzle::Red; + Swizzle[1] = TextureSwizzle::Green; + Swizzle[2] = TextureSwizzle::Blue; + Swizzle[3] = TextureSwizzle::Alpha; } ResourceId Resource; uint32_t FirstSlice; uint32_t HighestMip; - ShaderResourceType ResType; + TextureDim ResType; TextureSwizzle Swizzle[4]; int32_t DepthReadChannel; @@ -188,7 +188,7 @@ struct GLPipelineState Level(0), Layered(false), Layer(0), - ResType(eResType_None), + ResType(TextureDim::Unknown), readAllowed(false), writeAllowed(false) { @@ -197,7 +197,7 @@ struct GLPipelineState uint32_t Level; bool32 Layered; uint32_t Layer; - ShaderResourceType ResType; + TextureDim ResType; bool32 readAllowed; bool32 writeAllowed; ResourceFormat Format; @@ -246,8 +246,8 @@ struct GLPipelineState struct RasterizerState { RasterizerState() - : FillMode(eFill_Solid), - CullMode(eCull_None), + : fillMode(FillMode::Solid), + cullMode(CullMode::NoCull), FrontCCW(false), DepthBias(0), SlopeScaledDepthBias(0.0f), @@ -270,8 +270,8 @@ struct GLPipelineState PointOriginUpperLeft(false) { } - TriangleFillMode FillMode; - TriangleCullMode CullMode; + FillMode fillMode; + CullMode cullMode; bool32 FrontCCW; float DepthBias; float SlopeScaledDepthBias; @@ -338,10 +338,10 @@ struct GLPipelineState { Attachment() : Obj(), Layer(0), Mip(0) { - Swizzle[0] = eSwizzle_Red; - Swizzle[1] = eSwizzle_Green; - Swizzle[2] = eSwizzle_Blue; - Swizzle[3] = eSwizzle_Alpha; + Swizzle[0] = TextureSwizzle::Red; + Swizzle[1] = TextureSwizzle::Green; + Swizzle[2] = TextureSwizzle::Blue; + Swizzle[3] = TextureSwizzle::Alpha; } ResourceId Obj; uint32_t Layer; @@ -389,10 +389,10 @@ struct GLPipelineState struct Hints { Hints() - : Derivatives(eQuality_DontCare), - LineSmooth(eQuality_DontCare), - PolySmooth(eQuality_DontCare), - TexCompression(eQuality_DontCare), + : Derivatives(QualityHint::DontCare), + LineSmooth(QualityHint::DontCare), + PolySmooth(QualityHint::DontCare), + TexCompression(QualityHint::DontCare), LineSmoothEnabled(0), PolySmoothEnabled(0) { diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index 58b6a666e..2e4b57168 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -98,13 +98,13 @@ struct XCBWindowData #endif -enum WindowingSystem +enum class WindowingSystem : uint32_t { - eWindowingSystem_Unknown, - eWindowingSystem_Win32, - eWindowingSystem_Xlib, - eWindowingSystem_XCB, - eWindowingSystem_Android, + Unknown, + Win32, + Xlib, + XCB, + Android, }; // needs to be declared up here for reference in basic_types @@ -144,13 +144,12 @@ struct ResourceId struct IReplayOutput { - virtual bool SetOutputConfig(const OutputConfig &o) = 0; virtual bool SetTextureDisplay(const TextureDisplay &o) = 0; virtual bool SetMeshDisplay(const MeshDisplay &o) = 0; virtual bool ClearThumbnails() = 0; virtual bool AddThumbnail(WindowingSystem system, void *data, ResourceId texID, - FormatComponentType typeHint) = 0; + CompType typeHint) = 0; virtual bool Display() = 0; @@ -169,8 +168,6 @@ struct IReplayOutput }; // deprecated C interface, for renderdocui only -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetOutputConfig(IReplayOutput *output, - const OutputConfig &o); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetTextureDisplay(IReplayOutput *output, const TextureDisplay &o); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetMeshDisplay(IReplayOutput *output, @@ -180,7 +177,7 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_ClearThumbnails(IRepla extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_AddThumbnail(IReplayOutput *output, WindowingSystem system, void *data, ResourceId texID, - FormatComponentType typeHint); + CompType typeHint); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_Display(IReplayOutput *output); @@ -215,7 +212,7 @@ struct IReplayRenderer virtual void GetSupportedWindowSystems(rdctype::array *systems) = 0; - virtual IReplayOutput *CreateOutput(WindowingSystem system, void *data, OutputType type) = 0; + virtual IReplayOutput *CreateOutput(WindowingSystem system, void *data, ReplayOutputType type) = 0; virtual void Shutdown() = 0; virtual void ShutdownOutput(IReplayOutput *output) = 0; @@ -231,12 +228,12 @@ struct IReplayRenderer virtual bool GetVulkanPipelineState(VulkanPipelineState *state) = 0; virtual ResourceId BuildCustomShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStageType type, + const uint32_t compileFlags, ShaderStage type, rdctype::str *errors) = 0; virtual bool FreeCustomShader(ResourceId id) = 0; virtual ResourceId BuildTargetShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStageType type, + const uint32_t compileFlags, ShaderStage type, rdctype::str *errors) = 0; virtual bool ReplaceResource(ResourceId from, ResourceId to) = 0; virtual bool RemoveReplacement(ResourceId id) = 0; @@ -244,10 +241,10 @@ struct IReplayRenderer virtual bool GetFrameInfo(FetchFrameInfo *frame) = 0; virtual bool GetDrawcalls(rdctype::array *draws) = 0; - virtual bool FetchCounters(uint32_t *counters, uint32_t numCounters, + virtual bool FetchCounters(GPUCounter *counters, uint32_t numCounters, rdctype::array *results) = 0; - virtual bool EnumerateCounters(rdctype::array *counters) = 0; - virtual bool DescribeCounter(uint32_t counterID, CounterDescription *desc) = 0; + virtual bool EnumerateCounters(rdctype::array *counters) = 0; + virtual bool DescribeCounter(GPUCounter counterID, CounterDescription *desc) = 0; virtual bool GetTextures(rdctype::array *texs) = 0; virtual bool GetBuffers(rdctype::array *bufs) = 0; virtual bool GetResolve(uint64_t *callstack, uint32_t callstackLen, @@ -255,7 +252,7 @@ struct IReplayRenderer virtual bool GetDebugMessages(rdctype::array *msgs) = 0; virtual bool PixelHistory(ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint, + uint32_t sampleIdx, CompType typeHint, rdctype::array *history) = 0; virtual bool DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace) = 0; @@ -287,7 +284,7 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetSupportedWindowSyst IReplayRenderer *rend, rdctype::array *systems); extern "C" RENDERDOC_API IReplayOutput *RENDERDOC_CC ReplayRenderer_CreateOutput( - IReplayRenderer *rend, WindowingSystem system, void *data, OutputType type); + IReplayRenderer *rend, WindowingSystem system, void *data, ReplayOutputType type); extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_Shutdown(IReplayRenderer *rend); extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_ShutdownOutput(IReplayRenderer *rend, IReplayOutput *output); @@ -311,13 +308,13 @@ ReplayRenderer_GetVulkanPipelineState(IReplayRenderer *rend, VulkanPipelineState extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildCustomShader( IReplayRenderer *rend, const char *entry, const char *source, const uint32_t compileFlags, - ShaderStageType type, ResourceId *shaderID, rdctype::str *errors); + ShaderStage type, ResourceId *shaderID, rdctype::str *errors); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_FreeCustomShader(IReplayRenderer *rend, ResourceId id); extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildTargetShader( IReplayRenderer *rend, const char *entry, const char *source, const uint32_t compileFlags, - ShaderStageType type, ResourceId *shaderID, rdctype::str *errors); + ShaderStage type, ResourceId *shaderID, rdctype::str *errors); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_ReplaceResource(IReplayRenderer *rend, ResourceId from, ResourceId to); @@ -331,12 +328,12 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetFrameInfo(IReplay extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetDrawcalls(IReplayRenderer *rend, rdctype::array *draws); extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_FetchCounters(IReplayRenderer *rend, uint32_t *counters, uint32_t numCounters, +ReplayRenderer_FetchCounters(IReplayRenderer *rend, GPUCounter *counters, uint32_t numCounters, rdctype::array *results); extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_EnumerateCounters(IReplayRenderer *rend, rdctype::array *counters); +ReplayRenderer_EnumerateCounters(IReplayRenderer *rend, rdctype::array *counters); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_DescribeCounter(IReplayRenderer *rend, - uint32_t counterID, + GPUCounter counterID, CounterDescription *desc); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetTextures(IReplayRenderer *rend, rdctype::array *texs); @@ -350,7 +347,7 @@ ReplayRenderer_GetDebugMessages(IReplayRenderer *rend, rdctype::array *history); + uint32_t sampleIdx, CompType typeHint, rdctype::array *history); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_DebugVertex(IReplayRenderer *rend, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace); @@ -449,8 +446,8 @@ struct IRemoteServer virtual void CopyCaptureFromRemote(const char *remotepath, const char *localpath, float *progress) = 0; - virtual ReplayCreateStatus OpenCapture(uint32_t proxyid, const char *logfile, float *progress, - IReplayRenderer **rend) = 0; + virtual ReplayStatus OpenCapture(uint32_t proxyid, const char *logfile, float *progress, + IReplayRenderer **rend) = 0; virtual void CloseCapture(IReplayRenderer *rend) = 0; }; @@ -484,9 +481,11 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_CopyCaptureFromRemote(IR const char *localpath, float *progress); -extern "C" RENDERDOC_API ReplayCreateStatus RENDERDOC_CC -RemoteServer_OpenCapture(IRemoteServer *remote, uint32_t proxyid, const char *logfile, - float *progress, IReplayRenderer **rend); +extern "C" RENDERDOC_API ReplayStatus RENDERDOC_CC RemoteServer_OpenCapture(IRemoteServer *remote, + uint32_t proxyid, + const char *logfile, + float *progress, + IReplayRenderer **rend); extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_CloseCapture(IRemoteServer *remote, IReplayRenderer *rend); @@ -521,9 +520,8 @@ extern "C" RENDERDOC_API void RENDERDOC_CC Camera_GetBasis(Camera *c, FloatVecto extern "C" RENDERDOC_API float RENDERDOC_CC Maths_HalfToFloat(uint16_t half); extern "C" RENDERDOC_API uint16_t RENDERDOC_CC Maths_FloatToHalf(float f); -extern "C" RENDERDOC_API uint32_t RENDERDOC_CC -Topology_NumVerticesPerPrimitive(PrimitiveTopology topology); -extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_VertexOffset(PrimitiveTopology topology, +extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_NumVerticesPerPrimitive(Topology topology); +extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_VertexOffset(Topology topology, uint32_t primitive); ////////////////////////////////////////////////////////////////////////// @@ -534,7 +532,7 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_VertexOffset(PrimitiveTo extern "C" RENDERDOC_API ReplaySupport RENDERDOC_CC RENDERDOC_SupportLocalReplay( const char *logfile, rdctype::str *driverName, rdctype::str *recordMachineIdent); -extern "C" RENDERDOC_API ReplayCreateStatus RENDERDOC_CC +extern "C" RENDERDOC_API ReplayStatus RENDERDOC_CC RENDERDOC_CreateReplayRenderer(const char *logfile, float *progress, IReplayRenderer **rend); ////////////////////////////////////////////////////////////////////////// @@ -551,7 +549,7 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets( ////////////////////////////////////////////////////////////////////////// extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_GetDefaultRemoteServerPort(); -extern "C" RENDERDOC_API ReplayCreateStatus RENDERDOC_CC +extern "C" RENDERDOC_API ReplayStatus RENDERDOC_CC RENDERDOC_CreateRemoteServerConnection(const char *host, uint32_t port, IRemoteServer **rend); extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_BecomeRemoteServer(const char *listenhost, uint32_t port, @@ -578,8 +576,9 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_EndSelfHostCapture(const ch // Vulkan layer handling ////////////////////////////////////////////////////////////////////////// -extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_NeedVulkanLayerRegistration( - uint32_t *flags, rdctype::array *myJSONs, rdctype::array *otherJSONs); +extern "C" RENDERDOC_API bool RENDERDOC_CC +RENDERDOC_NeedVulkanLayerRegistration(VulkanLayerFlags *flags, rdctype::array *myJSONs, + rdctype::array *otherJSONs); extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_UpdateVulkanLayerRegistration(bool systemLevel); ////////////////////////////////////////////////////////////////////////// @@ -591,9 +590,9 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_TriggerExceptionHandler(voi extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetDebugLogFile(const char *filename); extern "C" RENDERDOC_API const char *RENDERDOC_CC RENDERDOC_GetLogFile(); extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogText(const char *text); -extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogMessage(LogMessageType type, - const char *project, const char *file, - unsigned int line, const char *text); +extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogMessage(LogType type, const char *project, + const char *file, unsigned int line, + const char *text); extern "C" RENDERDOC_API bool32 RENDERDOC_CC RENDERDOC_GetThumbnail(const char *filename, FileType type, uint32_t maxsize, rdctype::array *buf); @@ -606,8 +605,7 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetConfigSetting(const char extern "C" RENDERDOC_API void *RENDERDOC_CC RENDERDOC_MakeEnvironmentModificationList(int numElems); extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetEnvironmentModification( - void *mem, int idx, const char *variable, const char *value, EnvironmentModificationType type, - EnvironmentSeparator separator); + void *mem, int idx, const char *variable, const char *value, EnvMod type, EnvSep separator); extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_FreeEnvironmentModificationList(void *mem); diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index d38e31eaf..b15ff9a34 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -25,590 +25,825 @@ #pragma once -enum DirectoryFileProperty -{ - eFileProp_Directory = 0x1, - eFileProp_Hidden = 0x2, - eFileProp_Executable = 0x4, +#ifdef NO_ENUM_CLASS_OPERATORS - eFileProp_ErrorUnknown = 0x2000, - eFileProp_ErrorAccessDenied = 0x4000, - eFileProp_ErrorInvalidPath = 0x8000, +#define BITMASK_OPERATORS(a) +#define ITERABLE_OPERATORS(a) + +#else + +#include + +// helper template that allows the result of & to be cast back to the enum or explicitly cast to +// bool for use in if() or ?: or so on or compared against 0. +// +// If you get an error about missing operator then you're probably doing something like +// (bitfield & value) == 0 or (bitfield & value) != 0 or similar. Instead prefer: +// !(bitfield & value) or (bitfield & value) to make use of the bool cast directly +template +struct EnumCastHelper +{ +public: + constexpr EnumCastHelper(enum_name v) : val(v) {} + constexpr operator enum_name() const { return val; } + constexpr explicit operator bool() const + { + typedef typename std::underlying_type::type etype; + return etype(val) != 0; + } + +private: + const enum_name val; }; +// helper templates for iterating over all values in an enum that has sequential values and is +// to be used for array indices or something like that. +template +struct ValueIterContainer +{ + struct ValueIter + { + ValueIter(enum_name v) : val(v) {} + enum_name val; + enum_name operator*() const { return val; } + bool operator!=(const ValueIter &it) const { return !(val == *it); } + const inline enum_name operator++() + { + ++val; + return val; + } + }; + + ValueIter begin() { return ValueIter(enum_name::First); } + ValueIter end() { return ValueIter(enum_name::Count); } +}; + +template +struct IndexIterContainer +{ + typedef typename std::underlying_type::type etype; + + struct IndexIter + { + IndexIter(enum_name v) : val(v) {} + enum_name val; + etype operator*() const { return etype(val); } + bool operator!=(const IndexIter &it) const { return !(val == it.val); } + const inline enum_name operator++() + { + ++val; + return val; + } + }; + + IndexIter begin() { return IndexIter(enum_name::First); } + IndexIter end() { return IndexIter(enum_name::Count); } +}; + +template +constexpr inline ValueIterContainer values() +{ + return ValueIterContainer(); +}; + +template +constexpr inline IndexIterContainer indices() +{ + return IndexIterContainer(); +}; + +template +constexpr inline size_t arraydim() +{ + typedef typename std::underlying_type::type etype; + return (size_t)etype(enum_name::Count); +}; + +// clang-format makes a even more of a mess of this multi-line macro than it usually does, for some +// reason. So we just disable it since it's still readable and this isn't really the intended case +// we are using clang-format for. + +// clang-format off +#define BITMASK_OPERATORS(enum_name) \ + \ +constexpr inline enum_name operator|(enum_name a, enum_name b) \ +{ \ + typedef typename std::underlying_type::type etype; \ + return enum_name(etype(a) | etype(b)); \ +} \ + \ +constexpr inline EnumCastHelper operator&(enum_name a, enum_name b) \ +{ \ + typedef typename std::underlying_type::type etype; \ + return EnumCastHelper(enum_name(etype(a) & etype(b))); \ +} \ + \ +constexpr inline enum_name operator~(enum_name a) \ +{ \ + typedef typename std::underlying_type::type etype; \ + return enum_name(~etype(a)); \ +} \ + \ +inline enum_name &operator|=(enum_name &a, enum_name b) \ +{ return a = a | b; } \ + \ +inline enum_name &operator&=(enum_name &a, enum_name b) \ +{ return a = a & b; } + +#define ITERABLE_OPERATORS(enum_name) \ + \ +inline enum_name operator++(enum_name &a) \ +{ \ + typedef typename std::underlying_type::type etype; \ + return a = enum_name(etype(a)+1); \ +} +// clang-format on + +#endif + +#define ENUM_ARRAY_SIZE(enum_name) size_t(enum_name::Count) + +enum class FileProperty : uint32_t +{ + NoFlags = 0x0, + Directory = 0x1, + Hidden = 0x2, + Executable = 0x4, + + ErrorUnknown = 0x2000, + ErrorAccessDenied = 0x4000, + ErrorInvalidPath = 0x8000, +}; + +BITMASK_OPERATORS(FileProperty); + // replay_shader.h -enum VarType +enum class VarType : uint32_t { - eVar_Unknown = -1, - eVar_Float = 0, - eVar_Int, - eVar_UInt, - eVar_Double, + Float = 0, + Int, + UInt, + Double, + Unknown = ~0U, }; -enum FormatComponentType +enum class CompType : uint32_t { - eCompType_None = 0, - eCompType_Float, - eCompType_UNorm, - eCompType_SNorm, - eCompType_UInt, - eCompType_SInt, - eCompType_UScaled, - eCompType_SScaled, - eCompType_Depth, - eCompType_Double, + Typeless = 0, + Float, + UNorm, + SNorm, + UInt, + SInt, + UScaled, + SScaled, + Depth, + Double, }; -enum TextureSwizzle +enum class TextureSwizzle : uint32_t { - eSwizzle_Red, - eSwizzle_Green, - eSwizzle_Blue, - eSwizzle_Alpha, - eSwizzle_Zero, - eSwizzle_One, + Red, + Green, + Blue, + Alpha, + Zero, + One, }; -enum ShaderResourceType +enum class TextureDim : uint32_t { - eResType_None, - eResType_Buffer, - eResType_Texture1D, - eResType_Texture1DArray, - eResType_Texture2D, - eResType_TextureRect, - eResType_Texture2DArray, - eResType_Texture2DMS, - eResType_Texture2DMSArray, - eResType_Texture3D, - eResType_TextureCube, - eResType_TextureCubeArray, - eResType_Count, + Unknown, + First = Unknown, + Buffer, + Texture1D, + Texture1DArray, + Texture2D, + TextureRect, + Texture2DArray, + Texture2DMS, + Texture2DMSArray, + Texture3D, + TextureCube, + TextureCubeArray, + Count, }; -enum ShaderBindType +ITERABLE_OPERATORS(TextureDim); + +enum class BindType : uint32_t { - eBindType_Unknown = 0, - eBindType_ConstantBuffer, - eBindType_Sampler, - eBindType_ImageSampler, - eBindType_ReadOnlyImage, - eBindType_ReadWriteImage, - eBindType_ReadOnlyTBuffer, - eBindType_ReadWriteTBuffer, - eBindType_ReadOnlyBuffer, - eBindType_ReadWriteBuffer, - eBindType_InputAttachment, + Unknown = 0, + ConstantBuffer, + Sampler, + ImageSampler, + ReadOnlyImage, + ReadWriteImage, + ReadOnlyTBuffer, + ReadWriteTBuffer, + ReadOnlyBuffer, + ReadWriteBuffer, + InputAttachment, }; -enum SystemAttribute +enum class ShaderBuiltin : uint32_t { - eAttr_None = 0, - eAttr_Position, - eAttr_PointSize, - eAttr_ClipDistance, - eAttr_CullDistance, - eAttr_RTIndex, - eAttr_ViewportIndex, - eAttr_VertexIndex, - eAttr_PrimitiveIndex, - eAttr_InstanceIndex, - eAttr_InvocationIndex, - eAttr_DispatchSize, - eAttr_DispatchThreadIndex, - eAttr_GroupIndex, - eAttr_GroupFlatIndex, - eAttr_GroupThreadIndex, - eAttr_GSInstanceIndex, - eAttr_OutputControlPointIndex, - eAttr_DomainLocation, - eAttr_IsFrontFace, - eAttr_MSAACoverage, - eAttr_MSAASamplePosition, - eAttr_MSAASampleIndex, - eAttr_PatchNumVertices, - eAttr_OuterTessFactor, - eAttr_InsideTessFactor, - eAttr_ColourOutput, - eAttr_DepthOutput, - eAttr_DepthOutputGreaterEqual, - eAttr_DepthOutputLessEqual, + Undefined = 0, + Position, + PointSize, + ClipDistance, + CullDistance, + RTIndex, + ViewportIndex, + VertexIndex, + PrimitiveIndex, + InstanceIndex, + InvocationIndex, + DispatchSize, + DispatchThreadIndex, + GroupIndex, + GroupFlatIndex, + GroupThreadIndex, + GSInstanceIndex, + OutputControlPointIndex, + DomainLocation, + IsFrontFace, + MSAACoverage, + MSAASamplePosition, + MSAASampleIndex, + PatchNumVertices, + OuterTessFactor, + InsideTessFactor, + ColourOutput, + DepthOutput, + DepthOutputGreaterEqual, + DepthOutputLessEqual, }; // replay_render.h -enum OutputType +enum class ReplayOutputType : uint32_t { - eOutputType_None = 0, - eOutputType_TexDisplay, - eOutputType_MeshDisplay, + Headless = 0, + Texture, + Mesh, }; -enum MeshDataStage +enum class MeshDataStage : uint32_t { - eMeshDataStage_Unknown = 0, - eMeshDataStage_VSIn, - eMeshDataStage_VSOut, - eMeshDataStage_GSOut, + Unknown = 0, + VSIn, + VSOut, + GSOut, }; -enum TextureDisplayOverlay +enum class DebugOverlay : uint32_t { - eTexOverlay_None = 0, - eTexOverlay_Drawcall, - eTexOverlay_Wireframe, - eTexOverlay_Depth, - eTexOverlay_Stencil, - eTexOverlay_BackfaceCull, - eTexOverlay_ViewportScissor, - eTexOverlay_NaN, - eTexOverlay_Clipping, - eTexOverlay_ClearBeforePass, - eTexOverlay_ClearBeforeDraw, - eTexOverlay_QuadOverdrawPass, - eTexOverlay_QuadOverdrawDraw, - eTexOverlay_TriangleSizePass, - eTexOverlay_TriangleSizeDraw, + NoOverlay = 0, + Drawcall, + Wireframe, + Depth, + Stencil, + BackfaceCull, + ViewportScissor, + NaN, + Clipping, + ClearBeforePass, + ClearBeforeDraw, + QuadOverdrawPass, + QuadOverdrawDraw, + TriangleSizePass, + TriangleSizeDraw, }; -enum FileType +enum class FileType : uint32_t { - eFileType_DDS, - eFileType_PNG, - eFileType_JPG, - eFileType_BMP, - eFileType_TGA, - eFileType_HDR, - eFileType_EXR, - eFileType_Count, + DDS, + First = DDS, + PNG, + JPG, + BMP, + TGA, + HDR, + EXR, + Count, }; -enum AlphaMapping +ITERABLE_OPERATORS(FileType); + +enum class AlphaMapping : uint32_t { - eAlphaMap_Discard, - eAlphaMap_BlendToColour, - eAlphaMap_BlendToCheckerboard, - eAlphaMap_Preserve, - eAlphaMap_Count, + Discard, + First = Discard, + BlendToColour, + BlendToCheckerboard, + Preserve, + Count, }; -enum SpecialFormat +ITERABLE_OPERATORS(AlphaMapping); + +enum class SpecialFormat : uint32_t { - eSpecial_Unknown = 0, - eSpecial_BC1, - eSpecial_BC2, - eSpecial_BC3, - eSpecial_BC4, - eSpecial_BC5, - eSpecial_BC6, - eSpecial_BC7, - eSpecial_ETC2, - eSpecial_EAC, - eSpecial_ASTC, - eSpecial_R10G10B10A2, - eSpecial_R11G11B10, - eSpecial_R5G6B5, - eSpecial_R5G5B5A1, - eSpecial_R9G9B9E5, - eSpecial_R4G4B4A4, - eSpecial_R4G4, - eSpecial_D16S8, - eSpecial_D24S8, - eSpecial_D32S8, - eSpecial_S8, - eSpecial_YUV, + Unknown = 0, + BC1, + BC2, + BC3, + BC4, + BC5, + BC6, + BC7, + ETC2, + EAC, + ASTC, + R10G10B10A2, + R11G11B10, + R5G6B5, + R5G5B5A1, + R9G9B9E5, + R4G4B4A4, + R4G4, + D16S8, + D24S8, + D32S8, + S8, + YUV, }; -enum QualityHint +enum class QualityHint : uint32_t { - eQuality_DontCare, - eQuality_Nicest, - eQuality_Fastest, + DontCare, + Nicest, + Fastest, }; -enum GraphicsAPI +enum class GraphicsAPI : uint32_t { - eGraphicsAPI_D3D11, - eGraphicsAPI_D3D12, - eGraphicsAPI_OpenGL, - eGraphicsAPI_Vulkan, + D3D11, + D3D12, + OpenGL, + Vulkan, }; -inline bool IsD3D(GraphicsAPI api) +constexpr inline bool IsD3D(GraphicsAPI api) { - return api == eGraphicsAPI_D3D11 || api == eGraphicsAPI_D3D12; + return api == GraphicsAPI::D3D11 || api == GraphicsAPI::D3D12; } -enum PrimitiveTopology +enum class Topology : uint32_t { - eTopology_Unknown, - eTopology_PointList, - eTopology_LineList, - eTopology_LineStrip, - eTopology_LineLoop, - eTopology_TriangleList, - eTopology_TriangleStrip, - eTopology_TriangleFan, - eTopology_LineList_Adj, - eTopology_LineStrip_Adj, - eTopology_TriangleList_Adj, - eTopology_TriangleStrip_Adj, - eTopology_PatchList, - eTopology_PatchList_1CPs = eTopology_PatchList, - eTopology_PatchList_2CPs, - eTopology_PatchList_3CPs, - eTopology_PatchList_4CPs, - eTopology_PatchList_5CPs, - eTopology_PatchList_6CPs, - eTopology_PatchList_7CPs, - eTopology_PatchList_8CPs, - eTopology_PatchList_9CPs, - eTopology_PatchList_10CPs, - eTopology_PatchList_11CPs, - eTopology_PatchList_12CPs, - eTopology_PatchList_13CPs, - eTopology_PatchList_14CPs, - eTopology_PatchList_15CPs, - eTopology_PatchList_16CPs, - eTopology_PatchList_17CPs, - eTopology_PatchList_18CPs, - eTopology_PatchList_19CPs, - eTopology_PatchList_20CPs, - eTopology_PatchList_21CPs, - eTopology_PatchList_22CPs, - eTopology_PatchList_23CPs, - eTopology_PatchList_24CPs, - eTopology_PatchList_25CPs, - eTopology_PatchList_26CPs, - eTopology_PatchList_27CPs, - eTopology_PatchList_28CPs, - eTopology_PatchList_29CPs, - eTopology_PatchList_30CPs, - eTopology_PatchList_31CPs, - eTopology_PatchList_32CPs, + Unknown, + PointList, + LineList, + LineStrip, + LineLoop, + TriangleList, + TriangleStrip, + TriangleFan, + LineList_Adj, + LineStrip_Adj, + TriangleList_Adj, + TriangleStrip_Adj, + PatchList, + PatchList_1CPs = PatchList, + PatchList_2CPs, + PatchList_3CPs, + PatchList_4CPs, + PatchList_5CPs, + PatchList_6CPs, + PatchList_7CPs, + PatchList_8CPs, + PatchList_9CPs, + PatchList_10CPs, + PatchList_11CPs, + PatchList_12CPs, + PatchList_13CPs, + PatchList_14CPs, + PatchList_15CPs, + PatchList_16CPs, + PatchList_17CPs, + PatchList_18CPs, + PatchList_19CPs, + PatchList_20CPs, + PatchList_21CPs, + PatchList_22CPs, + PatchList_23CPs, + PatchList_24CPs, + PatchList_25CPs, + PatchList_26CPs, + PatchList_27CPs, + PatchList_28CPs, + PatchList_29CPs, + PatchList_30CPs, + PatchList_31CPs, + PatchList_32CPs, }; -enum BufferCreationFlags +constexpr inline Topology PatchList_Topology(uint32_t N) { - eBufferCreate_VB = 0x1, - eBufferCreate_IB = 0x2, - eBufferCreate_CB = 0x4, - eBufferCreate_UAV = 0x8, - eBufferCreate_Indirect = 0x10, + return (N < 1 || N > 32) ? Topology::PatchList_1CPs + : Topology(uint32_t(Topology::PatchList_1CPs) + N - 1); +} + +constexpr inline uint32_t PatchList_Count(Topology t) +{ + return uint32_t(t) < uint32_t(Topology::PatchList_1CPs) + ? 0 + : uint32_t(t) - uint32_t(Topology::PatchList_1CPs); +} + +enum class BufferCategory : uint32_t +{ + NoFlags = 0x0, + Vertex = 0x1, + Index = 0x2, + Constants = 0x4, + ReadWrite = 0x8, + Indirect = 0x10, }; -enum TextureCreationFlags +BITMASK_OPERATORS(BufferCategory); + +enum class D3DBufferViewFlags : uint32_t { - eTextureCreate_SRV = 0x1, - eTextureCreate_RTV = 0x2, - eTextureCreate_DSV = 0x4, - eTextureCreate_UAV = 0x8, - eTextureCreate_SwapBuffer = 0x10, + NoFlags = 0x0, + Raw = 0x1, + Append = 0x2, + Counter = 0x4, }; -enum ShaderStageType +BITMASK_OPERATORS(D3DBufferViewFlags); + +enum class TextureCategory : uint32_t { - eShaderStage_Vertex = 0, - eShaderStage_First = eShaderStage_Vertex, - - eShaderStage_Hull, - eShaderStage_Tess_Control = eShaderStage_Hull, - - eShaderStage_Domain, - eShaderStage_Tess_Eval = eShaderStage_Domain, - - eShaderStage_Geometry, - - eShaderStage_Pixel, - eShaderStage_Fragment = eShaderStage_Pixel, - - eShaderStage_Compute, - - eShaderStage_Count, + NoFlags = 0x0, + ShaderRead = 0x1, + ColorTarget = 0x2, + DepthTarget = 0x4, + ShaderReadWrite = 0x8, + SwapBuffer = 0x10, }; -enum ShaderStageBits +BITMASK_OPERATORS(TextureCategory); + +enum class ShaderStage : uint32_t { - eStageBits_None = 0, - eStageBits_Vertex = 1 << eShaderStage_Vertex, - eStageBits_Hull = 1 << eShaderStage_Hull, - eStageBits_Tess_Control = 1 << eShaderStage_Tess_Control, - eStageBits_Domain = 1 << eShaderStage_Domain, - eStageBits_Tess_Eval = 1 << eShaderStage_Tess_Eval, - eStageBits_Geometry = 1 << eShaderStage_Geometry, - eStageBits_Pixel = 1 << eShaderStage_Pixel, - eStageBits_Fragment = 1 << eShaderStage_Fragment, - eStageBits_Compute = 1 << eShaderStage_Compute, - eStageBits_All = eStageBits_Vertex | eStageBits_Hull | eStageBits_Domain | eStageBits_Geometry | - eStageBits_Pixel | - eStageBits_Compute, + Vertex = 0, + First = Vertex, + + Hull, + Tess_Control = Hull, + + Domain, + Tess_Eval = Domain, + + Geometry, + + Pixel, + Fragment = Pixel, + + Compute, + + Count, }; -enum ShaderDebugStateFlags +ITERABLE_OPERATORS(ShaderStage); + +template +constexpr inline ShaderStage StageFromIndex(integer stage) { - eShaderDbg_None = 0, - eShaderDbg_SampleLoadGather = 0x1, - eShaderDbg_GeneratedNanOrInf = 0x2, + return ShaderStage(stage); +} + +enum class ShaderStageMask : uint32_t +{ + Unknown = 0, + Vertex = 1 << uint32_t(ShaderStage::Vertex), + Hull = 1 << uint32_t(ShaderStage::Hull), + Tess_Control = Hull, + Domain = 1 << uint32_t(ShaderStage::Domain), + Tess_Eval = Domain, + Geometry = 1 << uint32_t(ShaderStage::Geometry), + Pixel = 1 << uint32_t(ShaderStage::Pixel), + Fragment = Pixel, + Compute = 1 << uint32_t(ShaderStage::Compute), + All = Vertex | Hull | Domain | Geometry | Pixel | Compute, }; -enum DebugMessageCategory +BITMASK_OPERATORS(ShaderStageMask); + +constexpr inline ShaderStageMask MaskForStage(ShaderStage stage) { - eDbgCategory_Application_Defined = 0, - eDbgCategory_Miscellaneous, - eDbgCategory_Initialization, - eDbgCategory_Cleanup, - eDbgCategory_Compilation, - eDbgCategory_State_Creation, - eDbgCategory_State_Setting, - eDbgCategory_State_Getting, - eDbgCategory_Resource_Manipulation, - eDbgCategory_Execution, - eDbgCategory_Shaders, - eDbgCategory_Deprecated, - eDbgCategory_Undefined, - eDbgCategory_Portability, - eDbgCategory_Performance, + return ShaderStageMask(1 << uint32_t(stage)); +} + +enum class ShaderEvents : uint32_t +{ + NoEvent = 0, + SampleLoadGather = 0x1, + GeneratedNanOrInf = 0x2, }; -enum DebugMessageSeverity +BITMASK_OPERATORS(ShaderEvents); + +enum class MessageCategory : uint32_t { - eDbgSeverity_High = 0, - eDbgSeverity_Medium, - eDbgSeverity_Low, - eDbgSeverity_Info, + Application_Defined = 0, + Miscellaneous, + Initialization, + Cleanup, + Compilation, + State_Creation, + State_Setting, + State_Getting, + Resource_Manipulation, + Execution, + Shaders, + Deprecated, + Undefined, + Portability, + Performance, }; -enum DebugMessageSource +enum class MessageSeverity : uint32_t { - eDbgSource_API = 0, - eDbgSource_RedundantAPIUse, - eDbgSource_IncorrectAPIUse, - eDbgSource_GeneralPerformance, - eDbgSource_GCNPerformance, - eDbgSource_RuntimeWarning, - eDbgSoruce_UnsupportedConfiguration, + High = 0, + Medium, + Low, + Info, }; -enum ResourceUsage +enum class MessageSource : uint32_t { - eUsage_None, - - eUsage_VertexBuffer, - eUsage_IndexBuffer, - - eUsage_VS_Constants, - eUsage_HS_Constants, - eUsage_DS_Constants, - eUsage_GS_Constants, - eUsage_PS_Constants, - eUsage_CS_Constants, - - eUsage_All_Constants, - - eUsage_SO, - - eUsage_VS_Resource, - eUsage_HS_Resource, - eUsage_DS_Resource, - eUsage_GS_Resource, - eUsage_PS_Resource, - eUsage_CS_Resource, - - eUsage_All_Resource, - - eUsage_VS_RWResource, - eUsage_HS_RWResource, - eUsage_DS_RWResource, - eUsage_GS_RWResource, - eUsage_PS_RWResource, - eUsage_CS_RWResource, - - eUsage_All_RWResource, - - eUsage_InputTarget, - eUsage_ColourTarget, - eUsage_DepthStencilTarget, - - eUsage_Indirect, - - eUsage_Clear, - - eUsage_GenMips, - eUsage_Resolve, - eUsage_ResolveSrc, - eUsage_ResolveDst, - eUsage_Copy, - eUsage_CopySrc, - eUsage_CopyDst, - - eUsage_Barrier, + API = 0, + RedundantAPIUse, + IncorrectAPIUse, + GeneralPerformance, + GCNPerformance, + RuntimeWarning, + UnsupportedConfiguration, }; -enum DrawcallFlags +enum class ResourceUsage : uint32_t { + Unused, + + VertexBuffer, + IndexBuffer, + + VS_Constants, + HS_Constants, + DS_Constants, + GS_Constants, + PS_Constants, + CS_Constants, + + All_Constants, + + StreamOut, + + VS_Resource, + HS_Resource, + DS_Resource, + GS_Resource, + PS_Resource, + CS_Resource, + + All_Resource, + + VS_RWResource, + HS_RWResource, + DS_RWResource, + GS_RWResource, + PS_RWResource, + CS_RWResource, + + All_RWResource, + + InputTarget, + ColourTarget, + DepthStencilTarget, + + Indirect, + + Clear, + + GenMips, + Resolve, + ResolveSrc, + ResolveDst, + Copy, + CopySrc, + CopyDst, + + Barrier, +}; + +template +constexpr inline ResourceUsage CBUsage(integer stage) +{ + return ResourceUsage(uint32_t(ResourceUsage::VS_Constants) + stage); +} + +constexpr inline ResourceUsage CBUsage(ShaderStage stage) +{ + return CBUsage(uint32_t(stage)); +} + +template +constexpr inline ResourceUsage ResUsage(integer stage) +{ + return ResourceUsage(uint32_t(ResourceUsage::VS_Resource) + stage); +} + +constexpr inline ResourceUsage ResUsage(ShaderStage stage) +{ + return ResUsage(uint32_t(stage)); +} + +template +constexpr inline ResourceUsage RWResUsage(integer stage) +{ + return ResourceUsage(uint32_t(ResourceUsage::VS_RWResource) + stage); +} + +constexpr inline ResourceUsage RWResUsage(ShaderStage stage) +{ + return RWResUsage(uint32_t(stage)); +} + +enum class DrawFlags : uint32_t +{ + NoFlags = 0x0000, + // types - eDraw_Clear = 0x0001, - eDraw_Drawcall = 0x0002, - eDraw_Dispatch = 0x0004, - eDraw_CmdList = 0x0008, - eDraw_SetMarker = 0x0010, - eDraw_PushMarker = 0x0020, - eDraw_PopMarker = 0x0040, // this is only for internal tracking use - eDraw_Present = 0x0080, - eDraw_MultiDraw = 0x0100, - eDraw_Copy = 0x0200, - eDraw_Resolve = 0x0400, - eDraw_GenMips = 0x0800, - eDraw_PassBoundary = 0x1000, + Clear = 0x0001, + Drawcall = 0x0002, + Dispatch = 0x0004, + CmdList = 0x0008, + SetMarker = 0x0010, + PushMarker = 0x0020, + PopMarker = 0x0040, // this is only for internal tracking use + Present = 0x0080, + MultiDraw = 0x0100, + Copy = 0x0200, + Resolve = 0x0400, + GenMips = 0x0800, + PassBoundary = 0x1000, // flags - eDraw_UseIBuffer = 0x010000, - eDraw_Instanced = 0x020000, - eDraw_Auto = 0x040000, - eDraw_Indirect = 0x080000, - eDraw_ClearColour = 0x100000, - eDraw_ClearDepthStencil = 0x200000, - eDraw_BeginPass = 0x400000, - eDraw_EndPass = 0x800000, - eDraw_APICalls = 0x1000000, + UseIBuffer = 0x010000, + Instanced = 0x020000, + Auto = 0x040000, + Indirect = 0x080000, + ClearColour = 0x100000, + ClearDepthStencil = 0x200000, + BeginPass = 0x400000, + EndPass = 0x800000, + APICalls = 0x1000000, }; -enum SolidShadeMode +BITMASK_OPERATORS(DrawFlags); + +enum class SolidShade : uint32_t { - eShade_None = 0, - eShade_Solid, - eShade_Lit, - eShade_Secondary, - eShade_Count, + NoSolid = 0, + Solid, + Lit, + Secondary, + Count, }; -enum TriangleFillMode +enum class FillMode : uint32_t { - eFill_Solid = 0, - eFill_Wireframe, - eFill_Point, + Solid = 0, + Wireframe, + Point, }; -enum TriangleCullMode +enum class CullMode : uint32_t { - eCull_None = 0, - eCull_Front, - eCull_Back, - eCull_FrontAndBack, + NoCull = 0, + Front, + Back, + FrontAndBack, }; -enum GPUCounters +enum class GPUCounter : uint32_t { - eCounter_FirstGeneric = 1, - eCounter_EventGPUDuration = eCounter_FirstGeneric, - eCounter_InputVerticesRead, - eCounter_IAPrimitives, - eCounter_GSPrimitives, - eCounter_RasterizerInvocations, - eCounter_RasterizedPrimitives, - eCounter_SamplesWritten, - eCounter_VSInvocations, - eCounter_HSInvocations, - eCounter_TCSInvocations = eCounter_HSInvocations, - eCounter_DSInvocations, - eCounter_TESInvocations = eCounter_DSInvocations, - eCounter_GSInvocations, - eCounter_PSInvocations, - eCounter_CSInvocations, - eCounter_GLMaxCounters, + EventGPUDuration = 1, + First = EventGPUDuration, + InputVerticesRead, + IAPrimitives, + GSPrimitives, + RasterizerInvocations, + RasterizedPrimitives, + SamplesWritten, + VSInvocations, + HSInvocations, + TCSInvocations = HSInvocations, + DSInvocations, + TESInvocations = DSInvocations, + GSInvocations, + PSInvocations, + FSInvocations = PSInvocations, + CSInvocations, + Count, // IHV specific counters can be set above this point // with ranges reserved for each IHV - eCounter_FirstAMD = 1000000, + FirstAMD = 1000000, - eCounter_FirstIntel = 2000000, + FirstIntel = 2000000, - eCounter_FirstNvidia = 3000000, + FirstNvidia = 3000000, }; -enum CounterUnits +ITERABLE_OPERATORS(GPUCounter); + +enum class CounterUnit : uint32_t { - eUnits_Absolute, - eUnits_Seconds, - eUnits_Percentage, + Absolute, + Seconds, + Percentage, }; -enum ReplaySupport +enum class ReplaySupport : uint32_t { - eReplaySupport_Unsupported, - eReplaySupport_Supported, - eReplaySupport_SuggestRemote, + Unsupported, + Supported, + SuggestRemote, }; -enum ReplayCreateStatus +enum class ReplayStatus : uint32_t { - eReplayCreate_Success = 0, - eReplayCreate_UnknownError, - eReplayCreate_InternalError, - eReplayCreate_FileNotFound, - eReplayCreate_InjectionFailed, - eReplayCreate_IncompatibleProcess, - eReplayCreate_NetworkIOFailed, - eReplayCreate_NetworkRemoteBusy, - eReplayCreate_NetworkVersionMismatch, - eReplayCreate_FileIOFailed, - eReplayCreate_FileIncompatibleVersion, - eReplayCreate_FileCorrupted, - eReplayCreate_ImageUnsupported, - eReplayCreate_APIUnsupported, - eReplayCreate_APIInitFailed, - eReplayCreate_APIIncompatibleVersion, - eReplayCreate_APIHardwareUnsupported, + Succeeded = 0, + UnknownError, + InternalError, + FileNotFound, + InjectionFailed, + IncompatibleProcess, + NetworkIOFailed, + NetworkRemoteBusy, + NetworkVersionMismatch, + FileIOFailed, + FileIncompatibleVersion, + FileCorrupted, + ImageUnsupported, + APIUnsupported, + APIInitFailed, + APIIncompatibleVersion, + APIHardwareUnsupported, }; -enum TargetControlMessageType +enum class TargetControlMessageType : uint32_t { - eTargetControlMsg_Unknown = 0, - eTargetControlMsg_Disconnected, - eTargetControlMsg_Busy, - eTargetControlMsg_Noop, - eTargetControlMsg_NewCapture, - eTargetControlMsg_CaptureCopied, - eTargetControlMsg_RegisterAPI, - eTargetControlMsg_NewChild, + Unknown = 0, + Disconnected, + Busy, + Noop, + NewCapture, + CaptureCopied, + RegisterAPI, + NewChild, }; -enum EnvironmentModificationType +enum class EnvMod : uint32_t { - eEnvMod_Set, - eEnvMod_Append, - eEnvMod_Prepend, + Set, + Append, + Prepend, }; -enum EnvironmentSeparator +enum class EnvSep : uint32_t { - eEnvSep_Platform, - eEnvSep_SemiColon, - eEnvSep_Colon, - eEnvSep_None, + Platform, + SemiColon, + Colon, + NoSep, }; -// matches enum in common.h -enum LogMessageType +enum class LogType : int32_t { - eLogType_First = -1, - eLogType_Debug, - eLogType_Comment, - eLogType_Warning, - eLogType_Error, - eLogType_Fatal, - eLogType_NumTypes, + Debug, + Comment, + Warning, + Error, + Fatal, + Count, }; -enum VulkanFlags +enum class VulkanLayerFlags : uint32_t { - eVulkan_OtherInstallsRegistered = 0x1, - eVulkan_ThisInstallRegistered = 0x2, - eVulkan_NeedElevation = 0x4, - eVulkan_CouldElevate = 0x8, - eVulkan_RegisterAll = 0x10, - eVulkan_UpdateAllowed = 0x20, - eVulkan_Unfixable = 0x40, + NoFlags = 0x0, + OtherInstallsRegistered = 0x1, + ThisInstallRegistered = 0x2, + NeedElevation = 0x4, + CouldElevate = 0x8, + RegisterAll = 0x10, + UpdateAllowed = 0x20, + Unfixable = 0x40, }; + +BITMASK_OPERATORS(VulkanLayerFlags); \ No newline at end of file diff --git a/renderdoc/api/replay/shader_types.h b/renderdoc/api/replay/shader_types.h index f218c8635..98df2c303 100644 --- a/renderdoc/api/replay/shader_types.h +++ b/renderdoc/api/replay/shader_types.h @@ -39,7 +39,7 @@ struct ShaderVariable name = ""; rows = columns = 0; displayAsHex = isStruct = false; - type = eVar_Float; + type = VarType::Float; for(int i = 0; i < 16; i++) value.uv[i] = 0; } @@ -51,7 +51,7 @@ struct ShaderVariable displayAsHex = isStruct = false; for(int i = 0; i < 16; i++) value.uv[i] = 0; - type = eVar_Float; + type = VarType::Float; value.f.x = x; value.f.y = y; value.f.z = z; @@ -65,7 +65,7 @@ struct ShaderVariable displayAsHex = isStruct = false; for(int i = 0; i < 16; i++) value.uv[i] = 0; - type = eVar_Int; + type = VarType::Int; value.i.x = x; value.i.y = y; value.i.z = z; @@ -79,7 +79,7 @@ struct ShaderVariable displayAsHex = isStruct = false; for(int i = 0; i < 16; i++) value.uv[i] = 0; - type = eVar_UInt; + type = VarType::UInt; value.u.x = x; value.u.y = y; value.u.z = z; @@ -133,7 +133,7 @@ struct ShaderDebugState rdctype::array > indexableTemps; uint32_t nextInstruction; - uint32_t flags; + ShaderEvents flags; }; struct ShaderDebugTrace @@ -150,8 +150,8 @@ struct SigParameter : semanticIndex(0), needSemanticIndex(false), regIndex(0), - systemValue(eAttr_None), - compType(eCompType_Float), + systemValue(ShaderBuiltin::Undefined), + compType(CompType::Float), regChannelMask(0), channelUsedMask(0), compCount(0), @@ -168,9 +168,9 @@ struct SigParameter bool32 needSemanticIndex; uint32_t regIndex; - SystemAttribute systemValue; + ShaderBuiltin systemValue; - FormatComponentType compType; + CompType compType; uint8_t regChannelMask; uint8_t channelUsedMask; @@ -225,7 +225,7 @@ struct ShaderResource bool32 IsTexture; bool32 IsSRV; - ShaderResourceType resType; + TextureDim resType; rdctype::str name; ShaderVariableType variableType; diff --git a/renderdoc/api/replay/vk_pipestate.h b/renderdoc/api/replay/vk_pipestate.h index c33fe4b54..ba0e76d77 100644 --- a/renderdoc/api/replay/vk_pipestate.h +++ b/renderdoc/api/replay/vk_pipestate.h @@ -40,8 +40,8 @@ struct VulkanPipelineState struct DescriptorBinding { uint32_t descriptorCount; - ShaderBindType type; - ShaderStageBits stageFlags; + BindType type; + ShaderStageMask stageFlags; struct BindingElement { @@ -60,10 +60,10 @@ struct VulkanPipelineState borderEnable(false), unnormalized(false) { - swizzle[0] = eSwizzle_Red; - swizzle[1] = eSwizzle_Green; - swizzle[2] = eSwizzle_Blue; - swizzle[3] = eSwizzle_Alpha; + swizzle[0] = TextureSwizzle::Red; + swizzle[1] = TextureSwizzle::Green; + swizzle[2] = TextureSwizzle::Blue; + swizzle[3] = TextureSwizzle::Alpha; } ResourceId view; // bufferview, imageview, attachmentview @@ -151,10 +151,10 @@ struct VulkanPipelineState rdctype::array vbuffers; } VI; - struct ShaderStage + struct Shader { - ShaderStage() : Shader(), customName(false), ShaderDetails(NULL), stage(eShaderStage_Vertex) {} - ResourceId Shader; + Shader() : Object(), customName(false), ShaderDetails(NULL), stage(ShaderStage::Vertex) {} + ResourceId Object; rdctype::str entryPoint; rdctype::str ShaderName; @@ -166,7 +166,7 @@ struct VulkanPipelineState // and the descriptor set and binding that they use ShaderBindpointMapping BindpointMapping; - ShaderStageType stage; + ShaderStage stage; struct SpecInfo { @@ -209,8 +209,8 @@ struct VulkanPipelineState : depthClampEnable(false), rasterizerDiscardEnable(false), FrontCCW(false), - FillMode(eFill_Solid), - CullMode(eCull_None), + fillMode(FillMode::Solid), + cullMode(CullMode::NoCull), depthBias(0), depthBiasClamp(0), slopeScaledDepthBias(0), @@ -219,8 +219,8 @@ struct VulkanPipelineState } bool32 depthClampEnable, rasterizerDiscardEnable, FrontCCW; - TriangleFillMode FillMode; - TriangleCullMode CullMode; + FillMode fillMode; + CullMode cullMode; // dynamic float depthBias, depthBiasClamp, slopeScaledDepthBias, lineWidth; @@ -322,10 +322,10 @@ struct VulkanPipelineState { Attachment() : baseMip(0), baseLayer(0), numMip(1), numLayer(1) { - swizzle[0] = eSwizzle_Red; - swizzle[1] = eSwizzle_Green; - swizzle[2] = eSwizzle_Blue; - swizzle[3] = eSwizzle_Alpha; + swizzle[0] = TextureSwizzle::Red; + swizzle[1] = TextureSwizzle::Green; + swizzle[2] = TextureSwizzle::Blue; + swizzle[3] = TextureSwizzle::Alpha; } ResourceId view; ResourceId img; diff --git a/renderdoc/common/common.cpp b/renderdoc/common/common.cpp index cb8b2a36f..c050c0d95 100644 --- a/renderdoc/common/common.cpp +++ b/renderdoc/common/common.cpp @@ -81,7 +81,7 @@ float SRGB8_lookuptable[256] = { void rdcassert(const char *msg, const char *file, unsigned int line, const char *func) { - rdclog_int(RDCLog_Error, RDCLOG_PROJECT, file, line, "Assertion failed: %s", msg); + rdclog_int(LogType::Error, RDCLOG_PROJECT, file, line, "Assertion failed: %s", msg); } #if 0 @@ -317,12 +317,12 @@ void rdclogprint_int(LogType type, const char *fullMsg, const char *msg) #endif #if ENABLED(OUTPUT_LOG_TO_STDOUT) // don't output debug messages to stdout/stderr - if(type != RDCLog_Debug && log_output_enabled) + if(type != LogType::Debug && log_output_enabled) OSUtility::WriteOutput(OSUtility::Output_StdOut, msg); #endif #if ENABLED(OUTPUT_LOG_TO_STDERR) // don't output debug messages to stdout/stderr - if(type != RDCLog_Debug && log_output_enabled) + if(type != LogType::Debug && log_output_enabled) OSUtility::WriteOutput(OSUtility::Output_StdErr, msg); #endif #if ENABLED(OUTPUT_LOG_TO_DISK) @@ -340,12 +340,6 @@ static char rdclog_outputBuffer[rdclog_outBufSize + 1]; void rdclog_int(LogType type, const char *project, const char *file, unsigned int line, const char *fmt, ...) { - if(type <= RDCLog_First || type >= RDCLog_NumTypes) - { - RDCFATAL("Unexpected log type"); - return; - } - va_list args; va_start(args, fmt); @@ -361,7 +355,7 @@ void rdclog_int(LogType type, const char *project, const char *file, unsigned in StringFormat::snprintf(location, 63, "% 20s(%4d) - ", loc.c_str(), line); #endif - const char *typestr[RDCLog_NumTypes] = { + const char *typestr[(uint32_t)LogType::Count] = { "Debug ", "Log ", "Warning", "Error ", "Fatal ", }; @@ -374,9 +368,9 @@ void rdclog_int(LogType type, const char *project, const char *file, unsigned in char *output = rdclog_outputBuffer; size_t available = rdclog_outBufSize; - int numWritten = - StringFormat::snprintf(output, available, "% 4s %06u: %s%s%s - ", project, - Process::GetCurrentPID(), timestamp, location, typestr[type]); + int numWritten = StringFormat::snprintf(output, available, "% 4s %06u: %s%s%s - ", project, + Process::GetCurrentPID(), timestamp, location, + typestr[(uint32_t)type]); if(numWritten < 0) { @@ -388,7 +382,7 @@ void rdclog_int(LogType type, const char *project, const char *file, unsigned in available -= numWritten; // -3 is for the " - " after the type. - const char *noPrefixOutput = (output - 3 - (sizeof(typestr[type]) - 1)); + const char *noPrefixOutput = (output - 3 - (sizeof(typestr[(uint32_t)type]) - 1)); numWritten = StringFormat::vsnprintf(output, available, fmt, args); diff --git a/renderdoc/common/common.h b/renderdoc/common/common.h index b4b760fb1..12aae228c 100644 --- a/renderdoc/common/common.h +++ b/renderdoc/common/common.h @@ -28,6 +28,7 @@ #include #include #include +#include "api/replay/replay_enums.h" #include "globalconfig.h" ///////////////////////////////////////////////// @@ -185,28 +186,17 @@ uint64_t Log2Floor(uint64_t value); } while((void)0, 0) #endif -#define RDCUNIMPLEMENTED(...) \ - do \ - { \ - rdclog(RDCLog_Warning, "Unimplemented: " __VA_ARGS__); \ - RDCBREAK(); \ +#define RDCUNIMPLEMENTED(...) \ + do \ + { \ + rdclog(LogType::Warning, "Unimplemented: " __VA_ARGS__); \ + RDCBREAK(); \ } while((void)0, 0) // // Logging // -enum LogType -{ - RDCLog_First = -1, - RDCLog_Debug, - RDCLog_Comment, - RDCLog_Warning, - RDCLog_Error, - RDCLog_Fatal, - RDCLog_NumTypes, -}; - #if ENABLED(STRIP_LOG) #define RDCLOGFILE(fn) \ do \ @@ -275,7 +265,7 @@ void rdclog_closelog(); #define RDCSTOPLOGGING() rdclog_closelog() #if(ENABLED(RDOC_DEVEL) || ENABLED(FORCE_DEBUG_LOGS)) && DISABLED(STRIP_DEBUG_LOGS) -#define RDCDEBUG(...) rdclog(RDCLog_Debug, __VA_ARGS__) +#define RDCDEBUG(...) rdclog(LogType::Debug, __VA_ARGS__) #else #define RDCDEBUG(...) \ do \ @@ -283,36 +273,36 @@ void rdclog_closelog(); } while((void)0, 0) #endif -#define RDCLOG(...) rdclog(RDCLog_Comment, __VA_ARGS__) -#define RDCWARN(...) rdclog(RDCLog_Warning, __VA_ARGS__) +#define RDCLOG(...) rdclog(LogType::Comment, __VA_ARGS__) +#define RDCWARN(...) rdclog(LogType::Warning, __VA_ARGS__) #if ENABLED(DEBUGBREAK_ON_ERROR_LOG) -#define RDCERR(...) \ - do \ - { \ - rdclog(RDCLog_Error, __VA_ARGS__); \ - rdclog_flush(); \ - RDCBREAK(); \ +#define RDCERR(...) \ + do \ + { \ + rdclog(LogType::Error, __VA_ARGS__); \ + rdclog_flush(); \ + RDCBREAK(); \ } while((void)0, 0) #else -#define RDCERR(...) rdclog(RDCLog_Error, __VA_ARGS__) +#define RDCERR(...) rdclog(LogType::Error, __VA_ARGS__) #endif -#define RDCFATAL(...) \ - do \ - { \ - rdclog(RDCLog_Fatal, __VA_ARGS__); \ - rdclog_flush(); \ - RDCDUMP(); \ - exit(0); \ +#define RDCFATAL(...) \ + do \ + { \ + rdclog(LogType::Fatal, __VA_ARGS__); \ + rdclog_flush(); \ + RDCDUMP(); \ + exit(0); \ } while((void)0, 0) -#define RDCDUMPMSG(message) \ - do \ - { \ - rdclogprint_int(RDCLog_Fatal, message, message); \ - rdclog_flush(); \ - RDCDUMP(); \ - exit(0); \ +#define RDCDUMPMSG(message) \ + do \ + { \ + rdclogprint_int(LogType::Fatal, message, message); \ + rdclog_flush(); \ + RDCDUMP(); \ + exit(0); \ } while((void)0, 0) #endif diff --git a/renderdoc/common/dds_readwrite.cpp b/renderdoc/common/dds_readwrite.cpp index 04778585e..967a30103 100644 --- a/renderdoc/common/dds_readwrite.cpp +++ b/renderdoc/common/dds_readwrite.cpp @@ -234,197 +234,205 @@ ResourceFormat DXGIFormat2ResourceFormat(DXGI_FORMAT format) fmt32.compByteWidth = 4; fmt32.compCount = 1; - fmt32.compType = eCompType_Float; + fmt32.compType = CompType::Float; fmt32.special = false; fmt16.compByteWidth = 2; fmt16.compCount = 1; - fmt16.compType = eCompType_Float; + fmt16.compType = CompType::Float; fmt16.special = false; fmt8.compByteWidth = 1; fmt8.compCount = 1; - fmt8.compType = eCompType_UNorm; + fmt8.compType = CompType::UNorm; fmt8.special = false; switch(format) { case DXGI_FORMAT_BC1_UNORM: case DXGI_FORMAT_BC1_UNORM_SRGB: - special.specialFormat = eSpecial_BC1; + special.specialFormat = SpecialFormat::BC1; special.srgbCorrected = (format == DXGI_FORMAT_BC1_UNORM_SRGB ? true : false); return special; case DXGI_FORMAT_BC2_UNORM: case DXGI_FORMAT_BC2_UNORM_SRGB: - special.specialFormat = eSpecial_BC2; + special.specialFormat = SpecialFormat::BC2; special.srgbCorrected = (format == DXGI_FORMAT_BC2_UNORM_SRGB ? true : false); return special; case DXGI_FORMAT_BC3_UNORM: case DXGI_FORMAT_BC3_UNORM_SRGB: - special.specialFormat = eSpecial_BC3; + special.specialFormat = SpecialFormat::BC3; special.srgbCorrected = (format == DXGI_FORMAT_BC3_UNORM_SRGB ? true : false); return special; case DXGI_FORMAT_BC4_UNORM: case DXGI_FORMAT_BC4_SNORM: - special.specialFormat = eSpecial_BC4; - special.compType = (format == DXGI_FORMAT_BC4_UNORM ? eCompType_UNorm : eCompType_SNorm); + special.specialFormat = SpecialFormat::BC4; + special.compType = (format == DXGI_FORMAT_BC4_UNORM ? CompType::UNorm : CompType::SNorm); return special; case DXGI_FORMAT_BC5_UNORM: case DXGI_FORMAT_BC5_SNORM: - special.specialFormat = eSpecial_BC5; - special.compType = (format == DXGI_FORMAT_BC5_UNORM ? eCompType_UNorm : eCompType_SNorm); + special.specialFormat = SpecialFormat::BC5; + special.compType = (format == DXGI_FORMAT_BC5_UNORM ? CompType::UNorm : CompType::SNorm); return special; case DXGI_FORMAT_BC6H_UF16: case DXGI_FORMAT_BC6H_SF16: - special.specialFormat = eSpecial_BC6; - special.compType = (format == DXGI_FORMAT_BC6H_UF16 ? eCompType_UNorm : eCompType_SNorm); + special.specialFormat = SpecialFormat::BC6; + special.compType = (format == DXGI_FORMAT_BC6H_UF16 ? CompType::UNorm : CompType::SNorm); return special; case DXGI_FORMAT_BC7_UNORM: case DXGI_FORMAT_BC7_UNORM_SRGB: - special.specialFormat = eSpecial_BC7; + special.specialFormat = SpecialFormat::BC7; special.srgbCorrected = (format == DXGI_FORMAT_BC7_UNORM_SRGB ? true : false); return special; case DXGI_FORMAT_R10G10B10A2_UNORM: case DXGI_FORMAT_R10G10B10A2_UINT: - special.specialFormat = eSpecial_R10G10B10A2; - special.compType = (format == DXGI_FORMAT_R10G10B10A2_UNORM ? eCompType_UNorm : eCompType_UInt); + special.specialFormat = SpecialFormat::R10G10B10A2; + special.compType = (format == DXGI_FORMAT_R10G10B10A2_UNORM ? CompType::UNorm : CompType::UInt); + return special; + case DXGI_FORMAT_R11G11B10_FLOAT: + special.specialFormat = SpecialFormat::R11G11B10; return special; - case DXGI_FORMAT_R11G11B10_FLOAT: special.specialFormat = eSpecial_R11G11B10; return special; case DXGI_FORMAT_B5G6R5_UNORM: fmt8.bgraOrder = true; - special.specialFormat = eSpecial_R5G6B5; + special.specialFormat = SpecialFormat::R5G6B5; return special; case DXGI_FORMAT_B5G5R5A1_UNORM: fmt8.bgraOrder = true; - special.specialFormat = eSpecial_R5G5B5A1; + special.specialFormat = SpecialFormat::R5G5B5A1; + return special; + case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: + special.specialFormat = SpecialFormat::R9G9B9E5; return special; - case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: special.specialFormat = eSpecial_R9G9B9E5; return special; case DXGI_FORMAT_B4G4R4A4_UNORM: fmt8.bgraOrder = true; - special.specialFormat = eSpecial_R4G4B4A4; + special.specialFormat = SpecialFormat::R4G4B4A4; + return special; + case DXGI_FORMAT_D24_UNORM_S8_UINT: + special.specialFormat = SpecialFormat::D24S8; + return special; + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + special.specialFormat = SpecialFormat::D32S8; return special; - case DXGI_FORMAT_D24_UNORM_S8_UINT: special.specialFormat = eSpecial_D24S8; return special; - case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: special.specialFormat = eSpecial_D32S8; return special; case DXGI_FORMAT_R32G32B32A32_UINT: - fmt32.compType = eCompType_UInt; + fmt32.compType = CompType::UInt; fmt32.compCount = 4; return fmt32; case DXGI_FORMAT_R32G32B32A32_SINT: - fmt32.compType = eCompType_SInt; + fmt32.compType = CompType::SInt; fmt32.compCount = 4; return fmt32; case DXGI_FORMAT_R32G32B32A32_FLOAT: fmt32.compCount = 4; return fmt32; case DXGI_FORMAT_R32G32B32_UINT: - fmt32.compType = eCompType_UInt; + fmt32.compType = CompType::UInt; fmt32.compCount = 3; return fmt32; case DXGI_FORMAT_R32G32B32_SINT: - fmt32.compType = eCompType_SInt; + fmt32.compType = CompType::SInt; fmt32.compCount = 3; return fmt32; case DXGI_FORMAT_R32G32B32_FLOAT: fmt32.compCount = 3; return fmt32; case DXGI_FORMAT_R32G32_UINT: - fmt32.compType = eCompType_UInt; + fmt32.compType = CompType::UInt; fmt32.compCount = 2; return fmt32; case DXGI_FORMAT_R32G32_SINT: - fmt32.compType = eCompType_SInt; + fmt32.compType = CompType::SInt; fmt32.compCount = 2; return fmt32; case DXGI_FORMAT_R32G32_FLOAT: fmt32.compCount = 2; return fmt32; - case DXGI_FORMAT_R32_UINT: fmt32.compType = eCompType_UInt; return fmt32; - case DXGI_FORMAT_R32_SINT: fmt32.compType = eCompType_SInt; return fmt32; + case DXGI_FORMAT_R32_UINT: fmt32.compType = CompType::UInt; return fmt32; + case DXGI_FORMAT_R32_SINT: fmt32.compType = CompType::SInt; return fmt32; case DXGI_FORMAT_R32_FLOAT: return fmt32; case DXGI_FORMAT_R16G16B16A16_UINT: - fmt16.compType = eCompType_UInt; + fmt16.compType = CompType::UInt; fmt16.compCount = 4; return fmt16; case DXGI_FORMAT_R16G16B16A16_SINT: - fmt16.compType = eCompType_SInt; + fmt16.compType = CompType::SInt; fmt16.compCount = 4; return fmt16; case DXGI_FORMAT_R16G16B16A16_UNORM: - fmt16.compType = eCompType_UNorm; + fmt16.compType = CompType::UNorm; fmt16.compCount = 4; return fmt16; case DXGI_FORMAT_R16G16B16A16_SNORM: - fmt16.compType = eCompType_SNorm; + fmt16.compType = CompType::SNorm; fmt16.compCount = 4; return fmt16; case DXGI_FORMAT_R16G16B16A16_FLOAT: fmt16.compCount = 4; return fmt16; case DXGI_FORMAT_R16G16_UINT: - fmt16.compType = eCompType_UInt; + fmt16.compType = CompType::UInt; fmt16.compCount = 2; return fmt16; case DXGI_FORMAT_R16G16_SINT: - fmt16.compType = eCompType_SInt; + fmt16.compType = CompType::SInt; fmt16.compCount = 2; return fmt16; case DXGI_FORMAT_R16G16_UNORM: - fmt16.compType = eCompType_UNorm; + fmt16.compType = CompType::UNorm; fmt16.compCount = 2; return fmt16; case DXGI_FORMAT_R16G16_SNORM: - fmt16.compType = eCompType_SNorm; + fmt16.compType = CompType::SNorm; fmt16.compCount = 2; return fmt16; case DXGI_FORMAT_R16G16_FLOAT: fmt16.compCount = 2; return fmt16; - case DXGI_FORMAT_R16_UINT: fmt16.compType = eCompType_UInt; return fmt16; - case DXGI_FORMAT_R16_SINT: fmt16.compType = eCompType_SInt; return fmt16; - case DXGI_FORMAT_R16_UNORM: fmt16.compType = eCompType_UNorm; return fmt16; - case DXGI_FORMAT_R16_SNORM: fmt16.compType = eCompType_SNorm; return fmt16; + case DXGI_FORMAT_R16_UINT: fmt16.compType = CompType::UInt; return fmt16; + case DXGI_FORMAT_R16_SINT: fmt16.compType = CompType::SInt; return fmt16; + case DXGI_FORMAT_R16_UNORM: fmt16.compType = CompType::UNorm; return fmt16; + case DXGI_FORMAT_R16_SNORM: fmt16.compType = CompType::SNorm; return fmt16; case DXGI_FORMAT_R16_FLOAT: return fmt16; case DXGI_FORMAT_R8G8B8A8_UINT: - fmt8.compType = eCompType_UInt; + fmt8.compType = CompType::UInt; fmt8.compCount = 4; return fmt8; case DXGI_FORMAT_R8G8B8A8_SINT: - fmt8.compType = eCompType_SInt; + fmt8.compType = CompType::SInt; fmt8.compCount = 4; return fmt8; case DXGI_FORMAT_R8G8B8A8_SNORM: - fmt8.compType = eCompType_SNorm; + fmt8.compType = CompType::SNorm; fmt8.compCount = 4; return fmt8; case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: - fmt8.compType = eCompType_UNorm; + fmt8.compType = CompType::UNorm; fmt8.srgbCorrected = true; fmt8.compCount = 4; return fmt8; case DXGI_FORMAT_R8G8B8A8_UNORM: fmt8.compCount = 4; return fmt8; case DXGI_FORMAT_B8G8R8A8_UNORM: case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - fmt8.compType = eCompType_UNorm; + fmt8.compType = CompType::UNorm; fmt8.compCount = 4; fmt8.bgraOrder = true; fmt8.srgbCorrected = (format == DXGI_FORMAT_B8G8R8A8_UNORM_SRGB ? true : false); return fmt8; case DXGI_FORMAT_R8G8_UINT: - fmt8.compType = eCompType_UInt; + fmt8.compType = CompType::UInt; fmt8.compCount = 2; return fmt8; case DXGI_FORMAT_R8G8_SINT: - fmt8.compType = eCompType_SInt; + fmt8.compType = CompType::SInt; fmt8.compCount = 2; return fmt8; case DXGI_FORMAT_R8G8_SNORM: - fmt8.compType = eCompType_SNorm; + fmt8.compType = CompType::SNorm; fmt8.compCount = 2; return fmt8; case DXGI_FORMAT_R8G8_UNORM: fmt8.compCount = 2; return fmt8; - case DXGI_FORMAT_R8_UINT: fmt8.compType = eCompType_UInt; return fmt8; - case DXGI_FORMAT_R8_SINT: fmt8.compType = eCompType_SInt; return fmt8; - case DXGI_FORMAT_R8_SNORM: fmt8.compType = eCompType_SNorm; return fmt8; + case DXGI_FORMAT_R8_UINT: fmt8.compType = CompType::UInt; return fmt8; + case DXGI_FORMAT_R8_SINT: fmt8.compType = CompType::SInt; return fmt8; + case DXGI_FORMAT_R8_SNORM: fmt8.compType = CompType::SNorm; return fmt8; case DXGI_FORMAT_R8_UNORM: return fmt8; default: RDCWARN("Unsupported DXGI_FORMAT: %u", (uint32_t)format); @@ -439,38 +447,38 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.specialFormat) { - case eSpecial_BC1: + case SpecialFormat::BC1: return format.srgbCorrected ? DXGI_FORMAT_BC1_UNORM_SRGB : DXGI_FORMAT_BC1_UNORM; - case eSpecial_BC2: + case SpecialFormat::BC2: return format.srgbCorrected ? DXGI_FORMAT_BC2_UNORM_SRGB : DXGI_FORMAT_BC2_UNORM; - case eSpecial_BC3: + case SpecialFormat::BC3: return format.srgbCorrected ? DXGI_FORMAT_BC3_UNORM_SRGB : DXGI_FORMAT_BC3_UNORM; - case eSpecial_BC4: - return format.compType == eCompType_UNorm ? DXGI_FORMAT_BC4_UNORM : DXGI_FORMAT_BC4_SNORM; - case eSpecial_BC5: - return format.compType == eCompType_UNorm ? DXGI_FORMAT_BC5_UNORM : DXGI_FORMAT_BC5_SNORM; - case eSpecial_BC6: - return format.compType == eCompType_UNorm ? DXGI_FORMAT_BC6H_UF16 : DXGI_FORMAT_BC6H_SF16; - case eSpecial_BC7: + case SpecialFormat::BC4: + return format.compType == CompType::UNorm ? DXGI_FORMAT_BC4_UNORM : DXGI_FORMAT_BC4_SNORM; + case SpecialFormat::BC5: + return format.compType == CompType::UNorm ? DXGI_FORMAT_BC5_UNORM : DXGI_FORMAT_BC5_SNORM; + case SpecialFormat::BC6: + return format.compType == CompType::UNorm ? DXGI_FORMAT_BC6H_UF16 : DXGI_FORMAT_BC6H_SF16; + case SpecialFormat::BC7: return format.srgbCorrected ? DXGI_FORMAT_BC7_UNORM_SRGB : DXGI_FORMAT_BC7_UNORM; - case eSpecial_R10G10B10A2: - return format.compType == eCompType_UNorm ? DXGI_FORMAT_R10G10B10A2_UNORM + case SpecialFormat::R10G10B10A2: + return format.compType == CompType::UNorm ? DXGI_FORMAT_R10G10B10A2_UNORM : DXGI_FORMAT_R10G10B10A2_UINT; - case eSpecial_R11G11B10: return DXGI_FORMAT_R11G11B10_FLOAT; - case eSpecial_R5G6B5: RDCASSERT(format.bgraOrder); return DXGI_FORMAT_B5G6R5_UNORM; - case eSpecial_R5G5B5A1: RDCASSERT(format.bgraOrder); return DXGI_FORMAT_B5G5R5A1_UNORM; - case eSpecial_R9G9B9E5: return DXGI_FORMAT_R9G9B9E5_SHAREDEXP; - case eSpecial_R4G4B4A4: RDCASSERT(format.bgraOrder); return DXGI_FORMAT_B4G4R4A4_UNORM; - case eSpecial_D24S8: return DXGI_FORMAT_D24_UNORM_S8_UINT; - case eSpecial_D32S8: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; - case eSpecial_S8: return DXGI_FORMAT_R8_UINT; + case SpecialFormat::R11G11B10: return DXGI_FORMAT_R11G11B10_FLOAT; + case SpecialFormat::R5G6B5: RDCASSERT(format.bgraOrder); return DXGI_FORMAT_B5G6R5_UNORM; + case SpecialFormat::R5G5B5A1: RDCASSERT(format.bgraOrder); return DXGI_FORMAT_B5G5R5A1_UNORM; + case SpecialFormat::R9G9B9E5: return DXGI_FORMAT_R9G9B9E5_SHAREDEXP; + case SpecialFormat::R4G4B4A4: RDCASSERT(format.bgraOrder); return DXGI_FORMAT_B4G4R4A4_UNORM; + case SpecialFormat::D24S8: return DXGI_FORMAT_D24_UNORM_S8_UINT; + case SpecialFormat::D32S8: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; + case SpecialFormat::S8: return DXGI_FORMAT_R8_UINT; default: - case eSpecial_R4G4: - case eSpecial_D16S8: - case eSpecial_ETC2: - case eSpecial_EAC: - case eSpecial_ASTC: - case eSpecial_YUV: + case SpecialFormat::R4G4: + case SpecialFormat::D16S8: + case SpecialFormat::ETC2: + case SpecialFormat::EAC: + case SpecialFormat::ASTC: + case SpecialFormat::YUV: RDCERR("Unsupported writing format %u", format.specialFormat); return DXGI_FORMAT_UNKNOWN; } @@ -482,8 +490,8 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R32G32B32A32_UINT; - case eCompType_SInt: return DXGI_FORMAT_R32G32B32A32_SINT; + case CompType::UInt: return DXGI_FORMAT_R32G32B32A32_UINT; + case CompType::SInt: return DXGI_FORMAT_R32G32B32A32_SINT; default: return DXGI_FORMAT_R32G32B32A32_FLOAT; } } @@ -491,10 +499,10 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R16G16B16A16_UINT; - case eCompType_SInt: return DXGI_FORMAT_R16G16B16A16_SINT; - case eCompType_UNorm: return DXGI_FORMAT_R16G16B16A16_UNORM; - case eCompType_SNorm: return DXGI_FORMAT_R16G16B16A16_SNORM; + case CompType::UInt: return DXGI_FORMAT_R16G16B16A16_UINT; + case CompType::SInt: return DXGI_FORMAT_R16G16B16A16_SINT; + case CompType::UNorm: return DXGI_FORMAT_R16G16B16A16_UNORM; + case CompType::SNorm: return DXGI_FORMAT_R16G16B16A16_SNORM; default: return DXGI_FORMAT_R16G16B16A16_FLOAT; } } @@ -502,11 +510,11 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R8G8B8A8_UINT; - case eCompType_SInt: return DXGI_FORMAT_R8G8B8A8_SINT; - case eCompType_SNorm: return DXGI_FORMAT_R8G8B8A8_SNORM; + case CompType::UInt: return DXGI_FORMAT_R8G8B8A8_UINT; + case CompType::SInt: return DXGI_FORMAT_R8G8B8A8_SINT; + case CompType::SNorm: return DXGI_FORMAT_R8G8B8A8_SNORM; default: - case eCompType_UNorm: + case CompType::UNorm: if(format.srgbCorrected) { if(format.bgraOrder) @@ -532,8 +540,8 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R32G32B32_UINT; - case eCompType_SInt: return DXGI_FORMAT_R32G32B32_SINT; + case CompType::UInt: return DXGI_FORMAT_R32G32B32_UINT; + case CompType::SInt: return DXGI_FORMAT_R32G32B32_SINT; default: return DXGI_FORMAT_R32G32B32_FLOAT; } } @@ -546,8 +554,8 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R32G32_UINT; - case eCompType_SInt: return DXGI_FORMAT_R32G32_SINT; + case CompType::UInt: return DXGI_FORMAT_R32G32_UINT; + case CompType::SInt: return DXGI_FORMAT_R32G32_SINT; default: return DXGI_FORMAT_R32G32_FLOAT; } } @@ -555,10 +563,10 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R16G16_UINT; - case eCompType_SInt: return DXGI_FORMAT_R16G16_SINT; - case eCompType_UNorm: return DXGI_FORMAT_R16G16_UNORM; - case eCompType_SNorm: return DXGI_FORMAT_R16G16_SNORM; + case CompType::UInt: return DXGI_FORMAT_R16G16_UINT; + case CompType::SInt: return DXGI_FORMAT_R16G16_SINT; + case CompType::UNorm: return DXGI_FORMAT_R16G16_UNORM; + case CompType::SNorm: return DXGI_FORMAT_R16G16_SNORM; default: return DXGI_FORMAT_R16G16_FLOAT; } } @@ -566,9 +574,9 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R8G8_UINT; - case eCompType_SInt: return DXGI_FORMAT_R8G8_SINT; - case eCompType_SNorm: return DXGI_FORMAT_R8G8_SNORM; + case CompType::UInt: return DXGI_FORMAT_R8G8_UINT; + case CompType::SInt: return DXGI_FORMAT_R8G8_SINT; + case CompType::SNorm: return DXGI_FORMAT_R8G8_SNORM; default: return DXGI_FORMAT_R8G8_UNORM; } } @@ -581,8 +589,8 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R32_UINT; - case eCompType_SInt: return DXGI_FORMAT_R32_SINT; + case CompType::UInt: return DXGI_FORMAT_R32_UINT; + case CompType::SInt: return DXGI_FORMAT_R32_SINT; default: return DXGI_FORMAT_R32_FLOAT; } } @@ -590,10 +598,10 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R16_UINT; - case eCompType_SInt: return DXGI_FORMAT_R16_SINT; - case eCompType_UNorm: return DXGI_FORMAT_R16_UNORM; - case eCompType_SNorm: return DXGI_FORMAT_R16_SNORM; + case CompType::UInt: return DXGI_FORMAT_R16_UINT; + case CompType::SInt: return DXGI_FORMAT_R16_SINT; + case CompType::UNorm: return DXGI_FORMAT_R16_UNORM; + case CompType::SNorm: return DXGI_FORMAT_R16_SNORM; default: return DXGI_FORMAT_R16_FLOAT; } } @@ -601,9 +609,9 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) { switch(format.compType) { - case eCompType_UInt: return DXGI_FORMAT_R8_UINT; - case eCompType_SInt: return DXGI_FORMAT_R8_SINT; - case eCompType_SNorm: return DXGI_FORMAT_R8_SNORM; + case CompType::UInt: return DXGI_FORMAT_R8_UINT; + case CompType::SInt: return DXGI_FORMAT_R8_SINT; + case CompType::SNorm: return DXGI_FORMAT_R8_SNORM; default: return DXGI_FORMAT_R8_UNORM; } } @@ -647,17 +655,17 @@ bool write_dds_to_file(FILE *f, const dds_data &data) { switch(data.format.specialFormat) { - case eSpecial_BC1: - case eSpecial_BC2: - case eSpecial_BC3: - case eSpecial_BC4: - case eSpecial_BC5: - case eSpecial_BC6: - case eSpecial_BC7: blockFormat = true; break; - case eSpecial_ETC2: - case eSpecial_EAC: - case eSpecial_ASTC: - case eSpecial_YUV: + case SpecialFormat::BC1: + case SpecialFormat::BC2: + case SpecialFormat::BC3: + case SpecialFormat::BC4: + case SpecialFormat::BC5: + case SpecialFormat::BC6: + case SpecialFormat::BC7: blockFormat = true; break; + case SpecialFormat::ETC2: + case SpecialFormat::EAC: + case SpecialFormat::ASTC: + case SpecialFormat::YUV: RDCERR("Unsupported file format, %u", data.format.specialFormat); return false; default: break; @@ -702,28 +710,28 @@ bool write_dds_to_file(FILE *f, const dds_data &data) if(blockFormat) { - int blockSize = - (data.format.specialFormat == eSpecial_BC1 || data.format.specialFormat == eSpecial_BC4) - ? 8 - : 16; + int blockSize = (data.format.specialFormat == SpecialFormat::BC1 || + data.format.specialFormat == SpecialFormat::BC4) + ? 8 + : 16; header.dwPitchOrLinearSize = RDCMAX(1U, ((header.dwWidth + 3) / 4)) * blockSize; } else { switch(data.format.specialFormat) { - case eSpecial_S8: bytesPerPixel = 1; break; - case eSpecial_R10G10B10A2: - case eSpecial_R9G9B9E5: - case eSpecial_R11G11B10: - case eSpecial_D24S8: bytesPerPixel = 4; break; - case eSpecial_R5G6B5: - case eSpecial_R5G5B5A1: - case eSpecial_R4G4B4A4: bytesPerPixel = 2; break; - case eSpecial_D32S8: bytesPerPixel = 8; break; - case eSpecial_D16S8: - case eSpecial_YUV: - case eSpecial_R4G4: + case SpecialFormat::S8: bytesPerPixel = 1; break; + case SpecialFormat::R10G10B10A2: + case SpecialFormat::R9G9B9E5: + case SpecialFormat::R11G11B10: + case SpecialFormat::D24S8: bytesPerPixel = 4; break; + case SpecialFormat::R5G6B5: + case SpecialFormat::R5G5B5A1: + case SpecialFormat::R4G4B4A4: bytesPerPixel = 2; break; + case SpecialFormat::D32S8: bytesPerPixel = 8; break; + case SpecialFormat::D16S8: + case SpecialFormat::YUV: + case SpecialFormat::R4G4: RDCERR("Unsupported file format %u", data.format.specialFormat); return false; default: bytesPerPixel = data.format.compCount * data.format.compByteWidth; @@ -735,7 +743,7 @@ bool write_dds_to_file(FILE *f, const dds_data &data) // special case a couple of formats to write out non-DX10 style, for // backwards compatibility if(data.format.compByteWidth == 1 && data.format.compCount == 4 && - data.format.compType == eCompType_UNorm) + data.format.compType == CompType::UNorm) { header.ddspf.dwFlags = DDPF_RGBA; header.ddspf.dwRGBBitCount = 32; @@ -747,37 +755,37 @@ bool write_dds_to_file(FILE *f, const dds_data &data) if(data.format.bgraOrder) std::swap(header.ddspf.dwRBitMask, header.ddspf.dwBBitMask); } - else if(data.format.specialFormat == eSpecial_BC1) + else if(data.format.specialFormat == SpecialFormat::BC1) { header.ddspf.dwFlags = DDPF_FOURCC; header.ddspf.dwFourCC = MAKE_FOURCC('D', 'X', 'T', '1'); } - else if(data.format.specialFormat == eSpecial_BC2) + else if(data.format.specialFormat == SpecialFormat::BC2) { header.ddspf.dwFlags = DDPF_FOURCC; header.ddspf.dwFourCC = MAKE_FOURCC('D', 'X', 'T', '3'); } - else if(data.format.specialFormat == eSpecial_BC3) + else if(data.format.specialFormat == SpecialFormat::BC3) { header.ddspf.dwFlags = DDPF_FOURCC; header.ddspf.dwFourCC = MAKE_FOURCC('D', 'X', 'T', '5'); } - else if(data.format.specialFormat == eSpecial_BC4 && data.format.compType == eCompType_UNorm) + else if(data.format.specialFormat == SpecialFormat::BC4 && data.format.compType == CompType::UNorm) { header.ddspf.dwFlags = DDPF_FOURCC; header.ddspf.dwFourCC = MAKE_FOURCC('B', 'C', '4', 'U'); } - else if(data.format.specialFormat == eSpecial_BC4 && data.format.compType == eCompType_SNorm) + else if(data.format.specialFormat == SpecialFormat::BC4 && data.format.compType == CompType::SNorm) { header.ddspf.dwFlags = DDPF_FOURCC; header.ddspf.dwFourCC = MAKE_FOURCC('B', 'C', '4', 'S'); } - else if(data.format.specialFormat == eSpecial_BC5 && data.format.compType == eCompType_UNorm) + else if(data.format.specialFormat == SpecialFormat::BC5 && data.format.compType == CompType::UNorm) { header.ddspf.dwFlags = DDPF_FOURCC; header.ddspf.dwFourCC = MAKE_FOURCC('A', 'T', 'I', '2'); } - else if(data.format.specialFormat == eSpecial_BC5 && data.format.compType == eCompType_SNorm) + else if(data.format.specialFormat == SpecialFormat::BC5 && data.format.compType == CompType::SNorm) { header.ddspf.dwFlags = DDPF_FOURCC; header.ddspf.dwFourCC = MAKE_FOURCC('B', 'C', '5', 'S'); @@ -819,8 +827,8 @@ bool write_dds_to_file(FILE *f, const dds_data &data) { numRows = RDCMAX(1, numRows / 4); - int blockSize = (data.format.specialFormat == eSpecial_BC1 || - data.format.specialFormat == eSpecial_BC4) + int blockSize = (data.format.specialFormat == SpecialFormat::BC1 || + data.format.specialFormat == SpecialFormat::BC4) ? 8 : 16; @@ -897,7 +905,7 @@ dds_data load_dds_from_file(FILE *f) if(dx10Header) { ret.format = DXGIFormat2ResourceFormat(headerDXT10.dxgiFormat); - if(ret.format.special && ret.format.specialFormat == eSpecial_Unknown) + if(ret.format.special && ret.format.specialFormat == SpecialFormat::Unknown) { RDCWARN("Unsupported DXGI_FORMAT: %u", (uint32_t)headerDXT10.dxgiFormat); return error; @@ -958,7 +966,7 @@ dds_data load_dds_from_file(FILE *f) ret.format.compByteWidth = 1; ret.format.compCount = header.ddspf.dwRGBBitCount / 8; - ret.format.compType = eCompType_UNorm; + ret.format.compType = CompType::UNorm; ret.format.special = false; if(header.ddspf.dwBBitMask < header.ddspf.dwRBitMask) @@ -968,18 +976,18 @@ dds_data load_dds_from_file(FILE *f) uint32_t bytesPerPixel = 1; switch(ret.format.specialFormat) { - case eSpecial_S8: bytesPerPixel = 1; break; - case eSpecial_R10G10B10A2: - case eSpecial_R9G9B9E5: - case eSpecial_R11G11B10: - case eSpecial_D24S8: bytesPerPixel = 4; break; - case eSpecial_R5G6B5: - case eSpecial_R5G5B5A1: - case eSpecial_R4G4B4A4: bytesPerPixel = 2; break; - case eSpecial_D32S8: bytesPerPixel = 8; break; - case eSpecial_D16S8: - case eSpecial_YUV: - case eSpecial_R4G4: + case SpecialFormat::S8: bytesPerPixel = 1; break; + case SpecialFormat::R10G10B10A2: + case SpecialFormat::R9G9B9E5: + case SpecialFormat::R11G11B10: + case SpecialFormat::D24S8: bytesPerPixel = 4; break; + case SpecialFormat::R5G6B5: + case SpecialFormat::R5G5B5A1: + case SpecialFormat::R4G4B4A4: bytesPerPixel = 2; break; + case SpecialFormat::D32S8: bytesPerPixel = 8; break; + case SpecialFormat::D16S8: + case SpecialFormat::YUV: + case SpecialFormat::R4G4: RDCERR("Unsupported file format %u", ret.format.specialFormat); return error; default: bytesPerPixel = ret.format.compCount * ret.format.compByteWidth; @@ -991,17 +999,17 @@ dds_data load_dds_from_file(FILE *f) { switch(ret.format.specialFormat) { - case eSpecial_BC1: - case eSpecial_BC2: - case eSpecial_BC3: - case eSpecial_BC4: - case eSpecial_BC5: - case eSpecial_BC6: - case eSpecial_BC7: blockFormat = true; break; - case eSpecial_ETC2: - case eSpecial_EAC: - case eSpecial_ASTC: - case eSpecial_YUV: + case SpecialFormat::BC1: + case SpecialFormat::BC2: + case SpecialFormat::BC3: + case SpecialFormat::BC4: + case SpecialFormat::BC5: + case SpecialFormat::BC6: + case SpecialFormat::BC7: blockFormat = true; break; + case SpecialFormat::ETC2: + case SpecialFormat::EAC: + case SpecialFormat::ASTC: + case SpecialFormat::YUV: RDCERR("Unsupported file format, %u", ret.format.specialFormat); return error; default: break; @@ -1026,10 +1034,10 @@ dds_data load_dds_from_file(FILE *f) { numRows = RDCMAX(1, numRows / 4); - int blockSize = - (ret.format.specialFormat == eSpecial_BC1 || ret.format.specialFormat == eSpecial_BC4) - ? 8 - : 16; + int blockSize = (ret.format.specialFormat == SpecialFormat::BC1 || + ret.format.specialFormat == SpecialFormat::BC4) + ? 8 + : 16; pitch = RDCMAX(blockSize, (((rowlen + 3) / 4)) * blockSize); } diff --git a/renderdoc/common/timing.h b/renderdoc/common/timing.h index 61a8eea3c..279599469 100644 --- a/renderdoc/common/timing.h +++ b/renderdoc/common/timing.h @@ -121,7 +121,7 @@ public: ~ScopedTimer() { - rdclog_int(RDCLog_Comment, RDCLOG_PROJECT, m_File, m_Line, "Timer %s - %.3lf ms", + rdclog_int(LogType::Comment, RDCLOG_PROJECT, m_File, m_Line, "Timer %s - %.3lf ms", m_Message.c_str(), m_Timer.GetMilliseconds()); } diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index e116ffecc..a4870c068 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -37,7 +37,7 @@ #include "crash_handler.h" // from image_viewer.cpp -ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **driver); +ReplayStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **driver); // not provided by tinyexr, just do by hand bool is_exr_file(FILE *f) @@ -83,11 +83,11 @@ string ToStrHelper::Get(const WindowingSystem &el) { switch(el) { - case eWindowingSystem_Unknown: return "Unknown"; - case eWindowingSystem_Win32: return "Win32"; - case eWindowingSystem_Xlib: return "Xlib"; - case eWindowingSystem_XCB: return "XCB"; - case eWindowingSystem_Android: return "Android"; + case WindowingSystem::Unknown: return "Unknown"; + case WindowingSystem::Win32: return "Win32"; + case WindowingSystem::Xlib: return "Xlib"; + case WindowingSystem::XCB: return "XCB"; + case WindowingSystem::Android: return "Android"; default: break; } @@ -98,31 +98,31 @@ string ToStrHelper::Get(const WindowingSystem &el) } template <> -string ToStrHelper::Get(const ReplayCreateStatus &el) +string ToStrHelper::Get(const ReplayStatus &el) { switch(el) { - case eReplayCreate_Success: return "Success"; - case eReplayCreate_UnknownError: return "Unknown error"; - case eReplayCreate_InternalError: return "Internal error"; - case eReplayCreate_FileNotFound: return "File not found"; - case eReplayCreate_InjectionFailed: return "RenderDoc injection failed"; - case eReplayCreate_IncompatibleProcess: return "Process is incompatible"; - case eReplayCreate_NetworkIOFailed: return "Network I/O operation failed"; - case eReplayCreate_NetworkRemoteBusy: return "Remote side of network connection is busy"; - case eReplayCreate_NetworkVersionMismatch: return "Version mismatch between network clients"; - case eReplayCreate_FileIOFailed: return "File I/O failed"; - case eReplayCreate_FileIncompatibleVersion: return "File of incompatible version"; - case eReplayCreate_FileCorrupted: return "File corrupted"; - case eReplayCreate_APIUnsupported: return "API unsupported"; - case eReplayCreate_APIInitFailed: return "API initialisation failed"; - case eReplayCreate_APIIncompatibleVersion: return "API incompatible version"; - case eReplayCreate_APIHardwareUnsupported: return "API hardware unsupported"; + case ReplayStatus::Succeeded: return "Succeeded"; + case ReplayStatus::UnknownError: return "Unknown error"; + case ReplayStatus::InternalError: return "Internal error"; + case ReplayStatus::FileNotFound: return "File not found"; + case ReplayStatus::InjectionFailed: return "RenderDoc injection failed"; + case ReplayStatus::IncompatibleProcess: return "Process is incompatible"; + case ReplayStatus::NetworkIOFailed: return "Network I/O operation failed"; + case ReplayStatus::NetworkRemoteBusy: return "Remote side of network connection is busy"; + case ReplayStatus::NetworkVersionMismatch: return "Version mismatch between network clients"; + case ReplayStatus::FileIOFailed: return "File I/O failed"; + case ReplayStatus::FileIncompatibleVersion: return "File of incompatible version"; + case ReplayStatus::FileCorrupted: return "File corrupted"; + case ReplayStatus::APIUnsupported: return "API unsupported"; + case ReplayStatus::APIInitFailed: return "API initialisation failed"; + case ReplayStatus::APIIncompatibleVersion: return "API incompatible version"; + case ReplayStatus::APIHardwareUnsupported: return "API hardware unsupported"; default: break; } char tostrBuf[256] = {0}; - StringFormat::snprintf(tostrBuf, 255, "ReplayCreateStatus<%d>", el); + StringFormat::snprintf(tostrBuf, 255, "StatusCode<%d>", el); return tostrBuf; } @@ -748,9 +748,8 @@ Serialiser *RenderDoc::OpenWriteSerialiser(uint32_t frameNum, RDCInitParams *par return fileSerialiser; } -ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &driverType, - string &driverName, uint64_t &fileMachineIdent, - RDCInitParams *params) +ReplayStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &driverType, string &driverName, + uint64_t &fileMachineIdent, RDCInitParams *params) { Serialiser ser(logFile, Serialiser::READING, true); @@ -777,7 +776,7 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri driverType = RDC_Image; driverName = "Image"; fileMachineIdent = 0; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } } @@ -785,13 +784,13 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri switch(ser.ErrorCode()) { - case Serialiser::eSerError_FileIO: return eReplayCreate_FileIOFailed; - case Serialiser::eSerError_Corrupt: return eReplayCreate_FileCorrupted; - case Serialiser::eSerError_UnsupportedVersion: return eReplayCreate_FileIncompatibleVersion; + case Serialiser::eSerError_FileIO: return ReplayStatus::FileIOFailed; + case Serialiser::eSerError_Corrupt: return ReplayStatus::FileCorrupted; + case Serialiser::eSerError_UnsupportedVersion: return ReplayStatus::FileIncompatibleVersion; default: break; } - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; } ser.Rewind(); @@ -804,7 +803,7 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri if(chunkType != THUMBNAIL_DATA) { RDCERR("Malformed logfile '%s', first chunk isn't thumbnail data", logFile); - return eReplayCreate_FileCorrupted; + return ReplayStatus::FileCorrupted; } ser.SkipCurrentChunk(); @@ -818,7 +817,7 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri if(chunkType != CREATE_PARAMS) { RDCERR("Malformed logfile '%s', second chunk isn't create params", logFile); - return eReplayCreate_FileCorrupted; + return ReplayStatus::FileCorrupted; } ser.Serialise("DriverType", driverType); @@ -829,7 +828,7 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri if(chunkType != DRIVER_INIT_PARAMS) { RDCERR("Malformed logfile '%s', chunk doesn't contain driver init params", logFile); - return eReplayCreate_FileCorrupted; + return ReplayStatus::FileCorrupted; } if(params) @@ -841,7 +840,7 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri } // we can just throw away the serialiser, don't need to care about closing/popping contexts - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } bool RenderDoc::HasReplayDriver(RDCDriver driver) const @@ -887,11 +886,11 @@ void RenderDoc::RegisterRemoteProvider(RDCDriver driver, const char *name, m_RemoteDriverProviders[driver] = provider; } -ReplayCreateStatus RenderDoc::CreateReplayDriver(RDCDriver driverType, const char *logfile, - IReplayDriver **driver) +ReplayStatus RenderDoc::CreateReplayDriver(RDCDriver driverType, const char *logfile, + IReplayDriver **driver) { if(driver == NULL) - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; // allows passing RDC_Unknown as 'I don't care, give me a proxy driver of any type' // only valid if logfile is NULL and it will be used as a proxy, not to process a log @@ -906,14 +905,14 @@ ReplayCreateStatus RenderDoc::CreateReplayDriver(RDCDriver driverType, const cha return m_ReplayDriverProviders[driverType](logfile, driver); RDCERR("Unsupported replay driver requested: %d", driverType); - return eReplayCreate_APIUnsupported; + return ReplayStatus::APIUnsupported; } -ReplayCreateStatus RenderDoc::CreateRemoteDriver(RDCDriver driverType, const char *logfile, - IRemoteDriver **driver) +ReplayStatus RenderDoc::CreateRemoteDriver(RDCDriver driverType, const char *logfile, + IRemoteDriver **driver) { if(driver == NULL) - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; if(m_RemoteDriverProviders.find(driverType) != m_RemoteDriverProviders.end()) return m_RemoteDriverProviders[driverType](logfile, driver); @@ -924,7 +923,7 @@ ReplayCreateStatus RenderDoc::CreateRemoteDriver(RDCDriver driverType, const cha IReplayDriver *dr = NULL; auto status = m_ReplayDriverProviders[driverType](logfile, &dr); - if(status == eReplayCreate_Success) + if(status == ReplayStatus::Succeeded) *driver = (IRemoteDriver *)dr; else RDCASSERT(dr == NULL); @@ -933,7 +932,7 @@ ReplayCreateStatus RenderDoc::CreateRemoteDriver(RDCDriver driverType, const cha } RDCERR("Unsupported replay driver requested: %d", driverType); - return eReplayCreate_APIUnsupported; + return ReplayStatus::APIUnsupported; } void RenderDoc::SetCurrentDriver(RDCDriver driver) diff --git a/renderdoc/core/core.h b/renderdoc/core/core.h index bca547094..3d9d59283 100644 --- a/renderdoc/core/core.h +++ b/renderdoc/core/core.h @@ -137,7 +137,7 @@ struct RDCInitParams m_pSerialiser = NULL; } virtual ~RDCInitParams() {} - virtual ReplayCreateStatus Serialise() = 0; + virtual ReplayStatus Serialise() = 0; LogState m_State; Serialiser *m_pSerialiser; @@ -168,10 +168,10 @@ enum LoadProgressSection class IRemoteDriver; class IReplayDriver; -typedef ReplayCreateStatus (*RemoteDriverProvider)(const char *logfile, IRemoteDriver **driver); -typedef ReplayCreateStatus (*ReplayDriverProvider)(const char *logfile, IReplayDriver **driver); +typedef ReplayStatus (*RemoteDriverProvider)(const char *logfile, IRemoteDriver **driver); +typedef ReplayStatus (*ReplayDriverProvider)(const char *logfile, IReplayDriver **driver); -typedef bool (*VulkanLayerCheck)(uint32_t &flags, std::vector &myJSONs, +typedef bool (*VulkanLayerCheck)(VulkanLayerFlags &flags, std::vector &myJSONs, std::vector &otherJSONs); typedef void (*VulkanLayerInstall)(bool systemLevel); @@ -238,15 +238,15 @@ public: } } - ReplayCreateStatus FillInitParams(const char *logfile, RDCDriver &driverType, string &driverName, - uint64_t &fileMachineIdent, RDCInitParams *params); + ReplayStatus FillInitParams(const char *logfile, RDCDriver &driverType, string &driverName, + uint64_t &fileMachineIdent, RDCInitParams *params); void RegisterReplayProvider(RDCDriver driver, const char *name, ReplayDriverProvider provider); void RegisterRemoteProvider(RDCDriver driver, const char *name, RemoteDriverProvider provider); void SetVulkanLayerCheck(VulkanLayerCheck callback) { m_VulkanCheck = callback; } void SetVulkanLayerInstall(VulkanLayerInstall callback) { m_VulkanInstall = callback; } - bool NeedVulkanLayerRegistration(uint32_t &flags, std::vector &myJSONs, + bool NeedVulkanLayerRegistration(VulkanLayerFlags &flags, std::vector &myJSONs, std::vector &otherJSONs) { if(m_VulkanCheck) @@ -261,10 +261,8 @@ public: m_VulkanInstall(systemLevel); } - ReplayCreateStatus CreateReplayDriver(RDCDriver driverType, const char *logfile, - IReplayDriver **driver); - ReplayCreateStatus CreateRemoteDriver(RDCDriver driverType, const char *logfile, - IRemoteDriver **driver); + ReplayStatus CreateReplayDriver(RDCDriver driverType, const char *logfile, IReplayDriver **driver); + ReplayStatus CreateRemoteDriver(RDCDriver driverType, const char *logfile, IRemoteDriver **driver); map GetReplayDrivers(); map GetRemoteDrivers(); diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index a20051523..e5110fc2d 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -40,7 +40,7 @@ public: // start with props so that m_Props.localRenderer is correct m_Props = m_Proxy->GetAPIProperties(); - m_Props.pipelineType = eGraphicsAPI_D3D11; + m_Props.pipelineType = GraphicsAPI::D3D11; m_Props.degraded = false; m_FrameRecord.frameInfo.fileOffset = 0; @@ -100,12 +100,12 @@ public: m_Proxy->RenderHighlightBox(w, h, scale); } bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) + CompType typeHint, float *minval, float *maxval) { return m_Proxy->GetMinMax(m_TextureID, sliceFace, mip, sample, typeHint, minval, maxval); } bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram) { return m_Proxy->GetHistogram(m_TextureID, sliceFace, mip, sample, typeHint, minval, maxval, @@ -117,7 +117,7 @@ public: return m_Proxy->RenderTexture(cfg); } void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]) + uint32_t sample, CompType typeHint, float pixel[4]) { m_Proxy->PickPixel(m_TextureID, x, y, sliceFace, mip, sample, typeHint, pixel); } @@ -125,14 +125,14 @@ public: { return m_Proxy->PickVertex(eventID, cfg, x, y); } - void BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors) { m_Proxy->BuildCustomShader(source, entry, compileFlags, type, id, errors); } void FreeCustomShader(ResourceId id) { m_Proxy->FreeTargetResource(id); } ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint) + uint32_t sampleIdx, CompType typeHint) { return m_Proxy->ApplyCustomShader(shader, m_TextureID, mip, arrayIdx, sampleIdx, typeHint); } @@ -170,13 +170,13 @@ public: vector GetUsage(ResourceId id) { return vector(); } bool IsRenderOutput(ResourceId id) { return false; } ResourceId GetLiveID(ResourceId id) { return id; } - vector EnumerateCounters() { return vector(); } - void DescribeCounter(uint32_t counterID, CounterDescription &desc) + vector EnumerateCounters() { return vector(); } + void DescribeCounter(GPUCounter counterID, CounterDescription &desc) { RDCEraseEl(desc); desc.counterID = counterID; } - vector FetchCounters(const vector &counters) + vector FetchCounters(const vector &counters) { return vector(); } @@ -193,9 +193,8 @@ public: RDCEraseEl(ret); return ret; } - ResourceId RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) + ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { return ResourceId(); } @@ -206,7 +205,7 @@ public: void FreeTargetResource(ResourceId id) {} vector PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint) + uint32_t sampleIdx, CompType typeHint) { return vector(); } @@ -230,8 +229,8 @@ public: RDCEraseEl(ret); return ret; } - void BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors) { } void ReplaceResource(ResourceId from, ResourceId to) {} @@ -273,12 +272,12 @@ private: FetchTexture m_TexDetails; }; -ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { FILE *f = FileIO::fopen(logfile, "rb"); if(!f) - return eReplayCreate_FileIOFailed; + return ReplayStatus::FileIOFailed; // make sure the file is a type we recognise before going further if(is_exr_file(f)) @@ -309,7 +308,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d RDCERR( "EXR file detected, but couldn't load with ParseMultiChannelEXRHeaderFromMemory %d: '%s'", ret, err); - return eReplayCreate_ImageUnsupported; + return ReplayStatus::ImageUnsupported; } } else if(stbi_is_hdr_from_file(f)) @@ -323,7 +322,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d { FileIO::fclose(f); RDCERR("HDR file recognised, but couldn't load with stbi_loadf_from_file"); - return eReplayCreate_ImageUnsupported; + return ReplayStatus::ImageUnsupported; } free(data); @@ -337,7 +336,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d { FileIO::fclose(f); RDCERR("DDS file recognised, but couldn't load"); - return eReplayCreate_ImageUnsupported; + return ReplayStatus::ImageUnsupported; } for(int i = 0; i < read_data.slices * read_data.mips; i++) @@ -357,7 +356,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d if(ret == 0 || width <= 0 || width >= 65536 || height <= 0 || height >= 65536) { FileIO::fclose(f); - return eReplayCreate_ImageUnsupported; + return ReplayStatus::ImageUnsupported; } byte *data = stbi_load_from_file(f, &ignore, &ignore, &ignore, 4); @@ -366,7 +365,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d { FileIO::fclose(f); RDCERR("File recognised, but couldn't load with stbi_load_from_file"); - return eReplayCreate_ImageUnsupported; + return ReplayStatus::ImageUnsupported; } free(data); @@ -377,7 +376,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d IReplayDriver *proxy = NULL; auto status = RenderDoc::Inst().CreateReplayDriver(RDC_Unknown, NULL, &proxy); - if(status != eReplayCreate_Success || !proxy) + if(status != ReplayStatus::Succeeded || !proxy) { if(proxy) proxy->Shutdown(); @@ -386,7 +385,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d *driver = new ImageViewer(proxy, logfile); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } void ImageViewer::RefreshFile() @@ -412,14 +411,14 @@ void ImageViewer::RefreshFile() ResourceFormat rgba8_unorm; rgba8_unorm.compByteWidth = 1; rgba8_unorm.compCount = 4; - rgba8_unorm.compType = eCompType_UNorm; + rgba8_unorm.compType = CompType::UNorm; rgba8_unorm.special = false; ResourceFormat rgba32_float = rgba8_unorm; rgba32_float.compByteWidth = 4; - rgba32_float.compType = eCompType_Float; + rgba32_float.compType = CompType::Float; - texDetails.creationFlags = eTextureCreate_SwapBuffer | eTextureCreate_RTV; + texDetails.creationFlags = TextureCategory::SwapBuffer | TextureCategory::ColorTarget; texDetails.cubemap = false; texDetails.customName = true; texDetails.name = m_Filename; diff --git a/renderdoc/core/remote_server.cpp b/renderdoc/core/remote_server.cpp index 488e7da10..3930831a0 100644 --- a/renderdoc/core/remote_server.cpp +++ b/renderdoc/core/remote_server.cpp @@ -36,6 +36,12 @@ using std::pair; +template <> +string ToStrHelper::Get(const FileProperty &el) +{ + return "<...>"; +} + template <> string ToStrHelper::Get(const CaptureOptions &el) { @@ -54,7 +60,13 @@ void Serialiser::Serialise(const char *name, DirectoryFile &el) } template <> -string ToStrHelper::Get(const Process::ModificationType &el) +string ToStrHelper::Get(const EnvMod &el) +{ + return "<...>"; +} + +template <> +string ToStrHelper::Get(const EnvSep &el) { return "<...>"; } @@ -64,7 +76,8 @@ void Serialiser::Serialise(const char *name, Process::EnvironmentModification &e { ScopedContext scope(this, name, "Process::EnvironmentModification", 0, true); - Serialise("type", el.type); + Serialise("mod", el.mod); + Serialise("sep", el.sep); Serialise("name", el.name); Serialise("value", el.value); } @@ -370,10 +383,10 @@ static void ActiveRemoteClientThread(void *data) RDCDriver driverType = RDC_Unknown; string driverName = ""; uint64_t fileMachineIdent = 0; - ReplayCreateStatus status = RenderDoc::Inst().FillInitParams( - cap_file.c_str(), driverType, driverName, fileMachineIdent, NULL); + ReplayStatus status = RenderDoc::Inst().FillInitParams(cap_file.c_str(), driverType, + driverName, fileMachineIdent, NULL); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) { RDCERR("Failed to open %s", cap_file.c_str()); } @@ -391,7 +404,7 @@ static void ActiveRemoteClientThread(void *data) status = RenderDoc::Inst().CreateRemoteDriver(driverType, cap_file.c_str(), &driver); - if(status != eReplayCreate_Success || driver == NULL) + if(status != ReplayStatus::Succeeded || driver == NULL) { RDCERR("Failed to create remote driver for driver type %d name %s", driverType, driverName.c_str()); @@ -413,7 +426,7 @@ static void ActiveRemoteClientThread(void *data) { RDCERR("File needs driver for %s which isn't supported!", driverName.c_str()); - status = eReplayCreate_APIUnsupported; + status = ReplayStatus::APIUnsupported; } sendType = eRemoteServer_LogOpened; @@ -443,7 +456,7 @@ static void ActiveRemoteClientThread(void *data) if(envListSize > 0) recvser->SerialiseComplexArray("env", env, envListSize); - uint32_t ident = eReplayCreate_NetworkIOFailed; + uint32_t ident = uint32_t(ReplayStatus::NetworkIOFailed); if(threadData->allowExecution) { @@ -850,7 +863,7 @@ public: package.filename = trim(tokens[1]); package.size = 0; package.lastmod = 0; - package.flags = eFileProp_Executable; + package.flags = FileProperty::Executable; packages.push_back(package); } } @@ -888,7 +901,7 @@ public: { create_array_uninit(ret, 1); ret.elems[0].filename = path; - ret.elems[0].flags = eFileProp_ErrorUnknown; + ret.elems[0].flags = FileProperty::ErrorUnknown; } return ret; @@ -1015,18 +1028,18 @@ public: Send(eRemoteServer_TakeOwnershipCapture, sendData); } - ReplayCreateStatus OpenCapture(uint32_t proxyid, const char *filename, float *progress, - IReplayRenderer **rend) + ReplayStatus OpenCapture(uint32_t proxyid, const char *filename, float *progress, + IReplayRenderer **rend) { if(rend == NULL) - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; string logfile = filename; if(proxyid != ~0U && proxyid >= m_Proxies.size()) { RDCERR("Invalid proxy driver id %d specified for remote renderer", proxyid); - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; } float dummy = 0.0f; @@ -1058,16 +1071,16 @@ public: } if(!m_Socket || progressSer == NULL || type != eRemoteServer_LogOpened) - return eReplayCreate_NetworkIOFailed; + return ReplayStatus::NetworkIOFailed; - ReplayCreateStatus status = eReplayCreate_Success; + ReplayStatus status = ReplayStatus::Succeeded; progressSer->Serialise("status", status); SAFE_DELETE(progressSer); *progress = 1.0f; - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) return status; RDCLOG("Log ready on replay host"); @@ -1075,7 +1088,7 @@ public: IReplayDriver *proxyDriver = NULL; status = RenderDoc::Inst().CreateReplayDriver(proxydrivertype, NULL, &proxyDriver); - if(status != eReplayCreate_Success || !proxyDriver) + if(status != ReplayStatus::Succeeded || !proxyDriver) { if(proxyDriver) proxyDriver->Shutdown(); @@ -1087,7 +1100,7 @@ public: ReplayProxy *proxy = new ReplayProxy(m_Socket, proxyDriver); status = ret->SetDevice(proxy); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) { SAFE_DELETE(ret); return status; @@ -1098,7 +1111,7 @@ public: *rend = ret; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } void CloseCapture(IReplayRenderer *rend) @@ -1207,9 +1220,11 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_CopyCaptureFromRemote(IR remote->CopyCaptureFromRemote(remotepath, localpath, progress); } -extern "C" RENDERDOC_API ReplayCreateStatus RENDERDOC_CC -RemoteServer_OpenCapture(IRemoteServer *remote, uint32_t proxyid, const char *logfile, - float *progress, IReplayRenderer **rend) +extern "C" RENDERDOC_API ReplayStatus RENDERDOC_CC RemoteServer_OpenCapture(IRemoteServer *remote, + uint32_t proxyid, + const char *logfile, + float *progress, + IReplayRenderer **rend) { return remote->OpenCapture(proxyid, logfile, progress, rend); } @@ -1220,11 +1235,11 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_CloseCapture(IRemoteServ return remote->CloseCapture(rend); } -extern "C" RENDERDOC_API ReplayCreateStatus RENDERDOC_CC +extern "C" RENDERDOC_API ReplayStatus RENDERDOC_CC RENDERDOC_CreateRemoteServerConnection(const char *host, uint32_t port, IRemoteServer **rend) { if(rend == NULL) - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; string s = "localhost"; if(host != NULL && host[0] != '\0') @@ -1250,7 +1265,7 @@ RENDERDOC_CreateRemoteServerConnection(const char *host, uint32_t port, IRemoteS sock = Network::CreateClientSocket(s.c_str(), (uint16_t)port, 750); if(sock == NULL) - return eReplayCreate_NetworkIOFailed; + return ReplayStatus::NetworkIOFailed; } Serialiser sendData("", Serialiser::WRITING, false); @@ -1263,23 +1278,23 @@ RENDERDOC_CreateRemoteServerConnection(const char *host, uint32_t port, IRemoteS if(type == eRemoteServer_Busy) { SAFE_DELETE(sock); - return eReplayCreate_NetworkRemoteBusy; + return ReplayStatus::NetworkRemoteBusy; } if(type == eRemoteServer_VersionMismatch) { SAFE_DELETE(sock); - return eReplayCreate_NetworkVersionMismatch; + return ReplayStatus::NetworkVersionMismatch; } if(type != eRemoteServer_Handshake) { RDCWARN("Didn't get proper handshake"); SAFE_DELETE(sock); - return eReplayCreate_NetworkIOFailed; + return ReplayStatus::NetworkIOFailed; } *rend = new RemoteServer(sock, host); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index 65684924c..7dc4bf020 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -57,40 +57,40 @@ class undersized #pragma region General Shader / State template <> -string ToStrHelper::Get(const SystemAttribute &el) +string ToStrHelper::Get(const ShaderBuiltin &el) { switch(el) { - TOSTR_CASE_STRINGIZE(eAttr_None) - TOSTR_CASE_STRINGIZE(eAttr_Position) - TOSTR_CASE_STRINGIZE(eAttr_PointSize) - TOSTR_CASE_STRINGIZE(eAttr_ClipDistance) - TOSTR_CASE_STRINGIZE(eAttr_CullDistance) - TOSTR_CASE_STRINGIZE(eAttr_RTIndex) - TOSTR_CASE_STRINGIZE(eAttr_ViewportIndex) - TOSTR_CASE_STRINGIZE(eAttr_VertexIndex) - TOSTR_CASE_STRINGIZE(eAttr_PrimitiveIndex) - TOSTR_CASE_STRINGIZE(eAttr_InstanceIndex) - TOSTR_CASE_STRINGIZE(eAttr_InvocationIndex) - TOSTR_CASE_STRINGIZE(eAttr_DispatchSize) - TOSTR_CASE_STRINGIZE(eAttr_DispatchThreadIndex) - TOSTR_CASE_STRINGIZE(eAttr_GroupIndex) - TOSTR_CASE_STRINGIZE(eAttr_GroupFlatIndex) - TOSTR_CASE_STRINGIZE(eAttr_GroupThreadIndex) - TOSTR_CASE_STRINGIZE(eAttr_GSInstanceIndex) - TOSTR_CASE_STRINGIZE(eAttr_OutputControlPointIndex) - TOSTR_CASE_STRINGIZE(eAttr_DomainLocation) - TOSTR_CASE_STRINGIZE(eAttr_IsFrontFace) - TOSTR_CASE_STRINGIZE(eAttr_MSAACoverage) - TOSTR_CASE_STRINGIZE(eAttr_MSAASamplePosition) - TOSTR_CASE_STRINGIZE(eAttr_MSAASampleIndex) - TOSTR_CASE_STRINGIZE(eAttr_PatchNumVertices) - TOSTR_CASE_STRINGIZE(eAttr_OuterTessFactor) - TOSTR_CASE_STRINGIZE(eAttr_InsideTessFactor) - TOSTR_CASE_STRINGIZE(eAttr_ColourOutput) - TOSTR_CASE_STRINGIZE(eAttr_DepthOutput) - TOSTR_CASE_STRINGIZE(eAttr_DepthOutputGreaterEqual) - TOSTR_CASE_STRINGIZE(eAttr_DepthOutputLessEqual) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, Undefined) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, Position) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, PointSize) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, ClipDistance) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, CullDistance) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, RTIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, ViewportIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, VertexIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, PrimitiveIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, InstanceIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, InvocationIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, DispatchSize) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, DispatchThreadIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, GroupIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, GroupFlatIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, GroupThreadIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, GSInstanceIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, OutputControlPointIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, DomainLocation) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, IsFrontFace) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, MSAACoverage) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, MSAASamplePosition) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, MSAASampleIndex) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, PatchNumVertices) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, OuterTessFactor) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, InsideTessFactor) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, ColourOutput) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, DepthOutput) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, DepthOutputGreaterEqual) + TOSTR_CASE_STRINGIZE_SCOPED(ShaderBuiltin, DepthOutputLessEqual) default: break; } @@ -329,7 +329,7 @@ void Serialiser::Serialise(const char *name, D3D11PipelineState::InputAssembler } template <> -void Serialiser::Serialise(const char *name, D3D11PipelineState::ShaderStage::ResourceView &el) +void Serialiser::Serialise(const char *name, D3D11PipelineState::Shader::ResourceView &el) { Serialise("", el.View); Serialise("", el.Resource); @@ -353,7 +353,7 @@ void Serialiser::Serialise(const char *name, D3D11PipelineState::ShaderStage::Re } template <> -void Serialiser::Serialise(const char *name, D3D11PipelineState::ShaderStage::Sampler &el) +void Serialiser::Serialise(const char *name, D3D11PipelineState::Shader::Sampler &el) { Serialise("", el.Samp); Serialise("", el.SamplerName); @@ -375,9 +375,9 @@ void Serialiser::Serialise(const char *name, D3D11PipelineState::ShaderStage::Sa } template <> -void Serialiser::Serialise(const char *name, D3D11PipelineState::ShaderStage &el) +void Serialiser::Serialise(const char *name, D3D11PipelineState::Shader &el) { - Serialise("", el.Shader); + Serialise("", el.Object); Serialise("", el.stage); Serialise("", el.ShaderName); Serialise("", el.customName); @@ -592,7 +592,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::ResourceView &e } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::ShaderStage::RegisterSpace &el) +void Serialiser::Serialise(const char *name, D3D12PipelineState::Shader::RegisterSpace &el) { Serialise("", el.ConstantBuffers); Serialise("", el.Samplers); @@ -603,9 +603,9 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::ShaderStage::Re } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::ShaderStage &el) +void Serialiser::Serialise(const char *name, D3D12PipelineState::Shader &el) { - Serialise("", el.Shader); + Serialise("", el.Object); Serialise("", el.BindpointMapping); Serialise("", el.stage); Serialise("", el.Spaces); @@ -762,9 +762,9 @@ void Serialiser::Serialise(const char *name, GLPipelineState::VertexInput &el) } template <> -void Serialiser::Serialise(const char *name, GLPipelineState::ShaderStage &el) +void Serialiser::Serialise(const char *name, GLPipelineState::Shader &el) { - Serialise("", el.Shader); + Serialise("", el.Object); Serialise("", el.ShaderName); Serialise("", el.customShaderName); @@ -1070,7 +1070,7 @@ void Serialiser::Serialise(const char *name, VulkanPipelineState::VertexInput &e } template <> -void Serialiser::Serialise(const char *name, VulkanPipelineState::ShaderStage::SpecInfo &el) +void Serialiser::Serialise(const char *name, VulkanPipelineState::Shader::SpecInfo &el) { Serialise("", el.specID); Serialise("", el.data); @@ -1079,9 +1079,9 @@ void Serialiser::Serialise(const char *name, VulkanPipelineState::ShaderStage::S } template <> -void Serialiser::Serialise(const char *name, VulkanPipelineState::ShaderStage &el) +void Serialiser::Serialise(const char *name, VulkanPipelineState::Shader &el) { - Serialise("", el.Shader); + Serialise("", el.Object); Serialise("", el.entryPoint); Serialise("", el.ShaderName); @@ -1537,11 +1537,11 @@ void Serialiser::Serialise(const char *name, FetchFrameStatistics &el) // dealing with arrays,t hey'll never be NULL and need to be assigned // to, so this is fine FetchFrameConstantBindStats *constants = el.constants; - SerialiseComplexArray("", constants); + SerialiseComplexArray<(uint32_t)ShaderStage::Count>("", constants); FetchFrameSamplerBindStats *samplers = el.samplers; - SerialiseComplexArray("", samplers); + SerialiseComplexArray<(uint32_t)ShaderStage::Count>("", samplers); FetchFrameResourceBindStats *resources = el.resources; - SerialiseComplexArray("", resources); + SerialiseComplexArray<(uint32_t)ShaderStage::Count>("", resources); Serialise("", el.updates); Serialise("", el.draws); Serialise("", el.dispatches); @@ -1549,7 +1549,7 @@ void Serialiser::Serialise(const char *name, FetchFrameStatistics &el) Serialise("", el.vertices); Serialise("", el.layouts); FetchFrameShaderStats *shaders = el.shaders; - SerialiseComplexArray("", shaders); + SerialiseComplexArray<(uint32_t)ShaderStage::Count>("", shaders); Serialise("", el.blends); Serialise("", el.depths); Serialise("", el.rasters); @@ -1616,9 +1616,9 @@ void Serialiser::Serialise(const char *name, CounterDescription &el) Serialise("", el.counterID); Serialise("", el.name); Serialise("", el.description); - Serialise("", el.resultCompType); + Serialise("", el.resultType); Serialise("", el.resultByteWidth); - Serialise("", el.units); + Serialise("", el.unit); SIZE_CHECK(56); } @@ -1667,7 +1667,37 @@ string ToStrHelper::Get(const SpecialFormat &el) return "<...>"; } template <> -string ToStrHelper::Get(const FormatComponentType &el) +string ToStrHelper::Get(const CompType &el) +{ + return "<...>"; +} +template <> +string ToStrHelper::Get(const ShaderEvents &el) +{ + return "<...>"; +} +template <> +string ToStrHelper::Get(const TextureCategory &el) +{ + return "<...>"; +} +template <> +string ToStrHelper::Get(const BufferCategory &el) +{ + return "<...>"; +} +template <> +string ToStrHelper::Get(const D3DBufferViewFlags &el) +{ + return "<...>"; +} +template <> +string ToStrHelper::Get(const DrawFlags &el) +{ + return "<...>"; +} +template <> +string ToStrHelper::Get(const GPUCounter &el) { return "<...>"; } @@ -1677,47 +1707,47 @@ string ToStrHelper::Get(const TextureSwizzle &el) return "<...>"; } template <> -string ToStrHelper::Get(const CounterUnits &el) +string ToStrHelper::Get(const CounterUnit &el) { return "<...>"; } template <> -string ToStrHelper::Get(const PrimitiveTopology &el) +string ToStrHelper::Get(const Topology &el) { return "<...>"; } template <> -string ToStrHelper::Get(const ShaderStageType &el) +string ToStrHelper::Get(const ShaderStage &el) { return "<...>"; } template <> -string ToStrHelper::Get(const ShaderStageBits &el) +string ToStrHelper::Get(const ShaderStageMask &el) { return "<...>"; } template <> -string ToStrHelper::Get(const ShaderBindType &el) +string ToStrHelper::Get(const BindType &el) { return "<...>"; } template <> -string ToStrHelper::Get(const ShaderResourceType &el) +string ToStrHelper::Get(const TextureDim &el) { return "<...>"; } template <> -string ToStrHelper::Get(const DebugMessageCategory &el) +string ToStrHelper::Get(const MessageCategory &el) { return "<...>"; } template <> -string ToStrHelper::Get(const DebugMessageSeverity &el) +string ToStrHelper::Get(const MessageSeverity &el) { return "<...>"; } template <> -string ToStrHelper::Get(const DebugMessageSource &el) +string ToStrHelper::Get(const MessageSource &el) { return "<...>"; } @@ -1732,7 +1762,7 @@ string ToStrHelper::Get(const MeshDataStage &el) return "<...>"; } template <> -string ToStrHelper::Get(const TextureDisplayOverlay &el) +string ToStrHelper::Get(const DebugOverlay &el) { return "<...>"; } @@ -1760,8 +1790,8 @@ string ToStrHelper::Get( return "<...>"; } template <> -string ToStrHelper::Get( - const D3D11PipelineState::ShaderStage::CBuffer &el) +string ToStrHelper::Get( + const D3D11PipelineState::Shader::CBuffer &el) { return "<...>"; } @@ -1997,12 +2027,12 @@ void ReplayProxy::RemapProxyTextureIfNeeded(ResourceFormat &format, GetTextureDa { switch(format.specialFormat) { - case eSpecial_S8: - case eSpecial_D16S8: params.remap = eRemap_D32S8; break; - case eSpecial_ASTC: - case eSpecial_EAC: - case eSpecial_R5G6B5: - case eSpecial_ETC2: params.remap = eRemap_RGBA8; break; + case SpecialFormat::S8: + case SpecialFormat::D16S8: params.remap = eRemap_D32S8; break; + case SpecialFormat::ASTC: + case SpecialFormat::EAC: + case SpecialFormat::R5G6B5: + case SpecialFormat::ETC2: params.remap = eRemap_RGBA8; break; default: RDCERR("Don't know how to remap special format %u, falling back to RGBA32"); params.remap = eRemap_RGBA32; @@ -2026,19 +2056,19 @@ void ReplayProxy::RemapProxyTextureIfNeeded(ResourceFormat &format, GetTextureDa case eRemap_RGBA8: format.compCount = 4; format.compByteWidth = 1; - format.compType = eCompType_UNorm; + format.compType = CompType::UNorm; // Range adaptation is only needed when remapping a higher precision format down to RGBA8. params.whitePoint = 1.0f; break; case eRemap_RGBA16: format.compCount = 4; format.compByteWidth = 2; - format.compType = eCompType_UNorm; + format.compType = CompType::UNorm; break; case eRemap_RGBA32: format.compCount = 4; format.compByteWidth = 4; - format.compType = eCompType_Float; + format.compType = CompType::Float; break; case eRemap_D32S8: RDCERR("Remapping depth/stencil formats not implemented."); break; } @@ -2141,7 +2171,7 @@ bool ReplayProxy::Tick(int type, Serialiser *incomingPacket) case eReplayProxy_FreeResource: FreeTargetResource(ResourceId()); break; case eReplayProxy_FetchCounters: { - vector counters; + vector counters; FetchCounters(counters); break; } @@ -2149,7 +2179,7 @@ bool ReplayProxy::Tick(int type, Serialiser *incomingPacket) case eReplayProxy_DescribeCounter: { CounterDescription desc; - DescribeCounter(0, desc); + DescribeCounter(GPUCounter::EventGPUDuration, desc); break; } case eReplayProxy_FillCBufferVariables: @@ -2178,17 +2208,17 @@ bool ReplayProxy::Tick(int type, Serialiser *incomingPacket) InitPostVSBuffers(dummy); break; } - case eReplayProxy_GetPostVS: GetPostVSBuffers(0, 0, eMeshDataStage_Unknown); break; + case eReplayProxy_GetPostVS: GetPostVSBuffers(0, 0, MeshDataStage::Unknown); break; case eReplayProxy_BuildTargetShader: - BuildTargetShader("", "", 0, eShaderStage_Vertex, NULL, NULL); + BuildTargetShader("", "", 0, ShaderStage::Vertex, NULL, NULL); break; case eReplayProxy_ReplaceResource: ReplaceResource(ResourceId(), ResourceId()); break; case eReplayProxy_RemoveReplacement: RemoveReplacement(ResourceId()); break; case eReplayProxy_RenderOverlay: - RenderOverlay(ResourceId(), eCompType_None, eTexOverlay_None, 0, vector()); + RenderOverlay(ResourceId(), CompType::Typeless, DebugOverlay::NoOverlay, 0, vector()); break; case eReplayProxy_PixelHistory: - PixelHistory(vector(), ResourceId(), 0, 0, 0, 0, 0, eCompType_None); + PixelHistory(vector(), ResourceId(), 0, 0, 0, 0, 0, CompType::Typeless); break; case eReplayProxy_DebugVertex: DebugVertex(0, 0, 0, 0, 0, 0); break; case eReplayProxy_DebugPixel: DebugPixel(0, 0, 0, 0, 0); break; @@ -2520,11 +2550,11 @@ ResourceId ReplayProxy::GetLiveID(ResourceId id) return ret; } -vector ReplayProxy::FetchCounters(const vector &counters) +vector ReplayProxy::FetchCounters(const vector &counters) { vector ret; - m_ToReplaySerialiser->Serialise("", (vector &)counters); + m_ToReplaySerialiser->Serialise("", (vector &)counters); if(m_RemoteServer) { @@ -2541,9 +2571,9 @@ vector ReplayProxy::FetchCounters(const vector &counter return ret; } -vector ReplayProxy::EnumerateCounters() +vector ReplayProxy::EnumerateCounters() { - vector ret; + vector ret; if(m_RemoteServer) { @@ -2560,7 +2590,7 @@ vector ReplayProxy::EnumerateCounters() return ret; } -void ReplayProxy::DescribeCounter(uint32_t counterID, CounterDescription &desc) +void ReplayProxy::DescribeCounter(GPUCounter counterID, CounterDescription &desc) { m_ToReplaySerialiser->Serialise("", counterID); @@ -2748,9 +2778,8 @@ MeshFormat ReplayProxy::GetPostVSBuffers(uint32_t eventID, uint32_t instID, Mesh return ret; } -ResourceId ReplayProxy::RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) +ResourceId ReplayProxy::RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { ResourceId ret; @@ -2905,7 +2934,7 @@ Callstack::AddressDetails ReplayProxy::GetAddr(uint64_t addr) } void ReplayProxy::BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { uint32_t flags = compileFlags; m_ToReplaySerialiser->Serialise("", source); @@ -2972,7 +3001,7 @@ void ReplayProxy::RemoveReplacement(ResourceId id) vector ReplayProxy::PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, uint32_t sampleIdx, - FormatComponentType typeHint) + CompType typeHint) { vector ret; diff --git a/renderdoc/core/replay_proxy.h b/renderdoc/core/replay_proxy.h index 41f78671b..0ec1d5d50 100644 --- a/renderdoc/core/replay_proxy.h +++ b/renderdoc/core/replay_proxy.h @@ -189,7 +189,7 @@ public: } bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) + CompType typeHint, float *minval, float *maxval) { if(m_Proxy) { @@ -204,7 +204,7 @@ public: } bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram) { if(m_Proxy) @@ -230,8 +230,8 @@ public: // due to OpenGL having origin bottom-left compared to the rest of the world, // we need to flip going in or out of GL. - if((m_APIProps.pipelineType == eGraphicsAPI_OpenGL) != - (m_APIProps.localRenderer == eGraphicsAPI_OpenGL)) + if((m_APIProps.pipelineType == GraphicsAPI::OpenGL) != + (m_APIProps.localRenderer == GraphicsAPI::OpenGL)) { cfg.FlipY = !cfg.FlipY; } @@ -243,7 +243,7 @@ public: } void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]) + uint32_t sample, CompType typeHint, float pixel[4]) { if(m_Proxy) { @@ -257,8 +257,8 @@ public: // we need to flip going in or out of GL. // This is a bit more annoying here as we don't have a bool to flip, we need to // manually adjust y - if((m_APIProps.pipelineType == eGraphicsAPI_OpenGL) != - (m_APIProps.localRenderer == eGraphicsAPI_OpenGL)) + if((m_APIProps.pipelineType == GraphicsAPI::OpenGL) != + (m_APIProps.localRenderer == GraphicsAPI::OpenGL)) { FetchTexture tex = m_Proxy->GetTexture(texture); uint32_t mipHeight = RDCMAX(1U, tex.height >> mip); @@ -343,8 +343,8 @@ public: return ~0U; } - void BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors) { if(m_Proxy) { @@ -366,7 +366,7 @@ public: } ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint) + uint32_t sampleIdx, CompType typeHint) { if(m_Proxy) { @@ -412,9 +412,9 @@ public: ResourceId GetLiveID(ResourceId id); - vector EnumerateCounters(); - void DescribeCounter(uint32_t counterID, CounterDescription &desc); - vector FetchCounters(const vector &counterID); + vector EnumerateCounters(); + void DescribeCounter(GPUCounter counterID, CounterDescription &desc); + vector FetchCounters(const vector &counterID); void FillCBufferVariables(ResourceId shader, string entryPoint, uint32_t cbufSlot, vector &outvars, const vector &data); @@ -427,9 +427,8 @@ public: void InitPostVSBuffers(const vector &passEvents); MeshFormat GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDataStage stage); - ResourceId RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents); + ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents); ShaderReflection *GetShader(ResourceId shader, string entryPoint); @@ -443,15 +442,15 @@ public: vector PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ShaderDebugTrace DebugVertex(uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset); ShaderDebugTrace DebugPixel(uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive); ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]); - void BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); + void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); void ReplaceResource(ResourceId from, ResourceId to); void RemoveReplacement(ResourceId id); diff --git a/renderdoc/core/target_control.cpp b/renderdoc/core/target_control.cpp index 71164a45a..e20ffb25c 100644 --- a/renderdoc/core/target_control.cpp +++ b/renderdoc/core/target_control.cpp @@ -128,7 +128,7 @@ void RenderDoc::TargetControlClientThread(void *s) ser.Serialise("", path); rdctype::array buf; - RENDERDOC_GetThumbnail(captures.back().path.c_str(), eFileType_JPG, 0, &buf); + RENDERDOC_GetThumbnail(captures.back().path.c_str(), FileType::JPG, 0, &buf); size_t sz = buf.size(); ser.Serialise("", buf.count); @@ -488,7 +488,7 @@ public: { if(m_Socket == NULL) { - msg->Type = eTargetControlMsg_Disconnected; + msg->Type = TargetControlMessageType::Disconnected; return; } @@ -497,12 +497,12 @@ public: if(!m_Socket->Connected()) { SAFE_DELETE(m_Socket); - msg->Type = eTargetControlMsg_Disconnected; + msg->Type = TargetControlMessageType::Disconnected; } else { Threading::Sleep(2); - msg->Type = eTargetControlMsg_Noop; + msg->Type = TargetControlMessageType::Noop; } return; @@ -517,7 +517,7 @@ public: { SAFE_DELETE(ser); - msg->Type = eTargetControlMsg_Disconnected; + msg->Type = TargetControlMessageType::Disconnected; return; } else @@ -526,7 +526,7 @@ public: { SAFE_DELETE(ser); - msg->Type = eTargetControlMsg_Noop; + msg->Type = TargetControlMessageType::Noop; return; } else if(type == ePacket_Busy) @@ -539,13 +539,13 @@ public: SAFE_DELETE(m_Socket); RDCLOG("Got busy signal: '%s", existingClient.c_str()); - msg->Type = eTargetControlMsg_Busy; + msg->Type = TargetControlMessageType::Busy; msg->Busy.ClientName = existingClient; return; } else if(type == ePacket_CopyCapture) { - msg->Type = eTargetControlMsg_CaptureCopied; + msg->Type = TargetControlMessageType::CaptureCopied; ser->Serialise("", msg->NewCapture.ID); @@ -558,7 +558,7 @@ public: SAFE_DELETE(ser); SAFE_DELETE(m_Socket); - msg->Type = eTargetControlMsg_Disconnected; + msg->Type = TargetControlMessageType::Disconnected; return; } @@ -570,7 +570,7 @@ public: } else if(type == ePacket_NewChild) { - msg->Type = eTargetControlMsg_NewChild; + msg->Type = TargetControlMessageType::NewChild; ser->Serialise("", msg->NewChild.PID); ser->Serialise("", msg->NewChild.ident); @@ -583,7 +583,7 @@ public: } else if(type == ePacket_NewCapture) { - msg->Type = eTargetControlMsg_NewCapture; + msg->Type = TargetControlMessageType::NewCapture; ser->Serialise("", msg->NewCapture.ID); ser->Serialise("", msg->NewCapture.timestamp); @@ -611,7 +611,7 @@ public: } else if(type == ePacket_RegisterAPI) { - msg->Type = eTargetControlMsg_RegisterAPI; + msg->Type = TargetControlMessageType::RegisterAPI; ser->Serialise("", m_API); msg->RegisterAPI.APIName = m_API; @@ -626,7 +626,7 @@ public: SAFE_DELETE(ser); - msg->Type = eTargetControlMsg_Noop; + msg->Type = TargetControlMessageType::Noop; } private: diff --git a/renderdoc/driver/d3d11/d3d11_analyse.cpp b/renderdoc/driver/d3d11/d3d11_analyse.cpp index fde805397..5183eb5c6 100644 --- a/renderdoc/driver/d3d11/d3d11_analyse.cpp +++ b/renderdoc/driver/d3d11/d3d11_analyse.cpp @@ -93,7 +93,7 @@ void D3D11DebugManager::FillCBufferVariables(const string &prefix, size_t &offse ShaderVariable var; var.name = basename; var.rows = var.columns = 0; - var.type = eVar_Float; + var.type = VarType::Float; std::vector varmembers; @@ -113,7 +113,7 @@ void D3D11DebugManager::FillCBufferVariables(const string &prefix, size_t &offse ShaderVariable vr; vr.name = basename + buf; vr.rows = vr.columns = 0; - vr.type = eVar_Float; + vr.type = VarType::Float; std::vector mems; @@ -159,17 +159,17 @@ void D3D11DebugManager::FillCBufferVariables(const string &prefix, size_t &offse } size_t elemByteSize = 4; - VarType type = eVar_Float; + VarType type = VarType::Float; switch(invars[v].type.descriptor.type) { - case VARTYPE_INT: type = eVar_Int; break; - case VARTYPE_FLOAT: type = eVar_Float; break; + case VARTYPE_INT: type = VarType::Int; break; + case VARTYPE_FLOAT: type = VarType::Float; break; case VARTYPE_BOOL: case VARTYPE_UINT: - case VARTYPE_UINT8: type = eVar_UInt; break; + case VARTYPE_UINT8: type = VarType::UInt; break; case VARTYPE_DOUBLE: elemByteSize = 8; - type = eVar_Double; + type = VarType::Double; break; default: RDCERR("Unexpected type %d for variable '%s' in cbuffer", invars[v].type.descriptor.type, @@ -466,10 +466,10 @@ ShaderDebug::State D3D11DebugManager::CreateShaderDebugState(ShaderDebugTrace &t ? 2 : sig.regChannelMask & 0x1 ? 1 : 0; - if(sig.compType == eCompType_UInt) - v.type = eVar_UInt; - else if(sig.compType == eCompType_SInt) - v.type = eVar_Int; + if(sig.compType == CompType::UInt) + v.type = VarType::UInt; + else if(sig.compType == CompType::SInt) + v.type = VarType::Int; if(trace.inputs[sig.regIndex].columns == 0) trace.inputs[sig.regIndex] = v; @@ -536,15 +536,15 @@ ShaderDebug::State D3D11DebugManager::CreateShaderDebugState(ShaderDebugTrace &t ShaderVariable v; - if(sig.systemValue == eAttr_OutputControlPointIndex) + if(sig.systemValue == ShaderBuiltin::OutputControlPointIndex) v.name = "vOutputControlPointID"; - else if(sig.systemValue == eAttr_DepthOutput) + else if(sig.systemValue == ShaderBuiltin::DepthOutput) v.name = "oDepth"; - else if(sig.systemValue == eAttr_DepthOutputLessEqual) + else if(sig.systemValue == ShaderBuiltin::DepthOutputLessEqual) v.name = "oDepthLessEqual"; - else if(sig.systemValue == eAttr_DepthOutputGreaterEqual) + else if(sig.systemValue == ShaderBuiltin::DepthOutputGreaterEqual) v.name = "oDepthGreaterEqual"; - else if(sig.systemValue == eAttr_MSAACoverage) + else if(sig.systemValue == ShaderBuiltin::MSAACoverage) v.name = "oMask"; // if(sig.systemValue == TYPE_OUTPUT_CONTROL_POINT) str = "oOutputControlPoint"; else @@ -883,7 +883,7 @@ void D3D11DebugManager::CreateShaderGlobalState(ShaderDebug::GlobalState &global // want to copy the data to struct DataOutput { - DataOutput(int regster, int element, int numWords, SystemAttribute attr, bool inc) + DataOutput(int regster, int element, int numWords, ShaderBuiltin attr, bool inc) { reg = regster; elem = element; @@ -894,7 +894,7 @@ struct DataOutput int reg; int elem; - SystemAttribute sysattribute; + ShaderBuiltin sysattribute; int numwords; @@ -1019,10 +1019,11 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti for(int32_t i = 0; i < ret.inputs.count; i++) { - if(dxbc->m_InputSig[i].systemValue == eAttr_None || - dxbc->m_InputSig[i].systemValue == eAttr_Position) // SV_Position seems to get promoted - // automatically, but it's invalid for - // vertex input + if(dxbc->m_InputSig[i].systemValue == ShaderBuiltin::Undefined || + dxbc->m_InputSig[i].systemValue == + ShaderBuiltin::Position) // SV_Position seems to get promoted + // automatically, but it's invalid for + // vertex input { const D3D11_INPUT_ELEMENT_DESC *el = NULL; @@ -1085,7 +1086,7 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti { ret.inputs[i].value.u.w = 1; - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret.inputs[i].value.f.w = 1.0f; } @@ -1099,8 +1100,8 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti // if there's only e.g. 3 bytes remaining don't read and unpack some of // a 4-byte special format size_t packedsize = 4; - if(fmt.specialFormat == eSpecial_R5G5B5A1 || fmt.specialFormat == eSpecial_R5G6B5 || - fmt.specialFormat == eSpecial_R4G4B4A4) + if(fmt.specialFormat == SpecialFormat::R5G5B5A1 || + fmt.specialFormat == SpecialFormat::R5G6B5 || fmt.specialFormat == SpecialFormat::R4G4B4A4) packedsize = 2; if(srcData == NULL || packedsize > dataSize) @@ -1108,29 +1109,29 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti ret.inputs[i].value.u.x = ret.inputs[i].value.u.y = ret.inputs[i].value.u.z = ret.inputs[i].value.u.w = 0; } - else if(fmt.specialFormat == eSpecial_R5G5B5A1) + else if(fmt.specialFormat == SpecialFormat::R5G5B5A1) { RDCASSERT(fmt.bgraOrder); uint16_t packed = ((uint16_t *)srcData)[0]; *v4 = ConvertFromB5G5R5A1(packed); } - else if(fmt.specialFormat == eSpecial_R5G6B5) + else if(fmt.specialFormat == SpecialFormat::R5G6B5) { RDCASSERT(fmt.bgraOrder); uint16_t packed = ((uint16_t *)srcData)[0]; *v3 = ConvertFromB5G6R5(packed); } - else if(fmt.specialFormat == eSpecial_R4G4B4A4) + else if(fmt.specialFormat == SpecialFormat::R4G4B4A4) { RDCASSERT(fmt.bgraOrder); uint16_t packed = ((uint16_t *)srcData)[0]; *v4 = ConvertFromB4G4R4A4(packed); } - else if(fmt.specialFormat == eSpecial_R10G10B10A2) + else if(fmt.specialFormat == SpecialFormat::R10G10B10A2) { uint32_t packed = ((uint32_t *)srcData)[0]; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) { ret.inputs[i].value.u.z = (packed >> 0) & 0x3ff; ret.inputs[i].value.u.y = (packed >> 10) & 0x3ff; @@ -1142,7 +1143,7 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti *v4 = ConvertFromR10G10B10A2(packed); } } - else if(fmt.special && fmt.specialFormat == eSpecial_R11G11B10) + else if(fmt.special && fmt.specialFormat == SpecialFormat::R11G11B10) { uint32_t packed = ((uint32_t *)srcData)[0]; *v3 = ConvertFromR11G11B10(packed); @@ -1164,13 +1165,13 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti { byte *src = srcData + c * fmt.compByteWidth; - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) ret.inputs[i].value.uv[c] = *src; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret.inputs[i].value.iv[c] = *((int8_t *)src); - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret.inputs[i].value.fv[c] = float(*src) / 255.0f; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) { signed char *schar = (signed char *)src; @@ -1187,15 +1188,15 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti { uint16_t *src = (uint16_t *)(srcData + c * fmt.compByteWidth); - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret.inputs[i].value.fv[c] = ConvertFromHalf(*src); - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret.inputs[i].value.uv[c] = *src; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret.inputs[i].value.iv[c] = *((int16_t *)src); - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret.inputs[i].value.fv[c] = float(*src) / float(UINT16_MAX); - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) { int16_t *sint = (int16_t *)src; @@ -1212,8 +1213,8 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti { uint32_t *src = (uint32_t *)(srcData + c * fmt.compByteWidth); - if(fmt.compType == eCompType_Float || fmt.compType == eCompType_UInt || - fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::Float || fmt.compType == CompType::UInt || + fmt.compType == CompType::SInt) memcpy(&ret.inputs[i].value.uv[c], src, 4); else RDCERR("Unexpected component type"); @@ -1227,23 +1228,23 @@ ShaderDebugTrace D3D11DebugManager::DebugVertex(uint32_t eventID, uint32_t verti } } } - else if(dxbc->m_InputSig[i].systemValue == eAttr_VertexIndex) + else if(dxbc->m_InputSig[i].systemValue == ShaderBuiltin::VertexIndex) { uint32_t sv_vertid = vertid; - if(draw->flags & eDraw_UseIBuffer) + if(draw->flags & DrawFlags::UseIBuffer) sv_vertid = idx; - if(dxbc->m_InputSig[i].compType == eCompType_Float) + if(dxbc->m_InputSig[i].compType == CompType::Float) ret.inputs[i].value.f.x = ret.inputs[i].value.f.y = ret.inputs[i].value.f.z = ret.inputs[i].value.f.w = (float)sv_vertid; else ret.inputs[i].value.u.x = ret.inputs[i].value.u.y = ret.inputs[i].value.u.z = ret.inputs[i].value.u.w = sv_vertid; } - else if(dxbc->m_InputSig[i].systemValue == eAttr_InstanceIndex) + else if(dxbc->m_InputSig[i].systemValue == ShaderBuiltin::InstanceIndex) { - if(dxbc->m_InputSig[i].compType == eCompType_Float) + if(dxbc->m_InputSig[i].compType == CompType::Float) ret.inputs[i].value.f.x = ret.inputs[i].value.f.y = ret.inputs[i].value.f.z = ret.inputs[i].value.f.w = (float)instid; else @@ -1358,7 +1359,7 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin { extractHlsl += "float4 input_dummy : SV_Position;\n"; - initialValues.push_back(DataOutput(-1, 0, 4, eAttr_None, true)); + initialValues.push_back(DataOutput(-1, 0, 4, ShaderBuiltin::Undefined, true)); structureStride += 4; } @@ -1376,10 +1377,10 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin bool included = true; // handled specially to account for SV_ ordering - if(dxbc->m_InputSig[i].systemValue == eAttr_PrimitiveIndex || - dxbc->m_InputSig[i].systemValue == eAttr_MSAACoverage || - dxbc->m_InputSig[i].systemValue == eAttr_IsFrontFace || - dxbc->m_InputSig[i].systemValue == eAttr_MSAASampleIndex) + if(dxbc->m_InputSig[i].systemValue == ShaderBuiltin::PrimitiveIndex || + dxbc->m_InputSig[i].systemValue == ShaderBuiltin::MSAACoverage || + dxbc->m_InputSig[i].systemValue == ShaderBuiltin::IsFrontFace || + dxbc->m_InputSig[i].systemValue == ShaderBuiltin::MSAASampleIndex) { extractHlsl += "//"; included = false; @@ -1415,11 +1416,11 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin { filled = true; - if(prevdxbc->m_OutputSig[os].compType == eCompType_Float) + if(prevdxbc->m_OutputSig[os].compType == CompType::Float) extractHlsl += "float"; - else if(prevdxbc->m_OutputSig[os].compType == eCompType_SInt) + else if(prevdxbc->m_OutputSig[os].compType == CompType::SInt) extractHlsl += "int"; - else if(prevdxbc->m_OutputSig[os].compType == eCompType_UInt) + else if(prevdxbc->m_OutputSig[os].compType == CompType::UInt) extractHlsl += "uint"; else RDCERR("Unexpected input signature type: %d", prevdxbc->m_OutputSig[os].compType); @@ -1431,7 +1432,7 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin structureStride += 4 * numCols; - initialValues.push_back(DataOutput(-1, 0, numCols, eAttr_None, true)); + initialValues.push_back(DataOutput(-1, 0, numCols, ShaderBuiltin::Undefined, true)); string name = prevdxbc->m_OutputSig[os].semanticIdxName.elems; @@ -1446,7 +1447,7 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin dummy_reg += ToStr::Get((uint32_t)nextreg + dummy); extractHlsl += "float4 var_" + dummy_reg + " : semantic_" + dummy_reg + ";\n"; - initialValues.push_back(DataOutput(-1, 0, 4, eAttr_None, true)); + initialValues.push_back(DataOutput(-1, 0, 4, ShaderBuiltin::Undefined, true)); structureStride += 4 * sizeof(float); } @@ -1454,11 +1455,11 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin nextreg = dxbc->m_InputSig[i].regIndex + 1; - if(dxbc->m_InputSig[i].compType == eCompType_Float) + if(dxbc->m_InputSig[i].compType == CompType::Float) extractHlsl += "float"; - else if(dxbc->m_InputSig[i].compType == eCompType_SInt) + else if(dxbc->m_InputSig[i].compType == CompType::SInt) extractHlsl += "int"; - else if(dxbc->m_InputSig[i].compType == eCompType_UInt) + else if(dxbc->m_InputSig[i].compType == CompType::UInt) extractHlsl += "uint"; else RDCERR("Unexpected input signature type: %d", dxbc->m_InputSig[i].compType); @@ -1575,7 +1576,7 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin extractHlsl += "[" + ToStr::Get(arrayLength) + "]"; extractHlsl += " : " + name; - if(included && dxbc->m_InputSig[i].compType == eCompType_Float) + if(included && dxbc->m_InputSig[i].compType == CompType::Float) { if(arrayLength == 0) { @@ -1902,19 +1903,19 @@ ShaderDebugTrace D3D11DebugManager::DebugPixel(uint32_t eventID, uint32_t x, uin { ShaderVariable &invar = traces[destIdx].inputs[initialValues[i].reg]; - if(initialValues[i].sysattribute == eAttr_PrimitiveIndex) + if(initialValues[i].sysattribute == ShaderBuiltin::PrimitiveIndex) { invar.value.u.x = hit->primitive; } - else if(initialValues[i].sysattribute == eAttr_MSAASampleIndex) + else if(initialValues[i].sysattribute == ShaderBuiltin::MSAASampleIndex) { invar.value.u.x = hit->sample; } - else if(initialValues[i].sysattribute == eAttr_MSAACoverage) + else if(initialValues[i].sysattribute == ShaderBuiltin::MSAACoverage) { invar.value.u.x = hit->coverage; } - else if(initialValues[i].sysattribute == eAttr_IsFrontFace) + else if(initialValues[i].sysattribute == ShaderBuiltin::IsFrontFace) { invar.value.u.x = hit->isFrontFace ? ~0U : 0; } @@ -2357,7 +2358,7 @@ uint32_t D3D11DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg, resFmt.compCount = cfg.position.compCount; resFmt.compType = cfg.position.compType; resFmt.special = false; - if(cfg.position.specialFormat != eSpecial_Unknown) + if(cfg.position.specialFormat != SpecialFormat::Unknown) { resFmt.special = true; resFmt.specialFormat = cfg.position.specialFormat; @@ -2436,22 +2437,22 @@ uint32_t D3D11DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg, bool isTriangleMesh = true; switch(cfg.position.topo) { - case eTopology_TriangleList: + case Topology::TriangleList: { cbuf.MeshMode = MESH_TRIANGLE_LIST; break; } - case eTopology_TriangleStrip: + case Topology::TriangleStrip: { cbuf.MeshMode = MESH_TRIANGLE_STRIP; break; } - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: { cbuf.MeshMode = MESH_TRIANGLE_LIST_ADJ; break; } - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: { cbuf.MeshMode = MESH_TRIANGLE_STRIP_ADJ; break; @@ -2719,8 +2720,7 @@ uint32_t D3D11DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg, } void D3D11DebugManager::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, - uint32_t mip, uint32_t sample, FormatComponentType typeHint, - float pixel[4]) + uint32_t mip, uint32_t sample, CompType typeHint, float pixel[4]) { D3D11RenderStateTracker tracker(m_WrappedContext); @@ -2922,7 +2922,7 @@ byte *D3D11DebugManager::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint3 texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true; texDisplay.HDRMul = -1.0f; texDisplay.linearDisplayAsGamma = false; - texDisplay.overlay = eTexOverlay_None; + texDisplay.overlay = DebugOverlay::NoOverlay; texDisplay.FlipY = false; texDisplay.mip = mip; texDisplay.sampleIdx = 0; @@ -3064,7 +3064,7 @@ byte *D3D11DebugManager::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint3 texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true; texDisplay.HDRMul = -1.0f; texDisplay.linearDisplayAsGamma = false; - texDisplay.overlay = eTexOverlay_None; + texDisplay.overlay = DebugOverlay::NoOverlay; texDisplay.FlipY = false; texDisplay.mip = mip; texDisplay.sampleIdx = params.resolve ? ~0U : arrayIdx; @@ -3226,7 +3226,7 @@ byte *D3D11DebugManager::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint3 texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true; texDisplay.HDRMul = -1.0f; texDisplay.linearDisplayAsGamma = false; - texDisplay.overlay = eTexOverlay_None; + texDisplay.overlay = DebugOverlay::NoOverlay; texDisplay.FlipY = false; texDisplay.mip = mip; texDisplay.sampleIdx = 0; @@ -3308,7 +3308,7 @@ byte *D3D11DebugManager::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint3 ResourceId D3D11DebugManager::ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, uint32_t sampleIdx, - FormatComponentType typeHint) + CompType typeHint) { TextureShaderDetails details = GetShaderDetails(texid, typeHint, false); @@ -3361,7 +3361,7 @@ ResourceId D3D11DebugManager::ApplyCustomShader(ResourceId shader, ResourceId te disp.linearDisplayAsGamma = false; disp.mip = mip; disp.sampleIdx = sampleIdx; - disp.overlay = eTexOverlay_None; + disp.overlay = DebugOverlay::NoOverlay; disp.rangemin = 0.0f; disp.rangemax = 1.0f; disp.rawoutput = false; @@ -3415,9 +3415,8 @@ void D3D11DebugManager::CreateCustomShaderTex(uint32_t w, uint32_t h) } } -ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) +ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { TextureShaderDetails details = GetShaderDetails(texid, typeHint, false); @@ -3569,11 +3568,11 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp dsDesc.StencilEnable = FALSE; dsDesc.StencilReadMask = dsDesc.StencilWriteMask = 0xff; - if(overlay == eTexOverlay_NaN || overlay == eTexOverlay_Clipping) + if(overlay == DebugOverlay::NaN || overlay == DebugOverlay::Clipping) { // just need the basic texture } - else if(overlay == eTexOverlay_Drawcall) + else if(overlay == DebugOverlay::Drawcall) { m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0); @@ -3630,7 +3629,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(os); SAFE_RELEASE(rs); } - else if(overlay == eTexOverlay_BackfaceCull) + else if(overlay == DebugOverlay::BackfaceCull) { m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0); @@ -3722,7 +3721,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(rs); SAFE_RELEASE(rsCull); } - else if(overlay == eTexOverlay_ViewportScissor) + else if(overlay == DebugOverlay::ViewportScissor) { m_pImmediateContext->VSSetShader(m_DebugRender.FullscreenVS, NULL, 0); m_pImmediateContext->HSSetShader(NULL, NULL, 0); @@ -3861,7 +3860,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(rs); SAFE_RELEASE(bs); } - else if(overlay == eTexOverlay_Wireframe) + else if(overlay == DebugOverlay::Wireframe) { m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0); @@ -3931,18 +3930,18 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(os); SAFE_RELEASE(rs); } - else if(overlay == eTexOverlay_ClearBeforePass || overlay == eTexOverlay_ClearBeforeDraw) + else if(overlay == DebugOverlay::ClearBeforePass || overlay == DebugOverlay::ClearBeforeDraw) { vector events = passEvents; - if(overlay == eTexOverlay_ClearBeforeDraw) + if(overlay == DebugOverlay::ClearBeforeDraw) events.clear(); events.push_back(eventID); if(!events.empty()) { - if(overlay == eTexOverlay_ClearBeforePass) + if(overlay == DebugOverlay::ClearBeforePass) m_WrappedDevice->ReplayLog(0, events[0], eReplay_WithoutDraw); D3D11RenderState *state = m_WrappedContext->GetCurrentPipelineState(); @@ -3955,7 +3954,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp { m_WrappedDevice->ReplayLog(events[i], events[i], eReplay_OnlyDraw); - if(overlay == eTexOverlay_ClearBeforePass) + if(overlay == DebugOverlay::ClearBeforePass) { m_WrappedDevice->ReplayLog(events[i], events[i], eReplay_OnlyDraw); @@ -3965,7 +3964,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp } } } - else if(overlay == eTexOverlay_TriangleSizeDraw || overlay == eTexOverlay_TriangleSizePass) + else if(overlay == DebugOverlay::TriangleSizeDraw || overlay == DebugOverlay::TriangleSizePass) { SCOPED_TIMER("Triangle size"); @@ -4009,12 +4008,12 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp vector events = passEvents; - if(overlay == eTexOverlay_TriangleSizeDraw) + if(overlay == DebugOverlay::TriangleSizeDraw) events.clear(); events.push_back(eventID); - if(overlay == eTexOverlay_TriangleSizePass) + if(overlay == DebugOverlay::TriangleSizePass) m_WrappedDevice->ReplayLog(0, events[0], eReplay_WithoutDraw); events.push_back(eventID); @@ -4053,9 +4052,9 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp for(uint32_t inst = 0; draw && inst < RDCMAX(1U, draw->numInstances); inst++) { - MeshFormat fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_GSOut); + MeshFormat fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::GSOut); if(fmt.buf == ResourceId()) - fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_VSOut); + fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::VSOut); if(fmt.buf != ResourceId()) { @@ -4114,7 +4113,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp oldstate.ApplyState(m_WrappedContext); - if(overlay == eTexOverlay_TriangleSizePass) + if(overlay == DebugOverlay::TriangleSizePass) { m_WrappedDevice->ReplayLog(events[i], events[i], eReplay_OnlyDraw); @@ -4123,23 +4122,23 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp } } - if(overlay == eTexOverlay_TriangleSizePass) + if(overlay == DebugOverlay::TriangleSizePass) m_WrappedDevice->ReplayLog(0, eventID, eReplay_WithoutDraw); } - else if(overlay == eTexOverlay_QuadOverdrawPass || overlay == eTexOverlay_QuadOverdrawDraw) + else if(overlay == DebugOverlay::QuadOverdrawPass || overlay == DebugOverlay::QuadOverdrawDraw) { SCOPED_TIMER("Quad Overdraw"); vector events = passEvents; - if(overlay == eTexOverlay_QuadOverdrawDraw) + if(overlay == DebugOverlay::QuadOverdrawDraw) events.clear(); events.push_back(eventID); if(!events.empty()) { - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) m_WrappedDevice->ReplayLog(0, events[0], eReplay_WithoutDraw); D3D11RenderState *state = m_WrappedContext->GetCurrentPipelineState(); @@ -4290,7 +4289,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp oldstate.ApplyState(m_WrappedContext); - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) { m_WrappedDevice->ReplayLog(events[i], events[i], eReplay_OnlyDraw); @@ -4334,7 +4333,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(overdrawSRV); SAFE_RELEASE(overdrawUAV); - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) m_WrappedDevice->ReplayLog(0, eventID, eReplay_WithoutDraw); } } @@ -4379,13 +4378,13 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp if(!cur.StencilEnable) cur.StencilEnable = D3D11_COMPARISON_ALWAYS; - if(overlay == eTexOverlay_Depth || overlay == eTexOverlay_Stencil) + if(overlay == DebugOverlay::Depth || overlay == DebugOverlay::Stencil) { ID3D11DepthStencilState *os = NULL; D3D11_DEPTH_STENCIL_DESC d = dsDesc; - if(overlay == eTexOverlay_Depth) + if(overlay == DebugOverlay::Depth) { dsDesc.DepthEnable = d.DepthEnable = TRUE; dsDesc.StencilEnable = d.StencilEnable = FALSE; @@ -4405,7 +4404,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp case D3D11_COMPARISON_LESS_EQUAL: d.DepthFunc = D3D11_COMPARISON_GREATER; break; } } - else if(overlay == eTexOverlay_Stencil) + else if(overlay == DebugOverlay::Stencil) { dsDesc.DepthEnable = d.DepthEnable = FALSE; dsDesc.StencilEnable = d.StencilEnable = TRUE; @@ -4490,11 +4489,11 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp d = dsDesc; - if(overlay == eTexOverlay_Depth) + if(overlay == DebugOverlay::Depth) { d.DepthFunc = cur.DepthFunc; } - else if(overlay == eTexOverlay_Stencil) + else if(overlay == DebugOverlay::Stencil) { d.FrontFace = cur.FrontFace; d.BackFace = cur.BackFace; @@ -4525,7 +4524,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp else { // no depth? trivial pass for depth or stencil tests - if(overlay == eTexOverlay_Depth || overlay == eTexOverlay_Stencil) + if(overlay == DebugOverlay::Depth || overlay == DebugOverlay::Stencil) { m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0); @@ -4746,8 +4745,7 @@ void D3D11DebugManager::PixelHistoryCopyPixel(CopyPixelParams &p, uint32_t x, ui vector D3D11DebugManager::PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, - FormatComponentType typeHint) + uint32_t sampleIdx, CompType typeHint) { vector history; @@ -5292,10 +5290,11 @@ vector D3D11DebugManager::PixelHistory(vector eve curNumScissors = curNumViews = 16; bool uavOutput = - ((events[ev].usage >= eUsage_VS_RWResource && events[ev].usage <= eUsage_CS_RWResource) || - events[ev].usage == eUsage_CopyDst || events[ev].usage == eUsage_Copy || - events[ev].usage == eUsage_Resolve || events[ev].usage == eUsage_ResolveDst || - events[ev].usage == eUsage_GenMips); + ((events[ev].usage >= ResourceUsage::VS_RWResource && + events[ev].usage <= ResourceUsage::CS_RWResource) || + events[ev].usage == ResourceUsage::CopyDst || events[ev].usage == ResourceUsage::Copy || + events[ev].usage == ResourceUsage::Resolve || + events[ev].usage == ResourceUsage::ResolveDst || events[ev].usage == ResourceUsage::GenMips); m_pImmediateContext->RSGetState(&curRS); m_pImmediateContext->OMGetBlendState(&curBS, blendFactor, &curSample); @@ -5805,13 +5804,14 @@ vector D3D11DebugManager::PixelHistory(vector eve const FetchDrawcall *draw = m_WrappedDevice->GetDrawcall(events[i].eventID); - bool clear = (draw->flags & eDraw_Clear); + bool clear = bool(draw->flags & DrawFlags::Clear); bool uavWrite = - ((events[i].usage >= eUsage_VS_RWResource && events[i].usage <= eUsage_CS_RWResource) || - events[i].usage == eUsage_CopyDst || events[i].usage == eUsage_Copy || - events[i].usage == eUsage_Resolve || events[i].usage == eUsage_ResolveDst || - events[i].usage == eUsage_GenMips); + ((events[i].usage >= ResourceUsage::VS_RWResource && + events[i].usage <= ResourceUsage::CS_RWResource) || + events[i].usage == ResourceUsage::CopyDst || events[i].usage == ResourceUsage::Copy || + events[i].usage == ResourceUsage::Resolve || + events[i].usage == ResourceUsage::ResolveDst || events[i].usage == ResourceUsage::GenMips); if(events[i].view != ResourceId()) { @@ -5883,7 +5883,7 @@ vector D3D11DebugManager::PixelHistory(vector eve mod.preMod.col.value_u[0] = (uint32_t)i; - if((draw->flags & eDraw_Clear) == 0 && !uavWrite) + if(!(draw->flags & DrawFlags::Clear) && !uavWrite) { if(flags[i] & TestMustFail_DepthTesting) mod.depthTestFailed = true; @@ -6361,7 +6361,7 @@ vector D3D11DebugManager::PixelHistory(vector eve ModificationValue *val = (p == 0 ? &mod.preMod : &mod.postMod); - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) { // need to get correct sign, but otherwise just copy @@ -6393,8 +6393,8 @@ vector D3D11DebugManager::PixelHistory(vector eve } else { - if(fmt.special && - (fmt.specialFormat == eSpecial_R10G10B10A2 || fmt.specialFormat == eSpecial_R11G11B10)) + if(fmt.special && (fmt.specialFormat == SpecialFormat::R10G10B10A2 || + fmt.specialFormat == SpecialFormat::R11G11B10)) { byte *rowdata = pixstoreData + mapped.RowPitch * storey; @@ -6407,9 +6407,9 @@ vector D3D11DebugManager::PixelHistory(vector eve ModificationValue *val = (p == 0 ? &mod.preMod : &mod.postMod); Vec4f v; - if(fmt.specialFormat == eSpecial_R10G10B10A2) + if(fmt.specialFormat == SpecialFormat::R10G10B10A2) v = ConvertFromR10G10B10A2(*u); - if(fmt.specialFormat == eSpecial_R11G11B10) + if(fmt.specialFormat == SpecialFormat::R11G11B10) { Vec3f v3 = ConvertFromR11G11B10(*u); v = Vec4f(v3.x, v3.y, v3.z); @@ -6503,7 +6503,7 @@ vector D3D11DebugManager::PixelHistory(vector eve { const FetchDrawcall *draw = m_WrappedDevice->GetDrawcall(history[h].eventID); - if(draw->flags & eDraw_Clear) + if(draw->flags & DrawFlags::Clear) continue; D3D11MarkerRegion historyData( @@ -6756,7 +6756,7 @@ vector D3D11DebugManager::PixelHistory(vector eve { const FetchDrawcall *draw = m_WrappedDevice->GetDrawcall(history[h].eventID); - if(draw->flags & eDraw_Clear) + if(draw->flags & DrawFlags::Clear) continue; // if we're not the last modification in our event, need to fetch post fragment value @@ -6769,7 +6769,7 @@ vector D3D11DebugManager::PixelHistory(vector eve byte *rowdata = pixstoreData + mapped.RowPitch * (postColSlot / 2048); byte *data = rowdata + fmt.compCount * fmt.compByteWidth * (postColSlot % 2048); - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) { // need to get correct sign, but otherwise just copy @@ -6801,8 +6801,8 @@ vector D3D11DebugManager::PixelHistory(vector eve } else { - if(fmt.special && - (fmt.specialFormat == eSpecial_R10G10B10A2 || fmt.specialFormat == eSpecial_R11G11B10)) + if(fmt.special && (fmt.specialFormat == SpecialFormat::R10G10B10A2 || + fmt.specialFormat == SpecialFormat::R11G11B10)) { byte *rowdata = pixstoreData + mapped.RowPitch * (postColSlot / 2048); byte *data = rowdata + sizeof(uint32_t) * (postColSlot % 2048); @@ -6810,9 +6810,9 @@ vector D3D11DebugManager::PixelHistory(vector eve uint32_t *u = (uint32_t *)data; Vec4f v; - if(fmt.specialFormat == eSpecial_R10G10B10A2) + if(fmt.specialFormat == SpecialFormat::R10G10B10A2) v = ConvertFromR10G10B10A2(*u); - if(fmt.specialFormat == eSpecial_R11G11B10) + if(fmt.specialFormat == SpecialFormat::R11G11B10) { Vec3f v3 = ConvertFromR11G11B10(*u); v = Vec4f(v3.x, v3.y, v3.z); @@ -6978,7 +6978,7 @@ vector D3D11DebugManager::PixelHistory(vector eve m_pImmediateContext->Begin(testQueries[0]); // do draw - if(draw->flags & eDraw_UseIBuffer) + if(draw->flags & DrawFlags::UseIBuffer) { // TODO once pixel history distinguishes between instances, draw only the instance for // this fragment @@ -7020,12 +7020,12 @@ vector D3D11DebugManager::PixelHistory(vector eve m_pImmediateContext->Unmap(pixstoreDepthReadback, 0); // interpret float/unorm values - if(!fmt.special && fmt.compType != eCompType_UInt && fmt.compType != eCompType_SInt) + if(!fmt.special && fmt.compType != CompType::UInt && fmt.compType != CompType::SInt) { for(size_t h = 0; h < history.size(); h++) { PixelModification &mod = history[h]; - if(fmt.compType == eCompType_Float && fmt.compByteWidth == 2) + if(fmt.compType == CompType::Float && fmt.compByteWidth == 2) { for(uint32_t c = 0; c < fmt.compCount; c++) { @@ -7033,7 +7033,7 @@ vector D3D11DebugManager::PixelHistory(vector eve mod.postMod.col.value_f[c] = ConvertFromHalf(uint16_t(mod.postMod.col.value_u[c])); } } - else if(fmt.compType == eCompType_UNorm && fmt.compByteWidth == 1 && fmt.srgbCorrected) + else if(fmt.compType == CompType::UNorm && fmt.compByteWidth == 1 && fmt.srgbCorrected) { RDCASSERT(fmt.compByteWidth == 1); @@ -7050,7 +7050,7 @@ vector D3D11DebugManager::PixelHistory(vector eve mod.postMod.col.value_f[3] = float(mod.postMod.col.value_u[3] & 0xff) / 255.0f; } } - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) { // only 32bit unorm format is depth, handled separately float maxVal = fmt.compByteWidth == 2 ? 65535.0f : 255.0f; @@ -7063,7 +7063,7 @@ vector D3D11DebugManager::PixelHistory(vector eve mod.postMod.col.value_f[c] = float(mod.postMod.col.value_u[c]) / maxVal; } } - else if(fmt.compType == eCompType_SNorm && fmt.compByteWidth == 2) + else if(fmt.compType == CompType::SNorm && fmt.compByteWidth == 2) { for(uint32_t c = 0; c < fmt.compCount; c++) { @@ -7071,7 +7071,7 @@ vector D3D11DebugManager::PixelHistory(vector eve mod.postMod.col.value_f[c] = float(mod.postMod.col.value_u[c]); } } - else if(fmt.compType == eCompType_SNorm && fmt.compByteWidth == 1) + else if(fmt.compType == CompType::SNorm && fmt.compByteWidth == 1) { for(uint32_t c = 0; c < fmt.compCount; c++) { @@ -7090,7 +7090,7 @@ vector D3D11DebugManager::PixelHistory(vector eve mod.postMod.col.value_f[c] = float(*d) / 127.0f; } } - else if(fmt.compType == eCompType_SNorm && fmt.compByteWidth == 2) + else if(fmt.compType == CompType::SNorm && fmt.compByteWidth == 2) { for(uint32_t c = 0; c < fmt.compCount; c++) { diff --git a/renderdoc/driver/d3d11/d3d11_common.cpp b/renderdoc/driver/d3d11/d3d11_common.cpp index 42ac96f16..d67187c9b 100644 --- a/renderdoc/driver/d3d11/d3d11_common.cpp +++ b/renderdoc/driver/d3d11/d3d11_common.cpp @@ -73,12 +73,12 @@ static ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, switch(type.descriptor.type) { - case DXBC::VARTYPE_INT: ret.descriptor.type = eVar_Int; break; + case DXBC::VARTYPE_INT: ret.descriptor.type = VarType::Int; break; case DXBC::VARTYPE_BOOL: - case DXBC::VARTYPE_UINT: ret.descriptor.type = eVar_UInt; break; - case DXBC::VARTYPE_DOUBLE: ret.descriptor.type = eVar_Double; break; + case DXBC::VARTYPE_UINT: ret.descriptor.type = VarType::UInt; break; + case DXBC::VARTYPE_DOUBLE: ret.descriptor.type = VarType::Double; break; case DXBC::VARTYPE_FLOAT: - default: ret.descriptor.type = eVar_Float; break; + default: ret.descriptor.type = VarType::Float; break; } ret.descriptor.rows = type.descriptor.rows; ret.descriptor.cols = type.descriptor.cols; @@ -86,7 +86,7 @@ static ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, ret.descriptor.name = type.descriptor.name; ret.descriptor.rowMajorStorage = (type.descriptor.varClass == DXBC::CLASS_MATRIX_ROWS); - uint32_t baseElemSize = (ret.descriptor.type == eVar_Double) ? 8 : 4; + uint32_t baseElemSize = (ret.descriptor.type == VarType::Double) ? 8 : 4; if(ret.descriptor.rowMajorStorage) { uint32_t primary = ret.descriptor.rows; @@ -255,21 +255,25 @@ ShaderReflection *MakeShaderReflection(DXBC::DXBCFile *dxbc) switch(r.dimension) { default: - case DXBC::ShaderInputBind::DIM_UNKNOWN: res.resType = eResType_None; break; + case DXBC::ShaderInputBind::DIM_UNKNOWN: res.resType = TextureDim::Unknown; break; case DXBC::ShaderInputBind::DIM_BUFFER: - case DXBC::ShaderInputBind::DIM_BUFFEREX: res.resType = eResType_Buffer; break; - case DXBC::ShaderInputBind::DIM_TEXTURE1D: res.resType = eResType_Texture1D; break; - case DXBC::ShaderInputBind::DIM_TEXTURE1DARRAY: res.resType = eResType_Texture1DArray; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2D: res.resType = eResType_Texture2D; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2DARRAY: res.resType = eResType_Texture2DArray; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2DMS: res.resType = eResType_Texture2DMS; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2DMSARRAY: - res.resType = eResType_Texture2DMSArray; + case DXBC::ShaderInputBind::DIM_BUFFEREX: res.resType = TextureDim::Buffer; break; + case DXBC::ShaderInputBind::DIM_TEXTURE1D: res.resType = TextureDim::Texture1D; break; + case DXBC::ShaderInputBind::DIM_TEXTURE1DARRAY: + res.resType = TextureDim::Texture1DArray; break; - case DXBC::ShaderInputBind::DIM_TEXTURE3D: res.resType = eResType_Texture3D; break; - case DXBC::ShaderInputBind::DIM_TEXTURECUBE: res.resType = eResType_TextureCube; break; + case DXBC::ShaderInputBind::DIM_TEXTURE2D: res.resType = TextureDim::Texture2D; break; + case DXBC::ShaderInputBind::DIM_TEXTURE2DARRAY: + res.resType = TextureDim::Texture2DArray; + break; + case DXBC::ShaderInputBind::DIM_TEXTURE2DMS: res.resType = TextureDim::Texture2DMS; break; + case DXBC::ShaderInputBind::DIM_TEXTURE2DMSARRAY: + res.resType = TextureDim::Texture2DMSArray; + break; + case DXBC::ShaderInputBind::DIM_TEXTURE3D: res.resType = TextureDim::Texture3D; break; + case DXBC::ShaderInputBind::DIM_TEXTURECUBE: res.resType = TextureDim::TextureCube; break; case DXBC::ShaderInputBind::DIM_TEXTURECUBEARRAY: - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; break; } diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index 9a835b044..fbea22f31 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -807,7 +807,7 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch FetchDrawcall draw; draw.name = "Present()"; - draw.flags |= eDraw_Present; + draw.flags |= DrawFlags::Present; draw.copyDestination = m_pDevice->GetBackbufferResourceID(); @@ -852,19 +852,21 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) const D3D11RenderState *pipe = m_CurrentPipelineState; uint32_t e = d.eventID; - if((d.flags & (eDraw_Drawcall | eDraw_Dispatch | eDraw_CmdList)) == 0) + DrawFlags DrawMask = DrawFlags::Drawcall | DrawFlags::Dispatch | DrawFlags::CmdList; + if(!(d.flags & DrawMask)) return; ////////////////////////////// // IA - if(d.flags & eDraw_UseIBuffer && pipe->IA.IndexBuffer != NULL) + if(d.flags & DrawFlags::UseIBuffer && pipe->IA.IndexBuffer != NULL) m_ResourceUses[GetIDForResource(pipe->IA.IndexBuffer)].push_back( - EventUsage(e, eUsage_IndexBuffer)); + EventUsage(e, ResourceUsage::IndexBuffer)); for(int i = 0; i < D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; i++) if(pipe->IA.Used_VB(m_pDevice, i)) - m_ResourceUses[GetIDForResource(pipe->IA.VBs[i])].push_back(EventUsage(e, eUsage_VertexBuffer)); + m_ResourceUses[GetIDForResource(pipe->IA.VBs[i])].push_back( + EventUsage(e, ResourceUsage::VertexBuffer)); ////////////////////////////// // Shaders @@ -878,8 +880,7 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) for(int i = 0; i < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++) if(sh.Used_CB(i)) - m_ResourceUses[GetIDForResource(sh.ConstantBuffers[i])].push_back( - EventUsage(e, (ResourceUsage)(eUsage_VS_Constants + s))); + m_ResourceUses[GetIDForResource(sh.ConstantBuffers[i])].push_back(EventUsage(e, CBUsage(s))); for(int i = 0; i < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++) { @@ -887,7 +888,7 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) { WrappedID3D11ShaderResourceView1 *view = (WrappedID3D11ShaderResourceView1 *)sh.SRVs[i]; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(e, (ResourceUsage)(eUsage_VS_Resource + s), view->GetResourceID())); + EventUsage(e, ResUsage(s), view->GetResourceID())); } } @@ -900,7 +901,7 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) WrappedID3D11UnorderedAccessView1 *view = (WrappedID3D11UnorderedAccessView1 *)pipe->CSUAVs[i]; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(e, eUsage_CS_RWResource, view->GetResourceID())); + EventUsage(e, ResourceUsage::CS_RWResource, view->GetResourceID())); } } } @@ -911,7 +912,8 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) for(int i = 0; i < D3D11_SO_BUFFER_SLOT_COUNT; i++) if(pipe->SO.Buffers[i]) // assuming for now that any SO target bound is used. - m_ResourceUses[GetIDForResource(pipe->SO.Buffers[i])].push_back(EventUsage(e, eUsage_SO)); + m_ResourceUses[GetIDForResource(pipe->SO.Buffers[i])].push_back( + EventUsage(e, ResourceUsage::StreamOut)); ////////////////////////////// // OM @@ -922,7 +924,7 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) { WrappedID3D11UnorderedAccessView1 *view = (WrappedID3D11UnorderedAccessView1 *)pipe->OM.UAVs[i]; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(e, eUsage_PS_RWResource, view->GetResourceID())); + EventUsage(e, ResourceUsage::PS_RWResource, view->GetResourceID())); } } @@ -930,7 +932,7 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) { WrappedID3D11DepthStencilView *view = (WrappedID3D11DepthStencilView *)pipe->OM.DepthView; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(e, eUsage_DepthStencilTarget, view->GetResourceID())); + EventUsage(e, ResourceUsage::DepthStencilTarget, view->GetResourceID())); } for(int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++) @@ -940,7 +942,7 @@ void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d) WrappedID3D11RenderTargetView1 *view = (WrappedID3D11RenderTargetView1 *)pipe->OM.RenderTargets[i]; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(e, eUsage_ColourTarget, view->GetResourceID())); + EventUsage(e, ResourceUsage::ColourTarget, view->GetResourceID())); } } } @@ -979,7 +981,8 @@ void WrappedID3D11DeviceContext::AddDrawcall(const FetchDrawcall &d, bool hasEve } // markers don't increment drawcall ID - if((draw.flags & (eDraw_SetMarker | eDraw_PushMarker)) == 0) + DrawFlags MarkerMask = DrawFlags::SetMarker | DrawFlags::PushMarker; + if(!(draw.flags & MarkerMask)) m_CurDrawcallID++; if(hasEvents) @@ -1533,8 +1536,9 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven { ResourceUsage u = usit->usage; - if(u == eUsage_SO || (u >= eUsage_VS_RWResource && u <= eUsage_CS_RWResource) || - u == eUsage_DepthStencilTarget || u == eUsage_ColourTarget) + if(u == ResourceUsage::StreamOut || + (u >= ResourceUsage::VS_RWResource && u <= ResourceUsage::CS_RWResource) || + u == ResourceUsage::DepthStencilTarget || u == ResourceUsage::ColourTarget) { written = true; break; @@ -1706,12 +1710,12 @@ void WrappedID3D11DeviceContext::RecordLayoutBindStats(ID3D11InputLayout *Layout layouts.nulls += (Layout == NULL); } -void WrappedID3D11DeviceContext::RecordConstantStats(ShaderStageType stage, UINT NumBuffers, +void WrappedID3D11DeviceContext::RecordConstantStats(ShaderStage stage, UINT NumBuffers, ID3D11Buffer *Buffers[]) { FetchFrameStatistics &stats = m_pDevice->GetFrameStats(); - RDCASSERT(stage < ARRAY_COUNT(stats.constants)); - FetchFrameConstantBindStats &constants = stats.constants[stage]; + RDCASSERT(size_t(stage) < ARRAY_COUNT(stats.constants)); + FetchFrameConstantBindStats &constants = stats.constants[uint32_t(stage)]; constants.calls += 1; RDCASSERT(NumBuffers < constants.bindslots.size()); constants.bindslots[NumBuffers] += 1; @@ -1736,21 +1740,21 @@ void WrappedID3D11DeviceContext::RecordConstantStats(ShaderStageType stage, UINT } } -void WrappedID3D11DeviceContext::RecordResourceStats(ShaderStageType stage, UINT NumResources, +void WrappedID3D11DeviceContext::RecordResourceStats(ShaderStage stage, UINT NumResources, ID3D11ShaderResourceView *Resources[]) { FetchFrameStatistics &stats = m_pDevice->GetFrameStats(); - RDCASSERT(stage < ARRAY_COUNT(stats.resources)); - FetchFrameResourceBindStats &resources = stats.resources[stage]; + RDCASSERT(size_t(stage) < ARRAY_COUNT(stats.resources)); + FetchFrameResourceBindStats &resources = stats.resources[(uint32_t)stage]; resources.calls += 1; RDCASSERT(NumResources < resources.bindslots.size()); resources.bindslots[NumResources] += 1; - const ShaderResourceType mapping[] = { - eResType_None, eResType_Buffer, eResType_Texture1D, - eResType_Texture1DArray, eResType_Texture2D, eResType_Texture2DArray, - eResType_Texture2DMS, eResType_Texture2DMSArray, eResType_Texture3D, - eResType_TextureCube, eResType_TextureCubeArray, eResType_Buffer, + const TextureDim mapping[] = { + TextureDim::Unknown, TextureDim::Buffer, TextureDim::Texture1D, + TextureDim::Texture1DArray, TextureDim::Texture2D, TextureDim::Texture2DArray, + TextureDim::Texture2DMS, TextureDim::Texture2DMSArray, TextureDim::Texture3D, + TextureDim::TextureCube, TextureDim::TextureCubeArray, TextureDim::Buffer, }; RDCCOMPILE_ASSERT(ARRAY_COUNT(mapping) == D3D_SRV_DIMENSION_BUFFEREX + 1, "Update mapping table."); @@ -1764,11 +1768,11 @@ void WrappedID3D11DeviceContext::RecordResourceStats(ShaderStageType stage, UINT D3D11_SHADER_RESOURCE_VIEW_DESC desc; Resources[i]->GetDesc(&desc); RDCASSERT(desc.ViewDimension < ARRAY_COUNT(mapping)); - ShaderResourceType type = mapping[desc.ViewDimension]; + TextureDim type = mapping[desc.ViewDimension]; // #mivance surprisingly this is not asserted in operator[] for // rdctype::array so I'm being paranoid RDCASSERT((int)type < (int)resources.types.size()); - resources.types[type] += 1; + resources.types[(int)type] += 1; } else { @@ -1777,12 +1781,12 @@ void WrappedID3D11DeviceContext::RecordResourceStats(ShaderStageType stage, UINT } } -void WrappedID3D11DeviceContext::RecordSamplerStats(ShaderStageType stage, UINT NumSamplers, +void WrappedID3D11DeviceContext::RecordSamplerStats(ShaderStage stage, UINT NumSamplers, ID3D11SamplerState *Samplers[]) { FetchFrameStatistics &stats = m_pDevice->GetFrameStats(); - RDCASSERT(stage < ARRAY_COUNT(stats.samplers)); - FetchFrameSamplerBindStats &samplers = stats.samplers[stage]; + RDCASSERT(size_t(stage) < ARRAY_COUNT(stats.samplers)); + FetchFrameSamplerBindStats &samplers = stats.samplers[uint32_t(stage)]; samplers.calls += 1; RDCASSERT(NumSamplers < samplers.bindslots.size()); samplers.bindslots[NumSamplers] += 1; @@ -1808,20 +1812,20 @@ void WrappedID3D11DeviceContext::RecordUpdateStats(ID3D11Resource *res, uint32_t updates.clients += (Server == false); updates.servers += (Server == true); - const ShaderResourceType mapping[] = { - eResType_None, // D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, - eResType_Buffer, // D3D11_RESOURCE_DIMENSION_BUFFER = 1, - eResType_Texture1D, // D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, - eResType_Texture2D, // D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, - eResType_Texture3D, // D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4 + const TextureDim mapping[] = { + TextureDim::Unknown, // D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, + TextureDim::Buffer, // D3D11_RESOURCE_DIMENSION_BUFFER = 1, + TextureDim::Texture1D, // D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, + TextureDim::Texture2D, // D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, + TextureDim::Texture3D, // D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4 }; D3D11_RESOURCE_DIMENSION dim; res->GetType(&dim); RDCASSERT(dim < ARRAY_COUNT(mapping)); - ShaderResourceType type = mapping[dim]; + TextureDim type = mapping[dim]; RDCASSERT((int)type < (int)updates.types.size()); - updates.types[type] += 1; + updates.types[(int)type] += 1; // #mivance it might be nice to query the buffer to differentiate // between bindings for constant buffers @@ -1856,12 +1860,12 @@ void WrappedID3D11DeviceContext::RecordDispatchStats(bool indirect) dispatches.indirect += (uint32_t)indirect; } -void WrappedID3D11DeviceContext::RecordShaderStats(ShaderStageType stage, ID3D11DeviceChild *Current, +void WrappedID3D11DeviceContext::RecordShaderStats(ShaderStage stage, ID3D11DeviceChild *Current, ID3D11DeviceChild *Shader) { FetchFrameStatistics &stats = m_pDevice->GetFrameStats(); - RDCASSERT(stage <= ARRAY_COUNT(stats.shaders)); - FetchFrameShaderStats &shaders = stats.shaders[stage]; + RDCASSERT(size_t(stage) <= ARRAY_COUNT(stats.shaders)); + FetchFrameShaderStats &shaders = stats.shaders[uint32_t(stage)]; shaders.calls += 1; shaders.sets += (Shader != NULL); diff --git a/renderdoc/driver/d3d11/d3d11_context.h b/renderdoc/driver/d3d11/d3d11_context.h index 38b8b44e1..4b703894b 100644 --- a/renderdoc/driver/d3d11/d3d11_context.h +++ b/renderdoc/driver/d3d11/d3d11_context.h @@ -264,15 +264,14 @@ private: void RecordIndexBindStats(ID3D11Buffer *Buffer); void RecordVertexBindStats(UINT NumBuffers, ID3D11Buffer *Buffers[]); void RecordLayoutBindStats(ID3D11InputLayout *Layout); - void RecordConstantStats(ShaderStageType stage, UINT NumBuffers, ID3D11Buffer *Buffers[]); - void RecordResourceStats(ShaderStageType stage, UINT NumResources, + void RecordConstantStats(ShaderStage stage, UINT NumBuffers, ID3D11Buffer *Buffers[]); + void RecordResourceStats(ShaderStage stage, UINT NumResources, ID3D11ShaderResourceView *Resources[]); - void RecordSamplerStats(ShaderStageType stage, UINT NumSamplers, ID3D11SamplerState *Samplers[]); + void RecordSamplerStats(ShaderStage stage, UINT NumSamplers, ID3D11SamplerState *Samplers[]); void RecordUpdateStats(ID3D11Resource *res, uint32_t Size, bool Server); void RecordDrawStats(bool instanced, bool indirect, UINT InstanceCount); void RecordDispatchStats(bool indirect); - void RecordShaderStats(ShaderStageType stage, ID3D11DeviceChild *Current, - ID3D11DeviceChild *Shader); + void RecordShaderStats(ShaderStage stage, ID3D11DeviceChild *Current, ID3D11DeviceChild *Shader); void RecordBlendStats(ID3D11BlendState *Blend, FLOAT BlendFactor[4], UINT SampleMask); void RecordDepthStencilStats(ID3D11DepthStencilState *DepthStencil, UINT StencilRef); void RecordRasterizationStats(ID3D11RasterizerState *Rasterizer); diff --git a/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp index 177275d21..7ca73cbe4 100644 --- a/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp @@ -184,7 +184,8 @@ bool WrappedID3D11DeviceContext::Serialise_UpdateSubresource1(ID3D11Resource *pD { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to UpdateSubresource1() without D3D11.1 available"); } } @@ -293,7 +294,8 @@ bool WrappedID3D11DeviceContext::Serialise_UpdateSubresource1(ID3D11Resource *pD { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to UpdateSubresource1() without D3D11.1 available"); } } @@ -376,7 +378,8 @@ bool WrappedID3D11DeviceContext::Serialise_CopySubresourceRegion1( { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to CopySubresourceRegion1() without D3D11.1 available"); } } @@ -475,7 +478,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearView(ID3D11View *pView, const FL draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; AddDrawcall(draw, true); } @@ -606,7 +609,8 @@ bool WrappedID3D11DeviceContext::Serialise_VSSetConstantBuffers1(UINT StartSlot_ { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to VSSetConstantBuffers1() without D3D11.1 available"); // if there's a missing offset there's nothing we can do, everything will be nonsense @@ -754,7 +758,8 @@ bool WrappedID3D11DeviceContext::Serialise_HSSetConstantBuffers1(UINT StartSlot_ { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to HSSetConstantBuffers1() without D3D11.1 available"); // if there's a missing offset there's nothing we can do, everything will be nonsense @@ -902,7 +907,8 @@ bool WrappedID3D11DeviceContext::Serialise_DSSetConstantBuffers1(UINT StartSlot_ { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to DSSetConstantBuffers1() without D3D11.1 available"); // if there's a missing offset there's nothing we can do, everything will be nonsense @@ -1050,7 +1056,8 @@ bool WrappedID3D11DeviceContext::Serialise_GSSetConstantBuffers1(UINT StartSlot_ { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to GSSetConstantBuffers1() without D3D11.1 available"); // if there's a missing offset there's nothing we can do, everything will be nonsense @@ -1198,7 +1205,8 @@ bool WrappedID3D11DeviceContext::Serialise_PSSetConstantBuffers1(UINT StartSlot_ { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to PSSetConstantBuffers1() without D3D11.1 available"); // if there's a missing offset there's nothing we can do, everything will be nonsense @@ -1346,7 +1354,8 @@ bool WrappedID3D11DeviceContext::Serialise_CSSetConstantBuffers1(UINT StartSlot_ { RDCERR("Replaying a D3D11.1 context without D3D11.1 available"); m_pDevice->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_High, eDbgSoruce_UnsupportedConfiguration, + MessageCategory::Portability, MessageSeverity::High, + MessageSource::UnsupportedConfiguration, "Replaying a call to CSSetConstantBuffers1() without D3D11.1 available"); // if there's a missing offset there's nothing we can do, everything will be nonsense @@ -1702,12 +1711,12 @@ bool WrappedID3D11DeviceContext::Serialise_DiscardResource(ID3D11Resource *pReso draw.name = "DiscardResource()"; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; AddDrawcall(draw, true); if(m_pDevice->GetResourceManager()->HasLiveResource(res)) - m_ResourceUses[res].push_back(EventUsage(m_CurEventID, eUsage_Clear)); + m_ResourceUses[res].push_back(EventUsage(m_CurEventID, ResourceUsage::Clear)); } return true; @@ -1785,7 +1794,7 @@ bool WrappedID3D11DeviceContext::Serialise_DiscardView(ID3D11View *pResourceView draw.name = "DiscardView()"; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; AddDrawcall(draw, true); @@ -1797,25 +1806,25 @@ bool WrappedID3D11DeviceContext::Serialise_DiscardView(ID3D11View *pResourceView { WrappedID3D11RenderTargetView1 *view = (WrappedID3D11RenderTargetView1 *)pLiveView; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } else if(WrappedID3D11DepthStencilView::IsAlloc(pLiveView)) { WrappedID3D11DepthStencilView *view = (WrappedID3D11DepthStencilView *)pLiveView; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } else if(WrappedID3D11ShaderResourceView1::IsAlloc(pLiveView)) { WrappedID3D11ShaderResourceView1 *view = (WrappedID3D11ShaderResourceView1 *)pLiveView; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } else if(WrappedID3D11UnorderedAccessView1::IsAlloc(pLiveView)) { WrappedID3D11UnorderedAccessView1 *view = (WrappedID3D11UnorderedAccessView1 *)pLiveView; m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } } } @@ -1910,7 +1919,7 @@ bool WrappedID3D11DeviceContext::Serialise_DiscardView1(ID3D11View *pResourceVie draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; AddDrawcall(draw, true); @@ -1920,16 +1929,16 @@ bool WrappedID3D11DeviceContext::Serialise_DiscardView1(ID3D11View *pResourceVie if(WrappedID3D11RenderTargetView1::IsAlloc(pLiveView)) m_ResourceUses[((WrappedID3D11RenderTargetView1 *)pLiveView)->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else if(WrappedID3D11DepthStencilView::IsAlloc(pLiveView)) m_ResourceUses[((WrappedID3D11DepthStencilView *)pLiveView)->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else if(WrappedID3D11ShaderResourceView1::IsAlloc(pLiveView)) m_ResourceUses[((WrappedID3D11ShaderResourceView1 *)pLiveView)->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else if(WrappedID3D11UnorderedAccessView1::IsAlloc(pLiveView)) m_ResourceUses[((WrappedID3D11UnorderedAccessView1 *)pLiveView)->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } diff --git a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp index 732c78ca9..6632896a5 100644 --- a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp @@ -57,7 +57,7 @@ bool WrappedID3D11DeviceContext::Serialise_SetMarker(uint32_t col, const wchar_t { FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_SetMarker; + draw.flags |= DrawFlags::SetMarker; byte alpha = (colour >> 24) & 0xff; byte red = (colour >> 16) & 0xff; @@ -93,7 +93,7 @@ bool WrappedID3D11DeviceContext::Serialise_PushEvent(uint32_t col, const wchar_t { FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_PushMarker; + draw.flags |= DrawFlags::PushMarker; byte alpha = (colour >> 24) & 0xff; byte red = (colour >> 16) & 0xff; @@ -117,7 +117,7 @@ bool WrappedID3D11DeviceContext::Serialise_PopEvent() { FetchDrawcall draw; draw.name = "API Calls"; - draw.flags |= eDraw_SetMarker | eDraw_APICalls; + draw.flags |= DrawFlags::SetMarker | DrawFlags::APICalls; AddDrawcall(draw, true); } @@ -664,7 +664,7 @@ bool WrappedID3D11DeviceContext::Serialise_VSSetConstantBuffers(UINT StartSlot_, Buffers[i] = UNWRAP(WrappedID3D11Buffer, Buffers[i]); if(m_State == READING) - RecordConstantStats(eShaderStage_Vertex, NumBuffers, Buffers); + RecordConstantStats(ShaderStage::Vertex, NumBuffers, Buffers); m_pRealContext->VSSetConstantBuffers(StartSlot, NumBuffers, Buffers); VerifyState(); @@ -736,7 +736,7 @@ bool WrappedID3D11DeviceContext::Serialise_VSSetShaderResources( Views[i] = UNWRAP(WrappedID3D11ShaderResourceView1, Views[i]); if(m_State == READING) - RecordResourceStats(eShaderStage_Vertex, NumViews, Views); + RecordResourceStats(ShaderStage::Vertex, NumViews, Views); m_pRealContext->VSSetShaderResources(StartSlot, NumViews, Views); VerifyState(); @@ -812,7 +812,7 @@ bool WrappedID3D11DeviceContext::Serialise_VSSetSamplers(UINT StartSlot_, UINT N Samplers[i] = UNWRAP(WrappedID3D11SamplerState, Samplers[i]); if(m_State == READING) - RecordSamplerStats(eShaderStage_Vertex, NumSamplers, Samplers); + RecordSamplerStats(ShaderStage::Vertex, NumSamplers, Samplers); m_pRealContext->VSSetSamplers(StartSlot, NumSamplers, Samplers); VerifyState(); @@ -883,7 +883,7 @@ bool WrappedID3D11DeviceContext::Serialise_VSSetShader(ID3D11VertexShader *pShad pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); if(m_State == READING) - RecordShaderStats(eShaderStage_Vertex, m_CurrentPipelineState->VS.Shader, pSH); + RecordShaderStats(ShaderStage::Vertex, m_CurrentPipelineState->VS.Shader, pSH); m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->VS.Shader, pSH); m_pRealContext->VSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, @@ -1066,7 +1066,7 @@ bool WrappedID3D11DeviceContext::Serialise_HSSetConstantBuffers(UINT StartSlot_, Buffers[i] = UNWRAP(WrappedID3D11Buffer, Buffers[i]); if(m_State == READING) - RecordConstantStats(eShaderStage_Hull, NumBuffers, Buffers); + RecordConstantStats(ShaderStage::Hull, NumBuffers, Buffers); if(m_State <= EXECUTING) m_pRealContext->HSSetConstantBuffers(StartSlot, NumBuffers, Buffers); @@ -1141,7 +1141,7 @@ bool WrappedID3D11DeviceContext::Serialise_HSSetShaderResources( Views[i] = UNWRAP(WrappedID3D11ShaderResourceView1, Views[i]); if(m_State == READING) - RecordResourceStats(eShaderStage_Hull, NumViews, Views); + RecordResourceStats(ShaderStage::Hull, NumViews, Views); m_pRealContext->HSSetShaderResources(StartSlot, NumViews, Views); VerifyState(); @@ -1217,7 +1217,7 @@ bool WrappedID3D11DeviceContext::Serialise_HSSetSamplers(UINT StartSlot_, UINT N Samplers[i] = UNWRAP(WrappedID3D11SamplerState, Samplers[i]); if(m_State == READING) - RecordSamplerStats(eShaderStage_Hull, NumSamplers, Samplers); + RecordSamplerStats(ShaderStage::Hull, NumSamplers, Samplers); m_pRealContext->HSSetSamplers(StartSlot, NumSamplers, Samplers); VerifyState(); @@ -1288,7 +1288,7 @@ bool WrappedID3D11DeviceContext::Serialise_HSSetShader(ID3D11HullShader *pShader pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); if(m_State == READING) - RecordShaderStats(eShaderStage_Hull, m_CurrentPipelineState->HS.Shader, pSH); + RecordShaderStats(ShaderStage::Hull, m_CurrentPipelineState->HS.Shader, pSH); m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->HS.Shader, pSH); m_pRealContext->HSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, @@ -1471,7 +1471,7 @@ bool WrappedID3D11DeviceContext::Serialise_DSSetConstantBuffers(UINT StartSlot_, Buffers[i] = UNWRAP(WrappedID3D11Buffer, Buffers[i]); if(m_State == READING) - RecordConstantStats(eShaderStage_Domain, NumBuffers, Buffers); + RecordConstantStats(ShaderStage::Domain, NumBuffers, Buffers); m_pRealContext->DSSetConstantBuffers(StartSlot, NumBuffers, Buffers); VerifyState(); @@ -1545,7 +1545,7 @@ bool WrappedID3D11DeviceContext::Serialise_DSSetShaderResources( Views[i] = UNWRAP(WrappedID3D11ShaderResourceView1, Views[i]); if(m_State == READING) - RecordResourceStats(eShaderStage_Domain, NumViews, Views); + RecordResourceStats(ShaderStage::Domain, NumViews, Views); m_pRealContext->DSSetShaderResources(StartSlot, NumViews, Views); VerifyState(); @@ -1621,7 +1621,7 @@ bool WrappedID3D11DeviceContext::Serialise_DSSetSamplers(UINT StartSlot_, UINT N Samplers[i] = UNWRAP(WrappedID3D11SamplerState, Samplers[i]); if(m_State == READING) - RecordSamplerStats(eShaderStage_Domain, NumSamplers, Samplers); + RecordSamplerStats(ShaderStage::Domain, NumSamplers, Samplers); m_pRealContext->DSSetSamplers(StartSlot, NumSamplers, Samplers); VerifyState(); @@ -1692,7 +1692,7 @@ bool WrappedID3D11DeviceContext::Serialise_DSSetShader(ID3D11DomainShader *pShad pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); if(m_State == READING) - RecordShaderStats(eShaderStage_Domain, m_CurrentPipelineState->DS.Shader, pSH); + RecordShaderStats(ShaderStage::Domain, m_CurrentPipelineState->DS.Shader, pSH); m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->DS.Shader, pSH); m_pRealContext->DSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, @@ -1876,7 +1876,7 @@ bool WrappedID3D11DeviceContext::Serialise_GSSetConstantBuffers(UINT StartSlot_, Buffers[i] = UNWRAP(WrappedID3D11Buffer, Buffers[i]); if(m_State == READING) - RecordConstantStats(eShaderStage_Geometry, NumBuffers, Buffers); + RecordConstantStats(ShaderStage::Geometry, NumBuffers, Buffers); m_pRealContext->GSSetConstantBuffers(StartSlot, NumBuffers, Buffers); VerifyState(); @@ -1950,7 +1950,7 @@ bool WrappedID3D11DeviceContext::Serialise_GSSetShaderResources( Views[i] = UNWRAP(WrappedID3D11ShaderResourceView1, Views[i]); if(m_State == READING) - RecordResourceStats(eShaderStage_Geometry, NumViews, Views); + RecordResourceStats(ShaderStage::Geometry, NumViews, Views); m_pRealContext->GSSetShaderResources(StartSlot, NumViews, Views); VerifyState(); @@ -2026,7 +2026,7 @@ bool WrappedID3D11DeviceContext::Serialise_GSSetSamplers(UINT StartSlot_, UINT N Samplers[i] = UNWRAP(WrappedID3D11SamplerState, Samplers[i]); if(m_State == READING) - RecordSamplerStats(eShaderStage_Geometry, NumSamplers, Samplers); + RecordSamplerStats(ShaderStage::Geometry, NumSamplers, Samplers); m_pRealContext->GSSetSamplers(StartSlot, NumSamplers, Samplers); VerifyState(); @@ -2097,7 +2097,7 @@ bool WrappedID3D11DeviceContext::Serialise_GSSetShader(ID3D11GeometryShader *pSh pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); if(m_State == READING) - RecordShaderStats(eShaderStage_Geometry, m_CurrentPipelineState->GS.Shader, pSH); + RecordShaderStats(ShaderStage::Geometry, m_CurrentPipelineState->GS.Shader, pSH); m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->GS.Shader, pSH); m_pRealContext->GSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, @@ -2687,7 +2687,7 @@ bool WrappedID3D11DeviceContext::Serialise_PSSetConstantBuffers(UINT StartSlot_, Buffers[i] = UNWRAP(WrappedID3D11Buffer, Buffers[i]); if(m_State == READING) - RecordConstantStats(eShaderStage_Pixel, NumBuffers, Buffers); + RecordConstantStats(ShaderStage::Pixel, NumBuffers, Buffers); m_pRealContext->PSSetConstantBuffers(StartSlot, NumBuffers, Buffers); VerifyState(); @@ -2759,7 +2759,7 @@ bool WrappedID3D11DeviceContext::Serialise_PSSetShaderResources( Views[i] = UNWRAP(WrappedID3D11ShaderResourceView1, Views[i]); if(m_State == READING) - RecordResourceStats(eShaderStage_Pixel, NumViews, Views); + RecordResourceStats(ShaderStage::Pixel, NumViews, Views); m_pRealContext->PSSetShaderResources(StartSlot, NumViews, Views); VerifyState(); @@ -2833,7 +2833,7 @@ bool WrappedID3D11DeviceContext::Serialise_PSSetSamplers(UINT StartSlot_, UINT N Samplers[i] = UNWRAP(WrappedID3D11SamplerState, Samplers[i]); if(m_State == READING) - RecordSamplerStats(eShaderStage_Pixel, NumSamplers, Samplers); + RecordSamplerStats(ShaderStage::Pixel, NumSamplers, Samplers); m_pRealContext->PSSetSamplers(StartSlot, NumSamplers, Samplers); VerifyState(); @@ -2902,7 +2902,7 @@ bool WrappedID3D11DeviceContext::Serialise_PSSetShader(ID3D11PixelShader *pShade pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); if(m_State == READING) - RecordShaderStats(eShaderStage_Pixel, m_CurrentPipelineState->PS.Shader, pSH); + RecordShaderStats(ShaderStage::Pixel, m_CurrentPipelineState->PS.Shader, pSH); m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->PS.Shader, pSH); m_pRealContext->PSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, @@ -3725,8 +3725,8 @@ void WrappedID3D11DeviceContext::Serialise_DebugMessages() if(m_State >= WRITING) desc = debugMessages[i].description.elems; - SERIALISE_ELEMENT(uint32_t, Category, debugMessages[i].category); - SERIALISE_ELEMENT(uint32_t, Severity, debugMessages[i].severity); + SERIALISE_ELEMENT(MessageCategory, Category, debugMessages[i].category); + SERIALISE_ELEMENT(MessageSeverity, Severity, debugMessages[i].severity); SERIALISE_ELEMENT(uint32_t, ID, debugMessages[i].messageID); SERIALISE_ELEMENT(string, Description, desc); @@ -3734,9 +3734,9 @@ void WrappedID3D11DeviceContext::Serialise_DebugMessages() { DebugMessage msg; msg.eventID = m_CurEventID; - msg.source = eDbgSource_API; - msg.category = (DebugMessageCategory)Category; - msg.severity = (DebugMessageSeverity)Severity; + msg.source = MessageSource::API; + msg.category = Category; + msg.severity = Severity; msg.messageID = ID; msg.description = Description; @@ -3784,7 +3784,7 @@ bool WrappedID3D11DeviceContext::Serialise_DrawIndexedInstanced(UINT IndexCountP draw.baseVertex = BaseVertexLocation; draw.instanceOffset = StartInstanceLocation; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::UseIBuffer; AddDrawcall(draw, true); } @@ -3856,7 +3856,7 @@ bool WrappedID3D11DeviceContext::Serialise_DrawInstanced(UINT VertexCountPerInst draw.vertexOffset = StartVertexLocation; draw.instanceOffset = StartInstanceLocation; - draw.flags |= eDraw_Drawcall | eDraw_Instanced; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced; AddDrawcall(draw, true); } @@ -3921,7 +3921,7 @@ bool WrappedID3D11DeviceContext::Serialise_DrawIndexed(UINT IndexCount_, UINT St draw.baseVertex = BaseVertexLocation; draw.indexOffset = StartIndexLocation; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; AddDrawcall(draw, true); } @@ -3981,7 +3981,7 @@ bool WrappedID3D11DeviceContext::Serialise_Draw(UINT VertexCount_, UINT StartVer draw.numIndices = VertexCount; draw.vertexOffset = StartVertexLocation; - draw.flags |= eDraw_Drawcall; + draw.flags |= DrawFlags::Drawcall; AddDrawcall(draw, true); } @@ -4084,7 +4084,7 @@ bool WrappedID3D11DeviceContext::Serialise_DrawAuto() FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Drawcall | eDraw_Auto; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Auto; draw.numIndices = (uint32_t)numVerts; draw.vertexOffset = 0; draw.indexOffset = 0; @@ -4177,12 +4177,14 @@ bool WrappedID3D11DeviceContext::Serialise_DrawIndexedInstancedIndirect(ID3D11Bu name = "DrawIndexedInstancedIndirect(<" + ToStr::Get(draw.numIndices) + ", " + ToStr::Get(draw.numInstances) + ">)"; - m_ResourceUses[GetIDForResource(argBuffer)].push_back(EventUsage(m_CurEventID, eUsage_Indirect)); + m_ResourceUses[GetIDForResource(argBuffer)].push_back( + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } draw.name = name; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_UseIBuffer | eDraw_Indirect; + draw.flags |= + DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::UseIBuffer | DrawFlags::Indirect; AddDrawcall(draw, true); } @@ -4262,12 +4264,13 @@ bool WrappedID3D11DeviceContext::Serialise_DrawInstancedIndirect(ID3D11Buffer *p RecordDrawStats(true, true, draw.numInstances); - m_ResourceUses[GetIDForResource(argBuffer)].push_back(EventUsage(m_CurEventID, eUsage_Indirect)); + m_ResourceUses[GetIDForResource(argBuffer)].push_back( + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } draw.name = name; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_Indirect; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::Indirect; AddDrawcall(draw, true); } @@ -4459,7 +4462,7 @@ bool WrappedID3D11DeviceContext::Serialise_CSSetConstantBuffers(UINT StartSlot_, Buffers[i] = UNWRAP(WrappedID3D11Buffer, Buffers[i]); if(m_State == READING) - RecordConstantStats(eShaderStage_Compute, NumBuffers, Buffers); + RecordConstantStats(ShaderStage::Compute, NumBuffers, Buffers); m_pRealContext->CSSetConstantBuffers(StartSlot, NumBuffers, Buffers); VerifyState(); @@ -4533,7 +4536,7 @@ bool WrappedID3D11DeviceContext::Serialise_CSSetShaderResources( Views[i] = UNWRAP(WrappedID3D11ShaderResourceView1, Views[i]); if(m_State == READING) - RecordResourceStats(eShaderStage_Compute, NumViews, Views); + RecordResourceStats(ShaderStage::Compute, NumViews, Views); m_pRealContext->CSSetShaderResources(StartSlot, NumViews, Views); VerifyState(); @@ -4760,7 +4763,7 @@ bool WrappedID3D11DeviceContext::Serialise_CSSetShader(ID3D11ComputeShader *pSha pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); if(m_State == READING) - RecordShaderStats(eShaderStage_Compute, m_CurrentPipelineState->CS.Shader, pSH); + RecordShaderStats(ShaderStage::Compute, m_CurrentPipelineState->CS.Shader, pSH); m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->CS.Shader, pSH); m_pRealContext->CSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, @@ -4834,7 +4837,7 @@ bool WrappedID3D11DeviceContext::Serialise_ExecuteCommandList(ID3D11CommandList FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_CmdList; + draw.flags |= DrawFlags::CmdList; AddDrawcall(draw, true); } @@ -4942,25 +4945,25 @@ bool WrappedID3D11DeviceContext::Serialise_Dispatch(UINT ThreadGroupCountX_, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Dispatch; + draw.flags |= DrawFlags::Dispatch; draw.dispatchDimension[0] = ThreadGroupCountX; draw.dispatchDimension[1] = ThreadGroupCountY; draw.dispatchDimension[2] = ThreadGroupCountZ; if(ThreadGroupCountX == 0) - m_pDevice->AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, - eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has ThreadGroup count X=0. This will do nothing, " "which is unusual for a non-indirect Dispatch. Did you mean X=1?"); if(ThreadGroupCountY == 0) - m_pDevice->AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, - eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has ThreadGroup count Y=0. This will do nothing, " "which is unusual for a non-indirect Dispatch. Did you mean Y=1?"); if(ThreadGroupCountZ == 0) - m_pDevice->AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, - eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has ThreadGroup count Z=0. This will do nothing, " "which is unusual for a non-indirect Dispatch. Did you mean Z=1?"); @@ -5039,11 +5042,12 @@ bool WrappedID3D11DeviceContext::Serialise_DispatchIndirect(ID3D11Buffer *pBuffe draw.dispatchDimension[1] = uargs[1]; draw.dispatchDimension[2] = uargs[2]; - m_ResourceUses[GetIDForResource(argBuffer)].push_back(EventUsage(m_CurEventID, eUsage_Indirect)); + m_ResourceUses[GetIDForResource(argBuffer)].push_back( + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } draw.name = name; - draw.flags |= eDraw_Dispatch | eDraw_Indirect; + draw.flags |= DrawFlags::Dispatch | DrawFlags::Indirect; AddDrawcall(draw, true); } @@ -5097,7 +5101,7 @@ bool WrappedID3D11DeviceContext::Serialise_FinishCommandList(BOOL RestoreDeferre FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_CmdList; + draw.flags |= DrawFlags::CmdList; AddDrawcall(draw, true); } @@ -5110,7 +5114,8 @@ HRESULT WrappedID3D11DeviceContext::FinishCommandList(BOOL RestoreDeferredContex { if(GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE) { - m_pDevice->AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::Execution, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "It is invalid to call FinishCommandList on an immediate context. " "The call has been dropped from the capture."); return DXGI_ERROR_INVALID_CALL; @@ -5310,7 +5315,7 @@ bool WrappedID3D11DeviceContext::Serialise_CopySubresourceRegion( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; if(m_pDevice->GetResourceManager()->HasLiveResource(Destination) && m_pDevice->GetResourceManager()->HasLiveResource(Source)) @@ -5321,14 +5326,14 @@ bool WrappedID3D11DeviceContext::Serialise_CopySubresourceRegion( if(Destination == Source) { m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back( - EventUsage(m_CurEventID, eUsage_Copy)); + EventUsage(m_CurEventID, ResourceUsage::Copy)); } else { m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back( - EventUsage(m_CurEventID, eUsage_CopyDst)); + EventUsage(m_CurEventID, ResourceUsage::CopyDst)); m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Source)].push_back( - EventUsage(m_CurEventID, eUsage_CopySrc)); + EventUsage(m_CurEventID, ResourceUsage::CopySrc)); } } @@ -5459,7 +5464,7 @@ bool WrappedID3D11DeviceContext::Serialise_CopyResource(ID3D11Resource *pDstReso FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; if(m_pDevice->GetResourceManager()->HasLiveResource(Destination) && m_pDevice->GetResourceManager()->HasLiveResource(Source)) @@ -5470,14 +5475,14 @@ bool WrappedID3D11DeviceContext::Serialise_CopyResource(ID3D11Resource *pDstReso if(Destination == Source) { m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back( - EventUsage(m_CurEventID, eUsage_Copy)); + EventUsage(m_CurEventID, ResourceUsage::Copy)); } else { m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Destination)].push_back( - EventUsage(m_CurEventID, eUsage_CopyDst)); + EventUsage(m_CurEventID, ResourceUsage::CopyDst)); m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(Source)].push_back( - EventUsage(m_CurEventID, eUsage_CopySrc)); + EventUsage(m_CurEventID, ResourceUsage::CopySrc)); } } @@ -5999,7 +6004,7 @@ bool WrappedID3D11DeviceContext::Serialise_ResolveSubresource(ID3D11Resource *pD FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Resolve; + draw.flags |= DrawFlags::Resolve; if(m_pDevice->GetResourceManager()->HasLiveResource(DestResource) && m_pDevice->GetResourceManager()->HasLiveResource(SourceResource)) @@ -6010,14 +6015,14 @@ bool WrappedID3D11DeviceContext::Serialise_ResolveSubresource(ID3D11Resource *pD if(DestResource == SourceResource) { m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(DestResource)].push_back( - EventUsage(m_CurEventID, eUsage_Resolve)); + EventUsage(m_CurEventID, ResourceUsage::Resolve)); } else { m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(DestResource)].push_back( - EventUsage(m_CurEventID, eUsage_ResolveDst)); + EventUsage(m_CurEventID, ResourceUsage::ResolveDst)); m_ResourceUses[m_pDevice->GetResourceManager()->GetLiveID(SourceResource)].push_back( - EventUsage(m_CurEventID, eUsage_ResolveSrc)); + EventUsage(m_CurEventID, ResourceUsage::ResolveSrc)); } } @@ -6141,7 +6146,8 @@ bool WrappedID3D11DeviceContext::Serialise_GenerateMips(ID3D11ShaderResourceView (WrappedID3D11ShaderResourceView1 *)m_pDevice->GetResourceManager()->GetLiveResource( ShaderResourceView); id = view->GetResourceResID(); - m_ResourceUses[id].push_back(EventUsage(m_CurEventID, eUsage_GenMips, view->GetResourceID())); + m_ResourceUses[id].push_back( + EventUsage(m_CurEventID, ResourceUsage::GenMips, view->GetResourceID())); id = m_pDevice->GetResourceManager()->GetOriginalID(id); } @@ -6155,7 +6161,7 @@ bool WrappedID3D11DeviceContext::Serialise_GenerateMips(ID3D11ShaderResourceView FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_GenMips; + draw.flags |= DrawFlags::GenMips; AddDrawcall(draw, true); } @@ -6315,7 +6321,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearRenderTargetView( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearColour; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearColour; AddDrawcall(draw, true); @@ -6324,7 +6330,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearRenderTargetView( WrappedID3D11RenderTargetView1 *view = (WrappedID3D11RenderTargetView1 *)m_pDevice->GetResourceManager()->GetLiveResource(View); m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } } @@ -6497,7 +6503,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearUnorderedAccessViewUint( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; AddDrawcall(draw, true); @@ -6506,7 +6512,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearUnorderedAccessViewUint( WrappedID3D11UnorderedAccessView1 *view = (WrappedID3D11UnorderedAccessView1 *)m_pDevice->GetResourceManager()->GetLiveResource(View); m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } } @@ -6669,7 +6675,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearUnorderedAccessViewFloat( FetchDrawcall draw; draw.name = (name); - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; AddDrawcall(draw, true); @@ -6678,7 +6684,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearUnorderedAccessViewFloat( WrappedID3D11UnorderedAccessView1 *view = (WrappedID3D11UnorderedAccessView1 *)m_pDevice->GetResourceManager()->GetLiveResource(View); m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } } @@ -6827,7 +6833,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearDepthStencilView( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearDepthStencil; AddDrawcall(draw, true); @@ -6836,7 +6842,7 @@ bool WrappedID3D11DeviceContext::Serialise_ClearDepthStencilView( WrappedID3D11DepthStencilView *view = (WrappedID3D11DepthStencilView *)m_pDevice->GetResourceManager()->GetLiveResource(View); m_ResourceUses[view->GetResourceResID()].push_back( - EventUsage(m_CurEventID, eUsage_Clear, view->GetResourceID())); + EventUsage(m_CurEventID, ResourceUsage::Clear, view->GetResourceID())); } } diff --git a/renderdoc/driver/d3d11/d3d11_counters.cpp b/renderdoc/driver/d3d11/d3d11_counters.cpp index 70fe3427c..f5a8f0436 100644 --- a/renderdoc/driver/d3d11/d3d11_counters.cpp +++ b/renderdoc/driver/d3d11/d3d11_counters.cpp @@ -43,133 +43,133 @@ void D3D11DebugManager::PostDeviceShutdownCounters() { } -vector D3D11DebugManager::EnumerateCounters() +vector D3D11DebugManager::EnumerateCounters() { - vector ret; + vector ret; - ret.push_back(eCounter_EventGPUDuration); - ret.push_back(eCounter_InputVerticesRead); - ret.push_back(eCounter_IAPrimitives); - ret.push_back(eCounter_GSPrimitives); - ret.push_back(eCounter_RasterizerInvocations); - ret.push_back(eCounter_RasterizedPrimitives); - ret.push_back(eCounter_SamplesWritten); - ret.push_back(eCounter_VSInvocations); - ret.push_back(eCounter_HSInvocations); - ret.push_back(eCounter_DSInvocations); - ret.push_back(eCounter_GSInvocations); - ret.push_back(eCounter_PSInvocations); - ret.push_back(eCounter_CSInvocations); + ret.push_back(GPUCounter::EventGPUDuration); + ret.push_back(GPUCounter::InputVerticesRead); + ret.push_back(GPUCounter::IAPrimitives); + ret.push_back(GPUCounter::GSPrimitives); + ret.push_back(GPUCounter::RasterizerInvocations); + ret.push_back(GPUCounter::RasterizedPrimitives); + ret.push_back(GPUCounter::SamplesWritten); + ret.push_back(GPUCounter::VSInvocations); + ret.push_back(GPUCounter::HSInvocations); + ret.push_back(GPUCounter::DSInvocations); + ret.push_back(GPUCounter::GSInvocations); + ret.push_back(GPUCounter::PSInvocations); + ret.push_back(GPUCounter::CSInvocations); return ret; } -void D3D11DebugManager::DescribeCounter(uint32_t counterID, CounterDescription &desc) +void D3D11DebugManager::DescribeCounter(GPUCounter counterID, CounterDescription &desc) { desc.counterID = counterID; switch(counterID) { - case eCounter_EventGPUDuration: + case GPUCounter::EventGPUDuration: desc.name = "GPU Duration"; desc.description = "Time taken for this event on the GPU, as measured by delta between two GPU timestamps."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_Double; - desc.units = eUnits_Seconds; + desc.resultType = CompType::Double; + desc.unit = CounterUnit::Seconds; break; - case eCounter_InputVerticesRead: + case GPUCounter::InputVerticesRead: desc.name = "Input Vertices Read"; desc.description = "Number of vertices read by input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_IAPrimitives: + case GPUCounter::IAPrimitives: desc.name = "Input Primitives"; desc.description = "Number of primitives read by the input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSPrimitives: + case GPUCounter::GSPrimitives: desc.name = "GS Primitives"; desc.description = "Number of primitives output by a geometry shader."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizerInvocations: + case GPUCounter::RasterizerInvocations: desc.name = "Rasterizer Invocations"; desc.description = "Number of primitives that were sent to the rasterizer."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizedPrimitives: + case GPUCounter::RasterizedPrimitives: desc.name = "Rasterized Primitives"; desc.description = "Number of primitives that were rendered."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_SamplesWritten: + case GPUCounter::SamplesWritten: desc.name = "Samples Written"; desc.description = "Number of samples that passed depth/stencil test."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_VSInvocations: + case GPUCounter::VSInvocations: desc.name = "VS Invocations"; desc.description = "Number of times a vertex shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSInvocations: + case GPUCounter::GSInvocations: desc.name = "GS Invocations"; desc.description = "Number of times a geometry shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_HSInvocations: + case GPUCounter::HSInvocations: desc.name = "HS Invocations"; desc.description = "Number of times a hull shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_DSInvocations: + case GPUCounter::DSInvocations: desc.name = "DS Invocations"; desc.description = "Number of times a domain shader (or tesselation evaluation shader in OpenGL) was " "invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_PSInvocations: + case GPUCounter::PSInvocations: desc.name = "PS Invocations"; desc.description = "Number of times a pixel shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_CSInvocations: + case GPUCounter::CSInvocations: desc.name = "CS Invocations"; desc.description = "Number of times a compute shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; default: desc.name = "Unknown"; desc.description = "Unknown counter ID"; desc.resultByteWidth = 0; - desc.resultCompType = eCompType_None; - desc.units = eUnits_Absolute; + desc.resultType = CompType::Typeless; + desc.unit = CounterUnit::Absolute; break; } } @@ -257,7 +257,7 @@ void D3D11DebugManager::FillTimers(D3D11CounterContext &ctx, const DrawcallTreeN } } -vector D3D11DebugManager::FetchCounters(const vector &counters) +vector D3D11DebugManager::FetchCounters(const vector &counters) { vector ret; @@ -353,57 +353,57 @@ vector D3D11DebugManager::FetchCounters(const vector &c { switch(counters[c]) { - case eCounter_EventGPUDuration: + case GPUCounter::EventGPUDuration: ret.push_back( - CounterResult(ctx.timers[i].eventID, eCounter_EventGPUDuration, duration)); + CounterResult(ctx.timers[i].eventID, GPUCounter::EventGPUDuration, duration)); break; - case eCounter_InputVerticesRead: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_InputVerticesRead, + case GPUCounter::InputVerticesRead: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::InputVerticesRead, pipelineStats.IAVertices)); break; - case eCounter_IAPrimitives: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_IAPrimitives, + case GPUCounter::IAPrimitives: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::IAPrimitives, pipelineStats.IAPrimitives)); break; - case eCounter_VSInvocations: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_VSInvocations, + case GPUCounter::VSInvocations: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::VSInvocations, pipelineStats.VSInvocations)); break; - case eCounter_GSInvocations: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_GSInvocations, + case GPUCounter::GSInvocations: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::GSInvocations, pipelineStats.GSInvocations)); break; - case eCounter_GSPrimitives: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_GSPrimitives, + case GPUCounter::GSPrimitives: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::GSPrimitives, pipelineStats.GSPrimitives)); break; - case eCounter_RasterizerInvocations: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_RasterizerInvocations, + case GPUCounter::RasterizerInvocations: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::RasterizerInvocations, pipelineStats.CInvocations)); break; - case eCounter_RasterizedPrimitives: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_RasterizedPrimitives, + case GPUCounter::RasterizedPrimitives: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::RasterizedPrimitives, pipelineStats.CPrimitives)); break; - case eCounter_PSInvocations: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_PSInvocations, + case GPUCounter::PSInvocations: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::PSInvocations, pipelineStats.PSInvocations)); break; - case eCounter_HSInvocations: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_HSInvocations, + case GPUCounter::HSInvocations: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::HSInvocations, pipelineStats.HSInvocations)); break; - case eCounter_DSInvocations: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_DSInvocations, + case GPUCounter::DSInvocations: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::DSInvocations, pipelineStats.DSInvocations)); break; - case eCounter_CSInvocations: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_CSInvocations, + case GPUCounter::CSInvocations: + ret.push_back(CounterResult(ctx.timers[i].eventID, GPUCounter::CSInvocations, pipelineStats.CSInvocations)); break; - case eCounter_SamplesWritten: + case GPUCounter::SamplesWritten: ret.push_back( - CounterResult(ctx.timers[i].eventID, eCounter_SamplesWritten, occlusion)); + CounterResult(ctx.timers[i].eventID, GPUCounter::SamplesWritten, occlusion)); break; } } @@ -414,21 +414,22 @@ vector D3D11DebugManager::FetchCounters(const vector &c { switch(counters[c]) { - case eCounter_EventGPUDuration: - ret.push_back(CounterResult(ctx.timers[i].eventID, eCounter_EventGPUDuration, -1.0)); + case GPUCounter::EventGPUDuration: + ret.push_back( + CounterResult(ctx.timers[i].eventID, GPUCounter::EventGPUDuration, -1.0)); break; - case eCounter_InputVerticesRead: - case eCounter_IAPrimitives: - case eCounter_GSPrimitives: - case eCounter_RasterizerInvocations: - case eCounter_RasterizedPrimitives: - case eCounter_VSInvocations: - case eCounter_HSInvocations: - case eCounter_DSInvocations: - case eCounter_GSInvocations: - case eCounter_PSInvocations: - case eCounter_CSInvocations: - case eCounter_SamplesWritten: + case GPUCounter::InputVerticesRead: + case GPUCounter::IAPrimitives: + case GPUCounter::GSPrimitives: + case GPUCounter::RasterizerInvocations: + case GPUCounter::RasterizedPrimitives: + case GPUCounter::VSInvocations: + case GPUCounter::HSInvocations: + case GPUCounter::DSInvocations: + case GPUCounter::GSInvocations: + case GPUCounter::PSInvocations: + case GPUCounter::CSInvocations: + case GPUCounter::SamplesWritten: ret.push_back(CounterResult(ctx.timers[i].eventID, counters[c], 0xFFFFFFFFFFFFFFFF)); break; } diff --git a/renderdoc/driver/d3d11/d3d11_debug.cpp b/renderdoc/driver/d3d11/d3d11_debug.cpp index d2df01d47..07bd8d6e4 100644 --- a/renderdoc/driver/d3d11/d3d11_debug.cpp +++ b/renderdoc/driver/d3d11/d3d11_debug.cpp @@ -422,7 +422,7 @@ ID3D11ComputeShader *D3D11DebugManager::MakeCShader(const char *source, const ch } void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { if(id == NULL || errors == NULL) { @@ -435,12 +435,12 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t switch(type) { - case eShaderStage_Vertex: profile = "vs_5_0"; break; - case eShaderStage_Hull: profile = "hs_5_0"; break; - case eShaderStage_Domain: profile = "ds_5_0"; break; - case eShaderStage_Geometry: profile = "gs_5_0"; break; - case eShaderStage_Pixel: profile = "ps_5_0"; break; - case eShaderStage_Compute: profile = "cs_5_0"; break; + case ShaderStage::Vertex: profile = "vs_5_0"; break; + case ShaderStage::Hull: profile = "hs_5_0"; break; + case ShaderStage::Domain: profile = "ds_5_0"; break; + case ShaderStage::Geometry: profile = "gs_5_0"; break; + case ShaderStage::Pixel: profile = "ps_5_0"; break; + case ShaderStage::Compute: profile = "cs_5_0"; break; default: RDCERR("Unexpected type in BuildShader!"); *id = ResourceId(); @@ -458,7 +458,7 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t switch(type) { - case eShaderStage_Vertex: + case ShaderStage::Vertex: { ID3D11VertexShader *sh = NULL; m_WrappedDevice->CreateVertexShader(blob->GetBufferPointer(), blob->GetBufferSize(), NULL, &sh); @@ -471,7 +471,7 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t *id = ResourceId(); return; } - case eShaderStage_Hull: + case ShaderStage::Hull: { ID3D11HullShader *sh = NULL; m_WrappedDevice->CreateHullShader(blob->GetBufferPointer(), blob->GetBufferSize(), NULL, &sh); @@ -484,7 +484,7 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t *id = ResourceId(); return; } - case eShaderStage_Domain: + case ShaderStage::Domain: { ID3D11DomainShader *sh = NULL; m_WrappedDevice->CreateDomainShader(blob->GetBufferPointer(), blob->GetBufferSize(), NULL, &sh); @@ -497,7 +497,7 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t *id = ResourceId(); return; } - case eShaderStage_Geometry: + case ShaderStage::Geometry: { ID3D11GeometryShader *sh = NULL; m_WrappedDevice->CreateGeometryShader(blob->GetBufferPointer(), blob->GetBufferSize(), NULL, @@ -511,7 +511,7 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t *id = ResourceId(); return; } - case eShaderStage_Pixel: + case ShaderStage::Pixel: { ID3D11PixelShader *sh = NULL; m_WrappedDevice->CreatePixelShader(blob->GetBufferPointer(), blob->GetBufferSize(), NULL, &sh); @@ -524,7 +524,7 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t *id = ResourceId(); return; } - case eShaderStage_Compute: + case ShaderStage::Compute: { ID3D11ComputeShader *sh = NULL; m_WrappedDevice->CreateComputeShader(blob->GetBufferPointer(), blob->GetBufferSize(), NULL, @@ -1540,7 +1540,7 @@ void D3D11DebugManager::OutputWindow::MakeDSV() uint64_t D3D11DebugManager::MakeOutputWindow(WindowingSystem system, void *data, bool depth) { - RDCASSERT(system == eWindowingSystem_Win32, system); + RDCASSERT(system == WindowingSystem::Win32, system); OutputWindow outw; outw.wnd = (HWND)data; @@ -1749,8 +1749,8 @@ uint32_t D3D11DebugManager::GetStructCount(ID3D11UnorderedAccessView *uav) } bool D3D11DebugManager::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float minval, - float maxval, bool channels[4], vector &histogram) + uint32_t sample, CompType typeHint, float minval, float maxval, + bool channels[4], vector &histogram) { if(minval >= maxval) return false; @@ -1864,8 +1864,8 @@ bool D3D11DebugManager::GetHistogram(ResourceId texid, uint32_t sliceFace, uint3 return true; } -bool D3D11DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) +bool D3D11DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, + uint32_t sample, CompType typeHint, float *minval, float *maxval) { TextureShaderDetails details = GetShaderDetails(texid, typeHint, true); @@ -2184,7 +2184,7 @@ void D3D11DebugManager::CopyArrayToTex2DMS(ID3D11Texture2D *destMS, ID3D11Textur D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY; rtvDesc.Format = - depth ? GetUIntTypedFormat(descMS.Format) : GetTypedFormat(descMS.Format, eCompType_UInt); + depth ? GetUIntTypedFormat(descMS.Format) : GetTypedFormat(descMS.Format, CompType::UInt); rtvDesc.Texture2DMSArray.ArraySize = descMS.ArraySize; rtvDesc.Texture2DMSArray.FirstArraySlice = 0; @@ -2198,7 +2198,7 @@ void D3D11DebugManager::CopyArrayToTex2DMS(ID3D11Texture2D *destMS, ID3D11Textur D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; srvDesc.Format = - depth ? GetUIntTypedFormat(descArr.Format) : GetTypedFormat(descArr.Format, eCompType_UInt); + depth ? GetUIntTypedFormat(descArr.Format) : GetTypedFormat(descArr.Format, CompType::UInt); srvDesc.Texture2DArray.ArraySize = descArr.ArraySize; srvDesc.Texture2DArray.FirstArraySlice = 0; srvDesc.Texture2DArray.MipLevels = descArr.MipLevels; @@ -2477,7 +2477,7 @@ void D3D11DebugManager::CopyTex2DMSToArray(ID3D11Texture2D *destArray, ID3D11Tex D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; rtvDesc.Format = - depth ? GetUIntTypedFormat(descArr.Format) : GetTypedFormat(descArr.Format, eCompType_UInt); + depth ? GetUIntTypedFormat(descArr.Format) : GetTypedFormat(descArr.Format, CompType::UInt); rtvDesc.Texture2DArray.FirstArraySlice = 0; rtvDesc.Texture2DArray.ArraySize = 1; rtvDesc.Texture2DArray.MipSlice = 0; @@ -2493,7 +2493,7 @@ void D3D11DebugManager::CopyTex2DMSToArray(ID3D11Texture2D *destArray, ID3D11Tex D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY; srvDesc.Format = - depth ? GetUIntTypedFormat(descMS.Format) : GetTypedFormat(descMS.Format, eCompType_UInt); + depth ? GetUIntTypedFormat(descMS.Format) : GetTypedFormat(descMS.Format, CompType::UInt); srvDesc.Texture2DMSArray.ArraySize = descMS.ArraySize; srvDesc.Texture2DMSArray.FirstArraySlice = 0; @@ -2677,8 +2677,8 @@ void D3D11DebugManager::CopyTex2DMSToArray(ID3D11Texture2D *destArray, ID3D11Tex SAFE_RELEASE(srvResource); } -D3D11DebugManager::CacheElem &D3D11DebugManager::GetCachedElem(ResourceId id, - FormatComponentType typeHint, bool raw) +D3D11DebugManager::CacheElem &D3D11DebugManager::GetCachedElem(ResourceId id, CompType typeHint, + bool raw) { for(auto it = m_ShaderItemCache.begin(); it != m_ShaderItemCache.end(); ++it) { @@ -2697,8 +2697,9 @@ D3D11DebugManager::CacheElem &D3D11DebugManager::GetCachedElem(ResourceId id, return m_ShaderItemCache.front(); } -D3D11DebugManager::TextureShaderDetails D3D11DebugManager::GetShaderDetails( - ResourceId id, FormatComponentType typeHint, bool rawOutput) +D3D11DebugManager::TextureShaderDetails D3D11DebugManager::GetShaderDetails(ResourceId id, + CompType typeHint, + bool rawOutput) { TextureShaderDetails details; HRESULT hr = S_OK; @@ -3429,12 +3430,12 @@ bool D3D11DebugManager::RenderTexture(TextureDisplay cfg, bool blendAlpha) pixelData.OutputDisplayFormat = RESTYPE_TEX2D_MS; } - if(cfg.overlay == eTexOverlay_NaN) + if(cfg.overlay == DebugOverlay::NaN) { pixelData.OutputDisplayFormat |= TEXDISPLAY_NANS; } - if(cfg.overlay == eTexOverlay_Clipping) + if(cfg.overlay == DebugOverlay::Clipping) { pixelData.OutputDisplayFormat |= TEXDISPLAY_CLIPPING; } @@ -3442,13 +3443,13 @@ bool D3D11DebugManager::RenderTexture(TextureDisplay cfg, bool blendAlpha) int srvOffset = 0; if(IsUIntFormat(details.texFmt) || - (IsTypelessFormat(details.texFmt) && cfg.typeHint == eCompType_UInt)) + (IsTypelessFormat(details.texFmt) && cfg.typeHint == CompType::UInt)) { pixelData.OutputDisplayFormat |= TEXDISPLAY_UINT_TEX; srvOffset = 10; } if(IsIntFormat(details.texFmt) || - (IsTypelessFormat(details.texFmt) && cfg.typeHint == eCompType_SInt)) + (IsTypelessFormat(details.texFmt) && cfg.typeHint == CompType::SInt)) { pixelData.OutputDisplayFormat |= TEXDISPLAY_SINT_TEX; srvOffset = 20; @@ -3657,8 +3658,8 @@ MeshFormat D3D11DebugManager::GetPostVSBuffers(uint32_t eventID, uint32_t instID ret.compCount = 4; ret.compByteWidth = 4; - ret.compType = eCompType_Float; - ret.specialFormat = eSpecial_Unknown; + ret.compType = CompType::Float; + ret.specialFormat = SpecialFormat::Unknown; ret.showAlpha = false; ret.bgraOrder = false; @@ -3795,7 +3796,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) decl.StartComponent = 0; decl.ComponentCount = sign.compCount & 0xff; - if(sign.systemValue == eAttr_Position) + if(sign.systemValue == ShaderBuiltin::Position) { posidx = (int)sodecls.size(); numPosComponents = decl.ComponentCount = 4; @@ -3838,10 +3839,10 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) ID3D11Buffer *idxBuf = NULL; DXGI_FORMAT idxFmt = DXGI_FORMAT_UNKNOWN; - if((drawcall->flags & eDraw_UseIBuffer) == 0) + if(!(drawcall->flags & DrawFlags::UseIBuffer)) { m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_pImmediateContext->DrawInstanced(drawcall->numIndices, drawcall->numInstances, drawcall->vertexOffset, drawcall->instanceOffset); else @@ -3940,7 +3941,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) m_pImmediateContext->IASetIndexBuffer(idxBuf, DXGI_FORMAT_R32_UINT, 0); SAFE_RELEASE(idxBuf); - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_pImmediateContext->DrawIndexedInstanced((UINT)indices.size(), drawcall->numInstances, 0, 0, drawcall->instanceOffset); else @@ -4115,11 +4116,11 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) m_PostVSData[eventID].vsout.nearPlane = nearp; m_PostVSData[eventID].vsout.farPlane = farp; - m_PostVSData[eventID].vsout.useIndices = (drawcall->flags & eDraw_UseIBuffer) > 0; + m_PostVSData[eventID].vsout.useIndices = bool(drawcall->flags & DrawFlags::UseIBuffer); m_PostVSData[eventID].vsout.numVerts = drawcall->numIndices; m_PostVSData[eventID].vsout.instStride = 0; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].vsout.instStride = bufferDesc.ByteWidth / RDCMAX(1U, drawcall->numInstances); @@ -4179,7 +4180,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) decl.StartComponent = 0; decl.ComponentCount = sign.compCount & 0xff; - if(sign.systemValue == eAttr_Position) + if(sign.systemValue == ShaderBuiltin::Position) { posidx = (int)sodecls.size(); numPosComponents = decl.ComponentCount = 4; @@ -4221,7 +4222,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) // instanced draws must be replayed one at a time so we can record the number of primitives from // each drawcall, as due to expansion this can vary per-instance. - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) { // if there is only one instance it's a trivial case and we don't need to bother with the // expensive path @@ -4248,7 +4249,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) // difference how much each instance wrote. for(uint32_t inst = 1; inst <= drawcall->numInstances; inst++) { - if(drawcall->flags & eDraw_UseIBuffer) + if(drawcall->flags & DrawFlags::UseIBuffer) { m_pImmediateContext->SOSetTargets(1, &m_SOBuffer, &offset); m_pImmediateContext->Begin(m_SOStatsQueries[inst - 1]); @@ -4271,7 +4272,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) { m_pImmediateContext->Begin(m_SOStatsQueries[0]); - if(drawcall->flags & eDraw_UseIBuffer) + if(drawcall->flags & DrawFlags::UseIBuffer) { m_pImmediateContext->DrawIndexedInstanced(drawcall->numIndices, drawcall->numInstances, drawcall->indexOffset, drawcall->baseVertex, @@ -4292,13 +4293,13 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) // trying to stream out a stream-out-auto based drawcall would be bad! // instead just draw the number of verts we pre-calculated - if(drawcall->flags & eDraw_Auto) + if(drawcall->flags & DrawFlags::Auto) { m_pImmediateContext->Draw(drawcall->numIndices, 0); } else { - if(drawcall->flags & eDraw_UseIBuffer) + if(drawcall->flags & DrawFlags::UseIBuffer) { m_pImmediateContext->DrawIndexed(drawcall->numIndices, drawcall->indexOffset, drawcall->baseVertex); @@ -4320,7 +4321,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) D3D11_QUERY_DATA_SO_STATISTICS numPrims = {0}; std::vector instData; - if((drawcall->flags & eDraw_Instanced) && drawcall->numInstances > 1) + if((drawcall->flags & DrawFlags::Instanced) && drawcall->numInstances > 1) { uint64_t prevVertCount = 0; @@ -4463,7 +4464,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) m_PostVSData[eventID].gsout.buf = gsoutBuffer; m_PostVSData[eventID].gsout.instStride = 0; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].gsout.instStride = bufferDesc.ByteWidth / RDCMAX(1U, drawcall->numInstances); m_PostVSData[eventID].gsout.vertStride = stride; @@ -4533,7 +4534,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID) break; } - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].gsout.numVerts /= RDCMAX(1U, drawcall->numInstances); m_PostVSData[eventID].gsout.instData = instData; @@ -4565,7 +4566,7 @@ FloatVector D3D11DebugManager::InterpretVertex(byte *data, uint32_t vert, const fmt.compCount = cfg.position.compCount; fmt.compType = cfg.position.compType; - if(cfg.position.specialFormat == eSpecial_R10G10B10A2) + if(cfg.position.specialFormat == SpecialFormat::R10G10B10A2) { if(data + 4 >= end) { @@ -4580,7 +4581,7 @@ FloatVector D3D11DebugManager::InterpretVertex(byte *data, uint32_t vert, const ret.w = v.w; return ret; } - else if(cfg.position.specialFormat == eSpecial_R11G11B10) + else if(cfg.position.specialFormat == SpecialFormat::R11G11B10) { if(data + 4 >= end) { @@ -4669,7 +4670,7 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s resFmt.compCount = cfg.position.compCount; resFmt.compType = cfg.position.compType; resFmt.special = false; - if(cfg.position.specialFormat != eSpecial_Unknown) + if(cfg.position.specialFormat != SpecialFormat::Unknown) { resFmt.special = true; resFmt.specialFormat = cfg.position.specialFormat; @@ -4680,7 +4681,7 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s resFmt2.compCount = cfg.second.compCount; resFmt2.compType = cfg.second.compType; resFmt2.special = false; - if(cfg.second.specialFormat != eSpecial_Unknown) + if(cfg.second.specialFormat != SpecialFormat::Unknown) { resFmt2.special = true; resFmt2.specialFormat = cfg.second.specialFormat; @@ -4696,7 +4697,7 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s layoutdesc[0].SemanticIndex = 0; layoutdesc[0].Format = DXGI_FORMAT_R8G8B8A8_UNORM; if(cfg.position.buf != ResourceId() && - (cfg.position.specialFormat != eSpecial_Unknown || cfg.position.compCount > 0)) + (cfg.position.specialFormat != SpecialFormat::Unknown || cfg.position.compCount > 0)) layoutdesc[0].Format = MakeDXGIFormat(resFmt); layoutdesc[0].AlignedByteOffset = 0; // offset will be handled by vertex buffer offset layoutdesc[0].InputSlot = 0; @@ -4707,7 +4708,7 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s layoutdesc[1].SemanticIndex = 0; layoutdesc[1].Format = DXGI_FORMAT_R8G8B8A8_UNORM; if(cfg.second.buf != ResourceId() && - (cfg.second.specialFormat != eSpecial_Unknown || cfg.second.compCount > 0)) + (cfg.second.specialFormat != SpecialFormat::Unknown || cfg.second.compCount > 0)) layoutdesc[1].Format = MakeDXGIFormat(resFmt2); layoutdesc[1].AlignedByteOffset = 0; layoutdesc[1].InputSlot = 1; @@ -4858,14 +4859,14 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s m_pImmediateContext->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, NULL); // draw solid shaded mode - if(cfg.solidShadeMode != eShade_None && cfg.position.topo < eTopology_PatchList_1CPs) + if(cfg.solidShadeMode != SolidShade::NoSolid && cfg.position.topo < Topology::PatchList_1CPs) { m_pImmediateContext->RSSetState(m_DebugRender.RastState); m_pImmediateContext->IASetPrimitiveTopology(topo); pixelData.OutputDisplayFormat = (int)cfg.solidShadeMode; - if(cfg.solidShadeMode == eShade_Secondary && cfg.second.showAlpha) + if(cfg.solidShadeMode == SolidShade::Secondary && cfg.second.showAlpha) pixelData.OutputDisplayFormat = MESHDISPLAY_SECONDARY_ALPHA; FillCBuffer(m_DebugRender.GenericPSCBuffer, &pixelData, sizeof(DebugPixelCBufferData)); @@ -4875,7 +4876,7 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s m_pImmediateContext->PSSetConstantBuffers(0, 1, &m_DebugRender.GenericPSCBuffer); - if(cfg.solidShadeMode == eShade_Lit) + if(cfg.solidShadeMode == SolidShade::Lit) { DebugGeometryCBuffer geomData; @@ -4892,13 +4893,13 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s else m_pImmediateContext->Draw(cfg.position.numVerts, 0); - if(cfg.solidShadeMode == eShade_Lit) + if(cfg.solidShadeMode == SolidShade::Lit) m_pImmediateContext->GSSetShader(NULL, NULL, 0); } // draw wireframe mode - if(cfg.solidShadeMode == eShade_None || cfg.wireframeDraw || - cfg.position.topo >= eTopology_PatchList_1CPs) + if(cfg.solidShadeMode == SolidShade::NoSolid || cfg.wireframeDraw || + cfg.position.topo >= Topology::PatchList_1CPs) { m_pImmediateContext->RSSetState(m_WireframeHelpersRS); @@ -4914,7 +4915,7 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s m_pImmediateContext->PSSetConstantBuffers(0, 1, &m_DebugRender.GenericPSCBuffer); - if(cfg.position.topo >= eTopology_PatchList_1CPs) + if(cfg.position.topo >= Topology::PatchList_1CPs) m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); else m_pImmediateContext->IASetPrimitiveTopology(topo); @@ -4987,7 +4988,7 @@ void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector &s GetBufferData(cfg.position.buf, 0, 0, m_HighlightCache.data); - if(cfg.position.idxByteWidth == 0 || stage == eMeshDataStage_GSOut) + if(cfg.position.idxByteWidth == 0 || stage == MeshDataStage::GSOut) { m_HighlightCache.indices.clear(); m_HighlightCache.useidx = false; diff --git a/renderdoc/driver/d3d11/d3d11_debug.h b/renderdoc/driver/d3d11/d3d11_debug.h index fc6fc8ff2..7e1f1d68a 100644 --- a/renderdoc/driver/d3d11/d3d11_debug.h +++ b/renderdoc/driver/d3d11/d3d11_debug.h @@ -87,9 +87,9 @@ struct D3D11PostVSData const StageData &GetStage(MeshDataStage type) { - if(type == eMeshDataStage_VSOut) + if(type == MeshDataStage::VSOut) return vsout; - else if(type == eMeshDataStage_GSOut) + else if(type == MeshDataStage::GSOut) return gsout; else RDCERR("Unexpected mesh data stage!"); @@ -141,9 +141,9 @@ public: const vector &data); bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval); + CompType typeHint, float *minval, float *maxval); bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram); void CopyArrayToTex2DMS(ID3D11Texture2D *destMS, ID3D11Texture2D *srcArray); @@ -155,9 +155,9 @@ public: // called after any device is destroyed, to do corresponding shutdown of counters static void PostDeviceShutdownCounters(); - vector EnumerateCounters(); - void DescribeCounter(uint32_t counterID, CounterDescription &desc); - vector FetchCounters(const vector &counters); + vector EnumerateCounters(); + void DescribeCounter(GPUCounter counterID, CounterDescription &desc); + vector FetchCounters(const vector &counters); void RenderText(float x, float y, const char *textfmt, ...); void RenderMesh(uint32_t eventID, const vector &secondaryDraws, const MeshDisplay &cfg); @@ -173,7 +173,7 @@ public: ID3D11PixelShader *MakePShader(const char *source, const char *entry, const char *profile); ID3D11ComputeShader *MakeCShader(const char *source, const char *entry, const char *profile); - void BuildShader(string source, string entry, const uint32_t compileFlags, ShaderStageType type, + void BuildShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, ResourceId *id, string *errors); ID3D11Buffer *MakeCBuffer(UINT size); @@ -186,21 +186,20 @@ public: vector PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ShaderDebugTrace DebugVertex(uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset); ShaderDebugTrace DebugPixel(uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive); ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]); + uint32_t sample, CompType typeHint, float pixel[4]); uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y); - ResourceId RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents); + ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents); ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); // don't need to differentiate arrays as we treat everything // as an array (potentially with only one element). @@ -258,12 +257,12 @@ public: ID3D11ShaderResourceView *srv[eTexType_Max]; }; - TextureShaderDetails GetShaderDetails(ResourceId id, FormatComponentType typeHint, bool rawOutput); + TextureShaderDetails GetShaderDetails(ResourceId id, CompType typeHint, bool rawOutput); private: struct CacheElem { - CacheElem(ResourceId id_, FormatComponentType typeHint_, bool raw_) + CacheElem(ResourceId id_, CompType typeHint_, bool raw_) : created(false), id(id_), typeHint(typeHint_), raw(raw_), srvResource(NULL) { srv[0] = srv[1] = NULL; @@ -278,7 +277,7 @@ private: bool created; ResourceId id; - FormatComponentType typeHint; + CompType typeHint; bool raw; ID3D11Resource *srvResource; ID3D11ShaderResourceView *srv[2]; @@ -288,7 +287,7 @@ private: std::list m_ShaderItemCache; - CacheElem &GetCachedElem(ResourceId id, FormatComponentType typeHint, bool raw); + CacheElem &GetCachedElem(ResourceId id, CompType typeHint, bool raw); int m_width, m_height; float m_supersamplingX, m_supersamplingY; @@ -348,7 +347,7 @@ private: // mesh, not jumping back and forth much between meshes. struct HighlightCache { - HighlightCache() : EID(0), buf(), offs(0), stage(eMeshDataStage_Unknown), useidx(false) {} + HighlightCache() : EID(0), buf(), offs(0), stage(MeshDataStage::Unknown), useidx(false) {} uint32_t EID; ResourceId buf; uint32_t offs; diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index e2d81e8db..15556809e 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -242,7 +242,7 @@ const uint32_t D3D11InitParams::D3D11_OLD_VERSIONS[D3D11InitParams::D3D11_NUM_SU 0x00000A, }; -ReplayCreateStatus D3D11InitParams::Serialise() +ReplayStatus D3D11InitParams::Serialise() { SERIALISE_ELEMENT(uint32_t, ver, D3D11_SERIALISE_VERSION); SerialiseVersion = ver; @@ -266,7 +266,7 @@ ReplayCreateStatus D3D11InitParams::Serialise() { RDCERR("Incompatible D3D11 serialise version, expected %d got %d", D3D11_SERIALISE_VERSION, ver); - return eReplayCreate_APIIncompatibleVersion; + return ReplayStatus::APIIncompatibleVersion; } } @@ -280,7 +280,7 @@ ReplayCreateStatus D3D11InitParams::Serialise() NumFeatureLevels = numlevels; m_pSerialiser->SerialisePODArray("FeatureLevels", FeatureLevels); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } void WrappedID3D11Device::NewSwapchainBuffer(IUnknown *backbuffer) @@ -891,13 +891,13 @@ void WrappedID3D11Device::LazyInit() m_DebugManager = new D3D11DebugManager(this); } -void WrappedID3D11Device::AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, - DebugMessageSource src, std::string d) +void WrappedID3D11Device::AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, + std::string d) { // Only add runtime warnings while executing. // While reading, add the messages from the log, and while writing add messages // we add (on top of the API debug messages) - if(m_State != EXECUTING || src == eDbgSource_RuntimeWarning) + if(m_State != EXECUTING || src == MessageSource::RuntimeWarning) { DebugMessage msg; msg.eventID = m_State >= WRITING ? 0 : m_pImmediateContext->GetEventID(); @@ -913,7 +913,7 @@ void WrappedID3D11Device::AddDebugMessage(DebugMessageCategory c, DebugMessageSe void WrappedID3D11Device::AddDebugMessage(DebugMessage msg) { - if(m_State != EXECUTING || msg.source == eDbgSource_RuntimeWarning) + if(m_State != EXECUTING || msg.source == MessageSource::RuntimeWarning) m_DebugMessages.push_back(msg); } @@ -946,37 +946,47 @@ vector WrappedID3D11Device::GetDebugMessages() DebugMessage msg; msg.eventID = 0; - msg.source = eDbgSource_API; - msg.category = eDbgCategory_Miscellaneous; - msg.severity = eDbgSeverity_Medium; + msg.source = MessageSource::API; + msg.category = MessageCategory::Miscellaneous; + msg.severity = MessageSeverity::Medium; switch(message->Category) { case D3D11_MESSAGE_CATEGORY_APPLICATION_DEFINED: - msg.category = eDbgCategory_Application_Defined; + msg.category = MessageCategory::Application_Defined; + break; + case D3D11_MESSAGE_CATEGORY_MISCELLANEOUS: + msg.category = MessageCategory::Miscellaneous; + break; + case D3D11_MESSAGE_CATEGORY_INITIALIZATION: + msg.category = MessageCategory::Initialization; + break; + case D3D11_MESSAGE_CATEGORY_CLEANUP: msg.category = MessageCategory::Cleanup; break; + case D3D11_MESSAGE_CATEGORY_COMPILATION: msg.category = MessageCategory::Compilation; break; + case D3D11_MESSAGE_CATEGORY_STATE_CREATION: + msg.category = MessageCategory::State_Creation; + break; + case D3D11_MESSAGE_CATEGORY_STATE_SETTING: + msg.category = MessageCategory::State_Setting; + break; + case D3D11_MESSAGE_CATEGORY_STATE_GETTING: + msg.category = MessageCategory::State_Getting; break; - case D3D11_MESSAGE_CATEGORY_MISCELLANEOUS: msg.category = eDbgCategory_Miscellaneous; break; - case D3D11_MESSAGE_CATEGORY_INITIALIZATION: msg.category = eDbgCategory_Initialization; break; - case D3D11_MESSAGE_CATEGORY_CLEANUP: msg.category = eDbgCategory_Cleanup; break; - case D3D11_MESSAGE_CATEGORY_COMPILATION: msg.category = eDbgCategory_Compilation; break; - case D3D11_MESSAGE_CATEGORY_STATE_CREATION: msg.category = eDbgCategory_State_Creation; break; - case D3D11_MESSAGE_CATEGORY_STATE_SETTING: msg.category = eDbgCategory_State_Setting; break; - case D3D11_MESSAGE_CATEGORY_STATE_GETTING: msg.category = eDbgCategory_State_Getting; break; case D3D11_MESSAGE_CATEGORY_RESOURCE_MANIPULATION: - msg.category = eDbgCategory_Resource_Manipulation; + msg.category = MessageCategory::Resource_Manipulation; break; - case D3D11_MESSAGE_CATEGORY_EXECUTION: msg.category = eDbgCategory_Execution; break; - case D3D11_MESSAGE_CATEGORY_SHADER: msg.category = eDbgCategory_Shaders; break; + case D3D11_MESSAGE_CATEGORY_EXECUTION: msg.category = MessageCategory::Execution; break; + case D3D11_MESSAGE_CATEGORY_SHADER: msg.category = MessageCategory::Shaders; break; default: RDCWARN("Unexpected message category: %d", message->Category); break; } switch(message->Severity) { - case D3D11_MESSAGE_SEVERITY_CORRUPTION: msg.severity = eDbgSeverity_High; break; - case D3D11_MESSAGE_SEVERITY_ERROR: msg.severity = eDbgSeverity_Medium; break; - case D3D11_MESSAGE_SEVERITY_WARNING: msg.severity = eDbgSeverity_Low; break; - case D3D11_MESSAGE_SEVERITY_INFO: msg.severity = eDbgSeverity_Info; break; - case D3D11_MESSAGE_SEVERITY_MESSAGE: msg.severity = eDbgSeverity_Info; break; + case D3D11_MESSAGE_SEVERITY_CORRUPTION: msg.severity = MessageSeverity::High; break; + case D3D11_MESSAGE_SEVERITY_ERROR: msg.severity = MessageSeverity::Medium; break; + case D3D11_MESSAGE_SEVERITY_WARNING: msg.severity = MessageSeverity::Low; break; + case D3D11_MESSAGE_SEVERITY_INFO: msg.severity = MessageSeverity::Info; break; + case D3D11_MESSAGE_SEVERITY_MESSAGE: msg.severity = MessageSeverity::Info; break; default: RDCWARN("Unexpected message severity: %d", message->Severity); break; } @@ -1099,7 +1109,7 @@ void WrappedID3D11Device::Serialise_CaptureScope(uint64_t offset) // #mivance GL/Vulkan don't set this so don't get stats in window stats.recorded = 1; - for(uint32_t stage = eShaderStage_First; stage < eShaderStage_Count; stage++) + for(uint32_t stage = uint32_t(ShaderStage::First); stage < uint32_t(ShaderStage::Count); stage++) { create_array(stats.constants[stage].bindslots, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + 1); @@ -1107,12 +1117,12 @@ void WrappedID3D11Device::Serialise_CaptureScope(uint64_t offset) create_array(stats.samplers[stage].bindslots, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT + 1); - create_array(stats.resources[stage].types, eResType_Count); + create_array(stats.resources[stage].types, uint32_t(TextureDim::Count)); create_array(stats.resources[stage].bindslots, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + 1); } - create_array(stats.updates.types, eResType_Count); + create_array(stats.updates.types, uint32_t(TextureDim::Count)); create_array(stats.updates.sizes, FetchFrameUpdateStats::BUCKET_COUNT); create_array(stats.draws.counts, FetchFrameDrawStats::BUCKET_COUNT); @@ -2905,7 +2915,7 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd) bool buf1010102 = false; bool bufBGRA = (fmt.bgraOrder != false); - if(fmt.special && fmt.specialFormat == eSpecial_R10G10B10A2) + if(fmt.special && fmt.specialFormat == SpecialFormat::R10G10B10A2) { stride = 4; buf1010102 = true; diff --git a/renderdoc/driver/d3d11/d3d11_device.h b/renderdoc/driver/d3d11/d3d11_device.h index 3ce2af1f8..ab4e7c205 100644 --- a/renderdoc/driver/d3d11/d3d11_device.h +++ b/renderdoc/driver/d3d11/d3d11_device.h @@ -54,7 +54,7 @@ enum TextureDisplayType struct D3D11InitParams : public RDCInitParams { D3D11InitParams(); - ReplayCreateStatus Serialise(); + ReplayStatus Serialise(); D3D_DRIVER_TYPE DriverType; UINT Flags; @@ -443,8 +443,7 @@ public: vector GetDebugMessages(); void AddDebugMessage(DebugMessage msg); - void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, - std::string d); + void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, std::string d); const vector &GetLayoutDesc(ID3D11InputLayout *layout) { return m_LayoutDescs[layout]; diff --git a/renderdoc/driver/d3d11/d3d11_renderstate.cpp b/renderdoc/driver/d3d11/d3d11_renderstate.cpp index 3e09fb867..9fa383b3c 100644 --- a/renderdoc/driver/d3d11/d3d11_renderstate.cpp +++ b/renderdoc/driver/d3d11/d3d11_renderstate.cpp @@ -1321,7 +1321,7 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep { valid = false; m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, StringFormat::Fmt("Invalid output merger - Render targets %d and %d overlap", i, j)); break; } @@ -1332,7 +1332,7 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep { valid = false; m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, StringFormat::Fmt("Invalid output merger - Render target %d and depth overlap", i)); break; } @@ -1344,7 +1344,7 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep { valid = false; m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, StringFormat::Fmt("Invalid output merger - Render target %d and UAV %d overlap", i, j)); break; } @@ -1363,7 +1363,7 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep { valid = false; m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, StringFormat::Fmt("Invalid output merger - UAV %d and depth overlap", i)); break; } @@ -1375,7 +1375,7 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep { valid = false; m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, StringFormat::Fmt("Invalid output merger - UAVs %d and %d overlap", i, j)); break; } @@ -1400,8 +1400,8 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep if(renderdim[i] != dim) { valid = false; - m_pDevice->AddDebugMessage(eDbgCategory_State_Setting, eDbgSeverity_High, - eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::State_Setting, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Invalid output merger - Render targets of different type"); break; } @@ -1411,7 +1411,7 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep depthdim != dim) { m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, "Invalid output merger - Render target(s) and depth target of different type"); valid = false; } @@ -1501,7 +1501,7 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep desc2.SampleDesc.Quality != d2.SampleDesc.Quality) { m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, "Invalid output merger - Render targets are different dimensions"); valid = false; break; @@ -1555,8 +1555,8 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep } else if(dim == D3D11_RESOURCE_DIMENSION_TEXTURE3D || dim == D3D11_RESOURCE_DIMENSION_BUFFER) { - m_pDevice->AddDebugMessage(eDbgCategory_State_Setting, eDbgSeverity_High, - eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::State_Setting, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Invalid output merger - Depth target is Texture3D or Buffer " "(shouldn't be possible! How did you create this view?!)"); valid = false; @@ -1577,13 +1577,13 @@ bool D3D11RenderState::ValidOutputMerger(ID3D11RenderTargetView **RTs, ID3D11Dep { valid = true; m_pDevice->AddDebugMessage( - eDbgCategory_State_Setting, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::State_Setting, MessageSeverity::High, MessageSource::IncorrectAPIUse, "Valid but unusual output merger - Depth target is larger than render target(s)"); } else { - m_pDevice->AddDebugMessage(eDbgCategory_State_Setting, eDbgSeverity_High, - eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::State_Setting, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Invalid output merger - Depth target is different size or " "MS count to render target(s)"); } diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index 2325a2f02..099bff0b6 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -74,15 +74,15 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.cubemap = false; tex.format = MakeResourceFormat(desc.Format); - tex.creationFlags = 0; + tex.creationFlags = TextureCategory::NoFlags; if(desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) - tex.creationFlags |= eTextureCreate_SRV; + tex.creationFlags |= TextureCategory::ShaderRead; if(desc.BindFlags & D3D11_BIND_RENDER_TARGET) - tex.creationFlags |= eTextureCreate_RTV; + tex.creationFlags |= TextureCategory::ColorTarget; if(desc.BindFlags & D3D11_BIND_DEPTH_STENCIL) - tex.creationFlags |= eTextureCreate_DSV; + tex.creationFlags |= TextureCategory::DepthTarget; if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS) - tex.creationFlags |= eTextureCreate_UAV; + tex.creationFlags |= TextureCategory::ShaderReadWrite; tex.mips = desc.MipLevels; @@ -91,7 +91,7 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.arraysize = desc.ArraySize; - tex.resType = tex.arraysize > 1 ? eResType_Texture1DArray : eResType_Texture1D; + tex.resType = tex.arraysize > 1 ? TextureDim::Texture1DArray : TextureDim::Texture1D; tex.msQual = 0; tex.msSamp = 1; @@ -102,9 +102,9 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) { const char *suffix = ""; - if(tex.creationFlags & eTextureCreate_RTV) + if(tex.creationFlags & TextureCategory::ColorTarget) suffix = " RTV"; - if(tex.creationFlags & eTextureCreate_DSV) + if(tex.creationFlags & TextureCategory::DepthTarget) suffix = " DSV"; tex.customName = false; @@ -144,17 +144,17 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.depth = 1; tex.format = MakeResourceFormat(desc.Format); - tex.creationFlags = 0; + tex.creationFlags = TextureCategory::NoFlags; if(desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) - tex.creationFlags |= eTextureCreate_SRV; + tex.creationFlags |= TextureCategory::ShaderRead; if(desc.BindFlags & D3D11_BIND_RENDER_TARGET) - tex.creationFlags |= eTextureCreate_RTV; + tex.creationFlags |= TextureCategory::ColorTarget; if(desc.BindFlags & D3D11_BIND_DEPTH_STENCIL) - tex.creationFlags |= eTextureCreate_DSV; + tex.creationFlags |= TextureCategory::DepthTarget; if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS) - tex.creationFlags |= eTextureCreate_UAV; + tex.creationFlags |= TextureCategory::ShaderReadWrite; if(d3dtex->m_RealDescriptor) - tex.creationFlags |= eTextureCreate_SwapBuffer; + tex.creationFlags |= TextureCategory::SwapBuffer; tex.cubemap = false; if(desc.MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE) @@ -170,11 +170,11 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.msQual = desc.SampleDesc.Quality; tex.msSamp = RDCMAX(1U, desc.SampleDesc.Count); - tex.resType = tex.arraysize > 1 ? eResType_Texture2DArray : eResType_Texture2D; + tex.resType = tex.arraysize > 1 ? TextureDim::Texture2DArray : TextureDim::Texture2D; if(tex.cubemap) - tex.resType = tex.arraysize > 1 ? eResType_TextureCubeArray : eResType_TextureCube; + tex.resType = tex.arraysize > 1 ? TextureDim::TextureCubeArray : TextureDim::TextureCube; if(tex.msSamp > 1) - tex.resType = tex.arraysize > 1 ? eResType_Texture2DMSArray : eResType_Texture2DMS; + tex.resType = tex.arraysize > 1 ? TextureDim::Texture2DMSArray : TextureDim::Texture2DMS; tex.customName = true; @@ -186,9 +186,9 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) if(tex.msSamp > 1) ms = "MS"; - if(tex.creationFlags & eTextureCreate_RTV) + if(tex.creationFlags & TextureCategory::ColorTarget) suffix = " RTV"; - if(tex.creationFlags & eTextureCreate_DSV) + if(tex.creationFlags & TextureCategory::DepthTarget) suffix = " DSV"; tex.customName = false; @@ -236,17 +236,17 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.cubemap = false; tex.format = MakeResourceFormat(desc.Format); - tex.resType = eResType_Texture3D; + tex.resType = TextureDim::Texture3D; - tex.creationFlags = 0; + tex.creationFlags = TextureCategory::NoFlags; if(desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) - tex.creationFlags |= eTextureCreate_SRV; + tex.creationFlags |= TextureCategory::ShaderRead; if(desc.BindFlags & D3D11_BIND_RENDER_TARGET) - tex.creationFlags |= eTextureCreate_RTV; + tex.creationFlags |= TextureCategory::ColorTarget; if(desc.BindFlags & D3D11_BIND_DEPTH_STENCIL) - tex.creationFlags |= eTextureCreate_DSV; + tex.creationFlags |= TextureCategory::DepthTarget; if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS) - tex.creationFlags |= eTextureCreate_UAV; + tex.creationFlags |= TextureCategory::ShaderReadWrite; tex.mips = desc.MipLevels; @@ -264,9 +264,9 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) { const char *suffix = ""; - if(tex.creationFlags & eTextureCreate_RTV) + if(tex.creationFlags & TextureCategory::ColorTarget) suffix = " RTV"; - if(tex.creationFlags & eTextureCreate_DSV) + if(tex.creationFlags & TextureCategory::DepthTarget) suffix = " DSV"; tex.customName = false; @@ -289,7 +289,7 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.customName = true; tex.byteSize = 0; tex.dimension = 2; - tex.resType = eResType_Texture2D; + tex.resType = TextureDim::Texture2D; tex.width = 1; tex.height = 1; tex.depth = 1; @@ -354,8 +354,8 @@ APIProperties D3D11Replay::GetAPIProperties() { APIProperties ret; - ret.pipelineType = eGraphicsAPI_D3D11; - ret.localRenderer = eGraphicsAPI_D3D11; + ret.pipelineType = GraphicsAPI::D3D11; + ret.localRenderer = GraphicsAPI::D3D11; ret.degraded = m_WARP; return ret; @@ -403,15 +403,15 @@ FetchBuffer D3D11Replay::GetBuffer(ResourceId id) ret.name = str; ret.length = desc.ByteWidth; - ret.creationFlags = 0; + ret.creationFlags = BufferCategory::NoFlags; if(desc.BindFlags & D3D11_BIND_VERTEX_BUFFER) - ret.creationFlags |= eBufferCreate_VB; + ret.creationFlags |= BufferCategory::Vertex; if(desc.BindFlags & D3D11_BIND_INDEX_BUFFER) - ret.creationFlags |= eBufferCreate_IB; + ret.creationFlags |= BufferCategory::Index; if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS) - ret.creationFlags |= eBufferCreate_UAV; + ret.creationFlags |= BufferCategory::ReadWrite; if(desc.MiscFlags & D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS) - ret.creationFlags |= eBufferCreate_Indirect; + ret.creationFlags |= BufferCategory::Indirect; return ret; } @@ -508,8 +508,8 @@ D3D11PipelineState D3D11Replay::MakePipelineState() ///////////////////////////////////////////////// { - D3D11PipelineState::ShaderStage *dstArr[] = {&ret.m_VS, &ret.m_HS, &ret.m_DS, - &ret.m_GS, &ret.m_PS, &ret.m_CS}; + D3D11PipelineState::Shader *dstArr[] = {&ret.m_VS, &ret.m_HS, &ret.m_DS, + &ret.m_GS, &ret.m_PS, &ret.m_CS}; const D3D11RenderState::shader *srcArr[] = {&rs->VS, &rs->HS, &rs->DS, &rs->GS, &rs->PS, &rs->CS}; @@ -517,10 +517,10 @@ D3D11PipelineState D3D11Replay::MakePipelineState() for(size_t stage = 0; stage < 6; stage++) { - D3D11PipelineState::ShaderStage &dst = *dstArr[stage]; + D3D11PipelineState::Shader &dst = *dstArr[stage]; const D3D11RenderState::shader &src = *srcArr[stage]; - dst.stage = (ShaderStageType)stage; + dst.stage = (ShaderStage)stage; ResourceId id = GetIDForResource(src.Shader); @@ -531,16 +531,16 @@ D3D11PipelineState D3D11Replay::MakePipelineState() if(shad != NULL) refl = shad->GetDetails(); - dst.Shader = rm->GetOriginalID(id); + dst.Object = rm->GetOriginalID(id); dst.ShaderDetails = NULL; string str = GetDebugName(src.Shader); dst.customName = true; - if(str == "" && dst.Shader != ResourceId()) + if(str == "" && dst.Object != ResourceId()) { dst.customName = false; - str = StringFormat::Fmt("%s Shader %llu", stageNames[stage], dst.Shader); + str = StringFormat::Fmt("%s Shader %llu", stageNames[stage], dst.Object); } dst.ShaderName = str; @@ -611,7 +611,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() create_array_uninit(dst.Samplers, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT); for(size_t s = 0; s < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; s++) { - D3D11PipelineState::ShaderStage::Sampler &samp = dst.Samplers[s]; + D3D11PipelineState::Shader::Sampler &samp = dst.Samplers[s]; samp.Samp = rm->GetOriginalID(GetIDForResource(src.Samplers[s])); @@ -657,7 +657,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() create_array_uninit(dst.SRVs, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT); for(size_t s = 0; s < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; s++) { - D3D11PipelineState::ShaderStage::ResourceView &view = dst.SRVs[s]; + D3D11PipelineState::Shader::ResourceView &view = dst.SRVs[s]; view.View = rm->GetOriginalID(GetIDForResource(src.SRVs[s])); @@ -700,7 +700,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() { view.FirstElement = desc.BufferEx.FirstElement; view.NumElements = desc.BufferEx.NumElements; - view.Flags = desc.BufferEx.Flags; + view.Flags = D3DBufferViewFlags(desc.BufferEx.Flags); } else if(desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1D) { @@ -758,9 +758,9 @@ D3D11PipelineState D3D11Replay::MakePipelineState() } create_array(dst.UAVs, D3D11_1_UAV_SLOT_COUNT); - for(size_t s = 0; dst.stage == eShaderStage_Compute && s < D3D11_1_UAV_SLOT_COUNT; s++) + for(size_t s = 0; dst.stage == ShaderStage::Compute && s < D3D11_1_UAV_SLOT_COUNT; s++) { - D3D11PipelineState::ShaderStage::ResourceView &view = dst.UAVs[s]; + D3D11PipelineState::Shader::ResourceView &view = dst.UAVs[s]; view.View = rm->GetOriginalID(GetIDForResource(rs->CSUAVs[s])); @@ -793,7 +793,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() { view.FirstElement = desc.Buffer.FirstElement; view.NumElements = desc.Buffer.NumElements; - view.Flags = desc.Buffer.Flags; + view.Flags = D3DBufferViewFlags(desc.Buffer.Flags); D3D11_BUFFER_DESC bufdesc; ((ID3D11Buffer *)res)->GetDesc(&bufdesc); @@ -884,15 +884,15 @@ D3D11PipelineState D3D11Replay::MakePipelineState() ret.m_RS.m_State.AntialiasedLineEnable = desc.AntialiasedLineEnable == TRUE; - ret.m_RS.m_State.CullMode = eCull_None; + ret.m_RS.m_State.cullMode = CullMode::NoCull; if(desc.CullMode == D3D11_CULL_FRONT) - ret.m_RS.m_State.CullMode = eCull_Front; + ret.m_RS.m_State.cullMode = CullMode::Front; if(desc.CullMode == D3D11_CULL_BACK) - ret.m_RS.m_State.CullMode = eCull_Back; + ret.m_RS.m_State.cullMode = CullMode::Back; - ret.m_RS.m_State.FillMode = eFill_Solid; + ret.m_RS.m_State.fillMode = FillMode::Solid; if(desc.FillMode == D3D11_FILL_WIREFRAME) - ret.m_RS.m_State.FillMode = eFill_Wireframe; + ret.m_RS.m_State.fillMode = FillMode::Wireframe; ret.m_RS.m_State.DepthBias = desc.DepthBias; ret.m_RS.m_State.DepthBiasClamp = desc.DepthBiasClamp; @@ -927,11 +927,11 @@ D3D11PipelineState D3D11Replay::MakePipelineState() else { ret.m_RS.m_State.AntialiasedLineEnable = FALSE; - ret.m_RS.m_State.CullMode = eCull_Back; + ret.m_RS.m_State.cullMode = CullMode::Back; ret.m_RS.m_State.DepthBias = 0; ret.m_RS.m_State.DepthBiasClamp = 0.0f; ret.m_RS.m_State.DepthClip = TRUE; - ret.m_RS.m_State.FillMode = eFill_Solid; + ret.m_RS.m_State.fillMode = FillMode::Solid; ret.m_RS.m_State.FrontCCW = FALSE; ret.m_RS.m_State.MultisampleEnable = FALSE; ret.m_RS.m_State.ScissorEnable = FALSE; @@ -969,7 +969,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() create_array_uninit(ret.m_OM.RenderTargets, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT); for(size_t i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++) { - D3D11PipelineState::ShaderStage::ResourceView &view = ret.m_OM.RenderTargets[i]; + D3D11PipelineState::Shader::ResourceView &view = ret.m_OM.RenderTargets[i]; view.View = rm->GetOriginalID(GetIDForResource(rs->OM.RenderTargets[i])); @@ -1037,7 +1037,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() create_array_uninit(ret.m_OM.UAVs, D3D11_1_UAV_SLOT_COUNT); for(size_t s = 0; s < D3D11_1_UAV_SLOT_COUNT; s++) { - D3D11PipelineState::ShaderStage::ResourceView view; + D3D11PipelineState::Shader::ResourceView view; view.View = rm->GetOriginalID(GetIDForResource(rs->OM.UAVs[s])); @@ -1068,7 +1068,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() { view.FirstElement = desc.Buffer.FirstElement; view.NumElements = desc.Buffer.NumElements; - view.Flags = desc.Buffer.Flags; + view.Flags = D3DBufferViewFlags(desc.Buffer.Flags); D3D11_BUFFER_DESC bufdesc; ((ID3D11Buffer *)res)->GetDesc(&bufdesc); @@ -1117,7 +1117,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState() } { - D3D11PipelineState::ShaderStage::ResourceView &view = ret.m_OM.DepthTarget; + D3D11PipelineState::Shader::ResourceView &view = ret.m_OM.DepthTarget; view.View = rm->GetOriginalID(GetIDForResource(rs->OM.DepthView)); @@ -1320,7 +1320,7 @@ vector D3D11Replay::GetPassEvents(uint32_t eventID) const FetchDrawcall *start = draw; while(start && start->previous != 0 && - (m_pDevice->GetDrawcall((uint32_t)start->previous)->flags & eDraw_Clear) == 0) + !(m_pDevice->GetDrawcall((uint32_t)start->previous)->flags & DrawFlags::Clear)) { const FetchDrawcall *prev = m_pDevice->GetDrawcall((uint32_t)start->previous); @@ -1336,7 +1336,7 @@ vector D3D11Replay::GetPassEvents(uint32_t eventID) if(start == draw) break; - if(start->flags & eDraw_Drawcall) + if(start->flags & DrawFlags::Drawcall) passEvents.push_back(start->eventID); start = m_pDevice->GetDrawcall((uint32_t)start->next); @@ -1423,15 +1423,15 @@ ResourceId D3D11Replay::GetLiveID(ResourceId id) } bool D3D11Replay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) + CompType typeHint, float *minval, float *maxval) { return m_pDevice->GetDebugManager()->GetMinMax(texid, sliceFace, mip, sample, typeHint, minval, maxval); } bool D3D11Replay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, - bool channels[4], vector &histogram) + CompType typeHint, float minval, float maxval, bool channels[4], + vector &histogram) { return m_pDevice->GetDebugManager()->GetHistogram(texid, sliceFace, mip, sample, typeHint, minval, maxval, channels, histogram); @@ -1463,17 +1463,17 @@ void D3D11Replay::RemoveReplacement(ResourceId id) m_pDevice->GetResourceManager()->RemoveReplacement(id); } -vector D3D11Replay::EnumerateCounters() +vector D3D11Replay::EnumerateCounters() { return m_pDevice->GetDebugManager()->EnumerateCounters(); } -void D3D11Replay::DescribeCounter(uint32_t counterID, CounterDescription &desc) +void D3D11Replay::DescribeCounter(GPUCounter counterID, CounterDescription &desc) { m_pDevice->GetDebugManager()->DescribeCounter(counterID, desc); } -vector D3D11Replay::FetchCounters(const vector &counters) +vector D3D11Replay::FetchCounters(const vector &counters) { return m_pDevice->GetDebugManager()->FetchCounters(counters); } @@ -1485,14 +1485,14 @@ void D3D11Replay::RenderMesh(uint32_t eventID, const vector &seconda } void D3D11Replay::BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { m_pDevice->GetDebugManager()->BuildShader(source, entry, D3DCOMPILE_DEBUG | compileFlags, type, id, errors); } void D3D11Replay::BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { m_pDevice->GetDebugManager()->BuildShader(source, entry, compileFlags, type, id, errors); } @@ -1533,7 +1533,7 @@ void D3D11Replay::FillCBufferVariables(ResourceId shader, string entryPoint, uin vector D3D11Replay::PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, uint32_t sampleIdx, - FormatComponentType typeHint) + CompType typeHint) { return m_pDevice->GetDebugManager()->PixelHistory(events, target, x, y, slice, mip, sampleIdx, typeHint); @@ -1563,22 +1563,19 @@ uint32_t D3D11Replay::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint3 } void D3D11Replay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, - uint32_t mip, uint32_t sample, FormatComponentType typeHint, - float pixel[4]) + uint32_t mip, uint32_t sample, CompType typeHint, float pixel[4]) { m_pDevice->GetDebugManager()->PickPixel(texture, x, y, sliceFace, mip, sample, typeHint, pixel); } -ResourceId D3D11Replay::RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) +ResourceId D3D11Replay::RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { return m_pDevice->GetDebugManager()->RenderOverlay(texid, typeHint, overlay, eventID, passEvents); } ResourceId D3D11Replay::ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, - uint32_t arrayIdx, uint32_t sampleIdx, - FormatComponentType typeHint) + uint32_t arrayIdx, uint32_t sampleIdx, CompType typeHint) { return m_pDevice->GetDebugManager()->ApplyCustomShader(shader, texid, mip, arrayIdx, sampleIdx, typeHint); @@ -1629,7 +1626,7 @@ ResourceId D3D11Replay::CreateProxyTexture(const FetchTexture &templateTex) desc.ArraySize = templateTex.arraysize; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - if(templateTex.creationFlags & eTextureCreate_DSV) + if(templateTex.creationFlags & TextureCategory::DepthTarget) desc.BindFlags |= D3D11_BIND_DEPTH_STENCIL; desc.CPUAccessFlags = 0; @@ -1648,12 +1645,12 @@ ResourceId D3D11Replay::CreateProxyTexture(const FetchTexture &templateTex) resource = throwaway; - if(templateTex.creationFlags & eTextureCreate_DSV) + if(templateTex.creationFlags & TextureCategory::DepthTarget) desc.Format = GetTypelessFormat(desc.Format); ret = ((WrappedID3D11Texture1D *)throwaway)->GetResourceID(); - if(templateTex.creationFlags & eTextureCreate_DSV) + if(templateTex.creationFlags & TextureCategory::DepthTarget) WrappedID3D11Texture1D::m_TextureList[ret].m_Type = TEXDISPLAY_DEPTH_TARGET; } else if(templateTex.dimension == 2) @@ -1674,7 +1671,7 @@ ResourceId D3D11Replay::CreateProxyTexture(const FetchTexture &templateTex) desc.SampleDesc.Count = RDCMAX(1U, templateTex.msSamp); desc.SampleDesc.Quality = templateTex.msQual; - if(templateTex.creationFlags & eTextureCreate_DSV || IsDepthFormat(desc.Format)) + if(templateTex.creationFlags & TextureCategory::DepthTarget || IsDepthFormat(desc.Format)) { desc.BindFlags |= D3D11_BIND_DEPTH_STENCIL; desc.Format = GetTypelessFormat(desc.Format); @@ -1693,7 +1690,7 @@ ResourceId D3D11Replay::CreateProxyTexture(const FetchTexture &templateTex) resource = throwaway; ret = ((WrappedID3D11Texture2D1 *)throwaway)->GetResourceID(); - if(templateTex.creationFlags & eTextureCreate_DSV) + if(templateTex.creationFlags & TextureCategory::DepthTarget) WrappedID3D11Texture2D1::m_TextureList[ret].m_Type = TEXDISPLAY_DEPTH_TARGET; } else if(templateTex.dimension == 3) @@ -1703,7 +1700,7 @@ ResourceId D3D11Replay::CreateProxyTexture(const FetchTexture &templateTex) desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - if(templateTex.creationFlags & eTextureCreate_DSV) + if(templateTex.creationFlags & TextureCategory::DepthTarget) desc.BindFlags |= D3D11_BIND_DEPTH_STENCIL; desc.CPUAccessFlags = 0; @@ -1864,20 +1861,20 @@ ResourceId D3D11Replay::CreateProxyBuffer(const FetchBuffer &templateBuf) desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; desc.StructureByteStride = 0; - if(templateBuf.creationFlags & eBufferCreate_Indirect) + if(templateBuf.creationFlags & BufferCategory::Indirect) { desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.MiscFlags |= D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS; } - if(templateBuf.creationFlags & eBufferCreate_IB) + if(templateBuf.creationFlags & BufferCategory::Index) desc.BindFlags = D3D11_BIND_INDEX_BUFFER; // D3D11_BIND_CONSTANT_BUFFER size must be <= 65536 on some drivers. if(desc.ByteWidth <= D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * 16) { - if(templateBuf.creationFlags & eBufferCreate_CB) + if(templateBuf.creationFlags & BufferCategory::Constants) desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; } - if(templateBuf.creationFlags & eBufferCreate_UAV) + if(templateBuf.creationFlags & BufferCategory::ReadWrite) desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE; HRESULT hr = m_pDevice->CreateBuffer(&desc, NULL, &throwaway); @@ -1934,7 +1931,7 @@ void D3D11Replay::SetProxyBufferData(ResourceId bufid, byte *data, size_t dataSi ID3DDevice *GetD3D11DeviceIfAlloc(IUnknown *dev); -ReplayCreateStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCDEBUG("Creating a D3D11 replay device"); @@ -1945,27 +1942,27 @@ ReplayCreateStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver * if(lib == NULL) { RDCERR("Failed to load d3d11.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } lib = LoadLibraryA("d3d9.dll"); if(lib == NULL) { RDCERR("Failed to load d3d9.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } lib = LoadLibraryA("dxgi.dll"); if(lib == NULL) { RDCERR("Failed to load dxgi.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } if(GetD3DCompiler() == NULL) { RDCERR("Failed to load d3dcompiler_??.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } typedef HRESULT(__cdecl * PFN_RENDERDOC_CREATE_DEVICE_AND_SWAP_CHAIN)( @@ -1990,7 +1987,7 @@ ReplayCreateStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver * { auto status = RenderDoc::Inst().FillInitParams(logfile, driverFileType, driverName, machineIdent, (RDCInitParams *)&initParams); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) return status; } @@ -2068,7 +2065,7 @@ ReplayCreateStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver * if(logfile && wrappedDev->GetSerialiser()->HasError()) { SAFE_RELEASE(wrappedDev); - return eReplayCreate_FileIOFailed; + return ReplayStatus::FileIOFailed; } RDCLOG("Created device."); @@ -2078,14 +2075,14 @@ ReplayCreateStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver * if(warpFallback) { wrappedDev->AddDebugMessage( - eDbgCategory_Initialization, eDbgSeverity_High, eDbgSource_RuntimeWarning, + MessageCategory::Initialization, MessageSeverity::High, MessageSource::RuntimeWarning, "Couldn't create FEATURE_LEVEL_11_0 device - RenderDoc requires FEATURE_LEVEL_11_0 " "availability - falling back to WARP rasterizer.\n" "Performance and usability will be significantly degraded."); } *driver = (IReplayDriver *)replay; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } if(i == -1) @@ -2119,7 +2116,7 @@ ReplayCreateStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver * RDCERR("Couldn't create any compatible d3d11 device :(."); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } static DriverRegistration D3D11DriverRegistration(RDC_D3D11, "D3D11", &D3D11_CreateReplayDevice); diff --git a/renderdoc/driver/d3d11/d3d11_replay.h b/renderdoc/driver/d3d11/d3d11_replay.h index c6bb82c59..1688dc193 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.h +++ b/renderdoc/driver/d3d11/d3d11_replay.h @@ -78,7 +78,7 @@ public: vector GetSupportedWindowSystems() { vector ret; - ret.push_back(eWindowingSystem_Win32); + ret.push_back(WindowingSystem::Win32); return ret; } @@ -98,9 +98,9 @@ public: ResourceId GetLiveID(ResourceId id); bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval); + CompType typeHint, float *minval, float *maxval); bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram); MeshFormat GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDataStage stage); @@ -109,14 +109,14 @@ public: byte *GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, const GetTextureDataParams ¶ms, size_t &dataSize); - void BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); + void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); void ReplaceResource(ResourceId from, ResourceId to); void RemoveReplacement(ResourceId id); - vector EnumerateCounters(); - void DescribeCounter(uint32_t counterID, CounterDescription &desc); - vector FetchCounters(const vector &counters); + vector EnumerateCounters(); + void DescribeCounter(GPUCounter counterID, CounterDescription &desc); + vector FetchCounters(const vector &counters); ResourceId CreateProxyTexture(const FetchTexture &templateTex); void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data, @@ -139,24 +139,23 @@ public: vector PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ShaderDebugTrace DebugVertex(uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset); ShaderDebugTrace DebugPixel(uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive); ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]); + uint32_t sample, CompType typeHint, float pixel[4]); uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y); - ResourceId RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents); + ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents); - void BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); + void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); bool IsRenderOutput(ResourceId id); diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index efcca4508..1ff4706a9 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -92,7 +92,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Close() { FetchDrawcall draw; draw.name = "API Calls"; - draw.flags |= eDraw_SetMarker | eDraw_APICalls; + draw.flags |= DrawFlags::SetMarker | DrawFlags::APICalls; m_Cmd->AddDrawcall(draw, true); @@ -2651,7 +2651,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetMarker(UINT Metadata, const { FetchDrawcall draw; draw.name = markerText; - draw.flags |= eDraw_SetMarker; + draw.flags |= DrawFlags::SetMarker; m_Cmd->AddDrawcall(draw, false); } @@ -2709,7 +2709,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BeginEvent(UINT Metadata, const { FetchDrawcall draw; draw.name = markerText; - draw.flags |= eDraw_PushMarker; + draw.flags |= DrawFlags::PushMarker; m_Cmd->AddDrawcall(draw, false); } @@ -2741,7 +2741,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_EndEvent() { FetchDrawcall draw; draw.name = "API Calls"; - draw.flags = eDraw_SetMarker | eDraw_APICalls; + draw.flags = DrawFlags::SetMarker | DrawFlags::APICalls; m_Cmd->AddDrawcall(draw, true); } @@ -2752,7 +2752,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_EndEvent() // is being in-lined into the call stream FetchDrawcall draw; draw.name = "Pop()"; - draw.flags = eDraw_PopMarker; + draw.flags = DrawFlags::PopMarker; m_Cmd->AddDrawcall(draw, false); } @@ -2826,7 +2826,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_DrawInstanced(UINT VertexCountP draw.vertexOffset = startVtx; draw.instanceOffset = startInst; - draw.flags |= eDraw_Drawcall | eDraw_Instanced; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced; m_Cmd->AddDrawcall(draw, true); } @@ -2903,7 +2903,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_DrawIndexedInstanced(UINT Index draw.baseVertex = startVtx; draw.instanceOffset = startInst; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::UseIBuffer; m_Cmd->AddDrawcall(draw, true); } @@ -2975,7 +2975,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Dispatch(UINT ThreadGroupCountX draw.dispatchDimension[1] = y; draw.dispatchDimension[2] = z; - draw.flags |= eDraw_Dispatch; + draw.flags |= DrawFlags::Dispatch; m_Cmd->AddDrawcall(draw, true); } @@ -3052,7 +3052,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteBundle(ID3D12GraphicsCom FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_CmdList; + draw.flags |= DrawFlags::CmdList; m_Cmd->AddDrawcall(draw, true); } @@ -3146,7 +3146,7 @@ void WrappedID3D12GraphicsCommandList::ReserveExecuteIndirect(ID3D12GraphicsComm { FetchDrawcall draw; draw.name = "ExecuteIndirect()"; - draw.flags = eDraw_PopMarker; + draw.flags = DrawFlags::PopMarker; m_Cmd->AddDrawcall(draw, false); } else @@ -3205,7 +3205,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in StringFormat::Fmt("ExecuteIndirect(maxCount %u, count <%u>)", exec.maxCount, count); // if there's only one command running, remove its pushmarker flag if(!multidraw) - draws[idx].draw.flags = (draws[idx].draw.flags & ~eDraw_PushMarker) | eDraw_SetMarker; + draws[idx].draw.flags = (draws[idx].draw.flags & ~DrawFlags::PushMarker) | DrawFlags::SetMarker; // move to the first actual draw of the commands idx++; @@ -3232,7 +3232,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in draw.numInstances = args->InstanceCount; draw.vertexOffset = args->StartVertexLocation; draw.instanceOffset = args->StartInstanceLocation; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_Indirect; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::Indirect; draw.name = StringFormat::Fmt("[%u] arg%u: IndirectDraw(<%u, %u>)", i, a, draw.numIndices, draw.numInstances); @@ -3276,7 +3276,8 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in draw.baseVertex = args->BaseVertexLocation; draw.vertexOffset = args->StartIndexLocation; draw.instanceOffset = args->StartInstanceLocation; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_UseIBuffer | eDraw_Indirect; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::UseIBuffer | + DrawFlags::Indirect; draw.name = StringFormat::Fmt("[%u] arg%u: IndirectDrawIndexed(<%u, %u>)", i, a, draw.numIndices, draw.numInstances); @@ -3318,7 +3319,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in draw.dispatchDimension[0] = args->ThreadGroupCountX; draw.dispatchDimension[1] = args->ThreadGroupCountY; draw.dispatchDimension[2] = args->ThreadGroupCountZ; - draw.flags |= eDraw_Dispatch | eDraw_Indirect; + draw.flags |= DrawFlags::Dispatch | DrawFlags::Indirect; draw.name = StringFormat::Fmt("[%u] arg%u: IndirectDispatch(<%u, %u, %u>)", i, a, draw.dispatchDimension[0], draw.dispatchDimension[1], draw.dispatchDimension[2]); @@ -3966,12 +3967,12 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( FetchDrawcall draw; draw.name = "ExecuteIndirect"; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; if(maxCount > 1 || comSig->sig.numDraws > 1) - draw.flags |= eDraw_PushMarker; + draw.flags |= DrawFlags::PushMarker; else - draw.flags |= eDraw_SetMarker; + draw.flags |= DrawFlags::SetMarker; // this drawcall needs an event to anchor its file offset. This is a bit of a hack, // but a proper solution for handling 'fake' events that don't correspond to actual @@ -3984,11 +3985,12 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( D3D12DrawcallTreeNode &drawNode = m_Cmd->GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back(std::make_pair( - GetResourceManager()->GetLiveID(arg), EventUsage(drawNode.draw.eventID, eUsage_Indirect))); + drawNode.resourceUsage.push_back( + std::make_pair(GetResourceManager()->GetLiveID(arg), + EventUsage(drawNode.draw.eventID, ResourceUsage::Indirect))); drawNode.resourceUsage.push_back( std::make_pair(GetResourceManager()->GetLiveID(countbuf), - EventUsage(drawNode.draw.eventID, eUsage_Indirect))); + EventUsage(drawNode.draw.eventID, ResourceUsage::Indirect))); ID3D12GraphicsCommandList *cracked = GetCrackedList(CommandList); @@ -4130,7 +4132,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ClearDepthStencilView( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearDepthStencil; m_Cmd->AddDrawcall(draw, true); @@ -4138,8 +4140,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ClearDepthStencilView( D3D12DrawcallTreeNode &drawNode = m_Cmd->GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back(std::make_pair( - GetResID(descriptor->nonsamp.resource), EventUsage(drawNode.draw.eventID, eUsage_Clear))); + drawNode.resourceUsage.push_back( + std::make_pair(GetResID(descriptor->nonsamp.resource), + EventUsage(drawNode.draw.eventID, ResourceUsage::Clear))); } } @@ -4216,7 +4219,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ClearRenderTargetView( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearColour; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearColour; m_Cmd->AddDrawcall(draw, true); @@ -4224,8 +4227,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ClearRenderTargetView( D3D12DrawcallTreeNode &drawNode = m_Cmd->GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back(std::make_pair( - GetResID(descriptor->nonsamp.resource), EventUsage(drawNode.draw.eventID, eUsage_Clear))); + drawNode.resourceUsage.push_back( + std::make_pair(GetResID(descriptor->nonsamp.resource), + EventUsage(drawNode.draw.eventID, ResourceUsage::Clear))); } } @@ -4313,14 +4317,14 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ClearUnorderedAccessViewUint( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; m_Cmd->AddDrawcall(draw, true); D3D12DrawcallTreeNode &drawNode = m_Cmd->GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(pResource), EventUsage(drawNode.draw.eventID, eUsage_Clear))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(pResource), EventUsage(drawNode.draw.eventID, ResourceUsage::Clear))); } } @@ -4416,14 +4420,14 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ClearUnorderedAccessViewFloat( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; m_Cmd->AddDrawcall(draw, true); D3D12DrawcallTreeNode &drawNode = m_Cmd->GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(pResource), EventUsage(drawNode.draw.eventID, eUsage_Clear))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(pResource), EventUsage(drawNode.draw.eventID, ResourceUsage::Clear))); } } @@ -4555,7 +4559,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyBufferRegion(ID3D12Resource FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = src; draw.copyDestination = dst; @@ -4566,15 +4570,15 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyBufferRegion(ID3D12Resource if(src == dst) { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(pSrcBuffer), EventUsage(drawNode.draw.eventID, eUsage_Copy))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(pSrcBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::Copy))); } else { drawNode.resourceUsage.push_back(std::make_pair( - GetResID(pSrcBuffer), EventUsage(drawNode.draw.eventID, eUsage_CopySrc))); + GetResID(pSrcBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::CopySrc))); drawNode.resourceUsage.push_back(std::make_pair( - GetResID(pDstBuffer), EventUsage(drawNode.draw.eventID, eUsage_CopyDst))); + GetResID(pDstBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::CopyDst))); } } } @@ -4643,7 +4647,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyTextureRegion( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = origSrc; draw.copyDestination = origDst; @@ -4655,14 +4659,14 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyTextureRegion( if(origSrc == origDst) { drawNode.resourceUsage.push_back( - std::make_pair(liveSrc, EventUsage(drawNode.draw.eventID, eUsage_Copy))); + std::make_pair(liveSrc, EventUsage(drawNode.draw.eventID, ResourceUsage::Copy))); } else { drawNode.resourceUsage.push_back( - std::make_pair(liveSrc, EventUsage(drawNode.draw.eventID, eUsage_CopySrc))); + std::make_pair(liveSrc, EventUsage(drawNode.draw.eventID, ResourceUsage::CopySrc))); drawNode.resourceUsage.push_back( - std::make_pair(liveDst, EventUsage(drawNode.draw.eventID, eUsage_CopyDst))); + std::make_pair(liveDst, EventUsage(drawNode.draw.eventID, ResourceUsage::CopyDst))); } } } @@ -4732,7 +4736,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyResource(ID3D12Resource *pD FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = src; draw.copyDestination = dst; @@ -4743,15 +4747,15 @@ bool WrappedID3D12GraphicsCommandList::Serialise_CopyResource(ID3D12Resource *pD if(pSrcResource == pDstResource) { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, eUsage_Copy))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, ResourceUsage::Copy))); } else { drawNode.resourceUsage.push_back(std::make_pair( - GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, eUsage_CopySrc))); + GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, ResourceUsage::CopySrc))); drawNode.resourceUsage.push_back(std::make_pair( - GetResID(pDstResource), EventUsage(drawNode.draw.eventID, eUsage_CopyDst))); + GetResID(pDstResource), EventUsage(drawNode.draw.eventID, ResourceUsage::CopyDst))); } } } @@ -4822,7 +4826,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ResolveSubresource(ID3D12Resour FetchDrawcall draw; draw.name = name; - draw.flags |= eUsage_Resolve; + draw.flags |= DrawFlags::Resolve; draw.copySource = src; draw.copyDestination = dst; @@ -4834,14 +4838,14 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ResolveSubresource(ID3D12Resour if(pSrcResource == pDstResource) { drawNode.resourceUsage.push_back(std::make_pair( - GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, eUsage_Resolve))); + GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, ResourceUsage::Resolve))); } else { drawNode.resourceUsage.push_back(std::make_pair( - GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, eUsage_ResolveSrc))); + GetResID(pSrcResource), EventUsage(drawNode.draw.eventID, ResourceUsage::ResolveSrc))); drawNode.resourceUsage.push_back(std::make_pair( - GetResID(pDstResource), EventUsage(drawNode.draw.eventID, eUsage_ResolveDst))); + GetResID(pDstResource), EventUsage(drawNode.draw.eventID, ResourceUsage::ResolveDst))); } } } diff --git a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp index 803c85ae6..05e556da9 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp @@ -101,17 +101,17 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(UINT NumCommandLis if(m_State >= WRITING) msgDesc = debugMessages[i].description.elems; - SERIALISE_ELEMENT(uint32_t, Category, debugMessages[i].category); - SERIALISE_ELEMENT(uint32_t, Severity, debugMessages[i].severity); + SERIALISE_ELEMENT(MessageCategory, Category, debugMessages[i].category); + SERIALISE_ELEMENT(MessageSeverity, Severity, debugMessages[i].severity); SERIALISE_ELEMENT(uint32_t, ID, debugMessages[i].messageID); SERIALISE_ELEMENT(string, Description, msgDesc); if(m_State == READING) { DebugMessage msg; - msg.source = eDbgSource_API; - msg.category = (DebugMessageCategory)Category; - msg.severity = (DebugMessageSeverity)Severity; + msg.source = MessageSource::API; + msg.category = Category; + msg.severity = Severity; msg.messageID = ID; msg.description = Description; @@ -185,7 +185,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(UINT NumCommandLis // add a fake marker FetchDrawcall draw; draw.name = name; - draw.flags = eDraw_PassBoundary | eDraw_BeginPass; + draw.flags = DrawFlags::PassBoundary | DrawFlags::BeginPass; m_Cmd.AddEvent(name); m_Cmd.AddDrawcall(draw, true); m_Cmd.m_RootEventID++; @@ -222,7 +222,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(UINT NumCommandLis name = StringFormat::Fmt("=> %s[%u]: Close(%s)", basename.c_str(), c, ToStr::Get(cmdIds[c]).c_str()); draw.name = name; - draw.flags = eDraw_PassBoundary | eDraw_EndPass; + draw.flags = DrawFlags::PassBoundary | DrawFlags::EndPass; m_Cmd.AddEvent(name); m_Cmd.AddDrawcall(draw, true); m_Cmd.m_RootEventID++; diff --git a/renderdoc/driver/d3d12/d3d12_commands.cpp b/renderdoc/driver/d3d12/d3d12_commands.cpp index d1d3cce4b..d6991d07b 100644 --- a/renderdoc/driver/d3d12/d3d12_commands.cpp +++ b/renderdoc/driver/d3d12/d3d12_commands.cpp @@ -416,7 +416,7 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu FetchDrawcall draw; draw.name = "Present()"; - draw.flags |= eDraw_Present; + draw.flags |= DrawFlags::Present; draw.copyDestination = bbid; @@ -679,8 +679,8 @@ bool WrappedID3D12GraphicsCommandList::ValidateRootGPUVA(ResourceId buffer) } else { - m_pDevice->AddDebugMessage(eDbgCategory_Resource_Manipulation, eDbgSeverity_Medium, - eDbgSource_IncorrectAPIUse, + m_pDevice->AddDebugMessage(MessageCategory::Resource_Manipulation, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Binding 0 as a GPU Virtual Address in a root constant is " "invalid. This call will be dropped during replay."); } @@ -868,7 +868,7 @@ uint32_t D3D12CommandData::HandlePreCallback(ID3D12GraphicsCommandList *list, bo // handle all aliases of this drawcall as long as it's not a multidraw const FetchDrawcall *draw = m_pDevice->GetDrawcall(eventID); - if(draw == NULL || (draw->flags & eDraw_MultiDraw) == 0) + if(draw == NULL || !(draw->flags & DrawFlags::MultiDraw)) { ++it; while(it != m_DrawcallUses.end() && it->fileOffset == m_CurChunkOffset) @@ -1003,12 +1003,13 @@ void D3D12CommandData::AddUsage(D3D12DrawcallTreeNode &drawNode) const D3D12RenderState &state = m_BakedCmdListInfo[m_LastCmdListID].state; uint32_t e = d.eventID; - if((d.flags & (eDraw_Drawcall | eDraw_Dispatch)) == 0) + DrawFlags DrawMask = DrawFlags::Drawcall | DrawFlags::Dispatch; + if(!(d.flags & DrawMask)) return; const D3D12RenderState::RootSignature *rootdata = NULL; - if((d.flags & eDraw_Dispatch) && state.compute.rootsig != ResourceId()) + if((d.flags & DrawFlags::Dispatch) && state.compute.rootsig != ResourceId()) { rootdata = &state.compute; } @@ -1016,25 +1017,25 @@ void D3D12CommandData::AddUsage(D3D12DrawcallTreeNode &drawNode) { rootdata = &state.graphics; - if(d.flags & eDraw_UseIBuffer && state.ibuffer.buf != ResourceId()) + if(d.flags & DrawFlags::UseIBuffer && state.ibuffer.buf != ResourceId()) drawNode.resourceUsage.push_back( - std::make_pair(state.ibuffer.buf, EventUsage(e, eUsage_IndexBuffer))); + std::make_pair(state.ibuffer.buf, EventUsage(e, ResourceUsage::IndexBuffer))); for(size_t i = 0; i < state.vbuffers.size(); i++) { if(state.vbuffers[i].buf != ResourceId()) drawNode.resourceUsage.push_back( - std::make_pair(state.vbuffers[i].buf, EventUsage(e, eUsage_VertexBuffer))); + std::make_pair(state.vbuffers[i].buf, EventUsage(e, ResourceUsage::VertexBuffer))); } for(size_t i = 0; i < state.streamouts.size(); i++) { if(state.streamouts[i].buf != ResourceId()) drawNode.resourceUsage.push_back( - std::make_pair(state.streamouts[i].buf, EventUsage(e, eUsage_SO))); + std::make_pair(state.streamouts[i].buf, EventUsage(e, ResourceUsage::StreamOut))); if(state.streamouts[i].countbuf != ResourceId()) drawNode.resourceUsage.push_back( - std::make_pair(state.streamouts[i].countbuf, EventUsage(e, eUsage_SO))); + std::make_pair(state.streamouts[i].countbuf, EventUsage(e, ResourceUsage::StreamOut))); } vector rts = state.GetRTVIDs(); @@ -1042,12 +1043,14 @@ void D3D12CommandData::AddUsage(D3D12DrawcallTreeNode &drawNode) for(size_t i = 0; i < rts.size(); i++) { if(rts[i] != ResourceId()) - drawNode.resourceUsage.push_back(std::make_pair(rts[i], EventUsage(e, eUsage_ColourTarget))); + drawNode.resourceUsage.push_back( + std::make_pair(rts[i], EventUsage(e, ResourceUsage::ColourTarget))); } ResourceId id = state.GetDSVID(); if(id != ResourceId()) - drawNode.resourceUsage.push_back(std::make_pair(id, EventUsage(e, eUsage_DepthStencilTarget))); + drawNode.resourceUsage.push_back( + std::make_pair(id, EventUsage(e, ResourceUsage::DepthStencilTarget))); } if(rootdata) @@ -1063,25 +1066,23 @@ void D3D12CommandData::AddUsage(D3D12DrawcallTreeNode &drawNode) const D3D12RootSignatureParameter &p = sig->sig.params[rootEl]; const D3D12RenderState::SignatureElement &el = rootdata->sigelems[rootEl]; - ResourceUsage cb = eUsage_CS_Constants; - ResourceUsage ro = eUsage_CS_Resource; - ResourceUsage rw = eUsage_CS_RWResource; + ResourceUsage cb = ResourceUsage::CS_Constants; + ResourceUsage ro = ResourceUsage::CS_Resource; + ResourceUsage rw = ResourceUsage::CS_RWResource; if(rootdata == &state.graphics) { if(p.ShaderVisibility == D3D12_SHADER_VISIBILITY_ALL) { - cb = eUsage_All_Constants; - ro = eUsage_All_Resource; - rw = eUsage_All_RWResource; + cb = ResourceUsage::All_Constants; + ro = ResourceUsage::All_Resource; + rw = ResourceUsage::All_RWResource; } else { - cb = ResourceUsage(eUsage_VS_Constants + p.ShaderVisibility - - D3D12_SHADER_VISIBILITY_VERTEX); - ro = ResourceUsage(eUsage_VS_Resource + p.ShaderVisibility - D3D12_SHADER_VISIBILITY_VERTEX); - rw = ResourceUsage(eUsage_VS_RWResource + p.ShaderVisibility - - D3D12_SHADER_VISIBILITY_VERTEX); + cb = CBUsage(p.ShaderVisibility - D3D12_SHADER_VISIBILITY_VERTEX); + ro = ResUsage(p.ShaderVisibility - D3D12_SHADER_VISIBILITY_VERTEX); + rw = RWResUsage(p.ShaderVisibility - D3D12_SHADER_VISIBILITY_VERTEX); } } @@ -1170,7 +1171,7 @@ void D3D12CommandData::AddDrawcall(const FetchDrawcall &d, bool hasEvents, bool draw.depthOut = ResourceId(); draw.indexByteWidth = 0; - draw.topology = eTopology_Unknown; + draw.topology = Topology::Unknown; if(m_LastCmdListID != ResourceId()) { @@ -1230,7 +1231,7 @@ void D3D12CommandData::InsertDrawsAndRefreshIDs(ResourceId cmd, // assign new drawcall IDs for(size_t i = 0; i < cmdBufNodes.size(); i++) { - if(cmdBufNodes[i].draw.flags & eDraw_PopMarker) + if(cmdBufNodes[i].draw.flags & DrawFlags::PopMarker) { if(GetDrawcallStack().size() > 1) GetDrawcallStack().pop_back(); @@ -1268,7 +1269,7 @@ void D3D12CommandData::InsertDrawsAndRefreshIDs(ResourceId cmd, GetDrawcallStack().back()->children.push_back(n); // if this is a push marker too, step down the drawcall stack - if(cmdBufNodes[i].draw.flags & eDraw_PushMarker) + if(cmdBufNodes[i].draw.flags & DrawFlags::PushMarker) GetDrawcallStack().push_back(&GetDrawcallStack().back()->children.back()); } } diff --git a/renderdoc/driver/d3d12/d3d12_common.cpp b/renderdoc/driver/d3d12/d3d12_common.cpp index ebf118e2c..8996f89fd 100644 --- a/renderdoc/driver/d3d12/d3d12_common.cpp +++ b/renderdoc/driver/d3d12/d3d12_common.cpp @@ -62,12 +62,12 @@ static ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, switch(type.descriptor.type) { - case DXBC::VARTYPE_INT: ret.descriptor.type = eVar_Int; break; + case DXBC::VARTYPE_INT: ret.descriptor.type = VarType::Int; break; case DXBC::VARTYPE_BOOL: - case DXBC::VARTYPE_UINT: ret.descriptor.type = eVar_UInt; break; - case DXBC::VARTYPE_DOUBLE: ret.descriptor.type = eVar_Double; break; + case DXBC::VARTYPE_UINT: ret.descriptor.type = VarType::UInt; break; + case DXBC::VARTYPE_DOUBLE: ret.descriptor.type = VarType::Double; break; case DXBC::VARTYPE_FLOAT: - default: ret.descriptor.type = eVar_Float; break; + default: ret.descriptor.type = VarType::Float; break; } ret.descriptor.rows = type.descriptor.rows; ret.descriptor.cols = type.descriptor.cols; @@ -75,7 +75,7 @@ static ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, ret.descriptor.name = type.descriptor.name; ret.descriptor.rowMajorStorage = (type.descriptor.varClass == DXBC::CLASS_MATRIX_ROWS); - uint32_t baseElemSize = (ret.descriptor.type == eVar_Double) ? 8 : 4; + uint32_t baseElemSize = (ret.descriptor.type == VarType::Double) ? 8 : 4; if(ret.descriptor.rowMajorStorage) { uint32_t primary = ret.descriptor.rows; @@ -271,21 +271,25 @@ void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl, switch(r.dimension) { default: - case DXBC::ShaderInputBind::DIM_UNKNOWN: res.resType = eResType_None; break; + case DXBC::ShaderInputBind::DIM_UNKNOWN: res.resType = TextureDim::Unknown; break; case DXBC::ShaderInputBind::DIM_BUFFER: - case DXBC::ShaderInputBind::DIM_BUFFEREX: res.resType = eResType_Buffer; break; - case DXBC::ShaderInputBind::DIM_TEXTURE1D: res.resType = eResType_Texture1D; break; - case DXBC::ShaderInputBind::DIM_TEXTURE1DARRAY: res.resType = eResType_Texture1DArray; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2D: res.resType = eResType_Texture2D; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2DARRAY: res.resType = eResType_Texture2DArray; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2DMS: res.resType = eResType_Texture2DMS; break; - case DXBC::ShaderInputBind::DIM_TEXTURE2DMSARRAY: - res.resType = eResType_Texture2DMSArray; + case DXBC::ShaderInputBind::DIM_BUFFEREX: res.resType = TextureDim::Buffer; break; + case DXBC::ShaderInputBind::DIM_TEXTURE1D: res.resType = TextureDim::Texture1D; break; + case DXBC::ShaderInputBind::DIM_TEXTURE1DARRAY: + res.resType = TextureDim::Texture1DArray; break; - case DXBC::ShaderInputBind::DIM_TEXTURE3D: res.resType = eResType_Texture3D; break; - case DXBC::ShaderInputBind::DIM_TEXTURECUBE: res.resType = eResType_TextureCube; break; + case DXBC::ShaderInputBind::DIM_TEXTURE2D: res.resType = TextureDim::Texture2D; break; + case DXBC::ShaderInputBind::DIM_TEXTURE2DARRAY: + res.resType = TextureDim::Texture2DArray; + break; + case DXBC::ShaderInputBind::DIM_TEXTURE2DMS: res.resType = TextureDim::Texture2DMS; break; + case DXBC::ShaderInputBind::DIM_TEXTURE2DMSARRAY: + res.resType = TextureDim::Texture2DMSArray; + break; + case DXBC::ShaderInputBind::DIM_TEXTURE3D: res.resType = TextureDim::Texture3D; break; + case DXBC::ShaderInputBind::DIM_TEXTURECUBE: res.resType = TextureDim::TextureCube; break; case DXBC::ShaderInputBind::DIM_TEXTURECUBEARRAY: - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; break; } @@ -460,19 +464,19 @@ UINT GetNumSubresources(ID3D12Device *dev, const D3D12_RESOURCE_DESC *desc) return 1; } -ShaderStageBits ConvertVisibility(D3D12_SHADER_VISIBILITY ShaderVisibility) +ShaderStageMask ConvertVisibility(D3D12_SHADER_VISIBILITY ShaderVisibility) { switch(ShaderVisibility) { - case D3D12_SHADER_VISIBILITY_ALL: return eStageBits_All; - case D3D12_SHADER_VISIBILITY_VERTEX: return eStageBits_Vertex; - case D3D12_SHADER_VISIBILITY_HULL: return eStageBits_Hull; - case D3D12_SHADER_VISIBILITY_DOMAIN: return eStageBits_Domain; - case D3D12_SHADER_VISIBILITY_GEOMETRY: return eStageBits_Geometry; - case D3D12_SHADER_VISIBILITY_PIXEL: return eStageBits_Pixel; + case D3D12_SHADER_VISIBILITY_ALL: return ShaderStageMask::All; + case D3D12_SHADER_VISIBILITY_VERTEX: return ShaderStageMask::Vertex; + case D3D12_SHADER_VISIBILITY_HULL: return ShaderStageMask::Hull; + case D3D12_SHADER_VISIBILITY_DOMAIN: return ShaderStageMask::Domain; + case D3D12_SHADER_VISIBILITY_GEOMETRY: return ShaderStageMask::Geometry; + case D3D12_SHADER_VISIBILITY_PIXEL: return ShaderStageMask::Pixel; } - return eStageBits_Vertex; + return ShaderStageMask::Vertex; } string ToStrHelper::Get(const D3D12ComponentMapping &el) diff --git a/renderdoc/driver/d3d12/d3d12_common.h b/renderdoc/driver/d3d12/d3d12_common.h index d4930118b..36ab3cefb 100644 --- a/renderdoc/driver/d3d12/d3d12_common.h +++ b/renderdoc/driver/d3d12/d3d12_common.h @@ -67,7 +67,7 @@ void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl, // buffer replay is happening #define VERBOSE_PARTIAL_REPLAY OPTION_ON -ShaderStageBits ConvertVisibility(D3D12_SHADER_VISIBILITY ShaderVisibility); +ShaderStageMask ConvertVisibility(D3D12_SHADER_VISIBILITY ShaderVisibility); UINT GetNumSubresources(ID3D12Device *dev, const D3D12_RESOURCE_DESC *desc); class WrappedID3D12Device; diff --git a/renderdoc/driver/d3d12/d3d12_counters.cpp b/renderdoc/driver/d3d12/d3d12_counters.cpp index 03efd14c0..76c29620d 100644 --- a/renderdoc/driver/d3d12/d3d12_counters.cpp +++ b/renderdoc/driver/d3d12/d3d12_counters.cpp @@ -42,133 +42,133 @@ void D3D12Replay::PostDeviceShutdownCounters() { } -vector D3D12Replay::EnumerateCounters() +vector D3D12Replay::EnumerateCounters() { - vector ret; + vector ret; - ret.push_back(eCounter_EventGPUDuration); - ret.push_back(eCounter_InputVerticesRead); - ret.push_back(eCounter_IAPrimitives); - ret.push_back(eCounter_GSPrimitives); - ret.push_back(eCounter_RasterizerInvocations); - ret.push_back(eCounter_RasterizedPrimitives); - ret.push_back(eCounter_SamplesWritten); - ret.push_back(eCounter_VSInvocations); - ret.push_back(eCounter_HSInvocations); - ret.push_back(eCounter_DSInvocations); - ret.push_back(eCounter_GSInvocations); - ret.push_back(eCounter_PSInvocations); - ret.push_back(eCounter_CSInvocations); + ret.push_back(GPUCounter::EventGPUDuration); + ret.push_back(GPUCounter::InputVerticesRead); + ret.push_back(GPUCounter::IAPrimitives); + ret.push_back(GPUCounter::GSPrimitives); + ret.push_back(GPUCounter::RasterizerInvocations); + ret.push_back(GPUCounter::RasterizedPrimitives); + ret.push_back(GPUCounter::SamplesWritten); + ret.push_back(GPUCounter::VSInvocations); + ret.push_back(GPUCounter::HSInvocations); + ret.push_back(GPUCounter::DSInvocations); + ret.push_back(GPUCounter::GSInvocations); + ret.push_back(GPUCounter::PSInvocations); + ret.push_back(GPUCounter::CSInvocations); return ret; } -void D3D12Replay::DescribeCounter(uint32_t counterID, CounterDescription &desc) +void D3D12Replay::DescribeCounter(GPUCounter counterID, CounterDescription &desc) { desc.counterID = counterID; switch(counterID) { - case eCounter_EventGPUDuration: + case GPUCounter::EventGPUDuration: desc.name = "GPU Duration"; desc.description = "Time taken for this event on the GPU, as measured by delta between two GPU timestamps."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_Double; - desc.units = eUnits_Seconds; + desc.resultType = CompType::Double; + desc.unit = CounterUnit::Seconds; break; - case eCounter_InputVerticesRead: + case GPUCounter::InputVerticesRead: desc.name = "Input Vertices Read"; desc.description = "Number of vertices read by input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_IAPrimitives: + case GPUCounter::IAPrimitives: desc.name = "Input Primitives"; desc.description = "Number of primitives read by the input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSPrimitives: + case GPUCounter::GSPrimitives: desc.name = "GS Primitives"; desc.description = "Number of primitives output by a geometry shader."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizerInvocations: + case GPUCounter::RasterizerInvocations: desc.name = "Rasterizer Invocations"; desc.description = "Number of primitives that were sent to the rasterizer."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizedPrimitives: + case GPUCounter::RasterizedPrimitives: desc.name = "Rasterized Primitives"; desc.description = "Number of primitives that were rendered."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_SamplesWritten: + case GPUCounter::SamplesWritten: desc.name = "Samples Written"; desc.description = "Number of samples that passed depth/stencil test."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_VSInvocations: + case GPUCounter::VSInvocations: desc.name = "VS Invocations"; desc.description = "Number of times a vertex shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSInvocations: + case GPUCounter::GSInvocations: desc.name = "GS Invocations"; desc.description = "Number of times a geometry shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_HSInvocations: + case GPUCounter::HSInvocations: desc.name = "HS Invocations"; desc.description = "Number of times a hull shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_DSInvocations: + case GPUCounter::DSInvocations: desc.name = "DS Invocations"; desc.description = "Number of times a domain shader (or tesselation evaluation shader in OpenGL) was " "invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_PSInvocations: + case GPUCounter::PSInvocations: desc.name = "PS Invocations"; desc.description = "Number of times a pixel shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_CSInvocations: + case GPUCounter::CSInvocations: desc.name = "CS Invocations"; desc.description = "Number of times a compute shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; default: desc.name = "Unknown"; desc.description = "Unknown counter ID"; desc.resultByteWidth = 0; - desc.resultCompType = eCompType_None; - desc.units = eUnits_Absolute; + desc.resultType = CompType::Typeless; + desc.unit = CounterUnit::Absolute; break; } } @@ -243,7 +243,7 @@ struct D3D12GPUTimerCallback : public D3D12DrawcallCallback vector > m_AliasEvents; }; -vector D3D12Replay::FetchCounters(const vector &counters) +vector D3D12Replay::FetchCounters(const vector &counters) { uint32_t maxEID = m_pDevice->GetQueue()->GetMaxEID(); @@ -412,24 +412,24 @@ vector D3D12Replay::FetchCounters(const vector &counter switch(counters[c]) { - case eCounter_EventGPUDuration: + case GPUCounter::EventGPUDuration: { uint64_t delta = timestamps[i * 2 + 1] - timestamps[i * 2 + 0]; result.value.d = double(delta) / double(freq); } break; - case eCounter_InputVerticesRead: result.value.u64 = pipeStats.IAVertices; break; - case eCounter_IAPrimitives: result.value.u64 = pipeStats.IAPrimitives; break; - case eCounter_GSPrimitives: result.value.u64 = pipeStats.GSPrimitives; break; - case eCounter_RasterizerInvocations: result.value.u64 = pipeStats.CInvocations; break; - case eCounter_RasterizedPrimitives: result.value.u64 = pipeStats.CPrimitives; break; - case eCounter_SamplesWritten: result.value.u64 = occl; break; - case eCounter_VSInvocations: result.value.u64 = pipeStats.VSInvocations; break; - case eCounter_HSInvocations: result.value.u64 = pipeStats.HSInvocations; break; - case eCounter_DSInvocations: result.value.u64 = pipeStats.DSInvocations; break; - case eCounter_GSInvocations: result.value.u64 = pipeStats.GSInvocations; break; - case eCounter_PSInvocations: result.value.u64 = pipeStats.PSInvocations; break; - case eCounter_CSInvocations: result.value.u64 = pipeStats.CSInvocations; break; + case GPUCounter::InputVerticesRead: result.value.u64 = pipeStats.IAVertices; break; + case GPUCounter::IAPrimitives: result.value.u64 = pipeStats.IAPrimitives; break; + case GPUCounter::GSPrimitives: result.value.u64 = pipeStats.GSPrimitives; break; + case GPUCounter::RasterizerInvocations: result.value.u64 = pipeStats.CInvocations; break; + case GPUCounter::RasterizedPrimitives: result.value.u64 = pipeStats.CPrimitives; break; + case GPUCounter::SamplesWritten: result.value.u64 = occl; break; + case GPUCounter::VSInvocations: result.value.u64 = pipeStats.VSInvocations; break; + case GPUCounter::HSInvocations: result.value.u64 = pipeStats.HSInvocations; break; + case GPUCounter::DSInvocations: result.value.u64 = pipeStats.DSInvocations; break; + case GPUCounter::GSInvocations: result.value.u64 = pipeStats.GSInvocations; break; + case GPUCounter::PSInvocations: result.value.u64 = pipeStats.PSInvocations; break; + case GPUCounter::CSInvocations: result.value.u64 = pipeStats.CSInvocations; break; } ret.push_back(result); } diff --git a/renderdoc/driver/d3d12/d3d12_debug.cpp b/renderdoc/driver/d3d12/d3d12_debug.cpp index 693020c2e..7fff6e6a6 100644 --- a/renderdoc/driver/d3d12/d3d12_debug.cpp +++ b/renderdoc/driver/d3d12/d3d12_debug.cpp @@ -1916,7 +1916,7 @@ void D3D12DebugManager::OutputWindow::MakeDSV() uint64_t D3D12DebugManager::MakeOutputWindow(WindowingSystem system, void *data, bool depth) { - RDCASSERT(system == eWindowingSystem_Win32, system); + RDCASSERT(system == WindowingSystem::Win32, system); OutputWindow outw; outw.wnd = (HWND)data; @@ -2288,8 +2288,7 @@ void D3D12DebugManager::FreeRTV(D3D12_CPU_DESCRIPTOR_HANDLE handle) } void D3D12DebugManager::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, - uint32_t mip, uint32_t sample, FormatComponentType typeHint, - float pixel[4]) + uint32_t mip, uint32_t sample, CompType typeHint, float pixel[4]) { int oldW = GetWidth(), oldH = GetHeight(); @@ -2427,7 +2426,7 @@ uint32_t D3D12DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg, resFmt.compCount = cfg.position.compCount; resFmt.compType = cfg.position.compType; resFmt.special = false; - if(cfg.position.specialFormat != eSpecial_Unknown) + if(cfg.position.specialFormat != SpecialFormat::Unknown) { resFmt.special = true; resFmt.specialFormat = cfg.position.specialFormat; @@ -2506,22 +2505,22 @@ uint32_t D3D12DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg, bool isTriangleMesh = true; switch(cfg.position.topo) { - case eTopology_TriangleList: + case Topology::TriangleList: { cbuf.MeshMode = MESH_TRIANGLE_LIST; break; } - case eTopology_TriangleStrip: + case Topology::TriangleStrip: { cbuf.MeshMode = MESH_TRIANGLE_STRIP; break; } - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: { cbuf.MeshMode = MESH_TRIANGLE_LIST_ADJ; break; } - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: { cbuf.MeshMode = MESH_TRIANGLE_STRIP_ADJ; break; @@ -2784,7 +2783,7 @@ void D3D12DebugManager::FillCBufferVariables(const string &prefix, size_t &offse ShaderVariable var; var.name = basename; var.rows = var.columns = 0; - var.type = eVar_Float; + var.type = VarType::Float; std::vector varmembers; @@ -2804,7 +2803,7 @@ void D3D12DebugManager::FillCBufferVariables(const string &prefix, size_t &offse ShaderVariable vr; vr.name = basename + buf; vr.rows = vr.columns = 0; - vr.type = eVar_Float; + vr.type = VarType::Float; std::vector mems; @@ -2850,17 +2849,17 @@ void D3D12DebugManager::FillCBufferVariables(const string &prefix, size_t &offse } size_t elemByteSize = 4; - VarType type = eVar_Float; + VarType type = VarType::Float; switch(invars[v].type.descriptor.type) { - case VARTYPE_INT: type = eVar_Int; break; - case VARTYPE_FLOAT: type = eVar_Float; break; + case VARTYPE_INT: type = VarType::Int; break; + case VARTYPE_FLOAT: type = VarType::Float; break; case VARTYPE_BOOL: case VARTYPE_UINT: - case VARTYPE_UINT8: type = eVar_UInt; break; + case VARTYPE_UINT8: type = VarType::UInt; break; case VARTYPE_DOUBLE: elemByteSize = 8; - type = eVar_Double; + type = VarType::Double; break; default: RDCERR("Unexpected type %d for variable '%s' in cbuffer", invars[v].type.descriptor.type, @@ -3109,7 +3108,7 @@ void D3D12DebugManager::FillCBufferVariables(const vector } void D3D12DebugManager::BuildShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { if(id == NULL || errors == NULL) { @@ -3122,12 +3121,12 @@ void D3D12DebugManager::BuildShader(string source, string entry, const uint32_t switch(type) { - case eShaderStage_Vertex: profile = "vs_5_0"; break; - case eShaderStage_Hull: profile = "hs_5_0"; break; - case eShaderStage_Domain: profile = "ds_5_0"; break; - case eShaderStage_Geometry: profile = "gs_5_0"; break; - case eShaderStage_Pixel: profile = "ps_5_0"; break; - case eShaderStage_Compute: profile = "cs_5_0"; break; + case ShaderStage::Vertex: profile = "vs_5_0"; break; + case ShaderStage::Hull: profile = "hs_5_0"; break; + case ShaderStage::Domain: profile = "ds_5_0"; break; + case ShaderStage::Geometry: profile = "gs_5_0"; break; + case ShaderStage::Pixel: profile = "ps_5_0"; break; + case ShaderStage::Compute: profile = "cs_5_0"; break; default: RDCERR("Unexpected type in BuildShader!"); *id = ResourceId(); @@ -3383,7 +3382,7 @@ byte *D3D12DebugManager::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint3 texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true; texDisplay.HDRMul = -1.0f; texDisplay.linearDisplayAsGamma = false; - texDisplay.overlay = eTexOverlay_None; + texDisplay.overlay = DebugOverlay::NoOverlay; texDisplay.FlipY = false; texDisplay.mip = mip; texDisplay.sampleIdx = params.resolve ? ~0U : arrayIdx; @@ -3393,7 +3392,7 @@ byte *D3D12DebugManager::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint3 texDisplay.rangemax = params.whitePoint; texDisplay.scale = 1.0f; texDisplay.texid = tex; - texDisplay.typeHint = eCompType_None; + texDisplay.typeHint = CompType::Typeless; texDisplay.rawoutput = false; texDisplay.offx = 0; texDisplay.offy = 0; @@ -3846,7 +3845,7 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) decl.StartComponent = 0; decl.ComponentCount = sign.compCount & 0xff; - if(sign.systemValue == eAttr_Position) + if(sign.systemValue == ShaderBuiltin::Position) { posidx = (int)sodecls.size(); numPosComponents = decl.ComponentCount = 4; @@ -3910,7 +3909,7 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) ID3D12Resource *idxBuf = NULL; - if((drawcall->flags & eDraw_UseIBuffer) == 0) + if(!(drawcall->flags & DrawFlags::UseIBuffer)) { m_DebugList->Reset(m_DebugAlloc, NULL); @@ -4268,11 +4267,11 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) m_PostVSData[eventID].vsout.nearPlane = nearp; m_PostVSData[eventID].vsout.farPlane = farp; - m_PostVSData[eventID].vsout.useIndices = (drawcall->flags & eDraw_UseIBuffer) > 0; + m_PostVSData[eventID].vsout.useIndices = bool(drawcall->flags & DrawFlags::UseIBuffer); m_PostVSData[eventID].vsout.numVerts = drawcall->numIndices; m_PostVSData[eventID].vsout.instStride = 0; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].vsout.instStride = uint32_t(numBytesWritten / RDCMAX(1U, drawcall->numInstances)); @@ -4333,7 +4332,7 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) decl.StartComponent = 0; decl.ComponentCount = sign.compCount & 0xff; - if(sign.systemValue == eAttr_Position) + if(sign.systemValue == ShaderBuiltin::Position) { posidx = (int)sodecls.size(); numPosComponents = decl.ComponentCount = 4; @@ -4410,7 +4409,7 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) // each instance wrote. for(uint32_t inst = 1; inst <= drawcall->numInstances; inst++) { - if(drawcall->flags & eDraw_UseIBuffer) + if(drawcall->flags & DrawFlags::UseIBuffer) { view.BufferFilledSizeLocation = m_SOBuffer->GetGPUVirtualAddress() + (inst - 1) * sizeof(UINT64); @@ -4435,7 +4434,7 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) m_DebugList->SOSetTargets(0, 1, &view); // because the result is expanded we don't have to remap index buffers or anything - if(drawcall->flags & eDraw_UseIBuffer) + if(drawcall->flags & DrawFlags::UseIBuffer) { m_DebugList->DrawIndexedInstanced(drawcall->numIndices, drawcall->numInstances, drawcall->indexOffset, drawcall->baseVertex, @@ -4636,7 +4635,7 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) m_PostVSData[eventID].gsout.buf = gsoutBuffer; m_PostVSData[eventID].gsout.instStride = 0; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].gsout.instStride = uint32_t(numBytesWritten / RDCMAX(1U, drawcall->numInstances)); m_PostVSData[eventID].gsout.vertStride = stride; @@ -4692,7 +4691,7 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID) m_PostVSData[eventID].gsout.numVerts = (uint32_t)numVerts; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].gsout.numVerts /= RDCMAX(1U, drawcall->numInstances); m_PostVSData[eventID].gsout.instData = instData; @@ -4740,8 +4739,8 @@ MeshFormat D3D12DebugManager::GetPostVSBuffers(uint32_t eventID, uint32_t instID ret.compCount = 4; ret.compByteWidth = 4; - ret.compType = eCompType_Float; - ret.specialFormat = eSpecial_Unknown; + ret.compType = CompType::Float; + ret.specialFormat = SpecialFormat::Unknown; ret.showAlpha = false; ret.bgraOrder = false; @@ -5023,7 +5022,7 @@ FloatVector D3D12DebugManager::InterpretVertex(byte *data, uint32_t vert, const fmt.compCount = cfg.position.compCount; fmt.compType = cfg.position.compType; - if(cfg.position.specialFormat == eSpecial_R10G10B10A2) + if(cfg.position.specialFormat == SpecialFormat::R10G10B10A2) { if(data + 4 >= end) { @@ -5038,7 +5037,7 @@ FloatVector D3D12DebugManager::InterpretVertex(byte *data, uint32_t vert, const ret.w = v.w; return ret; } - else if(cfg.position.specialFormat == eSpecial_R11G11B10) + else if(cfg.position.specialFormat == SpecialFormat::R11G11B10) { if(data + 4 >= end) { @@ -5116,7 +5115,7 @@ D3D12DebugManager::MeshDisplayPipelines D3D12DebugManager::CacheMeshDisplayPipel bit += 6; ResourceFormat fmt; - fmt.special = primary.specialFormat != eSpecial_Unknown; + fmt.special = primary.specialFormat != SpecialFormat::Unknown; fmt.specialFormat = primary.specialFormat; fmt.compByteWidth = primary.compByteWidth; fmt.compCount = primary.compCount; @@ -5124,7 +5123,7 @@ D3D12DebugManager::MeshDisplayPipelines D3D12DebugManager::CacheMeshDisplayPipel DXGI_FORMAT primaryFmt = MakeDXGIFormat(fmt); - fmt.special = secondary.specialFormat != eSpecial_Unknown; + fmt.special = secondary.specialFormat != SpecialFormat::Unknown; fmt.specialFormat = secondary.specialFormat; fmt.compByteWidth = secondary.compByteWidth; fmt.compCount = secondary.compCount; @@ -5152,7 +5151,7 @@ D3D12DebugManager::MeshDisplayPipelines D3D12DebugManager::CacheMeshDisplayPipel MeshDisplayPipelines &cache = m_CachedMeshPipelines[key]; - if(cache.pipes[eShade_None] != NULL) + if(cache.pipes[(uint32_t)SolidShade::NoSolid] != NULL) return cache; // should we try and evict old pipelines from the cache here? @@ -5418,13 +5417,13 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s list->IASetPrimitiveTopology(MakeD3DPrimitiveTopology(cfg.position.topo)); } - SolidShadeMode solidShadeMode = cfg.solidShadeMode; + SolidShade solidShadeMode = cfg.solidShadeMode; // can't support secondary shading without a buffer - no pipeline will have been created - if(solidShadeMode == eShade_Secondary && cfg.second.buf == ResourceId()) - solidShadeMode = eShade_None; + if(solidShadeMode == SolidShade::Secondary && cfg.second.buf == ResourceId()) + solidShadeMode = SolidShade::NoSolid; - if(solidShadeMode == eShade_Secondary) + if(solidShadeMode == SolidShade::Secondary) { ID3D12Resource *vb = m_WrappedDevice->GetResourceManager()->GetCurrentAs(cfg.position.buf); @@ -5438,19 +5437,19 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s } // solid render - if(solidShadeMode != eShade_None && cfg.position.topo < eTopology_PatchList) + if(solidShadeMode != SolidShade::NoSolid && cfg.position.topo < Topology::PatchList) { ID3D12PipelineState *pipe = NULL; switch(solidShadeMode) { default: - case eShade_Solid: pipe = cache.pipes[MeshDisplayPipelines::ePipe_SolidDepth]; break; - case eShade_Lit: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Lit]; break; - case eShade_Secondary: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Secondary]; break; + case SolidShade::Solid: pipe = cache.pipes[MeshDisplayPipelines::ePipe_SolidDepth]; break; + case SolidShade::Lit: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Lit]; break; + case SolidShade::Secondary: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Secondary]; break; } pixelData.OutputDisplayFormat = (int)cfg.solidShadeMode; - if(cfg.solidShadeMode == eShade_Secondary && cfg.second.showAlpha) + if(cfg.solidShadeMode == SolidShade::Secondary && cfg.second.showAlpha) pixelData.OutputDisplayFormat = MESHDISPLAY_SECONDARY_ALPHA; pixelData.WireframeColour = Vec3f(0.8f, 0.8f, 0.0f); @@ -5460,7 +5459,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s list->SetGraphicsRootConstantBufferView(0, vsCB); list->SetGraphicsRootConstantBufferView(1, UploadConstants(&pixelData, sizeof(pixelData))); - if(solidShadeMode == eShade_Lit) + if(solidShadeMode == SolidShade::Lit) { DebugGeometryCBuffer geomData; geomData.InvProj = projMat.Inverse(); @@ -5495,7 +5494,8 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s } // wireframe render - if(solidShadeMode == eShade_None || cfg.wireframeDraw || cfg.position.topo >= eTopology_PatchList) + if(solidShadeMode == SolidShade::NoSolid || cfg.wireframeDraw || + cfg.position.topo >= Topology::PatchList) { Vec4f wireCol = Vec4f(cfg.position.meshColour.x, cfg.position.meshColour.y, cfg.position.meshColour.z, 1.0f); @@ -5532,12 +5532,12 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s MeshFormat helper; helper.idxByteWidth = 2; - helper.topo = eTopology_LineList; + helper.topo = Topology::LineList; - helper.specialFormat = eSpecial_Unknown; + helper.specialFormat = SpecialFormat::Unknown; helper.compByteWidth = 4; helper.compCount = 4; - helper.compType = eCompType_Float; + helper.compType = CompType::Float; helper.stride = sizeof(Vec4f); @@ -5676,7 +5676,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s uint32_t bytesize = cfg.position.idxByteWidth; uint64_t maxIndex = cfg.position.numVerts; - if(cfg.position.idxByteWidth == 0 || stage == eMeshDataStage_GSOut) + if(cfg.position.idxByteWidth == 0 || stage == MeshDataStage::GSOut) { m_HighlightCache.indices.clear(); m_HighlightCache.useidx = false; @@ -5747,7 +5747,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s m_HighlightCache.data); } - PrimitiveTopology meshtopo = cfg.position.topo; + Topology meshtopo = cfg.position.topo; uint32_t idx = cfg.highlightVert; @@ -5778,19 +5778,19 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s // will be N*M long, N adjacent prims of M verts each. M = primSize below vector adjacentPrimVertices; - helper.topo = eTopology_TriangleList; + helper.topo = Topology::TriangleList; uint32_t primSize = 3; // number of verts per primitive - if(meshtopo == eTopology_LineList || meshtopo == eTopology_LineStrip || - meshtopo == eTopology_LineList_Adj || meshtopo == eTopology_LineStrip_Adj) + if(meshtopo == Topology::LineList || meshtopo == Topology::LineStrip || + meshtopo == Topology::LineList_Adj || meshtopo == Topology::LineStrip_Adj) { primSize = 2; - helper.topo = eTopology_LineList; + helper.topo = Topology::LineList; } else { // update the cache, as it's currently linelist - helper.topo = eTopology_TriangleList; + helper.topo = Topology::TriangleList; cache = CacheMeshDisplayPipelines(helper, helper); } @@ -5798,14 +5798,14 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s // see http://msdn.microsoft.com/en-us/library/windows/desktop/bb205124(v=vs.85).aspx for // how primitive topologies are laid out - if(meshtopo == eTopology_LineList) + if(meshtopo == Topology::LineList) { uint32_t v = uint32_t(idx / 2) * 2; // find first vert in primitive activePrim.push_back(InterpretVertex(data, v + 0, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_TriangleList) + else if(meshtopo == Topology::TriangleList) { uint32_t v = uint32_t(idx / 3) * 3; // find first vert in primitive @@ -5813,7 +5813,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 2, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_LineList_Adj) + else if(meshtopo == Topology::LineList_Adj) { uint32_t v = uint32_t(idx / 4) * 4; // find first vert in primitive @@ -5833,7 +5833,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s activePrim.push_back(vs[1]); activePrim.push_back(vs[2]); } - else if(meshtopo == eTopology_TriangleList_Adj) + else if(meshtopo == Topology::TriangleList_Adj) { uint32_t v = uint32_t(idx / 6) * 6; // find first vert in primitive @@ -5862,7 +5862,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s activePrim.push_back(vs[2]); activePrim.push_back(vs[4]); } - else if(meshtopo == eTopology_LineStrip) + else if(meshtopo == Topology::LineStrip) { // find first vert in primitive. In strips a vert isn't // in only one primitive, so we pick the first primitive @@ -5873,7 +5873,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s activePrim.push_back(InterpretVertex(data, v + 0, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_TriangleStrip) + else if(meshtopo == Topology::TriangleStrip) { // find first vert in primitive. In strips a vert isn't // in only one primitive, so we pick the first primitive @@ -5885,7 +5885,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 2, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_LineStrip_Adj) + else if(meshtopo == Topology::LineStrip_Adj) { // find first vert in primitive. In strips a vert isn't // in only one primitive, so we pick the first primitive @@ -5909,7 +5909,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s activePrim.push_back(vs[1]); activePrim.push_back(vs[2]); } - else if(meshtopo == eTopology_TriangleStrip_Adj) + else if(meshtopo == Topology::TriangleStrip_Adj) { // Triangle strip with adjacency is the most complex topology, as // we need to handle the ends separately where the pattern breaks. @@ -6039,9 +6039,9 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s activePrim.push_back(vs[6]); } } - else if(meshtopo >= eTopology_PatchList) + else if(meshtopo >= Topology::PatchList) { - uint32_t dim = (cfg.position.topo - eTopology_PatchList_1CPs + 1); + uint32_t dim = PatchList_Count(cfg.position.topo); uint32_t v0 = uint32_t(idx / dim) * dim; @@ -6051,7 +6051,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s inactiveVertices.push_back(InterpretVertex(data, v, cfg, dataEnd, true, valid)); } } - else // if(meshtopo == eTopology_PointList) point list, or unknown/unhandled type + else // if(meshtopo == Topology::PointList) point list, or unknown/unhandled type { // no adjacency, inactive verts or active primitive } @@ -6123,7 +6123,7 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s list->SetGraphicsRoot32BitConstants(3, 4, &colour.x, 0); // vertices are drawn with tri strips - helper.topo = eTopology_TriangleStrip; + helper.topo = Topology::TriangleStrip; cache = CacheMeshDisplayPipelines(helper, helper); FloatVector vertSprite[4] = { @@ -6184,9 +6184,8 @@ void D3D12DebugManager::RenderMesh(uint32_t eventID, const vector &s #endif } -void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, - FormatComponentType typeHint, int &resType, - vector &barriers) +void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompType typeHint, + int &resType, vector &barriers) { int srvOffset = 0; @@ -6448,8 +6447,8 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, } } -bool D3D12DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) +bool D3D12DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, + uint32_t sample, CompType typeHint, float *minval, float *maxval) { ID3D12Resource *resource = WrappedID3D12Resource::GetList()[texid]; @@ -6617,8 +6616,8 @@ bool D3D12DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t } bool D3D12DebugManager::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float minval, - float maxval, bool channels[4], vector &histogram) + uint32_t sample, CompType typeHint, float minval, float maxval, + bool channels[4], vector &histogram) { if(minval >= maxval) return false; @@ -6993,7 +6992,7 @@ struct D3D12QuadOverdrawCallback : public D3D12DrawcallCallback ResourceId D3D12DebugManager::ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, uint32_t sampleIdx, - FormatComponentType typeHint) + CompType typeHint) { ID3D12Resource *resource = WrappedID3D12Resource::GetList()[texid]; @@ -7070,7 +7069,7 @@ ResourceId D3D12DebugManager::ApplyCustomShader(ResourceId shader, ResourceId te disp.linearDisplayAsGamma = false; disp.mip = mip; disp.sampleIdx = sampleIdx; - disp.overlay = eTexOverlay_None; + disp.overlay = DebugOverlay::NoOverlay; disp.rangemin = 0.0f; disp.rangemax = 1.0f; disp.rawoutput = false; @@ -7085,9 +7084,8 @@ ResourceId D3D12DebugManager::ApplyCustomShader(ResourceId shader, ResourceId te return m_CustomShaderResourceId; } -ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) +ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { ID3D12Resource *resource = WrappedID3D12Resource::GetList()[texid]; @@ -7276,11 +7274,11 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp if(rs.pipe != ResourceId()) pipe = m_WrappedDevice->GetResourceManager()->GetCurrentAs(rs.pipe); - if(overlay == eTexOverlay_NaN || overlay == eTexOverlay_Clipping) + if(overlay == DebugOverlay::NaN || overlay == DebugOverlay::Clipping) { // just need the basic texture } - else if(overlay == eTexOverlay_Drawcall) + else if(overlay == DebugOverlay::Drawcall) { if(pipe && pipe->IsGraphics()) { @@ -7353,7 +7351,7 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(ps); } } - else if(overlay == eTexOverlay_BackfaceCull) + else if(overlay == DebugOverlay::BackfaceCull) { if(pipe && pipe->IsGraphics()) { @@ -7451,7 +7449,7 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(greenPSO); } } - else if(overlay == eTexOverlay_Wireframe) + else if(overlay == DebugOverlay::Wireframe) { if(pipe && pipe->IsGraphics()) { @@ -7524,11 +7522,11 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(ps); } } - else if(overlay == eTexOverlay_ClearBeforePass || overlay == eTexOverlay_ClearBeforeDraw) + else if(overlay == DebugOverlay::ClearBeforePass || overlay == DebugOverlay::ClearBeforeDraw) { vector events = passEvents; - if(overlay == eTexOverlay_ClearBeforeDraw) + if(overlay == DebugOverlay::ClearBeforeDraw) events.clear(); events.push_back(eventID); @@ -7541,7 +7539,7 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp bool rtSingle = rs.rtSingle; vector rts = rs.rts; - if(overlay == eTexOverlay_ClearBeforePass) + if(overlay == DebugOverlay::ClearBeforePass) m_WrappedDevice->ReplayLog(0, events[0], eReplay_WithoutDraw); list = m_WrappedDevice->GetNewList(); @@ -7572,12 +7570,12 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp { m_WrappedDevice->ReplayLog(events[i], events[i], eReplay_OnlyDraw); - if(overlay == eTexOverlay_ClearBeforePass && i + 1 < events.size()) + if(overlay == DebugOverlay::ClearBeforePass && i + 1 < events.size()) m_WrappedDevice->ReplayLog(events[i] + 1, events[i + 1], eReplay_WithoutDraw); } } } - else if(overlay == eTexOverlay_ViewportScissor) + else if(overlay == DebugOverlay::ViewportScissor) { if(pipe && pipe->IsGraphics() && !rs.views.empty()) { @@ -7638,7 +7636,7 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp list->DrawInstanced(3, 1, 0, 0); } } - else if(overlay == eTexOverlay_TriangleSizeDraw || overlay == eTexOverlay_TriangleSizePass) + else if(overlay == DebugOverlay::TriangleSizeDraw || overlay == DebugOverlay::TriangleSizePass) { if(pipe && pipe->IsGraphics()) { @@ -7646,7 +7644,7 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp vector events = passEvents; - if(overlay == eTexOverlay_TriangleSizeDraw) + if(overlay == DebugOverlay::TriangleSizeDraw) events.clear(); while(!events.empty()) @@ -7654,7 +7652,7 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp const FetchDrawcall *draw = m_WrappedDevice->GetDrawcall(events[0]); // remove any non-drawcalls, like the pass boundary. - if((draw->flags & eDraw_Drawcall) == 0) + if(!(draw->flags & DrawFlags::Drawcall)) events.erase(events.begin()); else break; @@ -7747,9 +7745,9 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp for(uint32_t inst = 0; draw && inst < RDCMAX(1U, draw->numInstances); inst++) { - MeshFormat fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_GSOut); + MeshFormat fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::GSOut); if(fmt.buf == ResourceId()) - fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_VSOut); + fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::VSOut); if(fmt.buf != ResourceId()) { @@ -7825,20 +7823,20 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp // restore back to normal m_WrappedDevice->ReplayLog(0, eventID, eReplay_WithoutDraw); } - else if(overlay == eTexOverlay_QuadOverdrawPass || overlay == eTexOverlay_QuadOverdrawDraw) + else if(overlay == DebugOverlay::QuadOverdrawPass || overlay == DebugOverlay::QuadOverdrawDraw) { SCOPED_TIMER("Quad Overdraw"); vector events = passEvents; - if(overlay == eTexOverlay_QuadOverdrawDraw) + if(overlay == DebugOverlay::QuadOverdrawDraw) events.clear(); events.push_back(eventID); if(!events.empty()) { - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) { list->Close(); m_WrappedDevice->ReplayLog(0, events[0], eReplay_WithoutDraw); @@ -7954,10 +7952,10 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp SAFE_RELEASE(overdrawTex); } - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) m_WrappedDevice->ReplayLog(0, eventID, eReplay_WithoutDraw); } - else if(overlay == eTexOverlay_Depth || overlay == eTexOverlay_Stencil) + else if(overlay == DebugOverlay::Depth || overlay == DebugOverlay::Stencil) { if(pipe && pipe->IsGraphics()) { @@ -7979,7 +7977,7 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, FormatComponentTyp psoDesc.DepthStencilState.BackFace.StencilFunc = D3D12_COMPARISON_FUNC_ALWAYS; } - if(overlay == eTexOverlay_Depth) + if(overlay == DebugOverlay::Depth) { psoDesc.DepthStencilState.StencilEnable = FALSE; psoDesc.DepthStencilState.FrontFace.StencilFunc = D3D12_COMPARISON_FUNC_ALWAYS; @@ -8208,10 +8206,10 @@ bool D3D12DebugManager::RenderTextureInternal(D3D12_CPU_DESCRIPTOR_HANDLE rtv, T pixelData.OutputDisplayFormat = resType; - if(cfg.overlay == eTexOverlay_NaN) + if(cfg.overlay == DebugOverlay::NaN) pixelData.OutputDisplayFormat |= TEXDISPLAY_NANS; - if(cfg.overlay == eTexOverlay_Clipping) + if(cfg.overlay == DebugOverlay::Clipping) pixelData.OutputDisplayFormat |= TEXDISPLAY_CLIPPING; if(IsUIntFormat(resourceDesc.Format)) diff --git a/renderdoc/driver/d3d12/d3d12_debug.h b/renderdoc/driver/d3d12/d3d12_debug.h index ce7de42ab..ae80b40f9 100644 --- a/renderdoc/driver/d3d12/d3d12_debug.h +++ b/renderdoc/driver/d3d12/d3d12_debug.h @@ -77,20 +77,19 @@ public: void RenderMesh(uint32_t eventID, const vector &secondaryDraws, const MeshDisplay &cfg); bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval); + CompType typeHint, float *minval, float *maxval); bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram); - ResourceId RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents); + ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents); ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]); + uint32_t sample, CompType typeHint, float pixel[4]); uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y); void FillCBufferVariables(const vector &invars, @@ -109,7 +108,7 @@ public: byte *GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, const GetTextureDataParams ¶ms, size_t &dataSize); - void BuildShader(string source, string entry, const uint32_t compileFlags, ShaderStageType type, + void BuildShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, ResourceId *id, string *errors); D3D12_CPU_DESCRIPTOR_HANDLE AllocRTV(); @@ -313,7 +312,7 @@ private: void RenderTextInternal(ID3D12GraphicsCommandList *list, float x, float y, const char *text); bool RenderTextureInternal(D3D12_CPU_DESCRIPTOR_HANDLE rtv, TextureDisplay cfg, bool blendAlpha); - void PrepareTextureSampling(ID3D12Resource *resource, FormatComponentType typeHint, int &resType, + void PrepareTextureSampling(ID3D12Resource *resource, CompType typeHint, int &resType, vector &barriers); string GetShaderBlob(const char *source, const char *entry, const uint32_t compileFlags, @@ -370,9 +369,9 @@ private: const StageData &GetStage(MeshDataStage type) { - if(type == eMeshDataStage_VSOut) + if(type == MeshDataStage::VSOut) return vsout; - else if(type == eMeshDataStage_GSOut) + else if(type == MeshDataStage::GSOut) return gsout; else RDCERR("Unexpected mesh data stage!"); @@ -411,7 +410,7 @@ private: // mesh, not jumping back and forth much between meshes. struct HighlightCache { - HighlightCache() : EID(0), buf(), offs(0), stage(eMeshDataStage_Unknown), useidx(false) {} + HighlightCache() : EID(0), buf(), offs(0), stage(MeshDataStage::Unknown), useidx(false) {} uint32_t EID; ResourceId buf; uint64_t offs; diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 7ef811432..b7209c183 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -54,7 +54,7 @@ D3D12InitParams::D3D12InitParams() MinimumFeatureLevel = D3D_FEATURE_LEVEL_11_0; } -ReplayCreateStatus D3D12InitParams::Serialise() +ReplayStatus D3D12InitParams::Serialise() { Serialiser *localSerialiser = GetSerialiser(); @@ -64,12 +64,12 @@ ReplayCreateStatus D3D12InitParams::Serialise() if(ver != D3D12_SERIALISE_VERSION) { RDCERR("Incompatible D3D12 serialise version, expected %d got %d", D3D12_SERIALISE_VERSION, ver); - return eReplayCreate_APIIncompatibleVersion; + return ReplayStatus::APIIncompatibleVersion; } localSerialiser->Serialise("MinimumFeatureLevel", MinimumFeatureLevel); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } const char *WrappedID3D12Device::GetChunkName(uint32_t idx) @@ -1501,7 +1501,7 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd) bool buf1010102 = false; bool bufBGRA = (fmt.bgraOrder != false); - if(fmt.special && fmt.specialFormat == eSpecial_R10G10B10A2) + if(fmt.special && fmt.specialFormat == SpecialFormat::R10G10B10A2) { stride = 4; buf1010102 = true; @@ -1739,8 +1739,8 @@ void WrappedID3D12Device::ReleaseResource(ID3D12DeviceChild *res) } } -void WrappedID3D12Device::AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, - DebugMessageSource src, std::string d) +void WrappedID3D12Device::AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, + std::string d) { D3D12CommandData &cmd = *m_Queue->GetCommandData(); @@ -1797,37 +1797,47 @@ vector WrappedID3D12Device::GetDebugMessages() DebugMessage msg; msg.eventID = 0; - msg.source = eDbgSource_API; - msg.category = eDbgCategory_Miscellaneous; - msg.severity = eDbgSeverity_Medium; + msg.source = MessageSource::API; + msg.category = MessageCategory::Miscellaneous; + msg.severity = MessageSeverity::Medium; switch(message->Category) { case D3D12_MESSAGE_CATEGORY_APPLICATION_DEFINED: - msg.category = eDbgCategory_Application_Defined; + msg.category = MessageCategory::Application_Defined; + break; + case D3D12_MESSAGE_CATEGORY_MISCELLANEOUS: + msg.category = MessageCategory::Miscellaneous; + break; + case D3D12_MESSAGE_CATEGORY_INITIALIZATION: + msg.category = MessageCategory::Initialization; + break; + case D3D12_MESSAGE_CATEGORY_CLEANUP: msg.category = MessageCategory::Cleanup; break; + case D3D12_MESSAGE_CATEGORY_COMPILATION: msg.category = MessageCategory::Compilation; break; + case D3D12_MESSAGE_CATEGORY_STATE_CREATION: + msg.category = MessageCategory::State_Creation; + break; + case D3D12_MESSAGE_CATEGORY_STATE_SETTING: + msg.category = MessageCategory::State_Setting; + break; + case D3D12_MESSAGE_CATEGORY_STATE_GETTING: + msg.category = MessageCategory::State_Getting; break; - case D3D12_MESSAGE_CATEGORY_MISCELLANEOUS: msg.category = eDbgCategory_Miscellaneous; break; - case D3D12_MESSAGE_CATEGORY_INITIALIZATION: msg.category = eDbgCategory_Initialization; break; - case D3D12_MESSAGE_CATEGORY_CLEANUP: msg.category = eDbgCategory_Cleanup; break; - case D3D12_MESSAGE_CATEGORY_COMPILATION: msg.category = eDbgCategory_Compilation; break; - case D3D12_MESSAGE_CATEGORY_STATE_CREATION: msg.category = eDbgCategory_State_Creation; break; - case D3D12_MESSAGE_CATEGORY_STATE_SETTING: msg.category = eDbgCategory_State_Setting; break; - case D3D12_MESSAGE_CATEGORY_STATE_GETTING: msg.category = eDbgCategory_State_Getting; break; case D3D12_MESSAGE_CATEGORY_RESOURCE_MANIPULATION: - msg.category = eDbgCategory_Resource_Manipulation; + msg.category = MessageCategory::Resource_Manipulation; break; - case D3D12_MESSAGE_CATEGORY_EXECUTION: msg.category = eDbgCategory_Execution; break; - case D3D12_MESSAGE_CATEGORY_SHADER: msg.category = eDbgCategory_Shaders; break; + case D3D12_MESSAGE_CATEGORY_EXECUTION: msg.category = MessageCategory::Execution; break; + case D3D12_MESSAGE_CATEGORY_SHADER: msg.category = MessageCategory::Shaders; break; default: RDCWARN("Unexpected message category: %d", message->Category); break; } switch(message->Severity) { - case D3D12_MESSAGE_SEVERITY_CORRUPTION: msg.severity = eDbgSeverity_High; break; - case D3D12_MESSAGE_SEVERITY_ERROR: msg.severity = eDbgSeverity_Medium; break; - case D3D12_MESSAGE_SEVERITY_WARNING: msg.severity = eDbgSeverity_Low; break; - case D3D12_MESSAGE_SEVERITY_INFO: msg.severity = eDbgSeverity_Info; break; - case D3D12_MESSAGE_SEVERITY_MESSAGE: msg.severity = eDbgSeverity_Info; break; + case D3D12_MESSAGE_SEVERITY_CORRUPTION: msg.severity = MessageSeverity::High; break; + case D3D12_MESSAGE_SEVERITY_ERROR: msg.severity = MessageSeverity::Medium; break; + case D3D12_MESSAGE_SEVERITY_WARNING: msg.severity = MessageSeverity::Low; break; + case D3D12_MESSAGE_SEVERITY_INFO: msg.severity = MessageSeverity::Info; break; + case D3D12_MESSAGE_SEVERITY_MESSAGE: msg.severity = MessageSeverity::Info; break; default: RDCWARN("Unexpected message severity: %d", message->Severity); break; } diff --git a/renderdoc/driver/d3d12/d3d12_device.h b/renderdoc/driver/d3d12/d3d12_device.h index 264b665c3..1138e54a4 100644 --- a/renderdoc/driver/d3d12/d3d12_device.h +++ b/renderdoc/driver/d3d12/d3d12_device.h @@ -41,7 +41,7 @@ struct D3D12InitParams : public RDCInitParams { D3D12InitParams(); - ReplayCreateStatus Serialise(); + ReplayStatus Serialise(); D3D_FEATURE_LEVEL MinimumFeatureLevel; @@ -366,8 +366,7 @@ public: FetchFrameRecord &GetFrameRecord() { return m_FrameRecord; } const FetchDrawcall *GetDrawcall(uint32_t eventID); - void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, - std::string d); + void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, std::string d); void AddDebugMessage(const DebugMessage &msg) { m_DebugMessages.push_back(msg); } vector GetDebugMessages(); diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 11aa87c22..2e791acf7 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -66,8 +66,8 @@ APIProperties D3D12Replay::GetAPIProperties() { APIProperties ret; - ret.pipelineType = eGraphicsAPI_D3D12; - ret.localRenderer = eGraphicsAPI_D3D12; + ret.pipelineType = GraphicsAPI::D3D12; + ret.localRenderer = GraphicsAPI::D3D12; ret.degraded = false; return ret; @@ -130,26 +130,29 @@ FetchBuffer D3D12Replay::GetBuffer(ResourceId id) ret.length = desc.Width; - ret.creationFlags = 0; + ret.creationFlags = BufferCategory::NoFlags; const std::vector &usage = m_pDevice->GetQueue()->GetUsage(id); for(size_t i = 0; i < usage.size(); i++) { - if(usage[i].usage == eUsage_VS_RWResource || usage[i].usage == eUsage_HS_RWResource || - usage[i].usage == eUsage_DS_RWResource || usage[i].usage == eUsage_GS_RWResource || - usage[i].usage == eUsage_PS_RWResource || usage[i].usage == eUsage_CS_RWResource) - ret.creationFlags |= eBufferCreate_UAV; - else if(usage[i].usage == eUsage_VertexBuffer) - ret.creationFlags |= eBufferCreate_VB; - else if(usage[i].usage == eUsage_IndexBuffer) - ret.creationFlags |= eBufferCreate_IB; - else if(usage[i].usage == eUsage_Indirect) - ret.creationFlags |= eBufferCreate_Indirect; + if(usage[i].usage == ResourceUsage::VS_RWResource || + usage[i].usage == ResourceUsage::HS_RWResource || + usage[i].usage == ResourceUsage::DS_RWResource || + usage[i].usage == ResourceUsage::GS_RWResource || + usage[i].usage == ResourceUsage::PS_RWResource || + usage[i].usage == ResourceUsage::CS_RWResource) + ret.creationFlags |= BufferCategory::ReadWrite; + else if(usage[i].usage == ResourceUsage::VertexBuffer) + ret.creationFlags |= BufferCategory::Vertex; + else if(usage[i].usage == ResourceUsage::IndexBuffer) + ret.creationFlags |= BufferCategory::Index; + else if(usage[i].usage == ResourceUsage::Indirect) + ret.creationFlags |= BufferCategory::Indirect; } if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) - ret.creationFlags |= eBufferCreate_UAV; + ret.creationFlags |= BufferCategory::ReadWrite; return ret; } @@ -183,31 +186,33 @@ FetchTexture D3D12Replay::GetTexture(ResourceId id) switch(ret.dimension) { - case 1: ret.resType = ret.arraysize > 1 ? eResType_Texture1DArray : eResType_Texture1D; break; + case 1: + ret.resType = ret.arraysize > 1 ? TextureDim::Texture1DArray : TextureDim::Texture1D; + break; case 2: if(ret.msSamp > 1) - ret.resType = ret.arraysize > 1 ? eResType_Texture2DMSArray : eResType_Texture2DMS; + ret.resType = ret.arraysize > 1 ? TextureDim::Texture2DMSArray : TextureDim::Texture2DMS; else - ret.resType = ret.arraysize > 1 ? eResType_Texture2DArray : eResType_Texture2D; + ret.resType = ret.arraysize > 1 ? TextureDim::Texture2DArray : TextureDim::Texture2D; break; - case 3: ret.resType = eResType_Texture3D; break; + case 3: ret.resType = TextureDim::Texture3D; break; } ret.cubemap = m_pDevice->IsCubemap(id); - ret.creationFlags = eTextureCreate_SRV; + ret.creationFlags = TextureCategory::ShaderRead; if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) - ret.creationFlags |= eTextureCreate_RTV; + ret.creationFlags |= TextureCategory::ColorTarget; if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) - ret.creationFlags |= eTextureCreate_DSV; + ret.creationFlags |= TextureCategory::DepthTarget; if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) - ret.creationFlags |= eTextureCreate_UAV; + ret.creationFlags |= TextureCategory::ShaderReadWrite; if(ret.ID == m_pDevice->GetQueue()->GetBackbufferResourceID()) { - ret.format = MakeResourceFormat(GetTypedFormat(desc.Format, eCompType_UNorm)); - ret.creationFlags |= eTextureCreate_SwapBuffer; + ret.format = MakeResourceFormat(GetTypedFormat(desc.Format, CompType::UNorm)); + ret.creationFlags |= TextureCategory::SwapBuffer; } ret.customName = true; @@ -221,9 +226,9 @@ FetchTexture D3D12Replay::GetTexture(ResourceId id) if(ret.msSamp > 1) ms = "MS"; - if(ret.creationFlags & eTextureCreate_RTV) + if(ret.creationFlags & TextureCategory::ColorTarget) suffix = " RTV"; - if(ret.creationFlags & eTextureCreate_DSV) + if(ret.creationFlags & TextureCategory::DepthTarget) suffix = " DSV"; ret.customName = false; @@ -413,7 +418,7 @@ void D3D12Replay::FillResourceView(D3D12PipelineState::ResourceView &view, D3D12 view.FirstElement = desc->nonsamp.srv.Buffer.FirstElement; view.NumElements = desc->nonsamp.srv.Buffer.NumElements; - view.BufferFlags = desc->nonsamp.srv.Buffer.Flags; + view.BufferFlags = D3DBufferViewFlags(desc->nonsamp.srv.Buffer.Flags); if(desc->nonsamp.srv.Buffer.StructureByteStride > 0) view.ElementSize = desc->nonsamp.srv.Buffer.StructureByteStride; } @@ -473,7 +478,7 @@ void D3D12Replay::FillResourceView(D3D12PipelineState::ResourceView &view, D3D12 view.FirstElement = uav.Buffer.FirstElement; view.NumElements = uav.Buffer.NumElements; - view.BufferFlags = uav.Buffer.Flags; + view.BufferFlags = D3DBufferViewFlags(uav.Buffer.Flags); if(uav.Buffer.StructureByteStride > 0) view.ElementSize = uav.Buffer.StructureByteStride; @@ -518,10 +523,9 @@ void D3D12Replay::FillResourceView(D3D12PipelineState::ResourceView &view, D3D12 } } -void D3D12Replay::FillRegisterSpaces( - const D3D12RenderState::RootSignature &rootSig, - rdctype::array &dstSpaces, - D3D12_SHADER_VISIBILITY visibility) +void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &rootSig, + rdctype::array &dstSpaces, + D3D12_SHADER_VISIBILITY visibility) { D3D12ResourceManager *rm = m_pDevice->GetResourceManager(); @@ -946,8 +950,8 @@ void D3D12Replay::MakePipelineState() { WrappedID3D12Shader *sh = (WrappedID3D12Shader *)pipe->compute->CS.pShaderBytecode; - state.m_CS.Shader = sh->GetResourceID(); - state.m_CS.stage = eShaderStage_Compute; + state.m_CS.Object = sh->GetResourceID(); + state.m_CS.stage = ShaderStage::Compute; state.m_CS.BindpointMapping = sh->GetMapping(); state.rootSig = rm->GetOriginalID(rs.compute.rootsig); @@ -957,8 +961,8 @@ void D3D12Replay::MakePipelineState() } else if(pipe) { - D3D12PipelineState::ShaderStage *dstArr[] = {&state.m_VS, &state.m_HS, &state.m_DS, &state.m_GS, - &state.m_PS}; + D3D12PipelineState::Shader *dstArr[] = {&state.m_VS, &state.m_HS, &state.m_DS, &state.m_GS, + &state.m_PS}; D3D12_SHADER_BYTECODE *srcArr[] = {&pipe->graphics->VS, &pipe->graphics->HS, &pipe->graphics->DS, &pipe->graphics->GS, &pipe->graphics->PS}; @@ -969,16 +973,16 @@ void D3D12Replay::MakePipelineState() for(size_t stage = 0; stage < 5; stage++) { - D3D12PipelineState::ShaderStage &dst = *dstArr[stage]; + D3D12PipelineState::Shader &dst = *dstArr[stage]; D3D12_SHADER_BYTECODE &src = *srcArr[stage]; - dst.stage = (ShaderStageType)stage; + dst.stage = (ShaderStage)stage; WrappedID3D12Shader *sh = (WrappedID3D12Shader *)src.pShaderBytecode; if(sh) { - dst.Shader = sh->GetResourceID(); + dst.Object = sh->GetResourceID(); dst.BindpointMapping = sh->GetMapping(); } @@ -1018,15 +1022,15 @@ void D3D12Replay::MakePipelineState() dst.AntialiasedLineEnable = src.AntialiasedLineEnable == TRUE; - dst.CullMode = eCull_None; + dst.cullMode = CullMode::NoCull; if(src.CullMode == D3D12_CULL_MODE_FRONT) - dst.CullMode = eCull_Front; + dst.cullMode = CullMode::Front; if(src.CullMode == D3D12_CULL_MODE_BACK) - dst.CullMode = eCull_Back; + dst.cullMode = CullMode::Back; - dst.FillMode = eFill_Solid; + dst.fillMode = FillMode::Solid; if(src.FillMode == D3D12_FILL_MODE_WIREFRAME) - dst.FillMode = eFill_Wireframe; + dst.fillMode = FillMode::Wireframe; dst.DepthBias = src.DepthBias; dst.DepthBiasClamp = src.DepthBiasClamp; @@ -1187,23 +1191,22 @@ void D3D12Replay::RenderMesh(uint32_t eventID, const vector &seconda } bool D3D12Replay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) + CompType typeHint, float *minval, float *maxval) { return m_pDevice->GetDebugManager()->GetMinMax(texid, sliceFace, mip, sample, typeHint, minval, maxval); } bool D3D12Replay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, - bool channels[4], vector &histogram) + CompType typeHint, float minval, float maxval, bool channels[4], + vector &histogram) { return m_pDevice->GetDebugManager()->GetHistogram(texid, sliceFace, mip, sample, typeHint, minval, maxval, channels, histogram); } -ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) +ResourceId D3D12Replay::RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { return m_pDevice->GetDebugManager()->RenderOverlay(texid, typeHint, overlay, eventID, passEvents); } @@ -1256,12 +1259,12 @@ vector D3D12Replay::GetPassEvents(uint32_t eventID) { // if we've come to the beginning of a list, break out of the loop, we've // found the start. - if(start->flags & eDraw_BeginPass) + if(start->flags & DrawFlags::BeginPass) break; // if we come to the END of a list, since we were iterating backwards that // means we started outside of a list, so return empty set. - if(start->flags & eDraw_EndPass) + if(start->flags & DrawFlags::EndPass) return passEvents; // if we've come to the start of the log we were outside of a list @@ -1295,7 +1298,7 @@ vector D3D12Replay::GetPassEvents(uint32_t eventID) // so we don't actually do anything (init postvs/draw overlay) // but it's useful to have the first part of the pass as part // of the list - if(start->flags & (eDraw_Drawcall | eDraw_PassBoundary)) + if(start->flags & (DrawFlags::Drawcall | DrawFlags::PassBoundary)) passEvents.push_back(start->eventID); start = m_pDevice->GetDrawcall((uint32_t)start->next); @@ -1315,8 +1318,7 @@ void D3D12Replay::GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, } void D3D12Replay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, - uint32_t mip, uint32_t sample, FormatComponentType typeHint, - float pixel[4]) + uint32_t mip, uint32_t sample, CompType typeHint, float pixel[4]) { m_pDevice->GetDebugManager()->PickPixel(texture, x, y, sliceFace, mip, sample, typeHint, pixel); } @@ -1540,7 +1542,7 @@ vector D3D12Replay::GetDebugMessages() } void D3D12Replay::BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { m_pDevice->GetDebugManager()->BuildShader(source, entry, D3DCOMPILE_DEBUG | compileFlags, type, id, errors); @@ -1647,14 +1649,13 @@ byte *D3D12Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mi } void D3D12Replay::BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { m_pDevice->GetDebugManager()->BuildShader(source, entry, compileFlags, type, id, errors); } ResourceId D3D12Replay::ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, - uint32_t arrayIdx, uint32_t sampleIdx, - FormatComponentType typeHint) + uint32_t arrayIdx, uint32_t sampleIdx, CompType typeHint) { return m_pDevice->GetDebugManager()->ApplyCustomShader(shader, texid, mip, arrayIdx, sampleIdx, typeHint); @@ -1665,7 +1666,7 @@ ResourceId D3D12Replay::ApplyCustomShader(ResourceId shader, ResourceId texid, u vector D3D12Replay::PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, uint32_t sampleIdx, - FormatComponentType typeHint) + CompType typeHint) { return vector(); } @@ -1714,7 +1715,7 @@ extern "C" __declspec(dllexport) HRESULT void **ppDevice); ID3DDevice *GetD3D12DeviceIfAlloc(IUnknown *dev); -ReplayCreateStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCDEBUG("Creating a D3D12 replay device"); @@ -1725,20 +1726,20 @@ ReplayCreateStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver * if(lib == NULL) { RDCERR("Failed to load d3d12.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } lib = LoadLibraryA("dxgi.dll"); if(lib == NULL) { RDCERR("Failed to load dxgi.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } if(GetD3DCompiler() == NULL) { RDCERR("Failed to load d3dcompiler_??.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } D3D12InitParams initParams; @@ -1749,7 +1750,7 @@ ReplayCreateStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver * { auto status = RenderDoc::Inst().FillInitParams(logfile, driverFileType, driverName, machineIdent, (RDCInitParams *)&initParams); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) return status; } @@ -1770,7 +1771,7 @@ ReplayCreateStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver * { RDCERR("Couldn't create a d3d12 device :(."); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } WrappedID3D12Device *wrappedDev = (WrappedID3D12Device *)dev; @@ -1781,7 +1782,7 @@ ReplayCreateStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver * if(logfile && wrappedDev->GetMainSerialiser()->HasError()) { SAFE_RELEASE(wrappedDev); - return eReplayCreate_FileIOFailed; + return ReplayStatus::FileIOFailed; } RDCLOG("Created device."); @@ -1790,7 +1791,7 @@ ReplayCreateStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver * replay->SetProxy(logfile == NULL); *driver = (IReplayDriver *)replay; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } static DriverRegistration D3D12DriverRegistration(RDC_D3D12, "D3D12", &D3D12_CreateReplayDevice); diff --git a/renderdoc/driver/d3d12/d3d12_replay.h b/renderdoc/driver/d3d12/d3d12_replay.h index 708fbb82b..8d54832e8 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.h +++ b/renderdoc/driver/d3d12/d3d12_replay.h @@ -76,7 +76,7 @@ public: vector GetSupportedWindowSystems() { vector ret; - ret.push_back(eWindowingSystem_Win32); + ret.push_back(WindowingSystem::Win32); return ret; } @@ -96,9 +96,9 @@ public: ResourceId GetLiveID(ResourceId id); bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval); + CompType typeHint, float *minval, float *maxval); bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram); MeshFormat GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDataStage stage); @@ -107,14 +107,14 @@ public: byte *GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, const GetTextureDataParams ¶ms, size_t &dataSize); - void BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); + void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); void ReplaceResource(ResourceId from, ResourceId to); void RemoveReplacement(ResourceId id); - vector EnumerateCounters(); - void DescribeCounter(uint32_t counterID, CounterDescription &desc); - vector FetchCounters(const vector &counters); + vector EnumerateCounters(); + void DescribeCounter(GPUCounter counterID, CounterDescription &desc); + vector FetchCounters(const vector &counters); ResourceId CreateProxyTexture(const FetchTexture &templateTex); void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data, @@ -137,24 +137,23 @@ public: vector PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ShaderDebugTrace DebugVertex(uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset); ShaderDebugTrace DebugPixel(uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive); ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]); + uint32_t sample, CompType typeHint, float pixel[4]); uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y); - ResourceId RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents); + ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents); - void BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); + void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); bool IsRenderOutput(ResourceId id); @@ -177,7 +176,7 @@ private: void MakePipelineState(); void FillRegisterSpaces(const D3D12RenderState::RootSignature &rootSig, - rdctype::array &spaces, + rdctype::array &spaces, D3D12_SHADER_VISIBILITY visibility); void FillResourceView(D3D12PipelineState::ResourceView &view, D3D12Descriptor *desc); diff --git a/renderdoc/driver/d3d9/d3d9_replay.cpp b/renderdoc/driver/d3d9/d3d9_replay.cpp index f5b66a99d..8799c00fa 100644 --- a/renderdoc/driver/d3d9/d3d9_replay.cpp +++ b/renderdoc/driver/d3d9/d3d9_replay.cpp @@ -24,10 +24,10 @@ #include "d3d9_common.h" -ReplayCreateStatus D3D9_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus D3D9_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCERR("D3D9 captures are not currently supported"); - return eReplayCreate_APIUnsupported; + return ReplayStatus::APIUnsupported; } static DriverRegistration D3D9DriverRegistration(RDC_D3D9, "D3D9", &D3D9_CreateReplayDevice); diff --git a/renderdoc/driver/dxgi/dxgi_common.cpp b/renderdoc/driver/dxgi/dxgi_common.cpp index 9551556bd..83196df05 100644 --- a/renderdoc/driver/dxgi/dxgi_common.cpp +++ b/renderdoc/driver/dxgi/dxgi_common.cpp @@ -933,7 +933,7 @@ DXGI_FORMAT GetTypedFormat(DXGI_FORMAT f) return f; } -DXGI_FORMAT GetTypedFormat(DXGI_FORMAT f, FormatComponentType typeHint) +DXGI_FORMAT GetTypedFormat(DXGI_FORMAT f, CompType typeHint) { switch(f) { @@ -941,146 +941,146 @@ DXGI_FORMAT GetTypedFormat(DXGI_FORMAT f, FormatComponentType typeHint) case DXGI_FORMAT_R8_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R8_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R8_SINT; - if(typeHint == eCompType_SNorm) + if(typeHint == CompType::SNorm) return DXGI_FORMAT_R8_SNORM; return DXGI_FORMAT_R8_UNORM; } case DXGI_FORMAT_R8G8_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R8G8_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R8G8_SINT; - if(typeHint == eCompType_SNorm) + if(typeHint == CompType::SNorm) return DXGI_FORMAT_R8G8_SNORM; return DXGI_FORMAT_R8G8_UNORM; } case DXGI_FORMAT_R8G8B8A8_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R8G8B8A8_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R8G8B8A8_SINT; - if(typeHint == eCompType_SNorm) + if(typeHint == CompType::SNorm) return DXGI_FORMAT_R8G8B8A8_SNORM; return DXGI_FORMAT_R8G8B8A8_UNORM; } case DXGI_FORMAT_R16_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R16_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R16_SINT; - if(typeHint == eCompType_SNorm) + if(typeHint == CompType::SNorm) return DXGI_FORMAT_R16_SNORM; - if(typeHint == eCompType_Float) + if(typeHint == CompType::Float) return DXGI_FORMAT_R16_FLOAT; - if(typeHint == eCompType_Depth) + if(typeHint == CompType::Depth) return DXGI_FORMAT_D16_UNORM; return DXGI_FORMAT_R16_UNORM; } case DXGI_FORMAT_R16G16_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R16G16_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R16G16_SINT; - if(typeHint == eCompType_SNorm) + if(typeHint == CompType::SNorm) return DXGI_FORMAT_R16G16_SNORM; - if(typeHint == eCompType_Float) + if(typeHint == CompType::Float) return DXGI_FORMAT_R16G16_FLOAT; return DXGI_FORMAT_R16G16_UNORM; } case DXGI_FORMAT_R16G16B16A16_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R16G16B16A16_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R16G16B16A16_SINT; - if(typeHint == eCompType_SNorm) + if(typeHint == CompType::SNorm) return DXGI_FORMAT_R16G16B16A16_SNORM; - if(typeHint == eCompType_Float) + if(typeHint == CompType::Float) return DXGI_FORMAT_R16G16B16A16_FLOAT; return DXGI_FORMAT_R16G16B16A16_UNORM; } case DXGI_FORMAT_R32_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R32_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R32_SINT; - if(typeHint == eCompType_Depth) + if(typeHint == CompType::Depth) return DXGI_FORMAT_D32_FLOAT; return DXGI_FORMAT_R32_FLOAT; } case DXGI_FORMAT_R32G32_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R32G32_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R32G32_SINT; return DXGI_FORMAT_R32G32_FLOAT; } case DXGI_FORMAT_R32G32B32_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R32G32B32_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R32G32B32_SINT; return DXGI_FORMAT_R32G32B32_FLOAT; } case DXGI_FORMAT_R32G32B32A32_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_R32G32B32A32_UINT; - if(typeHint == eCompType_SInt) + if(typeHint == CompType::SInt) return DXGI_FORMAT_R32G32B32A32_SINT; return DXGI_FORMAT_R32G32B32A32_FLOAT; } case DXGI_FORMAT_R32G8X24_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_X32_TYPELESS_G8X24_UINT; - if(typeHint == eCompType_Depth) + if(typeHint == CompType::Depth) return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS; } case DXGI_FORMAT_R24G8_TYPELESS: { - if(typeHint == eCompType_UInt) + if(typeHint == CompType::UInt) return DXGI_FORMAT_X24_TYPELESS_G8_UINT; - if(typeHint == eCompType_Depth) + if(typeHint == CompType::Depth) return DXGI_FORMAT_D24_UNORM_S8_UINT; return DXGI_FORMAT_R24_UNORM_X8_TYPELESS; } case DXGI_FORMAT_R10G10B10A2_TYPELESS: - return typeHint == eCompType_UInt ? DXGI_FORMAT_R10G10B10A2_UINT + return typeHint == CompType::UInt ? DXGI_FORMAT_R10G10B10A2_UINT : DXGI_FORMAT_R10G10B10A2_UNORM; case DXGI_FORMAT_BC4_TYPELESS: - return typeHint == eCompType_SNorm ? DXGI_FORMAT_BC4_SNORM : DXGI_FORMAT_BC4_UNORM; + return typeHint == CompType::SNorm ? DXGI_FORMAT_BC4_SNORM : DXGI_FORMAT_BC4_UNORM; case DXGI_FORMAT_BC5_TYPELESS: - return typeHint == eCompType_SNorm ? DXGI_FORMAT_BC5_SNORM : DXGI_FORMAT_BC5_UNORM; + return typeHint == CompType::SNorm ? DXGI_FORMAT_BC5_SNORM : DXGI_FORMAT_BC5_UNORM; case DXGI_FORMAT_BC6H_TYPELESS: - return typeHint == eCompType_SNorm ? DXGI_FORMAT_BC6H_SF16 : DXGI_FORMAT_BC6H_UF16; + return typeHint == CompType::SNorm ? DXGI_FORMAT_BC6H_SF16 : DXGI_FORMAT_BC6H_UF16; // these formats have only one valid non-typeless format (ignoring SRGB) case DXGI_FORMAT_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_UNORM; @@ -1251,77 +1251,77 @@ DXGI_FORMAT GetTypelessFormat(DXGI_FORMAT f) } } -D3D_PRIMITIVE_TOPOLOGY MakeD3DPrimitiveTopology(PrimitiveTopology Topo) +D3D_PRIMITIVE_TOPOLOGY MakeD3DPrimitiveTopology(Topology Topo) { switch(Topo) { - case eTopology_LineLoop: - case eTopology_TriangleFan: RDCWARN("Unsupported primitive topology on D3D: %x", Topo); break; + case Topology::LineLoop: + case Topology::TriangleFan: RDCWARN("Unsupported primitive topology on D3D: %x", Topo); break; default: - case eTopology_Unknown: return D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; - case eTopology_PointList: return D3D_PRIMITIVE_TOPOLOGY_POINTLIST; - case eTopology_LineList: return D3D_PRIMITIVE_TOPOLOGY_LINELIST; - case eTopology_LineStrip: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; - case eTopology_TriangleList: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - case eTopology_TriangleStrip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; - case eTopology_LineList_Adj: return D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; - case eTopology_LineStrip_Adj: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; - case eTopology_TriangleList_Adj: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; - case eTopology_TriangleStrip_Adj: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; - case eTopology_PatchList_1CPs: - case eTopology_PatchList_2CPs: - case eTopology_PatchList_3CPs: - case eTopology_PatchList_4CPs: - case eTopology_PatchList_5CPs: - case eTopology_PatchList_6CPs: - case eTopology_PatchList_7CPs: - case eTopology_PatchList_8CPs: - case eTopology_PatchList_9CPs: - case eTopology_PatchList_10CPs: - case eTopology_PatchList_11CPs: - case eTopology_PatchList_12CPs: - case eTopology_PatchList_13CPs: - case eTopology_PatchList_14CPs: - case eTopology_PatchList_15CPs: - case eTopology_PatchList_16CPs: - case eTopology_PatchList_17CPs: - case eTopology_PatchList_18CPs: - case eTopology_PatchList_19CPs: - case eTopology_PatchList_20CPs: - case eTopology_PatchList_21CPs: - case eTopology_PatchList_22CPs: - case eTopology_PatchList_23CPs: - case eTopology_PatchList_24CPs: - case eTopology_PatchList_25CPs: - case eTopology_PatchList_26CPs: - case eTopology_PatchList_27CPs: - case eTopology_PatchList_28CPs: - case eTopology_PatchList_29CPs: - case eTopology_PatchList_30CPs: - case eTopology_PatchList_31CPs: - case eTopology_PatchList_32CPs: + case Topology::Unknown: return D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; + case Topology::PointList: return D3D_PRIMITIVE_TOPOLOGY_POINTLIST; + case Topology::LineList: return D3D_PRIMITIVE_TOPOLOGY_LINELIST; + case Topology::LineStrip: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; + case Topology::TriangleList: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + case Topology::TriangleStrip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; + case Topology::LineList_Adj: return D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; + case Topology::LineStrip_Adj: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; + case Topology::TriangleList_Adj: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; + case Topology::TriangleStrip_Adj: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; + case Topology::PatchList_1CPs: + case Topology::PatchList_2CPs: + case Topology::PatchList_3CPs: + case Topology::PatchList_4CPs: + case Topology::PatchList_5CPs: + case Topology::PatchList_6CPs: + case Topology::PatchList_7CPs: + case Topology::PatchList_8CPs: + case Topology::PatchList_9CPs: + case Topology::PatchList_10CPs: + case Topology::PatchList_11CPs: + case Topology::PatchList_12CPs: + case Topology::PatchList_13CPs: + case Topology::PatchList_14CPs: + case Topology::PatchList_15CPs: + case Topology::PatchList_16CPs: + case Topology::PatchList_17CPs: + case Topology::PatchList_18CPs: + case Topology::PatchList_19CPs: + case Topology::PatchList_20CPs: + case Topology::PatchList_21CPs: + case Topology::PatchList_22CPs: + case Topology::PatchList_23CPs: + case Topology::PatchList_24CPs: + case Topology::PatchList_25CPs: + case Topology::PatchList_26CPs: + case Topology::PatchList_27CPs: + case Topology::PatchList_28CPs: + case Topology::PatchList_29CPs: + case Topology::PatchList_30CPs: + case Topology::PatchList_31CPs: + case Topology::PatchList_32CPs: return D3D_PRIMITIVE_TOPOLOGY(D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + - (Topo - eTopology_PatchList_1CPs)); + PatchList_Count(Topo) - 1); } return D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; } -PrimitiveTopology MakePrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY Topo) +Topology MakePrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY Topo) { switch(Topo) { default: case D3D_PRIMITIVE_TOPOLOGY_UNDEFINED: break; - case D3D_PRIMITIVE_TOPOLOGY_POINTLIST: return eTopology_PointList; break; - case D3D_PRIMITIVE_TOPOLOGY_LINELIST: return eTopology_LineList; break; - case D3D_PRIMITIVE_TOPOLOGY_LINESTRIP: return eTopology_LineStrip; break; - case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: return eTopology_TriangleList; break; - case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: return eTopology_TriangleStrip; break; - case D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: return eTopology_LineList_Adj; break; - case D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: return eTopology_LineStrip_Adj; break; - case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: return eTopology_TriangleList_Adj; break; - case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: return eTopology_TriangleStrip_Adj; break; + case D3D_PRIMITIVE_TOPOLOGY_POINTLIST: return Topology::PointList; + case D3D_PRIMITIVE_TOPOLOGY_LINELIST: return Topology::LineList; + case D3D_PRIMITIVE_TOPOLOGY_LINESTRIP: return Topology::LineStrip; + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: return Topology::TriangleList; + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: return Topology::TriangleStrip; + case D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: return Topology::LineList_Adj; + case D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: return Topology::LineStrip_Adj; + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: return Topology::TriangleList_Adj; + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: return Topology::TriangleStrip_Adj; case D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST: case D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST: case D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST: @@ -1354,12 +1354,10 @@ PrimitiveTopology MakePrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY Topo) case D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST: case D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST: case D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST: - return PrimitiveTopology(eTopology_PatchList_1CPs + - (Topo - D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST)); - break; + return PatchList_Topology(Topo - D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + 1); } - return eTopology_Unknown; + return Topology::Unknown; } DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) @@ -1370,48 +1368,48 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) { switch(fmt.specialFormat) { - case eSpecial_BC1: ret = DXGI_FORMAT_BC1_UNORM; break; - case eSpecial_BC2: ret = DXGI_FORMAT_BC2_UNORM; break; - case eSpecial_BC3: ret = DXGI_FORMAT_BC3_UNORM; break; - case eSpecial_BC4: ret = DXGI_FORMAT_BC4_UNORM; break; - case eSpecial_BC5: ret = DXGI_FORMAT_BC5_UNORM; break; - case eSpecial_BC6: ret = DXGI_FORMAT_BC6H_UF16; break; - case eSpecial_BC7: ret = DXGI_FORMAT_BC7_UNORM; break; - case eSpecial_R10G10B10A2: - if(fmt.compType == eCompType_UNorm) + case SpecialFormat::BC1: ret = DXGI_FORMAT_BC1_UNORM; break; + case SpecialFormat::BC2: ret = DXGI_FORMAT_BC2_UNORM; break; + case SpecialFormat::BC3: ret = DXGI_FORMAT_BC3_UNORM; break; + case SpecialFormat::BC4: ret = DXGI_FORMAT_BC4_UNORM; break; + case SpecialFormat::BC5: ret = DXGI_FORMAT_BC5_UNORM; break; + case SpecialFormat::BC6: ret = DXGI_FORMAT_BC6H_UF16; break; + case SpecialFormat::BC7: ret = DXGI_FORMAT_BC7_UNORM; break; + case SpecialFormat::R10G10B10A2: + if(fmt.compType == CompType::UNorm) ret = DXGI_FORMAT_R10G10B10A2_UNORM; else ret = DXGI_FORMAT_R10G10B10A2_UINT; break; - case eSpecial_R11G11B10: ret = DXGI_FORMAT_R11G11B10_FLOAT; break; - case eSpecial_R5G6B5: + case SpecialFormat::R11G11B10: ret = DXGI_FORMAT_R11G11B10_FLOAT; break; + case SpecialFormat::R5G6B5: // only support bgra order if(!fmt.bgraOrder) return DXGI_FORMAT_UNKNOWN; ret = DXGI_FORMAT_B5G6R5_UNORM; break; - case eSpecial_R5G5B5A1: + case SpecialFormat::R5G5B5A1: // only support bgra order if(!fmt.bgraOrder) return DXGI_FORMAT_UNKNOWN; ret = DXGI_FORMAT_B5G5R5A1_UNORM; break; - case eSpecial_R9G9B9E5: ret = DXGI_FORMAT_R9G9B9E5_SHAREDEXP; break; - case eSpecial_R4G4B4A4: + case SpecialFormat::R9G9B9E5: ret = DXGI_FORMAT_R9G9B9E5_SHAREDEXP; break; + case SpecialFormat::R4G4B4A4: // only support bgra order if(!fmt.bgraOrder) return DXGI_FORMAT_UNKNOWN; ret = DXGI_FORMAT_B4G4R4A4_UNORM; break; - case eSpecial_D24S8: ret = DXGI_FORMAT_R24G8_TYPELESS; break; - case eSpecial_D32S8: ret = DXGI_FORMAT_R32G8X24_TYPELESS; break; - case eSpecial_YUV: + case SpecialFormat::D24S8: ret = DXGI_FORMAT_R24G8_TYPELESS; break; + case SpecialFormat::D32S8: ret = DXGI_FORMAT_R32G8X24_TYPELESS; break; + case SpecialFormat::YUV: // just claim all YUV formats as unsupported. In theory we could add more // special format enums to identify all the types, and return support for // the ones that exist in D3D return DXGI_FORMAT_UNKNOWN; - case eSpecial_S8: // D3D has no stencil-only format - case eSpecial_D16S8: // D3D has no D16S8 format + case SpecialFormat::S8: // D3D has no stencil-only format + case SpecialFormat::D16S8: // D3D has no D16S8 format default: return DXGI_FORMAT_UNKNOWN; } } @@ -1463,19 +1461,19 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) return DXGI_FORMAT_UNKNOWN; } - if(fmt.compType == eCompType_None) + if(fmt.compType == CompType::Typeless) ret = GetTypelessFormat(ret); - else if(fmt.compType == eCompType_Float) + else if(fmt.compType == CompType::Float) ret = GetFloatTypedFormat(ret); - else if(fmt.compType == eCompType_Depth) + else if(fmt.compType == CompType::Depth) ret = GetDepthTypedFormat(ret); - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = GetUnormTypedFormat(ret); - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = GetSnormTypedFormat(ret); - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = GetUIntTypedFormat(ret); - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = GetSIntTypedFormat(ret); else return DXGI_FORMAT_UNKNOWN; @@ -1495,7 +1493,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) ret.strname = ToStr::Get(fmt).substr(12); // 12 == strlen("DXGI_FORMAT_") ret.compCount = ret.compByteWidth = 0; - ret.compType = eCompType_Float; + ret.compType = CompType::Float; ret.srgbCorrected = IsSRGBFormat(fmt); @@ -1692,14 +1690,14 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_R16_TYPELESS: case DXGI_FORMAT_R8G8B8A8_TYPELESS: case DXGI_FORMAT_R8G8_TYPELESS: - case DXGI_FORMAT_R8_TYPELESS: ret.compType = eCompType_None; break; + case DXGI_FORMAT_R8_TYPELESS: ret.compType = CompType::Typeless; break; case DXGI_FORMAT_R32G32B32A32_FLOAT: case DXGI_FORMAT_R32G32B32_FLOAT: case DXGI_FORMAT_R16G16B16A16_FLOAT: case DXGI_FORMAT_R32G32_FLOAT: case DXGI_FORMAT_R16G16_FLOAT: case DXGI_FORMAT_R32_FLOAT: - case DXGI_FORMAT_R16_FLOAT: ret.compType = eCompType_Float; break; + case DXGI_FORMAT_R16_FLOAT: ret.compType = CompType::Float; break; case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: case DXGI_FORMAT_R8G8B8A8_UNORM: case DXGI_FORMAT_R16G16B16A16_UNORM: @@ -1707,13 +1705,13 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_R8G8_UNORM: case DXGI_FORMAT_R16_UNORM: case DXGI_FORMAT_R8_UNORM: - case DXGI_FORMAT_A8_UNORM: ret.compType = eCompType_UNorm; break; + case DXGI_FORMAT_A8_UNORM: ret.compType = CompType::UNorm; break; case DXGI_FORMAT_R8G8B8A8_SNORM: case DXGI_FORMAT_R16G16B16A16_SNORM: case DXGI_FORMAT_R16G16_SNORM: case DXGI_FORMAT_R8G8_SNORM: case DXGI_FORMAT_R16_SNORM: - case DXGI_FORMAT_R8_SNORM: ret.compType = eCompType_SNorm; break; + case DXGI_FORMAT_R8_SNORM: ret.compType = CompType::SNorm; break; case DXGI_FORMAT_R32G32B32A32_UINT: case DXGI_FORMAT_R32G32B32_UINT: case DXGI_FORMAT_R16G16B16A16_UINT: @@ -1723,7 +1721,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_R32_UINT: case DXGI_FORMAT_R8G8_UINT: case DXGI_FORMAT_R16_UINT: - case DXGI_FORMAT_R8_UINT: ret.compType = eCompType_UInt; break; + case DXGI_FORMAT_R8_UINT: ret.compType = CompType::UInt; break; case DXGI_FORMAT_R32G32B32A32_SINT: case DXGI_FORMAT_R32G32B32_SINT: case DXGI_FORMAT_R16G16B16A16_SINT: @@ -1733,20 +1731,20 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_R32_SINT: case DXGI_FORMAT_R8G8_SINT: case DXGI_FORMAT_R16_SINT: - case DXGI_FORMAT_R8_SINT: ret.compType = eCompType_SInt; break; + case DXGI_FORMAT_R8_SINT: ret.compType = CompType::SInt; break; case DXGI_FORMAT_R10G10B10A2_UINT: - case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: ret.compType = eCompType_UInt; break; + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: ret.compType = CompType::UInt; break; case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: - case DXGI_FORMAT_R11G11B10_FLOAT: ret.compType = eCompType_Float; break; + case DXGI_FORMAT_R11G11B10_FLOAT: ret.compType = CompType::Float; break; case DXGI_FORMAT_BC4_SNORM: case DXGI_FORMAT_BC5_SNORM: - case DXGI_FORMAT_BC6H_SF16: ret.compType = eCompType_SNorm; break; + case DXGI_FORMAT_BC6H_SF16: ret.compType = CompType::SNorm; break; case DXGI_FORMAT_R24G8_TYPELESS: - case DXGI_FORMAT_R32G8X24_TYPELESS: ret.compType = eCompType_None; break; + case DXGI_FORMAT_R32G8X24_TYPELESS: ret.compType = CompType::Typeless; break; case DXGI_FORMAT_X24_TYPELESS_G8_UINT: case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: @@ -1754,7 +1752,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_D32_FLOAT: case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: case DXGI_FORMAT_D24_UNORM_S8_UINT: - case DXGI_FORMAT_D16_UNORM: ret.compType = eCompType_Depth; break; + case DXGI_FORMAT_D16_UNORM: ret.compType = CompType::Depth; break; case DXGI_FORMAT_R10G10B10A2_TYPELESS: case DXGI_FORMAT_B8G8R8A8_TYPELESS: @@ -1765,7 +1763,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_BC4_TYPELESS: case DXGI_FORMAT_BC5_TYPELESS: case DXGI_FORMAT_BC6H_TYPELESS: - case DXGI_FORMAT_BC7_TYPELESS: ret.compType = eCompType_None; break; + case DXGI_FORMAT_BC7_TYPELESS: ret.compType = CompType::Typeless; break; case DXGI_FORMAT_R8G8_B8G8_UNORM: case DXGI_FORMAT_G8R8_G8B8_UNORM: case DXGI_FORMAT_R10G10B10A2_UNORM: @@ -1786,9 +1784,9 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_BC1_UNORM_SRGB: case DXGI_FORMAT_BC2_UNORM_SRGB: case DXGI_FORMAT_BC3_UNORM_SRGB: - case DXGI_FORMAT_BC7_UNORM_SRGB: ret.compType = eCompType_UNorm; break; + case DXGI_FORMAT_BC7_UNORM_SRGB: ret.compType = CompType::UNorm; break; - case DXGI_FORMAT_UNKNOWN: ret.compType = eCompType_None; break; + case DXGI_FORMAT_UNKNOWN: ret.compType = CompType::Typeless; break; default: ret.special = true; } @@ -1803,54 +1801,56 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: ret.bgraOrder = true; break; } - ret.specialFormat = eSpecial_Unknown; + ret.specialFormat = SpecialFormat::Unknown; switch(fmt) { case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: case DXGI_FORMAT_X24_TYPELESS_G8_UINT: case DXGI_FORMAT_D24_UNORM_S8_UINT: - case DXGI_FORMAT_R24G8_TYPELESS: ret.specialFormat = eSpecial_D24S8; break; + case DXGI_FORMAT_R24G8_TYPELESS: ret.specialFormat = SpecialFormat::D24S8; break; case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: - case DXGI_FORMAT_R32G8X24_TYPELESS: ret.specialFormat = eSpecial_D32S8; break; + case DXGI_FORMAT_R32G8X24_TYPELESS: ret.specialFormat = SpecialFormat::D32S8; break; case DXGI_FORMAT_BC1_TYPELESS: case DXGI_FORMAT_BC1_UNORM_SRGB: - case DXGI_FORMAT_BC1_UNORM: ret.specialFormat = eSpecial_BC1; break; + case DXGI_FORMAT_BC1_UNORM: ret.specialFormat = SpecialFormat::BC1; break; case DXGI_FORMAT_BC2_TYPELESS: case DXGI_FORMAT_BC2_UNORM_SRGB: - case DXGI_FORMAT_BC2_UNORM: ret.specialFormat = eSpecial_BC2; break; + case DXGI_FORMAT_BC2_UNORM: ret.specialFormat = SpecialFormat::BC2; break; case DXGI_FORMAT_BC3_TYPELESS: case DXGI_FORMAT_BC3_UNORM_SRGB: - case DXGI_FORMAT_BC3_UNORM: ret.specialFormat = eSpecial_BC3; break; + case DXGI_FORMAT_BC3_UNORM: ret.specialFormat = SpecialFormat::BC3; break; case DXGI_FORMAT_BC4_TYPELESS: case DXGI_FORMAT_BC4_UNORM: - case DXGI_FORMAT_BC4_SNORM: ret.specialFormat = eSpecial_BC4; break; + case DXGI_FORMAT_BC4_SNORM: ret.specialFormat = SpecialFormat::BC4; break; case DXGI_FORMAT_BC5_TYPELESS: case DXGI_FORMAT_BC5_UNORM: - case DXGI_FORMAT_BC5_SNORM: ret.specialFormat = eSpecial_BC5; break; + case DXGI_FORMAT_BC5_SNORM: ret.specialFormat = SpecialFormat::BC5; break; case DXGI_FORMAT_BC6H_UF16: case DXGI_FORMAT_BC6H_SF16: - case DXGI_FORMAT_BC6H_TYPELESS: ret.specialFormat = eSpecial_BC6; break; + case DXGI_FORMAT_BC6H_TYPELESS: ret.specialFormat = SpecialFormat::BC6; break; case DXGI_FORMAT_BC7_TYPELESS: case DXGI_FORMAT_BC7_UNORM_SRGB: - case DXGI_FORMAT_BC7_UNORM: ret.specialFormat = eSpecial_BC7; break; + case DXGI_FORMAT_BC7_UNORM: ret.specialFormat = SpecialFormat::BC7; break; case DXGI_FORMAT_R10G10B10A2_TYPELESS: case DXGI_FORMAT_R10G10B10A2_UINT: case DXGI_FORMAT_R10G10B10A2_UNORM: - case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: ret.specialFormat = eSpecial_R10G10B10A2; break; - case DXGI_FORMAT_R11G11B10_FLOAT: ret.specialFormat = eSpecial_R11G11B10; break; + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: + ret.specialFormat = SpecialFormat::R10G10B10A2; + break; + case DXGI_FORMAT_R11G11B10_FLOAT: ret.specialFormat = SpecialFormat::R11G11B10; break; case DXGI_FORMAT_B5G6R5_UNORM: - ret.specialFormat = eSpecial_R5G6B5; + ret.specialFormat = SpecialFormat::R5G6B5; ret.bgraOrder = true; break; case DXGI_FORMAT_B5G5R5A1_UNORM: - ret.specialFormat = eSpecial_R5G5B5A1; + ret.specialFormat = SpecialFormat::R5G5B5A1; ret.bgraOrder = true; break; - case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: ret.specialFormat = eSpecial_R9G9B9E5; break; + case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: ret.specialFormat = SpecialFormat::R9G9B9E5; break; case DXGI_FORMAT_AYUV: case DXGI_FORMAT_Y410: @@ -1869,19 +1869,19 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_A8P8: case DXGI_FORMAT_P208: case DXGI_FORMAT_V208: - case DXGI_FORMAT_V408: ret.specialFormat = eSpecial_YUV; break; + case DXGI_FORMAT_V408: ret.specialFormat = SpecialFormat::YUV; break; case DXGI_FORMAT_B4G4R4A4_UNORM: - ret.specialFormat = eSpecial_R4G4B4A4; + ret.specialFormat = SpecialFormat::R4G4B4A4; ret.bgraOrder = true; break; - case DXGI_FORMAT_UNKNOWN: ret.specialFormat = eSpecial_Unknown; break; + case DXGI_FORMAT_UNKNOWN: ret.specialFormat = SpecialFormat::Unknown; break; default: break; } - if(ret.specialFormat != eSpecial_Unknown) + if(ret.specialFormat != SpecialFormat::Unknown) { ret.special = true; } diff --git a/renderdoc/driver/dxgi/dxgi_common.h b/renderdoc/driver/dxgi/dxgi_common.h index a6f60e6d4..a28987672 100644 --- a/renderdoc/driver/dxgi/dxgi_common.h +++ b/renderdoc/driver/dxgi/dxgi_common.h @@ -38,7 +38,7 @@ UINT GetFormatBPP(DXGI_FORMAT f); DXGI_FORMAT GetTypelessFormat(DXGI_FORMAT f); DXGI_FORMAT GetTypedFormat(DXGI_FORMAT f); -DXGI_FORMAT GetTypedFormat(DXGI_FORMAT f, FormatComponentType hint); +DXGI_FORMAT GetTypedFormat(DXGI_FORMAT f, CompType hint); DXGI_FORMAT GetDepthTypedFormat(DXGI_FORMAT f); DXGI_FORMAT GetFloatTypedFormat(DXGI_FORMAT f); DXGI_FORMAT GetUnormTypedFormat(DXGI_FORMAT f); @@ -57,5 +57,5 @@ bool IsIntFormat(DXGI_FORMAT f); bool IsSRGBFormat(DXGI_FORMAT f); // not technically DXGI, but makes more sense to have it here common between D3D versions -PrimitiveTopology MakePrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY Topo); -D3D_PRIMITIVE_TOPOLOGY MakeD3DPrimitiveTopology(PrimitiveTopology Topo); +Topology MakePrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY Topo); +D3D_PRIMITIVE_TOPOLOGY MakeD3DPrimitiveTopology(Topology Topo); diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index f865a180a..cf22c241b 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -1015,7 +1015,7 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt ret.rawType = (uint32_t)fmt; ret.special = false; - ret.specialFormat = eSpecial_Unknown; + ret.specialFormat = SpecialFormat::Unknown; ret.strname = ToStr::Get(fmt).substr(3); // 3 == strlen("GL_") // special handling for formats that don't query neatly @@ -1023,7 +1023,7 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt { ret.compByteWidth = 1; ret.compCount = 1; - ret.compType = eCompType_UNorm; + ret.compType = CompType::UNorm; ret.srgbCorrected = false; return ret; } @@ -1067,7 +1067,7 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt default: break; } - ret.compType = eCompType_UNorm; + ret.compType = CompType::UNorm; switch(fmt) { @@ -1075,7 +1075,7 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt case eGL_COMPRESSED_SIGNED_RG_RGTC2: case eGL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB: case eGL_COMPRESSED_SIGNED_R11_EAC: - case eGL_COMPRESSED_SIGNED_RG11_EAC: ret.compType = eCompType_SNorm; break; + case eGL_COMPRESSED_SIGNED_RG11_EAC: ret.compType = CompType::SNorm; break; default: break; } @@ -1086,44 +1086,44 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt case eGL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case eGL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: - ret.specialFormat = eSpecial_BC1; + ret.specialFormat = SpecialFormat::BC1; break; // BC2 case eGL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: - ret.specialFormat = eSpecial_BC2; + ret.specialFormat = SpecialFormat::BC2; break; // BC3 case eGL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - ret.specialFormat = eSpecial_BC3; + ret.specialFormat = SpecialFormat::BC3; break; // BC4 case eGL_COMPRESSED_RED_RGTC1: case eGL_COMPRESSED_SIGNED_RED_RGTC1: - ret.specialFormat = eSpecial_BC4; + ret.specialFormat = SpecialFormat::BC4; break; // BC5 case eGL_COMPRESSED_RG_RGTC2: case eGL_COMPRESSED_SIGNED_RG_RGTC2: - ret.specialFormat = eSpecial_BC5; + ret.specialFormat = SpecialFormat::BC5; break; // BC6 case eGL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB: case eGL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB: - ret.specialFormat = eSpecial_BC6; + ret.specialFormat = SpecialFormat::BC6; break; // BC7 case eGL_COMPRESSED_RGBA_BPTC_UNORM_ARB: case eGL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB: - ret.specialFormat = eSpecial_BC7; + ret.specialFormat = SpecialFormat::BC7; break; // ETC2 case eGL_COMPRESSED_RGB8_ETC2: case eGL_COMPRESSED_SRGB8_ETC2: case eGL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: case eGL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: - ret.specialFormat = eSpecial_ETC2; + ret.specialFormat = SpecialFormat::ETC2; break; // EAC case eGL_COMPRESSED_RGBA8_ETC2_EAC: @@ -1132,7 +1132,7 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt case eGL_COMPRESSED_SIGNED_R11_EAC: case eGL_COMPRESSED_RG11_EAC: case eGL_COMPRESSED_SIGNED_RG11_EAC: - ret.specialFormat = eSpecial_EAC; + ret.specialFormat = SpecialFormat::EAC; break; // ASTC case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: @@ -1162,7 +1162,9 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: ret.specialFormat = eSpecial_ASTC; break; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: + ret.specialFormat = SpecialFormat::ASTC; + break; default: RDCERR("Unexpected compressed format %#x", fmt); break; } return ret; @@ -1172,49 +1174,49 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt if(fmt == eGL_R11F_G11F_B10F) { ret.special = true; - ret.specialFormat = eSpecial_R11G11B10; + ret.specialFormat = SpecialFormat::R11G11B10; return ret; } if(fmt == eGL_RGB565) { ret.special = true; - ret.specialFormat = eSpecial_R5G6B5; + ret.specialFormat = SpecialFormat::R5G6B5; return ret; } if(fmt == eGL_RGB5_A1) { ret.special = true; - ret.specialFormat = eSpecial_R5G5B5A1; + ret.specialFormat = SpecialFormat::R5G5B5A1; return ret; } if(fmt == eGL_RGB9_E5) { ret.special = true; - ret.specialFormat = eSpecial_R9G9B9E5; + ret.specialFormat = SpecialFormat::R9G9B9E5; return ret; } if(fmt == eGL_RGBA4) { ret.special = true; - ret.specialFormat = eSpecial_R4G4B4A4; + ret.specialFormat = SpecialFormat::R4G4B4A4; return ret; } if(fmt == eGL_RGB10_A2 || fmt == eGL_RGB10_A2UI) { ret.special = true; - ret.specialFormat = eSpecial_R10G10B10A2; - ret.compType = fmt == eGL_RGB10_A2 ? eCompType_UNorm : eCompType_UInt; + ret.specialFormat = SpecialFormat::R10G10B10A2; + ret.compType = fmt == eGL_RGB10_A2 ? CompType::UNorm : CompType::UInt; return ret; } ret.compByteWidth = 1; ret.compCount = 4; - ret.compType = eCompType_Float; + ret.compType = CompType::Float; GLint data[8]; GLenum *edata = (GLenum *)data; @@ -1266,11 +1268,11 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt { switch(edata[0]) { - case eGL_UNSIGNED_INT: ret.compType = eCompType_UInt; break; - case eGL_UNSIGNED_NORMALIZED: ret.compType = eCompType_UNorm; break; - case eGL_SIGNED_NORMALIZED: ret.compType = eCompType_SNorm; break; - case eGL_FLOAT: ret.compType = eCompType_Float; break; - case eGL_INT: ret.compType = eCompType_SInt; break; + case eGL_UNSIGNED_INT: ret.compType = CompType::UInt; break; + case eGL_UNSIGNED_NORMALIZED: ret.compType = CompType::UNorm; break; + case eGL_SIGNED_NORMALIZED: ret.compType = CompType::SNorm; break; + case eGL_FLOAT: ret.compType = CompType::Float; break; + case eGL_INT: ret.compType = CompType::SInt; break; default: RDCERR("Unexpected texture type"); } } @@ -1285,7 +1287,7 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt else if(isdepth == GL_TRUE || isstencil == GL_TRUE) { // depth format - ret.compType = eCompType_Depth; + ret.compType = CompType::Depth; switch(fmt) { @@ -1303,15 +1305,15 @@ ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt ret.compCount = 1; break; case eGL_DEPTH24_STENCIL8: - ret.specialFormat = eSpecial_D24S8; + ret.specialFormat = SpecialFormat::D24S8; ret.special = true; break; case eGL_DEPTH32F_STENCIL8: - ret.specialFormat = eSpecial_D32S8; + ret.specialFormat = SpecialFormat::D32S8; ret.special = true; break; case eGL_STENCIL_INDEX8: - ret.specialFormat = eSpecial_S8; + ret.specialFormat = SpecialFormat::S8; ret.special = true; break; default: RDCERR("Unexpected depth or stencil format %x", fmt); @@ -1334,7 +1336,7 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) { switch(fmt.specialFormat) { - case eSpecial_BC1: + case SpecialFormat::BC1: { if(fmt.compCount == 3) ret = fmt.srgbCorrected ? eGL_COMPRESSED_SRGB_S3TC_DXT1_EXT @@ -1344,31 +1346,31 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) : eGL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break; } - case eSpecial_BC2: + case SpecialFormat::BC2: ret = fmt.srgbCorrected ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT : eGL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; - case eSpecial_BC3: + case SpecialFormat::BC3: ret = fmt.srgbCorrected ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT : eGL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; - case eSpecial_BC4: - ret = fmt.compType == eCompType_SNorm ? eGL_COMPRESSED_SIGNED_RED_RGTC1 + case SpecialFormat::BC4: + ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_RED_RGTC1 : eGL_COMPRESSED_RED_RGTC1; break; - case eSpecial_BC5: - ret = fmt.compType == eCompType_SNorm ? eGL_COMPRESSED_SIGNED_RG_RGTC2 + case SpecialFormat::BC5: + ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_RG_RGTC2 : eGL_COMPRESSED_RG_RGTC2; break; - case eSpecial_BC6: - ret = fmt.compType == eCompType_SNorm ? eGL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB + case SpecialFormat::BC6: + ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB : eGL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB; break; - case eSpecial_BC7: + case SpecialFormat::BC7: ret = fmt.srgbCorrected ? eGL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB : eGL_COMPRESSED_RGBA_BPTC_UNORM_ARB; break; - case eSpecial_ETC2: + case SpecialFormat::ETC2: { if(fmt.compCount == 3) ret = fmt.srgbCorrected ? eGL_COMPRESSED_SRGB8_ETC2 : eGL_COMPRESSED_RGB8_ETC2; @@ -1377,34 +1379,34 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) : eGL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; break; } - case eSpecial_EAC: + case SpecialFormat::EAC: { if(fmt.compCount == 1) - ret = fmt.compType == eCompType_SNorm ? eGL_COMPRESSED_SIGNED_R11_EAC + ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_R11_EAC : eGL_COMPRESSED_R11_EAC; else if(fmt.compCount == 2) - ret = fmt.compType == eCompType_SNorm ? eGL_COMPRESSED_SIGNED_RG11_EAC + ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_RG11_EAC : eGL_COMPRESSED_RG11_EAC; else ret = fmt.srgbCorrected ? eGL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : eGL_COMPRESSED_RGBA8_ETC2_EAC; break; } - case eSpecial_R10G10B10A2: - if(fmt.compType == eCompType_UNorm) + case SpecialFormat::R10G10B10A2: + if(fmt.compType == CompType::UNorm) ret = eGL_RGB10_A2; else ret = eGL_RGB10_A2UI; break; - case eSpecial_R11G11B10: ret = eGL_R11F_G11F_B10F; break; - case eSpecial_R5G6B5: ret = eGL_RGB565; break; - case eSpecial_R5G5B5A1: ret = eGL_RGB5_A1; break; - case eSpecial_R9G9B9E5: ret = eGL_RGB9_E5; break; - case eSpecial_R4G4B4A4: ret = eGL_RGBA4; break; - case eSpecial_D24S8: ret = eGL_DEPTH24_STENCIL8; break; - case eSpecial_D32S8: ret = eGL_DEPTH32F_STENCIL8; break; - case eSpecial_ASTC: RDCERR("ASTC can't be decoded unambiguously"); break; - case eSpecial_S8: ret = eGL_STENCIL_INDEX8; break; + case SpecialFormat::R11G11B10: ret = eGL_R11F_G11F_B10F; break; + case SpecialFormat::R5G6B5: ret = eGL_RGB565; break; + case SpecialFormat::R5G5B5A1: ret = eGL_RGB5_A1; break; + case SpecialFormat::R9G9B9E5: ret = eGL_RGB9_E5; break; + case SpecialFormat::R4G4B4A4: ret = eGL_RGBA4; break; + case SpecialFormat::D24S8: ret = eGL_DEPTH24_STENCIL8; break; + case SpecialFormat::D32S8: ret = eGL_DEPTH32F_STENCIL8; break; + case SpecialFormat::ASTC: RDCERR("ASTC can't be decoded unambiguously"); break; + case SpecialFormat::S8: ret = eGL_STENCIL_INDEX8; break; default: RDCERR("Unsupported special format %u", fmt.specialFormat); break; } } @@ -1416,39 +1418,39 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) } else if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_RGBA32F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_RGBA32I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RGBA32UI; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_RGBA16F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_RGBA16I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RGBA16UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_RGBA16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_RGBA16; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = eGL_RGBA8I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RGBA8UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_RGBA8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_RGBA8; else RDCERR("Unrecognised component type"); @@ -1466,39 +1468,39 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) } else if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_RGB32F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_RGB32I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RGB32UI; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_RGB16F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_RGB16I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RGB16UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_RGB16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_RGB16; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = eGL_RGB8I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RGB8UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_RGB8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_RGB8; else RDCERR("Unrecognised component type"); @@ -1512,39 +1514,39 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) { if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_RG32F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_RG32I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RG32UI; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_RG16F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_RG16I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RG16UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_RG16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_RG16; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = eGL_RG8I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_RG8UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_RG8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_RG8; else RDCERR("Unrecognised component type"); @@ -1558,13 +1560,13 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) { if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_R32F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_R32I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_R32UI; - else if(fmt.compType == eCompType_Depth) + else if(fmt.compType == CompType::Depth) ret = eGL_DEPTH_COMPONENT32F; else RDCERR("Unrecognised component type"); @@ -1575,30 +1577,30 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = eGL_R16F; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = eGL_R16I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_R16UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_R16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_R16; - else if(fmt.compType == eCompType_Depth) + else if(fmt.compType == CompType::Depth) ret = eGL_DEPTH_COMPONENT16; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = eGL_R8I; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = eGL_R8UI; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = eGL_R8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = eGL_R8; else RDCERR("Unrecognised component type"); @@ -1619,78 +1621,78 @@ GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt) return ret; } -GLenum MakeGLPrimitiveTopology(PrimitiveTopology Topo) +GLenum MakeGLPrimitiveTopology(Topology Topo) { switch(Topo) { default: return eGL_NONE; - case eTopology_PointList: return eGL_POINTS; - case eTopology_LineStrip: return eGL_LINE_STRIP; - case eTopology_LineLoop: return eGL_LINE_LOOP; - case eTopology_LineList: return eGL_LINES; - case eTopology_LineStrip_Adj: return eGL_LINE_STRIP_ADJACENCY; - case eTopology_LineList_Adj: return eGL_LINES_ADJACENCY; - case eTopology_TriangleStrip: return eGL_TRIANGLE_STRIP; - case eTopology_TriangleFan: return eGL_TRIANGLE_FAN; - case eTopology_TriangleList: return eGL_TRIANGLES; - case eTopology_TriangleStrip_Adj: return eGL_TRIANGLE_STRIP_ADJACENCY; - case eTopology_TriangleList_Adj: return eGL_TRIANGLES_ADJACENCY; - case eTopology_PatchList_1CPs: - case eTopology_PatchList_2CPs: - case eTopology_PatchList_3CPs: - case eTopology_PatchList_4CPs: - case eTopology_PatchList_5CPs: - case eTopology_PatchList_6CPs: - case eTopology_PatchList_7CPs: - case eTopology_PatchList_8CPs: - case eTopology_PatchList_9CPs: - case eTopology_PatchList_10CPs: - case eTopology_PatchList_11CPs: - case eTopology_PatchList_12CPs: - case eTopology_PatchList_13CPs: - case eTopology_PatchList_14CPs: - case eTopology_PatchList_15CPs: - case eTopology_PatchList_16CPs: - case eTopology_PatchList_17CPs: - case eTopology_PatchList_18CPs: - case eTopology_PatchList_19CPs: - case eTopology_PatchList_20CPs: - case eTopology_PatchList_21CPs: - case eTopology_PatchList_22CPs: - case eTopology_PatchList_23CPs: - case eTopology_PatchList_24CPs: - case eTopology_PatchList_25CPs: - case eTopology_PatchList_26CPs: - case eTopology_PatchList_27CPs: - case eTopology_PatchList_28CPs: - case eTopology_PatchList_29CPs: - case eTopology_PatchList_30CPs: - case eTopology_PatchList_31CPs: - case eTopology_PatchList_32CPs: return eGL_PATCHES; + case Topology::PointList: return eGL_POINTS; + case Topology::LineStrip: return eGL_LINE_STRIP; + case Topology::LineLoop: return eGL_LINE_LOOP; + case Topology::LineList: return eGL_LINES; + case Topology::LineStrip_Adj: return eGL_LINE_STRIP_ADJACENCY; + case Topology::LineList_Adj: return eGL_LINES_ADJACENCY; + case Topology::TriangleStrip: return eGL_TRIANGLE_STRIP; + case Topology::TriangleFan: return eGL_TRIANGLE_FAN; + case Topology::TriangleList: return eGL_TRIANGLES; + case Topology::TriangleStrip_Adj: return eGL_TRIANGLE_STRIP_ADJACENCY; + case Topology::TriangleList_Adj: return eGL_TRIANGLES_ADJACENCY; + case Topology::PatchList_1CPs: + case Topology::PatchList_2CPs: + case Topology::PatchList_3CPs: + case Topology::PatchList_4CPs: + case Topology::PatchList_5CPs: + case Topology::PatchList_6CPs: + case Topology::PatchList_7CPs: + case Topology::PatchList_8CPs: + case Topology::PatchList_9CPs: + case Topology::PatchList_10CPs: + case Topology::PatchList_11CPs: + case Topology::PatchList_12CPs: + case Topology::PatchList_13CPs: + case Topology::PatchList_14CPs: + case Topology::PatchList_15CPs: + case Topology::PatchList_16CPs: + case Topology::PatchList_17CPs: + case Topology::PatchList_18CPs: + case Topology::PatchList_19CPs: + case Topology::PatchList_20CPs: + case Topology::PatchList_21CPs: + case Topology::PatchList_22CPs: + case Topology::PatchList_23CPs: + case Topology::PatchList_24CPs: + case Topology::PatchList_25CPs: + case Topology::PatchList_26CPs: + case Topology::PatchList_27CPs: + case Topology::PatchList_28CPs: + case Topology::PatchList_29CPs: + case Topology::PatchList_30CPs: + case Topology::PatchList_31CPs: + case Topology::PatchList_32CPs: return eGL_PATCHES; } } -PrimitiveTopology MakePrimitiveTopology(const GLHookSet &gl, GLenum Topo) +Topology MakePrimitiveTopology(const GLHookSet &gl, GLenum Topo) { switch(Topo) { - default: return eTopology_Unknown; - case eGL_POINTS: return eTopology_PointList; - case eGL_LINE_STRIP: return eTopology_LineStrip; - case eGL_LINE_LOOP: return eTopology_LineLoop; - case eGL_LINES: return eTopology_LineList; - case eGL_LINE_STRIP_ADJACENCY: return eTopology_LineStrip_Adj; - case eGL_LINES_ADJACENCY: return eTopology_LineList_Adj; - case eGL_TRIANGLE_STRIP: return eTopology_TriangleStrip; - case eGL_TRIANGLE_FAN: return eTopology_TriangleFan; - case eGL_TRIANGLES: return eTopology_TriangleList; - case eGL_TRIANGLE_STRIP_ADJACENCY: return eTopology_TriangleStrip_Adj; - case eGL_TRIANGLES_ADJACENCY: return eTopology_TriangleList_Adj; + default: return Topology::Unknown; + case eGL_POINTS: return Topology::PointList; + case eGL_LINE_STRIP: return Topology::LineStrip; + case eGL_LINE_LOOP: return Topology::LineLoop; + case eGL_LINES: return Topology::LineList; + case eGL_LINE_STRIP_ADJACENCY: return Topology::LineStrip_Adj; + case eGL_LINES_ADJACENCY: return Topology::LineList_Adj; + case eGL_TRIANGLE_STRIP: return Topology::TriangleStrip; + case eGL_TRIANGLE_FAN: return Topology::TriangleFan; + case eGL_TRIANGLES: return Topology::TriangleList; + case eGL_TRIANGLE_STRIP_ADJACENCY: return Topology::TriangleStrip_Adj; + case eGL_TRIANGLES_ADJACENCY: return Topology::TriangleList_Adj; case eGL_PATCHES: { GLint patchCount = 3; gl.glGetIntegerv(eGL_PATCH_VERTICES, &patchCount); - return PrimitiveTopology(eTopology_PatchList_1CPs + patchCount - 1); + return PatchList_Topology(patchCount); } } } @@ -2198,7 +2200,7 @@ void CopyProgramAttribBindings(const GLHookSet &gl, GLuint progsrc, GLuint progd for(int32_t i = 0; i < refl->InputSig.count; i++) { // skip built-ins - if(refl->InputSig[i].systemValue != eAttr_None) + if(refl->InputSig[i].systemValue != ShaderBuiltin::Undefined) continue; GLint idx = gl.glGetAttribLocation(progsrc, refl->InputSig[i].varName.elems); @@ -2214,7 +2216,7 @@ void CopyProgramFragDataBindings(const GLHookSet &gl, GLuint progsrc, GLuint pro for(int32_t i = 0; i < refl->OutputSig.count; i++) { // only look at colour outputs (should be the only outputs from fs) - if(refl->OutputSig[i].systemValue != eAttr_ColourOutput) + if(refl->OutputSig[i].systemValue != ShaderBuiltin::ColourOutput) continue; GLint idx = gl.glGetFragDataLocation(progsrc, refl->OutputSig[i].varName.elems); diff --git a/renderdoc/driver/gl/gl_common.h b/renderdoc/driver/gl/gl_common.h index c2a04a634..221c54d90 100644 --- a/renderdoc/driver/gl/gl_common.h +++ b/renderdoc/driver/gl/gl_common.h @@ -264,8 +264,8 @@ GLenum ShaderEnum(size_t idx); ResourceFormat MakeResourceFormat(const GLHookSet &gl, GLenum target, GLenum fmt); GLenum MakeGLFormat(WrappedOpenGL &gl, ResourceFormat fmt); -PrimitiveTopology MakePrimitiveTopology(const GLHookSet &gl, GLenum Topo); -GLenum MakeGLPrimitiveTopology(PrimitiveTopology Topo); +Topology MakePrimitiveTopology(const GLHookSet &gl, GLenum Topo); +GLenum MakeGLPrimitiveTopology(Topology Topo); const char *BlendString(GLenum blendenum); const char *SamplerString(GLenum smpenum); diff --git a/renderdoc/driver/gl/gl_counters.cpp b/renderdoc/driver/gl/gl_counters.cpp index a394f81ee..785bf3c3d 100644 --- a/renderdoc/driver/gl/gl_counters.cpp +++ b/renderdoc/driver/gl/gl_counters.cpp @@ -42,138 +42,138 @@ void GLReplay::PostContextShutdownCounters() { } -vector GLReplay::EnumerateCounters() +vector GLReplay::EnumerateCounters() { - vector ret; + vector ret; - ret.push_back(eCounter_EventGPUDuration); - ret.push_back(eCounter_InputVerticesRead); - ret.push_back(eCounter_IAPrimitives); - ret.push_back(eCounter_GSPrimitives); - ret.push_back(eCounter_RasterizerInvocations); - ret.push_back(eCounter_RasterizedPrimitives); - ret.push_back(eCounter_SamplesWritten); - ret.push_back(eCounter_VSInvocations); - ret.push_back(eCounter_TCSInvocations); - ret.push_back(eCounter_TESInvocations); - ret.push_back(eCounter_GSInvocations); - ret.push_back(eCounter_PSInvocations); - ret.push_back(eCounter_CSInvocations); + ret.push_back(GPUCounter::EventGPUDuration); + ret.push_back(GPUCounter::InputVerticesRead); + ret.push_back(GPUCounter::IAPrimitives); + ret.push_back(GPUCounter::GSPrimitives); + ret.push_back(GPUCounter::RasterizerInvocations); + ret.push_back(GPUCounter::RasterizedPrimitives); + ret.push_back(GPUCounter::SamplesWritten); + ret.push_back(GPUCounter::VSInvocations); + ret.push_back(GPUCounter::TCSInvocations); + ret.push_back(GPUCounter::TESInvocations); + ret.push_back(GPUCounter::GSInvocations); + ret.push_back(GPUCounter::PSInvocations); + ret.push_back(GPUCounter::CSInvocations); return ret; } -void GLReplay::DescribeCounter(uint32_t counterID, CounterDescription &desc) +void GLReplay::DescribeCounter(GPUCounter counterID, CounterDescription &desc) { desc.counterID = counterID; switch(counterID) { - case eCounter_EventGPUDuration: + case GPUCounter::EventGPUDuration: desc.name = "GPU Duration"; desc.description = "Time taken for this event on the GPU, as measured by delta between two GPU timestamps."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_Double; - desc.units = eUnits_Seconds; + desc.resultType = CompType::Double; + desc.unit = CounterUnit::Seconds; break; - case eCounter_InputVerticesRead: + case GPUCounter::InputVerticesRead: desc.name = "Input Vertices Read"; desc.description = "Number of vertices read by input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_IAPrimitives: + case GPUCounter::IAPrimitives: desc.name = "Input Primitives"; desc.description = "Number of primitives read by the input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSPrimitives: + case GPUCounter::GSPrimitives: desc.name = "GS Primitives"; desc.description = "Number of primitives output by a geometry shader."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizerInvocations: + case GPUCounter::RasterizerInvocations: desc.name = "Rasterizer Invocations"; desc.description = "Number of primitives that were sent to the rasterizer."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizedPrimitives: + case GPUCounter::RasterizedPrimitives: desc.name = "Rasterized Primitives"; desc.description = "Number of primitives that were rendered."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_SamplesWritten: + case GPUCounter::SamplesWritten: desc.name = "Samples Written"; desc.description = "Number of samples that passed depth/stencil test."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_VSInvocations: + case GPUCounter::VSInvocations: desc.name = "VS Invocations"; desc.description = "Number of times a vertex shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSInvocations: + case GPUCounter::GSInvocations: desc.name = "GS Invocations"; desc.description = "Number of times a geometry shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_TCSInvocations: + case GPUCounter::TCSInvocations: desc.name = "TCS Invocations"; desc.description = "Number of times a tesselation control shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_TESInvocations: + case GPUCounter::TESInvocations: desc.name = "TES Invocations"; desc.description = "Number of times a tesselation evaluation shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_PSInvocations: + case GPUCounter::PSInvocations: desc.name = "PS Invocations"; desc.description = "Number of times a pixel shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_CSInvocations: + case GPUCounter::CSInvocations: desc.name = "CS Invocations"; desc.description = "Number of times a compute shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; default: desc.name = "Unknown"; desc.description = "Unknown counter ID"; desc.resultByteWidth = 0; - desc.resultCompType = eCompType_None; - desc.units = eUnits_Absolute; + desc.resultType = CompType::Typeless; + desc.unit = CounterUnit::Absolute; break; } } struct GPUQueries { - GLuint obj[eCounter_GLMaxCounters]; + GLuint obj[ENUM_ARRAY_SIZE(GPUCounter)]; uint32_t eventID; }; @@ -186,23 +186,23 @@ struct GLCounterContext GLenum glCounters[] = { eGL_NONE, // Undefined!! - eGL_TIME_ELAPSED, // eCounter_EventGPUDuration - eGL_VERTICES_SUBMITTED_ARB, // eCounter_InputVerticesRead - eGL_PRIMITIVES_SUBMITTED_ARB, // eCounter_IAPrimitives - eGL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB, // eCounter_GSPrimitives - eGL_CLIPPING_INPUT_PRIMITIVES_ARB, // eCounter_RasterizerInvocations - eGL_CLIPPING_OUTPUT_PRIMITIVES_ARB, // eCounter_RasterizedPrimitives - eGL_SAMPLES_PASSED, // eCounter_SamplesWritten - eGL_VERTEX_SHADER_INVOCATIONS_ARB, // eCounter_VSInvocations - eGL_TESS_CONTROL_SHADER_PATCHES_ARB, // eCounter_TCSInvocations - eGL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB, // eCounter_TESInvocations - eGL_GEOMETRY_SHADER_INVOCATIONS, // eCounter_GSInvocations - eGL_FRAGMENT_SHADER_INVOCATIONS_ARB, // eCounter_PSInvocations - eGL_COMPUTE_SHADER_INVOCATIONS_ARB // eCounter_CSInvocations + eGL_TIME_ELAPSED, // GPUCounter::EventGPUDuration + eGL_VERTICES_SUBMITTED_ARB, // GPUCounter::InputVerticesRead + eGL_PRIMITIVES_SUBMITTED_ARB, // GPUCounter::IAPrimitives + eGL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB, // GPUCounter::GSPrimitives + eGL_CLIPPING_INPUT_PRIMITIVES_ARB, // GPUCounter::RasterizerInvocations + eGL_CLIPPING_OUTPUT_PRIMITIVES_ARB, // GPUCounter::RasterizedPrimitives + eGL_SAMPLES_PASSED, // GPUCounter::SamplesWritten + eGL_VERTEX_SHADER_INVOCATIONS_ARB, // GPUCounter::VSInvocations + eGL_TESS_CONTROL_SHADER_PATCHES_ARB, // GPUCounter::TCSInvocations + eGL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB, // GPUCounter::TESInvocations + eGL_GEOMETRY_SHADER_INVOCATIONS, // GPUCounter::GSInvocations + eGL_FRAGMENT_SHADER_INVOCATIONS_ARB, // GPUCounter::PSInvocations + eGL_COMPUTE_SHADER_INVOCATIONS_ARB // GPUCounter::CSInvocations }; void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnode, - const vector &counters) + const vector &counters) { if(drawnode.children.empty()) return; @@ -224,14 +224,14 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnod queries = &ctx.queries.back(); queries->eventID = d.eventID; - for(uint32_t q = 0; q < eCounter_GLMaxCounters; q++) + for(auto q : indices()) queries->obj[q] = 0; for(uint32_t c = 0; c < counters.size(); c++) { - m_pDriver->glGenQueries(1, &queries->obj[counters[c]]); + m_pDriver->glGenQueries(1, &queries->obj[(uint32_t)counters[c]]); if(m_pDriver->glGetError()) - queries->obj[counters[c]] = 0; + queries->obj[(uint32_t)counters[c]] = 0; } } else @@ -243,7 +243,7 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnod m_pDriver->ReplayLog(ctx.eventStart, d.eventID, eReplay_WithoutDraw); // Reverse order so that Timer counter is queried the last. - for(int32_t q = (eCounter_GLMaxCounters - 1); q >= 0; q--) + for(int32_t q = uint32_t(GPUCounter::Count) - 1; q >= 0; q--) if(queries->obj[q]) { m_pDriver->glBeginQuery(glCounters[q], queries->obj[q]); @@ -256,7 +256,7 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnod m_pDriver->ReplayLog(ctx.eventStart, d.eventID, eReplay_OnlyDraw); - for(uint32_t q = 0; q < eCounter_GLMaxCounters; q++) + for(auto q : indices()) if(queries->obj[q]) m_pDriver->glEndQuery(glCounters[q]); @@ -264,7 +264,7 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnod } } -vector GLReplay::FetchCounters(const vector &counters) +vector GLReplay::FetchCounters(const vector &counters) { vector ret; @@ -296,10 +296,11 @@ vector GLReplay::FetchCounters(const vector &counters) { for(uint32_t c = 0; c < counters.size(); c++) { - if(ctx.queries[i].obj[counters[c]]) + if(ctx.queries[i].obj[(uint32_t)counters[c]]) { GLuint64 data = 0; - m_pDriver->glGetQueryObjectui64v(ctx.queries[i].obj[counters[c]], eGL_QUERY_RESULT, &data); + m_pDriver->glGetQueryObjectui64v(ctx.queries[i].obj[(uint32_t)counters[c]], + eGL_QUERY_RESULT, &data); double duration = double(data) * nanosToSecs; @@ -309,9 +310,10 @@ vector GLReplay::FetchCounters(const vector &counters) duration = -1; } - if(counters[c] == eCounter_EventGPUDuration) + if(counters[c] == GPUCounter::EventGPUDuration) { - ret.push_back(CounterResult(ctx.queries[i].eventID, eCounter_EventGPUDuration, duration)); + ret.push_back( + CounterResult(ctx.queries[i].eventID, GPUCounter::EventGPUDuration, duration)); } else ret.push_back(CounterResult(ctx.queries[i].eventID, counters[c], data)); @@ -326,8 +328,8 @@ vector GLReplay::FetchCounters(const vector &counters) for(size_t i = 0; i < ctx.queries.size(); i++) for(uint32_t c = 0; c < counters.size(); c++) - if(ctx.queries[i].obj[counters[c]]) - m_pDriver->glDeleteQueries(1, &ctx.queries[i].obj[counters[c]]); + if(ctx.queries[i].obj[(uint32_t)counters[c]]) + m_pDriver->glDeleteQueries(1, &ctx.queries[i].obj[(uint32_t)counters[c]]); return ret; } diff --git a/renderdoc/driver/gl/gl_debug.cpp b/renderdoc/driver/gl/gl_debug.cpp index 87817ac18..9fdb023e2 100644 --- a/renderdoc/driver/gl/gl_debug.cpp +++ b/renderdoc/driver/gl/gl_debug.cpp @@ -248,7 +248,7 @@ void GLReplay::InitDebugData() RenderDoc::Inst().SetProgress(DebugManagerInit, 0.0f); { - uint64_t id = MakeOutputWindow(eWindowingSystem_Unknown, NULL, true); + uint64_t id = MakeOutputWindow(WindowingSystem::Unknown, NULL, true); m_DebugID = id; m_DebugCtx = &m_OutputWindows[id]; @@ -344,7 +344,7 @@ void GLReplay::InitDebugData() RDCWARN("Quad overdraw requires GLSL 4.50 for dFd(xy)fine, using possibly coarse dFd(xy)."); m_pDriver->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Portability, MessageSeverity::Medium, MessageSource::RuntimeWarning, "Quad overdraw requires GLSL 4.50 for dFd(xy)fine, using possibly coarse dFd(xy)."); } @@ -362,8 +362,8 @@ void GLReplay::InitDebugData() RDCWARN( "GL_ARB_shader_image_load_store/GL_ARB_gpu_shader5 not supported, disabling quad overdraw " "feature."); - m_pDriver->AddDebugMessage(eDbgCategory_Portability, eDbgSeverity_Medium, - eDbgSource_RuntimeWarning, + m_pDriver->AddDebugMessage(MessageCategory::Portability, MessageSeverity::Medium, + MessageSource::RuntimeWarning, "GL_ARB_shader_image_load_store/GL_ARB_gpu_shader5 not supported, " "disabling quad overdraw feature."); DebugData.quadoverdrawFSProg = 0; @@ -518,7 +518,7 @@ void GLReplay::InitDebugData() { RDCWARN("GL_ARB_compute_shader not supported, disabling min/max and histogram features."); m_pDriver->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Portability, MessageSeverity::Medium, MessageSource::RuntimeWarning, "GL_ARB_compute_shader not supported, disabling min/max and histogram features."); } @@ -552,8 +552,8 @@ void GLReplay::InitDebugData() DebugData.MS2Array = 0; DebugData.Array2MS = 0; RDCWARN("GL_ARB_compute_shader not supported, disabling 2DMS save/load."); - m_pDriver->AddDebugMessage(eDbgCategory_Portability, eDbgSeverity_Medium, - eDbgSource_RuntimeWarning, + m_pDriver->AddDebugMessage(MessageCategory::Portability, MessageSeverity::Medium, + MessageSource::RuntimeWarning, "GL_ARB_compute_shader not supported, disabling 2DMS save/load."); } @@ -569,8 +569,8 @@ void GLReplay::InitDebugData() { DebugData.meshPickProgram = 0; RDCWARN("GL_ARB_compute_shader not supported, disabling mesh picking."); - m_pDriver->AddDebugMessage(eDbgCategory_Portability, eDbgSeverity_Medium, - eDbgSource_RuntimeWarning, + m_pDriver->AddDebugMessage(MessageCategory::Portability, MessageSeverity::Medium, + MessageSource::RuntimeWarning, "GL_ARB_compute_shader not supported, disabling mesh picking."); } @@ -674,8 +674,8 @@ void GLReplay::InitDebugData() RDCWARN( "ARB_gpu_shader5 not supported, pixel picking and saving of integer textures may be " "inaccurate."); - m_pDriver->AddDebugMessage(eDbgCategory_Portability, eDbgSeverity_Medium, - eDbgSource_RuntimeWarning, + m_pDriver->AddDebugMessage(MessageCategory::Portability, MessageSeverity::Medium, + MessageSource::RuntimeWarning, "ARB_gpu_shader5 not supported, pixel picking and saving of integer " "textures may be inaccurate."); @@ -686,7 +686,7 @@ void GLReplay::InitDebugData() { RDCWARN("ARB_stencil_texturing not supported, stencil values will not be displayed or picked."); m_pDriver->AddDebugMessage( - eDbgCategory_Portability, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Portability, MessageSeverity::Medium, MessageSource::RuntimeWarning, "ARB_stencil_texturing not supported, stencil values will not be displayed or picked."); m_Degraded = true; @@ -797,7 +797,7 @@ void GLReplay::DeleteDebugData() } bool GLReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) + CompType typeHint, float *minval, float *maxval) { if(texid == ResourceId() || m_pDriver->m_Textures.find(texid) == m_pDriver->m_Textures.end()) return false; @@ -890,12 +890,12 @@ bool GLReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uin int progIdx = texSlot; - if(details.format.compType == eCompType_UInt) + if(details.format.compType == CompType::UInt) { progIdx |= TEXDISPLAY_UINT_TEX; intIdx = 1; } - if(details.format.compType == eCompType_SInt) + if(details.format.compType == CompType::SInt) { progIdx |= TEXDISPLAY_SINT_TEX; intIdx = 2; @@ -967,8 +967,8 @@ bool GLReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uin } bool GLReplay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, - bool channels[4], vector &histogram) + CompType typeHint, float minval, float maxval, bool channels[4], + vector &histogram) { if(minval >= maxval || texid == ResourceId()) return false; @@ -1078,12 +1078,12 @@ bool GLReplay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, int progIdx = texSlot; - if(details.format.compType == eCompType_UInt) + if(details.format.compType == CompType::UInt) { progIdx |= TEXDISPLAY_UINT_TEX; intIdx = 1; } - if(details.format.compType == eCompType_SInt) + if(details.format.compType == CompType::SInt) { progIdx |= TEXDISPLAY_SINT_TEX; intIdx = 2; @@ -1170,7 +1170,7 @@ uint32_t GLReplay::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t resFmt.compCount = cfg.position.compCount; resFmt.compType = cfg.position.compType; resFmt.special = false; - if(cfg.position.specialFormat != eSpecial_Unknown) + if(cfg.position.specialFormat != SpecialFormat::Unknown) { resFmt.special = true; resFmt.specialFormat = cfg.position.specialFormat; @@ -1255,27 +1255,27 @@ uint32_t GLReplay::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t bool isTriangleMesh = true; switch(cfg.position.topo) { - case eTopology_TriangleList: + case Topology::TriangleList: { cdata->meshMode = MESH_TRIANGLE_LIST; break; }; - case eTopology_TriangleStrip: + case Topology::TriangleStrip: { cdata->meshMode = MESH_TRIANGLE_STRIP; break; }; - case eTopology_TriangleFan: + case Topology::TriangleFan: { cdata->meshMode = MESH_TRIANGLE_FAN; break; }; - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: { cdata->meshMode = MESH_TRIANGLE_LIST_ADJ; break; }; - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: { cdata->meshMode = MESH_TRIANGLE_STRIP_ADJ; break; @@ -1511,7 +1511,7 @@ uint32_t GLReplay::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t } void GLReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, - uint32_t mip, uint32_t sample, FormatComponentType typeHint, float pixel[4]) + uint32_t mip, uint32_t sample, CompType typeHint, float pixel[4]) { WrappedOpenGL &gl = *m_pDriver; @@ -1963,10 +1963,10 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, int flags) ubo->OutputDisplayFormat = resType; - if(cfg.overlay == eTexOverlay_NaN) + if(cfg.overlay == DebugOverlay::NaN) ubo->OutputDisplayFormat |= TEXDISPLAY_NANS; - if(cfg.overlay == eTexOverlay_Clipping) + if(cfg.overlay == DebugOverlay::Clipping) ubo->OutputDisplayFormat |= TEXDISPLAY_CLIPPING; if(!IsSRGBFormat(texDetails.internalFormat) && cfg.linearDisplayAsGamma) @@ -2177,9 +2177,8 @@ void GLReplay::SetupOverlayPipeline(GLuint Program, GLuint Pipeline, GLuint frag gl.glUseProgramStages(DebugData.overlayPipe, eGL_FRAGMENT_SHADER_BIT, fragProgram); } -ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) +ResourceId GLReplay::RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { WrappedOpenGL &gl = *m_pDriver; @@ -2272,13 +2271,13 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glDisable(eGL_STENCIL_TEST); gl.glStencilMask(0); - if(overlay == eTexOverlay_NaN || overlay == eTexOverlay_Clipping) + if(overlay == DebugOverlay::NaN || overlay == DebugOverlay::Clipping) { // just need the basic texture float black[] = {0.0f, 0.0f, 0.0f, 0.0f}; gl.glClearBufferfv(eGL_COLOR, 0, black); } - else if(overlay == eTexOverlay_Drawcall) + else if(overlay == DebugOverlay::Drawcall) { float black[] = {0.0f, 0.0f, 0.0f, 0.5f}; gl.glClearBufferfv(eGL_COLOR, 0, black); @@ -2289,7 +2288,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin ReplayLog(eventID, eReplay_OnlyDraw); } - else if(overlay == eTexOverlay_Wireframe) + else if(overlay == DebugOverlay::Wireframe) { float wireCol[] = {200.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 0.0f}; gl.glClearBufferfv(eGL_COLOR, 0, wireCol); @@ -2302,7 +2301,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin ReplayLog(eventID, eReplay_OnlyDraw); } - else if(overlay == eTexOverlay_ViewportScissor) + else if(overlay == DebugOverlay::ViewportScissor) { float col[] = {0.0f, 0.0f, 0.0f, 0.0f}; gl.glClearBufferfv(eGL_COLOR, 0, col); @@ -2359,7 +2358,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glDrawArrays(eGL_TRIANGLE_STRIP, 0, 4); } } - else if(overlay == eTexOverlay_Depth || overlay == eTexOverlay_Stencil) + else if(overlay == DebugOverlay::Depth || overlay == DebugOverlay::Stencil) { float black[] = {0.0f, 0.0f, 0.0f, 0.0f}; gl.glClearBufferfv(eGL_COLOR, 0, black); @@ -2547,7 +2546,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin float green[] = {0.0f, 1.0f, 0.0f, 1.0f}; gl.glProgramUniform4fv(DebugData.fixedcolFSProg, colLoc, 1, green); - if(overlay == eTexOverlay_Depth) + if(overlay == DebugOverlay::Depth) { if(rs.Enabled[GLRenderState::eEnabled_DepthTest]) gl.glEnable(eGL_DEPTH_TEST); @@ -2589,7 +2588,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin if(stencilCopy != 0) gl.glDeleteTextures(1, &stencilCopy); } - else if(overlay == eTexOverlay_BackfaceCull) + else if(overlay == DebugOverlay::BackfaceCull) { float col[] = {0.0f, 0.0f, 0.0f, 0.0f}; gl.glClearBufferfv(eGL_COLOR, 0, col); @@ -2614,21 +2613,21 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin ReplayLog(eventID, eReplay_OnlyDraw); } - else if(overlay == eTexOverlay_ClearBeforeDraw || overlay == eTexOverlay_ClearBeforePass) + else if(overlay == DebugOverlay::ClearBeforeDraw || overlay == DebugOverlay::ClearBeforePass) { float col[] = {0.0f, 0.0f, 0.0f, 0.0f}; gl.glClearBufferfv(eGL_COLOR, 0, col); vector events = passEvents; - if(overlay == eTexOverlay_ClearBeforeDraw) + if(overlay == DebugOverlay::ClearBeforeDraw) events.clear(); events.push_back(eventID); if(!events.empty()) { - if(overlay == eTexOverlay_ClearBeforePass) + if(overlay == DebugOverlay::ClearBeforePass) { m_pDriver->ReplayLog(0, events[0], eReplay_WithoutDraw); } @@ -2646,12 +2645,12 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin { m_pDriver->ReplayLog(events[i], events[i], eReplay_OnlyDraw); - if(overlay == eTexOverlay_ClearBeforePass && i + 1 < events.size()) + if(overlay == DebugOverlay::ClearBeforePass && i + 1 < events.size()) m_pDriver->ReplayLog(events[i], events[i + 1], eReplay_WithoutDraw); } } } - else if(overlay == eTexOverlay_TriangleSizeDraw || overlay == eTexOverlay_TriangleSizePass) + else if(overlay == DebugOverlay::TriangleSizeDraw || overlay == DebugOverlay::TriangleSizePass) { SCOPED_TIMER("Triangle Size"); @@ -2685,14 +2684,14 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin vector events = passEvents; - if(overlay == eTexOverlay_TriangleSizeDraw) + if(overlay == DebugOverlay::TriangleSizeDraw) events.clear(); events.push_back(eventID); if(!events.empty()) { - if(overlay == eTexOverlay_TriangleSizePass) + if(overlay == DebugOverlay::TriangleSizePass) ReplayLog(events[0], eReplay_WithoutDraw); else rs.ApplyState(m_pDriver->GetCtx(), m_pDriver); @@ -2857,9 +2856,9 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin for(uint32_t inst = 0; draw && inst < RDCMAX(1U, draw->numInstances); inst++) { - MeshFormat fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_GSOut); + MeshFormat fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::GSOut); if(fmt.buf == ResourceId()) - fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_VSOut); + fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::VSOut); if(fmt.buf != ResourceId()) { @@ -2868,16 +2867,16 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glBindVertexArray(tempVAO); { - if(fmt.specialFormat != eSpecial_Unknown) + if(fmt.specialFormat != SpecialFormat::Unknown) { - if(fmt.specialFormat == eSpecial_R10G10B10A2) + if(fmt.specialFormat == SpecialFormat::R10G10B10A2) { - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) gl.glVertexAttribIFormat(0, 4, eGL_UNSIGNED_INT_2_10_10_10_REV, 0); - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) gl.glVertexAttribIFormat(0, 4, eGL_INT_2_10_10_10_REV, 0); } - else if(fmt.specialFormat == eSpecial_R11G11B10) + else if(fmt.specialFormat == SpecialFormat::R11G11B10) { gl.glVertexAttribFormat(0, 4, eGL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0); } @@ -2886,69 +2885,69 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin RDCWARN("Unsupported special vertex attribute format: %x", fmt.specialFormat); } } - else if(fmt.compType == eCompType_Float || fmt.compType == eCompType_UNorm || - fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::Float || fmt.compType == CompType::UNorm || + fmt.compType == CompType::SNorm) { GLenum fmttype = eGL_UNSIGNED_INT; if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) fmttype = eGL_FLOAT; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) fmttype = eGL_UNSIGNED_INT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) fmttype = eGL_INT; } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) fmttype = eGL_HALF_FLOAT; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) fmttype = eGL_UNSIGNED_SHORT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) fmttype = eGL_SHORT; } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_UNorm) + if(fmt.compType == CompType::UNorm) fmttype = eGL_UNSIGNED_BYTE; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) fmttype = eGL_BYTE; } - gl.glVertexAttribFormat(0, fmt.compCount, fmttype, fmt.compType != eCompType_Float, + gl.glVertexAttribFormat(0, fmt.compCount, fmttype, fmt.compType != CompType::Float, 0); } - else if(fmt.compType == eCompType_UInt || fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::UInt || fmt.compType == CompType::SInt) { GLenum fmttype = eGL_UNSIGNED_INT; if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) fmttype = eGL_UNSIGNED_INT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) fmttype = eGL_INT; } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) fmttype = eGL_UNSIGNED_SHORT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) fmttype = eGL_SHORT; } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_UInt) + if(fmt.compType == CompType::UInt) fmttype = eGL_UNSIGNED_BYTE; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) fmttype = eGL_BYTE; } gl.glVertexAttribIFormat(0, fmt.compCount, fmttype, 0); } - else if(fmt.compType == eCompType_Double) + else if(fmt.compType == CompType::Double) { gl.glVertexAttribLFormat(0, fmt.compCount, eGL_DOUBLE, 0); } @@ -3008,7 +3007,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glStencilMaskSeparate(eGL_BACK, (GLuint)stencilbmask); } - if(overlay == eTexOverlay_TriangleSizePass) + if(overlay == DebugOverlay::TriangleSizePass) { m_pDriver->ReplayLog(0, events[i], eReplay_OnlyDraw); @@ -3020,11 +3019,11 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glDeleteFramebuffers(1, &overlayFBO); gl.glDeleteVertexArrays(1, &tempVAO); - if(overlay == eTexOverlay_TriangleSizePass) + if(overlay == DebugOverlay::TriangleSizePass) ReplayLog(eventID, eReplay_WithoutDraw); } } - else if(overlay == eTexOverlay_QuadOverdrawDraw || overlay == eTexOverlay_QuadOverdrawPass) + else if(overlay == DebugOverlay::QuadOverdrawDraw || overlay == DebugOverlay::QuadOverdrawPass) { if(DebugData.quadoverdrawFSProg) { @@ -3035,7 +3034,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin vector events = passEvents; - if(overlay == eTexOverlay_QuadOverdrawDraw) + if(overlay == DebugOverlay::QuadOverdrawDraw) events.clear(); events.push_back(eventID); @@ -3114,7 +3113,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glTexParameteri(eGL_TEXTURE_2D, eGL_TEXTURE_WRAP_T, eGL_CLAMP_TO_EDGE); gl.glFramebufferTexture(eGL_FRAMEBUFFER, eGL_DEPTH_STENCIL_ATTACHMENT, quadtexs[1], 0); - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) ReplayLog(events[0], eReplay_WithoutDraw); else rs.ApplyState(m_pDriver->GetCtx(), m_pDriver); @@ -3199,7 +3198,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glStencilMaskSeparate(eGL_BACK, (GLuint)stencilbmask); } - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) { m_pDriver->ReplayLog(0, events[i], eReplay_OnlyDraw); @@ -3251,7 +3250,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin gl.glDeleteFramebuffers(1, &replacefbo); gl.glDeleteTextures(3, quadtexs); - if(overlay == eTexOverlay_QuadOverdrawPass) + if(overlay == DebugOverlay::QuadOverdrawPass) ReplayLog(eventID, eReplay_WithoutDraw); } } @@ -3426,7 +3425,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) if(include) varyings.push_back(name); - if(vsRefl->OutputSig[i].systemValue == eAttr_Position) + if(vsRefl->OutputSig[i].systemValue == ShaderBuiltin::Position) posidx = int32_t(varyings.size()) - 1; stride += sizeof(float) * vsRefl->OutputSig[i].compCount; @@ -3591,9 +3590,9 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) gl.glBeginQuery(eGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, DebugData.feedbackQueries[0]); gl.glBeginTransformFeedback(eGL_POINTS); - if((drawcall->flags & eDraw_UseIBuffer) == 0) + if(!(drawcall->flags & DrawFlags::UseIBuffer)) { - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) { if(HasExt[ARB_base_instance]) { @@ -3681,7 +3680,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) gl.glNamedBufferDataEXT(indexSetBuffer, sizeof(uint32_t) * indices.size(), &indices[0], eGL_STATIC_DRAW); - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) { if(HasExt[ARB_base_instance]) { @@ -3862,11 +3861,11 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) m_PostVSData[eventID].vsout.nearPlane = nearp; m_PostVSData[eventID].vsout.farPlane = farp; - m_PostVSData[eventID].vsout.useIndices = (drawcall->flags & eDraw_UseIBuffer) > 0; + m_PostVSData[eventID].vsout.useIndices = bool(drawcall->flags & DrawFlags::UseIBuffer); m_PostVSData[eventID].vsout.numVerts = drawcall->numIndices; m_PostVSData[eventID].vsout.instStride = 0; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].vsout.instStride = (stride * primsWritten) / RDCMAX(1U, drawcall->numInstances); @@ -3932,7 +3931,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) if(include) varyings.push_back(name); - if(lastRefl->OutputSig[i].systemValue == eAttr_Position) + if(lastRefl->OutputSig[i].systemValue == ShaderBuiltin::Position) posidx = int32_t(varyings.size()) - 1; stride += sizeof(float) * lastRefl->OutputSig[i].compCount; @@ -4102,7 +4101,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) // instanced draws must be replayed one at a time so we can record the number of primitives // from // each drawcall, as due to expansion this can vary per-instance. - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) { // if there is only one instance it's a trivial case and we don't need to bother with the // expensive path @@ -4128,7 +4127,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) DebugData.feedbackQueries[inst - 1]); gl.glBeginTransformFeedback(lastOutTopo); - if((drawcall->flags & eDraw_UseIBuffer) == 0) + if(!(drawcall->flags & DrawFlags::UseIBuffer)) { if(HasExt[ARB_base_instance]) { @@ -4169,7 +4168,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) gl.glBeginQuery(eGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, DebugData.feedbackQueries[0]); gl.glBeginTransformFeedback(lastOutTopo); - if((drawcall->flags & eDraw_UseIBuffer) == 0) + if(!(drawcall->flags & DrawFlags::UseIBuffer)) { if(HasExt[ARB_base_instance]) { @@ -4210,7 +4209,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) gl.glBeginQuery(eGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, DebugData.feedbackQueries[0]); gl.glBeginTransformFeedback(lastOutTopo); - if((drawcall->flags & eDraw_UseIBuffer) == 0) + if(!(drawcall->flags & DrawFlags::UseIBuffer)) { gl.glDrawArrays(drawtopo, drawcall->vertexOffset, drawcall->numIndices); } @@ -4228,7 +4227,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) std::vector instData; - if((drawcall->flags & eDraw_Instanced) && drawcall->numInstances > 1) + if((drawcall->flags & DrawFlags::Instanced) && drawcall->numInstances > 1) { uint64_t prevVertCount = 0; @@ -4387,7 +4386,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID) // store everything out to the PostVS data cache m_PostVSData[eventID].gsout.buf = lastoutBuffer; m_PostVSData[eventID].gsout.instStride = 0; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) { m_PostVSData[eventID].gsout.numVerts /= RDCMAX(1U, drawcall->numInstances); m_PostVSData[eventID].gsout.instStride = stride * m_PostVSData[eventID].gsout.numVerts; @@ -4485,8 +4484,8 @@ MeshFormat GLReplay::GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDat ret.compCount = 4; ret.compByteWidth = 4; - ret.compType = eCompType_Float; - ret.specialFormat = eSpecial_Unknown; + ret.compType = CompType::Float; + ret.specialFormat = SpecialFormat::Unknown; ret.showAlpha = false; ret.bgraOrder = false; @@ -4534,7 +4533,7 @@ FloatVector GLReplay::InterpretVertex(byte *data, uint32_t vert, const MeshDispl fmt.compCount = cfg.position.compCount; fmt.compType = cfg.position.compType; - if(cfg.position.specialFormat == eSpecial_R10G10B10A2) + if(cfg.position.specialFormat == SpecialFormat::R10G10B10A2) { if(data + 4 >= end) { @@ -4549,7 +4548,7 @@ FloatVector GLReplay::InterpretVertex(byte *data, uint32_t vert, const MeshDispl ret.w = v.w; return ret; } - else if(cfg.position.specialFormat == eSpecial_R11G11B10) + else if(cfg.position.specialFormat == SpecialFormat::R11G11B10) { if(data + 4 >= end) { @@ -4706,16 +4705,16 @@ void GLReplay::RenderMesh(uint32_t eventID, const vector &secondaryD if(fmts[i]->buf == ResourceId()) continue; - if(fmts[i]->specialFormat != eSpecial_Unknown) + if(fmts[i]->specialFormat != SpecialFormat::Unknown) { - if(fmts[i]->specialFormat == eSpecial_R10G10B10A2) + if(fmts[i]->specialFormat == SpecialFormat::R10G10B10A2) { - if(fmts[i]->compType == eCompType_UInt) + if(fmts[i]->compType == CompType::UInt) gl.glVertexAttribIFormat(i, 4, eGL_UNSIGNED_INT_2_10_10_10_REV, 0); - if(fmts[i]->compType == eCompType_SInt) + if(fmts[i]->compType == CompType::SInt) gl.glVertexAttribIFormat(i, 4, eGL_INT_2_10_10_10_REV, 0); } - else if(fmts[i]->specialFormat == eSpecial_R11G11B10) + else if(fmts[i]->specialFormat == SpecialFormat::R11G11B10) { gl.glVertexAttribFormat(i, 4, eGL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0); } @@ -4724,69 +4723,69 @@ void GLReplay::RenderMesh(uint32_t eventID, const vector &secondaryD RDCWARN("Unsupported special vertex attribute format: %x", fmts[i]->specialFormat); } } - else if(fmts[i]->compType == eCompType_Float || fmts[i]->compType == eCompType_UNorm || - fmts[i]->compType == eCompType_SNorm) + else if(fmts[i]->compType == CompType::Float || fmts[i]->compType == CompType::UNorm || + fmts[i]->compType == CompType::SNorm) { GLenum fmttype = eGL_UNSIGNED_INT; if(fmts[i]->compByteWidth == 4) { - if(fmts[i]->compType == eCompType_Float) + if(fmts[i]->compType == CompType::Float) fmttype = eGL_FLOAT; - else if(fmts[i]->compType == eCompType_UNorm) + else if(fmts[i]->compType == CompType::UNorm) fmttype = eGL_UNSIGNED_INT; - else if(fmts[i]->compType == eCompType_SNorm) + else if(fmts[i]->compType == CompType::SNorm) fmttype = eGL_INT; } else if(fmts[i]->compByteWidth == 2) { - if(fmts[i]->compType == eCompType_Float) + if(fmts[i]->compType == CompType::Float) fmttype = eGL_HALF_FLOAT; - else if(fmts[i]->compType == eCompType_UNorm) + else if(fmts[i]->compType == CompType::UNorm) fmttype = eGL_UNSIGNED_SHORT; - else if(fmts[i]->compType == eCompType_SNorm) + else if(fmts[i]->compType == CompType::SNorm) fmttype = eGL_SHORT; } else if(fmts[i]->compByteWidth == 1) { - if(fmts[i]->compType == eCompType_UNorm) + if(fmts[i]->compType == CompType::UNorm) fmttype = eGL_UNSIGNED_BYTE; - else if(fmts[i]->compType == eCompType_SNorm) + else if(fmts[i]->compType == CompType::SNorm) fmttype = eGL_BYTE; } - gl.glVertexAttribFormat(i, fmts[i]->compCount, fmttype, fmts[i]->compType != eCompType_Float, + gl.glVertexAttribFormat(i, fmts[i]->compCount, fmttype, fmts[i]->compType != CompType::Float, 0); } - else if(fmts[i]->compType == eCompType_UInt || fmts[i]->compType == eCompType_SInt) + else if(fmts[i]->compType == CompType::UInt || fmts[i]->compType == CompType::SInt) { GLenum fmttype = eGL_UNSIGNED_INT; if(fmts[i]->compByteWidth == 4) { - if(fmts[i]->compType == eCompType_UInt) + if(fmts[i]->compType == CompType::UInt) fmttype = eGL_UNSIGNED_INT; - else if(fmts[i]->compType == eCompType_SInt) + else if(fmts[i]->compType == CompType::SInt) fmttype = eGL_INT; } else if(fmts[i]->compByteWidth == 2) { - if(fmts[i]->compType == eCompType_UInt) + if(fmts[i]->compType == CompType::UInt) fmttype = eGL_UNSIGNED_SHORT; - else if(fmts[i]->compType == eCompType_SInt) + else if(fmts[i]->compType == CompType::SInt) fmttype = eGL_SHORT; } else if(fmts[i]->compByteWidth == 1) { - if(fmts[i]->compType == eCompType_UInt) + if(fmts[i]->compType == CompType::UInt) fmttype = eGL_UNSIGNED_BYTE; - else if(fmts[i]->compType == eCompType_SInt) + else if(fmts[i]->compType == CompType::SInt) fmttype = eGL_BYTE; } gl.glVertexAttribIFormat(i, fmts[i]->compCount, fmttype, 0); } - else if(fmts[i]->compType == eCompType_Double) + else if(fmts[i]->compType == CompType::Double) { gl.glVertexAttribLFormat(i, fmts[i]->compCount, eGL_DOUBLE, 0); } @@ -4802,13 +4801,13 @@ void GLReplay::RenderMesh(uint32_t eventID, const vector &secondaryD gl.glEnable(eGL_DEPTH_TEST); // solid render - if(cfg.solidShadeMode != eShade_None && topo != eGL_PATCHES) + if(cfg.solidShadeMode != SolidShade::NoSolid && topo != eGL_PATCHES) { gl.glDepthFunc(eGL_LESS); GLuint solidProg = prog; - if(cfg.solidShadeMode == eShade_Lit) + if(cfg.solidShadeMode == SolidShade::Lit) { // pick program with GS for per-face lighting solidProg = DebugData.meshgsProg; @@ -4830,11 +4829,11 @@ void GLReplay::RenderMesh(uint32_t eventID, const vector &secondaryD soliddata->color = Vec4f(0.8f, 0.8f, 0.0f, 1.0f); uint32_t OutputDisplayFormat = (uint32_t)cfg.solidShadeMode; - if(cfg.solidShadeMode == eShade_Secondary && cfg.second.showAlpha) + if(cfg.solidShadeMode == SolidShade::Secondary && cfg.second.showAlpha) OutputDisplayFormat = MESHDISPLAY_SECONDARY_ALPHA; soliddata->displayFormat = OutputDisplayFormat; - if(cfg.solidShadeMode == eShade_Lit) + if(cfg.solidShadeMode == SolidShade::Lit) soliddata->invProj = projMat.Inverse(); gl.glUnmapBuffer(eGL_UNIFORM_BUFFER); @@ -4874,7 +4873,7 @@ void GLReplay::RenderMesh(uint32_t eventID, const vector &secondaryD gl.glDepthFunc(eGL_ALWAYS); // wireframe render - if(cfg.solidShadeMode == eShade_None || cfg.wireframeDraw || topo == eGL_PATCHES) + if(cfg.solidShadeMode == SolidShade::NoSolid || cfg.wireframeDraw || topo == eGL_PATCHES) { uboParams.color = Vec4f(cfg.position.meshColour.x, cfg.position.meshColour.y, cfg.position.meshColour.z, cfg.position.meshColour.w); @@ -5023,7 +5022,7 @@ void GLReplay::RenderMesh(uint32_t eventID, const vector &secondaryD GetBufferData(cfg.position.buf, 0, 0, m_HighlightCache.data); - if(cfg.position.idxByteWidth == 0 || stage == eMeshDataStage_GSOut) + if(cfg.position.idxByteWidth == 0 || stage == MeshDataStage::GSOut) { m_HighlightCache.indices.clear(); m_HighlightCache.useidx = false; @@ -5365,7 +5364,7 @@ void GLReplay::RenderMesh(uint32_t eventID, const vector &secondaryD } else if(meshtopo == eGL_PATCHES) { - uint32_t dim = (cfg.position.topo - eTopology_PatchList_1CPs + 1); + uint32_t dim = PatchList_Count(cfg.position.topo); uint32_t v0 = uint32_t(idx / dim) * dim; diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index 84b0bd12f..78684a96a 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -346,7 +346,7 @@ const uint32_t GLInitParams::GL_OLD_VERSIONS[GLInitParams::GL_NUM_SUPPORTED_OLD_ 0x000012, // Added support for GL-DX interop }; -ReplayCreateStatus GLInitParams::Serialise() +ReplayStatus GLInitParams::Serialise() { SERIALISE_ELEMENT(uint32_t, ver, GL_SERIALISE_VERSION); SerialiseVersion = ver; @@ -369,7 +369,7 @@ ReplayCreateStatus GLInitParams::Serialise() if(!oldsupported) { RDCERR("Incompatible OpenGL serialise version, expected %d got %d", GL_SERIALISE_VERSION, ver); - return eReplayCreate_APIIncompatibleVersion; + return ReplayStatus::APIIncompatibleVersion; } } @@ -381,7 +381,7 @@ ReplayCreateStatus GLInitParams::Serialise() m_pSerialiser->Serialise("Width", width); m_pSerialiser->Serialise("Height", height); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } void WrappedOpenGL::GetGLExtensions() @@ -2997,10 +2997,10 @@ void WrappedOpenGL::FinishCapture() // m_SuccessfulCapture = false; } -void WrappedOpenGL::AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, - DebugMessageSource src, std::string d) +void WrappedOpenGL::AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, + std::string d) { - if(m_State == READING || src == eDbgSource_RuntimeWarning) + if(m_State == READING || src == MessageSource::RuntimeWarning) { DebugMessage msg; msg.eventID = m_CurEventID; @@ -3073,8 +3073,8 @@ void WrappedOpenGL::Serialise_DebugMessages() if(m_State >= WRITING) desc = debugMessages[i].description.elems; - SERIALISE_ELEMENT(uint32_t, Category, debugMessages[i].category); - SERIALISE_ELEMENT(uint32_t, Severity, debugMessages[i].severity); + SERIALISE_ELEMENT(MessageCategory, Category, debugMessages[i].category); + SERIALISE_ELEMENT(MessageSeverity, Severity, debugMessages[i].severity); SERIALISE_ELEMENT(uint32_t, ID, debugMessages[i].messageID); SERIALISE_ELEMENT(string, Description, desc); @@ -3082,9 +3082,9 @@ void WrappedOpenGL::Serialise_DebugMessages() { DebugMessage msg; msg.eventID = m_CurEventID; - msg.source = eDbgSource_API; - msg.category = (DebugMessageCategory)Category; - msg.severity = (DebugMessageSeverity)Severity; + msg.source = MessageSource::API; + msg.category = Category; + msg.severity = Severity; msg.messageID = ID; msg.description = Description; @@ -3140,32 +3140,34 @@ void WrappedOpenGL::DebugSnoop(GLenum source, GLenum type, GLuint id, GLenum sev switch(severity) { - case eGL_DEBUG_SEVERITY_HIGH: msg.severity = eDbgSeverity_High; break; - case eGL_DEBUG_SEVERITY_MEDIUM: msg.severity = eDbgSeverity_Medium; break; - case eGL_DEBUG_SEVERITY_LOW: msg.severity = eDbgSeverity_Low; break; + case eGL_DEBUG_SEVERITY_HIGH: msg.severity = MessageSeverity::High; break; + case eGL_DEBUG_SEVERITY_MEDIUM: msg.severity = MessageSeverity::Medium; break; + case eGL_DEBUG_SEVERITY_LOW: msg.severity = MessageSeverity::Low; break; case eGL_DEBUG_SEVERITY_NOTIFICATION: - default: msg.severity = eDbgSeverity_Info; break; + default: msg.severity = MessageSeverity::Info; break; } if(source == eGL_DEBUG_SOURCE_APPLICATION || type == eGL_DEBUG_TYPE_MARKER) { - msg.category = eDbgCategory_Application_Defined; + msg.category = MessageCategory::Application_Defined; } else if(source == eGL_DEBUG_SOURCE_SHADER_COMPILER) { - msg.category = eDbgCategory_Shaders; + msg.category = MessageCategory::Shaders; } else { switch(type) { - case eGL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: msg.category = eDbgCategory_Deprecated; break; - case eGL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: msg.category = eDbgCategory_Undefined; break; - case eGL_DEBUG_TYPE_PORTABILITY: msg.category = eDbgCategory_Portability; break; - case eGL_DEBUG_TYPE_PERFORMANCE: msg.category = eDbgCategory_Performance; break; + case eGL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + msg.category = MessageCategory::Deprecated; + break; + case eGL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: msg.category = MessageCategory::Undefined; break; + case eGL_DEBUG_TYPE_PORTABILITY: msg.category = MessageCategory::Portability; break; + case eGL_DEBUG_TYPE_PERFORMANCE: msg.category = MessageCategory::Performance; break; case eGL_DEBUG_TYPE_ERROR: case eGL_DEBUG_TYPE_OTHER: - default: msg.category = eDbgCategory_Miscellaneous; break; + default: msg.category = MessageCategory::Miscellaneous; break; } } @@ -3695,7 +3697,7 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context) FetchDrawcall draw; draw.name = "SwapBuffers()"; - draw.flags |= eDraw_Present; + draw.flags |= DrawFlags::Present; draw.copyDestination = GetResourceManager()->GetOriginalID( GetResourceManager()->GetID(TextureRes(GetCtx(), m_FakeBB_Color))); @@ -3873,7 +3875,8 @@ void WrappedOpenGL::ContextProcessChunk(uint64_t offset, GLChunkType chunk) void WrappedOpenGL::AddUsage(const FetchDrawcall &d) { - if((d.flags & (eDraw_Drawcall | eDraw_Dispatch)) == 0) + DrawFlags DrawDispatchMask = DrawFlags::Drawcall | DrawFlags::Dispatch; + if(!(d.flags & DrawDispatchMask)) return; const GLHookSet &gl = m_Real; @@ -3887,13 +3890,14 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) ////////////////////////////// // Input - if(d.flags & eDraw_UseIBuffer) + if(d.flags & DrawFlags::UseIBuffer) { GLuint ibuffer = 0; gl.glGetIntegerv(eGL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint *)&ibuffer); if(ibuffer) - m_ResourceUses[rm->GetID(BufferRes(ctx, ibuffer))].push_back(EventUsage(e, eUsage_IndexBuffer)); + m_ResourceUses[rm->GetID(BufferRes(ctx, ibuffer))].push_back( + EventUsage(e, ResourceUsage::IndexBuffer)); } // Vertex buffers and attributes @@ -3905,7 +3909,8 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) GLuint buffer = GetBoundVertexBuffer(m_Real, i); if(buffer) - m_ResourceUses[rm->GetID(BufferRes(ctx, buffer))].push_back(EventUsage(e, eUsage_VertexBuffer)); + m_ResourceUses[rm->GetID(BufferRes(ctx, buffer))].push_back( + EventUsage(e, ResourceUsage::VertexBuffer)); } ////////////////////////////// @@ -3961,9 +3966,9 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) for(size_t i = 0; i < ARRAY_COUNT(refl); i++) { - EventUsage cb = EventUsage(e, ResourceUsage(eUsage_VS_Constants + i)); - EventUsage res = EventUsage(e, ResourceUsage(eUsage_VS_Resource + i)); - EventUsage rw = EventUsage(e, ResourceUsage(eUsage_VS_RWResource + i)); + EventUsage cb = EventUsage(e, CBUsage(i)); + EventUsage res = EventUsage(e, ResUsage(i)); + EventUsage rw = EventUsage(e, RWResUsage(i)); if(refl[i]) { @@ -3994,7 +3999,7 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) { if(refl[i]->ReadWriteResources[r].variableType.descriptor.cols == 1 && refl[i]->ReadWriteResources[r].variableType.descriptor.rows == 1 && - refl[i]->ReadWriteResources[r].variableType.descriptor.type == eVar_UInt) + refl[i]->ReadWriteResources[r].variableType.descriptor.type == VarType::UInt) { if(rs.AtomicCounter[bind].name) m_ResourceUses[rm->GetID(BufferRes(ctx, rs.AtomicCounter[bind].name))].push_back(rw); @@ -4016,52 +4021,52 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) switch(refl[i]->ReadOnlyResources[r].resType) { - case eResType_None: texList = NULL; break; - case eResType_Buffer: + case TextureDim::Unknown: texList = NULL; break; + case TextureDim::Buffer: texList = rs.TexBuffer; listSize = (int32_t)ARRAY_COUNT(rs.TexBuffer); break; - case eResType_Texture1D: + case TextureDim::Texture1D: texList = rs.Tex1D; listSize = (int32_t)ARRAY_COUNT(rs.Tex1D); break; - case eResType_Texture1DArray: + case TextureDim::Texture1DArray: texList = rs.Tex1DArray; listSize = (int32_t)ARRAY_COUNT(rs.Tex1DArray); break; - case eResType_Texture2D: + case TextureDim::Texture2D: texList = rs.Tex2D; listSize = (int32_t)ARRAY_COUNT(rs.Tex2D); break; - case eResType_TextureRect: + case TextureDim::TextureRect: texList = rs.TexRect; listSize = (int32_t)ARRAY_COUNT(rs.TexRect); break; - case eResType_Texture2DArray: + case TextureDim::Texture2DArray: texList = rs.Tex2DArray; listSize = (int32_t)ARRAY_COUNT(rs.Tex2DArray); break; - case eResType_Texture2DMS: + case TextureDim::Texture2DMS: texList = rs.Tex2DMS; listSize = (int32_t)ARRAY_COUNT(rs.Tex2DMS); break; - case eResType_Texture2DMSArray: + case TextureDim::Texture2DMSArray: texList = rs.Tex2DMSArray; listSize = (int32_t)ARRAY_COUNT(rs.Tex2DMSArray); break; - case eResType_Texture3D: + case TextureDim::Texture3D: texList = rs.Tex3D; listSize = (int32_t)ARRAY_COUNT(rs.Tex3D); break; - case eResType_TextureCube: + case TextureDim::TextureCube: texList = rs.TexCube; listSize = (int32_t)ARRAY_COUNT(rs.TexCube); break; - case eResType_TextureCubeArray: + case TextureDim::TextureCubeArray: texList = rs.TexCubeArray; listSize = (int32_t)ARRAY_COUNT(rs.TexCubeArray); break; - case eResType_Count: RDCERR("Invalid shader resource type"); break; + case TextureDim::Count: RDCERR("Invalid shader resource type"); break; } if(texList != NULL && bind >= 0 && bind < listSize && texList[bind] != 0) @@ -4083,7 +4088,8 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) gl.glGetIntegeri_v(eGL_TRANSFORM_FEEDBACK_BUFFER_BINDING, i, (GLint *)&buffer); if(buffer) - m_ResourceUses[rm->GetID(BufferRes(ctx, buffer))].push_back(EventUsage(e, eUsage_SO)); + m_ResourceUses[rm->GetID(BufferRes(ctx, buffer))].push_back( + EventUsage(e, ResourceUsage::StreamOut)); } ////////////////////////////// @@ -4108,10 +4114,10 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) { if(type == eGL_TEXTURE) m_ResourceUses[rm->GetID(TextureRes(ctx, attachment))].push_back( - EventUsage(e, eUsage_ColourTarget)); + EventUsage(e, ResourceUsage::ColourTarget)); else m_ResourceUses[rm->GetID(RenderbufferRes(ctx, attachment))].push_back( - EventUsage(e, eUsage_ColourTarget)); + EventUsage(e, ResourceUsage::ColourTarget)); } } @@ -4125,10 +4131,10 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) { if(type == eGL_TEXTURE) m_ResourceUses[rm->GetID(TextureRes(ctx, attachment))].push_back( - EventUsage(e, eUsage_DepthStencilTarget)); + EventUsage(e, ResourceUsage::DepthStencilTarget)); else m_ResourceUses[rm->GetID(RenderbufferRes(ctx, attachment))].push_back( - EventUsage(e, eUsage_DepthStencilTarget)); + EventUsage(e, ResourceUsage::DepthStencilTarget)); } gl.glGetFramebufferAttachmentParameteriv(eGL_DRAW_FRAMEBUFFER, eGL_STENCIL_ATTACHMENT, @@ -4141,10 +4147,10 @@ void WrappedOpenGL::AddUsage(const FetchDrawcall &d) { if(type == eGL_TEXTURE) m_ResourceUses[rm->GetID(TextureRes(ctx, attachment))].push_back( - EventUsage(e, eUsage_DepthStencilTarget)); + EventUsage(e, ResourceUsage::DepthStencilTarget)); else m_ResourceUses[rm->GetID(RenderbufferRes(ctx, attachment))].push_back( - EventUsage(e, eUsage_DepthStencilTarget)); + EventUsage(e, ResourceUsage::DepthStencilTarget)); } } @@ -4182,7 +4188,8 @@ void WrappedOpenGL::AddDrawcall(const FetchDrawcall &d, bool hasEvents) } // markers don't increment drawcall ID - if((draw.flags & (eDraw_SetMarker | eDraw_PushMarker | eDraw_MultiDraw)) == 0) + DrawFlags MarkerMask = DrawFlags::SetMarker | DrawFlags::PushMarker | DrawFlags::MultiDraw; + if(!(draw.flags & MarkerMask)) m_CurDrawcallID++; if(hasEvents) diff --git a/renderdoc/driver/gl/gl_driver.h b/renderdoc/driver/gl/gl_driver.h index c2d4fec3a..07290ba2d 100644 --- a/renderdoc/driver/gl/gl_driver.h +++ b/renderdoc/driver/gl/gl_driver.h @@ -43,7 +43,7 @@ using std::list; struct GLInitParams : public RDCInitParams { GLInitParams(); - ReplayCreateStatus Serialise(); + ReplayStatus Serialise(); uint32_t colorBits; uint32_t depthBits; @@ -265,7 +265,7 @@ private: depth(0), samples(0), mips(1), - creationFlags(0), + creationFlags(TextureCategory::NoFlags), internalFormat(eGL_NONE), renderbufferReadTex(0) { @@ -276,7 +276,7 @@ private: GLint dimension; bool emulated, view; GLint width, height, depth, samples, mips; - uint32_t creationFlags; + TextureCategory creationFlags; GLenum internalFormat; // since renderbuffers cannot be read from, we have to create a texture of identical @@ -541,8 +541,7 @@ public: if(m_State < WRITING) m_DebugMessages.push_back(msg); } - void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, - std::string d); + void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, std::string d); void AddMissingTrack(ResourceId id) { m_MissingTracks.insert(id); } // replay interface diff --git a/renderdoc/driver/gl/gl_hooks_egl.cpp b/renderdoc/driver/gl/gl_hooks_egl.cpp index 05b36c052..001beeb26 100644 --- a/renderdoc/driver/gl/gl_hooks_egl.cpp +++ b/renderdoc/driver/gl/gl_hooks_egl.cpp @@ -206,16 +206,16 @@ public: switch(system) { #if ENABLED(RDOC_ANDROID) - case eWindowingSystem_Android: window = (EGLNativeWindowType)data; break; + case WindowingSystem::Android: window = (EGLNativeWindowType)data; break; #elif ENABLED(RDOC_LINUX) - case eWindowingSystem_Xlib: + case WindowingSystem::Xlib: { XlibWindowData *xlib = (XlibWindowData *)data; window = (EGLNativeWindowType)xlib->window; break; } #endif - case eWindowingSystem_Unknown: { + case WindowingSystem::Unknown: { #if ENABLED(RDOC_LINUX) // allow undefined so that internally we can create a window-less context Display *dpy = XOpenDisplay(NULL); diff --git a/renderdoc/driver/gl/gl_hooks_linux.cpp b/renderdoc/driver/gl/gl_hooks_linux.cpp index e7ee43e30..4a50f7424 100644 --- a/renderdoc/driver/gl/gl_hooks_linux.cpp +++ b/renderdoc/driver/gl/gl_hooks_linux.cpp @@ -226,7 +226,7 @@ public: Display *dpy = NULL; Drawable draw = 0; - if(system == eWindowingSystem_Xlib) + if(system == WindowingSystem::Xlib) { #if ENABLED(RDOC_XLIB) XlibWindowData *xlib = (XlibWindowData *)data; @@ -239,7 +239,7 @@ public: "support compiled in"); #endif } - else if(system == eWindowingSystem_Unknown) + else if(system == WindowingSystem::Unknown) { // allow undefined so that internally we can create a window-less context dpy = XOpenDisplay(NULL); diff --git a/renderdoc/driver/gl/gl_hooks_win32.cpp b/renderdoc/driver/gl/gl_hooks_win32.cpp index d0f7f4073..2ec768300 100644 --- a/renderdoc/driver/gl/gl_hooks_win32.cpp +++ b/renderdoc/driver/gl/gl_hooks_win32.cpp @@ -431,7 +431,7 @@ public: { GLWindowingData ret; - RDCASSERT(system == eWindowingSystem_Win32 || system == eWindowingSystem_Unknown, system); + RDCASSERT(system == WindowingSystem::Win32 || system == WindowingSystem::Unknown, system); HWND w = (HWND)data; diff --git a/renderdoc/driver/gl/gl_manager.cpp b/renderdoc/driver/gl/gl_manager.cpp index 8d55303ad..8d023ffec 100644 --- a/renderdoc/driver/gl/gl_manager.cpp +++ b/renderdoc/driver/gl/gl_manager.cpp @@ -1925,8 +1925,8 @@ void GLResourceManager::Apply_InitialState(GLResource live, InitialContentData i "The original capture created a texture buffer with a range - replay will use the " "whole buffer, which is likely incorrect."; RDCERR("%s", msg); - m_GL->AddDebugMessage(eDbgCategory_Resource_Manipulation, eDbgSeverity_High, - eDbgSource_IncorrectAPIUse, msg); + m_GL->AddDebugMessage(MessageCategory::Resource_Manipulation, MessageSeverity::High, + MessageSource::IncorrectAPIUse, msg); } gl.glTextureBufferEXT(live.name, eGL_TEXTURE_BUFFER, details.internalFormat, buffer); diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index f77bb920e..22b330863 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -84,7 +84,7 @@ vector GLReplay::GetPassEvents(uint32_t eventID) const FetchDrawcall *start = draw; while(start && start->previous != 0 && - (m_pDriver->GetDrawcall((uint32_t)start->previous)->flags & eDraw_Clear) == 0) + !(m_pDriver->GetDrawcall((uint32_t)start->previous)->flags & DrawFlags::Clear)) { const FetchDrawcall *prev = m_pDriver->GetDrawcall((uint32_t)start->previous); @@ -100,7 +100,7 @@ vector GLReplay::GetPassEvents(uint32_t eventID) if(start == draw) break; - if(start->flags & eDraw_Drawcall) + if(start->flags & DrawFlags::Drawcall) passEvents.push_back(start->eventID); start = m_pDriver->GetDrawcall((uint32_t)start->next); @@ -123,8 +123,8 @@ APIProperties GLReplay::GetAPIProperties() { APIProperties ret; - ret.pipelineType = eGraphicsAPI_OpenGL; - ret.localRenderer = eGraphicsAPI_OpenGL; + ret.pipelineType = GraphicsAPI::OpenGL; + ret.localRenderer = GraphicsAPI::OpenGL; ret.degraded = m_Degraded; return ret; @@ -459,12 +459,12 @@ void GLReplay::CacheTexture(ResourceId id) tex.customName = true; tex.format = ResourceFormat(); tex.dimension = 1; - tex.resType = eResType_None; + tex.resType = TextureDim::Unknown; tex.width = tex.height = tex.depth = 1; tex.cubemap = false; tex.mips = 1; tex.arraysize = 1; - tex.creationFlags = 0; + tex.creationFlags = TextureCategory::NoFlags; tex.msQual = 0; tex.msSamp = 1; tex.byteSize = 1; @@ -476,21 +476,21 @@ void GLReplay::CacheTexture(ResourceId id) if(res.resource.Namespace == eResRenderbuffer || res.curType == eGL_RENDERBUFFER) { tex.dimension = 2; - tex.resType = eResType_Texture2D; + tex.resType = TextureDim::Texture2D; tex.width = res.width; tex.height = res.height; tex.depth = 1; tex.cubemap = false; tex.mips = 1; tex.arraysize = 1; - tex.creationFlags = eTextureCreate_RTV; + tex.creationFlags = TextureCategory::ColorTarget; tex.msQual = 0; tex.msSamp = RDCMAX(1, res.samples); tex.format = MakeResourceFormat(gl.GetHookset(), eGL_TEXTURE_2D, res.internalFormat); if(IsDepthStencilFormat(res.internalFormat)) - tex.creationFlags |= eTextureCreate_DSV; + tex.creationFlags |= TextureCategory::DepthTarget; tex.byteSize = (tex.width * tex.height) * (tex.format.compByteWidth * tex.format.compCount); @@ -505,9 +505,9 @@ void GLReplay::CacheTexture(ResourceId id) if(tex.msSamp > 1) ms = "MS"; - if(tex.creationFlags & eTextureCreate_RTV) + if(tex.creationFlags & TextureCategory::ColorTarget) suffix = " RTV"; - if(tex.creationFlags & eTextureCreate_DSV) + if(tex.creationFlags & TextureCategory::DepthTarget) suffix = " DSV"; tex.customName = false; @@ -568,20 +568,20 @@ void GLReplay::CacheTexture(ResourceId id) switch(target) { - case eGL_TEXTURE_BUFFER: tex.resType = eResType_Buffer; break; - case eGL_TEXTURE_1D: tex.resType = eResType_Texture1D; break; - case eGL_TEXTURE_2D: tex.resType = eResType_Texture2D; break; - case eGL_TEXTURE_3D: tex.resType = eResType_Texture3D; break; - case eGL_TEXTURE_1D_ARRAY: tex.resType = eResType_Texture1DArray; break; - case eGL_TEXTURE_2D_ARRAY: tex.resType = eResType_Texture2DArray; break; - case eGL_TEXTURE_RECTANGLE: tex.resType = eResType_TextureRect; break; - case eGL_TEXTURE_2D_MULTISAMPLE: tex.resType = eResType_Texture2DMS; break; - case eGL_TEXTURE_2D_MULTISAMPLE_ARRAY: tex.resType = eResType_Texture2DMSArray; break; - case eGL_TEXTURE_CUBE_MAP: tex.resType = eResType_TextureCube; break; - case eGL_TEXTURE_CUBE_MAP_ARRAY: tex.resType = eResType_TextureCubeArray; break; + case eGL_TEXTURE_BUFFER: tex.resType = TextureDim::Buffer; break; + case eGL_TEXTURE_1D: tex.resType = TextureDim::Texture1D; break; + case eGL_TEXTURE_2D: tex.resType = TextureDim::Texture2D; break; + case eGL_TEXTURE_3D: tex.resType = TextureDim::Texture3D; break; + case eGL_TEXTURE_1D_ARRAY: tex.resType = TextureDim::Texture1DArray; break; + case eGL_TEXTURE_2D_ARRAY: tex.resType = TextureDim::Texture2DArray; break; + case eGL_TEXTURE_RECTANGLE: tex.resType = TextureDim::TextureRect; break; + case eGL_TEXTURE_2D_MULTISAMPLE: tex.resType = TextureDim::Texture2DMS; break; + case eGL_TEXTURE_2D_MULTISAMPLE_ARRAY: tex.resType = TextureDim::Texture2DMSArray; break; + case eGL_TEXTURE_CUBE_MAP: tex.resType = TextureDim::TextureCube; break; + case eGL_TEXTURE_CUBE_MAP_ARRAY: tex.resType = TextureDim::TextureCubeArray; break; default: - tex.resType = eResType_None; + tex.resType = TextureDim::Unknown; RDCERR("Unexpected texture enum %s", ToStr::Get(target).c_str()); } @@ -632,7 +632,7 @@ void GLReplay::CacheTexture(ResourceId id) tex.creationFlags = res.creationFlags; if(res.resource.name == gl.m_FakeBB_Color || res.resource.name == gl.m_FakeBB_DepthStencil) - tex.creationFlags |= eTextureCreate_SwapBuffer; + tex.creationFlags |= TextureCategory::SwapBuffer; // surely this will be the same for each level... right? that would be insane if it wasn't GLint fmt = 0; @@ -641,8 +641,8 @@ void GLReplay::CacheTexture(ResourceId id) tex.format = MakeResourceFormat(gl.GetHookset(), target, (GLenum)fmt); - if(tex.format.compType == eCompType_Depth) - tex.creationFlags |= eTextureCreate_DSV; + if(tex.format.compType == CompType::Depth) + tex.creationFlags |= TextureCategory::DepthTarget; string str = m_pDriver->GetResourceManager()->GetName(tex.ID); tex.customName = true; @@ -655,9 +655,9 @@ void GLReplay::CacheTexture(ResourceId id) if(tex.msSamp > 1) ms = "MS"; - if(tex.creationFlags & eTextureCreate_RTV) + if(tex.creationFlags & TextureCategory::ColorTarget) suffix = " RTV"; - if(tex.creationFlags & eTextureCreate_DSV) + if(tex.creationFlags & TextureCategory::DepthTarget) suffix = " DSV"; tex.customName = false; @@ -687,7 +687,7 @@ void GLReplay::CacheTexture(ResourceId id) tex.cubemap = false; tex.mips = 1; tex.arraysize = 1; - tex.creationFlags = eTextureCreate_SRV; + tex.creationFlags = TextureCategory::ShaderRead; tex.msQual = 0; tex.msSamp = 1; tex.byteSize = 0; @@ -760,16 +760,16 @@ FetchBuffer GLReplay::GetBuffer(ResourceId id) gl.glBindBuffer(res.curType, res.resource.name); } - ret.creationFlags = 0; + ret.creationFlags = BufferCategory::NoFlags; switch(res.curType) { - case eGL_ARRAY_BUFFER: ret.creationFlags = eBufferCreate_VB; break; - case eGL_ELEMENT_ARRAY_BUFFER: ret.creationFlags = eBufferCreate_IB; break; - case eGL_UNIFORM_BUFFER: ret.creationFlags = eBufferCreate_CB; break; - case eGL_SHADER_STORAGE_BUFFER: ret.creationFlags = eBufferCreate_UAV; break; + case eGL_ARRAY_BUFFER: ret.creationFlags = BufferCategory::Vertex; break; + case eGL_ELEMENT_ARRAY_BUFFER: ret.creationFlags = BufferCategory::Index; break; + case eGL_UNIFORM_BUFFER: ret.creationFlags = BufferCategory::Constants; break; + case eGL_SHADER_STORAGE_BUFFER: ret.creationFlags = BufferCategory::ReadWrite; break; case eGL_DRAW_INDIRECT_BUFFER: case eGL_DISPATCH_INDIRECT_BUFFER: - case eGL_PARAMETER_BUFFER_ARB: ret.creationFlags = eBufferCreate_Indirect; break; + case eGL_PARAMETER_BUFFER_ARB: ret.creationFlags = BufferCategory::Indirect; break; case eGL_PIXEL_PACK_BUFFER: case eGL_PIXEL_UNPACK_BUFFER: case eGL_COPY_WRITE_BUFFER: @@ -919,83 +919,83 @@ void GLReplay::SavePipelineState() default: case eGL_BYTE: fmt.compByteWidth = 1; - fmt.compType = intComponent ? eCompType_SInt : eCompType_SNorm; + fmt.compType = intComponent ? CompType::SInt : CompType::SNorm; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_BYTE%d", fmt.compCount) : string("GL_BYTE")) + (intComponent ? "" : "_SNORM"); break; case eGL_UNSIGNED_BYTE: fmt.compByteWidth = 1; - fmt.compType = intComponent ? eCompType_UInt : eCompType_UNorm; + fmt.compType = intComponent ? CompType::UInt : CompType::UNorm; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_UNSIGNED_BYTE%d", fmt.compCount) : string("GL_UNSIGNED_BYTE")) + (intComponent ? "" : "_UNORM"); break; case eGL_SHORT: fmt.compByteWidth = 2; - fmt.compType = intComponent ? eCompType_SInt : eCompType_SNorm; + fmt.compType = intComponent ? CompType::SInt : CompType::SNorm; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_SHORT%d", fmt.compCount) : string("GL_SHORT")) + (intComponent ? "" : "_SNORM"); break; case eGL_UNSIGNED_SHORT: fmt.compByteWidth = 2; - fmt.compType = intComponent ? eCompType_UInt : eCompType_UNorm; + fmt.compType = intComponent ? CompType::UInt : CompType::UNorm; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_UNSIGNED_SHORT%d", fmt.compCount) : string("GL_UNSIGNED_SHORT")) + (intComponent ? "" : "_UNORM"); break; case eGL_INT: fmt.compByteWidth = 4; - fmt.compType = intComponent ? eCompType_SInt : eCompType_SNorm; + fmt.compType = intComponent ? CompType::SInt : CompType::SNorm; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_INT%d", fmt.compCount) : string("GL_INT")) + (intComponent ? "" : "_SNORM"); break; case eGL_UNSIGNED_INT: fmt.compByteWidth = 4; - fmt.compType = intComponent ? eCompType_UInt : eCompType_UNorm; + fmt.compType = intComponent ? CompType::UInt : CompType::UNorm; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_UNSIGNED_INT%d", fmt.compCount) : string("GL_UNSIGNED_INT")) + (intComponent ? "" : "_UNORM"); break; case eGL_FLOAT: fmt.compByteWidth = 4; - fmt.compType = eCompType_Float; + fmt.compType = CompType::Float; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_FLOAT%d", fmt.compCount) : string("GL_FLOAT")); break; case eGL_DOUBLE: fmt.compByteWidth = 8; - fmt.compType = eCompType_Double; + fmt.compType = CompType::Double; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_DOUBLE%d", fmt.compCount) : string("GL_DOUBLE")); break; case eGL_HALF_FLOAT: fmt.compByteWidth = 2; - fmt.compType = eCompType_Float; + fmt.compType = CompType::Float; fmt.strname = (fmt.compCount > 1 ? StringFormat::Fmt("GL_HALF_FLOAT%d", fmt.compCount) : string("GL_HALF_FLOAT")); break; case eGL_INT_2_10_10_10_REV: fmt.special = true; - fmt.specialFormat = eSpecial_R10G10B10A2; + fmt.specialFormat = SpecialFormat::R10G10B10A2; fmt.compCount = 4; - fmt.compType = eCompType_UInt; + fmt.compType = CompType::UInt; fmt.strname = "GL_INT_2_10_10_10_REV"; break; case eGL_UNSIGNED_INT_2_10_10_10_REV: fmt.special = true; - fmt.specialFormat = eSpecial_R10G10B10A2; + fmt.specialFormat = SpecialFormat::R10G10B10A2; fmt.compCount = 4; - fmt.compType = eCompType_SInt; + fmt.compType = CompType::SInt; fmt.strname = "GL_UNSIGNED_INT_2_10_10_10_REV"; break; case eGL_UNSIGNED_INT_10F_11F_11F_REV: fmt.special = true; - fmt.specialFormat = eSpecial_R11G11B10; + fmt.specialFormat = SpecialFormat::R11G11B10; fmt.compCount = 3; - fmt.compType = eCompType_Float; + fmt.compType = CompType::Float; fmt.strname = "GL_UNSIGNED_INT_10F_11F_11F_REV"; break; } @@ -1005,7 +1005,7 @@ void GLReplay::SavePipelineState() fmt.compByteWidth = 1; fmt.compCount = 4; fmt.bgraOrder = true; - fmt.compType = eCompType_UNorm; + fmt.compType = CompType::UNorm; if(type == eGL_UNSIGNED_BYTE) { @@ -1013,8 +1013,8 @@ void GLReplay::SavePipelineState() } else if(type == eGL_UNSIGNED_INT_2_10_10_10_REV || type == eGL_INT_2_10_10_10_REV) { - fmt.specialFormat = eSpecial_R10G10B10A2; - fmt.compType = type == eGL_UNSIGNED_INT_2_10_10_10_REV ? eCompType_UInt : eCompType_SInt; + fmt.specialFormat = SpecialFormat::R10G10B10A2; + fmt.compType = type == eGL_UNSIGNED_INT_2_10_10_10_REV ? CompType::UInt : CompType::SInt; fmt.strname = type == eGL_UNSIGNED_INT_2_10_10_10_REV ? "GL_UNSIGNED_INT_2_10_10_10_REV" : "GL_INT_2_10_10_10_REV"; } @@ -1053,17 +1053,17 @@ void GLReplay::SavePipelineState() GLenum activeTexture = eGL_TEXTURE0; gl.glGetIntegerv(eGL_ACTIVE_TEXTURE, (GLint *)&activeTexture); - pipe.m_VS.stage = eShaderStage_Vertex; - pipe.m_TCS.stage = eShaderStage_Tess_Control; - pipe.m_TES.stage = eShaderStage_Tess_Eval; - pipe.m_GS.stage = eShaderStage_Geometry; - pipe.m_FS.stage = eShaderStage_Fragment; - pipe.m_CS.stage = eShaderStage_Compute; + pipe.m_VS.stage = ShaderStage::Vertex; + pipe.m_TCS.stage = ShaderStage::Tess_Control; + pipe.m_TES.stage = ShaderStage::Tess_Eval; + pipe.m_GS.stage = ShaderStage::Geometry; + pipe.m_FS.stage = ShaderStage::Fragment; + pipe.m_CS.stage = ShaderStage::Compute; GLuint curProg = 0; gl.glGetIntegerv(eGL_CURRENT_PROGRAM, (GLint *)&curProg); - GLPipelineState::ShaderStage *stages[6] = { + GLPipelineState::Shader *stages[6] = { &pipe.m_VS, &pipe.m_TCS, &pipe.m_TES, &pipe.m_GS, &pipe.m_FS, &pipe.m_CS, }; ShaderReflection *refls[6] = {NULL}; @@ -1071,7 +1071,7 @@ void GLReplay::SavePipelineState() for(int i = 0; i < 6; i++) { - stages[i]->Shader = ResourceId(); + stages[i]->Object = ResourceId(); stages[i]->ShaderDetails = NULL; stages[i]->BindpointMapping.ConstantBlocks.Delete(); stages[i]->BindpointMapping.ReadOnlyResources.Delete(); @@ -1106,7 +1106,7 @@ void GLReplay::SavePipelineState() if(pipeDetails.stageShaders[i] != ResourceId()) { curProg = rm->GetCurrentResource(pipeDetails.stagePrograms[i]).name; - stages[i]->Shader = rm->GetOriginalID(pipeDetails.stageShaders[i]); + stages[i]->Object = rm->GetOriginalID(pipeDetails.stageShaders[i]); refls[i] = GetShader(pipeDetails.stageShaders[i], ""); GetBindpointMapping(gl.GetHookset(), curProg, (int)i, refls[i], stages[i]->BindpointMapping); @@ -1120,7 +1120,7 @@ void GLReplay::SavePipelineState() } else { - stages[i]->Shader = ResourceId(); + stages[i]->Object = ResourceId(); } } } @@ -1139,7 +1139,7 @@ void GLReplay::SavePipelineState() stages[i]->ProgramName = programName; stages[i]->customProgramName = (programName != ""); - stages[i]->Shader = rm->GetOriginalID(progDetails.stageShaders[i]); + stages[i]->Object = rm->GetOriginalID(progDetails.stageShaders[i]); refls[i] = GetShader(progDetails.stageShaders[i], ""); GetBindpointMapping(gl.GetHookset(), curProg, (int)i, refls[i], stages[i]->BindpointMapping); mappings[i] = &stages[i]->BindpointMapping; @@ -1215,7 +1215,7 @@ void GLReplay::SavePipelineState() { GLenum binding = eGL_NONE; GLenum target = eGL_NONE; - ShaderResourceType resType = eResType_None; + TextureDim resType = TextureDim::Unknown; bool shadow = false; @@ -1236,19 +1236,19 @@ void GLReplay::SavePipelineState() switch(refls[s]->ReadOnlyResources[r].resType) { - case eResType_None: target = eGL_NONE; break; - case eResType_Buffer: target = eGL_TEXTURE_BUFFER; break; - case eResType_Texture1D: target = eGL_TEXTURE_1D; break; - case eResType_Texture1DArray: target = eGL_TEXTURE_1D_ARRAY; break; - case eResType_Texture2D: target = eGL_TEXTURE_2D; break; - case eResType_TextureRect: target = eGL_TEXTURE_RECTANGLE; break; - case eResType_Texture2DArray: target = eGL_TEXTURE_2D_ARRAY; break; - case eResType_Texture2DMS: target = eGL_TEXTURE_2D_MULTISAMPLE; break; - case eResType_Texture2DMSArray: target = eGL_TEXTURE_2D_MULTISAMPLE_ARRAY; break; - case eResType_Texture3D: target = eGL_TEXTURE_3D; break; - case eResType_TextureCube: target = eGL_TEXTURE_CUBE_MAP; break; - case eResType_TextureCubeArray: target = eGL_TEXTURE_CUBE_MAP_ARRAY; break; - case eResType_Count: RDCERR("Invalid shader resource type"); break; + case TextureDim::Unknown: target = eGL_NONE; break; + case TextureDim::Buffer: target = eGL_TEXTURE_BUFFER; break; + case TextureDim::Texture1D: target = eGL_TEXTURE_1D; break; + case TextureDim::Texture1DArray: target = eGL_TEXTURE_1D_ARRAY; break; + case TextureDim::Texture2D: target = eGL_TEXTURE_2D; break; + case TextureDim::TextureRect: target = eGL_TEXTURE_RECTANGLE; break; + case TextureDim::Texture2DArray: target = eGL_TEXTURE_2D_ARRAY; break; + case TextureDim::Texture2DMS: target = eGL_TEXTURE_2D_MULTISAMPLE; break; + case TextureDim::Texture2DMSArray: target = eGL_TEXTURE_2D_MULTISAMPLE_ARRAY; break; + case TextureDim::Texture3D: target = eGL_TEXTURE_3D; break; + case TextureDim::TextureCube: target = eGL_TEXTURE_CUBE_MAP; break; + case TextureDim::TextureCubeArray: target = eGL_TEXTURE_CUBE_MAP_ARRAY; break; + case TextureDim::Count: RDCERR("Invalid shader resource type"); break; } if(target != eGL_NONE) @@ -1289,12 +1289,12 @@ void GLReplay::SavePipelineState() { pipe.Textures[unit].Resource = ResourceId(); pipe.Textures[unit].FirstSlice = 0; - pipe.Textures[unit].ResType = eResType_None; + pipe.Textures[unit].ResType = TextureDim::Unknown; pipe.Textures[unit].DepthReadChannel = -1; - pipe.Textures[unit].Swizzle[0] = eSwizzle_Red; - pipe.Textures[unit].Swizzle[1] = eSwizzle_Green; - pipe.Textures[unit].Swizzle[2] = eSwizzle_Blue; - pipe.Textures[unit].Swizzle[3] = eSwizzle_Alpha; + pipe.Textures[unit].Swizzle[0] = TextureSwizzle::Red; + pipe.Textures[unit].Swizzle[1] = TextureSwizzle::Green; + pipe.Textures[unit].Swizzle[2] = TextureSwizzle::Blue; + pipe.Textures[unit].Swizzle[3] = TextureSwizzle::Alpha; RDCEraseEl(pipe.Samplers[unit].BorderColor); pipe.Samplers[unit].AddressS = ""; @@ -1357,12 +1357,12 @@ void GLReplay::SavePipelineState() switch(swizzles[i]) { default: - case GL_ZERO: pipe.Textures[unit].Swizzle[i] = eSwizzle_Zero; break; - case GL_ONE: pipe.Textures[unit].Swizzle[i] = eSwizzle_One; break; - case eGL_RED: pipe.Textures[unit].Swizzle[i] = eSwizzle_Red; break; - case eGL_GREEN: pipe.Textures[unit].Swizzle[i] = eSwizzle_Green; break; - case eGL_BLUE: pipe.Textures[unit].Swizzle[i] = eSwizzle_Blue; break; - case eGL_ALPHA: pipe.Textures[unit].Swizzle[i] = eSwizzle_Alpha; break; + case GL_ZERO: pipe.Textures[unit].Swizzle[i] = TextureSwizzle::Zero; break; + case GL_ONE: pipe.Textures[unit].Swizzle[i] = TextureSwizzle::One; break; + case eGL_RED: pipe.Textures[unit].Swizzle[i] = TextureSwizzle::Red; break; + case eGL_GREEN: pipe.Textures[unit].Swizzle[i] = TextureSwizzle::Green; break; + case eGL_BLUE: pipe.Textures[unit].Swizzle[i] = TextureSwizzle::Blue; break; + case eGL_ALPHA: pipe.Textures[unit].Swizzle[i] = TextureSwizzle::Alpha; break; } } @@ -1610,15 +1610,15 @@ void GLReplay::SavePipelineState() RDCWARN("Unexpected value for POLYGON_MODE %x", rs.PolygonMode); // fall through case eGL_FILL: - pipe.m_Rasterizer.m_State.FillMode = eFill_Solid; + pipe.m_Rasterizer.m_State.fillMode = FillMode::Solid; polygonOffsetEnableEnum = GLRenderState::eEnabled_PolyOffsetFill; break; case eGL_LINE: - pipe.m_Rasterizer.m_State.FillMode = eFill_Wireframe; + pipe.m_Rasterizer.m_State.fillMode = FillMode::Wireframe; polygonOffsetEnableEnum = GLRenderState::eEnabled_PolyOffsetLine; break; case eGL_POINT: - pipe.m_Rasterizer.m_State.FillMode = eFill_Point; + pipe.m_Rasterizer.m_State.fillMode = FillMode::Point; polygonOffsetEnableEnum = GLRenderState::eEnabled_PolyOffsetPoint; break; } @@ -1642,14 +1642,14 @@ void GLReplay::SavePipelineState() default: RDCWARN("Unexpected value for CULL_FACE %x", rs.CullFace); // fall through - case eGL_BACK: pipe.m_Rasterizer.m_State.CullMode = eCull_Back; break; - case eGL_FRONT: pipe.m_Rasterizer.m_State.CullMode = eCull_Front; break; - case eGL_FRONT_AND_BACK: pipe.m_Rasterizer.m_State.CullMode = eCull_FrontAndBack; break; + case eGL_BACK: pipe.m_Rasterizer.m_State.cullMode = CullMode::Back; break; + case eGL_FRONT: pipe.m_Rasterizer.m_State.cullMode = CullMode::Front; break; + case eGL_FRONT_AND_BACK: pipe.m_Rasterizer.m_State.cullMode = CullMode::FrontAndBack; break; } } else { - pipe.m_Rasterizer.m_State.CullMode = eCull_None; + pipe.m_Rasterizer.m_State.cullMode = CullMode::NoCull; } RDCASSERT(rs.FrontFace == eGL_CCW || rs.FrontFace == eGL_CW); @@ -1781,12 +1781,12 @@ void GLReplay::SavePipelineState() switch(swizzles[s]) { default: - case GL_ZERO: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = eSwizzle_Zero; break; - case GL_ONE: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = eSwizzle_One; break; - case eGL_RED: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = eSwizzle_Red; break; - case eGL_GREEN: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = eSwizzle_Green; break; - case eGL_BLUE: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = eSwizzle_Blue; break; - case eGL_ALPHA: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = eSwizzle_Alpha; break; + case GL_ZERO: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = TextureSwizzle::Zero; break; + case GL_ONE: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = TextureSwizzle::One; break; + case eGL_RED: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = TextureSwizzle::Red; break; + case eGL_GREEN: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = TextureSwizzle::Green; break; + case eGL_BLUE: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = TextureSwizzle::Blue; break; + case eGL_ALPHA: pipe.m_FB.m_DrawFBO.Color[i].Swizzle[s] = TextureSwizzle::Alpha; break; } } } @@ -1930,33 +1930,33 @@ void GLReplay::SavePipelineState() switch(rs.Hints.Derivatives) { default: - case eGL_DONT_CARE: pipe.m_Hints.Derivatives = eQuality_DontCare; break; - case eGL_NICEST: pipe.m_Hints.Derivatives = eQuality_Nicest; break; - case eGL_FASTEST: pipe.m_Hints.Derivatives = eQuality_Fastest; break; + case eGL_DONT_CARE: pipe.m_Hints.Derivatives = QualityHint::DontCare; break; + case eGL_NICEST: pipe.m_Hints.Derivatives = QualityHint::Nicest; break; + case eGL_FASTEST: pipe.m_Hints.Derivatives = QualityHint::Fastest; break; } switch(rs.Hints.LineSmooth) { default: - case eGL_DONT_CARE: pipe.m_Hints.LineSmooth = eQuality_DontCare; break; - case eGL_NICEST: pipe.m_Hints.LineSmooth = eQuality_Nicest; break; - case eGL_FASTEST: pipe.m_Hints.LineSmooth = eQuality_Fastest; break; + case eGL_DONT_CARE: pipe.m_Hints.LineSmooth = QualityHint::DontCare; break; + case eGL_NICEST: pipe.m_Hints.LineSmooth = QualityHint::Nicest; break; + case eGL_FASTEST: pipe.m_Hints.LineSmooth = QualityHint::Fastest; break; } switch(rs.Hints.PolySmooth) { default: - case eGL_DONT_CARE: pipe.m_Hints.PolySmooth = eQuality_DontCare; break; - case eGL_NICEST: pipe.m_Hints.PolySmooth = eQuality_Nicest; break; - case eGL_FASTEST: pipe.m_Hints.PolySmooth = eQuality_Fastest; break; + case eGL_DONT_CARE: pipe.m_Hints.PolySmooth = QualityHint::DontCare; break; + case eGL_NICEST: pipe.m_Hints.PolySmooth = QualityHint::Nicest; break; + case eGL_FASTEST: pipe.m_Hints.PolySmooth = QualityHint::Fastest; break; } switch(rs.Hints.TexCompression) { default: - case eGL_DONT_CARE: pipe.m_Hints.TexCompression = eQuality_DontCare; break; - case eGL_NICEST: pipe.m_Hints.TexCompression = eQuality_Nicest; break; - case eGL_FASTEST: pipe.m_Hints.TexCompression = eQuality_Fastest; break; + case eGL_DONT_CARE: pipe.m_Hints.TexCompression = QualityHint::DontCare; break; + case eGL_NICEST: pipe.m_Hints.TexCompression = QualityHint::Nicest; break; + case eGL_FASTEST: pipe.m_Hints.TexCompression = QualityHint::Fastest; break; } pipe.m_Hints.LineSmoothEnabled = rs.Enabled[GLRenderState::eEnabled_LineSmooth]; @@ -2010,17 +2010,17 @@ void GLReplay::FillCBufferValue(WrappedOpenGL &gl, GLuint prog, bool bufferBacke { switch(outVar.type) { - case eVar_Unknown: - case eVar_Float: gl.glGetUniformfv(prog, offs, outVar.value.fv); break; - case eVar_Int: gl.glGetUniformiv(prog, offs, outVar.value.iv); break; - case eVar_UInt: gl.glGetUniformuiv(prog, offs, outVar.value.uv); break; - case eVar_Double: gl.glGetUniformdv(prog, offs, outVar.value.dv); break; + case VarType::Unknown: + case VarType::Float: gl.glGetUniformfv(prog, offs, outVar.value.fv); break; + case VarType::Int: gl.glGetUniformiv(prog, offs, outVar.value.iv); break; + case VarType::UInt: gl.glGetUniformuiv(prog, offs, outVar.value.uv); break; + case VarType::Double: gl.glGetUniformdv(prog, offs, outVar.value.dv); break; } } if(!rowMajor) { - if(outVar.type != eVar_Double) + if(outVar.type != VarType::Double) { uint32_t uv[16]; memcpy(&uv[0], &outVar.value.uv[0], sizeof(uv)); @@ -2304,7 +2304,7 @@ byte *GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true; texDisplay.HDRMul = -1.0f; texDisplay.linearDisplayAsGamma = false; - texDisplay.overlay = eTexOverlay_None; + texDisplay.overlay = DebugOverlay::NoOverlay; texDisplay.FlipY = false; texDisplay.mip = mip; texDisplay.sampleIdx = ~0U; @@ -2314,7 +2314,7 @@ byte *GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, texDisplay.rangemax = params.whitePoint; texDisplay.scale = 1.0f; texDisplay.texid = tex; - texDisplay.typeHint = eCompType_None; + texDisplay.typeHint = CompType::Typeless; texDisplay.rawoutput = false; texDisplay.offx = 0; texDisplay.offy = 0; @@ -2586,7 +2586,7 @@ byte *GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, } void GLReplay::BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { if(id == NULL || errors == NULL) { @@ -2602,12 +2602,12 @@ void GLReplay::BuildCustomShader(string source, string entry, const uint32_t com GLenum shtype = eGL_VERTEX_SHADER; switch(type) { - case eShaderStage_Vertex: shtype = eGL_VERTEX_SHADER; break; - case eShaderStage_Tess_Control: shtype = eGL_TESS_CONTROL_SHADER; break; - case eShaderStage_Tess_Eval: shtype = eGL_TESS_EVALUATION_SHADER; break; - case eShaderStage_Geometry: shtype = eGL_GEOMETRY_SHADER; break; - case eShaderStage_Fragment: shtype = eGL_FRAGMENT_SHADER; break; - case eShaderStage_Compute: shtype = eGL_COMPUTE_SHADER; break; + case ShaderStage::Vertex: shtype = eGL_VERTEX_SHADER; break; + case ShaderStage::Tess_Control: shtype = eGL_TESS_CONTROL_SHADER; break; + case ShaderStage::Tess_Eval: shtype = eGL_TESS_EVALUATION_SHADER; break; + case ShaderStage::Geometry: shtype = eGL_GEOMETRY_SHADER; break; + case ShaderStage::Fragment: shtype = eGL_FRAGMENT_SHADER; break; + case ShaderStage::Compute: shtype = eGL_COMPUTE_SHADER; break; default: { RDCERR("Unknown shader type %u", type); @@ -2641,8 +2641,7 @@ void GLReplay::BuildCustomShader(string source, string entry, const uint32_t com } ResourceId GLReplay::ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, - uint32_t arrayIdx, uint32_t sampleIdx, - FormatComponentType typeHint) + uint32_t arrayIdx, uint32_t sampleIdx, CompType typeHint) { if(shader == ResourceId() || texid == ResourceId()) return ResourceId(); @@ -2679,7 +2678,7 @@ ResourceId GLReplay::ApplyCustomShader(ResourceId shader, ResourceId texid, uint disp.linearDisplayAsGamma = false; disp.mip = mip; disp.sampleIdx = sampleIdx; - disp.overlay = eTexOverlay_None; + disp.overlay = DebugOverlay::NoOverlay; disp.rangemin = 0.0f; disp.rangemax = 1.0f; disp.rawoutput = false; @@ -2738,7 +2737,7 @@ void GLReplay::FreeCustomShader(ResourceId id) } void GLReplay::BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { if(id == NULL || errors == NULL) { @@ -2754,12 +2753,12 @@ void GLReplay::BuildTargetShader(string source, string entry, const uint32_t com GLenum shtype = eGL_VERTEX_SHADER; switch(type) { - case eShaderStage_Vertex: shtype = eGL_VERTEX_SHADER; break; - case eShaderStage_Tess_Control: shtype = eGL_TESS_CONTROL_SHADER; break; - case eShaderStage_Tess_Eval: shtype = eGL_TESS_EVALUATION_SHADER; break; - case eShaderStage_Geometry: shtype = eGL_GEOMETRY_SHADER; break; - case eShaderStage_Fragment: shtype = eGL_FRAGMENT_SHADER; break; - case eShaderStage_Compute: shtype = eGL_COMPUTE_SHADER; break; + case ShaderStage::Vertex: shtype = eGL_VERTEX_SHADER; break; + case ShaderStage::Tess_Control: shtype = eGL_TESS_CONTROL_SHADER; break; + case ShaderStage::Tess_Eval: shtype = eGL_TESS_EVALUATION_SHADER; break; + case ShaderStage::Geometry: shtype = eGL_GEOMETRY_SHADER; break; + case ShaderStage::Fragment: shtype = eGL_FRAGMENT_SHADER; break; + case ShaderStage::Compute: shtype = eGL_COMPUTE_SHADER; break; default: { RDCERR("Unknown shader type %u", type); @@ -2835,9 +2834,9 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) switch(templateTex.resType) { - case eResType_None: break; - case eResType_Buffer: - case eResType_Texture1D: + case TextureDim::Unknown: break; + case TextureDim::Buffer: + case TextureDim::Texture1D: { binding = eGL_TEXTURE_1D; gl.glBindTexture(eGL_TEXTURE_1D, tex); @@ -2850,7 +2849,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) } break; } - case eResType_Texture1DArray: + case TextureDim::Texture1DArray: { binding = eGL_TEXTURE_1D_ARRAY; gl.glBindTexture(eGL_TEXTURE_1D_ARRAY, tex); @@ -2863,8 +2862,8 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) } break; } - case eResType_TextureRect: - case eResType_Texture2D: + case TextureDim::TextureRect: + case TextureDim::Texture2D: { binding = eGL_TEXTURE_2D; gl.glBindTexture(eGL_TEXTURE_2D, tex); @@ -2879,7 +2878,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) } break; } - case eResType_Texture2DArray: + case TextureDim::Texture2DArray: { binding = eGL_TEXTURE_2D_ARRAY; gl.glBindTexture(eGL_TEXTURE_2D_ARRAY, tex); @@ -2894,7 +2893,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) } break; } - case eResType_Texture2DMS: + case TextureDim::Texture2DMS: { binding = eGL_TEXTURE_2D_MULTISAMPLE; gl.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE, tex); @@ -2902,7 +2901,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) intFormat, templateTex.width, templateTex.height, GL_TRUE); break; } - case eResType_Texture2DMSArray: + case TextureDim::Texture2DMSArray: { binding = eGL_TEXTURE_2D_MULTISAMPLE_ARRAY; gl.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex); @@ -2911,7 +2910,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) templateTex.arraysize, GL_TRUE); break; } - case eResType_Texture3D: + case TextureDim::Texture3D: { binding = eGL_TEXTURE_3D; gl.glBindTexture(eGL_TEXTURE_3D, tex); @@ -2928,7 +2927,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) } break; } - case eResType_TextureCube: + case TextureDim::TextureCube: { binding = eGL_TEXTURE_CUBE_MAP; gl.glBindTexture(eGL_TEXTURE_CUBE_MAP, tex); @@ -2953,7 +2952,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) } break; } - case eResType_TextureCubeArray: + case TextureDim::TextureCubeArray: { binding = eGL_TEXTURE_CUBE_MAP_ARRAY; gl.glBindTexture(eGL_TEXTURE_CUBE_MAP_ARRAY, tex); @@ -2968,7 +2967,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex) } break; } - case eResType_Count: + case TextureDim::Count: { RDCERR("Invalid shader resource type"); break; @@ -3147,13 +3146,13 @@ ResourceId GLReplay::CreateProxyBuffer(const FetchBuffer &templateBuf) GLenum target = eGL_ARRAY_BUFFER; - if(templateBuf.creationFlags & eBufferCreate_Indirect) + if(templateBuf.creationFlags & BufferCategory::Indirect) target = eGL_DRAW_INDIRECT_BUFFER; - if(templateBuf.creationFlags & eBufferCreate_IB) + if(templateBuf.creationFlags & BufferCategory::Index) target = eGL_ELEMENT_ARRAY_BUFFER; - if(templateBuf.creationFlags & eBufferCreate_CB) + if(templateBuf.creationFlags & BufferCategory::Constants) target = eGL_UNIFORM_BUFFER; - if(templateBuf.creationFlags & eBufferCreate_UAV) + if(templateBuf.creationFlags & BufferCategory::ReadWrite) target = eGL_SHADER_STORAGE_BUFFER; GLuint buf = 0; @@ -3184,8 +3183,8 @@ vector GLReplay::GetUsage(ResourceId id) #pragma endregion vector GLReplay::PixelHistory(vector events, ResourceId target, - uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint) + uint32_t x, uint32_t y, uint32_t slice, + uint32_t mip, uint32_t sampleIdx, CompType typeHint) { GLNOTIMP("GLReplay::PixelHistory"); return vector(); @@ -3237,7 +3236,7 @@ uint64_t GLReplay::MakeOutputWindow(WindowingSystem system, void *data, bool dep { OutputWindow win = m_pDriver->m_Platform.MakeOutputWindow(system, data, depth, m_ReplayCtx); if(!win.wnd) - return eReplayCreate_APIInitFailed; + return 0; m_pDriver->m_Platform.GetOutputWindowDimensions(win, win.width, win.height); @@ -3291,7 +3290,7 @@ bool GLReplay::IsOutputWindowVisible(uint64_t id) #if defined(RENDERDOC_SUPPORT_GL) // defined in gl_replay_.cpp -ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver); +ReplayStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver); static DriverRegistration GLDriverRegistration(RDC_OpenGL, "OpenGL", &GL_CreateReplayDevice); @@ -3300,7 +3299,7 @@ static DriverRegistration GLDriverRegistration(RDC_OpenGL, "OpenGL", &GL_CreateR #if defined(RENDERDOC_SUPPORT_GLES) // defined in gl_replay_egl.cpp -ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver **driver); +ReplayStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver **driver); static DriverRegistration GLESDriverRegistration(RDC_OpenGLES, "OpenGLES", &GLES_CreateReplayDevice); diff --git a/renderdoc/driver/gl/gl_replay.h b/renderdoc/driver/gl/gl_replay.h index 5a95c1331..e80b75af9 100644 --- a/renderdoc/driver/gl/gl_replay.h +++ b/renderdoc/driver/gl/gl_replay.h @@ -48,7 +48,7 @@ struct GLPostVSData struct StageData { GLuint buf = 0; - PrimitiveTopology topo = eTopology_Unknown; + Topology topo = Topology::Unknown; uint32_t vertStride = 0; @@ -71,9 +71,9 @@ struct GLPostVSData const StageData &GetStage(MeshDataStage type) { - if(type == eMeshDataStage_VSOut) + if(type == MeshDataStage::VSOut) return vsout; - else if(type == eMeshDataStage_GSOut) + else if(type == MeshDataStage::GSOut) return gsout; else RDCERR("Unexpected mesh data stage!"); @@ -127,7 +127,7 @@ public: // free to use XCB internally but it would have to create a hybrid and // initialise XCB out of Xlib, to be able to provide the display and // drawable to us. - ret.push_back(eWindowingSystem_Xlib); + ret.push_back(WindowingSystem::Xlib); return ret; } @@ -147,9 +147,9 @@ public: ResourceId GetLiveID(ResourceId id); bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval); + CompType typeHint, float *minval, float *maxval); bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram); MeshFormat GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDataStage stage); @@ -161,16 +161,16 @@ public: void ReplaceResource(ResourceId from, ResourceId to); void RemoveReplacement(ResourceId id); - vector EnumerateCounters(); - void DescribeCounter(uint32_t counterID, CounterDescription &desc); - vector FetchCounters(const vector &counters); + vector EnumerateCounters(); + void DescribeCounter(GPUCounter counterID, CounterDescription &desc); + vector FetchCounters(const vector &counters); void RenderMesh(uint32_t eventID, const vector &secondaryDraws, const MeshDisplay &cfg); - void BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); - void BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); + void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); + void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); void FreeCustomShader(ResourceId id); enum TexDisplayFlags @@ -191,20 +191,20 @@ public: vector PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ShaderDebugTrace DebugVertex(uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset); ShaderDebugTrace DebugPixel(uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive); ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]); + uint32_t sample, CompType typeHint, float pixel[4]); uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y); - ResourceId RenderOverlay(ResourceId id, FormatComponentType typeHint, TextureDisplayOverlay overlay, - uint32_t eventID, const vector &passEvents); + ResourceId RenderOverlay(ResourceId id, CompType typeHint, DebugOverlay overlay, uint32_t eventID, + const vector &passEvents); ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ResourceId CreateProxyTexture(const FetchTexture &templateTex); void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data, @@ -367,7 +367,7 @@ private: // mesh, not jumping back and forth much between meshes. struct HighlightCache { - HighlightCache() : EID(0), buf(), offs(0), stage(eMeshDataStage_Unknown), useidx(false) {} + HighlightCache() : EID(0), buf(), offs(0), stage(MeshDataStage::Unknown), useidx(false) {} uint32_t EID; ResourceId buf; uint64_t offs; @@ -392,7 +392,7 @@ private: void PreContextShutdownCounters(); void FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnode, - const vector &counters); + const vector &counters); GLuint CreateShaderProgram(const vector &vs, const vector &fs, const vector &gs); diff --git a/renderdoc/driver/gl/gl_replay_apple.cpp b/renderdoc/driver/gl/gl_replay_apple.cpp index 955726f49..a7ab6f86c 100644 --- a/renderdoc/driver/gl/gl_replay_apple.cpp +++ b/renderdoc/driver/gl/gl_replay_apple.cpp @@ -26,8 +26,8 @@ #include "gl_driver.h" #include "gl_resources.h" -ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCUNIMPLEMENTED("GL_CreateReplayDevice"); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } diff --git a/renderdoc/driver/gl/gl_replay_egl.cpp b/renderdoc/driver/gl/gl_replay_egl.cpp index fe80f716a..eaad0fef2 100644 --- a/renderdoc/driver/gl/gl_replay_egl.cpp +++ b/renderdoc/driver/gl/gl_replay_egl.cpp @@ -64,7 +64,7 @@ PFN_eglGetProcAddress eglGetProcAddressProc = NULL; const GLHookSet &GetRealGLFunctionsEGL(); GLPlatform &GetGLPlatformEGL(); -ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCDEBUG("Creating an OpenGL ES replay device"); @@ -96,7 +96,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** RDCERR( "Couldn't find required function addresses, eglGetProcAddress eglCreateContext" "eglSwapBuffers (etc.)"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } } @@ -109,7 +109,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** { auto status = RenderDoc::Inst().FillInitParams(logfile, driverType, driverName, machineIdent, (RDCInitParams *)&initParams); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) return status; } @@ -123,7 +123,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** if(dpy == NULL) { RDCERR("Couldn't open default X display"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } #endif @@ -133,7 +133,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** if(!eglDisplay) { RDCERR("Couldn't open default EGL display"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } int major, minor; @@ -156,7 +156,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** if(!eglChooseConfigProc(eglDisplay, configAttribs, &config, 1, &numConfigs)) { RDCERR("Couldn't find a suitable EGL config"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } static const EGLint ctxAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_CONTEXT_FLAGS_KHR, @@ -172,7 +172,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** #endif GLReplay::PostContextShutdownCounters(); RDCERR("Couldn't create GL ES 3.x context - RenderDoc requires OpenGL ES 3.x availability"); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } static const EGLint pbAttribs[] = {EGL_WIDTH, 32, EGL_HEIGHT, 32, EGL_NONE}; @@ -186,7 +186,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** XCloseDisplay(dpy); #endif GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } EGLBoolean res = eglMakeCurrentProc(eglDisplay, pbuffer, pbuffer, ctx); @@ -199,7 +199,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** XCloseDisplay(dpy); #endif GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } // TODO: add extesion check just like in the GL case. @@ -214,7 +214,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** XCloseDisplay(dpy); #endif GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } WrappedOpenGL *gl = new WrappedOpenGL(logfile, real, GetGLPlatformEGL()); @@ -224,7 +224,7 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** if(gl->GetSerialiser()->HasError()) { delete gl; - return eReplayCreate_FileIOFailed; + return ReplayStatus::FileIOFailed; } RDCLOG("Created OPEN GL ES replay device."); @@ -237,5 +237,5 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver ** replay->SetReplayData(data); *driver = (IReplayDriver *)replay; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } diff --git a/renderdoc/driver/gl/gl_replay_linux.cpp b/renderdoc/driver/gl/gl_replay_linux.cpp index fcdd0db55..96ad424ad 100644 --- a/renderdoc/driver/gl/gl_replay_linux.cpp +++ b/renderdoc/driver/gl/gl_replay_linux.cpp @@ -53,7 +53,7 @@ int NonFatalX11ErrorHandler(Display *display, XErrorEvent *error) typedef int (*X11ErrorHandler)(Display *display, XErrorEvent *error); -ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCDEBUG("Creating an OpenGL replay device"); @@ -74,7 +74,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr RDCERR( "Couldn't find required entry points, glXGetProcAddress glXDestroyContext " "glXSwapBuffers"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } glXCreateContextAttribsProc = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetFuncProc( @@ -86,7 +86,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr { RDCERR( "Couldn't get glx function addresses, glXCreateContextAttribsARB glXMakeContextCurrent"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } } @@ -98,7 +98,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr { auto status = RenderDoc::Inst().FillInitParams(logfile, driverType, driverName, machineIdent, (RDCInitParams *)&initParams); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) return status; } @@ -127,7 +127,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(dpy == NULL) { RDCERR("Couldn't open default X display"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } // don't need to care about the fb config as we won't be using the default framebuffer @@ -141,7 +141,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr XCloseDisplay(dpy); GLReplay::PostContextShutdownCounters(); RDCERR("Couldn't choose default framebuffer config"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } GLXContext ctx = NULL; @@ -180,7 +180,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr XCloseDisplay(dpy); GLReplay::PostContextShutdownCounters(); RDCERR("Couldn't create 3.2 context - RenderDoc requires OpenGL 3.2 availability"); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } GLCoreVersion = major * 10 + minor; @@ -202,7 +202,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr XCloseDisplay(dpy); GLReplay::PostContextShutdownCounters(); RDCERR("Couldn't make pbuffer & context current"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } PFNGLGETINTEGERVPROC getInt = @@ -220,7 +220,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr XFree(fbcfg); XCloseDisplay(dpy); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } const GLHookSet &real = GetRealGLFunctions(); @@ -235,7 +235,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr XFree(fbcfg); XCloseDisplay(dpy); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } bool extensionsValidated = ValidateFunctionPointers(real); @@ -247,7 +247,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr XFree(fbcfg); XCloseDisplay(dpy); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } WrappedOpenGL *gl = new WrappedOpenGL(logfile, real, GetGLPlatform()); @@ -256,7 +256,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(gl->GetSerialiser()->HasError()) { delete gl; - return eReplayCreate_FileIOFailed; + return ReplayStatus::FileIOFailed; } RDCLOG("Created device."); @@ -269,5 +269,5 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr replay->SetReplayData(data); *driver = (IReplayDriver *)replay; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } diff --git a/renderdoc/driver/gl/gl_replay_win32.cpp b/renderdoc/driver/gl/gl_replay_win32.cpp index e2a778005..1fad0d5bd 100644 --- a/renderdoc/driver/gl/gl_replay_win32.cpp +++ b/renderdoc/driver/gl/gl_replay_win32.cpp @@ -40,7 +40,7 @@ WGLCREATECONTEXTPROC wglCreateRC = NULL; WGLMAKECURRENTPROC wglMakeCurrentProc = NULL; WGLDELETECONTEXTPROC wglDeleteRC = NULL; -ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCDEBUG("Creating an OpenGL replay device"); @@ -49,7 +49,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(lib == NULL) { RDCERR("Failed to load opengl32.dll"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } GLInitParams initParams; @@ -60,7 +60,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr { auto status = RenderDoc::Inst().FillInitParams(logfile, driverType, driverName, machineIdent, (RDCInitParams *)&initParams); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) return status; } @@ -76,7 +76,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(wglGetProc == NULL || wglCreateRC == NULL || wglMakeCurrentProc == NULL || wglDeleteRC == NULL) { RDCERR("Couldn't get wgl function addresses"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } WNDCLASSEX wc; @@ -91,7 +91,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(!RegisterClassEx(&wc)) { RDCERR("Couldn't register GL window class"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } RDCEraseEl(pfd); @@ -115,28 +115,28 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(pf == 0) { RDCERR("Couldn't choose pixel format"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } BOOL res = SetPixelFormat(dc, pf, &pfd); if(res == FALSE) { RDCERR("Couldn't set pixel format"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } HGLRC rc = wglCreateRC(dc); if(rc == NULL) { RDCERR("Couldn't create simple RC"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } res = wglMakeCurrentProc(dc, rc); if(res == FALSE) { RDCERR("Couldn't make simple RC current"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } createContextAttribs = @@ -147,7 +147,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(createContextAttribs == NULL || getPixelFormatAttrib == NULL) { RDCERR("RenderDoc requires WGL_ARB_create_context and WGL_ARB_pixel_format"); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } wglMakeCurrentProc(NULL, NULL); @@ -176,7 +176,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr RDCERR("Couldn't choose pixel format"); ReleaseDC(w, dc); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } res = SetPixelFormat(dc, pf, &pfd); @@ -185,7 +185,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr RDCERR("Couldn't set pixel format"); ReleaseDC(w, dc); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } int attribs[64] = {0}; @@ -232,7 +232,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr RDCERR("Couldn't create 3.2 RC - RenderDoc requires OpenGL 3.2 availability"); ReleaseDC(w, dc); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } GLCoreVersion = major * 10 + minor; @@ -245,7 +245,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr wglDeleteRC(rc); ReleaseDC(w, dc); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } PFNGLGETINTEGERVPROC getInt = (PFNGLGETINTEGERVPROC)GetProcAddress(lib, "glGetIntegerv"); @@ -260,7 +260,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr wglDeleteRC(rc); ReleaseDC(w, dc); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } bool missingExt = CheckReplayContext(getStr, getInt, getStri); @@ -271,7 +271,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr wglDeleteRC(rc); ReleaseDC(w, dc); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } const GLHookSet &real = GetRealGLFunctions(); @@ -284,7 +284,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr wglDeleteRC(rc); ReleaseDC(w, dc); GLReplay::PostContextShutdownCounters(); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } WrappedOpenGL *gl = new WrappedOpenGL(logfile, real, GetGLPlatform()); @@ -293,7 +293,7 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr if(gl->GetSerialiser()->HasError()) { delete gl; - return eReplayCreate_FileIOFailed; + return ReplayStatus::FileIOFailed; } RDCLOG("Created device."); @@ -306,5 +306,5 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr replay->SetReplayData(data); *driver = (IReplayDriver *)replay; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } diff --git a/renderdoc/driver/gl/gl_shader_refl.cpp b/renderdoc/driver/gl/gl_shader_refl.cpp index 925adca42..c735f3b10 100644 --- a/renderdoc/driver/gl/gl_shader_refl.cpp +++ b/renderdoc/driver/gl/gl_shader_refl.cpp @@ -582,7 +582,7 @@ void ReconstructVarTree(const GLHookSet &gl, GLenum query, GLuint sepProg, GLuin case eGL_FLOAT_MAT3x4: case eGL_FLOAT_MAT3x2: case eGL_FLOAT_MAT2x4: - case eGL_FLOAT_MAT2x3: var.type.descriptor.type = eVar_Float; break; + case eGL_FLOAT_MAT2x3: var.type.descriptor.type = VarType::Float; break; case eGL_DOUBLE_VEC4: case eGL_DOUBLE_VEC3: case eGL_DOUBLE_VEC2: @@ -595,7 +595,7 @@ void ReconstructVarTree(const GLHookSet &gl, GLenum query, GLuint sepProg, GLuin case eGL_DOUBLE_MAT3x4: case eGL_DOUBLE_MAT3x2: case eGL_DOUBLE_MAT2x4: - case eGL_DOUBLE_MAT2x3: var.type.descriptor.type = eVar_Double; break; + case eGL_DOUBLE_MAT2x3: var.type.descriptor.type = VarType::Double; break; case eGL_UNSIGNED_INT_VEC4: case eGL_UNSIGNED_INT_VEC3: case eGL_UNSIGNED_INT_VEC2: @@ -603,11 +603,11 @@ void ReconstructVarTree(const GLHookSet &gl, GLenum query, GLuint sepProg, GLuin case eGL_BOOL_VEC4: case eGL_BOOL_VEC3: case eGL_BOOL_VEC2: - case eGL_BOOL: var.type.descriptor.type = eVar_UInt; break; + case eGL_BOOL: var.type.descriptor.type = VarType::UInt; break; case eGL_INT_VEC4: case eGL_INT_VEC3: case eGL_INT_VEC2: - case eGL_INT: var.type.descriptor.type = eVar_Int; break; + case eGL_INT: var.type.descriptor.type = VarType::Int; break; default: // not a variable (sampler etc) return; @@ -942,513 +942,513 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, // float samplers if(values[0] == eGL_SAMPLER_BUFFER) { - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.name = "samplerBuffer"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_1D) { - res.resType = eResType_Texture1D; + res.resType = TextureDim::Texture1D; res.variableType.descriptor.name = "sampler1D"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_1D_ARRAY) { - res.resType = eResType_Texture1DArray; + res.resType = TextureDim::Texture1DArray; res.variableType.descriptor.name = "sampler1DArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_1D_SHADOW) { - res.resType = eResType_Texture1D; + res.resType = TextureDim::Texture1D; res.variableType.descriptor.name = "sampler1DShadow"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_1D_ARRAY_SHADOW) { - res.resType = eResType_Texture1DArray; + res.resType = TextureDim::Texture1DArray; res.variableType.descriptor.name = "sampler1DArrayShadow"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.variableType.descriptor.name = "sampler2D"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D_ARRAY) { - res.resType = eResType_Texture2DArray; + res.resType = TextureDim::Texture2DArray; res.variableType.descriptor.name = "sampler2DArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D_SHADOW) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.variableType.descriptor.name = "sampler2DShadow"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D_ARRAY_SHADOW) { - res.resType = eResType_Texture2DArray; + res.resType = TextureDim::Texture2DArray; res.variableType.descriptor.name = "sampler2DArrayShadow"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D_RECT) { - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; res.variableType.descriptor.name = "sampler2DRect"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D_RECT_SHADOW) { - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; res.variableType.descriptor.name = "sampler2DRectShadow"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_3D) { - res.resType = eResType_Texture3D; + res.resType = TextureDim::Texture3D; res.variableType.descriptor.name = "sampler3D"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_CUBE) { - res.resType = eResType_TextureCube; + res.resType = TextureDim::TextureCube; res.variableType.descriptor.name = "samplerCube"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_CUBE_SHADOW) { - res.resType = eResType_TextureCube; + res.resType = TextureDim::TextureCube; res.variableType.descriptor.name = "samplerCubeShadow"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_CUBE_MAP_ARRAY) { - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; res.variableType.descriptor.name = "samplerCubeArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D_MULTISAMPLE) { - res.resType = eResType_Texture2DMS; + res.resType = TextureDim::Texture2DMS; res.variableType.descriptor.name = "sampler2DMS"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } else if(values[0] == eGL_SAMPLER_2D_MULTISAMPLE_ARRAY) { - res.resType = eResType_Texture2DMSArray; + res.resType = TextureDim::Texture2DMSArray; res.variableType.descriptor.name = "sampler2DMSArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; } // int samplers else if(values[0] == eGL_INT_SAMPLER_BUFFER) { - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.name = "isamplerBuffer"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_1D) { - res.resType = eResType_Texture1D; + res.resType = TextureDim::Texture1D; res.variableType.descriptor.name = "isampler1D"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_1D_ARRAY) { - res.resType = eResType_Texture1DArray; + res.resType = TextureDim::Texture1DArray; res.variableType.descriptor.name = "isampler1DArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_2D) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.variableType.descriptor.name = "isampler2D"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_2D_ARRAY) { - res.resType = eResType_Texture2DArray; + res.resType = TextureDim::Texture2DArray; res.variableType.descriptor.name = "isampler2DArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_2D_RECT) { - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; res.variableType.descriptor.name = "isampler2DRect"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_3D) { - res.resType = eResType_Texture3D; + res.resType = TextureDim::Texture3D; res.variableType.descriptor.name = "isampler3D"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_CUBE) { - res.resType = eResType_TextureCube; + res.resType = TextureDim::TextureCube; res.variableType.descriptor.name = "isamplerCube"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_CUBE_MAP_ARRAY) { - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; res.variableType.descriptor.name = "isamplerCubeArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_2D_MULTISAMPLE) { - res.resType = eResType_Texture2DMS; + res.resType = TextureDim::Texture2DMS; res.variableType.descriptor.name = "isampler2DMS"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } else if(values[0] == eGL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY) { - res.resType = eResType_Texture2DMSArray; + res.resType = TextureDim::Texture2DMSArray; res.variableType.descriptor.name = "isampler2DMSArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; } // unsigned int samplers else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_BUFFER) { - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.name = "usamplerBuffer"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_1D) { - res.resType = eResType_Texture1D; + res.resType = TextureDim::Texture1D; res.variableType.descriptor.name = "usampler1D"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_1D_ARRAY) { - res.resType = eResType_Texture1DArray; + res.resType = TextureDim::Texture1DArray; res.variableType.descriptor.name = "usampler1DArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_2D) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.variableType.descriptor.name = "usampler2D"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_2D_ARRAY) { - res.resType = eResType_Texture2DArray; + res.resType = TextureDim::Texture2DArray; res.variableType.descriptor.name = "usampler2DArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_2D_RECT) { - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; res.variableType.descriptor.name = "usampler2DRect"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_3D) { - res.resType = eResType_Texture3D; + res.resType = TextureDim::Texture3D; res.variableType.descriptor.name = "usampler3D"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_CUBE) { - res.resType = eResType_TextureCube; + res.resType = TextureDim::TextureCube; res.variableType.descriptor.name = "usamplerCube"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY) { - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; res.variableType.descriptor.name = "usamplerCubeArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE) { - res.resType = eResType_Texture2DMS; + res.resType = TextureDim::Texture2DMS; res.variableType.descriptor.name = "usampler2DMS"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } else if(values[0] == eGL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY) { - res.resType = eResType_Texture2DMSArray; + res.resType = TextureDim::Texture2DMSArray; res.variableType.descriptor.name = "usampler2DMSArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; } // float images else if(values[0] == eGL_IMAGE_BUFFER) { - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.name = "imageBuffer"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_1D) { - res.resType = eResType_Texture1D; + res.resType = TextureDim::Texture1D; res.variableType.descriptor.name = "image1D"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_1D_ARRAY) { - res.resType = eResType_Texture1DArray; + res.resType = TextureDim::Texture1DArray; res.variableType.descriptor.name = "image1DArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_2D) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.variableType.descriptor.name = "image2D"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_2D_ARRAY) { - res.resType = eResType_Texture2DArray; + res.resType = TextureDim::Texture2DArray; res.variableType.descriptor.name = "image2DArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_2D_RECT) { - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; res.variableType.descriptor.name = "image2DRect"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_3D) { - res.resType = eResType_Texture3D; + res.resType = TextureDim::Texture3D; res.variableType.descriptor.name = "image3D"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_CUBE) { - res.resType = eResType_TextureCube; + res.resType = TextureDim::TextureCube; res.variableType.descriptor.name = "imageCube"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_CUBE_MAP_ARRAY) { - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; res.variableType.descriptor.name = "imageCubeArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_2D_MULTISAMPLE) { - res.resType = eResType_Texture2DMS; + res.resType = TextureDim::Texture2DMS; res.variableType.descriptor.name = "image2DMS"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_IMAGE_2D_MULTISAMPLE_ARRAY) { - res.resType = eResType_Texture2DMSArray; + res.resType = TextureDim::Texture2DMSArray; res.variableType.descriptor.name = "image2DMSArray"; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.IsSRV = false; IsReadWrite = true; } // int images else if(values[0] == eGL_INT_IMAGE_BUFFER) { - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.name = "iimageBuffer"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_1D) { - res.resType = eResType_Texture1D; + res.resType = TextureDim::Texture1D; res.variableType.descriptor.name = "iimage1D"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_1D_ARRAY) { - res.resType = eResType_Texture1DArray; + res.resType = TextureDim::Texture1DArray; res.variableType.descriptor.name = "iimage1DArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_2D) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.variableType.descriptor.name = "iimage2D"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_2D_ARRAY) { - res.resType = eResType_Texture2DArray; + res.resType = TextureDim::Texture2DArray; res.variableType.descriptor.name = "iimage2DArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_2D_RECT) { - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; res.variableType.descriptor.name = "iimage2DRect"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_3D) { - res.resType = eResType_Texture3D; + res.resType = TextureDim::Texture3D; res.variableType.descriptor.name = "iimage3D"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_CUBE) { - res.resType = eResType_TextureCube; + res.resType = TextureDim::TextureCube; res.variableType.descriptor.name = "iimageCube"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_CUBE_MAP_ARRAY) { - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; res.variableType.descriptor.name = "iimageCubeArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_2D_MULTISAMPLE) { - res.resType = eResType_Texture2DMS; + res.resType = TextureDim::Texture2DMS; res.variableType.descriptor.name = "iimage2DMS"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_INT_IMAGE_2D_MULTISAMPLE_ARRAY) { - res.resType = eResType_Texture2DMSArray; + res.resType = TextureDim::Texture2DMSArray; res.variableType.descriptor.name = "iimage2DMSArray"; - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; res.IsSRV = false; IsReadWrite = true; } // unsigned int images else if(values[0] == eGL_UNSIGNED_INT_IMAGE_BUFFER) { - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.name = "uimageBuffer"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_1D) { - res.resType = eResType_Texture1D; + res.resType = TextureDim::Texture1D; res.variableType.descriptor.name = "uimage1D"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_1D_ARRAY) { - res.resType = eResType_Texture1DArray; + res.resType = TextureDim::Texture1DArray; res.variableType.descriptor.name = "uimage1DArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_2D) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.variableType.descriptor.name = "uimage2D"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_2D_ARRAY) { - res.resType = eResType_Texture2DArray; + res.resType = TextureDim::Texture2DArray; res.variableType.descriptor.name = "uimage2DArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_2D_RECT) { - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; res.variableType.descriptor.name = "uimage2DRect"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_3D) { - res.resType = eResType_Texture3D; + res.resType = TextureDim::Texture3D; res.variableType.descriptor.name = "uimage3D"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_CUBE) { - res.resType = eResType_TextureCube; + res.resType = TextureDim::TextureCube; res.variableType.descriptor.name = "uimageCube"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY) { - res.resType = eResType_TextureCubeArray; + res.resType = TextureDim::TextureCubeArray; res.variableType.descriptor.name = "uimageCubeArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE) { - res.resType = eResType_Texture2DMS; + res.resType = TextureDim::Texture2DMS; res.variableType.descriptor.name = "uimage2DMS"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } else if(values[0] == eGL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY) { - res.resType = eResType_Texture2DMSArray; + res.resType = TextureDim::Texture2DMSArray; res.variableType.descriptor.name = "uimage2DMSArray"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; IsReadWrite = true; } // atomic counter else if(values[0] == eGL_UNSIGNED_INT_ATOMIC_COUNTER) { - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.name = "atomic_uint"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.IsSRV = false; res.IsTexture = false; res.variableType.descriptor.cols = 1; @@ -1510,14 +1510,14 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, res.IsSampler = false; res.IsSRV = false; res.IsTexture = false; - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.rows = 0; res.variableType.descriptor.cols = 0; res.variableType.descriptor.elements = len; res.variableType.descriptor.rowMajorStorage = false; res.variableType.descriptor.arrayStride = 0; res.variableType.descriptor.name = "buffer"; - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; res.bindPoint = (int32_t)rwresources.size(); res.name = nm; @@ -1563,7 +1563,7 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, // add its size uint32_t size = last->type.descriptor.rows * last->type.descriptor.cols * 4; - if(last->type.descriptor.type == eVar_Double) + if(last->type.descriptor.type == VarType::Double) size *= 2; stride += size; @@ -1580,7 +1580,7 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, paddingVar.name = "__padding"; paddingVar.reg.vec = last->reg.vec + (size / 16); paddingVar.reg.comp = (last->reg.comp + size / 4) % 16; - paddingVar.type.descriptor.type = eVar_UInt; + paddingVar.type.descriptor.type = VarType::UInt; paddingVar.type.descriptor.rows = 1; paddingVar.type.descriptor.cols = padding; paddingVar.type.descriptor.elements = 1; @@ -1733,11 +1733,11 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, case eGL_FLOAT_MAT2x3: case eGL_DOUBLE_MAT2x3: case eGL_FLOAT_MAT2x4: - case eGL_DOUBLE_MAT2x4: sig.compType = eCompType_Float; break; + case eGL_DOUBLE_MAT2x4: sig.compType = CompType::Float; break; case eGL_INT: case eGL_INT_VEC2: case eGL_INT_VEC3: - case eGL_INT_VEC4: sig.compType = eCompType_SInt; break; + case eGL_INT_VEC4: sig.compType = CompType::SInt; break; case eGL_UNSIGNED_INT: case eGL_BOOL: case eGL_UNSIGNED_INT_VEC2: @@ -1745,9 +1745,9 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, case eGL_UNSIGNED_INT_VEC3: case eGL_BOOL_VEC3: case eGL_UNSIGNED_INT_VEC4: - case eGL_BOOL_VEC4: sig.compType = eCompType_UInt; break; + case eGL_BOOL_VEC4: sig.compType = CompType::UInt; break; default: - sig.compType = eCompType_Float; + sig.compType = CompType::Float; RDCWARN("Unhandled signature element type %s", ToStr::Get((GLenum)values[1]).c_str()); } @@ -1850,7 +1850,7 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, sig.channelUsedMask = sig.regChannelMask; - sig.systemValue = eAttr_None; + sig.systemValue = ShaderBuiltin::Undefined; #define IS_BUILTIN(builtin) !strncmp(nm, builtin, sizeof(builtin) - 1) @@ -1863,94 +1863,94 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, // VS built-in inputs if(IS_BUILTIN("gl_VertexID")) - sig.systemValue = eAttr_VertexIndex; + sig.systemValue = ShaderBuiltin::VertexIndex; if(IS_BUILTIN("gl_InstanceID")) - sig.systemValue = eAttr_InstanceIndex; + sig.systemValue = ShaderBuiltin::InstanceIndex; // VS built-in outputs if(IS_BUILTIN("gl_Position")) - sig.systemValue = eAttr_Position; + sig.systemValue = ShaderBuiltin::Position; if(IS_BUILTIN("gl_PointSize")) - sig.systemValue = eAttr_PointSize; + sig.systemValue = ShaderBuiltin::PointSize; if(IS_BUILTIN("gl_ClipDistance")) - sig.systemValue = eAttr_ClipDistance; + sig.systemValue = ShaderBuiltin::ClipDistance; // TCS built-in inputs if(IS_BUILTIN("gl_PatchVerticesIn")) - sig.systemValue = eAttr_PatchNumVertices; + sig.systemValue = ShaderBuiltin::PatchNumVertices; if(IS_BUILTIN("gl_PrimitiveID")) - sig.systemValue = eAttr_PrimitiveIndex; + sig.systemValue = ShaderBuiltin::PrimitiveIndex; if(IS_BUILTIN("gl_InvocationID")) - sig.systemValue = eAttr_InvocationIndex; + sig.systemValue = ShaderBuiltin::InvocationIndex; // TCS built-in outputs if(IS_BUILTIN("gl_TessLevelOuter")) - sig.systemValue = eAttr_OuterTessFactor; + sig.systemValue = ShaderBuiltin::OuterTessFactor; if(IS_BUILTIN("gl_TessLevelInner")) - sig.systemValue = eAttr_InsideTessFactor; + sig.systemValue = ShaderBuiltin::InsideTessFactor; // TES built-in inputs if(IS_BUILTIN("gl_TessCoord")) - sig.systemValue = eAttr_DomainLocation; + sig.systemValue = ShaderBuiltin::DomainLocation; if(IS_BUILTIN("gl_PatchVerticesIn")) - sig.systemValue = eAttr_PatchNumVertices; + sig.systemValue = ShaderBuiltin::PatchNumVertices; if(IS_BUILTIN("gl_PrimitiveID")) - sig.systemValue = eAttr_PrimitiveIndex; + sig.systemValue = ShaderBuiltin::PrimitiveIndex; // GS built-in inputs if(IS_BUILTIN("gl_PrimitiveIDIn")) - sig.systemValue = eAttr_PrimitiveIndex; + sig.systemValue = ShaderBuiltin::PrimitiveIndex; if(IS_BUILTIN("gl_InvocationID")) - sig.systemValue = eAttr_InvocationIndex; + sig.systemValue = ShaderBuiltin::InvocationIndex; if(IS_BUILTIN("gl_Layer")) - sig.systemValue = eAttr_RTIndex; + sig.systemValue = ShaderBuiltin::RTIndex; if(IS_BUILTIN("gl_ViewportIndex")) - sig.systemValue = eAttr_ViewportIndex; + sig.systemValue = ShaderBuiltin::ViewportIndex; // GS built-in outputs if(IS_BUILTIN("gl_Layer")) - sig.systemValue = eAttr_RTIndex; + sig.systemValue = ShaderBuiltin::RTIndex; if(IS_BUILTIN("gl_ViewportIndex")) - sig.systemValue = eAttr_ViewportIndex; + sig.systemValue = ShaderBuiltin::ViewportIndex; // PS built-in inputs if(IS_BUILTIN("gl_FragCoord")) - sig.systemValue = eAttr_Position; + sig.systemValue = ShaderBuiltin::Position; if(IS_BUILTIN("gl_FrontFacing")) - sig.systemValue = eAttr_IsFrontFace; + sig.systemValue = ShaderBuiltin::IsFrontFace; if(IS_BUILTIN("gl_PointCoord")) - sig.systemValue = eAttr_RTIndex; + sig.systemValue = ShaderBuiltin::RTIndex; if(IS_BUILTIN("gl_SampleID")) - sig.systemValue = eAttr_MSAASampleIndex; + sig.systemValue = ShaderBuiltin::MSAASampleIndex; if(IS_BUILTIN("gl_SamplePosition")) - sig.systemValue = eAttr_MSAASamplePosition; + sig.systemValue = ShaderBuiltin::MSAASamplePosition; if(IS_BUILTIN("gl_SampleMaskIn")) - sig.systemValue = eAttr_MSAACoverage; + sig.systemValue = ShaderBuiltin::MSAACoverage; // PS built-in outputs if(IS_BUILTIN("gl_FragDepth")) - sig.systemValue = eAttr_DepthOutput; + sig.systemValue = ShaderBuiltin::DepthOutput; if(IS_BUILTIN("gl_SampleMask")) - sig.systemValue = eAttr_MSAACoverage; + sig.systemValue = ShaderBuiltin::MSAACoverage; // CS built-in inputs if(IS_BUILTIN("gl_NumWorkGroups")) - sig.systemValue = eAttr_DispatchSize; + sig.systemValue = ShaderBuiltin::DispatchSize; if(IS_BUILTIN("gl_WorkGroupID")) - sig.systemValue = eAttr_GroupIndex; + sig.systemValue = ShaderBuiltin::GroupIndex; if(IS_BUILTIN("gl_LocalInvocationID")) - sig.systemValue = eAttr_GroupThreadIndex; + sig.systemValue = ShaderBuiltin::GroupThreadIndex; if(IS_BUILTIN("gl_GlobalInvocationID")) - sig.systemValue = eAttr_DispatchThreadIndex; + sig.systemValue = ShaderBuiltin::DispatchThreadIndex; if(IS_BUILTIN("gl_LocalInvocationIndex")) - sig.systemValue = eAttr_GroupFlatIndex; + sig.systemValue = ShaderBuiltin::GroupFlatIndex; #undef IS_BUILTIN if(shadType == eGL_FRAGMENT_SHADER && sigEnum == eGL_PROGRAM_OUTPUT && - sig.systemValue == eAttr_None) - sig.systemValue = eAttr_ColourOutput; + sig.systemValue == ShaderBuiltin::Undefined) + sig.systemValue = ShaderBuiltin::ColourOutput; - if(sig.systemValue == eAttr_None) + if(sig.systemValue == ShaderBuiltin::Undefined) sig.regIndex = values[2] >= 0 ? values[2] : i; else sig.regIndex = values[2] >= 0 ? values[2] : 0; @@ -2111,7 +2111,7 @@ void GetBindpointMapping(const GLHookSet &gl, GLuint curProg, int shadIdx, Shade { if(refl->ReadWriteResources.elems[i].variableType.descriptor.cols == 1 && refl->ReadWriteResources.elems[i].variableType.descriptor.rows == 1 && - refl->ReadWriteResources.elems[i].variableType.descriptor.type == eVar_UInt) + refl->ReadWriteResources.elems[i].variableType.descriptor.type == VarType::UInt) { // atomic uint GLuint idx = gl.glGetProgramResourceIndex(curProg, eGL_UNIFORM, diff --git a/renderdoc/driver/gl/wrappers/gl_debug_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_debug_funcs.cpp index 4a7c33c55..52d7952e4 100644 --- a/renderdoc/driver/gl/wrappers/gl_debug_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_debug_funcs.cpp @@ -156,7 +156,7 @@ bool WrappedOpenGL::Serialise_glDebugMessageInsert(GLenum source, GLenum type, G { FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_SetMarker; + draw.flags |= DrawFlags::SetMarker; AddDrawcall(draw, false); } @@ -238,7 +238,7 @@ bool WrappedOpenGL::Serialise_glPushDebugGroup(GLenum source, GLuint id, GLsizei { FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_PushMarker; + draw.flags |= DrawFlags::PushMarker; AddDrawcall(draw, false); } @@ -265,7 +265,7 @@ bool WrappedOpenGL::Serialise_glPopDebugGroup() { FetchDrawcall draw; draw.name = "API Calls"; - draw.flags |= eDraw_SetMarker | eDraw_APICalls; + draw.flags |= DrawFlags::SetMarker | DrawFlags::APICalls; AddDrawcall(draw, true); } diff --git a/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp index 66fe8f18f..be8a13197 100644 --- a/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp @@ -51,22 +51,25 @@ bool WrappedOpenGL::Serialise_glDispatchCompute(GLuint num_groups_x, GLuint num_ FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Dispatch; + draw.flags |= DrawFlags::Dispatch; draw.dispatchDimension[0] = X; draw.dispatchDimension[1] = Y; draw.dispatchDimension[2] = Z; if(X == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Num Groups X=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean X=1?"); if(Y == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Num Groups Y=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean Y=1?"); if(Z == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Num Groups Z=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean Z=1?"); @@ -129,7 +132,7 @@ bool WrappedOpenGL::Serialise_glDispatchComputeGroupSizeARB(GLuint num_groups_x, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Dispatch; + draw.flags |= DrawFlags::Dispatch; draw.dispatchDimension[0] = X; draw.dispatchDimension[1] = Y; @@ -139,28 +142,34 @@ bool WrappedOpenGL::Serialise_glDispatchComputeGroupSizeARB(GLuint num_groups_x, draw.dispatchThreadsDimension[2] = sZ; if(X == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Num Groups X=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean X=1?"); if(Y == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Num Groups Y=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean Y=1?"); if(Z == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Num Groups Z=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean Z=1?"); if(sX == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Group Size X=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean X=1?"); if(sY == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Group Size Y=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean Y=1?"); if(sZ == 0) - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_Medium, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::Medium, + MessageSource::IncorrectAPIUse, "Dispatch call has Group Size Z=0. This will do nothing, which is unusual " "for a non-indirect Dispatch. Did you mean Z=1?"); @@ -223,7 +232,7 @@ bool WrappedOpenGL::Serialise_glDispatchComputeIndirect(GLintptr indirect) FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Dispatch | eDraw_Indirect; + draw.flags |= DrawFlags::Dispatch | DrawFlags::Indirect; draw.dispatchDimension[0] = groupSizes[0]; draw.dispatchDimension[1] = groupSizes[1]; @@ -235,7 +244,7 @@ bool WrappedOpenGL::Serialise_glDispatchComputeIndirect(GLintptr indirect) m_Real.glGetIntegerv(eGL_DISPATCH_INDIRECT_BUFFER_BINDING, (GLint *)&buf); m_ResourceUses[GetResourceManager()->GetID(BufferRes(GetCtx(), buf))].push_back( - EventUsage(m_CurEventID, eUsage_Indirect)); + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } return true; @@ -435,7 +444,7 @@ bool WrappedOpenGL::Serialise_glDrawTransformFeedback(GLenum mode, GLuint id) draw.vertexOffset = 0; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall; + draw.flags |= DrawFlags::Drawcall; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -501,7 +510,7 @@ bool WrappedOpenGL::Serialise_glDrawTransformFeedbackInstanced(GLenum mode, GLui draw.vertexOffset = 0; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall; + draw.flags |= DrawFlags::Drawcall; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -566,7 +575,7 @@ bool WrappedOpenGL::Serialise_glDrawTransformFeedbackStream(GLenum mode, GLuint draw.vertexOffset = 0; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall; + draw.flags |= DrawFlags::Drawcall; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -636,7 +645,7 @@ bool WrappedOpenGL::Serialise_glDrawTransformFeedbackStreamInstanced(GLenum mode draw.vertexOffset = 0; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall; + draw.flags |= DrawFlags::Drawcall; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -699,7 +708,7 @@ bool WrappedOpenGL::Serialise_glDrawArrays(GLenum mode, GLint first, GLsizei cou draw.vertexOffset = First; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall; + draw.flags |= DrawFlags::Drawcall; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -830,7 +839,7 @@ bool WrappedOpenGL::Serialise_glDrawArraysIndirect(GLenum mode, const void *indi draw.vertexOffset = params.first; draw.instanceOffset = params.baseInstance; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_Indirect; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::Indirect; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -840,7 +849,7 @@ bool WrappedOpenGL::Serialise_glDrawArraysIndirect(GLenum mode, const void *indi m_Real.glGetIntegerv(eGL_DRAW_INDIRECT_BUFFER_BINDING, (GLint *)&buf); m_ResourceUses[GetResourceManager()->GetID(BufferRes(GetCtx(), buf))].push_back( - EventUsage(m_CurEventID, eUsage_Indirect)); + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } return true; @@ -901,7 +910,7 @@ bool WrappedOpenGL::Serialise_glDrawArraysInstanced(GLenum mode, GLint first, GL draw.vertexOffset = First; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall | eDraw_Instanced; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -973,7 +982,7 @@ bool WrappedOpenGL::Serialise_glDrawArraysInstancedBaseInstance(GLenum mode, GLi draw.vertexOffset = First; draw.instanceOffset = BaseInstance; - draw.flags |= eDraw_Drawcall | eDraw_Instanced; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -1015,8 +1024,8 @@ bool WrappedOpenGL::Check_preElements() if(idxbuf == 0) { - AddDebugMessage(eDbgCategory_Undefined, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, - "No index buffer bound at indexed draw!."); + AddDebugMessage(MessageCategory::Undefined, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "No index buffer bound at indexed draw!."); return false; } @@ -1084,7 +1093,8 @@ void WrappedOpenGL::Common_postElements(byte *idxDelete) { m_Real.glBindBuffer(eGL_ELEMENT_ARRAY_BUFFER, 0); - AddDebugMessage(eDbgCategory_Deprecated, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Deprecated, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Assuming GL core profile is used then specifying indices as a raw array, " "not as offset into element array buffer, is illegal."); @@ -1132,7 +1142,7 @@ bool WrappedOpenGL::Serialise_glDrawElements(GLenum mode, GLsizei count, GLenum draw.vertexOffset = 0; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1203,7 +1213,8 @@ bool WrappedOpenGL::Serialise_glDrawElementsIndirect(GLenum mode, GLenum type, c draw.baseVertex = params.baseVertex; draw.instanceOffset = params.baseInstance; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer | eDraw_Instanced | eDraw_Indirect; + draw.flags |= + DrawFlags::Drawcall | DrawFlags::UseIBuffer | DrawFlags::Instanced | DrawFlags::Indirect; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1214,7 +1225,7 @@ bool WrappedOpenGL::Serialise_glDrawElementsIndirect(GLenum mode, GLenum type, c m_Real.glGetIntegerv(eGL_DRAW_INDIRECT_BUFFER_BINDING, (GLint *)&buf); m_ResourceUses[GetResourceManager()->GetID(BufferRes(GetCtx(), buf))].push_back( - EventUsage(m_CurEventID, eUsage_Indirect)); + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } return true; @@ -1285,7 +1296,7 @@ bool WrappedOpenGL::Serialise_glDrawRangeElements(GLenum mode, GLuint start, GLu draw.vertexOffset = 0; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1365,7 +1376,7 @@ bool WrappedOpenGL::Serialise_glDrawRangeElementsBaseVertex(GLenum mode, GLuint draw.baseVertex = BaseVtx; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1442,7 +1453,7 @@ bool WrappedOpenGL::Serialise_glDrawElementsBaseVertex(GLenum mode, GLsizei coun draw.baseVertex = BaseVtx; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1518,7 +1529,7 @@ bool WrappedOpenGL::Serialise_glDrawElementsInstanced(GLenum mode, GLsizei count draw.vertexOffset = 0; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1598,7 +1609,7 @@ bool WrappedOpenGL::Serialise_glDrawElementsInstancedBaseInstance(GLenum mode, G draw.vertexOffset = 0; draw.instanceOffset = BaseInstance; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1681,7 +1692,7 @@ bool WrappedOpenGL::Serialise_glDrawElementsInstancedBaseVertex(GLenum mode, GLs draw.baseVertex = BaseVertex; draw.instanceOffset = 0; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1764,7 +1775,7 @@ bool WrappedOpenGL::Serialise_glDrawElementsInstancedBaseVertexBaseInstance( draw.baseVertex = BaseVertex; draw.instanceOffset = BaseInstance; - draw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_UseIBuffer; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::UseIBuffer; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -1870,7 +1881,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArrays(GLenum mode, const GLint *first, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -1889,7 +1900,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArrays(GLenum mode, const GLint *first, multidraw.name = "glMultiDrawArrays[" + ToStr::Get(i) + "](" + ToStr::Get(multidraw.numIndices) + ")"; - multidraw.flags |= eDraw_Drawcall; + multidraw.flags |= DrawFlags::Drawcall; multidraw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -2026,7 +2037,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElements(GLenum mode, const GLsizei *co FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; draw.indexByteWidth = IdxSize; draw.numIndices = 0; @@ -2050,7 +2061,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElements(GLenum mode, const GLsizei *co multidraw.name = "glMultiDrawElements[" + ToStr::Get(i) + "](" + ToStr::Get(multidraw.numIndices) + ")"; - multidraw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + multidraw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; multidraw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -2191,7 +2202,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsBaseVertex(GLenum mode, const G FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -2214,7 +2225,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsBaseVertex(GLenum mode, const G multidraw.name = "glMultiDrawElementsBaseVertex[" + ToStr::Get(i) + "](" + ToStr::Get(multidraw.numIndices) + ")"; - multidraw.flags |= eDraw_Drawcall | eDraw_UseIBuffer; + multidraw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer; multidraw.topology = MakePrimitiveTopology(m_Real, Mode); multidraw.indexByteWidth = IdxSize; @@ -2339,7 +2350,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirect(GLenum mode, const void FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -2352,7 +2363,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirect(GLenum mode, const void m_Real.glGetIntegerv(eGL_DRAW_INDIRECT_BUFFER_BINDING, (GLint *)&buf); m_ResourceUses[GetResourceManager()->GetID(BufferRes(GetCtx(), buf))].push_back( - EventUsage(m_CurEventID, eUsage_Indirect)); + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } GLintptr offs = (GLintptr)Offset; @@ -2380,7 +2391,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirect(GLenum mode, const void ToStr::Get(multidraw.numIndices) + ", " + ToStr::Get(multidraw.numInstances) + ">)"; - multidraw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_Indirect; + multidraw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::Indirect; multidraw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -2506,7 +2517,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirect(GLenum mode, GLenum ty FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -2520,7 +2531,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirect(GLenum mode, GLenum ty m_Real.glGetIntegerv(eGL_DRAW_INDIRECT_BUFFER_BINDING, (GLint *)&buf); m_ResourceUses[GetResourceManager()->GetID(BufferRes(GetCtx(), buf))].push_back( - EventUsage(m_CurEventID, eUsage_Indirect)); + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } GLintptr offs = (GLintptr)Offset; @@ -2549,7 +2560,8 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirect(GLenum mode, GLenum ty ToStr::Get(multidraw.numIndices) + ", " + ToStr::Get(multidraw.numInstances) + ">)"; - multidraw.flags |= eDraw_Drawcall | eDraw_UseIBuffer | eDraw_Instanced | eDraw_Indirect; + multidraw.flags |= + DrawFlags::Drawcall | DrawFlags::UseIBuffer | DrawFlags::Instanced | DrawFlags::Indirect; multidraw.topology = MakePrimitiveTopology(m_Real, Mode); multidraw.indexByteWidth = IdxSize; @@ -2682,7 +2694,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirectCountARB(GLenum mode, GLi FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; draw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -2695,7 +2707,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirectCountARB(GLenum mode, GLi m_Real.glGetIntegerv(eGL_DRAW_INDIRECT_BUFFER_BINDING, (GLint *)&buf); m_ResourceUses[GetResourceManager()->GetID(BufferRes(GetCtx(), buf))].push_back( - EventUsage(m_CurEventID, eUsage_Indirect)); + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } GLintptr offs = (GLintptr)Offset; @@ -2723,7 +2735,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirectCountARB(GLenum mode, GLi ToStr::Get(multidraw.numIndices) + ", " + ToStr::Get(multidraw.numInstances) + ">)"; - multidraw.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_Indirect; + multidraw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::Indirect; multidraw.topology = MakePrimitiveTopology(m_Real, Mode); @@ -2865,7 +2877,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirectCountARB(GLenum mode, G FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_MultiDraw; + draw.flags |= DrawFlags::MultiDraw; draw.topology = MakePrimitiveTopology(m_Real, Mode); draw.indexByteWidth = IdxSize; @@ -2879,7 +2891,7 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirectCountARB(GLenum mode, G m_Real.glGetIntegerv(eGL_DRAW_INDIRECT_BUFFER_BINDING, (GLint *)&buf); m_ResourceUses[GetResourceManager()->GetID(BufferRes(GetCtx(), buf))].push_back( - EventUsage(m_CurEventID, eUsage_Indirect)); + EventUsage(m_CurEventID, ResourceUsage::Indirect)); } GLintptr offs = (GLintptr)Offset; @@ -2908,7 +2920,8 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirectCountARB(GLenum mode, G ToStr::Get(multidraw.numIndices) + ", " + ToStr::Get(multidraw.numInstances) + ")"; - multidraw.flags |= eDraw_Drawcall | eDraw_UseIBuffer | eDraw_Instanced | eDraw_Indirect; + multidraw.flags |= + DrawFlags::Drawcall | DrawFlags::UseIBuffer | DrawFlags::Instanced | DrawFlags::Indirect; multidraw.topology = MakePrimitiveTopology(m_Real, Mode); multidraw.indexByteWidth = IdxSize; @@ -3017,11 +3030,11 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfv(GLuint framebuffer, GLen FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; if(buf == eGL_COLOR) - draw.flags |= eDraw_ClearColour; + draw.flags |= DrawFlags::ClearColour; else - draw.flags |= eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::ClearDepthStencil; AddDrawcall(draw, true); @@ -3038,10 +3051,10 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfv(GLuint framebuffer, GLen { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } @@ -3155,11 +3168,11 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferiv(GLuint framebuffer, GLen FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; if(buf == eGL_COLOR) - draw.flags |= eDraw_ClearColour; + draw.flags |= DrawFlags::ClearColour; else - draw.flags |= eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::ClearDepthStencil; AddDrawcall(draw, true); @@ -3176,10 +3189,10 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferiv(GLuint framebuffer, GLen { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } @@ -3272,7 +3285,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferuiv(GLuint framebuffer, GLe FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearColour; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearColour; AddDrawcall(draw, true); @@ -3288,10 +3301,10 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferuiv(GLuint framebuffer, GLe { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } @@ -3370,7 +3383,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfi(GLuint framebuffer, GLen FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearDepthStencil; AddDrawcall(draw, true); @@ -3386,10 +3399,10 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfi(GLuint framebuffer, GLen { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } attachment = 0; @@ -3404,10 +3417,10 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfi(GLuint framebuffer, GLen { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } @@ -3761,11 +3774,11 @@ bool WrappedOpenGL::Serialise_glClear(GLbitfield mask) FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; if(Mask & GL_COLOR_BUFFER_BIT) - draw.flags |= eDraw_ClearColour; + draw.flags |= DrawFlags::ClearColour; if(Mask & (eGL_DEPTH_BUFFER_BIT | eGL_STENCIL_BUFFER_BIT)) - draw.flags |= eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::ClearDepthStencil; AddDrawcall(draw, true); @@ -3785,10 +3798,10 @@ bool WrappedOpenGL::Serialise_glClear(GLbitfield mask) { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } @@ -3808,10 +3821,10 @@ bool WrappedOpenGL::Serialise_glClear(GLbitfield mask) { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } @@ -3836,10 +3849,10 @@ bool WrappedOpenGL::Serialise_glClear(GLbitfield mask) { if(type == eGL_TEXTURE) m_ResourceUses[GetResourceManager()->GetID(TextureRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); else m_ResourceUses[GetResourceManager()->GetID(RenderbufferRes(GetCtx(), attachment))].push_back( - EventUsage(m_CurEventID, eUsage_Clear)); + EventUsage(m_CurEventID, ResourceUsage::Clear)); } } } diff --git a/renderdoc/driver/gl/wrappers/gl_emulated.cpp b/renderdoc/driver/gl/wrappers/gl_emulated.cpp index c35ecc1f6..d12b661cf 100644 --- a/renderdoc/driver/gl/wrappers/gl_emulated.cpp +++ b/renderdoc/driver/gl/wrappers/gl_emulated.cpp @@ -1268,17 +1268,17 @@ void APIENTRY _glClearBufferSubData(GLenum target, GLenum internalformat, GLintp ToStr::Get(type).c_str()); } - FormatComponentType compType = eCompType_UInt; + CompType compType = CompType::UInt; switch(type) { case eGL_UNSIGNED_BYTE: case eGL_UNSIGNED_SHORT: - case eGL_UNSIGNED_INT: compType = eCompType_UInt; break; + case eGL_UNSIGNED_INT: compType = CompType::UInt; break; case eGL_BYTE: case eGL_SHORT: - case eGL_INT: compType = eCompType_SInt; break; - case eGL_FLOAT: compType = eCompType_Float; break; + case eGL_INT: compType = CompType::SInt; break; + case eGL_FLOAT: compType = CompType::Float; break; default: break; } diff --git a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp index aa4089a2f..59d5397d3 100644 --- a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp @@ -158,7 +158,7 @@ bool WrappedOpenGL::Serialise_glNamedFramebufferTextureEXT(GLuint framebuffer, G if(m_State == READING && tex) { - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_RTV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= TextureCategory::ColorTarget; } } @@ -303,7 +303,7 @@ bool WrappedOpenGL::Serialise_glNamedFramebufferTexture1DEXT(GLuint framebuffer, if(m_State == READING && tex) { - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_RTV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= TextureCategory::ColorTarget; } } @@ -450,7 +450,7 @@ bool WrappedOpenGL::Serialise_glNamedFramebufferTexture2DEXT(GLuint framebuffer, if(m_State == READING && tex) { - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_RTV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= TextureCategory::ColorTarget; } } @@ -598,7 +598,7 @@ bool WrappedOpenGL::Serialise_glNamedFramebufferTexture3DEXT(GLuint framebuffer, if(m_State == READING && tex) { - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_RTV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= TextureCategory::ColorTarget; } } @@ -746,7 +746,7 @@ bool WrappedOpenGL::Serialise_glNamedFramebufferRenderbufferEXT(GLuint framebuff if(m_State == READING && rb) { - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_RTV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= TextureCategory::ColorTarget; } } @@ -874,7 +874,7 @@ bool WrappedOpenGL::Serialise_glNamedFramebufferTextureLayerEXT(GLuint framebuff if(m_State == READING && tex) { - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_RTV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= TextureCategory::ColorTarget; } } @@ -1483,7 +1483,7 @@ bool WrappedOpenGL::Serialise_glBlitNamedFramebuffer(GLuint readFramebuffer, GLu FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Resolve; + draw.flags |= DrawFlags::Resolve; GLint numCols = 8; m_Real.glGetIntegerv(eGL_MAX_COLOR_ATTACHMENTS, &numCols); @@ -1542,7 +1542,7 @@ bool WrappedOpenGL::Serialise_glBlitNamedFramebuffer(GLuint readFramebuffer, GLu if(dstattachment == srcattachment && srctype == dsttype) { - m_ResourceUses[srcid].push_back(EventUsage(m_CurEventID, eUsage_Copy)); + m_ResourceUses[srcid].push_back(EventUsage(m_CurEventID, ResourceUsage::Copy)); } else { @@ -1552,13 +1552,13 @@ bool WrappedOpenGL::Serialise_glBlitNamedFramebuffer(GLuint readFramebuffer, GLu m_Textures[dstid].curType != eGL_TEXTURE_2D_MULTISAMPLE && m_Textures[dstid].curType != eGL_TEXTURE_2D_MULTISAMPLE_ARRAY) { - m_ResourceUses[srcid].push_back(EventUsage(m_CurEventID, eUsage_ResolveSrc)); - m_ResourceUses[dstid].push_back(EventUsage(m_CurEventID, eUsage_ResolveDst)); + m_ResourceUses[srcid].push_back(EventUsage(m_CurEventID, ResourceUsage::ResolveSrc)); + m_ResourceUses[dstid].push_back(EventUsage(m_CurEventID, ResourceUsage::ResolveDst)); } else { - m_ResourceUses[srcid].push_back(EventUsage(m_CurEventID, eUsage_CopySrc)); - m_ResourceUses[dstid].push_back(EventUsage(m_CurEventID, eUsage_CopyDst)); + m_ResourceUses[srcid].push_back(EventUsage(m_CurEventID, ResourceUsage::CopySrc)); + m_ResourceUses[dstid].push_back(EventUsage(m_CurEventID, ResourceUsage::CopyDst)); } } } diff --git a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp index 254c9ecb4..a192c8aae 100644 --- a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp @@ -122,7 +122,7 @@ bool WrappedOpenGL::Serialise_glCreateTextures(GLenum target, GLsizei n, GLuint m_Textures[live].resource = res; m_Textures[live].curType = TextureTarget(Target); - m_Textures[live].creationFlags |= eTextureCreate_SRV; + m_Textures[live].creationFlags |= TextureCategory::ShaderRead; } return true; @@ -162,7 +162,7 @@ void WrappedOpenGL::glCreateTextures(GLenum target, GLsizei n, GLuint *textures) GetResourceManager()->AddLiveResource(id, res); m_Textures[id].resource = res; m_Textures[id].curType = TextureTarget(target); - m_Textures[id].creationFlags |= eTextureCreate_SRV; + m_Textures[id].creationFlags |= TextureCategory::ShaderRead; } } } @@ -214,7 +214,7 @@ bool WrappedOpenGL::Serialise_glBindTexture(GLenum target, GLuint texture) if(m_State == READING) { m_Textures[GetResourceManager()->GetLiveID(Id)].curType = TextureTarget(Target); - m_Textures[GetResourceManager()->GetLiveID(Id)].creationFlags |= eTextureCreate_SRV; + m_Textures[GetResourceManager()->GetLiveID(Id)].creationFlags |= TextureCategory::ShaderRead; } } } @@ -305,7 +305,8 @@ bool WrappedOpenGL::Serialise_glBindTextures(GLuint first, GLsizei count, const { texs[i] = GetResourceManager()->GetLiveResource(id).name; if(m_State == READING) - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_SRV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= + TextureCategory::ShaderRead; } else { @@ -382,7 +383,7 @@ bool WrappedOpenGL::Serialise_glBindMultiTextureEXT(GLenum texunit, GLenum targe if(m_State == READING) { m_Textures[GetResourceManager()->GetLiveID(Id)].curType = TextureTarget(Target); - m_Textures[GetResourceManager()->GetLiveID(Id)].creationFlags |= eTextureCreate_SRV; + m_Textures[GetResourceManager()->GetLiveID(Id)].creationFlags |= TextureCategory::ShaderRead; } } } @@ -522,7 +523,8 @@ bool WrappedOpenGL::Serialise_glBindImageTexture(GLuint unit, GLuint texture, GL m_Real.glBindImageTexture(Unit, tex, Level, Layered, Layer, Access, Format); if(m_State == READING) - m_Textures[GetResourceManager()->GetLiveID(texid)].creationFlags |= eTextureCreate_UAV; + m_Textures[GetResourceManager()->GetLiveID(texid)].creationFlags |= + TextureCategory::ShaderReadWrite; } return true; @@ -571,7 +573,8 @@ bool WrappedOpenGL::Serialise_glBindImageTextures(GLuint first, GLsizei count, c { texs[i] = GetResourceManager()->GetLiveResource(id).name; if(m_State == READING) - m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= eTextureCreate_UAV; + m_Textures[GetResourceManager()->GetLiveID(id)].creationFlags |= + TextureCategory::ShaderReadWrite; } else { @@ -722,12 +725,12 @@ bool WrappedOpenGL::Serialise_glGenerateTextureMipmapEXT(GLuint texture, GLenum FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_GenMips; + draw.flags |= DrawFlags::GenMips; AddDrawcall(draw, true); m_ResourceUses[GetResourceManager()->GetLiveID(id)].push_back( - EventUsage(m_CurEventID, eUsage_GenMips)); + EventUsage(m_CurEventID, ResourceUsage::GenMips)); } return true; @@ -858,7 +861,7 @@ bool WrappedOpenGL::Serialise_glCopyImageSubData(GLuint srcName, GLenum srcTarge FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = srcid; draw.copyDestination = dstid; @@ -868,14 +871,14 @@ bool WrappedOpenGL::Serialise_glCopyImageSubData(GLuint srcName, GLenum srcTarge if(srcid == dstid) { m_ResourceUses[GetResourceManager()->GetLiveID(srcid)].push_back( - EventUsage(m_CurEventID, eUsage_Copy)); + EventUsage(m_CurEventID, ResourceUsage::Copy)); } else { m_ResourceUses[GetResourceManager()->GetLiveID(srcid)].push_back( - EventUsage(m_CurEventID, eUsage_CopySrc)); + EventUsage(m_CurEventID, ResourceUsage::CopySrc)); m_ResourceUses[GetResourceManager()->GetLiveID(dstid)].push_back( - EventUsage(m_CurEventID, eUsage_CopyDst)); + EventUsage(m_CurEventID, ResourceUsage::CopyDst)); } } diff --git a/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp b/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp index 48564f427..6f7a549d6 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp @@ -70,7 +70,7 @@ VarType State::OperationType(const OpcodeType &op) const case OPCODE_STORE_UAV_TYPED: case OPCODE_STORE_RAW: case OPCODE_STORE_STRUCTURED: - return eVar_Float; + return VarType::Float; // operations that can be either type, also just return float (fixed up later) case OPCODE_SAMPLE: @@ -89,7 +89,7 @@ VarType State::OperationType(const OpcodeType &op) const case OPCODE_SAMPLE_POS: case OPCODE_LOD: case OPCODE_LD: - case OPCODE_LD_MS: return eVar_Float; + case OPCODE_LD_MS: return VarType::Float; case OPCODE_ADD: case OPCODE_MUL: @@ -127,7 +127,7 @@ VarType State::OperationType(const OpcodeType &op) const case OPCODE_DERIV_RTX_FINE: case OPCODE_DERIV_RTY: case OPCODE_DERIV_RTY_COARSE: - case OPCODE_DERIV_RTY_FINE: return eVar_Float; + case OPCODE_DERIV_RTY_FINE: return VarType::Float; case OPCODE_AND: case OPCODE_OR: @@ -149,14 +149,14 @@ VarType State::OperationType(const OpcodeType &op) const case OPCODE_BREAKC: case OPCODE_IF: case OPCODE_ITOF: - case OPCODE_DTOI: return eVar_Int; + case OPCODE_DTOI: return VarType::Int; case OPCODE_ATOMIC_IADD: case OPCODE_ATOMIC_IMAX: case OPCODE_ATOMIC_IMIN: case OPCODE_IMM_ATOMIC_IADD: case OPCODE_IMM_ATOMIC_IMAX: - case OPCODE_IMM_ATOMIC_IMIN: return eVar_Int; + case OPCODE_IMM_ATOMIC_IMIN: return VarType::Int; case OPCODE_ATOMIC_AND: case OPCODE_ATOMIC_OR: case OPCODE_ATOMIC_XOR: @@ -169,7 +169,7 @@ VarType State::OperationType(const OpcodeType &op) const case OPCODE_IMM_ATOMIC_EXCH: case OPCODE_IMM_ATOMIC_CMP_EXCH: case OPCODE_IMM_ATOMIC_UMAX: - case OPCODE_IMM_ATOMIC_UMIN: return eVar_UInt; + case OPCODE_IMM_ATOMIC_UMIN: return VarType::UInt; case OPCODE_BFREV: case OPCODE_COUNTBITS: @@ -196,7 +196,7 @@ VarType State::OperationType(const OpcodeType &op) const case OPCODE_LD_RAW: case OPCODE_LD_UAV_TYPED: case OPCODE_LD_STRUCTURED: - case OPCODE_DTOU: return eVar_UInt; + case OPCODE_DTOU: return VarType::UInt; case OPCODE_DADD: case OPCODE_DMAX: @@ -213,9 +213,9 @@ VarType State::OperationType(const OpcodeType &op) const case OPCODE_DFMA: case OPCODE_DRCP: case OPCODE_ITOD: - case OPCODE_UTOD: return eVar_Double; + case OPCODE_UTOD: return VarType::Double; - default: RDCERR("Unhandled operation %d in shader debugging", op); return eVar_Float; + default: RDCERR("Unhandled operation %d in shader debugging", op); return VarType::Float; } } @@ -223,7 +223,7 @@ void DoubleSet(ShaderVariable &var, const double in[2]) { var.value.d.x = in[0]; var.value.d.y = in[1]; - var.type = eVar_Double; + var.type = VarType::Double; } void DoubleGet(const ShaderVariable &var, double out[2]) @@ -238,25 +238,25 @@ ShaderVariable sat(const ShaderVariable &v, const VarType type) switch(type) { - case eVar_Int: + case VarType::Int: { for(size_t i = 0; i < v.columns; i++) r.value.iv[i] = v.value.iv[i] < 0 ? 0 : (v.value.iv[i] > 1 ? 1 : v.value.iv[i]); break; } - case eVar_UInt: + case VarType::UInt: { for(size_t i = 0; i < v.columns; i++) r.value.uv[i] = v.value.uv[i] ? 1 : 0; break; } - case eVar_Float: + case VarType::Float: { for(size_t i = 0; i < v.columns; i++) r.value.fv[i] = v.value.fv[i] < 0 ? 0 : (v.value.fv[i] > 1 ? 1 : v.value.fv[i]); break; } - case eVar_Double: + case VarType::Double: { double src[2]; DoubleGet(v, src); @@ -287,21 +287,21 @@ ShaderVariable abs(const ShaderVariable &v, const VarType type) switch(type) { - case eVar_Int: + case VarType::Int: { for(size_t i = 0; i < v.columns; i++) r.value.iv[i] = v.value.iv[i] > 0 ? v.value.iv[i] : -v.value.iv[i]; break; } - case eVar_UInt: { break; + case VarType::UInt: { break; } - case eVar_Float: + case VarType::Float: { for(size_t i = 0; i < v.columns; i++) r.value.fv[i] = v.value.fv[i] > 0 ? v.value.fv[i] : -v.value.fv[i]; break; } - case eVar_Double: + case VarType::Double: { double src[2]; DoubleGet(v, src); @@ -332,21 +332,21 @@ ShaderVariable neg(const ShaderVariable &v, const VarType type) switch(type) { - case eVar_Int: + case VarType::Int: { for(size_t i = 0; i < v.columns; i++) r.value.iv[i] = -v.value.iv[i]; break; } - case eVar_UInt: { break; + case VarType::UInt: { break; } - case eVar_Float: + case VarType::Float: { for(size_t i = 0; i < v.columns; i++) r.value.fv[i] = -v.value.fv[i]; break; } - case eVar_Double: + case VarType::Double: { double src[2]; DoubleGet(v, src); @@ -377,25 +377,25 @@ ShaderVariable mul(const ShaderVariable &a, const ShaderVariable &b, const VarTy switch(type) { - case eVar_Int: + case VarType::Int: { for(size_t i = 0; i < a.columns; i++) r.value.iv[i] = a.value.iv[i] * b.value.iv[i]; break; } - case eVar_UInt: + case VarType::UInt: { for(size_t i = 0; i < a.columns; i++) r.value.uv[i] = a.value.uv[i] * b.value.uv[i]; break; } - case eVar_Float: + case VarType::Float: { for(size_t i = 0; i < a.columns; i++) r.value.fv[i] = a.value.fv[i] * b.value.fv[i]; break; } - case eVar_Double: + case VarType::Double: { double src0[2], src1[2]; DoubleGet(a, src0); @@ -427,25 +427,25 @@ ShaderVariable div(const ShaderVariable &a, const ShaderVariable &b, const VarTy switch(type) { - case eVar_Int: + case VarType::Int: { for(size_t i = 0; i < a.columns; i++) r.value.iv[i] = a.value.iv[i] / b.value.iv[i]; break; } - case eVar_UInt: + case VarType::UInt: { for(size_t i = 0; i < a.columns; i++) r.value.uv[i] = a.value.uv[i] / b.value.uv[i]; break; } - case eVar_Float: + case VarType::Float: { for(size_t i = 0; i < a.columns; i++) r.value.fv[i] = a.value.fv[i] / b.value.fv[i]; break; } - case eVar_Double: + case VarType::Double: { double src0[2], src1[2]; DoubleGet(a, src0); @@ -477,25 +477,25 @@ ShaderVariable add(const ShaderVariable &a, const ShaderVariable &b, const VarTy switch(type) { - case eVar_Int: + case VarType::Int: { for(size_t i = 0; i < a.columns; i++) r.value.iv[i] = a.value.iv[i] + b.value.iv[i]; break; } - case eVar_UInt: + case VarType::UInt: { for(size_t i = 0; i < a.columns; i++) r.value.uv[i] = a.value.uv[i] + b.value.uv[i]; break; } - case eVar_Float: + case VarType::Float: { for(size_t i = 0; i < a.columns; i++) r.value.fv[i] = a.value.fv[i] + b.value.fv[i]; break; } - case eVar_Double: + case VarType::Double: { double src0[2], src1[2]; DoubleGet(a, src0); @@ -588,17 +588,17 @@ bool State::Finished() const void State::AssignValue(ShaderVariable &dst, uint32_t dstIndex, const ShaderVariable &src, uint32_t srcIndex) { - if(src.type == eVar_Float) + if(src.type == VarType::Float) { float ft = src.value.fv[srcIndex]; if(!_finite(ft) || _isnan(ft)) - flags |= eShaderDbg_GeneratedNanOrInf; + flags |= ShaderEvents::GeneratedNanOrInf; } - else if(src.type == eVar_Double) + else if(src.type == VarType::Double) { double dt = src.value.dv[srcIndex]; if(!_finite(dt) || _isnan(dt)) - flags |= eShaderDbg_GeneratedNanOrInf; + flags |= ShaderEvents::GeneratedNanOrInf; } dst.value.uv[dstIndex] = src.value.uv[srcIndex]; @@ -1101,7 +1101,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const const ASMOperation &op = s.dxbc->GetInstruction((size_t)s.nextInstruction); s.nextInstruction++; - s.flags = 0; + s.flags = ShaderEvents::NoEvent; vector srcOpers; @@ -2404,7 +2404,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const } if(load) - s.flags = eShaderDbg_SampleLoadGather; + s.flags = ShaderEvents::SampleLoadGather; if(op.operation == OPCODE_LD_STRUCTURED || op.operation == OPCODE_STORE_STRUCTURED) { @@ -2520,7 +2520,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const if(load && !srv && !gsm && (fmt.numComps != 1 || fmt.byteWidth != 4)) { device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::Medium, MessageSource::RuntimeWarning, StringFormat::Fmt( "Shader debugging %d: %s\n" "UAV loads aren't supported from anything but 32-bit single channel resources", @@ -2541,7 +2541,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const numElems = global.groupshared[resIndex].count; stride = global.groupshared[resIndex].bytestride; data = &global.groupshared[resIndex].data[0]; - fmt.fmt = eCompType_UInt; + fmt.fmt = CompType::UInt; fmt.byteWidth = 4; fmt.numComps = global.groupshared[resIndex].bytestride / 4; fmt.reversed = false; @@ -2664,7 +2664,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("No targets bound for sampleinfo on rasterizer"); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::Medium, MessageSource::RuntimeWarning, StringFormat::Fmt( "Shader debugging %d: %s\nNo targets bound for sampleinfo on rasterizer", s.nextInstruction - 1, op.str.c_str())); @@ -2701,7 +2701,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("SRV is NULL being queried by sampleinfo"); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::Medium, MessageSource::RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nSRV is NULL being queried by sampleinfo", s.nextInstruction - 1, op.str.c_str())); } @@ -2735,7 +2735,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("Non multisampled resource provided to sample_info"); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::Medium, MessageSource::RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nSRV is NULL being queried by sampleinfo", s.nextInstruction - 1, op.str.c_str())); } @@ -2769,7 +2769,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("Non-multisampled texture being passed to sample_pos"); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::Medium, MessageSource::RuntimeWarning, StringFormat::Fmt( "Shader debugging %d: %s\nNon-multisampled texture being passed to sample_pos", s.nextInstruction - 1, op.str.c_str())); @@ -2853,7 +2853,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const if(op.operation == OPCODE_SAMPLE_POS) { result = swizzled; - result.type = eVar_Float; + result.type = VarType::Float; } else if(op.resinfoRetType == RETTYPE_FLOAT) { @@ -2861,12 +2861,12 @@ State State::GetNext(GlobalState &global, State quad[4]) const result.value.f.y = (float)swizzled.value.u.y; result.value.f.z = (float)swizzled.value.u.z; result.value.f.w = (float)swizzled.value.u.w; - result.type = eVar_Float; + result.type = VarType::Float; } else { result = swizzled; - result.type = eVar_UInt; + result.type = VarType::UInt; } // if we are assigning into a scalar, SetDst expects the result to be in .x (as normally we @@ -2918,7 +2918,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("Unexpected UAV dimension %d passed to bufinfo", uavDesc.ViewDimension); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::High, MessageSource::RuntimeWarning, StringFormat::Fmt( "Shader debugging %d: %s\nUAV being queried by bufinfo is not a buffer", s.nextInstruction - 1, op.str.c_str())); @@ -2929,7 +2929,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("UAV is NULL being queried by bufinfo"); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::Medium, MessageSource::RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nUAV being queried by bufinfo is NULL", s.nextInstruction - 1, op.str.c_str())); } @@ -2972,7 +2972,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("Unexpected SRV dimension %d passed to bufinfo", srvDesc.ViewDimension); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::High, MessageSource::RuntimeWarning, StringFormat::Fmt( "Shader debugging %d: %s\nSRV being queried by bufinfo is not a buffer", s.nextInstruction - 1, op.str.c_str())); @@ -2983,7 +2983,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("SRV is NULL being queried by bufinfo"); device->AddDebugMessage( - eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, + MessageCategory::Shaders, MessageSeverity::Medium, MessageSource::RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nSRV being queried by bufinfo is NULL", s.nextInstruction - 1, op.str.c_str())); } @@ -3003,7 +3003,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const } result = swizzled; - result.type = eVar_UInt; + result.type = VarType::UInt; // if we are assigning into a scalar, SetDst expects the result to be in .x (as normally we // are assigning FROM a scalar also). @@ -3400,7 +3400,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const result.value.f.y = (float)swizzled.value.u.y; result.value.f.z = (float)swizzled.value.u.z; result.value.f.w = (float)swizzled.value.u.w; - result.type = eVar_Float; + result.type = VarType::Float; } else if(op.resinfoRetType == RETTYPE_RCPFLOAT) { @@ -3422,12 +3422,12 @@ State State::GetNext(GlobalState &global, State quad[4]) const result.value.f.z = (float)swizzled.value.u.z; result.value.f.w = (float)swizzled.value.u.w; - result.type = eVar_Float; + result.type = VarType::Float; } else if(op.resinfoRetType == RETTYPE_UINT) { result = swizzled; - result.type = eVar_UInt; + result.type = VarType::UInt; } // if we are assigning into a scalar, SetDst expects the result to be in .x (as normally we @@ -3470,7 +3470,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const if(op.operation != OPCODE_LOD) { - s.flags = eShaderDbg_SampleLoadGather; + s.flags = ShaderEvents::SampleLoadGather; } if(op.operation == OPCODE_SAMPLE_C || op.operation == OPCODE_SAMPLE_C_LZ || @@ -3529,14 +3529,14 @@ State State::GetNext(GlobalState &global, State quad[4]) const { uint32_t u = *((uint32_t *)d); - if(fmt.fmt == eCompType_UInt) + if(fmt.fmt == CompType::UInt) { result.value.u.x = (u >> 0) & 0x3ff; result.value.u.y = (u >> 10) & 0x3ff; result.value.u.z = (u >> 20) & 0x3ff; result.value.u.w = (u >> 30) & 0x003; } - else if(fmt.fmt == eCompType_UNorm) + else if(fmt.fmt == CompType::UNorm) { Vec4f res = ConvertFromR10G10B10A2(u); result.value.f.x = res.x; @@ -3568,35 +3568,35 @@ State State::GetNext(GlobalState &global, State quad[4]) const } else if(fmt.byteWidth == 2) { - if(fmt.fmt == eCompType_Float) + if(fmt.fmt == CompType::Float) { uint16_t *u = (uint16_t *)d; for(int c = 0; c < fmt.numComps; c++) result.value.fv[c] = ConvertFromHalf(u[c]); } - else if(fmt.fmt == eCompType_UInt) + else if(fmt.fmt == CompType::UInt) { uint16_t *u = (uint16_t *)d; for(int c = 0; c < fmt.numComps; c++) result.value.uv[c] = u[c]; } - else if(fmt.fmt == eCompType_SInt) + else if(fmt.fmt == CompType::SInt) { int16_t *in = (int16_t *)d; for(int c = 0; c < fmt.numComps; c++) result.value.iv[c] = in[c]; } - else if(fmt.fmt == eCompType_UNorm) + else if(fmt.fmt == CompType::UNorm) { uint16_t *u = (uint16_t *)d; for(int c = 0; c < fmt.numComps; c++) result.value.fv[c] = float(u[c]) / float(0xffff); } - else if(fmt.fmt == eCompType_SNorm) + else if(fmt.fmt == CompType::SNorm) { int16_t *in = (int16_t *)d; @@ -3616,28 +3616,28 @@ State State::GetNext(GlobalState &global, State quad[4]) const } else if(fmt.byteWidth == 1) { - if(fmt.fmt == eCompType_UInt) + if(fmt.fmt == CompType::UInt) { uint8_t *u = (uint8_t *)d; for(int c = 0; c < fmt.numComps; c++) result.value.uv[c] = u[c]; } - else if(fmt.fmt == eCompType_SInt) + else if(fmt.fmt == CompType::SInt) { int8_t *in = (int8_t *)d; for(int c = 0; c < fmt.numComps; c++) result.value.iv[c] = in[c]; } - else if(fmt.fmt == eCompType_UNorm) + else if(fmt.fmt == CompType::UNorm) { uint8_t *u = (uint8_t *)d; for(int c = 0; c < fmt.numComps; c++) result.value.fv[c] = float(u[c]) / float(0xff); } - else if(fmt.fmt == eCompType_SNorm) + else if(fmt.fmt == CompType::SNorm) { int8_t *in = (int8_t *)d; @@ -3915,7 +3915,8 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("NaN or Inf in texlookup"); ddxCalc.value.fv[i] = 0.0f; - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, + device->AddDebugMessage(MessageCategory::Shaders, MessageSeverity::High, + MessageSource::RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNaN or Inf found in " "texture lookup ddx - using 0.0 instead", s.nextInstruction - 1, op.str.c_str())); @@ -3925,7 +3926,8 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("NaN or Inf in texlookup"); ddyCalc.value.fv[i] = 0.0f; - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, + device->AddDebugMessage(MessageCategory::Shaders, MessageSeverity::High, + MessageSource::RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNaN or Inf found in " "texture lookup ddy - using 0.0 instead", s.nextInstruction - 1, op.str.c_str())); @@ -3939,7 +3941,8 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("NaN or Inf in texlookup"); uv.value.fv[i] = 0.0f; - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, + device->AddDebugMessage(MessageCategory::Shaders, MessageSeverity::High, + MessageSource::RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNaN or Inf found in " "texture lookup uv - using 0.0 instead", s.nextInstruction - 1, op.str.c_str())); diff --git a/renderdoc/driver/shaders/dxbc/dxbc_debug.h b/renderdoc/driver/shaders/dxbc/dxbc_debug.h index dc17b1ec5..5161512b9 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_debug.h +++ b/renderdoc/driver/shaders/dxbc/dxbc_debug.h @@ -62,13 +62,13 @@ public: byteWidth = 0; numComps = 0; reversed = false; - fmt = eCompType_None; + fmt = CompType::Typeless; } int byteWidth; int numComps; bool reversed; - FormatComponentType fmt; + CompType fmt; int Stride() { @@ -121,7 +121,7 @@ public: { quadIndex = 0; nextInstruction = 0; - flags = 0; + flags = ShaderEvents::NoEvent; done = false; trace = NULL; dxbc = NULL; @@ -132,7 +132,7 @@ public: { quadIndex = quadIdx; nextInstruction = 0; - flags = 0; + flags = ShaderEvents::NoEvent; done = false; trace = t; dxbc = f; diff --git a/renderdoc/driver/shaders/dxbc/dxbc_disassemble.cpp b/renderdoc/driver/shaders/dxbc/dxbc_disassemble.cpp index da7440faf..461eaed60 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_disassemble.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_disassemble.cpp @@ -253,7 +253,7 @@ char *toString(ResourceDimension dim); char *toString(ResourceRetType type); char *toString(ResinfoRetType type); char *toString(InterpolationMode type); -char *SystemValueToString(uint32_t type); +char *SystemValueToString(SVSemantic type); bool ASMOperand::operator==(const ASMOperand &o) const { @@ -1497,7 +1497,7 @@ bool DXBCFile::ExtractDecl(uint32_t *&tokenStream, ASMDecl &retDecl) bool ret = ExtractOperand(tokenStream, retDecl.operand); RDCASSERT(ret); - retDecl.systemValue = tokenStream[0]; + retDecl.systemValue = (SVSemantic)tokenStream[0]; tokenStream++; retDecl.str += " "; @@ -2920,49 +2920,9 @@ char *toString(InterpolationMode interp) return ""; } -char *SystemValueToString(uint32_t name) +char *SystemValueToString(SVSemantic name) { - enum DXBC_SVSemantic - { - SVNAME_UNDEFINED = 0, - SVNAME_POSITION, - SVNAME_CLIP_DISTANCE, - SVNAME_CULL_DISTANCE, - SVNAME_RENDER_TARGET_ARRAY_INDEX, - SVNAME_VIEWPORT_ARRAY_INDEX, - SVNAME_VERTEX_ID, - SVNAME_PRIMITIVE_ID, - SVNAME_INSTANCE_ID, - SVNAME_IS_FRONT_FACE, - SVNAME_SAMPLE_INDEX, - - SVNAME_FINAL_QUAD_EDGE_TESSFACTOR0, - SVNAME_FINAL_QUAD_EDGE_TESSFACTOR1, - SVNAME_FINAL_QUAD_EDGE_TESSFACTOR2, - SVNAME_FINAL_QUAD_EDGE_TESSFACTOR3, - - SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR0, - SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR1, - - SVNAME_FINAL_TRI_EDGE_TESSFACTOR0, - SVNAME_FINAL_TRI_EDGE_TESSFACTOR1, - SVNAME_FINAL_TRI_EDGE_TESSFACTOR2, - - SVNAME_FINAL_TRI_INSIDE_TESSFACTOR, - - SVNAME_FINAL_LINE_DETAIL_TESSFACTOR, - - SVNAME_FINAL_LINE_DENSITY_TESSFACTOR, - - SVNAME_TARGET = 64, - SVNAME_DEPTH, - SVNAME_COVERAGE, - SVNAME_DEPTH_GREATER_EQUAL, - SVNAME_DEPTH_LESS_EQUAL, - }; - - // cast to uint32 for the fixup around tessellation factors where we don't use direct enum values - switch((DXBC_SVSemantic)name) + switch(name) { case SVNAME_POSITION: return "position"; case SVNAME_CLIP_DISTANCE: return "clipdistance"; diff --git a/renderdoc/driver/shaders/dxbc/dxbc_disassemble.h b/renderdoc/driver/shaders/dxbc/dxbc_disassemble.h index 06532101c..3d5922d00 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_disassemble.h +++ b/renderdoc/driver/shaders/dxbc/dxbc_disassemble.h @@ -413,6 +413,49 @@ enum OperandType NUM_OPERAND_TYPES, }; +enum SVSemantic +{ + SVNAME_UNDEFINED = 0, + SVNAME_POSITION, + SVNAME_CLIP_DISTANCE, + SVNAME_CULL_DISTANCE, + SVNAME_RENDER_TARGET_ARRAY_INDEX, + SVNAME_VIEWPORT_ARRAY_INDEX, + SVNAME_VERTEX_ID, + SVNAME_PRIMITIVE_ID, + SVNAME_INSTANCE_ID, + SVNAME_IS_FRONT_FACE, + SVNAME_SAMPLE_INDEX, + + // following are non-contiguous + SVNAME_FINAL_QUAD_EDGE_TESSFACTOR0, + SVNAME_FINAL_QUAD_EDGE_TESSFACTOR = SVNAME_FINAL_QUAD_EDGE_TESSFACTOR0, + SVNAME_FINAL_QUAD_EDGE_TESSFACTOR1, + SVNAME_FINAL_QUAD_EDGE_TESSFACTOR2, + SVNAME_FINAL_QUAD_EDGE_TESSFACTOR3, + + SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR0, + SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR = SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR0, + SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR1, + + SVNAME_FINAL_TRI_EDGE_TESSFACTOR0, + SVNAME_FINAL_TRI_EDGE_TESSFACTOR = SVNAME_FINAL_TRI_EDGE_TESSFACTOR0, + SVNAME_FINAL_TRI_EDGE_TESSFACTOR1, + SVNAME_FINAL_TRI_EDGE_TESSFACTOR2, + + SVNAME_FINAL_TRI_INSIDE_TESSFACTOR, + + SVNAME_FINAL_LINE_DETAIL_TESSFACTOR, + + SVNAME_FINAL_LINE_DENSITY_TESSFACTOR, + + SVNAME_TARGET = 64, + SVNAME_DEPTH, + SVNAME_COVERAGE, + SVNAME_DEPTH_GREATER_EQUAL, + SVNAME_DEPTH_LESS_EQUAL, +}; + enum OperandIndexType { INDEX_IMMEDIATE32 = 0, // 0 @@ -768,7 +811,7 @@ struct ASMDecl dim = RESOURCE_DIMENSION_UNKNOWN; sampleCount = 0; interpolation = INTERPOLATION_UNDEFINED; - systemValue = eAttr_None; + systemValue = SVNAME_UNDEFINED; maxOut = 0; samplerMode = NUM_SAMPLERS; domain = DOMAIN_UNDEFINED; @@ -845,7 +888,7 @@ struct ASMDecl InterpolationMode interpolation; // OPCODE_DCL_INPUT_SIV - uint32_t systemValue; + SVSemantic systemValue; // OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT uint32_t maxOut; diff --git a/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp b/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp index b52a6af81..adb1680f3 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp @@ -190,7 +190,7 @@ struct SIGNElement // after FourCC and chunk length. uint32_t semanticIdx; - uint32_t systemType; + SVSemantic systemType; uint32_t componentType; uint32_t registerNum; @@ -240,64 +240,35 @@ int TypeByteSize(VariableType t) } } -SystemAttribute GetSystemValue(uint32_t systemValue) +ShaderBuiltin GetSystemValue(SVSemantic systemValue) { - enum DXBC_SVSemantic - { - SVNAME_UNDEFINED = 0, - SVNAME_POSITION, - SVNAME_CLIP_DISTANCE, - SVNAME_CULL_DISTANCE, - SVNAME_RENDER_TARGET_ARRAY_INDEX, - SVNAME_VIEWPORT_ARRAY_INDEX, - SVNAME_VERTEX_ID, - SVNAME_PRIMITIVE_ID, - SVNAME_INSTANCE_ID, - SVNAME_IS_FRONT_FACE, - SVNAME_SAMPLE_INDEX, - - // following are non-contiguous - SVNAME_FINAL_QUAD_EDGE_TESSFACTOR, - SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR = SVNAME_FINAL_QUAD_EDGE_TESSFACTOR + 4, - SVNAME_FINAL_TRI_EDGE_TESSFACTOR = SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR + 2, - SVNAME_FINAL_TRI_INSIDE_TESSFACTOR = SVNAME_FINAL_TRI_EDGE_TESSFACTOR + 3, - SVNAME_FINAL_LINE_DETAIL_TESSFACTOR, - SVNAME_FINAL_LINE_DENSITY_TESSFACTOR, - - SVNAME_TARGET = 64, - SVNAME_DEPTH, - SVNAME_COVERAGE, - SVNAME_DEPTH_GREATER_EQUAL, - SVNAME_DEPTH_LESS_EQUAL, - }; - switch(systemValue) { - case SVNAME_UNDEFINED: return eAttr_None; - case SVNAME_POSITION: return eAttr_Position; - case SVNAME_CLIP_DISTANCE: return eAttr_ClipDistance; - case SVNAME_CULL_DISTANCE: return eAttr_CullDistance; - case SVNAME_RENDER_TARGET_ARRAY_INDEX: return eAttr_RTIndex; - case SVNAME_VIEWPORT_ARRAY_INDEX: return eAttr_ViewportIndex; - case SVNAME_VERTEX_ID: return eAttr_VertexIndex; - case SVNAME_PRIMITIVE_ID: return eAttr_PrimitiveIndex; - case SVNAME_INSTANCE_ID: return eAttr_InstanceIndex; - case SVNAME_IS_FRONT_FACE: return eAttr_IsFrontFace; - case SVNAME_SAMPLE_INDEX: return eAttr_MSAASampleIndex; - case SVNAME_FINAL_QUAD_EDGE_TESSFACTOR: return eAttr_OuterTessFactor; - case SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR: return eAttr_InsideTessFactor; - case SVNAME_FINAL_TRI_EDGE_TESSFACTOR: return eAttr_OuterTessFactor; - case SVNAME_FINAL_TRI_INSIDE_TESSFACTOR: return eAttr_InsideTessFactor; - case SVNAME_FINAL_LINE_DETAIL_TESSFACTOR: return eAttr_OuterTessFactor; - case SVNAME_FINAL_LINE_DENSITY_TESSFACTOR: return eAttr_InsideTessFactor; - case SVNAME_TARGET: return eAttr_ColourOutput; - case SVNAME_DEPTH: return eAttr_DepthOutput; - case SVNAME_COVERAGE: return eAttr_MSAACoverage; - case SVNAME_DEPTH_GREATER_EQUAL: return eAttr_DepthOutputGreaterEqual; - case SVNAME_DEPTH_LESS_EQUAL: return eAttr_DepthOutputLessEqual; + case SVNAME_UNDEFINED: return ShaderBuiltin::Undefined; + case SVNAME_POSITION: return ShaderBuiltin::Position; + case SVNAME_CLIP_DISTANCE: return ShaderBuiltin::ClipDistance; + case SVNAME_CULL_DISTANCE: return ShaderBuiltin::CullDistance; + case SVNAME_RENDER_TARGET_ARRAY_INDEX: return ShaderBuiltin::RTIndex; + case SVNAME_VIEWPORT_ARRAY_INDEX: return ShaderBuiltin::ViewportIndex; + case SVNAME_VERTEX_ID: return ShaderBuiltin::VertexIndex; + case SVNAME_PRIMITIVE_ID: return ShaderBuiltin::PrimitiveIndex; + case SVNAME_INSTANCE_ID: return ShaderBuiltin::InstanceIndex; + case SVNAME_IS_FRONT_FACE: return ShaderBuiltin::IsFrontFace; + case SVNAME_SAMPLE_INDEX: return ShaderBuiltin::MSAASampleIndex; + case SVNAME_FINAL_QUAD_EDGE_TESSFACTOR: return ShaderBuiltin::OuterTessFactor; + case SVNAME_FINAL_QUAD_INSIDE_TESSFACTOR: return ShaderBuiltin::InsideTessFactor; + case SVNAME_FINAL_TRI_EDGE_TESSFACTOR: return ShaderBuiltin::OuterTessFactor; + case SVNAME_FINAL_TRI_INSIDE_TESSFACTOR: return ShaderBuiltin::InsideTessFactor; + case SVNAME_FINAL_LINE_DETAIL_TESSFACTOR: return ShaderBuiltin::OuterTessFactor; + case SVNAME_FINAL_LINE_DENSITY_TESSFACTOR: return ShaderBuiltin::InsideTessFactor; + case SVNAME_TARGET: return ShaderBuiltin::ColourOutput; + case SVNAME_DEPTH: return ShaderBuiltin::DepthOutput; + case SVNAME_COVERAGE: return ShaderBuiltin::MSAACoverage; + case SVNAME_DEPTH_GREATER_EQUAL: return ShaderBuiltin::DepthOutputGreaterEqual; + case SVNAME_DEPTH_LESS_EQUAL: return ShaderBuiltin::DepthOutputLessEqual; } - return eAttr_None; + return ShaderBuiltin::Undefined; } string TypeName(CBufferVariableType::Descriptor desc) @@ -899,11 +870,11 @@ DXBCFile::DXBCFile(const void *ByteCode, size_t ByteCodeLength) } ComponentType compType = (ComponentType)el->componentType; - desc.compType = eCompType_Float; + desc.compType = CompType::Float; if(compType == COMPONENT_TYPE_UINT32) - desc.compType = eCompType_UInt; + desc.compType = CompType::UInt; else if(compType == COMPONENT_TYPE_SINT32) - desc.compType = eCompType_SInt; + desc.compType = CompType::SInt; else if(compType != COMPONENT_TYPE_FLOAT32) RDCERR("Unexpected component type in signature"); @@ -919,64 +890,64 @@ DXBCFile::DXBCFile(const void *ByteCode, size_t ByteCodeLength) RDCASSERT(m_Type != (D3D11_ShaderType)-1); // pixel shader outputs with registers are always targets - if(m_Type == D3D11_ShaderType_Pixel && output && desc.systemValue == eAttr_None && - desc.regIndex >= 0 && desc.regIndex <= 16) - desc.systemValue = eAttr_ColourOutput; + if(m_Type == D3D11_ShaderType_Pixel && output && + desc.systemValue == ShaderBuiltin::Undefined && desc.regIndex >= 0 && desc.regIndex <= 16) + desc.systemValue = ShaderBuiltin::ColourOutput; // check system value semantics - if(desc.systemValue == eAttr_None) + if(desc.systemValue == ShaderBuiltin::Undefined) { if(!_stricmp(desc.semanticName.elems, "SV_Position")) - desc.systemValue = eAttr_Position; + desc.systemValue = ShaderBuiltin::Position; if(!_stricmp(desc.semanticName.elems, "SV_ClipDistance")) - desc.systemValue = eAttr_ClipDistance; + desc.systemValue = ShaderBuiltin::ClipDistance; if(!_stricmp(desc.semanticName.elems, "SV_CullDistance")) - desc.systemValue = eAttr_CullDistance; + desc.systemValue = ShaderBuiltin::CullDistance; if(!_stricmp(desc.semanticName.elems, "SV_RenderTargetArrayIndex")) - desc.systemValue = eAttr_RTIndex; + desc.systemValue = ShaderBuiltin::RTIndex; if(!_stricmp(desc.semanticName.elems, "SV_ViewportArrayIndex")) - desc.systemValue = eAttr_ViewportIndex; + desc.systemValue = ShaderBuiltin::ViewportIndex; if(!_stricmp(desc.semanticName.elems, "SV_VertexID")) - desc.systemValue = eAttr_VertexIndex; + desc.systemValue = ShaderBuiltin::VertexIndex; if(!_stricmp(desc.semanticName.elems, "SV_PrimitiveID")) - desc.systemValue = eAttr_PrimitiveIndex; + desc.systemValue = ShaderBuiltin::PrimitiveIndex; if(!_stricmp(desc.semanticName.elems, "SV_InstanceID")) - desc.systemValue = eAttr_InstanceIndex; + desc.systemValue = ShaderBuiltin::InstanceIndex; if(!_stricmp(desc.semanticName.elems, "SV_DispatchThreadID")) - desc.systemValue = eAttr_DispatchThreadIndex; + desc.systemValue = ShaderBuiltin::DispatchThreadIndex; if(!_stricmp(desc.semanticName.elems, "SV_GroupID")) - desc.systemValue = eAttr_GroupIndex; + desc.systemValue = ShaderBuiltin::GroupIndex; if(!_stricmp(desc.semanticName.elems, "SV_GroupIndex")) - desc.systemValue = eAttr_GroupFlatIndex; + desc.systemValue = ShaderBuiltin::GroupFlatIndex; if(!_stricmp(desc.semanticName.elems, "SV_GroupThreadID")) - desc.systemValue = eAttr_GroupThreadIndex; + desc.systemValue = ShaderBuiltin::GroupThreadIndex; if(!_stricmp(desc.semanticName.elems, "SV_GSInstanceID")) - desc.systemValue = eAttr_GSInstanceIndex; + desc.systemValue = ShaderBuiltin::GSInstanceIndex; if(!_stricmp(desc.semanticName.elems, "SV_OutputControlPointID")) - desc.systemValue = eAttr_OutputControlPointIndex; + desc.systemValue = ShaderBuiltin::OutputControlPointIndex; if(!_stricmp(desc.semanticName.elems, "SV_DomainLocation")) - desc.systemValue = eAttr_DomainLocation; + desc.systemValue = ShaderBuiltin::DomainLocation; if(!_stricmp(desc.semanticName.elems, "SV_IsFrontFace")) - desc.systemValue = eAttr_IsFrontFace; + desc.systemValue = ShaderBuiltin::IsFrontFace; if(!_stricmp(desc.semanticName.elems, "SV_SampleIndex")) - desc.systemValue = eAttr_MSAASampleIndex; + desc.systemValue = ShaderBuiltin::MSAASampleIndex; if(!_stricmp(desc.semanticName.elems, "SV_TessFactor")) - desc.systemValue = eAttr_OuterTessFactor; + desc.systemValue = ShaderBuiltin::OuterTessFactor; if(!_stricmp(desc.semanticName.elems, "SV_InsideTessFactor")) - desc.systemValue = eAttr_InsideTessFactor; + desc.systemValue = ShaderBuiltin::InsideTessFactor; if(!_stricmp(desc.semanticName.elems, "SV_Target")) - desc.systemValue = eAttr_ColourOutput; + desc.systemValue = ShaderBuiltin::ColourOutput; if(!_stricmp(desc.semanticName.elems, "SV_Depth")) - desc.systemValue = eAttr_DepthOutput; + desc.systemValue = ShaderBuiltin::DepthOutput; if(!_stricmp(desc.semanticName.elems, "SV_Coverage")) - desc.systemValue = eAttr_MSAACoverage; + desc.systemValue = ShaderBuiltin::MSAACoverage; if(!_stricmp(desc.semanticName.elems, "SV_DepthGreaterEqual")) - desc.systemValue = eAttr_DepthOutputGreaterEqual; + desc.systemValue = ShaderBuiltin::DepthOutputGreaterEqual; if(!_stricmp(desc.semanticName.elems, "SV_DepthLessEqual")) - desc.systemValue = eAttr_DepthOutputLessEqual; + desc.systemValue = ShaderBuiltin::DepthOutputLessEqual; } - RDCASSERT(desc.systemValue != eAttr_None || desc.regIndex >= 0); + RDCASSERT(desc.systemValue != ShaderBuiltin::Undefined || desc.regIndex >= 0); sig->push_back(desc); diff --git a/renderdoc/driver/shaders/spirv/spirv_common.h b/renderdoc/driver/shaders/spirv/spirv_common.h index bd776b835..1929f5f44 100644 --- a/renderdoc/driver/shaders/spirv/spirv_common.h +++ b/renderdoc/driver/shaders/spirv/spirv_common.h @@ -87,7 +87,7 @@ struct SPVModule SPVInstruction *GetByID(uint32_t id); string Disassemble(const string &entryPoint); - void MakeReflection(ShaderStageType stage, const string &entryPoint, ShaderReflection *reflection, + void MakeReflection(ShaderStage stage, const string &entryPoint, ShaderReflection *reflection, ShaderBindpointMapping *mapping); }; diff --git a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp index b85493df9..3114db97e 100644 --- a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp @@ -3505,11 +3505,11 @@ void MakeConstantBlockVariable(ShaderConstant &outConst, SPVTypeData *type, cons if(type->type == SPVTypeData::eVector || type->type == SPVTypeData::eMatrix) { if(type->baseType->type == SPVTypeData::eFloat) - outConst.type.descriptor.type = eVar_Float; + outConst.type.descriptor.type = VarType::Float; else if(type->baseType->type == SPVTypeData::eUInt || type->baseType->type == SPVTypeData::eBool) - outConst.type.descriptor.type = eVar_UInt; + outConst.type.descriptor.type = VarType::UInt; else if(type->baseType->type == SPVTypeData::eSInt) - outConst.type.descriptor.type = eVar_Int; + outConst.type.descriptor.type = VarType::Int; else RDCERR("Unexpected base type of constant variable %u", type->baseType->type); @@ -3540,11 +3540,11 @@ void MakeConstantBlockVariable(ShaderConstant &outConst, SPVTypeData *type, cons else if(type->IsScalar()) { if(type->type == SPVTypeData::eFloat) - outConst.type.descriptor.type = eVar_Float; + outConst.type.descriptor.type = VarType::Float; else if(type->type == SPVTypeData::eUInt || type->type == SPVTypeData::eBool) - outConst.type.descriptor.type = eVar_UInt; + outConst.type.descriptor.type = VarType::UInt; else if(type->type == SPVTypeData::eSInt) - outConst.type.descriptor.type = eVar_Int; + outConst.type.descriptor.type = VarType::Int; else RDCERR("Unexpected base type of constant variable %u", type->type); @@ -3556,7 +3556,7 @@ void MakeConstantBlockVariable(ShaderConstant &outConst, SPVTypeData *type, cons } else { - outConst.type.descriptor.type = eVar_Float; + outConst.type.descriptor.type = VarType::Float; outConst.type.descriptor.rowMajorStorage = false; outConst.type.descriptor.rows = 0; outConst.type.descriptor.cols = 0; @@ -3602,7 +3602,7 @@ uint32_t CalculateMinimumByteSize(const rdctype::array &variable RDCASSERT(last.type.descriptor.elements <= 1); uint32_t basicTypeSize = 4; - if(last.type.descriptor.type == eVar_Double) + if(last.type.descriptor.type == VarType::Double) basicTypeSize = 8; uint32_t rows = last.type.descriptor.rows; @@ -3636,37 +3636,37 @@ uint32_t CalculateMinimumByteSize(const rdctype::array &variable } } -SystemAttribute BuiltInToSystemAttribute(const spv::BuiltIn el) +ShaderBuiltin BuiltInToSystemAttribute(const spv::BuiltIn el) { // not complete, might need to expand system attribute list switch(el) { - case spv::BuiltInPosition: return eAttr_Position; - case spv::BuiltInPointSize: return eAttr_PointSize; - case spv::BuiltInClipDistance: return eAttr_ClipDistance; - case spv::BuiltInCullDistance: return eAttr_CullDistance; - case spv::BuiltInVertexId: return eAttr_VertexIndex; - case spv::BuiltInInstanceId: return eAttr_InstanceIndex; - case spv::BuiltInPrimitiveId: return eAttr_PrimitiveIndex; - case spv::BuiltInInvocationId: return eAttr_InvocationIndex; - case spv::BuiltInLayer: return eAttr_RTIndex; - case spv::BuiltInViewportIndex: return eAttr_ViewportIndex; - case spv::BuiltInTessLevelOuter: return eAttr_OuterTessFactor; - case spv::BuiltInTessLevelInner: return eAttr_InsideTessFactor; - case spv::BuiltInPatchVertices: return eAttr_PatchNumVertices; - case spv::BuiltInFrontFacing: return eAttr_IsFrontFace; - case spv::BuiltInSampleId: return eAttr_MSAASampleIndex; - case spv::BuiltInSamplePosition: return eAttr_MSAASamplePosition; - case spv::BuiltInSampleMask: return eAttr_MSAACoverage; + case spv::BuiltInPosition: return ShaderBuiltin::Position; + case spv::BuiltInPointSize: return ShaderBuiltin::PointSize; + case spv::BuiltInClipDistance: return ShaderBuiltin::ClipDistance; + case spv::BuiltInCullDistance: return ShaderBuiltin::CullDistance; + case spv::BuiltInVertexId: return ShaderBuiltin::VertexIndex; + case spv::BuiltInInstanceId: return ShaderBuiltin::InstanceIndex; + case spv::BuiltInPrimitiveId: return ShaderBuiltin::PrimitiveIndex; + case spv::BuiltInInvocationId: return ShaderBuiltin::InvocationIndex; + case spv::BuiltInLayer: return ShaderBuiltin::RTIndex; + case spv::BuiltInViewportIndex: return ShaderBuiltin::ViewportIndex; + case spv::BuiltInTessLevelOuter: return ShaderBuiltin::OuterTessFactor; + case spv::BuiltInTessLevelInner: return ShaderBuiltin::InsideTessFactor; + case spv::BuiltInPatchVertices: return ShaderBuiltin::PatchNumVertices; + case spv::BuiltInFrontFacing: return ShaderBuiltin::IsFrontFace; + case spv::BuiltInSampleId: return ShaderBuiltin::MSAASampleIndex; + case spv::BuiltInSamplePosition: return ShaderBuiltin::MSAASamplePosition; + case spv::BuiltInSampleMask: return ShaderBuiltin::MSAACoverage; case spv::BuiltInFragDepth: - return eAttr_DepthOutput; - // case spv::BuiltInVertexIndex: return eAttr_Vertex0Index; - // case spv::BuiltInInstanceIndex: return eAttr_Instance0Index; + return ShaderBuiltin::DepthOutput; + // case spv::BuiltInVertexIndex: return ShaderBuiltin::Vertex0Index; + // case spv::BuiltInInstanceIndex: return ShaderBuiltin::Instance0Index; default: break; } - return eAttr_None; + return ShaderBuiltin::Undefined; } template @@ -3696,7 +3696,7 @@ struct bindpair typedef bindpair cblockpair; typedef bindpair shaderrespair; -void AddSignatureParameter(ShaderStageType stage, uint32_t id, uint32_t childIdx, string varName, +void AddSignatureParameter(ShaderStage stage, uint32_t id, uint32_t childIdx, string varName, SPVTypeData *type, const vector &decorations, vector &sigarray) { @@ -3726,8 +3726,8 @@ void AddSignatureParameter(ShaderStageType stage, uint32_t id, uint32_t childIdx } // fragment shader outputs are implicitly colour outputs - if(stage == eShaderStage_Fragment && type->storage == spv::StorageClassOutput) - sig.systemValue = eAttr_ColourOutput; + if(stage == ShaderStage::Fragment && type->storage == spv::StorageClassOutput) + sig.systemValue = ShaderBuiltin::ColourOutput; if(type->type == SPVTypeData::ePointer) type = type->baseType; @@ -3801,9 +3801,9 @@ void AddSignatureParameter(ShaderStageType stage, uint32_t id, uint32_t childIdx switch(type->baseType ? type->baseType->type : type->type) { case SPVTypeData::eBool: - case SPVTypeData::eUInt: sig.compType = eCompType_UInt; break; - case SPVTypeData::eSInt: sig.compType = eCompType_SInt; break; - case SPVTypeData::eFloat: sig.compType = eCompType_Float; break; + case SPVTypeData::eUInt: sig.compType = CompType::UInt; break; + case SPVTypeData::eSInt: sig.compType = CompType::SInt; break; + case SPVTypeData::eFloat: sig.compType = CompType::Float; break; default: RDCERR("Unexpected base type of input/output signature %u", type->baseType ? type->baseType->type : type->type); @@ -3849,7 +3849,7 @@ void AddSignatureParameter(ShaderStageType stage, uint32_t id, uint32_t childIdx } } -void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, +void SPVModule::MakeReflection(ShaderStage stage, const string &entryPoint, ShaderReflection *reflection, ShaderBindpointMapping *mapping) { vector inputs; @@ -3998,7 +3998,7 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, if(eliminate) { - SystemAttribute attr = BuiltInToSystemAttribute(checkBuiltin); + ShaderBuiltin attr = BuiltInToSystemAttribute(checkBuiltin); // find this builtin in the array, and remove for(auto it = sigarray->begin(); it != sigarray->end(); ++it) { @@ -4078,13 +4078,13 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, res.IsSRV = false; res.IsTexture = false; res.name = cblock.name; - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.variableType.descriptor.cols = 0; res.variableType.descriptor.rows = 0; res.variableType.descriptor.rowMajorStorage = false; res.variableType.descriptor.rows = 0; - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; res.variableType.descriptor.name = type->GetName(); MakeConstantBlockVariables(type, res.variableType.members); @@ -4131,27 +4131,27 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, res.name = inst->str.empty() ? StringFormat::Fmt("res%u", inst->id) : inst->str; if(type->multisampled) - res.resType = type->arrayed ? eResType_Texture2DMSArray : eResType_Texture2DMS; + res.resType = type->arrayed ? TextureDim::Texture2DMSArray : TextureDim::Texture2DMS; else if(type->texdim == spv::Dim1D) - res.resType = type->arrayed ? eResType_Texture1DArray : eResType_Texture1D; + res.resType = type->arrayed ? TextureDim::Texture1DArray : TextureDim::Texture1D; else if(type->texdim == spv::Dim2D) - res.resType = type->arrayed ? eResType_Texture2DArray : eResType_Texture2D; + res.resType = type->arrayed ? TextureDim::Texture2DArray : TextureDim::Texture2D; else if(type->texdim == spv::DimCube) - res.resType = type->arrayed ? eResType_TextureCubeArray : eResType_TextureCube; + res.resType = type->arrayed ? TextureDim::TextureCubeArray : TextureDim::TextureCube; else if(type->texdim == spv::Dim3D) - res.resType = eResType_Texture3D; + res.resType = TextureDim::Texture3D; else if(type->texdim == spv::DimRect) - res.resType = eResType_TextureRect; + res.resType = TextureDim::TextureRect; else if(type->texdim == spv::DimBuffer) - res.resType = eResType_Buffer; + res.resType = TextureDim::Buffer; res.IsSampler = type->type == SPVTypeData::eSampledImage || type->type == SPVTypeData::eSampler; - res.IsTexture = res.resType != eResType_Buffer && type->type != SPVTypeData::eSampler; + res.IsTexture = res.resType != TextureDim::Buffer && type->type != SPVTypeData::eSampler; if(type->type == SPVTypeData::eSampler) { - res.resType = eResType_None; + res.resType = TextureDim::Unknown; res.IsSRV = false; } @@ -4160,19 +4160,19 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, SPVTypeData *sampledType = type->baseType; if(type->type == SPVTypeData::eSampler) { - res.resType = eResType_None; + res.resType = TextureDim::Unknown; } else if(type->texdim == spv::DimSubpassData) { - res.resType = eResType_Texture2D; + res.resType = TextureDim::Texture2D; res.IsSRV = true; if(sampledType->type == SPVTypeData::eFloat) - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; else if(sampledType->type == SPVTypeData::eUInt) - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; else if(sampledType->type == SPVTypeData::eSInt) - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; else RDCERR("Unexpected base type of resource %u", sampledType->type); } @@ -4191,11 +4191,11 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, res.IsSRV = !isrw; if(sampledType->type == SPVTypeData::eFloat) - res.variableType.descriptor.type = eVar_Float; + res.variableType.descriptor.type = VarType::Float; else if(sampledType->type == SPVTypeData::eUInt) - res.variableType.descriptor.type = eVar_UInt; + res.variableType.descriptor.type = VarType::UInt; else if(sampledType->type == SPVTypeData::eSInt) - res.variableType.descriptor.type = eVar_Int; + res.variableType.descriptor.type = VarType::Int; else RDCERR("Unexpected base type of resource %u", sampledType->type); } @@ -4326,9 +4326,9 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, return strcmp(a.varName.elems, b.varName.elems) < 0; } - if(a.systemValue == eAttr_None) + if(a.systemValue == ShaderBuiltin::Undefined) return false; - if(b.systemValue == eAttr_None) + if(b.systemValue == ShaderBuiltin::Undefined) return true; return a.systemValue < b.systemValue; @@ -4341,7 +4341,7 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, size_t numInputs = 16; for(size_t i = 0; i < inputs.size(); i++) - if(inputs[i].systemValue == eAttr_None) + if(inputs[i].systemValue == ShaderBuiltin::Undefined) numInputs = RDCMAX(numInputs, (size_t)inputs[i].regIndex + 1); create_array_uninit(mapping->InputAttributes, numInputs); @@ -4349,7 +4349,7 @@ void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint, mapping->InputAttributes[i] = -1; for(size_t i = 0; i < inputs.size(); i++) - if(inputs[i].systemValue == eAttr_None) + if(inputs[i].systemValue == ShaderBuiltin::Undefined) mapping->InputAttributes[inputs[i].regIndex] = (int32_t)i; reflection->InputSig = inputs; diff --git a/renderdoc/driver/vulkan/vk_android.cpp b/renderdoc/driver/vulkan/vk_android.cpp index b5947ee10..6541326d5 100644 --- a/renderdoc/driver/vulkan/vk_android.cpp +++ b/renderdoc/driver/vulkan/vk_android.cpp @@ -27,7 +27,7 @@ void VulkanReplay::OutputWindow::SetWindowHandle(WindowingSystem system, void *data) { - RDCASSERT(system == eWindowingSystem_Android, system); + RDCASSERT(system == WindowingSystem::Android, system); wnd = (ANativeWindow *)data; m_WindowSystem = system; } @@ -58,7 +58,7 @@ void VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h const char *VulkanLibraryName = "libvulkan.so"; -bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &myJSONs, +bool VulkanReplay::CheckVulkanLayer(VulkanLayerFlags &flags, std::vector &myJSONs, std::vector &otherJSONs) { // nothing to do diff --git a/renderdoc/driver/vulkan/vk_apple.cpp b/renderdoc/driver/vulkan/vk_apple.cpp index 7e570155f..c617e3714 100644 --- a/renderdoc/driver/vulkan/vk_apple.cpp +++ b/renderdoc/driver/vulkan/vk_apple.cpp @@ -43,7 +43,7 @@ void VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h const char *VulkanLibraryName = "libvulkan.so"; -bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &myJSONs, +bool VulkanReplay::CheckVulkanLayer(VulkanLayerFlags &flags, std::vector &myJSONs, std::vector &otherJSONs) { return false; diff --git a/renderdoc/driver/vulkan/vk_common.cpp b/renderdoc/driver/vulkan/vk_common.cpp index ce1dfdc6b..b203b3e8f 100644 --- a/renderdoc/driver/vulkan/vk_common.cpp +++ b/renderdoc/driver/vulkan/vk_common.cpp @@ -150,11 +150,11 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) ret.rawType = (uint32_t)fmt; ret.special = false; - ret.specialFormat = eSpecial_Unknown; + ret.specialFormat = SpecialFormat::Unknown; ret.strname = ToStr::Get(fmt).substr(10); // 3 == strlen("VK_FORMAT_") ret.compByteWidth = 0; ret.compCount = 0; - ret.compType = eCompType_None; + ret.compType = CompType::Typeless; ret.srgbCorrected = false; if(fmt == VK_FORMAT_UNDEFINED) @@ -166,12 +166,12 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) { case VK_FORMAT_R4G4_UNORM_PACK8: ret.special = true; - ret.specialFormat = eSpecial_R4G4; + ret.specialFormat = SpecialFormat::R4G4; break; case VK_FORMAT_R4G4B4A4_UNORM_PACK16: case VK_FORMAT_B4G4R4A4_UNORM_PACK16: ret.special = true; - ret.specialFormat = eSpecial_R4G4B4A4; + ret.specialFormat = SpecialFormat::R4G4B4A4; break; case VK_FORMAT_A2B10G10R10_UNORM_PACK32: case VK_FORMAT_A2R10G10B10_UNORM_PACK32: @@ -186,75 +186,75 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_A2B10G10R10_SINT_PACK32: case VK_FORMAT_A2R10G10B10_SINT_PACK32: ret.special = true; - ret.specialFormat = eSpecial_R10G10B10A2; + ret.specialFormat = SpecialFormat::R10G10B10A2; break; case VK_FORMAT_B10G11R11_UFLOAT_PACK32: ret.special = true; - ret.specialFormat = eSpecial_R11G11B10; + ret.specialFormat = SpecialFormat::R11G11B10; break; case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: ret.special = true; - ret.specialFormat = eSpecial_R9G9B9E5; + ret.specialFormat = SpecialFormat::R9G9B9E5; break; case VK_FORMAT_R5G6B5_UNORM_PACK16: case VK_FORMAT_B5G6R5_UNORM_PACK16: ret.special = true; - ret.specialFormat = eSpecial_R5G6B5; + ret.specialFormat = SpecialFormat::R5G6B5; break; case VK_FORMAT_R5G5B5A1_UNORM_PACK16: case VK_FORMAT_B5G5R5A1_UNORM_PACK16: case VK_FORMAT_A1R5G5B5_UNORM_PACK16: ret.special = true; - ret.specialFormat = eSpecial_R5G5B5A1; + ret.specialFormat = SpecialFormat::R5G5B5A1; break; case VK_FORMAT_D16_UNORM_S8_UINT: ret.special = true; - ret.specialFormat = eSpecial_D16S8; + ret.specialFormat = SpecialFormat::D16S8; break; case VK_FORMAT_D24_UNORM_S8_UINT: ret.special = true; - ret.specialFormat = eSpecial_D24S8; + ret.specialFormat = SpecialFormat::D24S8; break; case VK_FORMAT_D32_SFLOAT_S8_UINT: ret.special = true; - ret.specialFormat = eSpecial_D32S8; + ret.specialFormat = SpecialFormat::D32S8; break; case VK_FORMAT_BC1_RGB_UNORM_BLOCK: case VK_FORMAT_BC1_RGB_SRGB_BLOCK: case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: case VK_FORMAT_BC1_RGBA_SRGB_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_BC1; + ret.specialFormat = SpecialFormat::BC1; break; case VK_FORMAT_BC2_UNORM_BLOCK: case VK_FORMAT_BC2_SRGB_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_BC2; + ret.specialFormat = SpecialFormat::BC2; break; case VK_FORMAT_BC3_UNORM_BLOCK: case VK_FORMAT_BC3_SRGB_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_BC3; + ret.specialFormat = SpecialFormat::BC3; break; case VK_FORMAT_BC4_UNORM_BLOCK: case VK_FORMAT_BC4_SNORM_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_BC4; + ret.specialFormat = SpecialFormat::BC4; break; case VK_FORMAT_BC5_UNORM_BLOCK: case VK_FORMAT_BC5_SNORM_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_BC5; + ret.specialFormat = SpecialFormat::BC5; break; case VK_FORMAT_BC6H_UFLOAT_BLOCK: case VK_FORMAT_BC6H_SFLOAT_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_BC6; + ret.specialFormat = SpecialFormat::BC6; break; case VK_FORMAT_BC7_UNORM_BLOCK: case VK_FORMAT_BC7_SRGB_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_BC7; + ret.specialFormat = SpecialFormat::BC7; break; case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: @@ -263,14 +263,14 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_ETC2; + ret.specialFormat = SpecialFormat::ETC2; break; case VK_FORMAT_EAC_R11_UNORM_BLOCK: case VK_FORMAT_EAC_R11_SNORM_BLOCK: case VK_FORMAT_EAC_R11G11_UNORM_BLOCK: case VK_FORMAT_EAC_R11G11_SNORM_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_EAC; + ret.specialFormat = SpecialFormat::EAC; break; case VK_FORMAT_ASTC_4x4_UNORM_BLOCK: case VK_FORMAT_ASTC_4x4_SRGB_BLOCK: @@ -301,7 +301,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_ASTC_12x12_UNORM_BLOCK: case VK_FORMAT_ASTC_12x12_SRGB_BLOCK: ret.special = true; - ret.specialFormat = eSpecial_ASTC; + ret.specialFormat = SpecialFormat::ASTC; break; default: break; } @@ -589,7 +589,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_B8G8R8A8_SRGB: case VK_FORMAT_A8B8G8R8_UNORM_PACK32: case VK_FORMAT_A8B8G8R8_SRGB_PACK32: - case VK_FORMAT_A2B10G10R10_UNORM_PACK32: ret.compType = eCompType_UNorm; break; + case VK_FORMAT_A2B10G10R10_UNORM_PACK32: ret.compType = CompType::UNorm; break; case VK_FORMAT_R8_SNORM: case VK_FORMAT_R8G8_SNORM: case VK_FORMAT_R8G8B8_SNORM: @@ -607,7 +607,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_B8G8R8_SNORM: case VK_FORMAT_B8G8R8A8_SNORM: case VK_FORMAT_A8B8G8R8_SNORM_PACK32: - case VK_FORMAT_A2B10G10R10_SNORM_PACK32: ret.compType = eCompType_SNorm; break; + case VK_FORMAT_A2B10G10R10_SNORM_PACK32: ret.compType = CompType::SNorm; break; case VK_FORMAT_R8_USCALED: case VK_FORMAT_R8G8_USCALED: case VK_FORMAT_R8G8B8_USCALED: @@ -619,7 +619,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_A2R10G10B10_USCALED_PACK32: case VK_FORMAT_B8G8R8_USCALED: case VK_FORMAT_B8G8R8A8_USCALED: - case VK_FORMAT_A2B10G10R10_USCALED_PACK32: ret.compType = eCompType_UScaled; break; + case VK_FORMAT_A2B10G10R10_USCALED_PACK32: ret.compType = CompType::UScaled; break; case VK_FORMAT_R8_SSCALED: case VK_FORMAT_R8G8_SSCALED: case VK_FORMAT_R8G8B8_SSCALED: @@ -632,7 +632,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_R16G16B16A16_SSCALED: case VK_FORMAT_B8G8R8_SSCALED: case VK_FORMAT_B8G8R8A8_SSCALED: - case VK_FORMAT_A2B10G10R10_SSCALED_PACK32: ret.compType = eCompType_SScaled; break; + case VK_FORMAT_A2B10G10R10_SSCALED_PACK32: ret.compType = CompType::SScaled; break; case VK_FORMAT_R8_UINT: case VK_FORMAT_R8G8_UINT: case VK_FORMAT_R8G8B8_UINT: @@ -652,7 +652,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_S8_UINT: case VK_FORMAT_B8G8R8_UINT: case VK_FORMAT_B8G8R8A8_UINT: - case VK_FORMAT_A2B10G10R10_UINT_PACK32: ret.compType = eCompType_UInt; break; + case VK_FORMAT_A2B10G10R10_UINT_PACK32: ret.compType = CompType::UInt; break; case VK_FORMAT_R8_SINT: case VK_FORMAT_R8G8_SINT: case VK_FORMAT_R8G8B8_SINT: @@ -668,7 +668,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_R32G32B32A32_SINT: case VK_FORMAT_B8G8R8_SINT: case VK_FORMAT_B8G8R8A8_SINT: - case VK_FORMAT_A2B10G10R10_SINT_PACK32: ret.compType = eCompType_SInt; break; + case VK_FORMAT_A2B10G10R10_SINT_PACK32: ret.compType = CompType::SInt; break; case VK_FORMAT_R16_SFLOAT: case VK_FORMAT_R16G16_SFLOAT: case VK_FORMAT_R16G16B16_SFLOAT: @@ -678,14 +678,14 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_R32G32B32_SFLOAT: case VK_FORMAT_R32G32B32A32_SFLOAT: case VK_FORMAT_B10G11R11_UFLOAT_PACK32: - case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: ret.compType = eCompType_Float; break; + case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: ret.compType = CompType::Float; break; case VK_FORMAT_R64_SFLOAT: case VK_FORMAT_R64G64_SFLOAT: case VK_FORMAT_R64G64B64_SFLOAT: - case VK_FORMAT_R64G64B64A64_SFLOAT: ret.compType = eCompType_Double; break; + case VK_FORMAT_R64G64B64A64_SFLOAT: ret.compType = CompType::Double; break; case VK_FORMAT_D16_UNORM: case VK_FORMAT_X8_D24_UNORM_PACK32: - case VK_FORMAT_D32_SFLOAT: ret.compType = eCompType_Depth; break; + case VK_FORMAT_D32_SFLOAT: ret.compType = CompType::Depth; break; default: break; } @@ -801,7 +801,7 @@ VkFormat MakeVkFormat(ResourceFormat fmt) { switch(fmt.specialFormat) { - case eSpecial_BC1: + case SpecialFormat::BC1: { if(fmt.compCount == 3) ret = fmt.srgbCorrected ? VK_FORMAT_BC1_RGB_SRGB_BLOCK : VK_FORMAT_BC1_RGB_UNORM_BLOCK; @@ -809,26 +809,26 @@ VkFormat MakeVkFormat(ResourceFormat fmt) ret = fmt.srgbCorrected ? VK_FORMAT_BC1_RGBA_SRGB_BLOCK : VK_FORMAT_BC1_RGBA_UNORM_BLOCK; break; } - case eSpecial_BC2: + case SpecialFormat::BC2: ret = fmt.srgbCorrected ? VK_FORMAT_BC2_SRGB_BLOCK : VK_FORMAT_BC2_UNORM_BLOCK; break; - case eSpecial_BC3: + case SpecialFormat::BC3: ret = fmt.srgbCorrected ? VK_FORMAT_BC3_SRGB_BLOCK : VK_FORMAT_BC3_UNORM_BLOCK; break; - case eSpecial_BC4: - ret = fmt.compType == eCompType_SNorm ? VK_FORMAT_BC4_SNORM_BLOCK : VK_FORMAT_BC4_UNORM_BLOCK; + case SpecialFormat::BC4: + ret = fmt.compType == CompType::SNorm ? VK_FORMAT_BC4_SNORM_BLOCK : VK_FORMAT_BC4_UNORM_BLOCK; break; - case eSpecial_BC5: - ret = fmt.compType == eCompType_SNorm ? VK_FORMAT_BC5_SNORM_BLOCK : VK_FORMAT_BC5_UNORM_BLOCK; + case SpecialFormat::BC5: + ret = fmt.compType == CompType::SNorm ? VK_FORMAT_BC5_SNORM_BLOCK : VK_FORMAT_BC5_UNORM_BLOCK; break; - case eSpecial_BC6: - ret = fmt.compType == eCompType_SNorm ? VK_FORMAT_BC6H_SFLOAT_BLOCK + case SpecialFormat::BC6: + ret = fmt.compType == CompType::SNorm ? VK_FORMAT_BC6H_SFLOAT_BLOCK : VK_FORMAT_BC6H_UFLOAT_BLOCK; break; - case eSpecial_BC7: + case SpecialFormat::BC7: ret = fmt.srgbCorrected ? VK_FORMAT_BC7_SRGB_BLOCK : VK_FORMAT_BC7_UNORM_BLOCK; break; - case eSpecial_ETC2: + case SpecialFormat::ETC2: { if(fmt.compCount == 3) ret = fmt.srgbCorrected ? VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK @@ -838,46 +838,46 @@ VkFormat MakeVkFormat(ResourceFormat fmt) : VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; break; } - case eSpecial_EAC: + case SpecialFormat::EAC: { if(fmt.compCount == 1) - ret = fmt.compType == eCompType_SNorm ? VK_FORMAT_EAC_R11_SNORM_BLOCK + ret = fmt.compType == CompType::SNorm ? VK_FORMAT_EAC_R11_SNORM_BLOCK : VK_FORMAT_EAC_R11_UNORM_BLOCK; else if(fmt.compCount == 2) - ret = fmt.compType == eCompType_SNorm ? VK_FORMAT_EAC_R11G11_SNORM_BLOCK + ret = fmt.compType == CompType::SNorm ? VK_FORMAT_EAC_R11G11_SNORM_BLOCK : VK_FORMAT_EAC_R11G11_UNORM_BLOCK; break; } - case eSpecial_R10G10B10A2: - if(fmt.compType == eCompType_UNorm) + case SpecialFormat::R10G10B10A2: + if(fmt.compType == CompType::UNorm) ret = fmt.bgraOrder ? VK_FORMAT_A2B10G10R10_UNORM_PACK32 : VK_FORMAT_A2R10G10B10_UNORM_PACK32; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = fmt.bgraOrder ? VK_FORMAT_A2B10G10R10_UINT_PACK32 : VK_FORMAT_A2R10G10B10_UINT_PACK32; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = fmt.bgraOrder ? VK_FORMAT_A2B10G10R10_USCALED_PACK32 : VK_FORMAT_A2R10G10B10_USCALED_PACK32; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = fmt.bgraOrder ? VK_FORMAT_A2B10G10R10_SNORM_PACK32 : VK_FORMAT_A2R10G10B10_SNORM_PACK32; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = fmt.bgraOrder ? VK_FORMAT_A2B10G10R10_SINT_PACK32 : VK_FORMAT_A2R10G10B10_SINT_PACK32; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = fmt.bgraOrder ? VK_FORMAT_A2B10G10R10_SSCALED_PACK32 : VK_FORMAT_A2R10G10B10_SSCALED_PACK32; break; - case eSpecial_R11G11B10: ret = VK_FORMAT_B10G11R11_UFLOAT_PACK32; break; - case eSpecial_R5G6B5: ret = VK_FORMAT_B5G6R5_UNORM_PACK16; break; - case eSpecial_R5G5B5A1: + case SpecialFormat::R11G11B10: ret = VK_FORMAT_B10G11R11_UFLOAT_PACK32; break; + case SpecialFormat::R5G6B5: ret = VK_FORMAT_B5G6R5_UNORM_PACK16; break; + case SpecialFormat::R5G5B5A1: ret = fmt.bgraOrder ? VK_FORMAT_B5G5R5A1_UNORM_PACK16 : VK_FORMAT_R5G5B5A1_UNORM_PACK16; break; - case eSpecial_R9G9B9E5: ret = VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; break; - case eSpecial_R4G4B4A4: + case SpecialFormat::R9G9B9E5: ret = VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; break; + case SpecialFormat::R4G4B4A4: ret = fmt.bgraOrder ? VK_FORMAT_R4G4B4A4_UNORM_PACK16 : VK_FORMAT_B4G4R4A4_UNORM_PACK16; break; - case eSpecial_R4G4: ret = VK_FORMAT_R4G4_UNORM_PACK8; break; - case eSpecial_D24S8: ret = VK_FORMAT_D24_UNORM_S8_UINT; break; - case eSpecial_D32S8: ret = VK_FORMAT_D32_SFLOAT_S8_UINT; break; + case SpecialFormat::R4G4: ret = VK_FORMAT_R4G4_UNORM_PACK8; break; + case SpecialFormat::D24S8: ret = VK_FORMAT_D24_UNORM_S8_UINT; break; + case SpecialFormat::D32S8: ret = VK_FORMAT_D32_SFLOAT_S8_UINT; break; default: RDCERR("Unsupported special format %u", fmt.specialFormat); break; } } @@ -889,47 +889,47 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R32G32B32A32_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R32G32B32A32_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R32G32B32A32_UINT; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R16G16B16A16_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R16G16B16A16_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R16G16B16A16_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = VK_FORMAT_R16G16B16A16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = VK_FORMAT_R16G16B16A16_UNORM; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = VK_FORMAT_R16G16B16A16_SSCALED; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = VK_FORMAT_R16G16B16A16_USCALED; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = fmt.bgraOrder ? VK_FORMAT_B8G8R8A8_SINT : VK_FORMAT_R8G8B8A8_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = fmt.bgraOrder ? VK_FORMAT_B8G8R8A8_UINT : VK_FORMAT_R8G8B8A8_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = fmt.bgraOrder ? VK_FORMAT_B8G8R8A8_SNORM : VK_FORMAT_R8G8B8A8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = fmt.bgraOrder ? VK_FORMAT_B8G8R8A8_UNORM : VK_FORMAT_R8G8B8A8_UNORM; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = fmt.bgraOrder ? VK_FORMAT_B8G8R8A8_SSCALED : VK_FORMAT_R8G8B8A8_SSCALED; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = fmt.bgraOrder ? VK_FORMAT_B8G8R8A8_USCALED : VK_FORMAT_R8G8B8A8_USCALED; else RDCERR("Unrecognised component type"); @@ -947,47 +947,47 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R32G32B32_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R32G32B32_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R32G32B32_UINT; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R16G16B16_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R16G16B16_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R16G16B16_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = VK_FORMAT_R16G16B16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = VK_FORMAT_R16G16B16_UNORM; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = VK_FORMAT_R16G16B16_SSCALED; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = VK_FORMAT_R16G16B16_USCALED; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R8G8B8_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R8G8B8_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = VK_FORMAT_R8G8B8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = VK_FORMAT_R8G8B8_UNORM; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = VK_FORMAT_R8G8B8_SSCALED; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = VK_FORMAT_R8G8B8_USCALED; else RDCERR("Unrecognised component type"); @@ -1001,47 +1001,47 @@ VkFormat MakeVkFormat(ResourceFormat fmt) { if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R32G32_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R32G32_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R32G32_UINT; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R16G16_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R16G16_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R16G16_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = VK_FORMAT_R16G16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = VK_FORMAT_R16G16_UNORM; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = VK_FORMAT_R16G16_SSCALED; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = VK_FORMAT_R16G16_USCALED; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R8G8_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R8G8_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = VK_FORMAT_R8G8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = VK_FORMAT_R8G8_UNORM; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = VK_FORMAT_R8G8_SSCALED; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = VK_FORMAT_R8G8_USCALED; else RDCERR("Unrecognised component type"); @@ -1055,51 +1055,51 @@ VkFormat MakeVkFormat(ResourceFormat fmt) { if(fmt.compByteWidth == 4) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R32_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R32_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R32_UINT; - else if(fmt.compType == eCompType_Depth) + else if(fmt.compType == CompType::Depth) ret = VK_FORMAT_D32_SFLOAT; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 2) { - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) ret = VK_FORMAT_R16_SFLOAT; - else if(fmt.compType == eCompType_SInt) + else if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R16_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R16_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = VK_FORMAT_R16_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = VK_FORMAT_R16_UNORM; - else if(fmt.compType == eCompType_Depth) + else if(fmt.compType == CompType::Depth) ret = VK_FORMAT_D16_UNORM; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = VK_FORMAT_R16_USCALED; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = VK_FORMAT_R16_SSCALED; else RDCERR("Unrecognised component type"); } else if(fmt.compByteWidth == 1) { - if(fmt.compType == eCompType_SInt) + if(fmt.compType == CompType::SInt) ret = VK_FORMAT_R8_SINT; - else if(fmt.compType == eCompType_UInt) + else if(fmt.compType == CompType::UInt) ret = VK_FORMAT_R8_UINT; - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) ret = VK_FORMAT_R8_SNORM; - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) ret = VK_FORMAT_R8_UNORM; - else if(fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UScaled) ret = VK_FORMAT_R8_USCALED; - else if(fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SScaled) ret = VK_FORMAT_R8_SSCALED; else RDCERR("Unrecognised component type"); @@ -1120,81 +1120,79 @@ VkFormat MakeVkFormat(ResourceFormat fmt) return ret; } -PrimitiveTopology MakePrimitiveTopology(VkPrimitiveTopology Topo, uint32_t patchControlPoints) +Topology MakePrimitiveTopology(VkPrimitiveTopology Topo, uint32_t patchControlPoints) { switch(Topo) { default: break; - case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: return eTopology_PointList; break; - case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: return eTopology_LineList; break; - case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP: return eTopology_LineStrip; break; - case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: return eTopology_TriangleList; break; - case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: return eTopology_TriangleStrip; break; - case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: return eTopology_TriangleFan; break; - case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: return eTopology_LineList_Adj; break; - case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY: return eTopology_LineStrip_Adj; break; + case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: return Topology::PointList; break; + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: return Topology::LineList; break; + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP: return Topology::LineStrip; break; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: return Topology::TriangleList; break; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: return Topology::TriangleStrip; break; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: return Topology::TriangleFan; break; + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: return Topology::LineList_Adj; break; + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY: return Topology::LineStrip_Adj; break; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY: - return eTopology_TriangleList_Adj; + return Topology::TriangleList_Adj; break; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY: - return eTopology_TriangleStrip_Adj; - break; - case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST: - return PrimitiveTopology(eTopology_PatchList_1CPs + patchControlPoints); + return Topology::TriangleStrip_Adj; break; + case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST: return PatchList_Topology(patchControlPoints); break; } - return eTopology_Unknown; + return Topology::Unknown; } -VkPrimitiveTopology MakeVkPrimitiveTopology(PrimitiveTopology Topo) +VkPrimitiveTopology MakeVkPrimitiveTopology(Topology Topo) { switch(Topo) { - case eTopology_LineLoop: RDCWARN("Unsupported primitive topology on Vulkan: %x", Topo); break; + case Topology::LineLoop: RDCWARN("Unsupported primitive topology on Vulkan: %x", Topo); break; default: return VK_PRIMITIVE_TOPOLOGY_MAX_ENUM; - case eTopology_PointList: return VK_PRIMITIVE_TOPOLOGY_POINT_LIST; - case eTopology_LineStrip: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP; - case eTopology_LineList: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST; - case eTopology_LineStrip_Adj: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY; - case eTopology_LineList_Adj: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY; - case eTopology_TriangleStrip: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; - case eTopology_TriangleFan: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN; - case eTopology_TriangleList: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; - case eTopology_TriangleStrip_Adj: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY; - case eTopology_TriangleList_Adj: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY; - case eTopology_PatchList_1CPs: - case eTopology_PatchList_2CPs: - case eTopology_PatchList_3CPs: - case eTopology_PatchList_4CPs: - case eTopology_PatchList_5CPs: - case eTopology_PatchList_6CPs: - case eTopology_PatchList_7CPs: - case eTopology_PatchList_8CPs: - case eTopology_PatchList_9CPs: - case eTopology_PatchList_10CPs: - case eTopology_PatchList_11CPs: - case eTopology_PatchList_12CPs: - case eTopology_PatchList_13CPs: - case eTopology_PatchList_14CPs: - case eTopology_PatchList_15CPs: - case eTopology_PatchList_16CPs: - case eTopology_PatchList_17CPs: - case eTopology_PatchList_18CPs: - case eTopology_PatchList_19CPs: - case eTopology_PatchList_20CPs: - case eTopology_PatchList_21CPs: - case eTopology_PatchList_22CPs: - case eTopology_PatchList_23CPs: - case eTopology_PatchList_24CPs: - case eTopology_PatchList_25CPs: - case eTopology_PatchList_26CPs: - case eTopology_PatchList_27CPs: - case eTopology_PatchList_28CPs: - case eTopology_PatchList_29CPs: - case eTopology_PatchList_30CPs: - case eTopology_PatchList_31CPs: - case eTopology_PatchList_32CPs: return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; + case Topology::PointList: return VK_PRIMITIVE_TOPOLOGY_POINT_LIST; + case Topology::LineStrip: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP; + case Topology::LineList: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST; + case Topology::LineStrip_Adj: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY; + case Topology::LineList_Adj: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY; + case Topology::TriangleStrip: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; + case Topology::TriangleFan: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN; + case Topology::TriangleList: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; + case Topology::TriangleStrip_Adj: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY; + case Topology::TriangleList_Adj: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY; + case Topology::PatchList_1CPs: + case Topology::PatchList_2CPs: + case Topology::PatchList_3CPs: + case Topology::PatchList_4CPs: + case Topology::PatchList_5CPs: + case Topology::PatchList_6CPs: + case Topology::PatchList_7CPs: + case Topology::PatchList_8CPs: + case Topology::PatchList_9CPs: + case Topology::PatchList_10CPs: + case Topology::PatchList_11CPs: + case Topology::PatchList_12CPs: + case Topology::PatchList_13CPs: + case Topology::PatchList_14CPs: + case Topology::PatchList_15CPs: + case Topology::PatchList_16CPs: + case Topology::PatchList_17CPs: + case Topology::PatchList_18CPs: + case Topology::PatchList_19CPs: + case Topology::PatchList_20CPs: + case Topology::PatchList_21CPs: + case Topology::PatchList_22CPs: + case Topology::PatchList_23CPs: + case Topology::PatchList_24CPs: + case Topology::PatchList_25CPs: + case Topology::PatchList_26CPs: + case Topology::PatchList_27CPs: + case Topology::PatchList_28CPs: + case Topology::PatchList_29CPs: + case Topology::PatchList_30CPs: + case Topology::PatchList_31CPs: + case Topology::PatchList_32CPs: return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; } return VK_PRIMITIVE_TOPOLOGY_MAX_ENUM; diff --git a/renderdoc/driver/vulkan/vk_common.h b/renderdoc/driver/vulkan/vk_common.h index 729a41f24..8f144bf14 100644 --- a/renderdoc/driver/vulkan/vk_common.h +++ b/renderdoc/driver/vulkan/vk_common.h @@ -82,8 +82,8 @@ ResourceFormat MakeResourceFormat(VkFormat fmt); VkFormat MakeVkFormat(ResourceFormat fmt); -PrimitiveTopology MakePrimitiveTopology(VkPrimitiveTopology Topo, uint32_t patchControlPoints); -VkPrimitiveTopology MakeVkPrimitiveTopology(PrimitiveTopology Topo); +Topology MakePrimitiveTopology(VkPrimitiveTopology Topo, uint32_t patchControlPoints); +VkPrimitiveTopology MakeVkPrimitiveTopology(Topology Topo); // set conservative access bits for this image layout VkAccessFlags MakeAccessMask(VkImageLayout layout); diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index fa17c9f7c..f67788954 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -172,7 +172,7 @@ const uint32_t VkInitParams::VK_OLD_VERSIONS[VkInitParams::VK_NUM_SUPPORTED_OLD_ 0x0000005, // from 0x5 to 0x6, we added serialisation of the original swapchain's imageUsage }; -ReplayCreateStatus VkInitParams::Serialise() +ReplayStatus VkInitParams::Serialise() { Serialiser *localSerialiser = GetSerialiser(); @@ -197,7 +197,7 @@ ReplayCreateStatus VkInitParams::Serialise() if(!oldsupported) { RDCERR("Incompatible Vulkan serialise version, expected %d got %d", VK_SERIALISE_VERSION, ver); - return eReplayCreate_APIIncompatibleVersion; + return ReplayStatus::APIIncompatibleVersion; } } @@ -212,7 +212,7 @@ ReplayCreateStatus VkInitParams::Serialise() localSerialiser->Serialise("InstanceID", InstanceID); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } void VkInitParams::Set(const VkInstanceCreateInfo *pCreateInfo, ResourceId inst) @@ -527,7 +527,7 @@ void WrappedVulkan::FlushQ() } } -uint32_t WrappedVulkan::HandlePreCallback(VkCommandBuffer commandBuffer, DrawcallFlags type, +uint32_t WrappedVulkan::HandlePreCallback(VkCommandBuffer commandBuffer, DrawFlags type, uint32_t multiDrawOffset) { if(!m_DrawcallCallback) @@ -545,7 +545,7 @@ uint32_t WrappedVulkan::HandlePreCallback(VkCommandBuffer commandBuffer, Drawcal // handle all aliases of this drawcall as long as it's not a multidraw const FetchDrawcall *draw = GetDrawcall(eventID); - if(draw == NULL || (draw->flags & eDraw_MultiDraw) == 0) + if(draw == NULL || !(draw->flags & DrawFlags::MultiDraw)) { ++it; while(it != m_DrawcallUses.end() && it->fileOffset == m_CurChunkOffset) @@ -557,9 +557,9 @@ uint32_t WrappedVulkan::HandlePreCallback(VkCommandBuffer commandBuffer, Drawcal eventID += multiDrawOffset; - if(type == eDraw_Drawcall) + if(type == DrawFlags::Drawcall) m_DrawcallCallback->PreDraw(eventID, commandBuffer); - else if(type == eDraw_Dispatch) + else if(type == DrawFlags::Dispatch) m_DrawcallCallback->PreDispatch(eventID, commandBuffer); else m_DrawcallCallback->PreMisc(eventID, type, commandBuffer); @@ -1408,15 +1408,15 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd) { switch(fmt.specialFormat) { - case eSpecial_R10G10B10A2: + case SpecialFormat::R10G10B10A2: stride = 4; buf1010102 = true; break; - case eSpecial_R5G6B5: + case SpecialFormat::R5G6B5: stride = 2; buf565 = true; break; - case eSpecial_R5G5B5A1: + case SpecialFormat::R5G5B5A1: stride = 2; buf5551 = true; break; @@ -2304,7 +2304,7 @@ void WrappedVulkan::ProcessChunk(uint64_t offset, VulkanChunkType context) FetchDrawcall draw; draw.name = "vkQueuePresentKHR()"; - draw.flags |= eDraw_Present; + draw.flags |= DrawFlags::Present; draw.copyDestination = bbid; @@ -2525,18 +2525,18 @@ void WrappedVulkan::Serialise_DebugMessages(Serialiser *localSerialiser, bool is if(m_State >= WRITING) desc = debugMessages[i].description.elems; - SERIALISE_ELEMENT(uint32_t, Category, debugMessages[i].category); - SERIALISE_ELEMENT(uint32_t, Source, debugMessages[i].source); - SERIALISE_ELEMENT(uint32_t, Severity, debugMessages[i].severity); + SERIALISE_ELEMENT(MessageCategory, Category, debugMessages[i].category); + SERIALISE_ELEMENT(MessageSource, Source, debugMessages[i].source); + SERIALISE_ELEMENT(MessageSeverity, Severity, debugMessages[i].severity); SERIALISE_ELEMENT(uint32_t, ID, debugMessages[i].messageID); SERIALISE_ELEMENT(string, Description, desc); if(m_State == READING) { DebugMessage msg; - msg.source = (DebugMessageSource)Source; - msg.category = (DebugMessageCategory)Category; - msg.severity = (DebugMessageSeverity)Severity; + msg.source = Source; + msg.category = Category; + msg.severity = Severity; msg.messageID = ID; msg.description = Description; @@ -2552,8 +2552,8 @@ vector WrappedVulkan::GetDebugMessages() return ret; } -void WrappedVulkan::AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, - DebugMessageSource src, std::string d) +void WrappedVulkan::AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, + std::string d) { DebugMessage msg; msg.eventID = 0; @@ -2616,42 +2616,42 @@ VkBool32 WrappedVulkan::DebugCallback(VkDebugReportFlagsEXT flags, DebugMessage msg; msg.eventID = 0; - msg.category = eDbgCategory_Miscellaneous; + msg.category = MessageCategory::Miscellaneous; msg.description = pMessage; - msg.severity = eDbgSeverity_Low; + msg.severity = MessageSeverity::Low; msg.messageID = messageCode; - msg.source = eDbgSource_API; + msg.source = MessageSource::API; if(flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) - msg.severity = eDbgSeverity_Info; + msg.severity = MessageSeverity::Info; else if(flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) - msg.severity = eDbgSeverity_Low; + msg.severity = MessageSeverity::Low; else if(flags & VK_DEBUG_REPORT_WARNING_BIT_EXT) - msg.severity = eDbgSeverity_Medium; + msg.severity = MessageSeverity::Medium; else if(flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) - msg.severity = eDbgSeverity_High; + msg.severity = MessageSeverity::High; if(flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) - msg.category = eDbgCategory_Performance; + msg.category = MessageCategory::Performance; else if(isDS) - msg.category = eDbgCategory_Execution; + msg.category = MessageCategory::Execution; else if(isMEM) - msg.category = eDbgCategory_Resource_Manipulation; + msg.category = MessageCategory::Resource_Manipulation; else if(isSC) - msg.category = eDbgCategory_Shaders; + msg.category = MessageCategory::Shaders; else if(isOBJ) - msg.category = eDbgCategory_State_Setting; + msg.category = MessageCategory::State_Setting; else if(isSWAP) - msg.category = eDbgCategory_Miscellaneous; + msg.category = MessageCategory::Miscellaneous; else if(isDL) - msg.category = eDbgCategory_Portability; + msg.category = MessageCategory::Portability; else if(isIMG) - msg.category = eDbgCategory_State_Creation; + msg.category = MessageCategory::State_Creation; else if(isPARAM) - msg.category = eDbgCategory_Miscellaneous; + msg.category = MessageCategory::Miscellaneous; if(isIMG || isPARAM) - msg.source = eDbgSource_IncorrectAPIUse; + msg.source = MessageSource::IncorrectAPIUse; sink->msgs.push_back(msg); } @@ -2755,7 +2755,7 @@ void WrappedVulkan::AddDrawcall(const FetchDrawcall &d, bool hasEvents) draw.depthOut = ResourceId(); draw.indexByteWidth = 0; - draw.topology = eTopology_Unknown; + draw.topology = Topology::Unknown; if(m_LastCmdBufferID != ResourceId()) { @@ -2841,18 +2841,20 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode, vectorReadOnlyResources, eUsage_VS_Resource), - ResUsageType(sh.mapping->ReadWriteResources, eUsage_VS_RWResource), - ResUsageType(sh.mapping->ConstantBlocks, eUsage_VS_Constants), + ResUsageType(sh.mapping->ReadOnlyResources, ResourceUsage::VS_Resource), + ResUsageType(sh.mapping->ReadWriteResources, ResourceUsage::VS_RWResource), + ResUsageType(sh.mapping->ConstantBlocks, ResourceUsage::VS_Constants), }; DebugMessage msg; msg.eventID = e; - msg.category = eDbgCategory_Execution; + msg.category = MessageCategory::Execution; msg.messageID = 0; - msg.source = eDbgSource_IncorrectAPIUse; - msg.severity = eDbgSeverity_High; + msg.source = MessageSource::IncorrectAPIUse; + msg.severity = MessageSeverity::High; for(size_t t = 0; t < ARRAY_COUNT(types); t++) { @@ -2946,7 +2948,7 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode, vector= (int32_t)descset.currentBindings.size()) { @@ -3012,7 +3014,7 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode, vector= 0) { int32_t att = rp.subpasses[state.subpass].depthstencilAttachment; - drawNode.resourceUsage.push_back( - std::make_pair(c.m_ImageView[fb.attachments[att].view].image, - EventUsage(e, eUsage_DepthStencilTarget, fb.attachments[att].view))); + drawNode.resourceUsage.push_back(std::make_pair( + c.m_ImageView[fb.attachments[att].view].image, + EventUsage(e, ResourceUsage::DepthStencilTarget, fb.attachments[att].view))); } } } diff --git a/renderdoc/driver/vulkan/vk_core.h b/renderdoc/driver/vulkan/vk_core.h index 188cf1579..b2e151516 100644 --- a/renderdoc/driver/vulkan/vk_core.h +++ b/renderdoc/driver/vulkan/vk_core.h @@ -40,7 +40,7 @@ using std::list; struct VkInitParams : public RDCInitParams { VkInitParams(); - ReplayCreateStatus Serialise(); + ReplayStatus Serialise(); void Set(const VkInstanceCreateInfo *pCreateInfo, ResourceId inst); @@ -162,9 +162,9 @@ struct VulkanDrawcallCallback virtual void PostRedispatch(uint32_t eid, VkCommandBuffer cmd) = 0; // finally, these are for copy/blit/resolve/clear/etc - virtual void PreMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) = 0; - virtual bool PostMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) = 0; - virtual void PostRemisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) = 0; + virtual void PreMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) = 0; + virtual bool PostMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) = 0; + virtual void PostRemisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) = 0; // should we re-record all command buffers? this needs to be true if the range // being replayed is larger than one command buffer (which usually means the @@ -210,8 +210,7 @@ private: void Serialise_DebugMessages(Serialiser *localSerialiser, bool isDrawcall); vector GetDebugMessages(); void AddDebugMessage(DebugMessage msg); - void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, - std::string d); + void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, std::string d); enum { @@ -264,7 +263,7 @@ private: // util function to handle fetching the right eventID, calling any // aliases then calling PreDraw/PreDispatch. - uint32_t HandlePreCallback(VkCommandBuffer commandBuffer, DrawcallFlags type = eDraw_Drawcall, + uint32_t HandlePreCallback(VkCommandBuffer commandBuffer, DrawFlags type = DrawFlags::Drawcall, uint32_t multiDrawOffset = 0); vector m_SupportedWindowSystems; @@ -704,7 +703,7 @@ public: bool ReleaseResource(WrappedVkRes *res); - ReplayCreateStatus Initialise(VkInitParams ¶ms); + ReplayStatus Initialise(VkInitParams ¶ms); uint32_t GetLogVersion() { return m_InitParams.SerialiseVersion; } void Shutdown(); void ReplayLog(uint32_t startEventID, uint32_t endEventID, ReplayLogType replayType); diff --git a/renderdoc/driver/vulkan/vk_counters.cpp b/renderdoc/driver/vulkan/vk_counters.cpp index 74a9c20a4..ab3d3449e 100644 --- a/renderdoc/driver/vulkan/vk_counters.cpp +++ b/renderdoc/driver/vulkan/vk_counters.cpp @@ -42,142 +42,142 @@ void VulkanReplay::PostDeviceShutdownCounters() { } -vector VulkanReplay::EnumerateCounters() +vector VulkanReplay::EnumerateCounters() { - vector ret; + vector ret; VkPhysicalDeviceFeatures availableFeatures = m_pDriver->GetDeviceFeatures(); - ret.push_back(eCounter_EventGPUDuration); + ret.push_back(GPUCounter::EventGPUDuration); if(availableFeatures.pipelineStatisticsQuery) { - ret.push_back(eCounter_InputVerticesRead); - ret.push_back(eCounter_IAPrimitives); - ret.push_back(eCounter_GSPrimitives); - ret.push_back(eCounter_RasterizerInvocations); - ret.push_back(eCounter_RasterizedPrimitives); + ret.push_back(GPUCounter::InputVerticesRead); + ret.push_back(GPUCounter::IAPrimitives); + ret.push_back(GPUCounter::GSPrimitives); + ret.push_back(GPUCounter::RasterizerInvocations); + ret.push_back(GPUCounter::RasterizedPrimitives); } if(availableFeatures.occlusionQueryPrecise) - ret.push_back(eCounter_SamplesWritten); + ret.push_back(GPUCounter::SamplesWritten); if(availableFeatures.pipelineStatisticsQuery) { - ret.push_back(eCounter_VSInvocations); - ret.push_back(eCounter_TCSInvocations); - ret.push_back(eCounter_TESInvocations); - ret.push_back(eCounter_GSInvocations); - ret.push_back(eCounter_PSInvocations); - ret.push_back(eCounter_CSInvocations); + ret.push_back(GPUCounter::VSInvocations); + ret.push_back(GPUCounter::TCSInvocations); + ret.push_back(GPUCounter::TESInvocations); + ret.push_back(GPUCounter::GSInvocations); + ret.push_back(GPUCounter::PSInvocations); + ret.push_back(GPUCounter::CSInvocations); } return ret; } -void VulkanReplay::DescribeCounter(uint32_t counterID, CounterDescription &desc) +void VulkanReplay::DescribeCounter(GPUCounter counterID, CounterDescription &desc) { desc.counterID = counterID; switch(counterID) { - case eCounter_EventGPUDuration: + case GPUCounter::EventGPUDuration: desc.name = "GPU Duration"; desc.description = "Time taken for this event on the GPU, as measured by delta between two GPU timestamps."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_Double; - desc.units = eUnits_Seconds; + desc.resultType = CompType::Double; + desc.unit = CounterUnit::Seconds; break; - case eCounter_InputVerticesRead: + case GPUCounter::InputVerticesRead: desc.name = "Input Vertices Read"; desc.description = "Number of vertices read by input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_IAPrimitives: + case GPUCounter::IAPrimitives: desc.name = "Input Primitives"; desc.description = "Number of primitives read by the input assembler."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSPrimitives: + case GPUCounter::GSPrimitives: desc.name = "GS Primitives"; desc.description = "Number of primitives output by a geometry shader."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizerInvocations: + case GPUCounter::RasterizerInvocations: desc.name = "Rasterizer Invocations"; desc.description = "Number of primitives that were sent to the rasterizer."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_RasterizedPrimitives: + case GPUCounter::RasterizedPrimitives: desc.name = "Rasterized Primitives"; desc.description = "Number of primitives that were rendered."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_SamplesWritten: + case GPUCounter::SamplesWritten: desc.name = "Samples Written"; desc.description = "Number of samples that passed depth/stencil test."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_VSInvocations: + case GPUCounter::VSInvocations: desc.name = "VS Invocations"; desc.description = "Number of times a vertex shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_GSInvocations: + case GPUCounter::GSInvocations: desc.name = "GS Invocations"; desc.description = "Number of times a geometry shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_TCSInvocations: + case GPUCounter::TCSInvocations: desc.name = "TCS Invocations"; desc.description = "Number of times a tesselation control shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_TESInvocations: + case GPUCounter::TESInvocations: desc.name = "TES Invocations"; desc.description = "Number of times a tesselation evaluation shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_PSInvocations: + case GPUCounter::PSInvocations: desc.name = "PS Invocations"; desc.description = "Number of times a pixel shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; - case eCounter_CSInvocations: + case GPUCounter::CSInvocations: desc.name = "CS Invocations"; desc.description = "Number of times a compute shader was invoked."; desc.resultByteWidth = 8; - desc.resultCompType = eCompType_UInt; - desc.units = eUnits_Absolute; + desc.resultType = CompType::UInt; + desc.unit = CounterUnit::Absolute; break; default: desc.name = "Unknown"; desc.description = "Unknown counter ID"; desc.resultByteWidth = 0; - desc.resultCompType = eCompType_None; - desc.units = eUnits_Absolute; + desc.resultType = CompType::Typeless; + desc.unit = CounterUnit::Absolute; break; } } @@ -223,12 +223,9 @@ struct VulkanGPUTimerCallback : public VulkanDrawcallCallback void PreDispatch(uint32_t eid, VkCommandBuffer cmd) { PreDraw(eid, cmd); } bool PostDispatch(uint32_t eid, VkCommandBuffer cmd) { return PostDraw(eid, cmd); } void PostRedispatch(uint32_t eid, VkCommandBuffer cmd) { PostRedraw(eid, cmd); } - void PreMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) { PreDraw(eid, cmd); } - bool PostMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) - { - return PostDraw(eid, cmd); - } - void PostRemisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) { PostRedraw(eid, cmd); } + void PreMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) { PreDraw(eid, cmd); } + bool PostMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) { return PostDraw(eid, cmd); } + void PostRemisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) { PostRedraw(eid, cmd); } bool RecordAllCmds() { return true; } void AliasEvent(uint32_t primary, uint32_t alias) { @@ -248,7 +245,7 @@ struct VulkanGPUTimerCallback : public VulkanDrawcallCallback vector > m_AliasEvents; }; -vector VulkanReplay::FetchCounters(const vector &counters) +vector VulkanReplay::FetchCounters(const vector &counters) { uint32_t maxEID = m_pDriver->GetMaxEID(); @@ -374,7 +371,7 @@ vector VulkanReplay::FetchCounters(const vector &counte switch(counters[c]) { - case eCounter_EventGPUDuration: + case GPUCounter::EventGPUDuration: { uint64_t delta = m_TimeStampData[i * 2 + 1] - m_TimeStampData[i * 2 + 0]; result.value.d = (double(m_pDriver->GetDeviceProps().limits.timestampPeriod) * @@ -382,18 +379,23 @@ vector VulkanReplay::FetchCounters(const vector &counte / (1000.0 * 1000.0 * 1000.0); // to seconds } break; - case eCounter_InputVerticesRead: result.value.u64 = m_PipeStatsData[i * 11 + 0]; break; - case eCounter_IAPrimitives: result.value.u64 = m_PipeStatsData[i * 11 + 1]; break; - case eCounter_GSPrimitives: result.value.u64 = m_PipeStatsData[i * 11 + 4]; break; - case eCounter_RasterizerInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 5]; break; - case eCounter_RasterizedPrimitives: result.value.u64 = m_PipeStatsData[i * 11 + 6]; break; - case eCounter_SamplesWritten: result.value.u64 = m_OcclusionData[i]; break; - case eCounter_VSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 2]; break; - case eCounter_TCSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 8]; break; - case eCounter_TESInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 9]; break; - case eCounter_GSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 3]; break; - case eCounter_PSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 9]; break; - case eCounter_CSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 10]; break; + case GPUCounter::InputVerticesRead: result.value.u64 = m_PipeStatsData[i * 11 + 0]; break; + case GPUCounter::IAPrimitives: result.value.u64 = m_PipeStatsData[i * 11 + 1]; break; + case GPUCounter::GSPrimitives: result.value.u64 = m_PipeStatsData[i * 11 + 4]; break; + case GPUCounter::RasterizerInvocations: + result.value.u64 = m_PipeStatsData[i * 11 + 5]; + break; + case GPUCounter::RasterizedPrimitives: + result.value.u64 = m_PipeStatsData[i * 11 + 6]; + break; + case GPUCounter::SamplesWritten: result.value.u64 = m_OcclusionData[i]; break; + case GPUCounter::VSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 2]; break; + case GPUCounter::TCSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 8]; break; + case GPUCounter::TESInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 9]; break; + case GPUCounter::GSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 3]; break; + case GPUCounter::PSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 9]; break; + case GPUCounter::CSInvocations: result.value.u64 = m_PipeStatsData[i * 11 + 10]; break; + default: break; } ret.push_back(result); } diff --git a/renderdoc/driver/vulkan/vk_debug.cpp b/renderdoc/driver/vulkan/vk_debug.cpp index 85e1b088d..6f6e71769 100644 --- a/renderdoc/driver/vulkan/vk_debug.cpp +++ b/renderdoc/driver/vulkan/vk_debug.cpp @@ -3888,7 +3888,7 @@ FloatVector VulkanDebugManager::InterpretVertex(byte *data, uint32_t vert, const fmt.compCount = cfg.position.compCount; fmt.compType = cfg.position.compType; - if(cfg.position.specialFormat == eSpecial_R10G10B10A2) + if(cfg.position.specialFormat == SpecialFormat::R10G10B10A2) { if(data + 4 >= end) { @@ -3903,7 +3903,7 @@ FloatVector VulkanDebugManager::InterpretVertex(byte *data, uint32_t vert, const ret.w = v.w; return ret; } - else if(cfg.position.specialFormat == eSpecial_R11G11B10) + else if(cfg.position.specialFormat == SpecialFormat::R11G11B10) { if(data + 4 >= end) { @@ -3962,7 +3962,7 @@ uint32_t VulkanDebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg resFmt.compCount = cfg.position.compCount; resFmt.compType = cfg.position.compType; resFmt.special = false; - if(cfg.position.specialFormat != eSpecial_Unknown) + if(cfg.position.specialFormat != SpecialFormat::Unknown) { resFmt.special = true; resFmt.specialFormat = cfg.position.specialFormat; @@ -4044,27 +4044,27 @@ uint32_t VulkanDebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg switch(cfg.position.topo) { - case eTopology_TriangleList: + case Topology::TriangleList: { ubo->meshMode = MESH_TRIANGLE_LIST; break; }; - case eTopology_TriangleStrip: + case Topology::TriangleStrip: { ubo->meshMode = MESH_TRIANGLE_STRIP; break; }; - case eTopology_TriangleFan: + case Topology::TriangleFan: { ubo->meshMode = MESH_TRIANGLE_FAN; break; }; - case eTopology_TriangleList_Adj: + case Topology::TriangleList_Adj: { ubo->meshMode = MESH_TRIANGLE_LIST_ADJ; break; }; - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: { ubo->meshMode = MESH_TRIANGLE_STRIP_ADJ; break; @@ -5053,9 +5053,9 @@ struct VulkanQuadOverdrawCallback : public VulkanDrawcallCallback bool PostDispatch(uint32_t eid, VkCommandBuffer cmd) { return false; } void PostRedispatch(uint32_t eid, VkCommandBuffer cmd) {} // Ditto copy/etc - void PreMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) {} - bool PostMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) { return false; } - void PostRemisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) {} + void PreMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) {} + bool PostMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) { return false; } + void PostRemisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) {} bool RecordAllCmds() { return false; } void AliasEvent(uint32_t primary, uint32_t alias) { @@ -5071,7 +5071,7 @@ struct VulkanQuadOverdrawCallback : public VulkanDrawcallCallback VulkanRenderState m_PrevState; }; -ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOverlay overlay, +ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, DebugOverlay overlay, uint32_t eventID, const vector &passEvents) { const VkLayerDispatchTable *vt = ObjDisp(m_Device); @@ -5255,7 +5255,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve const FetchDrawcall *mainDraw = m_pDriver->GetDrawcall(eventID); // Secondary commands can't have render passes - if((mainDraw && (mainDraw->flags & eDraw_Drawcall) == 0) || + if((mainDraw && !(mainDraw->flags & DrawFlags::Drawcall)) || !m_pDriver->m_Partial[WrappedVulkan::Primary].renderPassActive) { // don't do anything, no drawcall capable of making overlays selected @@ -5283,7 +5283,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve DoPipelineBarrier(cmd, 1, &barrier); } - else if(overlay == eTexOverlay_NaN || overlay == eTexOverlay_Clipping) + else if(overlay == DebugOverlay::NaN || overlay == DebugOverlay::Clipping) { float black[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -5309,11 +5309,11 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve DoPipelineBarrier(cmd, 1, &barrier); } - else if(overlay == eTexOverlay_Drawcall || overlay == eTexOverlay_Wireframe) + else if(overlay == DebugOverlay::Drawcall || overlay == DebugOverlay::Wireframe) { float highlightCol[] = {0.8f, 0.1f, 0.8f, 0.0f}; - if(overlay == eTexOverlay_Wireframe) + if(overlay == DebugOverlay::Wireframe) { highlightCol[0] = 200 / 255.0f; highlightCol[1] = 1.0f; @@ -5375,7 +5375,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve rs->depthClampEnable = true; } - if(overlay == eTexOverlay_Wireframe && m_pDriver->GetDeviceFeatures().fillModeNonSolid) + if(overlay == DebugOverlay::Wireframe && m_pDriver->GetDeviceFeatures().fillModeNonSolid) { rs->polygonMode = VK_POLYGON_MODE_LINE; rs->lineWidth = 1.0f; @@ -5461,7 +5461,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve m_pDriver->m_RenderState.scissors[i].extent.height = 16384; } - if(overlay == eTexOverlay_Wireframe) + if(overlay == DebugOverlay::Wireframe) m_pDriver->m_RenderState.lineWidth = 1.0f; m_pDriver->ReplayLog(0, eventID, eReplay_OnlyDraw); @@ -5481,7 +5481,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve m_pDriver->vkDestroyPipeline(m_Device, pipe, NULL); m_pDriver->vkDestroyShaderModule(m_Device, mod, NULL); } - else if(overlay == eTexOverlay_ViewportScissor) + else if(overlay == DebugOverlay::ViewportScissor) { // clear the whole image to opaque black. We'll overwite the render area with transparent black // before rendering the viewport/scissors @@ -5596,7 +5596,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve vt->CmdEndRenderPass(Unwrap(cmd)); } } - else if(overlay == eTexOverlay_BackfaceCull) + else if(overlay == DebugOverlay::BackfaceCull) { float highlightCol[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -5775,7 +5775,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve m_pDriver->vkDestroyShaderModule(m_Device, mod[i], NULL); } } - else if(overlay == eTexOverlay_Depth || overlay == eTexOverlay_Stencil) + else if(overlay == DebugOverlay::Depth || overlay == DebugOverlay::Stencil) { float highlightCol[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -5994,7 +5994,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve if(depthRP != VK_NULL_HANDLE) { - if(overlay == eTexOverlay_Depth) + if(overlay == DebugOverlay::Depth) ds->depthTestEnable = origDepthTest; else ds->stencilTestEnable = origStencilTest; @@ -6056,7 +6056,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve m_pDriver->vkDestroyFramebuffer(m_Device, depthFB, NULL); } } - else if(overlay == eTexOverlay_ClearBeforeDraw || overlay == eTexOverlay_ClearBeforePass) + else if(overlay == DebugOverlay::ClearBeforeDraw || overlay == DebugOverlay::ClearBeforePass) { // clear the overlay image itself float black[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -6085,7 +6085,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve vector events = passEvents; - if(overlay == eTexOverlay_ClearBeforeDraw) + if(overlay == DebugOverlay::ClearBeforeDraw) events.clear(); events.push_back(eventID); @@ -6106,10 +6106,10 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve // BeginRenderPassAndApplyState and a clear. If it's just the begin, we // just play including it, do the clear, then we won't replay anything // in the loop below - if(overlay == eTexOverlay_ClearBeforePass) + if(overlay == DebugOverlay::ClearBeforePass) { const FetchDrawcall *draw = m_pDriver->GetDrawcall(events[0]); - if(draw && draw->flags & eDraw_BeginPass) + if(draw && draw->flags & DrawFlags::BeginPass) { if(events.size() == 1) { @@ -6169,7 +6169,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve { m_pDriver->ReplayLog(events[i], events[i], eReplay_OnlyDraw); - if(overlay == eTexOverlay_ClearBeforePass && i + 1 < events.size()) + if(overlay == DebugOverlay::ClearBeforePass && i + 1 < events.size()) m_pDriver->ReplayLog(events[i] + 1, events[i + 1], eReplay_WithoutDraw); } @@ -6179,7 +6179,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve RDCASSERTEQUAL(vkr, VK_SUCCESS); } } - else if(overlay == eTexOverlay_QuadOverdrawPass || overlay == eTexOverlay_QuadOverdrawDraw) + else if(overlay == DebugOverlay::QuadOverdrawPass || overlay == DebugOverlay::QuadOverdrawDraw) { VulkanRenderState prevstate = m_pDriver->m_RenderState; @@ -6213,7 +6213,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve vector events = passEvents; - if(overlay == eTexOverlay_QuadOverdrawDraw) + if(overlay == DebugOverlay::QuadOverdrawDraw) events.clear(); events.push_back(eventID); @@ -6402,7 +6402,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve vkr = vt->BeginCommandBuffer(Unwrap(cmd), &beginInfo); RDCASSERTEQUAL(vkr, VK_SUCCESS); } - else if(overlay == eTexOverlay_TriangleSizePass || overlay == eTexOverlay_TriangleSizeDraw) + else if(overlay == DebugOverlay::TriangleSizePass || overlay == DebugOverlay::TriangleSizeDraw) { VulkanRenderState prevstate = m_pDriver->m_RenderState; @@ -6444,7 +6444,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve vector events = passEvents; - if(overlay == eTexOverlay_TriangleSizeDraw) + if(overlay == DebugOverlay::TriangleSizeDraw) events.clear(); while(!events.empty()) @@ -6452,7 +6452,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve const FetchDrawcall *draw = m_pDriver->GetDrawcall(events[0]); // remove any non-drawcalls, like the pass boundary. - if((draw->flags & eDraw_Drawcall) == 0) + if(!(draw->flags & DrawFlags::Drawcall)) events.erase(events.begin()); else break; @@ -6659,7 +6659,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve pipeCreateInfo.pVertexInputState = &vi; pipeCreateInfo.pColorBlendState = &cb; - typedef std::pair PipeKey; + typedef std::pair PipeKey; map pipes; @@ -6693,9 +6693,9 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve for(uint32_t inst = 0; draw && inst < RDCMAX(1U, draw->numInstances); inst++) { - MeshFormat fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_GSOut); + MeshFormat fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::GSOut); if(fmt.buf == ResourceId()) - fmt = GetPostVSBuffers(events[i], inst, eMeshDataStage_VSOut); + fmt = GetPostVSBuffers(events[i], inst, MeshDataStage::VSOut); if(fmt.buf != ResourceId()) { @@ -6854,7 +6854,7 @@ MeshDisplayPipelines VulkanDebugManager::CacheMeshDisplayPipelines(const MeshFor bit += 6; ResourceFormat fmt; - fmt.special = primary.specialFormat != eSpecial_Unknown; + fmt.special = primary.specialFormat != SpecialFormat::Unknown; fmt.specialFormat = primary.specialFormat; fmt.compByteWidth = primary.compByteWidth; fmt.compCount = primary.compCount; @@ -6862,7 +6862,7 @@ MeshDisplayPipelines VulkanDebugManager::CacheMeshDisplayPipelines(const MeshFor VkFormat primaryFmt = MakeVkFormat(fmt); - fmt.special = secondary.specialFormat != eSpecial_Unknown; + fmt.special = secondary.specialFormat != SpecialFormat::Unknown; fmt.specialFormat = secondary.specialFormat; fmt.compByteWidth = secondary.compByteWidth; fmt.compCount = secondary.compCount; @@ -6892,7 +6892,7 @@ MeshDisplayPipelines VulkanDebugManager::CacheMeshDisplayPipelines(const MeshFor MeshDisplayPipelines &cache = m_CachedMeshPipelines[key]; - if(cache.pipes[eShade_None] != VK_NULL_HANDLE) + if(cache.pipes[(uint32_t)SolidShade::NoSolid] != VK_NULL_HANDLE) return cache; const VkLayerDispatchTable *vt = ObjDisp(m_Device); @@ -6934,7 +6934,7 @@ MeshDisplayPipelines VulkanDebugManager::CacheMeshDisplayPipelines(const MeshFor VkPipelineInputAssemblyStateCreateInfo ia = { VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, NULL, 0, - primary.topo >= eTopology_PatchList ? VK_PRIMITIVE_TOPOLOGY_POINT_LIST + primary.topo >= Topology::PatchList ? VK_PRIMITIVE_TOPOLOGY_POINT_LIST : MakeVkPrimitiveTopology(primary.topo), false, }; @@ -7271,13 +7271,13 @@ static void AddOutputDumping(const ShaderReflection &refl, const char *entryName { uint32_t baseID = 0; - if(refl.OutputSig[i].compType == eCompType_UInt) + if(refl.OutputSig[i].compType == CompType::UInt) baseID = uint32ID; - else if(refl.OutputSig[i].compType == eCompType_SInt) + else if(refl.OutputSig[i].compType == CompType::SInt) baseID = sint32ID; - else if(refl.OutputSig[i].compType == eCompType_Float) + else if(refl.OutputSig[i].compType == CompType::Float) baseID = floatID; - else if(refl.OutputSig[i].compType == eCompType_Double) + else if(refl.OutputSig[i].compType == CompType::Double) baseID = doubleID; else RDCERR("Unexpected component type for output signature element"); @@ -7333,13 +7333,13 @@ static void AddOutputDumping(const ShaderReflection &refl, const char *entryName // handle non-vectors once here if(refl.OutputSig[i].compCount == 1) { - if(refl.OutputSig[i].compType == eCompType_UInt) + if(refl.OutputSig[i].compType == CompType::UInt) outs[i].basetypeID = uint32ID; - else if(refl.OutputSig[i].compType == eCompType_SInt) + else if(refl.OutputSig[i].compType == CompType::SInt) outs[i].basetypeID = sint32ID; - else if(refl.OutputSig[i].compType == eCompType_Float) + else if(refl.OutputSig[i].compType == CompType::Float) outs[i].basetypeID = floatID; - else if(refl.OutputSig[i].compType == eCompType_Double) + else if(refl.OutputSig[i].compType == CompType::Double) outs[i].basetypeID = doubleID; else RDCERR("Unexpected component type for output signature element"); @@ -7676,11 +7676,11 @@ static void AddOutputDumping(const ShaderReflection &refl, const char *entryName for(int o = 0; o < numOutputs; o++) { uint32_t elemSize = 0; - if(refl.OutputSig[o].compType == eCompType_Double) + if(refl.OutputSig[o].compType == CompType::Double) elemSize = 8; - else if(refl.OutputSig[o].compType == eCompType_SInt || - refl.OutputSig[o].compType == eCompType_UInt || - refl.OutputSig[o].compType == eCompType_Float) + else if(refl.OutputSig[o].compType == CompType::SInt || + refl.OutputSig[o].compType == CompType::UInt || + refl.OutputSig[o].compType == CompType::Float) elemSize = 4; else RDCERR("Unexpected component type for output signature element"); @@ -8059,7 +8059,7 @@ void VulkanDebugManager::InitPostVSBuffers(uint32_t eventID) uint32_t vertexIndexOffset = 0; - if((drawcall->flags & eDraw_UseIBuffer) != 0) + if(drawcall->flags & DrawFlags::UseIBuffer) { // fetch ibuffer GetBufferData(state.ibuffer.buf, state.ibuffer.offs + drawcall->indexOffset * idxsize, @@ -8246,7 +8246,7 @@ void VulkanDebugManager::InitPostVSBuffers(uint32_t eventID) modifiedstate.graphics.descSets.resize(descSet + 1); modifiedstate.graphics.descSets[descSet].descSet = GetResID(m_MeshFetchDescSet); - if((drawcall->flags & eDraw_UseIBuffer) == 0) + if(!(drawcall->flags & DrawFlags::UseIBuffer)) { // create buffer of sufficient size (num indices * bufStride) VkBufferCreateInfo bufInfo = { @@ -8544,7 +8544,7 @@ void VulkanDebugManager::InitPostVSBuffers(uint32_t eventID) // expect position at the start of the buffer, as system values are sorted first // and position is the first value - for(uint32_t i = 1; refl->OutputSig[0].systemValue == eAttr_Position && i < numVerts; i++) + for(uint32_t i = 1; refl->OutputSig[0].systemValue == ShaderBuiltin::Position && i < numVerts; i++) { ////////////////////////////////////////////////////////////////////////////////// // derive near/far, assuming a standard perspective matrix @@ -8621,11 +8621,11 @@ void VulkanDebugManager::InitPostVSBuffers(uint32_t eventID) m_PostVSData[eventID].vsout.nearPlane = nearp; m_PostVSData[eventID].vsout.farPlane = farp; - m_PostVSData[eventID].vsout.useIndices = (drawcall->flags & eDraw_UseIBuffer) > 0; + m_PostVSData[eventID].vsout.useIndices = bool(drawcall->flags & DrawFlags::UseIBuffer); m_PostVSData[eventID].vsout.numVerts = drawcall->numIndices; m_PostVSData[eventID].vsout.instStride = 0; - if(drawcall->flags & eDraw_Instanced) + if(drawcall->flags & DrawFlags::Instanced) m_PostVSData[eventID].vsout.instStride = uint32_t(bufSize / drawcall->numInstances); m_PostVSData[eventID].vsout.idxBuf = VK_NULL_HANDLE; @@ -8637,7 +8637,7 @@ void VulkanDebugManager::InitPostVSBuffers(uint32_t eventID) state.ibuffer.bytewidth == 2 ? VK_INDEX_TYPE_UINT16 : VK_INDEX_TYPE_UINT32; } - m_PostVSData[eventID].vsout.hasPosOut = refl->OutputSig[0].systemValue == eAttr_Position; + m_PostVSData[eventID].vsout.hasPosOut = refl->OutputSig[0].systemValue == ShaderBuiltin::Position; // delete pipeline layout m_pDriver->vkDestroyPipelineLayout(dev, pipeLayout, NULL); @@ -8688,8 +8688,8 @@ MeshFormat VulkanDebugManager::GetPostVSBuffers(uint32_t eventID, uint32_t instI ret.compCount = 4; ret.compByteWidth = 4; - ret.compType = eCompType_Float; - ret.specialFormat = eSpecial_Unknown; + ret.compType = CompType::Float; + ret.specialFormat = SpecialFormat::Unknown; ret.showAlpha = false; ret.bgraOrder = false; diff --git a/renderdoc/driver/vulkan/vk_debug.h b/renderdoc/driver/vulkan/vk_debug.h index d0622b1c2..4edd40d3a 100644 --- a/renderdoc/driver/vulkan/vk_debug.h +++ b/renderdoc/driver/vulkan/vk_debug.h @@ -87,9 +87,9 @@ struct VulkanPostVSData const StageData &GetStage(MeshDataStage type) { - if(type == eMeshDataStage_VSOut) + if(type == MeshDataStage::VSOut) return vsout; - else if(type == eMeshDataStage_GSOut) + else if(type == MeshDataStage::GSOut) return gsout; else RDCERR("Unexpected mesh data stage!"); @@ -110,7 +110,7 @@ public: void RenderText(const TextPrintState &textstate, float x, float y, const char *fmt, ...); void EndText(const TextPrintState &textstate); - ResourceId RenderOverlay(ResourceId texid, TextureDisplayOverlay overlay, uint32_t eventID, + ResourceId RenderOverlay(ResourceId texid, DebugOverlay overlay, uint32_t eventID, const vector &passEvents); void InitPostVSBuffers(uint32_t eventID); diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index ec0d15046..98e3c099e 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -111,8 +111,8 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk { reflData.entryPoint = shad.entryPoint; reflData.stage = stageIndex; - info.m_ShaderModule[id].spirv.MakeReflection( - ShaderStageType(reflData.stage), reflData.entryPoint, &reflData.refl, &reflData.mapping); + info.m_ShaderModule[id].spirv.MakeReflection(ShaderStage(reflData.stage), reflData.entryPoint, + &reflData.refl, &reflData.mapping); } if(pCreateInfo->pStages[i].pSpecializationInfo) @@ -325,7 +325,7 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk if(reflData.entryPoint.empty()) { reflData.entryPoint = shad.entryPoint; - info.m_ShaderModule[id].spirv.MakeReflection(eShaderStage_Compute, reflData.entryPoint, + info.m_ShaderModule[id].spirv.MakeReflection(ShaderStage::Compute, reflData.entryPoint, &reflData.refl, &reflData.mapping); } @@ -490,17 +490,17 @@ void VulkanCreationInfo::Image::Init(VulkanResourceManager *resourceMan, VulkanC mipLevels = pCreateInfo->mipLevels; samples = RDCMAX(VK_SAMPLE_COUNT_1_BIT, pCreateInfo->samples); - creationFlags = 0; + creationFlags = TextureCategory::NoFlags; if(pCreateInfo->usage & VK_IMAGE_USAGE_SAMPLED_BIT) - creationFlags |= eTextureCreate_SRV; + creationFlags |= TextureCategory::ShaderRead; if(pCreateInfo->usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT)) - creationFlags |= eTextureCreate_RTV; + creationFlags |= TextureCategory::ColorTarget; if(pCreateInfo->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) - creationFlags |= eTextureCreate_DSV; + creationFlags |= TextureCategory::DepthTarget; if(pCreateInfo->usage & VK_IMAGE_USAGE_STORAGE_BIT) - creationFlags |= eTextureCreate_UAV; + creationFlags |= TextureCategory::ShaderReadWrite; cube = (pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) ? true : false; } @@ -530,15 +530,15 @@ static TextureSwizzle Convert(VkComponentSwizzle s, int i) { default: RDCWARN("Unexpected component swizzle value %d", (int)s); case VK_COMPONENT_SWIZZLE_IDENTITY: break; - case VK_COMPONENT_SWIZZLE_ZERO: return eSwizzle_Zero; - case VK_COMPONENT_SWIZZLE_ONE: return eSwizzle_One; - case VK_COMPONENT_SWIZZLE_R: return eSwizzle_Red; - case VK_COMPONENT_SWIZZLE_G: return eSwizzle_Green; - case VK_COMPONENT_SWIZZLE_B: return eSwizzle_Blue; - case VK_COMPONENT_SWIZZLE_A: return eSwizzle_Alpha; + case VK_COMPONENT_SWIZZLE_ZERO: return TextureSwizzle::Zero; + case VK_COMPONENT_SWIZZLE_ONE: return TextureSwizzle::One; + case VK_COMPONENT_SWIZZLE_R: return TextureSwizzle::Red; + case VK_COMPONENT_SWIZZLE_G: return TextureSwizzle::Green; + case VK_COMPONENT_SWIZZLE_B: return TextureSwizzle::Blue; + case VK_COMPONENT_SWIZZLE_A: return TextureSwizzle::Alpha; } - return TextureSwizzle(eSwizzle_Red + i); + return TextureSwizzle(uint32_t(TextureSwizzle::Red) + i); } void VulkanCreationInfo::ImageView::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, diff --git a/renderdoc/driver/vulkan/vk_info.h b/renderdoc/driver/vulkan/vk_info.h index 6dbd67a72..64f9c906f 100644 --- a/renderdoc/driver/vulkan/vk_info.h +++ b/renderdoc/driver/vulkan/vk_info.h @@ -282,7 +282,7 @@ struct VulkanCreationInfo VkSampleCountFlagBits samples; bool cube; - uint32_t creationFlags; + TextureCategory creationFlags; }; map m_Image; diff --git a/renderdoc/driver/vulkan/vk_layer.cpp b/renderdoc/driver/vulkan/vk_layer.cpp index c8db13842..28b65e2f0 100644 --- a/renderdoc/driver/vulkan/vk_layer.cpp +++ b/renderdoc/driver/vulkan/vk_layer.cpp @@ -52,7 +52,7 @@ class VulkanHook : LibraryHook { // we assume the implicit layer is registered - the UI will prompt the user about installing it. Process::RegisterEnvironmentModification(Process::EnvironmentModification( - Process::eEnvModification_Replace, "ENABLE_VULKAN_RENDERDOC_CAPTURE", "1")); + EnvMod::Set, EnvSep::NoSep, "ENABLE_VULKAN_RENDERDOC_CAPTURE", "1")); // check options to set further variables, and apply OptionsUpdated(libName); @@ -64,7 +64,7 @@ class VulkanHook : LibraryHook { // set the env var to 0 to disable the implicit layer Process::RegisterEnvironmentModification(Process::EnvironmentModification( - Process::eEnvModification_Replace, "ENABLE_VULKAN_RENDERDOC_CAPTURE", enable ? "1" : "0")); + EnvMod::Set, EnvSep::NoSep, "ENABLE_VULKAN_RENDERDOC_CAPTURE", enable ? "1" : "0")); Process::ApplyEnvironmentModification(); } @@ -73,12 +73,12 @@ class VulkanHook : LibraryHook { if(RenderDoc::Inst().GetCaptureOptions().APIValidation) { - Process::RegisterEnvironmentModification(Process::EnvironmentModification( - Process::eEnvModification_AppendPlatform, "VK_INSTANCE_LAYERS", - "VK_LAYER_LUNARG_standard_validation")); - Process::RegisterEnvironmentModification(Process::EnvironmentModification( - Process::eEnvModification_AppendPlatform, "VK_DEVICE_LAYERS", - "VK_LAYER_LUNARG_standard_validation")); + Process::RegisterEnvironmentModification( + Process::EnvironmentModification(EnvMod::Append, EnvSep::Platform, "VK_INSTANCE_LAYERS", + "VK_LAYER_LUNARG_standard_validation")); + Process::RegisterEnvironmentModification( + Process::EnvironmentModification(EnvMod::Append, EnvSep::Platform, "VK_DEVICE_LAYERS", + "VK_LAYER_LUNARG_standard_validation")); } else { diff --git a/renderdoc/driver/vulkan/vk_linux.cpp b/renderdoc/driver/vulkan/vk_linux.cpp index bfb22e56c..fc986d508 100644 --- a/renderdoc/driver/vulkan/vk_linux.cpp +++ b/renderdoc/driver/vulkan/vk_linux.cpp @@ -37,7 +37,7 @@ void VulkanReplay::OutputWindow::SetWindowHandle(WindowingSystem system, void *d m_WindowSystem = system; #if ENABLED(RDOC_XLIB) - if(system == eWindowingSystem_Xlib) + if(system == WindowingSystem::Xlib) { XlibWindowData *xdata = (XlibWindowData *)data; xlib.display = xdata->display; @@ -47,7 +47,7 @@ void VulkanReplay::OutputWindow::SetWindowHandle(WindowingSystem system, void *d #endif #if ENABLED(RDOC_XCB) - if(system == eWindowingSystem_XCB) + if(system == WindowingSystem::XCB) { XCBWindowData *xdata = (XCBWindowData *)data; xcb.connection = xdata->connection; @@ -62,7 +62,7 @@ void VulkanReplay::OutputWindow::SetWindowHandle(WindowingSystem system, void *d void VulkanReplay::OutputWindow::CreateSurface(VkInstance inst) { #if ENABLED(RDOC_XLIB) - if(m_WindowSystem == eWindowingSystem_Xlib) + if(m_WindowSystem == WindowingSystem::Xlib) { VkXlibSurfaceCreateInfoKHR createInfo; @@ -80,7 +80,7 @@ void VulkanReplay::OutputWindow::CreateSurface(VkInstance inst) #endif #if ENABLED(RDOC_XCB) - if(m_WindowSystem == eWindowingSystem_XCB) + if(m_WindowSystem == WindowingSystem::XCB) { VkXcbSurfaceCreateInfoKHR createInfo; @@ -108,7 +108,7 @@ void VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h OutputWindow &outw = m_OutputWindows[id]; #if ENABLED(RDOC_XLIB) - if(outw.m_WindowSystem == eWindowingSystem_Xlib) + if(outw.m_WindowSystem == WindowingSystem::Xlib) { XWindowAttributes attr = {}; XGetWindowAttributes(outw.xlib.display, outw.xlib.window, &attr); @@ -121,7 +121,7 @@ void VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h #endif #if ENABLED(RDOC_XCB) - if(outw.m_WindowSystem == eWindowingSystem_XCB) + if(outw.m_WindowSystem == WindowingSystem::XCB) { xcb_get_geometry_cookie_t geomCookie = xcb_get_geometry(outw.xcb.connection, outw.xcb.window); // window is a xcb_drawable_t @@ -317,14 +317,14 @@ void MakeParentDirs(std::string file) mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); } -bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &myJSONs, +bool VulkanReplay::CheckVulkanLayer(VulkanLayerFlags &flags, std::vector &myJSONs, std::vector &otherJSONs) { // see if the user has suppressed all this checking as a "I know what I'm doing" measure if(FileExists(string(getenv("HOME")) + "/.renderdoc/ignore_vulkan_layer_issues")) { - flags = eVulkan_ThisInstallRegistered; + flags = VulkanLayerFlags::ThisInstallRegistered; return false; } @@ -367,10 +367,10 @@ bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &m numMatch++; } - flags = eVulkan_CouldElevate | eVulkan_UpdateAllowed; + flags = VulkanLayerFlags::CouldElevate | VulkanLayerFlags::UpdateAllowed; if(numMatch >= 1) - flags |= eVulkan_ThisInstallRegistered; + flags |= VulkanLayerFlags::ThisInstallRegistered; // if we only have one registration, check that it points to us. If so, we're good if(numExist == 1 && numMatch == 1) @@ -386,7 +386,7 @@ bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &m otherJSONs.push_back(layerRegistrationPath[HOME]); if(!otherJSONs.empty()) - flags |= eVulkan_OtherInstallsRegistered; + flags |= VulkanLayerFlags::OtherInstallsRegistered; if(exist[USR] && match[USR]) { @@ -400,7 +400,7 @@ bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &m if(exist[USR] && !match[USR]) { - flags = eVulkan_Unfixable | eVulkan_OtherInstallsRegistered; + flags = VulkanLayerFlags::Unfixable | VulkanLayerFlags::OtherInstallsRegistered; otherJSONs.clear(); otherJSONs.push_back(layerRegistrationPath[USR]); } diff --git a/renderdoc/driver/vulkan/vk_posix.cpp b/renderdoc/driver/vulkan/vk_posix.cpp index 468b526b9..af7ed30e8 100644 --- a/renderdoc/driver/vulkan/vk_posix.cpp +++ b/renderdoc/driver/vulkan/vk_posix.cpp @@ -62,7 +62,7 @@ bool WrappedVulkan::AddRequiredExtensions(bool instance, vector &extensi { oneSurfaceTypeSupported = true; - m_SupportedWindowSystems.push_back(eWindowingSystem_XCB); + m_SupportedWindowSystems.push_back(WindowingSystem::XCB); // don't add duplicates if(std::find(extensionList.begin(), extensionList.end(), VK_KHR_XCB_SURFACE_EXTENSION_NAME) == @@ -79,7 +79,7 @@ bool WrappedVulkan::AddRequiredExtensions(bool instance, vector &extensi { oneSurfaceTypeSupported = true; - m_SupportedWindowSystems.push_back(eWindowingSystem_Xlib); + m_SupportedWindowSystems.push_back(WindowingSystem::Xlib); // don't add duplicates if(std::find(extensionList.begin(), extensionList.end(), VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == @@ -96,7 +96,7 @@ bool WrappedVulkan::AddRequiredExtensions(bool instance, vector &extensi supportedExtensions.end()); oneSurfaceTypeSupported = true; - m_SupportedWindowSystems.push_back(eWindowingSystem_Android); + m_SupportedWindowSystems.push_back(WindowingSystem::Android); // don't add duplicates, application will have added this but just be sure if(std::find(extensionList.begin(), extensionList.end(), diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index d48c176ea..f79a86642 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -35,7 +35,7 @@ #include "data/glsl/debuguniforms.h" VulkanReplay::OutputWindow::OutputWindow() - : m_WindowSystem(eWindowingSystem_Unknown), width(0), height(0) + : m_WindowSystem(WindowingSystem::Unknown), width(0), height(0) { surface = VK_NULL_HANDLE; swap = VK_NULL_HANDLE; @@ -647,8 +647,8 @@ APIProperties VulkanReplay::GetAPIProperties() { APIProperties ret; - ret.pipelineType = eGraphicsAPI_Vulkan; - ret.localRenderer = eGraphicsAPI_Vulkan; + ret.pipelineType = GraphicsAPI::Vulkan; + ret.localRenderer = GraphicsAPI::Vulkan; ret.degraded = false; return ret; @@ -681,15 +681,15 @@ vector VulkanReplay::GetPassEvents(uint32_t eventID) // if we've come to the beginning of a pass, break out of the loop, we've // found the start. // Note that vkCmdNextSubPass has both Begin and End flags set, so it will - // break out here before we hit the terminating case looking for eDraw_EndPass - if(start->flags & eDraw_BeginPass) + // break out here before we hit the terminating case looking for DrawFlags::EndPass + if(start->flags & DrawFlags::BeginPass) break; // if we come to the END of a pass, since we were iterating backwards that // means we started outside of a pass, so return empty set. // Note that vkCmdNextSubPass has both Begin and End flags set, so it will // break out above before we hit this terminating case - if(start->flags & eDraw_EndPass) + if(start->flags & DrawFlags::EndPass) return passEvents; // if we've come to the start of the log we were outside of a render pass @@ -716,7 +716,7 @@ vector VulkanReplay::GetPassEvents(uint32_t eventID) // so we don't actually do anything (init postvs/draw overlay) // but it's useful to have the first part of the pass as part // of the list - if(start->flags & (eDraw_Drawcall | eDraw_PassBoundary)) + if(start->flags & (DrawFlags::Drawcall | DrawFlags::PassBoundary)) passEvents.push_back(start->eventID); start = m_pDriver->GetDrawcall((uint32_t)start->next); @@ -815,20 +815,20 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id) switch(iminfo.type) { case VK_IMAGE_TYPE_1D: - ret.resType = iminfo.arrayLayers > 1 ? eResType_Texture1DArray : eResType_Texture1D; + ret.resType = iminfo.arrayLayers > 1 ? TextureDim::Texture1DArray : TextureDim::Texture1D; ret.dimension = 1; break; case VK_IMAGE_TYPE_2D: if(ret.msSamp > 1) - ret.resType = iminfo.arrayLayers > 1 ? eResType_Texture2DMSArray : eResType_Texture2DMS; + ret.resType = iminfo.arrayLayers > 1 ? TextureDim::Texture2DMSArray : TextureDim::Texture2DMS; else if(ret.cubemap) - ret.resType = iminfo.arrayLayers > 6 ? eResType_TextureCubeArray : eResType_TextureCube; + ret.resType = iminfo.arrayLayers > 6 ? TextureDim::TextureCubeArray : TextureDim::TextureCube; else - ret.resType = iminfo.arrayLayers > 1 ? eResType_Texture2DArray : eResType_Texture2D; + ret.resType = iminfo.arrayLayers > 1 ? TextureDim::Texture2DArray : TextureDim::Texture2D; ret.dimension = 2; break; case VK_IMAGE_TYPE_3D: - ret.resType = eResType_Texture3D; + ret.resType = TextureDim::Texture3D; ret.dimension = 3; break; default: RDCERR("Unexpected image type"); break; @@ -846,9 +846,9 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id) if(ret.msSamp > 1) ms = "MS"; - if(ret.creationFlags & eTextureCreate_RTV) + if(ret.creationFlags & TextureCategory::ColorTarget) suffix = " RTV"; - if(ret.creationFlags & eTextureCreate_DSV) + if(ret.creationFlags & TextureCategory::DepthTarget) suffix = " DSV"; if(ret.cubemap) @@ -878,18 +878,18 @@ FetchBuffer VulkanReplay::GetBuffer(ResourceId id) ret.ID = m_pDriver->GetResourceManager()->GetOriginalID(id); ret.length = bufinfo.size; - ret.creationFlags = 0; + ret.creationFlags = BufferCategory::NoFlags; if(bufinfo.usage & (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)) - ret.creationFlags |= eBufferCreate_UAV; + ret.creationFlags |= BufferCategory::ReadWrite; if(bufinfo.usage & (VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT)) - ret.creationFlags |= eBufferCreate_CB; + ret.creationFlags |= BufferCategory::Constants; if(bufinfo.usage & (VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT)) - ret.creationFlags |= eBufferCreate_Indirect; + ret.creationFlags |= BufferCategory::Indirect; if(bufinfo.usage & (VK_BUFFER_USAGE_INDEX_BUFFER_BIT)) - ret.creationFlags |= eBufferCreate_IB; + ret.creationFlags |= BufferCategory::Index; if(bufinfo.usage & (VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)) - ret.creationFlags |= eBufferCreate_IB; + ret.creationFlags |= BufferCategory::Vertex; ret.customName = true; ret.name = m_pDriver->m_CreationInfo.m_Names[id]; @@ -929,8 +929,7 @@ ShaderReflection *VulkanReplay::GetShader(ResourceId shader, string entryPoint) } void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, - uint32_t mip, uint32_t sample, FormatComponentType typeHint, - float pixel[4]) + uint32_t mip, uint32_t sample, CompType typeHint, float pixel[4]) { int oldW = m_DebugWidth, oldH = m_DebugHeight; @@ -955,7 +954,7 @@ void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_ texDisplay.sampleIdx = sample; texDisplay.CustomShader = ResourceId(); texDisplay.sliceFace = sliceFace; - texDisplay.overlay = eTexOverlay_None; + texDisplay.overlay = DebugOverlay::NoOverlay; texDisplay.rangemin = 0.0f; texDisplay.rangemax = 1.0f; texDisplay.scale = 1.0f; @@ -1271,10 +1270,10 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn if(!IsSRGBFormat(iminfo.format) && cfg.linearDisplayAsGamma) displayformat |= TEXDISPLAY_GAMMA_CURVE; - if(cfg.overlay == eTexOverlay_NaN) + if(cfg.overlay == DebugOverlay::NaN) displayformat |= TEXDISPLAY_NANS; - if(cfg.overlay == eTexOverlay_Clipping) + if(cfg.overlay == DebugOverlay::Clipping) displayformat |= TEXDISPLAY_CLIPPING; data->OutputDisplayFormat = displayformat; @@ -1670,9 +1669,8 @@ void VulkanReplay::RenderHighlightBox(float w, float h, float scale) #endif } -ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) +ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) { return GetDebugManager()->RenderOverlay(texid, overlay, eventID, passEvents); } @@ -1883,13 +1881,13 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second vt->CmdBindVertexBuffers(Unwrap(cmd), 0, 1, UnwrapPtr(vb), &offs); } - SolidShadeMode solidShadeMode = cfg.solidShadeMode; + SolidShade solidShadeMode = cfg.solidShadeMode; // can't support secondary shading without a buffer - no pipeline will have been created - if(solidShadeMode == eShade_Secondary && cfg.second.buf == ResourceId()) - solidShadeMode = eShade_None; + if(solidShadeMode == SolidShade::Secondary && cfg.second.buf == ResourceId()) + solidShadeMode = SolidShade::NoSolid; - if(solidShadeMode == eShade_Secondary) + if(solidShadeMode == SolidShade::Secondary) { VkBuffer vb = m_pDriver->GetResourceManager()->GetCurrentHandle(cfg.second.buf); @@ -1898,21 +1896,21 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second } // solid render - if(solidShadeMode != eShade_None && cfg.position.topo < eTopology_PatchList) + if(solidShadeMode != SolidShade::NoSolid && cfg.position.topo < Topology::PatchList) { VkPipeline pipe = VK_NULL_HANDLE; switch(solidShadeMode) { default: - case eShade_Solid: pipe = cache.pipes[MeshDisplayPipelines::ePipe_SolidDepth]; break; - case eShade_Lit: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Lit]; break; - case eShade_Secondary: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Secondary]; break; + case SolidShade::Solid: pipe = cache.pipes[MeshDisplayPipelines::ePipe_SolidDepth]; break; + case SolidShade::Lit: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Lit]; break; + case SolidShade::Secondary: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Secondary]; break; } uint32_t uboOffs = 0; MeshUBOData *data = (MeshUBOData *)GetDebugManager()->m_MeshUBO.Map(&uboOffs); - if(solidShadeMode == eShade_Lit) + if(solidShadeMode == SolidShade::Lit) data->invProj = projMat.Inverse(); data->mvp = ModelViewProj; @@ -1922,7 +1920,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second data->displayFormat = (uint32_t)solidShadeMode; data->rawoutput = 0; - if(solidShadeMode == eShade_Secondary && cfg.second.showAlpha) + if(solidShadeMode == SolidShade::Secondary && cfg.second.showAlpha) data->displayFormat = MESHDISPLAY_SECONDARY_ALPHA; GetDebugManager()->m_MeshUBO.Unmap(); @@ -1955,7 +1953,8 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second } // wireframe render - if(solidShadeMode == eShade_None || cfg.wireframeDraw || cfg.position.topo >= eTopology_PatchList) + if(solidShadeMode == SolidShade::NoSolid || cfg.wireframeDraw || + cfg.position.topo >= Topology::PatchList) { Vec4f wireCol = Vec4f(cfg.position.meshColour.x, cfg.position.meshColour.y, cfg.position.meshColour.z, 1.0f); @@ -1965,7 +1964,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second data->mvp = ModelViewProj; data->color = wireCol; - data->displayFormat = (uint32_t)eShade_Solid; + data->displayFormat = (uint32_t)SolidShade::Solid; data->homogenousInput = cfg.position.unproject; data->pointSpriteSize = Vec2f(0.0f, 0.0f); data->rawoutput = 0; @@ -2002,12 +2001,12 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second MeshFormat helper; helper.idxByteWidth = 2; - helper.topo = eTopology_LineList; + helper.topo = Topology::LineList; - helper.specialFormat = eSpecial_Unknown; + helper.specialFormat = SpecialFormat::Unknown; helper.compByteWidth = 4; helper.compCount = 4; - helper.compType = eCompType_Float; + helper.compType = CompType::Float; helper.stride = sizeof(Vec4f); @@ -2053,7 +2052,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second data->mvp = ModelViewProj; data->color = Vec4f(0.2f, 0.2f, 1.0f, 1.0f); - data->displayFormat = (uint32_t)eShade_Solid; + data->displayFormat = (uint32_t)SolidShade::Solid; data->homogenousInput = 0; data->pointSpriteSize = Vec2f(0.0f, 0.0f); data->rawoutput = 0; @@ -2082,7 +2081,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second data->mvp = ModelViewProj; data->color = Vec4f(1.0f, 0.0f, 0.0f, 1.0f); - data->displayFormat = (uint32_t)eShade_Solid; + data->displayFormat = (uint32_t)SolidShade::Solid; data->homogenousInput = 0; data->pointSpriteSize = Vec2f(0.0f, 0.0f); data->rawoutput = 0; @@ -2103,7 +2102,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second data->mvp = ModelViewProj; data->color = Vec4f(0.0f, 1.0f, 0.0f, 1.0f); - data->displayFormat = (uint32_t)eShade_Solid; + data->displayFormat = (uint32_t)SolidShade::Solid; data->homogenousInput = 0; data->pointSpriteSize = Vec2f(0.0f, 0.0f); data->rawoutput = 0; @@ -2119,7 +2118,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second data->mvp = ModelViewProj; data->color = Vec4f(0.0f, 0.0f, 1.0f, 1.0f); - data->displayFormat = (uint32_t)eShade_Solid; + data->displayFormat = (uint32_t)SolidShade::Solid; data->homogenousInput = 0; data->pointSpriteSize = Vec2f(0.0f, 0.0f); data->rawoutput = 0; @@ -2144,7 +2143,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second data->mvp = ModelViewProj; data->color = Vec4f(1.0f, 1.0f, 1.0f, 1.0f); - data->displayFormat = (uint32_t)eShade_Solid; + data->displayFormat = (uint32_t)SolidShade::Solid; data->homogenousInput = 0; data->pointSpriteSize = Vec2f(0.0f, 0.0f); data->rawoutput = 0; @@ -2188,7 +2187,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second uint64_t maxIndex = cfg.position.numVerts; - if(cfg.position.idxByteWidth == 0 || stage == eMeshDataStage_GSOut) + if(cfg.position.idxByteWidth == 0 || stage == MeshDataStage::GSOut) { m_HighlightCache.indices.clear(); m_HighlightCache.useidx = false; @@ -2268,7 +2267,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second vt->CmdSetViewport(Unwrap(cmd), 0, 1, &viewport); } - PrimitiveTopology meshtopo = cfg.position.topo; + Topology meshtopo = cfg.position.topo; uint32_t idx = cfg.highlightVert; @@ -2299,19 +2298,19 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second // will be N*M long, N adjacent prims of M verts each. M = primSize below vector adjacentPrimVertices; - helper.topo = eTopology_TriangleList; + helper.topo = Topology::TriangleList; uint32_t primSize = 3; // number of verts per primitive - if(meshtopo == eTopology_LineList || meshtopo == eTopology_LineStrip || - meshtopo == eTopology_LineList_Adj || meshtopo == eTopology_LineStrip_Adj) + if(meshtopo == Topology::LineList || meshtopo == Topology::LineStrip || + meshtopo == Topology::LineList_Adj || meshtopo == Topology::LineStrip_Adj) { primSize = 2; - helper.topo = eTopology_LineList; + helper.topo = Topology::LineList; } else { // update the cache, as it's currently linelist - helper.topo = eTopology_TriangleList; + helper.topo = Topology::TriangleList; cache = GetDebugManager()->CacheMeshDisplayPipelines(helper, helper); } @@ -2319,14 +2318,14 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second // see Section 15.1.1 of the Vulkan 1.0 spec for // how primitive topologies are laid out - if(meshtopo == eTopology_LineList) + if(meshtopo == Topology::LineList) { uint32_t v = uint32_t(idx / 2) * 2; // find first vert in primitive activePrim.push_back(InterpretVertex(data, v + 0, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_TriangleList) + else if(meshtopo == Topology::TriangleList) { uint32_t v = uint32_t(idx / 3) * 3; // find first vert in primitive @@ -2334,7 +2333,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 2, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_LineList_Adj) + else if(meshtopo == Topology::LineList_Adj) { uint32_t v = uint32_t(idx / 4) * 4; // find first vert in primitive @@ -2354,7 +2353,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second activePrim.push_back(vs[1]); activePrim.push_back(vs[2]); } - else if(meshtopo == eTopology_TriangleList_Adj) + else if(meshtopo == Topology::TriangleList_Adj) { uint32_t v = uint32_t(idx / 6) * 6; // find first vert in primitive @@ -2383,7 +2382,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second activePrim.push_back(vs[2]); activePrim.push_back(vs[4]); } - else if(meshtopo == eTopology_LineStrip) + else if(meshtopo == Topology::LineStrip) { // find first vert in primitive. In strips a vert isn't // in only one primitive, so we pick the first primitive @@ -2394,7 +2393,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second activePrim.push_back(InterpretVertex(data, v + 0, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_TriangleStrip) + else if(meshtopo == Topology::TriangleStrip) { // find first vert in primitive. In strips a vert isn't // in only one primitive, so we pick the first primitive @@ -2406,7 +2405,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second activePrim.push_back(InterpretVertex(data, v + 1, cfg, dataEnd, true, valid)); activePrim.push_back(InterpretVertex(data, v + 2, cfg, dataEnd, true, valid)); } - else if(meshtopo == eTopology_LineStrip_Adj) + else if(meshtopo == Topology::LineStrip_Adj) { // find first vert in primitive. In strips a vert isn't // in only one primitive, so we pick the first primitive @@ -2430,7 +2429,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second activePrim.push_back(vs[1]); activePrim.push_back(vs[2]); } - else if(meshtopo == eTopology_TriangleStrip_Adj) + else if(meshtopo == Topology::TriangleStrip_Adj) { // Triangle strip with adjacency is the most complex topology, as // we need to handle the ends separately where the pattern breaks. @@ -2560,9 +2559,9 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second activePrim.push_back(vs[6]); } } - else if(meshtopo >= eTopology_PatchList) + else if(meshtopo >= Topology::PatchList) { - uint32_t dim = (cfg.position.topo - eTopology_PatchList_1CPs + 1); + uint32_t dim = PatchList_Count(cfg.position.topo); uint32_t v0 = uint32_t(idx / dim) * dim; @@ -2572,7 +2571,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second inactiveVertices.push_back(InterpretVertex(data, v, cfg, dataEnd, true, valid)); } } - else // if(meshtopo == eTopology_PointList) point list, or unknown/unhandled type + else // if(meshtopo == Topology::PointList) point list, or unknown/unhandled type { // no adjacency, inactive verts or active primitive } @@ -2591,7 +2590,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second MeshUBOData uniforms = {}; uniforms.mvp = ModelViewProj; uniforms.color = Vec4f(1.0f, 1.0f, 1.0f, 1.0f); - uniforms.displayFormat = (uint32_t)eShade_Solid; + uniforms.displayFormat = (uint32_t)SolidShade::Solid; uniforms.homogenousInput = cfg.position.unproject; uniforms.pointSpriteSize = Vec2f(0.0f, 0.0f); @@ -2679,7 +2678,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector &second UnwrapPtr(GetDebugManager()->m_MeshDescSet), 1, &uboOffs); // vertices are drawn with tri strips - helper.topo = eTopology_TriangleStrip; + helper.topo = Topology::TriangleStrip; cache = GetDebugManager()->CacheMeshDisplayPipelines(helper, helper); FloatVector vertSprite[4] = { @@ -2763,7 +2762,7 @@ bool VulkanReplay::CheckResizeOutputWindow(uint64_t id) OutputWindow &outw = m_OutputWindows[id]; - if(outw.m_WindowSystem == eWindowingSystem_Unknown) + if(outw.m_WindowSystem == WindowingSystem::Unknown) return false; int32_t w, h; @@ -3125,7 +3124,7 @@ uint64_t VulkanReplay::MakeOutputWindow(WindowingSystem system, void *data, bool m_OutputWindows[id].SetWindowHandle(system, data); m_OutputWindows[id].m_ResourceManager = GetResourceManager(); - if(system != eWindowingSystem_Unknown) + if(system != WindowingSystem::Unknown) { int32_t w, h; GetOutputWindowDimensions(id, w, h); @@ -3180,11 +3179,11 @@ void VulkanReplay::SavePipelineState() m_VulkanPipelineState.compute.flags = p.flags; - VulkanPipelineState::ShaderStage &stage = m_VulkanPipelineState.m_CS; + VulkanPipelineState::Shader &stage = m_VulkanPipelineState.m_CS; int i = 5; // 5 is the CS idx (VS, TCS, TES, GS, FS, CS) { - stage.Shader = rm->GetOriginalID(p.shaders[i].module); + stage.Object = rm->GetOriginalID(p.shaders[i].module); stage.entryPoint = p.shaders[i].entryPoint; stage.ShaderDetails = NULL; @@ -3193,10 +3192,10 @@ void VulkanReplay::SavePipelineState() if(stage.ShaderName.count == 0) { stage.customName = false; - stage.ShaderName = StringFormat::Fmt("Shader %llu", stage.Shader); + stage.ShaderName = StringFormat::Fmt("Shader %llu", stage.Object); } - stage.stage = eShaderStage_Compute; + stage.stage = ShaderStage::Compute; if(p.shaders[i].mapping) stage.BindpointMapping = *p.shaders[i].mapping; @@ -3247,14 +3246,14 @@ void VulkanReplay::SavePipelineState() } // Shader Stages - VulkanPipelineState::ShaderStage *stages[] = { + VulkanPipelineState::Shader *stages[] = { &m_VulkanPipelineState.m_VS, &m_VulkanPipelineState.m_TCS, &m_VulkanPipelineState.m_TES, &m_VulkanPipelineState.m_GS, &m_VulkanPipelineState.m_FS, }; for(size_t i = 0; i < ARRAY_COUNT(stages); i++) { - stages[i]->Shader = rm->GetOriginalID(p.shaders[i].module); + stages[i]->Object = rm->GetOriginalID(p.shaders[i].module); stages[i]->entryPoint = p.shaders[i].entryPoint; stages[i]->ShaderDetails = NULL; @@ -3263,10 +3262,10 @@ void VulkanReplay::SavePipelineState() if(stages[i]->ShaderName.count == 0) { stages[i]->customName = false; - stages[i]->ShaderName = StringFormat::Fmt("Shader %llu", stages[i]->Shader); + stages[i]->ShaderName = StringFormat::Fmt("Shader %llu", stages[i]->Object); } - stages[i]->stage = ShaderStageType(eShaderStage_Vertex + i); + stages[i]->stage = StageFromIndex(i); if(p.shaders[i].mapping) stages[i]->BindpointMapping = *p.shaders[i].mapping; @@ -3322,25 +3321,25 @@ void VulkanReplay::SavePipelineState() switch(p.polygonMode) { - case VK_POLYGON_MODE_POINT: m_VulkanPipelineState.RS.FillMode = eFill_Point; break; - case VK_POLYGON_MODE_LINE: m_VulkanPipelineState.RS.FillMode = eFill_Wireframe; break; - case VK_POLYGON_MODE_FILL: m_VulkanPipelineState.RS.FillMode = eFill_Solid; break; + case VK_POLYGON_MODE_POINT: m_VulkanPipelineState.RS.fillMode = FillMode::Point; break; + case VK_POLYGON_MODE_LINE: m_VulkanPipelineState.RS.fillMode = FillMode::Wireframe; break; + case VK_POLYGON_MODE_FILL: m_VulkanPipelineState.RS.fillMode = FillMode::Solid; break; default: - m_VulkanPipelineState.RS.FillMode = eFill_Solid; + m_VulkanPipelineState.RS.fillMode = FillMode::Solid; RDCERR("Unexpected value for FillMode %x", p.polygonMode); break; } switch(p.cullMode) { - case VK_CULL_MODE_NONE: m_VulkanPipelineState.RS.CullMode = eCull_None; break; - case VK_CULL_MODE_FRONT_BIT: m_VulkanPipelineState.RS.CullMode = eCull_Front; break; - case VK_CULL_MODE_BACK_BIT: m_VulkanPipelineState.RS.CullMode = eCull_Back; break; + case VK_CULL_MODE_NONE: m_VulkanPipelineState.RS.cullMode = CullMode::NoCull; break; + case VK_CULL_MODE_FRONT_BIT: m_VulkanPipelineState.RS.cullMode = CullMode::Front; break; + case VK_CULL_MODE_BACK_BIT: m_VulkanPipelineState.RS.cullMode = CullMode::Back; break; case VK_CULL_MODE_FRONT_AND_BACK: - m_VulkanPipelineState.RS.CullMode = eCull_FrontAndBack; + m_VulkanPipelineState.RS.cullMode = CullMode::FrontAndBack; break; default: - m_VulkanPipelineState.RS.CullMode = eCull_None; + m_VulkanPipelineState.RS.cullMode = CullMode::NoCull; RDCERR("Unexpected value for CullMode %x", p.cullMode); break; } @@ -3522,44 +3521,44 @@ void VulkanReplay::SavePipelineState() bool dynamicOffset = false; dst.bindings[b].descriptorCount = layoutBind.descriptorCount; - dst.bindings[b].stageFlags = (ShaderStageBits)layoutBind.stageFlags; + dst.bindings[b].stageFlags = (ShaderStageMask)layoutBind.stageFlags; switch(layoutBind.descriptorType) { - case VK_DESCRIPTOR_TYPE_SAMPLER: dst.bindings[b].type = eBindType_Sampler; break; + case VK_DESCRIPTOR_TYPE_SAMPLER: dst.bindings[b].type = BindType::Sampler; break; case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - dst.bindings[b].type = eBindType_ImageSampler; + dst.bindings[b].type = BindType::ImageSampler; break; case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - dst.bindings[b].type = eBindType_ReadOnlyImage; + dst.bindings[b].type = BindType::ReadOnlyImage; break; case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - dst.bindings[b].type = eBindType_ReadWriteImage; + dst.bindings[b].type = BindType::ReadWriteImage; break; case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - dst.bindings[b].type = eBindType_ReadOnlyTBuffer; + dst.bindings[b].type = BindType::ReadOnlyTBuffer; break; case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - dst.bindings[b].type = eBindType_ReadWriteTBuffer; + dst.bindings[b].type = BindType::ReadWriteTBuffer; break; case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - dst.bindings[b].type = eBindType_ConstantBuffer; + dst.bindings[b].type = BindType::ConstantBuffer; break; case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - dst.bindings[b].type = eBindType_ReadWriteBuffer; + dst.bindings[b].type = BindType::ReadWriteBuffer; break; case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - dst.bindings[b].type = eBindType_ConstantBuffer; + dst.bindings[b].type = BindType::ConstantBuffer; dynamicOffset = true; break; case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - dst.bindings[b].type = eBindType_ReadWriteBuffer; + dst.bindings[b].type = BindType::ReadWriteBuffer; dynamicOffset = true; break; case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - dst.bindings[b].type = eBindType_InputAttachment; + dst.bindings[b].type = BindType::InputAttachment; break; default: - dst.bindings[b].type = eBindType_Unknown; + dst.bindings[b].type = BindType::Unknown; RDCERR("Unexpected descriptor type"); } @@ -3774,7 +3773,7 @@ void VulkanReplay::FillCBufferVariables(rdctype::array invars, ShaderVariable var; var.name = basename; var.rows = var.columns = 0; - var.type = eVar_Float; + var.type = VarType::Float; vector varmembers; @@ -3785,7 +3784,7 @@ void VulkanReplay::FillCBufferVariables(rdctype::array invars, ShaderVariable vr; vr.name = StringFormat::Fmt("%s[%u]", basename.c_str(), i); vr.rows = vr.columns = 0; - vr.type = eVar_Float; + vr.type = VarType::Float; vector mems; @@ -3828,7 +3827,7 @@ void VulkanReplay::FillCBufferVariables(rdctype::array invars, outvars[outIdx].columns = cols; size_t elemByteSize = 4; - if(outvars[outIdx].type == eVar_Double) + if(outvars[outIdx].type == VarType::Double) elemByteSize = 8; ShaderVariable &var = outvars[outIdx]; @@ -4030,7 +4029,7 @@ void VulkanReplay::FillCBufferVariables(ResourceId shader, string entryPoint, ui } bool VulkanReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) + CompType typeHint, float *minval, float *maxval) { VkDevice dev = m_pDriver->GetDev(); VkCommandBuffer cmd = m_pDriver->GetNextCmd(); @@ -4284,8 +4283,8 @@ bool VulkanReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, } bool VulkanReplay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, - bool channels[4], vector &histogram) + CompType typeHint, float minval, float maxval, bool channels[4], + vector &histogram) { if(minval >= maxval) return false; @@ -4551,9 +4550,9 @@ struct VulkanInitPostVSCallback : public VulkanDrawcallCallback bool PostDispatch(uint32_t eid, VkCommandBuffer cmd) { return false; } void PostRedispatch(uint32_t eid, VkCommandBuffer cmd) {} // Ditto copy/etc - void PreMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) {} - bool PostMisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) { return false; } - void PostRemisc(uint32_t eid, DrawcallFlags flags, VkCommandBuffer cmd) {} + void PreMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) {} + bool PostMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) { return false; } + void PostRemisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) {} bool RecordAllCmds() { return false; } void AliasEvent(uint32_t primary, uint32_t alias) { @@ -4766,7 +4765,7 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true; texDisplay.HDRMul = -1.0f; texDisplay.linearDisplayAsGamma = false; - texDisplay.overlay = eTexOverlay_None; + texDisplay.overlay = DebugOverlay::NoOverlay; texDisplay.FlipY = false; texDisplay.mip = mip; texDisplay.sampleIdx = @@ -4777,7 +4776,7 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m texDisplay.rangemax = params.whitePoint; texDisplay.scale = 1.0f; texDisplay.texid = tex; - texDisplay.typeHint = eCompType_None; + texDisplay.typeHint = CompType::Typeless; texDisplay.rawoutput = false; texDisplay.offx = 0; texDisplay.offy = 0; @@ -5349,18 +5348,18 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m } void VulkanReplay::BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { SPIRVShaderStage stage = eSPIRVInvalid; switch(type) { - case eShaderStage_Vertex: stage = eSPIRVVertex; break; - case eShaderStage_Hull: stage = eSPIRVTessControl; break; - case eShaderStage_Domain: stage = eSPIRVTessEvaluation; break; - case eShaderStage_Geometry: stage = eSPIRVGeometry; break; - case eShaderStage_Pixel: stage = eSPIRVFragment; break; - case eShaderStage_Compute: stage = eSPIRVCompute; break; + case ShaderStage::Vertex: stage = eSPIRVVertex; break; + case ShaderStage::Hull: stage = eSPIRVTessControl; break; + case ShaderStage::Domain: stage = eSPIRVTessEvaluation; break; + case ShaderStage::Geometry: stage = eSPIRVGeometry; break; + case ShaderStage::Pixel: stage = eSPIRVFragment; break; + case ShaderStage::Compute: stage = eSPIRVCompute; break; default: RDCERR("Unexpected type in BuildShader!"); *id = ResourceId(); @@ -5404,8 +5403,7 @@ void VulkanReplay::FreeCustomShader(ResourceId id) } ResourceId VulkanReplay::ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, - uint32_t arrayIdx, uint32_t sampleIdx, - FormatComponentType typeHint) + uint32_t arrayIdx, uint32_t sampleIdx, CompType typeHint) { if(shader == ResourceId() || texid == ResourceId()) return ResourceId(); @@ -5432,7 +5430,7 @@ ResourceId VulkanReplay::ApplyCustomShader(ResourceId shader, ResourceId texid, disp.linearDisplayAsGamma = false; disp.mip = mip; disp.sampleIdx = sampleIdx; - disp.overlay = eTexOverlay_None; + disp.overlay = DebugOverlay::NoOverlay; disp.rangemin = 0.0f; disp.rangemax = 1.0f; disp.rawoutput = false; @@ -5462,18 +5460,18 @@ ResourceId VulkanReplay::ApplyCustomShader(ResourceId shader, ResourceId texid, } void VulkanReplay::BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) + ShaderStage type, ResourceId *id, string *errors) { SPIRVShaderStage stage = eSPIRVInvalid; switch(type) { - case eShaderStage_Vertex: stage = eSPIRVVertex; break; - case eShaderStage_Hull: stage = eSPIRVTessControl; break; - case eShaderStage_Domain: stage = eSPIRVTessEvaluation; break; - case eShaderStage_Geometry: stage = eSPIRVGeometry; break; - case eShaderStage_Pixel: stage = eSPIRVFragment; break; - case eShaderStage_Compute: stage = eSPIRVCompute; break; + case ShaderStage::Vertex: stage = eSPIRVVertex; break; + case ShaderStage::Hull: stage = eSPIRVTessControl; break; + case ShaderStage::Domain: stage = eSPIRVTessEvaluation; break; + case ShaderStage::Geometry: stage = eSPIRVGeometry; break; + case ShaderStage::Pixel: stage = eSPIRVFragment; break; + case ShaderStage::Compute: stage = eSPIRVCompute; break; default: RDCERR("Unexpected type in BuildShader!"); *id = ResourceId(); @@ -5529,7 +5527,7 @@ void VulkanReplay::FreeTargetResource(ResourceId id) vector VulkanReplay::PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, uint32_t sampleIdx, - FormatComponentType typeHint) + CompType typeHint) { VULKANNOTIMP("PixelHistory"); return vector(); @@ -5584,13 +5582,13 @@ void VulkanReplay::SetProxyBufferData(ResourceId bufid, byte *data, size_t dataS VULKANNOTIMP("SetProxyTextureData"); } -ReplayCreateStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver **driver) +ReplayStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCDEBUG("Creating a VulkanReplay replay device"); // disable the layer env var, just in case the user left it set from a previous capture run Process::RegisterEnvironmentModification(Process::EnvironmentModification( - Process::eEnvModification_Replace, "ENABLE_VULKAN_RENDERDOC_CAPTURE", "0")); + EnvMod::Set, EnvSep::NoSep, "ENABLE_VULKAN_RENDERDOC_CAPTURE", "0")); Process::ApplyEnvironmentModification(); void *module = Process::LoadModule(VulkanLibraryName); @@ -5598,7 +5596,7 @@ ReplayCreateStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver if(module == NULL) { RDCERR("Failed to load vulkan library"); - return eReplayCreate_APIInitFailed; + return ReplayStatus::APIInitFailed; } VkInitParams initParams; @@ -5610,7 +5608,7 @@ ReplayCreateStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver auto status = RenderDoc::Inst().FillInitParams(logfile, driverType, driverName, machineIdent, (RDCInitParams *)&initParams); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) return status; } @@ -5623,9 +5621,9 @@ ReplayCreateStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver VulkanReplay::PreDeviceInitCounters(); WrappedVulkan *vk = new WrappedVulkan(logfile); - ReplayCreateStatus status = vk->Initialise(initParams); + ReplayStatus status = vk->Initialise(initParams); - if(status != eReplayCreate_Success) + if(status != ReplayStatus::Succeeded) { delete vk; return status; @@ -5637,7 +5635,7 @@ ReplayCreateStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver *driver = (IReplayDriver *)replay; - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } struct VulkanDriverRegistration diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 2298ab662..5698d8b0f 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -178,14 +178,14 @@ public: ResourceId GetLiveID(ResourceId id); - vector EnumerateCounters(); - void DescribeCounter(uint32_t counterID, CounterDescription &desc); - vector FetchCounters(const vector &counters); + vector EnumerateCounters(); + void DescribeCounter(GPUCounter counterID, CounterDescription &desc); + vector FetchCounters(const vector &counters); bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval); + CompType typeHint, float *minval, float *maxval); bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, bool channels[4], + CompType typeHint, float minval, float maxval, bool channels[4], vector &histogram); MeshFormat GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDataStage stage); @@ -199,10 +199,10 @@ public: void RenderMesh(uint32_t eventID, const vector &secondaryDraws, const MeshDisplay &cfg); - void BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); - void BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors); + void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); + void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type, + ResourceId *id, string *errors); void FreeCustomShader(ResourceId id); bool RenderTexture(TextureDisplay cfg); @@ -216,21 +216,20 @@ public: vector PixelHistory(vector events, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ShaderDebugTrace DebugVertex(uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset); ShaderDebugTrace DebugPixel(uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive); ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]); + uint32_t sample, CompType typeHint, float pixel[4]); uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y); - ResourceId RenderOverlay(ResourceId cfg, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents); + ResourceId RenderOverlay(ResourceId cfg, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents); ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx, - uint32_t sampleIdx, FormatComponentType typeHint); + uint32_t sampleIdx, CompType typeHint); ResourceId CreateProxyTexture(const FetchTexture &templateTex); void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data, @@ -262,7 +261,7 @@ public: // but for developers running builds locally or just in case, we need to be able to update the // layer registration ourselves. // These functions are defined in vk_.cpp - static bool CheckVulkanLayer(uint32_t &flags, std::vector &myJSONs, + static bool CheckVulkanLayer(VulkanLayerFlags &flags, std::vector &myJSONs, std::vector &otherJSONs); static void InstallVulkanLayer(bool systemLevel); @@ -329,7 +328,7 @@ private: // mesh, not jumping back and forth much between meshes. struct HighlightCache { - HighlightCache() : EID(0), buf(), offs(0), stage(eMeshDataStage_Unknown), useidx(false) {} + HighlightCache() : EID(0), buf(), offs(0), stage(MeshDataStage::Unknown), useidx(false) {} uint32_t EID; ResourceId buf; uint64_t offs; diff --git a/renderdoc/driver/vulkan/vk_win32.cpp b/renderdoc/driver/vulkan/vk_win32.cpp index 58e03416c..2928f3f86 100644 --- a/renderdoc/driver/vulkan/vk_win32.cpp +++ b/renderdoc/driver/vulkan/vk_win32.cpp @@ -29,7 +29,7 @@ static int dllLocator = 0; void VulkanReplay::OutputWindow::SetWindowHandle(WindowingSystem system, void *data) { - RDCASSERT(system == eWindowingSystem_Win32, system); + RDCASSERT(system == WindowingSystem::Win32, system); wnd = (HWND)data; m_WindowSystem = system; } @@ -251,7 +251,7 @@ bool ProcessImplicitLayersKey(HKEY key, const std::wstring &path, return thisRegistered; } -bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &myJSONs, +bool VulkanReplay::CheckVulkanLayer(VulkanLayerFlags &flags, std::vector &myJSONs, std::vector &otherJSONs) { std::wstring normalPath = GetJSONPath(false); @@ -270,7 +270,7 @@ bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &m // and it will go away as we'll have rights to create it. if(!key) { - flags = eVulkan_NeedElevation | eVulkan_RegisterAll; + flags = VulkanLayerFlags::NeedElevation | VulkanLayerFlags::RegisterAll; return true; } @@ -294,13 +294,13 @@ bool VulkanReplay::CheckVulkanLayer(uint32_t &flags, std::vector &m } #endif - flags = eVulkan_NeedElevation | eVulkan_RegisterAll; + flags = VulkanLayerFlags::NeedElevation | VulkanLayerFlags::RegisterAll; if(thisRegistered) - flags |= eVulkan_ThisInstallRegistered; + flags |= VulkanLayerFlags::ThisInstallRegistered; if(!otherJSONs.empty()) - flags |= eVulkan_OtherInstallsRegistered; + flags |= VulkanLayerFlags::OtherInstallsRegistered; // return true if any changes are needed return !otherJSONs.empty() || !thisRegistered; diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index 1c868a06b..3f80316be 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -744,7 +744,7 @@ bool WrappedVulkan::Serialise_vkEndCommandBuffer(Serialiser *localSerialiser, { FetchDrawcall draw; draw.name = "API Calls"; - draw.flags |= eDraw_SetMarker | eDraw_APICalls; + draw.flags |= DrawFlags::SetMarker | DrawFlags::APICalls; AddDrawcall(draw, true); @@ -892,7 +892,7 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(Serialiser *localSerialiser, AddEvent(desc); FetchDrawcall draw; draw.name = StringFormat::Fmt("vkCmdBeginRenderPass(%s)", opDesc.c_str()); - draw.flags |= eDraw_PassBoundary | eDraw_BeginPass; + draw.flags |= DrawFlags::PassBoundary | DrawFlags::BeginPass; AddDrawcall(draw, true); } @@ -994,7 +994,7 @@ bool WrappedVulkan::Serialise_vkCmdNextSubpass(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = StringFormat::Fmt("vkCmdNextSubpass() => %u", m_BakedCmdBufferInfo[m_LastCmdBufferID].state.subpass); - draw.flags |= eDraw_PassBoundary | eDraw_BeginPass | eDraw_EndPass; + draw.flags |= DrawFlags::PassBoundary | DrawFlags::BeginPass | DrawFlags::EndPass; AddDrawcall(draw, true); } @@ -1066,7 +1066,7 @@ bool WrappedVulkan::Serialise_vkCmdEndRenderPass(Serialiser *localSerialiser, AddEvent(desc); FetchDrawcall draw; draw.name = StringFormat::Fmt("vkCmdEndRenderPass(%s)", opDesc.c_str()); - draw.flags |= eDraw_PassBoundary | eDraw_EndPass; + draw.flags |= DrawFlags::PassBoundary | DrawFlags::EndPass; AddDrawcall(draw, true); @@ -1915,9 +1915,9 @@ bool WrappedVulkan::Serialise_vkCmdPipelineBarrier( for(size_t i = 0; i < imgBarriers.size(); i++) { - m_BakedCmdBufferInfo[cmdid].resourceUsage.push_back( - std::make_pair(GetResourceManager()->GetNonDispWrapper(imgBarriers[i].image)->id, - EventUsage(m_BakedCmdBufferInfo[cmdid].curEventID, eUsage_Barrier))); + m_BakedCmdBufferInfo[cmdid].resourceUsage.push_back(std::make_pair( + GetResourceManager()->GetNonDispWrapper(imgBarriers[i].image)->id, + EventUsage(m_BakedCmdBufferInfo[cmdid].curEventID, ResourceUsage::Barrier))); } } @@ -2353,7 +2353,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = "vkCmdExecuteCommands(" + ToStr::Get(count) + ")"; - draw.flags = eDraw_CmdList | eDraw_PushMarker; + draw.flags = DrawFlags::CmdList | DrawFlags::PushMarker; AddDrawcall(draw, true); @@ -2369,7 +2369,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(Serialiser *localSerialiser, // add a fake marker FetchDrawcall marker; marker.name = name; - marker.flags = eDraw_PassBoundary | eDraw_BeginPass; + marker.flags = DrawFlags::PassBoundary | DrawFlags::BeginPass; AddEvent(name); AddDrawcall(marker, true); parentCmdBufInfo.curEventID++; @@ -2380,7 +2380,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(Serialiser *localSerialiser, (cmdBufInfo.beginFlags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT)) { AddDebugMessage( - eDbgCategory_Execution, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + MessageCategory::Execution, MessageSeverity::High, MessageSource::IncorrectAPIUse, "Executing a command buffer with RENDER_PASS_CONTINUE_BIT outside of render pass"); } @@ -2406,7 +2406,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(Serialiser *localSerialiser, name = StringFormat::Fmt("=> vkCmdExecuteCommands()[%u]: vkEndCommandBuffer(%s)", c, ToStr::Get(cmdids[c]).c_str()); marker.name = name; - marker.flags = eDraw_PassBoundary | eDraw_EndPass; + marker.flags = DrawFlags::PassBoundary | DrawFlags::EndPass; AddEvent(name); AddDrawcall(marker, true); parentCmdBufInfo.curEventID++; @@ -2414,7 +2414,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(Serialiser *localSerialiser, // add an extra pop marker draw = FetchDrawcall(); - draw.flags = eDraw_PopMarker; + draw.flags = DrawFlags::PopMarker; AddDrawcall(draw, true); @@ -2639,7 +2639,7 @@ bool WrappedVulkan::Serialise_vkCmdDebugMarkerBeginEXT(Serialiser *localSerialis { FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_PushMarker; + draw.flags |= DrawFlags::PushMarker; draw.markerColour[0] = RDCCLAMP(color[0], 0.0f, 1.0f); draw.markerColour[1] = RDCCLAMP(color[1], 0.0f, 1.0f); @@ -2683,7 +2683,7 @@ bool WrappedVulkan::Serialise_vkCmdDebugMarkerEndEXT(Serialiser *localSerialiser { FetchDrawcall draw; draw.name = "API Calls"; - draw.flags = eDraw_SetMarker | eDraw_APICalls; + draw.flags = DrawFlags::SetMarker | DrawFlags::APICalls; AddDrawcall(draw, true); } @@ -2694,7 +2694,7 @@ bool WrappedVulkan::Serialise_vkCmdDebugMarkerEndEXT(Serialiser *localSerialiser // is being in-lined into the call stream FetchDrawcall draw; draw.name = "Pop()"; - draw.flags = eDraw_PopMarker; + draw.flags = DrawFlags::PopMarker; AddDrawcall(draw, false); } @@ -2741,7 +2741,7 @@ bool WrappedVulkan::Serialise_vkCmdDebugMarkerInsertEXT(Serialiser *localSeriali { FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_SetMarker; + draw.flags |= DrawFlags::SetMarker; draw.markerColour[0] = RDCCLAMP(color[0], 0.0f, 1.0f); draw.markerColour[1] = RDCCLAMP(color[1], 0.0f, 1.0f); diff --git a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp index e488463e6..a21092850 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp @@ -89,10 +89,10 @@ static void StripUnwantedLayers(vector &Layers) } } -ReplayCreateStatus WrappedVulkan::Initialise(VkInitParams ¶ms) +ReplayStatus WrappedVulkan::Initialise(VkInitParams ¶ms) { if(m_pSerialiser->HasError()) - return eReplayCreate_FileIOFailed; + return ReplayStatus::FileIOFailed; m_InitParams = params; @@ -166,7 +166,7 @@ ReplayCreateStatus WrappedVulkan::Initialise(VkInitParams ¶ms) // error message will be printed to log in above function if something went wrong if(!ok) - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; // verify that extensions & layers are supported for(size_t i = 0; i < params.Layers.size(); i++) @@ -174,7 +174,7 @@ ReplayCreateStatus WrappedVulkan::Initialise(VkInitParams ¶ms) if(supportedLayers.find(params.Layers[i]) == supportedLayers.end()) { RDCERR("Log requires layer '%s' which is not supported", params.Layers[i].c_str()); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } } @@ -183,7 +183,7 @@ ReplayCreateStatus WrappedVulkan::Initialise(VkInitParams ¶ms) if(supportedExtensions.find(params.Extensions[i]) == supportedExtensions.end()) { RDCERR("Log requires extension '%s' which is not supported", params.Extensions[i].c_str()); - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; } } @@ -224,7 +224,7 @@ ReplayCreateStatus WrappedVulkan::Initialise(VkInitParams ¶ms) SAFE_DELETE_ARRAY(extscstr); if(ret != VK_SUCCESS) - return eReplayCreate_APIHardwareUnsupported; + return ReplayStatus::APIHardwareUnsupported; RDCASSERTEQUAL(ret, VK_SUCCESS); @@ -271,7 +271,7 @@ ReplayCreateStatus WrappedVulkan::Initialise(VkInitParams ¶ms) for(uint32_t i = 0; i < count; i++) GetResourceManager()->WrapResource(m_Instance, m_ReplayPhysicalDevices[i]); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } VkResult WrappedVulkan::vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, diff --git a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp index 2d0e673ca..69eefbb66 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp @@ -107,7 +107,8 @@ bool WrappedVulkan::Serialise_vkCmdDraw(Serialiser *localSerialiser, VkCommandBu if(!IsDrawInRenderPass()) { - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Drawcall in happening outside of render pass, or in secondary command " "buffer without RENDER_PASS_CONTINUE_BIT"); } @@ -124,7 +125,7 @@ bool WrappedVulkan::Serialise_vkCmdDraw(Serialiser *localSerialiser, VkCommandBu draw.vertexOffset = firstVtx; draw.instanceOffset = firstInst; - draw.flags |= eDraw_Drawcall | eDraw_Instanced; + draw.flags |= DrawFlags::Drawcall | DrawFlags::Instanced; AddDrawcall(draw, true); } @@ -203,7 +204,8 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexed(Serialiser *localSerialiser, if(!IsDrawInRenderPass()) { - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Drawcall in happening outside of render pass, or in secondary command " "buffer without RENDER_PASS_CONTINUE_BIT"); } @@ -220,7 +222,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexed(Serialiser *localSerialiser, draw.baseVertex = vtxOffs; draw.instanceOffset = firstInst; - draw.flags |= eDraw_Drawcall | eDraw_UseIBuffer | eDraw_Instanced; + draw.flags |= DrawFlags::Drawcall | DrawFlags::UseIBuffer | DrawFlags::Instanced; AddDrawcall(draw, true); } @@ -329,7 +331,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirect(Serialiser *localSerialiser, { for(uint32_t i = 0; i < cnt; i++) { - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Drawcall, i + 1); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Drawcall, i + 1); ObjDisp(commandBuffer)->CmdDrawIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs, 1, strd); @@ -370,7 +372,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirect(Serialiser *localSerialiser, if(IsDrawInRenderPass()) { - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Drawcall, drawidx + 1); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Drawcall, drawidx + 1); ObjDisp(commandBuffer)->CmdDrawIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs, cnt, strd); @@ -400,7 +402,8 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirect(Serialiser *localSerialiser, if(!IsDrawInRenderPass()) { - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Drawcall in happening outside of render pass, or in secondary command " "buffer without RENDER_PASS_CONTINUE_BIT"); } @@ -432,28 +435,28 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirect(Serialiser *localSerialiser, AddEvent(desc); draw.name = name; - draw.flags = eDraw_Drawcall | eDraw_Instanced; + draw.flags = DrawFlags::Drawcall | DrawFlags::Instanced; AddDrawcall(draw, true); VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(buffer), EventUsage(drawNode.draw.eventID, eUsage_Indirect))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(buffer), EventUsage(drawNode.draw.eventID, ResourceUsage::Indirect))); return true; } FetchDrawcall draw; draw.name = name; - draw.flags = eDraw_MultiDraw | eDraw_PushMarker; + draw.flags = DrawFlags::MultiDraw | DrawFlags::PushMarker; AddEvent(desc); AddDrawcall(draw, true); VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(buffer), EventUsage(drawNode.draw.eventID, eUsage_Indirect))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(buffer), EventUsage(drawNode.draw.eventID, ResourceUsage::Indirect))); m_BakedCmdBufferInfo[m_LastCmdBufferID].curEventID++; @@ -481,7 +484,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirect(Serialiser *localSerialiser, multi.name = "vkCmdDrawIndirect[" + ToStr::Get(i) + "](<" + ToStr::Get(multi.numIndices) + ", " + ToStr::Get(multi.numInstances) + ">)"; - multi.flags |= eDraw_Drawcall | eDraw_Instanced | eDraw_Indirect; + multi.flags |= DrawFlags::Drawcall | DrawFlags::Instanced | DrawFlags::Indirect; AddEvent(multi.name.elems); AddDrawcall(multi, true); @@ -490,7 +493,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirect(Serialiser *localSerialiser, } draw.name = name; - draw.flags = eDraw_PopMarker; + draw.flags = DrawFlags::PopMarker; AddDrawcall(draw, false); } else if(multidraw) @@ -606,7 +609,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(Serialiser *localSerialis { for(uint32_t i = 0; i < cnt; i++) { - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Drawcall, i + 1); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Drawcall, i + 1); ObjDisp(commandBuffer) ->CmdDrawIndexedIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs, 1, strd); @@ -661,7 +664,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(Serialiser *localSerialis if(IsDrawInRenderPass()) { - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Drawcall, drawidx + 1); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Drawcall, drawidx + 1); ObjDisp(commandBuffer) ->CmdDrawIndexedIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs, cnt, strd); @@ -692,7 +695,8 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(Serialiser *localSerialis if(!IsDrawInRenderPass()) { - AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_High, eDbgSource_IncorrectAPIUse, + AddDebugMessage(MessageCategory::Execution, MessageSeverity::High, + MessageSource::IncorrectAPIUse, "Drawcall in happening outside of render pass, or in secondary command " "buffer without RENDER_PASS_CONTINUE_BIT"); } @@ -725,28 +729,28 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(Serialiser *localSerialis AddEvent(desc); draw.name = name; - draw.flags = eDraw_Drawcall | eDraw_UseIBuffer | eDraw_Instanced; + draw.flags = DrawFlags::Drawcall | DrawFlags::UseIBuffer | DrawFlags::Instanced; AddDrawcall(draw, true); VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(buffer), EventUsage(drawNode.draw.eventID, eUsage_Indirect))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(buffer), EventUsage(drawNode.draw.eventID, ResourceUsage::Indirect))); return true; } FetchDrawcall draw; draw.name = name; - draw.flags = eDraw_MultiDraw | eDraw_PushMarker; + draw.flags = DrawFlags::MultiDraw | DrawFlags::PushMarker; AddEvent(desc); AddDrawcall(draw, true); VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(buffer), EventUsage(drawNode.draw.eventID, eUsage_Indirect))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(buffer), EventUsage(drawNode.draw.eventID, ResourceUsage::Indirect))); m_BakedCmdBufferInfo[m_LastCmdBufferID].curEventID++; @@ -775,7 +779,8 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(Serialiser *localSerialis multi.name = "vkCmdDrawIndexedIndirect[" + ToStr::Get(i) + "](<" + ToStr::Get(multi.numIndices) + ", " + ToStr::Get(multi.numInstances) + ">)"; - multi.flags |= eDraw_Drawcall | eDraw_UseIBuffer | eDraw_Instanced | eDraw_Indirect; + multi.flags |= + DrawFlags::Drawcall | DrawFlags::UseIBuffer | DrawFlags::Instanced | DrawFlags::Indirect; AddEvent(multi.name.elems); AddDrawcall(multi, true); @@ -784,7 +789,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(Serialiser *localSerialis } draw.name = name; - draw.flags = eDraw_PopMarker; + draw.flags = DrawFlags::PopMarker; AddDrawcall(draw, false); } else if(multidraw) @@ -842,7 +847,7 @@ bool WrappedVulkan::Serialise_vkCmdDispatch(Serialiser *localSerialiser, { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Dispatch); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Dispatch); ObjDisp(commandBuffer)->CmdDispatch(Unwrap(commandBuffer), X, Y, Z); @@ -872,7 +877,7 @@ bool WrappedVulkan::Serialise_vkCmdDispatch(Serialiser *localSerialiser, draw.dispatchDimension[1] = Y; draw.dispatchDimension[2] = Z; - draw.flags |= eDraw_Dispatch; + draw.flags |= DrawFlags::Dispatch; AddDrawcall(draw, true); } @@ -921,7 +926,7 @@ bool WrappedVulkan::Serialise_vkCmdDispatchIndirect(Serialiser *localSerialiser, { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Dispatch); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Dispatch); ObjDisp(commandBuffer)->CmdDispatchIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs); @@ -964,14 +969,14 @@ bool WrappedVulkan::Serialise_vkCmdDispatchIndirect(Serialiser *localSerialiser, draw.dispatchDimension[1] = args->y; draw.dispatchDimension[2] = args->z; - draw.flags |= eDraw_Dispatch | eDraw_Indirect; + draw.flags |= DrawFlags::Dispatch | DrawFlags::Indirect; AddDrawcall(draw, true); VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(buffer), EventUsage(drawNode.draw.eventID, eUsage_Indirect))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(buffer), EventUsage(drawNode.draw.eventID, ResourceUsage::Indirect))); } } @@ -1034,19 +1039,19 @@ bool WrappedVulkan::Serialise_vkCmdBlitImage(Serialiser *localSerialiser, { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Resolve); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Resolve); ObjDisp(commandBuffer) ->CmdBlitImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions, f); - if(eventID && m_DrawcallCallback->PostMisc(eventID, eDraw_Resolve, commandBuffer)) + if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawFlags::Resolve, commandBuffer)) { ObjDisp(commandBuffer) ->CmdBlitImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions, f); - m_DrawcallCallback->PostRemisc(eventID, eDraw_Resolve, commandBuffer); + m_DrawcallCallback->PostRemisc(eventID, DrawFlags::Resolve, commandBuffer); } } } @@ -1068,7 +1073,7 @@ bool WrappedVulkan::Serialise_vkCmdBlitImage(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Resolve; + draw.flags |= DrawFlags::Resolve; draw.copySource = srcid; draw.copyDestination = dstid; @@ -1079,15 +1084,15 @@ bool WrappedVulkan::Serialise_vkCmdBlitImage(Serialiser *localSerialiser, if(srcImage == destImage) { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcImage), EventUsage(drawNode.draw.eventID, eUsage_Resolve))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(srcImage), EventUsage(drawNode.draw.eventID, ResourceUsage::Resolve))); } else { drawNode.resourceUsage.push_back(std::make_pair( - GetResID(srcImage), EventUsage(drawNode.draw.eventID, eUsage_ResolveSrc))); + GetResID(srcImage), EventUsage(drawNode.draw.eventID, ResourceUsage::ResolveSrc))); drawNode.resourceUsage.push_back(std::make_pair( - GetResID(destImage), EventUsage(drawNode.draw.eventID, eUsage_ResolveSrc))); + GetResID(destImage), EventUsage(drawNode.draw.eventID, ResourceUsage::ResolveSrc))); } } } @@ -1161,19 +1166,19 @@ bool WrappedVulkan::Serialise_vkCmdResolveImage(Serialiser *localSerialiser, { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Resolve); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Resolve); ObjDisp(commandBuffer) ->CmdResolveImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions); - if(eventID && m_DrawcallCallback->PostMisc(eventID, eDraw_Resolve, commandBuffer)) + if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawFlags::Resolve, commandBuffer)) { ObjDisp(commandBuffer) ->CmdResolveImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions); - m_DrawcallCallback->PostRemisc(eventID, eDraw_Resolve, commandBuffer); + m_DrawcallCallback->PostRemisc(eventID, DrawFlags::Resolve, commandBuffer); } } } @@ -1195,7 +1200,7 @@ bool WrappedVulkan::Serialise_vkCmdResolveImage(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Resolve; + draw.flags |= DrawFlags::Resolve; draw.copySource = srcid; draw.copyDestination = dstid; @@ -1206,15 +1211,15 @@ bool WrappedVulkan::Serialise_vkCmdResolveImage(Serialiser *localSerialiser, if(srcImage == destImage) { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcImage), EventUsage(drawNode.draw.eventID, eUsage_Resolve))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(srcImage), EventUsage(drawNode.draw.eventID, ResourceUsage::Resolve))); } else { drawNode.resourceUsage.push_back(std::make_pair( - GetResID(srcImage), EventUsage(drawNode.draw.eventID, eUsage_ResolveSrc))); + GetResID(srcImage), EventUsage(drawNode.draw.eventID, ResourceUsage::ResolveSrc))); drawNode.resourceUsage.push_back(std::make_pair( - GetResID(destImage), EventUsage(drawNode.draw.eventID, eUsage_ResolveDst))); + GetResID(destImage), EventUsage(drawNode.draw.eventID, ResourceUsage::ResolveDst))); } } } @@ -1288,19 +1293,19 @@ bool WrappedVulkan::Serialise_vkCmdCopyImage(Serialiser *localSerialiser, { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Copy); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Copy); ObjDisp(commandBuffer) ->CmdCopyImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions); - if(eventID && m_DrawcallCallback->PostMisc(eventID, eDraw_Copy, commandBuffer)) + if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawFlags::Copy, commandBuffer)) { ObjDisp(commandBuffer) ->CmdCopyImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions); - m_DrawcallCallback->PostRemisc(eventID, eDraw_Copy, commandBuffer); + m_DrawcallCallback->PostRemisc(eventID, DrawFlags::Copy, commandBuffer); } } } @@ -1322,7 +1327,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyImage(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = srcid; draw.copyDestination = dstid; @@ -1333,15 +1338,15 @@ bool WrappedVulkan::Serialise_vkCmdCopyImage(Serialiser *localSerialiser, if(srcImage == destImage) { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcImage), EventUsage(drawNode.draw.eventID, eUsage_Copy))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(srcImage), EventUsage(drawNode.draw.eventID, ResourceUsage::Copy))); } else { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcImage), EventUsage(drawNode.draw.eventID, eUsage_CopySrc))); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(destImage), EventUsage(drawNode.draw.eventID, eUsage_CopyDst))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(srcImage), EventUsage(drawNode.draw.eventID, ResourceUsage::CopySrc))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(destImage), EventUsage(drawNode.draw.eventID, ResourceUsage::CopyDst))); } } } @@ -1415,19 +1420,19 @@ bool WrappedVulkan::Serialise_vkCmdCopyBufferToImage(Serialiser *localSerialiser { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Copy); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Copy); ObjDisp(commandBuffer) ->CmdCopyBufferToImage(Unwrap(commandBuffer), Unwrap(srcBuffer), Unwrap(destImage), layout, count, regions); - if(eventID && m_DrawcallCallback->PostMisc(eventID, eDraw_Copy, commandBuffer)) + if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawFlags::Copy, commandBuffer)) { ObjDisp(commandBuffer) ->CmdCopyBufferToImage(Unwrap(commandBuffer), Unwrap(srcBuffer), Unwrap(destImage), layout, count, regions); - m_DrawcallCallback->PostRemisc(eventID, eDraw_Copy, commandBuffer); + m_DrawcallCallback->PostRemisc(eventID, DrawFlags::Copy, commandBuffer); } } } @@ -1449,7 +1454,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyBufferToImage(Serialiser *localSerialiser FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = bufid; draw.copyDestination = imgid; @@ -1458,10 +1463,10 @@ bool WrappedVulkan::Serialise_vkCmdCopyBufferToImage(Serialiser *localSerialiser VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcBuffer), EventUsage(drawNode.draw.eventID, eUsage_CopySrc))); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(destImage), EventUsage(drawNode.draw.eventID, eUsage_CopyDst))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(srcBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::CopySrc))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(destImage), EventUsage(drawNode.draw.eventID, ResourceUsage::CopyDst))); } } @@ -1533,19 +1538,19 @@ bool WrappedVulkan::Serialise_vkCmdCopyImageToBuffer(Serialiser *localSerialiser { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Copy); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Copy); ObjDisp(commandBuffer) ->CmdCopyImageToBuffer(Unwrap(commandBuffer), Unwrap(srcImage), layout, Unwrap(destBuffer), count, regions); - if(eventID && m_DrawcallCallback->PostMisc(eventID, eDraw_Copy, commandBuffer)) + if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawFlags::Copy, commandBuffer)) { ObjDisp(commandBuffer) ->CmdCopyImageToBuffer(Unwrap(commandBuffer), Unwrap(srcImage), layout, Unwrap(destBuffer), count, regions); - m_DrawcallCallback->PostRemisc(eventID, eDraw_Copy, commandBuffer); + m_DrawcallCallback->PostRemisc(eventID, DrawFlags::Copy, commandBuffer); } } } @@ -1567,7 +1572,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyImageToBuffer(Serialiser *localSerialiser FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = imgid; draw.copyDestination = bufid; @@ -1576,10 +1581,10 @@ bool WrappedVulkan::Serialise_vkCmdCopyImageToBuffer(Serialiser *localSerialiser VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcImage), EventUsage(drawNode.draw.eventID, eUsage_CopySrc))); - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(destBuffer), EventUsage(drawNode.draw.eventID, eUsage_CopyDst))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(srcImage), EventUsage(drawNode.draw.eventID, ResourceUsage::CopySrc))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(destBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::CopyDst))); } } @@ -1652,19 +1657,19 @@ bool WrappedVulkan::Serialise_vkCmdCopyBuffer(Serialiser *localSerialiser, { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, eDraw_Copy); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags::Copy); ObjDisp(commandBuffer) ->CmdCopyBuffer(Unwrap(commandBuffer), Unwrap(srcBuffer), Unwrap(destBuffer), count, regions); - if(eventID && m_DrawcallCallback->PostMisc(eventID, eDraw_Copy, commandBuffer)) + if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawFlags::Copy, commandBuffer)) { ObjDisp(commandBuffer) ->CmdCopyBuffer(Unwrap(commandBuffer), Unwrap(srcBuffer), Unwrap(destBuffer), count, regions); - m_DrawcallCallback->PostRemisc(eventID, eDraw_Copy, commandBuffer); + m_DrawcallCallback->PostRemisc(eventID, DrawFlags::Copy, commandBuffer); } } } @@ -1685,7 +1690,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyBuffer(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Copy; + draw.flags |= DrawFlags::Copy; draw.copySource = srcid; draw.copyDestination = dstid; @@ -1696,15 +1701,15 @@ bool WrappedVulkan::Serialise_vkCmdCopyBuffer(Serialiser *localSerialiser, if(srcBuffer == destBuffer) { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcBuffer), EventUsage(drawNode.draw.eventID, eUsage_Copy))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(srcBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::Copy))); } else { - drawNode.resourceUsage.push_back( - std::make_pair(GetResID(srcBuffer), EventUsage(drawNode.draw.eventID, eUsage_CopySrc))); drawNode.resourceUsage.push_back(std::make_pair( - GetResID(destBuffer), EventUsage(drawNode.draw.eventID, eUsage_CopyDst))); + GetResID(srcBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::CopySrc))); + drawNode.resourceUsage.push_back(std::make_pair( + GetResID(destBuffer), EventUsage(drawNode.draw.eventID, ResourceUsage::CopyDst))); } } } @@ -1781,20 +1786,20 @@ bool WrappedVulkan::Serialise_vkCmdClearColorImage(Serialiser *localSerialiser, commandBuffer = RerecordCmdBuf(cmdid); uint32_t eventID = - HandlePreCallback(commandBuffer, DrawcallFlags(eDraw_Clear | eDraw_ClearColour)); + HandlePreCallback(commandBuffer, DrawFlags(DrawFlags::Clear | DrawFlags::ClearColour)); ObjDisp(commandBuffer) ->CmdClearColorImage(Unwrap(commandBuffer), Unwrap(image), layout, &col, count, ranges); if(eventID && - m_DrawcallCallback->PostMisc(eventID, DrawcallFlags(eDraw_Clear | eDraw_ClearColour), + m_DrawcallCallback->PostMisc(eventID, DrawFlags(DrawFlags::Clear | DrawFlags::ClearColour), commandBuffer)) { ObjDisp(commandBuffer) ->CmdClearColorImage(Unwrap(commandBuffer), Unwrap(image), layout, &col, count, ranges); - m_DrawcallCallback->PostRemisc(eventID, DrawcallFlags(eDraw_Clear | eDraw_ClearColour), - commandBuffer); + m_DrawcallCallback->PostRemisc( + eventID, DrawFlags(DrawFlags::Clear | DrawFlags::ClearColour), commandBuffer); } } } @@ -1814,14 +1819,14 @@ bool WrappedVulkan::Serialise_vkCmdClearColorImage(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearColour; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearColour; AddDrawcall(draw, true); VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); drawNode.resourceUsage.push_back( - std::make_pair(GetResID(image), EventUsage(drawNode.draw.eventID, eUsage_Clear))); + std::make_pair(GetResID(image), EventUsage(drawNode.draw.eventID, ResourceUsage::Clear))); } } @@ -1883,21 +1888,21 @@ bool WrappedVulkan::Serialise_vkCmdClearDepthStencilImage( { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = - HandlePreCallback(commandBuffer, DrawcallFlags(eDraw_Clear | eDraw_ClearDepthStencil)); + uint32_t eventID = HandlePreCallback( + commandBuffer, DrawFlags(DrawFlags::Clear | DrawFlags::ClearDepthStencil)); ObjDisp(commandBuffer) ->CmdClearDepthStencilImage(Unwrap(commandBuffer), Unwrap(image), l, &ds, count, ranges); if(eventID && - m_DrawcallCallback->PostMisc(eventID, DrawcallFlags(eDraw_Clear | eDraw_ClearDepthStencil), - commandBuffer)) + m_DrawcallCallback->PostMisc( + eventID, DrawFlags(DrawFlags::Clear | DrawFlags::ClearDepthStencil), commandBuffer)) { ObjDisp(commandBuffer) ->CmdClearDepthStencilImage(Unwrap(commandBuffer), Unwrap(image), l, &ds, count, ranges); m_DrawcallCallback->PostRemisc( - eventID, DrawcallFlags(eDraw_Clear | eDraw_ClearDepthStencil), commandBuffer); + eventID, DrawFlags(DrawFlags::Clear | DrawFlags::ClearDepthStencil), commandBuffer); } } } @@ -1918,14 +1923,14 @@ bool WrappedVulkan::Serialise_vkCmdClearDepthStencilImage( FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear | eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::Clear | DrawFlags::ClearDepthStencil; AddDrawcall(draw, true); VulkanDrawcallTreeNode &drawNode = GetDrawcallStack().back()->children.back(); drawNode.resourceUsage.push_back( - std::make_pair(GetResID(image), EventUsage(drawNode.draw.eventID, eUsage_Clear))); + std::make_pair(GetResID(image), EventUsage(drawNode.draw.eventID, ResourceUsage::Clear))); } } @@ -1989,15 +1994,15 @@ bool WrappedVulkan::Serialise_vkCmdClearAttachments(Serialiser *localSerialiser, { commandBuffer = RerecordCmdBuf(cmdid); - uint32_t eventID = HandlePreCallback(commandBuffer, DrawcallFlags(eDraw_Clear)); + uint32_t eventID = HandlePreCallback(commandBuffer, DrawFlags(DrawFlags::Clear)); ObjDisp(commandBuffer)->CmdClearAttachments(Unwrap(commandBuffer), acount, atts, rcount, rects); - if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawcallFlags(eDraw_Clear), commandBuffer)) + if(eventID && m_DrawcallCallback->PostMisc(eventID, DrawFlags(DrawFlags::Clear), commandBuffer)) { ObjDisp(commandBuffer)->CmdClearAttachments(Unwrap(commandBuffer), acount, atts, rcount, rects); - m_DrawcallCallback->PostRemisc(eventID, DrawcallFlags(eDraw_Clear), commandBuffer); + m_DrawcallCallback->PostRemisc(eventID, DrawFlags(DrawFlags::Clear), commandBuffer); } } } @@ -2018,13 +2023,13 @@ bool WrappedVulkan::Serialise_vkCmdClearAttachments(Serialiser *localSerialiser, FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_Clear; + draw.flags |= DrawFlags::Clear; for(uint32_t a = 0; a < acount; a++) { if(atts[a].aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) - draw.flags |= eDraw_ClearColour; + draw.flags |= DrawFlags::ClearColour; if(atts[a].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) - draw.flags |= eDraw_ClearDepthStencil; + draw.flags |= DrawFlags::ClearDepthStencil; } AddDrawcall(draw, true); @@ -2044,16 +2049,16 @@ bool WrappedVulkan::Serialise_vkCmdClearAttachments(Serialiser *localSerialiser, uint32_t att = rp.subpasses[state.subpass].colorAttachments[i]; drawNode.resourceUsage.push_back(std::make_pair( m_CreationInfo.m_ImageView[fb.attachments[att].view].image, - EventUsage(drawNode.draw.eventID, eUsage_Clear, fb.attachments[att].view))); + EventUsage(drawNode.draw.eventID, ResourceUsage::Clear, fb.attachments[att].view))); } - if(draw.flags & eDraw_ClearDepthStencil && + if(draw.flags & DrawFlags::ClearDepthStencil && rp.subpasses[state.subpass].depthstencilAttachment >= 0) { int32_t att = rp.subpasses[state.subpass].depthstencilAttachment; drawNode.resourceUsage.push_back(std::make_pair( m_CreationInfo.m_ImageView[fb.attachments[att].view].image, - EventUsage(drawNode.draw.eventID, eUsage_Clear, fb.attachments[att].view))); + EventUsage(drawNode.draw.eventID, ResourceUsage::Clear, fb.attachments[att].view))); } } } diff --git a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp index ee5706b43..cebf7c710 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp @@ -215,7 +215,7 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(Serialiser *localSerialiser, VkQueue // add a fake marker FetchDrawcall draw; draw.name = name; - draw.flags |= eDraw_SetMarker; + draw.flags |= DrawFlags::SetMarker; AddEvent(name); AddDrawcall(draw, true); m_RootEventID++; @@ -405,7 +405,7 @@ void WrappedVulkan::InsertDrawsAndRefreshIDs(vector &cmd // assign new drawcall IDs for(size_t i = 0; i < cmdBufNodes.size(); i++) { - if(cmdBufNodes[i].draw.flags & eDraw_PopMarker) + if(cmdBufNodes[i].draw.flags & DrawFlags::PopMarker) { // RDCASSERT(GetDrawcallStack().size() > 1); if(GetDrawcallStack().size() > 1) @@ -444,7 +444,7 @@ void WrappedVulkan::InsertDrawsAndRefreshIDs(vector &cmd GetDrawcallStack().back()->children.push_back(n); // if this is a push marker too, step down the drawcall stack - if(cmdBufNodes[i].draw.flags & eDraw_PushMarker) + if(cmdBufNodes[i].draw.flags & DrawFlags::PushMarker) GetDrawcallStack().push_back(&GetDrawcallStack().back()->children.back()); } } diff --git a/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp index f42b48e5c..0a43899e2 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp @@ -386,7 +386,8 @@ bool WrappedVulkan::Serialise_vkCreateSwapchainKHR(Serialiser *localSerialiser, iminfo.extent.depth = 1; iminfo.mipLevels = 1; iminfo.arrayLayers = info.imageArrayLayers; - iminfo.creationFlags = eTextureCreate_SRV | eTextureCreate_RTV | eTextureCreate_SwapBuffer; + iminfo.creationFlags = + TextureCategory::ShaderRead | TextureCategory::ColorTarget | TextureCategory::SwapBuffer; iminfo.cube = false; iminfo.samples = VK_SAMPLE_COUNT_1_BIT; diff --git a/renderdoc/os/os_specific.h b/renderdoc/os/os_specific.h index 1d6fcdf77..2d2c280e1 100644 --- a/renderdoc/os/os_specific.h +++ b/renderdoc/os/os_specific.h @@ -37,6 +37,7 @@ #include #include #include +#include "api/replay/renderdoc_replay.h" #include "common/common.h" using std::string; @@ -47,31 +48,15 @@ struct CaptureOptions; namespace Process { -enum ModificationType -{ - eEnvModification_Replace = 0, - - // prepend/append options will replace if there is no existing variable - eEnvModification_AppendPlatform, // append, separated by colons for linux & semi-colons for - // windows - eEnvModification_AppendSemiColon, // append, separated by semi-colons - eEnvModification_AppendColon, // append, separated by colons - eEnvModification_Append, // append with no separators - - eEnvModification_PrependPlatform, // prepend, separated by colons for linux & semi-colons for - // windows - eEnvModification_PrependSemiColon, // prepend, separated by semi-colons - eEnvModification_PrependColon, // prepend, separated by colons - eEnvModification_Prepend, // prepend with no separators -}; struct EnvironmentModification { - EnvironmentModification() : type(eEnvModification_Replace), name(""), value("") {} - EnvironmentModification(ModificationType t, const char *n, const char *v) - : type(t), name(n), value(v) + EnvironmentModification() : mod(EnvMod::Set), sep(EnvSep::NoSep), name(""), value("") {} + EnvironmentModification(EnvMod m, EnvSep s, const char *n, const char *v) + : mod(m), sep(s), name(n), value(v) { } - ModificationType type; + EnvMod mod; + EnvSep sep; string name; string value; }; @@ -272,23 +257,12 @@ uint64_t GetModifiedTimestamp(const string &filename); void Copy(const char *from, const char *to, bool allowOverwrite); void Delete(const char *path); -enum -{ - eFileProp_Directory = 0x1, - eFileProp_Hidden = 0x2, - eFileProp_Executable = 0x4, - - eFileProp_ErrorUnknown = 0x2000, - eFileProp_ErrorAccessDenied = 0x4000, - eFileProp_ErrorInvalidPath = 0x8000, -}; - struct FoundFile { - FoundFile() : flags(0) {} - FoundFile(string fn, uint32_t f) : filename(fn), flags(f), lastmod(0), size(0) {} + FoundFile() : flags(FileProperty::NoFlags) {} + FoundFile(string fn, FileProperty f) : filename(fn), flags(f), lastmod(0), size(0) {} string filename; - uint32_t flags; + FileProperty flags; uint32_t lastmod; uint64_t size; }; diff --git a/renderdoc/os/posix/posix_process.cpp b/renderdoc/os/posix/posix_process.cpp index 86c9774c1..a3c4c045a 100644 --- a/renderdoc/os/posix/posix_process.cpp +++ b/renderdoc/os/posix/posix_process.cpp @@ -181,36 +181,36 @@ void Process::ApplyEnvironmentModification() string value = currentEnv[m.name]; - switch(m.type) + switch(m.mod) { - case eEnvModification_Replace: value = m.value; break; - case eEnvModification_Append: value += m.value; break; - case eEnvModification_AppendPlatform: - case eEnvModification_AppendColon: + case EnvMod::Set: value = m.value; break; + case EnvMod::Append: + { if(!value.empty()) - value += ":"; + { + if(m.sep == EnvSep::Platform || m.sep == EnvSep::Colon) + value += ":"; + else if(m.sep == EnvSep::SemiColon) + value += ";"; + } value += m.value; break; - case eEnvModification_AppendSemiColon: + } + case EnvMod::Prepend: + { if(!value.empty()) - value += ";"; - value += m.value; - break; - case eEnvModification_Prepend: value = m.value + value; break; - case eEnvModification_PrependColon: - if(!value.empty()) - value = m.value + ":" + value; + { + if(m.sep == EnvSep::Platform || m.sep == EnvSep::Colon) + value += ":"; + else if(m.sep == EnvSep::SemiColon) + value += ";"; + } else + { value = m.value; + } break; - case eEnvModification_PrependPlatform: - case eEnvModification_PrependSemiColon: - if(!value.empty()) - value = m.value + ";" + value; - else - value = m.value; - break; - default: RDCERR("Unexpected environment modification type"); + } } setenv(m.name.c_str(), value.c_str(), true); @@ -513,17 +513,17 @@ uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workin } } + modifications.push_back(EnvironmentModification(EnvMod::Append, EnvSep::Platform, + "LD_LIBRARY_PATH", binpath.c_str())); + modifications.push_back(EnvironmentModification(EnvMod::Append, EnvSep::Platform, + "LD_LIBRARY_PATH", libpath.c_str())); modifications.push_back( - EnvironmentModification(eEnvModification_AppendPlatform, "LD_LIBRARY_PATH", binpath.c_str())); + EnvironmentModification(EnvMod::Append, EnvSep::Platform, "LD_PRELOAD", "librenderdoc.so")); modifications.push_back( - EnvironmentModification(eEnvModification_AppendPlatform, "LD_LIBRARY_PATH", libpath.c_str())); + EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_LOGFILE", logfile)); modifications.push_back( - EnvironmentModification(eEnvModification_AppendPlatform, "LD_PRELOAD", "librenderdoc.so")); - modifications.push_back( - EnvironmentModification(eEnvModification_Replace, "RENDERDOC_LOGFILE", logfile)); - modifications.push_back( - EnvironmentModification(eEnvModification_Replace, "RENDERDOC_CAPTUREOPTS", optstr.c_str())); - modifications.push_back(EnvironmentModification(eEnvModification_Replace, + EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_CAPTUREOPTS", optstr.c_str())); + modifications.push_back(EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_DEBUG_LOG_FILE", RDCGETLOGFILE())); for(size_t i = 0; i < modifications.size(); i++) @@ -532,36 +532,36 @@ uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workin string &value = env[m.name]; - switch(m.type) + switch(m.mod) { - case eEnvModification_Replace: value = m.value; break; - case eEnvModification_Append: value += m.value; break; - case eEnvModification_AppendPlatform: - case eEnvModification_AppendColon: + case EnvMod::Set: value = m.value; break; + case EnvMod::Append: + { if(!value.empty()) - value += ":"; + { + if(m.sep == EnvSep::Platform || m.sep == EnvSep::Colon) + value += ":"; + else if(m.sep == EnvSep::SemiColon) + value += ";"; + } value += m.value; break; - case eEnvModification_AppendSemiColon: + } + case EnvMod::Prepend: + { if(!value.empty()) - value += ";"; - value += m.value; - break; - case eEnvModification_Prepend: value = m.value + value; break; - case eEnvModification_PrependColon: - if(!value.empty()) - value = m.value + ":" + value; + { + if(m.sep == EnvSep::Platform || m.sep == EnvSep::Colon) + value += ":"; + else if(m.sep == EnvSep::SemiColon) + value += ";"; + } else + { value = m.value; + } break; - case eEnvModification_PrependPlatform: - case eEnvModification_PrependSemiColon: - if(!value.empty()) - value = m.value + ";" + value; - else - value = m.value; - break; - default: RDCERR("Unexpected environment modification type"); + } } } diff --git a/renderdoc/os/posix/posix_stringio.cpp b/renderdoc/os/posix/posix_stringio.cpp index 67c57e8c7..ad250eac6 100644 --- a/renderdoc/os/posix/posix_stringio.cpp +++ b/renderdoc/os/posix/posix_stringio.cpp @@ -259,12 +259,12 @@ vector GetFilesInDirectory(const char *path) if(d == NULL) { - uint32_t flags = eFileProp_ErrorUnknown; + FileProperty flags = FileProperty::ErrorUnknown; if(errno == ENOENT) - flags = eFileProp_ErrorInvalidPath; + flags = FileProperty::ErrorInvalidPath; else if(errno == EACCES) - flags = eFileProp_ErrorAccessDenied; + flags = FileProperty::ErrorAccessDenied; ret.push_back(FoundFile(path, flags)); return ret; @@ -294,16 +294,16 @@ vector GetFilesInDirectory(const char *path) if(res != 0) continue; - uint32_t flags = 0; + FileProperty flags = FileProperty::NoFlags; // make directory/executable mutually exclusive for clarity's sake if(S_ISDIR(st.st_mode)) - flags |= eFileProp_Directory; + flags |= FileProperty::Directory; else if(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) - flags |= eFileProp_Executable; + flags |= FileProperty::Executable; if(ent->d_name[0] == '.') - flags |= eFileProp_Hidden; + flags |= FileProperty::Hidden; FoundFile f(ent->d_name, flags); diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index 4d2b9da2b..af563292d 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -114,36 +114,36 @@ void Process::ApplyEnvironmentModification() name = lowername; } - switch(m.type) + switch(m.mod) { - case eEnvModification_Replace: value = m.value; break; - case eEnvModification_Append: value += m.value; break; - case eEnvModification_AppendColon: + case EnvMod::Set: value = m.value; break; + case EnvMod::Append: + { if(!value.empty()) - value += ":"; + { + if(m.sep == EnvSep::Platform || m.sep == EnvSep::SemiColon) + value += ";"; + else if(m.sep == EnvSep::Colon) + value += ":"; + } value += m.value; break; - case eEnvModification_AppendPlatform: - case eEnvModification_AppendSemiColon: + } + case EnvMod::Prepend: + { if(!value.empty()) - value += ";"; - value += m.value; - break; - case eEnvModification_Prepend: value = m.value + value; break; - case eEnvModification_PrependColon: - if(!value.empty()) - value = m.value + ":" + value; + { + if(m.sep == EnvSep::Platform || m.sep == EnvSep::SemiColon) + value += ";"; + else if(m.sep == EnvSep::Colon) + value += ":"; + } else + { value = m.value; + } break; - case eEnvModification_PrependPlatform: - case eEnvModification_PrependSemiColon: - if(!value.empty()) - value = m.value + ";" + value; - else - value = m.value; - break; - default: RDCERR("Unexpected environment modification type"); + } } SetEnvironmentVariableW(name.c_str(), StringFormat::UTF82Wide(value).c_str()); @@ -186,11 +186,17 @@ extern "C" __declspec(dllexport) void __cdecl INTERNAL_EnvModValue(const char *v tempEnvMod.value = value; } -extern "C" __declspec(dllexport) void __cdecl INTERNAL_EnvMod(Process::ModificationType *type) +extern "C" __declspec(dllexport) void __cdecl INTERNAL_EnvSep(EnvSep *sep) { - if(type) + if(sep) + tempEnvMod.sep = *sep; +} + +extern "C" __declspec(dllexport) void __cdecl INTERNAL_EnvMod(EnvMod *mod) +{ + if(mod) { - tempEnvMod.type = *type; + tempEnvMod.mod = *mod; Process::RegisterEnvironmentModification(tempEnvMod); } } @@ -759,29 +765,30 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, { string name = trim(env->name); string value = env->value; - ModificationType type = env->type; if(name == "") break; cmdWithEnv += L" +env-"; - switch(type) + switch(env->mod) { - case eEnvModification_Replace: cmdWithEnv += L"replace "; break; - - case eEnvModification_AppendPlatform: cmdWithEnv += L"append-platform "; break; - - case eEnvModification_AppendSemiColon: cmdWithEnv += L"append-semicolon "; break; - case eEnvModification_AppendColon: cmdWithEnv += L"append-colon "; break; - case eEnvModification_Append: cmdWithEnv += L"append "; break; - - case eEnvModification_PrependPlatform: cmdWithEnv += L"prepend-platform "; break; - - case eEnvModification_PrependSemiColon: cmdWithEnv += L"prepend-semicolon "; break; - case eEnvModification_PrependColon: cmdWithEnv += L"prepend-colon "; break; - case eEnvModification_Prepend: cmdWithEnv += L"prepend "; break; + case EnvMod::Set: cmdWithEnv += L"replace"; break; + case EnvMod::Append: cmdWithEnv += L"append"; break; + case EnvMod::Prepend: cmdWithEnv += L"prepend"; break; } + if(env->mod != EnvMod::Set) + { + switch(env->sep) + { + case EnvSep::Platform: cmdWithEnv += L"-platform"; break; + case EnvSep::SemiColon: cmdWithEnv += L"-semicolon"; break; + case EnvSep::Colon: cmdWithEnv += L"-colon"; break; + } + } + + cmdWithEnv += L" "; + // escape the parameters for(auto it = name.begin(); it != name.end(); ++it) { @@ -874,7 +881,8 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, { string name = trim(env->name); string value = env->value; - ModificationType type = env->type; + EnvMod mod = env->mod; + EnvSep sep = env->sep; if(name == "") break; @@ -883,7 +891,8 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, name.size() + 1); InjectFunctionCall(hProcess, loc, "INTERNAL_EnvModValue", (void *)value.c_str(), value.size() + 1); - InjectFunctionCall(hProcess, loc, "INTERNAL_EnvMod", &type, sizeof(type)); + InjectFunctionCall(hProcess, loc, "INTERNAL_EnvSep", &sep, sizeof(sep)); + InjectFunctionCall(hProcess, loc, "INTERNAL_EnvMod", &mod, sizeof(mod)); env++; } diff --git a/renderdoc/os/win32/win32_stringio.cpp b/renderdoc/os/win32/win32_stringio.cpp index 0142dc1aa..864acc62d 100644 --- a/renderdoc/os/win32/win32_stringio.cpp +++ b/renderdoc/os/win32/win32_stringio.cpp @@ -364,7 +364,7 @@ vector GetFilesInDirectory(const char *path) string fn = "A:/"; fn[0] = char('A' + i); - ret.push_back(FoundFile(fn, eFileProp_Directory)); + ret.push_back(FoundFile(fn, FileProperty::Directory)); } } @@ -394,12 +394,12 @@ vector GetFilesInDirectory(const char *path) { DWORD err = GetLastError(); - uint32_t flags = eFileProp_ErrorUnknown; + FileProperty flags = FileProperty::ErrorUnknown; if(err == ERROR_FILE_NOT_FOUND) - flags = eFileProp_ErrorInvalidPath; + flags = FileProperty::ErrorInvalidPath; else if(err == ERROR_ACCESS_DENIED) - flags = eFileProp_ErrorAccessDenied; + flags = FileProperty::ErrorAccessDenied; ret.push_back(FoundFile(path, flags)); return ret; @@ -418,18 +418,18 @@ vector GetFilesInDirectory(const char *path) } else { - uint32_t flags = 0; + FileProperty flags = FileProperty::NoFlags; if(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - flags |= eFileProp_Directory; + flags |= FileProperty::Directory; if(findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) - flags |= eFileProp_Hidden; + flags |= FileProperty::Hidden; if(wcsstr(findData.cFileName, L".EXE") || wcsstr(findData.cFileName, L".exe") || wcsstr(findData.cFileName, L".Exe")) { - flags |= eFileProp_Executable; + flags |= FileProperty::Executable; } FoundFile f(StringFormat::Wide2UTF8(findData.cFileName), flags); diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 8e2126dd2..395e7300f 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -40,63 +40,63 @@ // these entry points are for the replay/analysis side - not for the application. -extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_NumVerticesPerPrimitive(PrimitiveTopology topology) +extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_NumVerticesPerPrimitive(Topology topology) { // strips/loops/fans have the same number of indices for a single primitive // as their list friends switch(topology) { default: - case eTopology_Unknown: break; - case eTopology_PointList: return 1; - case eTopology_LineList: - case eTopology_LineStrip: - case eTopology_LineLoop: return 2; - case eTopology_TriangleList: - case eTopology_TriangleStrip: - case eTopology_TriangleFan: return 3; - case eTopology_LineList_Adj: - case eTopology_LineStrip_Adj: return 4; - case eTopology_TriangleList_Adj: - case eTopology_TriangleStrip_Adj: return 6; - case eTopology_PatchList_1CPs: - case eTopology_PatchList_2CPs: - case eTopology_PatchList_3CPs: - case eTopology_PatchList_4CPs: - case eTopology_PatchList_5CPs: - case eTopology_PatchList_6CPs: - case eTopology_PatchList_7CPs: - case eTopology_PatchList_8CPs: - case eTopology_PatchList_9CPs: - case eTopology_PatchList_10CPs: - case eTopology_PatchList_11CPs: - case eTopology_PatchList_12CPs: - case eTopology_PatchList_13CPs: - case eTopology_PatchList_14CPs: - case eTopology_PatchList_15CPs: - case eTopology_PatchList_16CPs: - case eTopology_PatchList_17CPs: - case eTopology_PatchList_18CPs: - case eTopology_PatchList_19CPs: - case eTopology_PatchList_20CPs: - case eTopology_PatchList_21CPs: - case eTopology_PatchList_22CPs: - case eTopology_PatchList_23CPs: - case eTopology_PatchList_24CPs: - case eTopology_PatchList_25CPs: - case eTopology_PatchList_26CPs: - case eTopology_PatchList_27CPs: - case eTopology_PatchList_28CPs: - case eTopology_PatchList_29CPs: - case eTopology_PatchList_30CPs: - case eTopology_PatchList_31CPs: - case eTopology_PatchList_32CPs: return uint32_t(topology - eTopology_PatchList_1CPs + 1); + case Topology::Unknown: break; + case Topology::PointList: return 1; + case Topology::LineList: + case Topology::LineStrip: + case Topology::LineLoop: return 2; + case Topology::TriangleList: + case Topology::TriangleStrip: + case Topology::TriangleFan: return 3; + case Topology::LineList_Adj: + case Topology::LineStrip_Adj: return 4; + case Topology::TriangleList_Adj: + case Topology::TriangleStrip_Adj: return 6; + case Topology::PatchList_1CPs: + case Topology::PatchList_2CPs: + case Topology::PatchList_3CPs: + case Topology::PatchList_4CPs: + case Topology::PatchList_5CPs: + case Topology::PatchList_6CPs: + case Topology::PatchList_7CPs: + case Topology::PatchList_8CPs: + case Topology::PatchList_9CPs: + case Topology::PatchList_10CPs: + case Topology::PatchList_11CPs: + case Topology::PatchList_12CPs: + case Topology::PatchList_13CPs: + case Topology::PatchList_14CPs: + case Topology::PatchList_15CPs: + case Topology::PatchList_16CPs: + case Topology::PatchList_17CPs: + case Topology::PatchList_18CPs: + case Topology::PatchList_19CPs: + case Topology::PatchList_20CPs: + case Topology::PatchList_21CPs: + case Topology::PatchList_22CPs: + case Topology::PatchList_23CPs: + case Topology::PatchList_24CPs: + case Topology::PatchList_25CPs: + case Topology::PatchList_26CPs: + case Topology::PatchList_27CPs: + case Topology::PatchList_28CPs: + case Topology::PatchList_29CPs: + case Topology::PatchList_30CPs: + case Topology::PatchList_31CPs: + case Topology::PatchList_32CPs: return PatchList_Count(topology); } return 0; } -extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_VertexOffset(PrimitiveTopology topology, +extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_VertexOffset(Topology topology, uint32_t primitive) { // strips/loops/fans have the same number of indices for a single primitive @@ -104,57 +104,57 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_VertexOffset(PrimitiveTo switch(topology) { default: - case eTopology_Unknown: - case eTopology_PointList: - case eTopology_LineList: - case eTopology_TriangleList: - case eTopology_LineList_Adj: - case eTopology_TriangleList_Adj: - case eTopology_PatchList_1CPs: - case eTopology_PatchList_2CPs: - case eTopology_PatchList_3CPs: - case eTopology_PatchList_4CPs: - case eTopology_PatchList_5CPs: - case eTopology_PatchList_6CPs: - case eTopology_PatchList_7CPs: - case eTopology_PatchList_8CPs: - case eTopology_PatchList_9CPs: - case eTopology_PatchList_10CPs: - case eTopology_PatchList_11CPs: - case eTopology_PatchList_12CPs: - case eTopology_PatchList_13CPs: - case eTopology_PatchList_14CPs: - case eTopology_PatchList_15CPs: - case eTopology_PatchList_16CPs: - case eTopology_PatchList_17CPs: - case eTopology_PatchList_18CPs: - case eTopology_PatchList_19CPs: - case eTopology_PatchList_20CPs: - case eTopology_PatchList_21CPs: - case eTopology_PatchList_22CPs: - case eTopology_PatchList_23CPs: - case eTopology_PatchList_24CPs: - case eTopology_PatchList_25CPs: - case eTopology_PatchList_26CPs: - case eTopology_PatchList_27CPs: - case eTopology_PatchList_28CPs: - case eTopology_PatchList_29CPs: - case eTopology_PatchList_30CPs: - case eTopology_PatchList_31CPs: - case eTopology_PatchList_32CPs: + case Topology::Unknown: + case Topology::PointList: + case Topology::LineList: + case Topology::TriangleList: + case Topology::LineList_Adj: + case Topology::TriangleList_Adj: + case Topology::PatchList_1CPs: + case Topology::PatchList_2CPs: + case Topology::PatchList_3CPs: + case Topology::PatchList_4CPs: + case Topology::PatchList_5CPs: + case Topology::PatchList_6CPs: + case Topology::PatchList_7CPs: + case Topology::PatchList_8CPs: + case Topology::PatchList_9CPs: + case Topology::PatchList_10CPs: + case Topology::PatchList_11CPs: + case Topology::PatchList_12CPs: + case Topology::PatchList_13CPs: + case Topology::PatchList_14CPs: + case Topology::PatchList_15CPs: + case Topology::PatchList_16CPs: + case Topology::PatchList_17CPs: + case Topology::PatchList_18CPs: + case Topology::PatchList_19CPs: + case Topology::PatchList_20CPs: + case Topology::PatchList_21CPs: + case Topology::PatchList_22CPs: + case Topology::PatchList_23CPs: + case Topology::PatchList_24CPs: + case Topology::PatchList_25CPs: + case Topology::PatchList_26CPs: + case Topology::PatchList_27CPs: + case Topology::PatchList_28CPs: + case Topology::PatchList_29CPs: + case Topology::PatchList_30CPs: + case Topology::PatchList_31CPs: + case Topology::PatchList_32CPs: // for all lists, it's just primitive * Topology_NumVerticesPerPrimitive(topology) break; - case eTopology_LineStrip: - case eTopology_LineLoop: - case eTopology_TriangleStrip: - case eTopology_LineStrip_Adj: + case Topology::LineStrip: + case Topology::LineLoop: + case Topology::TriangleStrip: + case Topology::LineStrip_Adj: // for strips, each new vertex creates a new primitive return primitive; - case eTopology_TriangleStrip_Adj: + case Topology::TriangleStrip_Adj: // triangle strip with adjacency is a special case as every other // vert is purely for adjacency so it's doubled return primitive * 2; - case eTopology_TriangleFan: RDCERR("Cannot get VertexOffset for triangle fan!"); break; + case Topology::TriangleFan: RDCERR("Cannot get VertexOffset for triangle fan!"); break; } return primitive * Topology_NumVerticesPerPrimitive(topology); @@ -264,19 +264,11 @@ extern "C" RENDERDOC_API void *RENDERDOC_CC RENDERDOC_MakeEnvironmentModificatio } extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetEnvironmentModification( - void *mem, int idx, const char *variable, const char *value, EnvironmentModificationType type, - EnvironmentSeparator separator) + void *mem, int idx, const char *variable, const char *value, EnvMod type, EnvSep separator) { Process::EnvironmentModification *mods = (Process::EnvironmentModification *)mem; - Process::ModificationType modType = Process::eEnvModification_Replace; - - if(type == eEnvMod_Append) - modType = Process::ModificationType(Process::eEnvModification_AppendPlatform + (int)separator); - if(type == eEnvMod_Prepend) - modType = Process::ModificationType(Process::eEnvModification_PrependPlatform + (int)separator); - - mods[idx] = Process::EnvironmentModification(modType, variable, value); + mods[idx] = Process::EnvironmentModification(type, separator, variable, value); } extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_FreeEnvironmentModificationList(void *mem) @@ -293,24 +285,21 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetDebugLogFile(const char extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogText(const char *text) { - rdclog_int(RDCLog_Comment, "EXT", "external", 0, "%s", text); + rdclog_int(LogType::Comment, "EXT", "external", 0, "%s", text); } -extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogMessage(LogMessageType type, - const char *project, const char *file, - unsigned int line, const char *text) +extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogMessage(LogType type, const char *project, + const char *file, unsigned int line, + const char *text) { - RDCCOMPILE_ASSERT( - (int)eLogType_First == (int)RDCLog_First && (int)eLogType_NumTypes == (int)eLogType_NumTypes, - "Log type enum is out of sync"); - rdclog_int((LogType)type, project ? project : "UNK?", file ? file : "unknown", line, "%s", text); + rdclog_int(type, project ? project : "UNK?", file ? file : "unknown", line, "%s", text); #if ENABLED(DEBUGBREAK_ON_ERROR_LOG) - if(type == eLogType_Error) + if(type == LogType::Error) RDCBREAK(); #endif - if(type == eLogType_Fatal) + if(type == LogType::Fatal) RDCDUMP(); } @@ -349,7 +338,7 @@ extern "C" RENDERDOC_API ReplaySupport RENDERDOC_CC RENDERDOC_SupportLocalReplay const char *logfile, rdctype::str *driver, rdctype::str *recordMachineIdent) { if(logfile == NULL) - return eReplaySupport_Unsupported; + return ReplaySupport::Unsupported; RDCDriver driverType = RDC_Unknown; string driverName = ""; @@ -362,7 +351,7 @@ extern "C" RENDERDOC_API ReplaySupport RENDERDOC_CC RENDERDOC_SupportLocalReplay bool supported = RenderDoc::Inst().HasReplayDriver(driverType); if(!supported) - return eReplaySupport_Unsupported; + return ReplaySupport::Unsupported; if(fileMachineIdent != 0) { @@ -373,17 +362,17 @@ extern "C" RENDERDOC_API ReplaySupport RENDERDOC_CC RENDERDOC_SupportLocalReplay if((machineIdent & OSUtility::MachineIdent_OS_Mask) != (fileMachineIdent & OSUtility::MachineIdent_OS_Mask)) - return eReplaySupport_SuggestRemote; + return ReplaySupport::SuggestRemote; } - return eReplaySupport_Supported; + return ReplaySupport::Supported; } -extern "C" RENDERDOC_API ReplayCreateStatus RENDERDOC_CC +extern "C" RENDERDOC_API ReplayStatus RENDERDOC_CC RENDERDOC_CreateReplayRenderer(const char *logfile, float *progress, IReplayRenderer **rend) { if(rend == NULL) - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; RenderDoc::Inst().SetProgressPtr(progress); @@ -392,12 +381,12 @@ RENDERDOC_CreateReplayRenderer(const char *logfile, float *progress, IReplayRend if(!render) { RenderDoc::Inst().SetProgressPtr(NULL); - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; } - ReplayCreateStatus ret = render->CreateDevice(logfile); + ReplayStatus ret = render->CreateDevice(logfile); - if(ret != eReplayCreate_Success) + if(ret != ReplayStatus::Succeeded) { delete render; RenderDoc::Inst().SetProgressPtr(NULL); @@ -407,7 +396,7 @@ RENDERDOC_CreateReplayRenderer(const char *logfile, float *progress, IReplayRend *rend = render; RenderDoc::Inst().SetProgressPtr(NULL); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } extern "C" RENDERDOC_API uint32_t RENDERDOC_CC @@ -482,7 +471,7 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC RENDERDOC_GetThumbnail(const char * // if the desired output is jpg and either there's no max size or it's already satisfied, // return the data directly - if(type == eFileType_JPG && (maxsize == 0 || (maxsize > thumbwidth && maxsize > thumbheight))) + if(type == FileType::JPG && (maxsize == 0 || (maxsize > thumbwidth && maxsize > thumbheight))) { create_array_init(*buf, thumblen, jpgbuf); } @@ -529,7 +518,7 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC RENDERDOC_GetThumbnail(const char * switch(type) { - case eFileType_JPG: + case FileType::JPG: { int len = thumbwidth * thumbheight * 3; encodedBytes.resize(len); @@ -540,19 +529,19 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC RENDERDOC_GetThumbnail(const char * encodedBytes.resize(len); break; } - case eFileType_PNG: + case FileType::PNG: { stbi_write_png_to_func(&writeToByteVector, &encodedBytes, (int)thumbwidth, (int)thumbheight, 3, thumbpixels, 0); break; } - case eFileType_TGA: + case FileType::TGA: { stbi_write_tga_to_func(&writeToByteVector, &encodedBytes, (int)thumbwidth, (int)thumbheight, 3, thumbpixels); break; } - case eFileType_BMP: + case FileType::BMP: { stbi_write_bmp_to_func(&writeToByteVector, &encodedBytes, (int)thumbwidth, (int)thumbheight, 3, thumbpixels); @@ -799,11 +788,11 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartAndroidRemoteServer() "shell am start -n org.renderdoc.renderdoccmd/.Loader -e renderdoccmd remoteserver"); } -extern "C" RENDERDOC_API bool RENDERDOC_CC -RENDERDOC_NeedVulkanLayerRegistration(uint32_t *flagsPtr, rdctype::array *myJSONsPtr, - rdctype::array *otherJSONsPtr) +extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_NeedVulkanLayerRegistration( + VulkanLayerFlags *flagsPtr, rdctype::array *myJSONsPtr, + rdctype::array *otherJSONsPtr) { - uint32_t flags = 0; + VulkanLayerFlags flags = VulkanLayerFlags::NoFlags; std::vector myJSONs; std::vector otherJSONs; diff --git a/renderdoc/replay/replay_driver.h b/renderdoc/replay/replay_driver.h index 92e2e8b0c..f87e39066 100644 --- a/renderdoc/replay/replay_driver.h +++ b/renderdoc/replay/replay_driver.h @@ -49,7 +49,7 @@ enum RemapTextureEnum struct GetTextureDataParams { bool forDiskSave; - FormatComponentType typeHint; + CompType typeHint; bool resolve; RemapTextureEnum remap; float blackPoint; @@ -57,7 +57,7 @@ struct GetTextureDataParams GetTextureDataParams() : forDiskSave(false), - typeHint(eCompType_None), + typeHint(CompType::Typeless), resolve(false), remap(eRemap_None), blackPoint(0.0f), @@ -121,22 +121,21 @@ public: const GetTextureDataParams ¶ms, size_t &dataSize) = 0; virtual void BuildTargetShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) = 0; + ShaderStage type, ResourceId *id, string *errors) = 0; virtual void ReplaceResource(ResourceId from, ResourceId to) = 0; virtual void RemoveReplacement(ResourceId id) = 0; virtual void FreeTargetResource(ResourceId id) = 0; - virtual vector EnumerateCounters() = 0; - virtual void DescribeCounter(uint32_t counterID, CounterDescription &desc) = 0; - virtual vector FetchCounters(const vector &counterID) = 0; + virtual vector EnumerateCounters() = 0; + virtual void DescribeCounter(GPUCounter counterID, CounterDescription &desc) = 0; + virtual vector FetchCounters(const vector &counterID) = 0; virtual void FillCBufferVariables(ResourceId shader, string entryPoint, uint32_t cbufSlot, vector &outvars, const vector &data) = 0; virtual vector PixelHistory(vector events, ResourceId target, - uint32_t x, uint32_t y, uint32_t slice, - uint32_t mip, uint32_t sampleIdx, - FormatComponentType typeHint) = 0; + uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, + uint32_t sampleIdx, CompType typeHint) = 0; virtual ShaderDebugTrace DebugVertex(uint32_t eventID, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset) = 0; virtual ShaderDebugTrace DebugPixel(uint32_t eventID, uint32_t x, uint32_t y, uint32_t sample, @@ -144,9 +143,8 @@ public: virtual ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]) = 0; - virtual ResourceId RenderOverlay(ResourceId texid, FormatComponentType typeHint, - TextureDisplayOverlay overlay, uint32_t eventID, - const vector &passEvents) = 0; + virtual ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay, + uint32_t eventID, const vector &passEvents) = 0; virtual bool IsRenderOutput(ResourceId id) = 0; @@ -175,10 +173,10 @@ public: virtual void FlipOutputWindow(uint64_t id) = 0; virtual bool GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float *minval, float *maxval) = 0; + CompType typeHint, float *minval, float *maxval) = 0; virtual bool GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, - FormatComponentType typeHint, float minval, float maxval, - bool channels[4], vector &histogram) = 0; + CompType typeHint, float minval, float maxval, bool channels[4], + vector &histogram) = 0; virtual ResourceId CreateProxyTexture(const FetchTexture &templateTex) = 0; virtual void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data, @@ -193,18 +191,17 @@ public: virtual bool RenderTexture(TextureDisplay cfg) = 0; virtual void BuildCustomShader(string source, string entry, const uint32_t compileFlags, - ShaderStageType type, ResourceId *id, string *errors) = 0; + ShaderStage type, ResourceId *id, string *errors) = 0; virtual ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, - uint32_t arrayIdx, uint32_t sampleIdx, - FormatComponentType typeHint) = 0; + uint32_t arrayIdx, uint32_t sampleIdx, CompType typeHint) = 0; virtual void FreeCustomShader(ResourceId id) = 0; virtual void RenderCheckerboard(Vec3f light, Vec3f dark) = 0; virtual void RenderHighlightBox(float w, float h, float scale) = 0; - virtual void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, - uint32_t sample, FormatComponentType typeHint, float pixel[4]) = 0; + virtual void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, + uint32_t mip, uint32_t sample, CompType typeHint, float pixel[4]) = 0; virtual uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y) = 0; }; @@ -233,7 +230,8 @@ FetchDrawcall *SetupDrawcallPointers(vector *drawcallTable, ret = previous = SetupDrawcallPointers(drawcallTable, draw->children, draw, previous); } - else if(draw->flags & (eDraw_PushMarker | eDraw_SetMarker | eDraw_Present | eDraw_MultiDraw)) + else if(draw->flags & (DrawFlags::PushMarker | DrawFlags::SetMarker | DrawFlags::Present | + DrawFlags::MultiDraw)) { // don't want to set up previous/next links for markers, but still add them to the table diff --git a/renderdoc/replay/replay_output.cpp b/renderdoc/replay/replay_output.cpp index 95e1e4a77..299117a58 100644 --- a/renderdoc/replay/replay_output.cpp +++ b/renderdoc/replay/replay_output.cpp @@ -32,7 +32,7 @@ static uint64_t GetHandle(WindowingSystem system, void *data) { #if ENABLED(RDOC_LINUX) - if(system == eWindowingSystem_Xlib) + if(system == WindowingSystem::Xlib) { #if ENABLED(RDOC_XLIB) return (uint64_t)((XlibWindowData *)data)->window; @@ -41,7 +41,7 @@ static uint64_t GetHandle(WindowingSystem system, void *data) #endif } - if(system == eWindowingSystem_XCB) + if(system == WindowingSystem::XCB) { #if ENABLED(RDOC_XCB) return (uint64_t)((XCBWindowData *)data)->window; @@ -56,12 +56,12 @@ static uint64_t GetHandle(WindowingSystem system, void *data) #elif ENABLED(RDOC_WIN32) - RDCASSERT(system == eWindowingSystem_Win32); + RDCASSERT(system == WindowingSystem::Win32); return (uint64_t)data; // HWND #elif ENABLED(RDOC_ANDROID) - RDCASSERT(system == eWindowingSystem_Android); + RDCASSERT(system == WindowingSystem::Android); return (uint64_t)data; // ANativeWindow * #else @@ -69,7 +69,8 @@ static uint64_t GetHandle(WindowingSystem system, void *data) #endif } -ReplayOutput::ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void *data, OutputType type) +ReplayOutput::ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void *data, + ReplayOutputType type) { m_pRenderer = parent; @@ -93,11 +94,10 @@ ReplayOutput::ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void m_ContextX = -1.0f; m_ContextY = -1.0f; - m_Config.m_Type = type; + m_Type = type; - if(system != eWindowingSystem_Unknown) - m_MainOutput.outputID = - m_pDevice->MakeOutputWindow(system, data, type == eOutputType_MeshDisplay); + if(system != WindowingSystem::Unknown) + m_MainOutput.outputID = m_pDevice->MakeOutputWindow(system, data, type == ReplayOutputType::Mesh); else m_MainOutput.outputID = 0; m_MainOutput.texture = ResourceId(); @@ -117,20 +117,12 @@ ReplayOutput::~ReplayOutput() ClearThumbnails(); } -bool ReplayOutput::SetOutputConfig(const OutputConfig &o) -{ - m_OverlayDirty = true; - m_Config = o; - m_MainOutput.dirty = true; - return true; -} - bool ReplayOutput::SetTextureDisplay(const TextureDisplay &o) { if(o.overlay != m_RenderData.texDisplay.overlay) { - if(m_RenderData.texDisplay.overlay == eTexOverlay_ClearBeforeDraw || - m_RenderData.texDisplay.overlay == eTexOverlay_ClearBeforePass) + if(m_RenderData.texDisplay.overlay == DebugOverlay::ClearBeforeDraw || + m_RenderData.texDisplay.overlay == DebugOverlay::ClearBeforePass) { // by necessity these overlays modify the actual texture, not an // independent overlay texture. So if we disable them, we must @@ -175,25 +167,25 @@ void ReplayOutput::RefreshOverlay() bool postVSBuffers = false; bool postVSWholePass = false; - if(m_Config.m_Type == eOutputType_MeshDisplay && m_OverlayDirty) + if(m_Type == ReplayOutputType::Mesh && m_OverlayDirty) { postVSBuffers = true; postVSWholePass = m_RenderData.meshDisplay.showWholePass != 0; } - if(m_Config.m_Type == eOutputType_TexDisplay) + if(m_Type == ReplayOutputType::Texture) { - postVSBuffers = m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizePass || - m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizeDraw; - postVSWholePass = m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizePass; + postVSBuffers = m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizePass || + m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizeDraw; + postVSWholePass = m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizePass; } if(postVSBuffers) { - if(m_Config.m_Type == eOutputType_MeshDisplay) + if(m_Type == ReplayOutputType::Mesh) m_OverlayDirty = false; - if(draw != NULL && (draw->flags & eDraw_Drawcall)) + if(draw != NULL && (draw->flags & DrawFlags::Drawcall)) { m_pDevice->InitPostVSBuffers(draw->eventID); @@ -206,7 +198,7 @@ void ReplayOutput::RefreshOverlay() } } - if(m_Config.m_Type == eOutputType_TexDisplay && m_RenderData.texDisplay.overlay != eTexOverlay_None) + if(m_Type == ReplayOutputType::Texture && m_RenderData.texDisplay.overlay != DebugOverlay::NoOverlay) { if(draw && m_pDevice->IsRenderOutput(m_RenderData.texDisplay.texid)) { @@ -244,7 +236,7 @@ bool ReplayOutput::SetPixelContext(WindowingSystem system, void *data) } bool ReplayOutput::AddThumbnail(WindowingSystem system, void *data, ResourceId texID, - FormatComponentType typeHint) + CompType typeHint) { OutputPair p; @@ -256,8 +248,8 @@ bool ReplayOutput::AddThumbnail(WindowingSystem system, void *data, ResourceId t { if(m_pRenderer->m_Textures[t].ID == texID) { - depthMode = (m_pRenderer->m_Textures[t].creationFlags & eTextureCreate_DSV) > 0; - depthMode |= (m_pRenderer->m_Textures[t].format.compType == eCompType_Depth); + depthMode = (m_pRenderer->m_Textures[t].creationFlags & TextureCategory::DepthTarget) || + (m_pRenderer->m_Textures[t].format.compType == CompType::Depth); break; } } @@ -306,7 +298,7 @@ bool ReplayOutput::GetMinMax(PixelValue *minval, PixelValue *maxval) ResourceId tex = m_pDevice->GetLiveID(m_RenderData.texDisplay.texid); - FormatComponentType typeHint = m_RenderData.texDisplay.typeHint; + CompType typeHint = m_RenderData.texDisplay.typeHint; uint32_t slice = m_RenderData.texDisplay.sliceFace; uint32_t mip = m_RenderData.texDisplay.mip; uint32_t sample = m_RenderData.texDisplay.sampleIdx; @@ -314,7 +306,7 @@ bool ReplayOutput::GetMinMax(PixelValue *minval, PixelValue *maxval) if(m_RenderData.texDisplay.CustomShader != ResourceId() && m_CustomShaderResourceId != ResourceId()) { tex = m_CustomShaderResourceId; - typeHint = eCompType_None; + typeHint = CompType::Typeless; slice = 0; sample = 0; } @@ -332,7 +324,7 @@ bool ReplayOutput::GetHistogram(float minval, float maxval, bool channels[4], ResourceId tex = m_pDevice->GetLiveID(m_RenderData.texDisplay.texid); - FormatComponentType typeHint = m_RenderData.texDisplay.typeHint; + CompType typeHint = m_RenderData.texDisplay.typeHint; uint32_t slice = m_RenderData.texDisplay.sliceFace; uint32_t mip = m_RenderData.texDisplay.mip; uint32_t sample = m_RenderData.texDisplay.sampleIdx; @@ -340,7 +332,7 @@ bool ReplayOutput::GetHistogram(float minval, float maxval, bool channels[4], if(m_RenderData.texDisplay.CustomShader != ResourceId() && m_CustomShaderResourceId != ResourceId()) { tex = m_CustomShaderResourceId; - typeHint = eCompType_None; + typeHint = CompType::Typeless; slice = 0; sample = 0; } @@ -364,23 +356,23 @@ bool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint bool decodeRamp = false; - FormatComponentType typeHint = m_RenderData.texDisplay.typeHint; + CompType typeHint = m_RenderData.texDisplay.typeHint; if(customShader && m_RenderData.texDisplay.CustomShader != ResourceId() && m_CustomShaderResourceId != ResourceId()) { tex = m_CustomShaderResourceId; - typeHint = eCompType_None; + typeHint = CompType::Typeless; } - if((m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawDraw || - m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawPass || - m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizeDraw || - m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizePass) && + if((m_RenderData.texDisplay.overlay == DebugOverlay::QuadOverdrawDraw || + m_RenderData.texDisplay.overlay == DebugOverlay::QuadOverdrawPass || + m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizeDraw || + m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizePass) && m_OverlayResourceId != ResourceId()) { decodeRamp = true; tex = m_OverlayResourceId; - typeHint = eCompType_None; + typeHint = CompType::Typeless; } m_pDevice->PickPixel(m_pDevice->GetLiveID(tex), x, y, sliceFace, mip, sample, typeHint, @@ -403,8 +395,8 @@ bool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint } // decode back into approximate pixel size area - if(m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizePass || - m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizeDraw) + if(m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizePass || + m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizeDraw) { float bucket = (float)ret->value_i[0]; @@ -427,9 +419,9 @@ uint32_t ReplayOutput::PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint if(!draw) return ~0U; - if(m_RenderData.meshDisplay.type == eMeshDataStage_Unknown) + if(m_RenderData.meshDisplay.type == MeshDataStage::Unknown) return ~0U; - if((draw->flags & eDraw_Drawcall) == 0) + if(!(draw->flags & DrawFlags::Drawcall)) return ~0U; MeshDisplay cfg = m_RenderData.meshDisplay; @@ -446,7 +438,7 @@ uint32_t ReplayOutput::PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint // input data either doesn't vary with instance, or is trivial (all verts the same for that // element), so only care about fetching the right instance for post-VS stages - if((draw->flags & eDraw_Instanced) && m_RenderData.meshDisplay.type != eMeshDataStage_VSIn) + if((draw->flags & DrawFlags::Instanced) && m_RenderData.meshDisplay.type != MeshDataStage::VSIn) { // if no special options are enabled, just look at the current instance uint32_t firstInst = m_RenderData.meshDisplay.curInstance; @@ -518,7 +510,7 @@ void ReplayOutput::DisplayContext() float color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; m_pDevice->BindOutputWindow(m_PixelContext.outputID, false); - if((m_Config.m_Type != eOutputType_TexDisplay) || (m_ContextX < 0.0f && m_ContextY < 0.0f) || + if((m_Type != ReplayOutputType::Texture) || (m_ContextX < 0.0f && m_ContextY < 0.0f) || (m_RenderData.texDisplay.texid == ResourceId())) { m_pDevice->RenderCheckerboard(Vec3f(0.81f, 0.81f, 0.81f), Vec3f(0.57f, 0.57f, 0.57f)); @@ -535,10 +527,10 @@ void ReplayOutput::DisplayContext() if(m_RenderData.texDisplay.CustomShader != ResourceId()) disp.texid = m_CustomShaderResourceId; - if((m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawDraw || - m_RenderData.texDisplay.overlay == eTexOverlay_QuadOverdrawPass || - m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizeDraw || - m_RenderData.texDisplay.overlay == eTexOverlay_TriangleSizePass) && + if((m_RenderData.texDisplay.overlay == DebugOverlay::QuadOverdrawDraw || + m_RenderData.texDisplay.overlay == DebugOverlay::QuadOverdrawPass || + m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizeDraw || + m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizePass) && m_OverlayResourceId != ResourceId()) disp.texid = m_OverlayResourceId; @@ -636,11 +628,11 @@ bool ReplayOutput::Display() disp.offx = 0.0f; disp.offy = 0.0f; disp.rawoutput = false; - disp.overlay = eTexOverlay_None; + disp.overlay = DebugOverlay::NoOverlay; disp.lightBackgroundColour = disp.darkBackgroundColour = FloatVector(); - if(m_Thumbnails[i].typeHint == eCompType_SNorm) + if(m_Thumbnails[i].typeHint == CompType::SNorm) disp.rangemin = -1.0f; if(m_Thumbnails[i].depthMode) @@ -667,11 +659,11 @@ bool ReplayOutput::Display() m_MainOutput.dirty = false; - switch(m_Config.m_Type) + switch(m_Type) { - case eOutputType_MeshDisplay: DisplayMesh(); break; - case eOutputType_TexDisplay: DisplayTex(); break; - default: RDCERR("Unexpected display type! %d", m_Config.m_Type); break; + case ReplayOutputType::Mesh: DisplayMesh(); break; + case ReplayOutputType::Texture: DisplayTex(); break; + default: RDCERR("Unexpected display type! %d", m_Type); break; } m_pDevice->FlipOutputWindow(m_MainOutput.outputID); @@ -701,7 +693,7 @@ void ReplayOutput::DisplayTex() texDisplay.rawoutput = false; texDisplay.texid = m_pDevice->GetLiveID(texDisplay.texid); - if(m_RenderData.texDisplay.overlay != eTexOverlay_None && draw) + if(m_RenderData.texDisplay.overlay != DebugOverlay::NoOverlay && draw) { if(m_OverlayDirty) { @@ -723,7 +715,7 @@ void ReplayOutput::DisplayTex() texDisplay.sliceFace, texDisplay.sampleIdx, texDisplay.typeHint); texDisplay.texid = m_pDevice->GetLiveID(m_CustomShaderResourceId); - texDisplay.typeHint = eCompType_None; + texDisplay.typeHint = CompType::Typeless; texDisplay.CustomShader = ResourceId(); texDisplay.sliceFace = 0; } @@ -741,10 +733,10 @@ void ReplayOutput::DisplayTex() m_pDevice->RenderTexture(texDisplay); - if(m_RenderData.texDisplay.overlay != eTexOverlay_None && draw && + if(m_RenderData.texDisplay.overlay != DebugOverlay::NoOverlay && draw && m_pDevice->IsRenderOutput(m_RenderData.texDisplay.texid) && - m_RenderData.texDisplay.overlay != eTexOverlay_NaN && - m_RenderData.texDisplay.overlay != eTexOverlay_Clipping) + m_RenderData.texDisplay.overlay != DebugOverlay::NaN && + m_RenderData.texDisplay.overlay != DebugOverlay::Clipping) { RDCASSERT(m_OverlayResourceId != ResourceId()); texDisplay.texid = m_pDevice->GetLiveID(m_OverlayResourceId); @@ -766,7 +758,8 @@ void ReplayOutput::DisplayMesh() FetchDrawcall *draw = m_pRenderer->GetDrawcallByEID(m_EventID); if(draw == NULL || m_MainOutput.outputID == 0 || m_Width <= 0 || m_Height <= 0 || - (m_RenderData.meshDisplay.type == eMeshDataStage_Unknown) || (draw->flags & eDraw_Drawcall) == 0) + (m_RenderData.meshDisplay.type == MeshDataStage::Unknown) || + !(draw->flags & DrawFlags::Drawcall)) { float color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; m_pDevice->BindOutputWindow(m_MainOutput.outputID, false); @@ -813,7 +806,7 @@ void ReplayOutput::DisplayMesh() // lighter grey with blue tinge to contrast from main/instance draws const FloatVector passDraws(0.2f, 0.2f, 0.25f, 1.0f); - if(m_RenderData.meshDisplay.type != eMeshDataStage_VSIn) + if(m_RenderData.meshDisplay.type != MeshDataStage::VSIn) { for(size_t i = 0; m_RenderData.meshDisplay.showWholePass && i < passEvents.size(); i++) { @@ -824,9 +817,9 @@ void ReplayOutput::DisplayMesh() for(uint32_t inst = 0; inst < RDCMAX(1U, draw->numInstances); inst++) { // get the 'most final' stage - MeshFormat fmt = m_pDevice->GetPostVSBuffers(passEvents[i], inst, eMeshDataStage_GSOut); + MeshFormat fmt = m_pDevice->GetPostVSBuffers(passEvents[i], inst, MeshDataStage::GSOut); if(fmt.buf == ResourceId()) - fmt = m_pDevice->GetPostVSBuffers(passEvents[i], inst, eMeshDataStage_VSOut); + fmt = m_pDevice->GetPostVSBuffers(passEvents[i], inst, MeshDataStage::VSOut); fmt.meshColour = passDraws; @@ -838,7 +831,7 @@ void ReplayOutput::DisplayMesh() } // draw previous instances in the current drawcall - if(draw->flags & eDraw_Instanced) + if(draw->flags & DrawFlags::Instanced) { uint32_t maxInst = 0; if(m_RenderData.meshDisplay.showPrevInstances) @@ -849,9 +842,9 @@ void ReplayOutput::DisplayMesh() for(uint32_t inst = 0; inst < maxInst; inst++) { // get the 'most final' stage - MeshFormat fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, eMeshDataStage_GSOut); + MeshFormat fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, MeshDataStage::GSOut); if(fmt.buf == ResourceId()) - fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, eMeshDataStage_VSOut); + fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, MeshDataStage::VSOut); fmt.meshColour = otherInstances; @@ -867,11 +860,6 @@ void ReplayOutput::DisplayMesh() m_pDevice->RenderMesh(m_EventID, secondaryDraws, mesh); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetOutputConfig(IReplayOutput *output, - const OutputConfig &o) -{ - return output->SetOutputConfig(o); -} extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetTextureDisplay(IReplayOutput *output, const TextureDisplay &o) { @@ -890,7 +878,7 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_ClearThumbnails(IRepla extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_AddThumbnail(IReplayOutput *output, WindowingSystem system, void *data, ResourceId texID, - FormatComponentType typeHint) + CompType typeHint) { return output->AddThumbnail(system, data, texID, typeHint); } diff --git a/renderdoc/replay/replay_renderer.cpp b/renderdoc/replay/replay_renderer.cpp index e9f92a1ea..acc57de6d 100644 --- a/renderdoc/replay/replay_renderer.cpp +++ b/renderdoc/replay/replay_renderer.cpp @@ -44,15 +44,15 @@ float ConvertComponent(const ResourceFormat &fmt, byte *data) uint32_t *u32 = (uint32_t *)data; int32_t *i32 = (int32_t *)data; - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) { return *(float *)u32; } - else if(fmt.compType == eCompType_UInt || fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UInt || fmt.compType == CompType::UScaled) { return float(*u32); } - else if(fmt.compType == eCompType_SInt || fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SInt || fmt.compType == CompType::SScaled) { return float(*i32); } @@ -62,23 +62,23 @@ float ConvertComponent(const ResourceFormat &fmt, byte *data) uint16_t *u16 = (uint16_t *)data; int16_t *i16 = (int16_t *)data; - if(fmt.compType == eCompType_Float) + if(fmt.compType == CompType::Float) { return ConvertFromHalf(*u16); } - else if(fmt.compType == eCompType_UInt || fmt.compType == eCompType_UScaled) + else if(fmt.compType == CompType::UInt || fmt.compType == CompType::UScaled) { return float(*u16); } - else if(fmt.compType == eCompType_SInt || fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SInt || fmt.compType == CompType::SScaled) { return float(*i16); } - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) { return float(*u16) / 65535.0f; } - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) { float f = -1.0f; @@ -95,22 +95,22 @@ float ConvertComponent(const ResourceFormat &fmt, byte *data) uint8_t *u8 = (uint8_t *)data; int8_t *i8 = (int8_t *)data; - if(fmt.compType == eCompType_UInt || fmt.compType == eCompType_UScaled) + if(fmt.compType == CompType::UInt || fmt.compType == CompType::UScaled) { return float(*u8); } - else if(fmt.compType == eCompType_SInt || fmt.compType == eCompType_SScaled) + else if(fmt.compType == CompType::SInt || fmt.compType == CompType::SScaled) { return float(*i8); } - else if(fmt.compType == eCompType_UNorm) + else if(fmt.compType == CompType::UNorm) { if(fmt.srgbCorrected) return SRGB8_lookuptable[*u8]; else return float(*u8) / 255.0f; } - else if(fmt.compType == eCompType_SNorm) + else if(fmt.compType == CompType::SNorm) { float f = -1.0f; @@ -254,13 +254,13 @@ bool ReplayRenderer::GetDrawcalls(rdctype::array *draws) return true; } -bool ReplayRenderer::FetchCounters(uint32_t *counters, uint32_t numCounters, +bool ReplayRenderer::FetchCounters(GPUCounter *counters, uint32_t numCounters, rdctype::array *results) { if(results == NULL) return false; - vector counterArray; + vector counterArray; counterArray.reserve(numCounters); for(uint32_t i = 0; i < numCounters; i++) counterArray.push_back(counters[i]); @@ -270,7 +270,7 @@ bool ReplayRenderer::FetchCounters(uint32_t *counters, uint32_t numCounters, return true; } -bool ReplayRenderer::EnumerateCounters(rdctype::array *counters) +bool ReplayRenderer::EnumerateCounters(rdctype::array *counters) { if(counters == NULL) return false; @@ -280,7 +280,7 @@ bool ReplayRenderer::EnumerateCounters(rdctype::array *counters) return true; } -bool ReplayRenderer::DescribeCounter(uint32_t counterID, CounterDescription *desc) +bool ReplayRenderer::DescribeCounter(GPUCounter counterID, CounterDescription *desc) { if(desc == NULL) return false; @@ -389,7 +389,7 @@ bool ReplayRenderer::GetPostVSData(uint32_t instID, MeshDataStage stage, MeshFor MeshFormat ret; RDCEraseEl(ret); - if(draw == NULL || (draw->flags & eDraw_Drawcall) == 0) + if(draw == NULL || !(draw->flags & DrawFlags::Drawcall)) { *data = MeshFormat(); return false; @@ -517,7 +517,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) td.msSamp = 1; } - if(sd.destType != eFileType_DDS && sd.sample.mapToArray && !sd.slice.slicesAsGrid && + if(sd.destType != FileType::DDS && sd.sample.mapToArray && !sd.slice.slicesAsGrid && sd.slice.sliceIndex == -1) { sd.sample.mapToArray = false; @@ -525,11 +525,11 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) } // only DDS supports writing multiple mips, fall back to mip 0 if 'all mips' was specified - if(sd.destType != eFileType_DDS && sd.mip == -1) + if(sd.destType != FileType::DDS && sd.mip == -1) sd.mip = 0; // only DDS supports writing multiple slices, fall back to slice 0 if 'all slices' was specified - if(sd.destType != eFileType_DDS && sd.slice.sliceIndex == -1 && !sd.slice.slicesAsGrid && + if(sd.destType != FileType::DDS && sd.slice.sliceIndex == -1 && !sd.slice.slicesAsGrid && !sd.slice.cubeCruciform) sd.slice.sliceIndex = 0; @@ -610,7 +610,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) bool downcast = false; // don't support slice mappings for DDS - it supports slices natively - if(sd.destType == eFileType_DDS) + if(sd.destType == FileType::DDS) { sd.slice.cubeCruciform = false; sd.slice.slicesAsGrid = false; @@ -621,25 +621,25 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) downcast = true; // we don't support any file formats that handle these block compression formats - if(td.format.specialFormat == eSpecial_ETC2 || td.format.specialFormat == eSpecial_EAC || - td.format.specialFormat == eSpecial_ASTC) + if(td.format.specialFormat == SpecialFormat::ETC2 || + td.format.specialFormat == SpecialFormat::EAC || td.format.specialFormat == SpecialFormat::ASTC) downcast = true; // for DDS don't downcast, for non-HDR always downcast if we're not already RGBA8 unorm // for HDR&EXR we can convert from most regular types as well as 10.10.10.2 and 11.11.10 - if((sd.destType != eFileType_DDS && sd.destType != eFileType_HDR && sd.destType != eFileType_EXR && + if((sd.destType != FileType::DDS && sd.destType != FileType::HDR && sd.destType != FileType::EXR && (td.format.compByteWidth != 1 || td.format.compCount != 4 || - td.format.compType != eCompType_UNorm || td.format.bgraOrder)) || - downcast || (sd.destType != eFileType_DDS && td.format.special && - td.format.specialFormat != eSpecial_R10G10B10A2 && - td.format.specialFormat != eSpecial_R11G11B10)) + td.format.compType != CompType::UNorm || td.format.bgraOrder)) || + downcast || (sd.destType != FileType::DDS && td.format.special && + td.format.specialFormat != SpecialFormat::R10G10B10A2 && + td.format.specialFormat != SpecialFormat::R11G11B10)) { downcast = true; td.format.compByteWidth = 1; td.format.compCount = 4; - td.format.compType = eCompType_UNorm; + td.format.compType = CompType::UNorm; td.format.special = false; - td.format.specialFormat = eSpecial_Unknown; + td.format.specialFormat = SpecialFormat::Unknown; } uint32_t rowPitch = 0; @@ -653,12 +653,13 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) td.height = RDCMAX(1U, td.height >> mipOffset); td.depth = RDCMAX(1U, td.depth >> mipOffset); - if(td.format.specialFormat == eSpecial_BC1 || td.format.specialFormat == eSpecial_BC2 || - td.format.specialFormat == eSpecial_BC3 || td.format.specialFormat == eSpecial_BC4 || - td.format.specialFormat == eSpecial_BC5 || td.format.specialFormat == eSpecial_BC6 || - td.format.specialFormat == eSpecial_BC7) + if(td.format.specialFormat == SpecialFormat::BC1 || + td.format.specialFormat == SpecialFormat::BC2 || td.format.specialFormat == SpecialFormat::BC3 || + td.format.specialFormat == SpecialFormat::BC4 || td.format.specialFormat == SpecialFormat::BC5 || + td.format.specialFormat == SpecialFormat::BC6 || td.format.specialFormat == SpecialFormat::BC7) { - blockSize = (td.format.specialFormat == eSpecial_BC1 || td.format.specialFormat == eSpecial_BC4) + blockSize = (td.format.specialFormat == SpecialFormat::BC1 || + td.format.specialFormat == SpecialFormat::BC4) ? 8 : 16; rowPitch = RDCMAX(1U, ((td.width + 3) / 4)) * blockSize; @@ -669,18 +670,18 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) { switch(td.format.specialFormat) { - case eSpecial_S8: bytesPerPixel = 1; break; - case eSpecial_R10G10B10A2: - case eSpecial_R9G9B9E5: - case eSpecial_R11G11B10: - case eSpecial_D24S8: bytesPerPixel = 4; break; - case eSpecial_R5G6B5: - case eSpecial_R5G5B5A1: - case eSpecial_R4G4B4A4: bytesPerPixel = 2; break; - case eSpecial_D32S8: bytesPerPixel = 8; break; - case eSpecial_D16S8: - case eSpecial_YUV: - case eSpecial_R4G4: + case SpecialFormat::S8: bytesPerPixel = 1; break; + case SpecialFormat::R10G10B10A2: + case SpecialFormat::R9G9B9E5: + case SpecialFormat::R11G11B10: + case SpecialFormat::D24S8: bytesPerPixel = 4; break; + case SpecialFormat::R5G6B5: + case SpecialFormat::R5G5B5A1: + case SpecialFormat::R4G4B4A4: bytesPerPixel = 2; break; + case SpecialFormat::D32S8: bytesPerPixel = 8; break; + case SpecialFormat::D16S8: + case SpecialFormat::YUV: + case SpecialFormat::R4G4: RDCERR("Unsupported file format %u", td.format.specialFormat); return false; default: bytesPerPixel = td.format.compCount * td.format.compByteWidth; @@ -904,7 +905,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) } // handle formats that don't support alpha - if(numComps == 4 && (sd.destType == eFileType_BMP || sd.destType == eFileType_JPG)) + if(numComps == 4 && (sd.destType == FileType::BMP || sd.destType == FileType::JPG)) { byte *nonalpha = new byte[td.width * td.height * 3]; @@ -917,10 +918,10 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) byte b = subdata[0][(y * td.width + x) * 4 + 2]; byte a = subdata[0][(y * td.width + x) * 4 + 3]; - if(sd.alpha != eAlphaMap_Discard) + if(sd.alpha != AlphaMapping::Discard) { FloatVector col = sd.alphaCol; - if(sd.alpha == eAlphaMap_BlendToCheckerboard) + if(sd.alpha == AlphaMapping::BlendToCheckerboard) { bool lightSquare = ((x / 64) % 2) == ((y / 64) % 2); col = lightSquare ? sd.alphaCol : sd.alphaColSecondary; @@ -957,8 +958,8 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) } // assume that (R,G,0) is better mapping than (Y,A) for 2 component data - if(numComps == 2 && (sd.destType == eFileType_BMP || sd.destType == eFileType_JPG || - sd.destType == eFileType_PNG || sd.destType == eFileType_TGA)) + if(numComps == 2 && (sd.destType == FileType::BMP || sd.destType == FileType::JPG || + sd.destType == FileType::PNG || sd.destType == FileType::TGA)) { byte *rg0 = new byte[td.width * td.height * 3]; @@ -995,7 +996,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) } else { - if(sd.destType == eFileType_DDS) + if(sd.destType == FileType::DDS) { dds_data ddsData; @@ -1010,33 +1011,33 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) success = write_dds_to_file(f, ddsData); } - else if(sd.destType == eFileType_BMP) + else if(sd.destType == FileType::BMP) { int ret = stbi_write_bmp_to_func(fileWriteFunc, (void *)f, td.width, td.height, numComps, subdata[0]); success = (ret != 0); } - else if(sd.destType == eFileType_PNG) + else if(sd.destType == FileType::PNG) { // discard alpha if requested - for(uint32_t p = 0; sd.alpha == eAlphaMap_Discard && p < td.width * td.height; p++) + for(uint32_t p = 0; sd.alpha == AlphaMapping::Discard && p < td.width * td.height; p++) subdata[0][p * 4 + 3] = 255; int ret = stbi_write_png_to_func(fileWriteFunc, (void *)f, td.width, td.height, numComps, subdata[0], rowPitch); success = (ret != 0); } - else if(sd.destType == eFileType_TGA) + else if(sd.destType == FileType::TGA) { // discard alpha if requested - for(uint32_t p = 0; sd.alpha == eAlphaMap_Discard && p < td.width * td.height; p++) + for(uint32_t p = 0; sd.alpha == AlphaMapping::Discard && p < td.width * td.height; p++) subdata[0][p * 4 + 3] = 255; int ret = stbi_write_tga_to_func(fileWriteFunc, (void *)f, td.width, td.height, numComps, subdata[0]); success = (ret != 0); } - else if(sd.destType == eFileType_JPG) + else if(sd.destType == FileType::JPG) { jpge::params p; p.m_quality = sd.jpegQuality; @@ -1056,12 +1057,12 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) delete[] jpgdst; } - else if(sd.destType == eFileType_HDR || sd.destType == eFileType_EXR) + else if(sd.destType == FileType::HDR || sd.destType == FileType::EXR) { float *fldata = NULL; float *abgr[4] = {NULL, NULL, NULL, NULL}; - if(sd.destType == eFileType_HDR) + if(sd.destType == FileType::HDR) { fldata = new float[td.width * td.height * 4]; } @@ -1076,10 +1077,10 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) byte *srcData = subdata[0]; ResourceFormat saveFmt = td.format; - if(saveFmt.compType == eCompType_None) + if(saveFmt.compType == CompType::Typeless) saveFmt.compType = sd.typeHint; - if(saveFmt.compType == eCompType_None) - saveFmt.compType = saveFmt.compByteWidth == 4 ? eCompType_Float : eCompType_UNorm; + if(saveFmt.compType == CompType::Typeless) + saveFmt.compType = saveFmt.compByteWidth == 4 ? CompType::Float : CompType::UNorm; for(uint32_t y = 0; y < td.height; y++) { @@ -1090,7 +1091,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) float b = 0.0f; float a = 1.0f; - if(saveFmt.special && saveFmt.specialFormat == eSpecial_R10G10B10A2) + if(saveFmt.special && saveFmt.specialFormat == SpecialFormat::R10G10B10A2) { uint32_t *u32 = (uint32_t *)srcData; @@ -1103,7 +1104,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) srcData += 4; } - else if(saveFmt.special && saveFmt.specialFormat == eSpecial_R11G11B10) + else if(saveFmt.special && saveFmt.specialFormat == SpecialFormat::R11G11B10) { uint32_t *u32 = (uint32_t *)srcData; @@ -1134,7 +1135,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) std::swap(r, b); // HDR can't represent negative values - if(sd.destType == eFileType_HDR) + if(sd.destType == FileType::HDR) { r = RDCMAX(r, 0.0f); g = RDCMAX(g, 0.0f); @@ -1180,12 +1181,12 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) } } - if(sd.destType == eFileType_HDR) + if(sd.destType == FileType::HDR) { int ret = stbi_write_hdr_to_func(fileWriteFunc, (void *)f, td.width, td.height, 4, fldata); success = (ret != 0); } - else if(sd.destType == eFileType_EXR) + else if(sd.destType == FileType::EXR) { const char *err = NULL; @@ -1245,7 +1246,7 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) } bool ReplayRenderer::PixelHistory(ResourceId target, uint32_t x, uint32_t y, uint32_t slice, - uint32_t mip, uint32_t sampleIdx, FormatComponentType typeHint, + uint32_t mip, uint32_t sampleIdx, CompType typeHint, rdctype::array *history) { for(size_t t = 0; t < m_Textures.size(); t++) @@ -1282,47 +1283,47 @@ bool ReplayRenderer::PixelHistory(ResourceId target, uint32_t x, uint32_t y, uin switch(usage[i].usage) { - case eUsage_VertexBuffer: - case eUsage_IndexBuffer: - case eUsage_VS_Constants: - case eUsage_HS_Constants: - case eUsage_DS_Constants: - case eUsage_GS_Constants: - case eUsage_PS_Constants: - case eUsage_CS_Constants: - case eUsage_All_Constants: - case eUsage_VS_Resource: - case eUsage_HS_Resource: - case eUsage_DS_Resource: - case eUsage_GS_Resource: - case eUsage_PS_Resource: - case eUsage_CS_Resource: - case eUsage_All_Resource: - case eUsage_InputTarget: - case eUsage_CopySrc: - case eUsage_ResolveSrc: - case eUsage_Barrier: - case eUsage_Indirect: + case ResourceUsage::VertexBuffer: + case ResourceUsage::IndexBuffer: + case ResourceUsage::VS_Constants: + case ResourceUsage::HS_Constants: + case ResourceUsage::DS_Constants: + case ResourceUsage::GS_Constants: + case ResourceUsage::PS_Constants: + case ResourceUsage::CS_Constants: + case ResourceUsage::All_Constants: + case ResourceUsage::VS_Resource: + case ResourceUsage::HS_Resource: + case ResourceUsage::DS_Resource: + case ResourceUsage::GS_Resource: + case ResourceUsage::PS_Resource: + case ResourceUsage::CS_Resource: + case ResourceUsage::All_Resource: + case ResourceUsage::InputTarget: + case ResourceUsage::CopySrc: + case ResourceUsage::ResolveSrc: + case ResourceUsage::Barrier: + case ResourceUsage::Indirect: // read-only, not a valid pixel history event continue; - case eUsage_None: - case eUsage_SO: - case eUsage_VS_RWResource: - case eUsage_HS_RWResource: - case eUsage_DS_RWResource: - case eUsage_GS_RWResource: - case eUsage_PS_RWResource: - case eUsage_CS_RWResource: - case eUsage_All_RWResource: - case eUsage_ColourTarget: - case eUsage_DepthStencilTarget: - case eUsage_Clear: - case eUsage_Copy: - case eUsage_CopyDst: - case eUsage_Resolve: - case eUsage_ResolveDst: - case eUsage_GenMips: + case ResourceUsage::Unused: + case ResourceUsage::StreamOut: + case ResourceUsage::VS_RWResource: + case ResourceUsage::HS_RWResource: + case ResourceUsage::DS_RWResource: + case ResourceUsage::GS_RWResource: + case ResourceUsage::PS_RWResource: + case ResourceUsage::CS_RWResource: + case ResourceUsage::All_RWResource: + case ResourceUsage::ColourTarget: + case ResourceUsage::DepthStencilTarget: + case ResourceUsage::Clear: + case ResourceUsage::Copy: + case ResourceUsage::CopyDst: + case ResourceUsage::Resolve: + case ResourceUsage::ResolveDst: + case ResourceUsage::GenMips: // writing - include in pixel history events break; } @@ -1410,7 +1411,7 @@ void ReplayRenderer::GetSupportedWindowSystems(rdctype::array * *systems = m_pDevice->GetSupportedWindowSystems(); } -ReplayOutput *ReplayRenderer::CreateOutput(WindowingSystem system, void *data, OutputType type) +ReplayOutput *ReplayRenderer::CreateOutput(WindowingSystem system, void *data, ReplayOutputType type) { ReplayOutput *out = new ReplayOutput(this, system, data, type); @@ -1436,7 +1437,7 @@ void ReplayRenderer::Shutdown() } ResourceId ReplayRenderer::BuildTargetShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStageType type, + const uint32_t compileFlags, ShaderStage type, rdctype::str *errors) { ResourceId id; @@ -1444,12 +1445,12 @@ ResourceId ReplayRenderer::BuildTargetShader(const char *entry, const char *sour switch(type) { - case eShaderStage_Vertex: - case eShaderStage_Hull: - case eShaderStage_Domain: - case eShaderStage_Geometry: - case eShaderStage_Pixel: - case eShaderStage_Compute: break; + case ShaderStage::Vertex: + case ShaderStage::Hull: + case ShaderStage::Domain: + case ShaderStage::Geometry: + case ShaderStage::Pixel: + case ShaderStage::Compute: break; default: RDCERR("Unexpected type in BuildShader!"); return ResourceId(); } @@ -1465,7 +1466,7 @@ ResourceId ReplayRenderer::BuildTargetShader(const char *entry, const char *sour } ResourceId ReplayRenderer::BuildCustomShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStageType type, + const uint32_t compileFlags, ShaderStage type, rdctype::str *errors) { ResourceId id; @@ -1473,12 +1474,12 @@ ResourceId ReplayRenderer::BuildCustomShader(const char *entry, const char *sour switch(type) { - case eShaderStage_Vertex: - case eShaderStage_Hull: - case eShaderStage_Domain: - case eShaderStage_Geometry: - case eShaderStage_Pixel: - case eShaderStage_Compute: break; + case ShaderStage::Vertex: + case ShaderStage::Hull: + case ShaderStage::Domain: + case ShaderStage::Geometry: + case ShaderStage::Pixel: + case ShaderStage::Compute: break; default: RDCERR("Unexpected type in BuildShader!"); return ResourceId(); } @@ -1516,7 +1517,7 @@ bool ReplayRenderer::ReplaceResource(ResourceId from, ResourceId to) SetFrameEvent(m_EventID, true); for(size_t i = 0; i < m_Outputs.size(); i++) - if(m_Outputs[i]->GetType() != eOutputType_None) + if(m_Outputs[i]->GetType() != ReplayOutputType::Headless) m_Outputs[i]->Display(); return true; @@ -1529,13 +1530,13 @@ bool ReplayRenderer::RemoveReplacement(ResourceId id) SetFrameEvent(m_EventID, true); for(size_t i = 0; i < m_Outputs.size(); i++) - if(m_Outputs[i]->GetType() != eOutputType_None) + if(m_Outputs[i]->GetType() != ReplayOutputType::Headless) m_Outputs[i]->Display(); return true; } -ReplayCreateStatus ReplayRenderer::CreateDevice(const char *logfile) +ReplayStatus ReplayRenderer::CreateDevice(const char *logfile) { RDCLOG("Creating replay device for %s", logfile); @@ -1545,7 +1546,7 @@ ReplayCreateStatus ReplayRenderer::CreateDevice(const char *logfile) auto status = RenderDoc::Inst().FillInitParams(logfile, driverType, driverName, fileMachineIdent, NULL); - if(driverType == RDC_Unknown || driverName == "" || status != eReplayCreate_Success) + if(driverType == RDC_Unknown || driverName == "" || status != ReplayStatus::Succeeded) { RDCERR("Couldn't get device type from log"); return status; @@ -1554,7 +1555,7 @@ ReplayCreateStatus ReplayRenderer::CreateDevice(const char *logfile) IReplayDriver *driver = NULL; status = RenderDoc::Inst().CreateReplayDriver(driverType, logfile, &driver); - if(driver && status == eReplayCreate_Success) + if(driver && status == ReplayStatus::Succeeded) { RDCLOG("Created replay driver."); return PostCreateInit(driver); @@ -1564,7 +1565,7 @@ ReplayCreateStatus ReplayRenderer::CreateDevice(const char *logfile) return status; } -ReplayCreateStatus ReplayRenderer::SetDevice(IReplayDriver *device) +ReplayStatus ReplayRenderer::SetDevice(IReplayDriver *device) { if(device) { @@ -1573,10 +1574,10 @@ ReplayCreateStatus ReplayRenderer::SetDevice(IReplayDriver *device) } RDCERR("Given invalid replay driver."); - return eReplayCreate_InternalError; + return ReplayStatus::InternalError; } -ReplayCreateStatus ReplayRenderer::PostCreateInit(IReplayDriver *device) +ReplayStatus ReplayRenderer::PostCreateInit(IReplayDriver *device) { m_pDevice = device; @@ -1590,7 +1591,7 @@ ReplayCreateStatus ReplayRenderer::PostCreateInit(IReplayDriver *device) m_FrameRecord.m_DrawCallList = fr.drawcallList; SetupDrawcallPointers(&m_Drawcalls, m_FrameRecord.m_DrawCallList, NULL, NULL); - return eReplayCreate_Success; + return ReplayStatus::Succeeded; } void ReplayRenderer::FileChanged() @@ -1624,47 +1625,47 @@ void ReplayRenderer::FetchPipelineState() m_VulkanPipelineState = m_pDevice->GetVulkanPipelineState(); { - D3D11PipelineState::ShaderStage *stages[] = { + D3D11PipelineState::Shader *stages[] = { &m_D3D11PipelineState.m_VS, &m_D3D11PipelineState.m_HS, &m_D3D11PipelineState.m_DS, &m_D3D11PipelineState.m_GS, &m_D3D11PipelineState.m_PS, &m_D3D11PipelineState.m_CS, }; for(int i = 0; i < 6; i++) - if(stages[i]->Shader != ResourceId()) - stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Shader), ""); + if(stages[i]->Object != ResourceId()) + stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Object), ""); } { - D3D12PipelineState::ShaderStage *stages[] = { + D3D12PipelineState::Shader *stages[] = { &m_D3D12PipelineState.m_VS, &m_D3D12PipelineState.m_HS, &m_D3D12PipelineState.m_DS, &m_D3D12PipelineState.m_GS, &m_D3D12PipelineState.m_PS, &m_D3D12PipelineState.m_CS, }; for(int i = 0; i < 6; i++) - if(stages[i]->Shader != ResourceId()) - stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Shader), ""); + if(stages[i]->Object != ResourceId()) + stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Object), ""); } { - GLPipelineState::ShaderStage *stages[] = { + GLPipelineState::Shader *stages[] = { &m_GLPipelineState.m_VS, &m_GLPipelineState.m_TCS, &m_GLPipelineState.m_TES, &m_GLPipelineState.m_GS, &m_GLPipelineState.m_FS, &m_GLPipelineState.m_CS, }; for(int i = 0; i < 6; i++) - if(stages[i]->Shader != ResourceId()) - stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Shader), ""); + if(stages[i]->Object != ResourceId()) + stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Object), ""); } { - VulkanPipelineState::ShaderStage *stages[] = { + VulkanPipelineState::Shader *stages[] = { &m_VulkanPipelineState.m_VS, &m_VulkanPipelineState.m_TCS, &m_VulkanPipelineState.m_TES, &m_VulkanPipelineState.m_GS, &m_VulkanPipelineState.m_FS, &m_VulkanPipelineState.m_CS, }; for(int i = 0; i < 6; i++) - if(stages[i]->Shader != ResourceId()) - stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Shader), + if(stages[i]->Object != ResourceId()) + stages[i]->ShaderDetails = m_pDevice->GetShader(m_pDevice->GetLiveID(stages[i]->Object), stages[i]->entryPoint.elems); } } @@ -1683,7 +1684,7 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetSupportedWindowSyst } extern "C" RENDERDOC_API IReplayOutput *RENDERDOC_CC ReplayRenderer_CreateOutput( - IReplayRenderer *rend, WindowingSystem system, void *data, OutputType type) + IReplayRenderer *rend, WindowingSystem system, void *data, ReplayOutputType type) { return rend->CreateOutput(system, data, type); } @@ -1740,7 +1741,7 @@ ReplayRenderer_GetVulkanPipelineState(IReplayRenderer *rend, VulkanPipelineState extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildCustomShader( IReplayRenderer *rend, const char *entry, const char *source, const uint32_t compileFlags, - ShaderStageType type, ResourceId *shaderID, rdctype::str *errors) + ShaderStage type, ResourceId *shaderID, rdctype::str *errors) { if(shaderID == NULL) return; @@ -1755,7 +1756,7 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_FreeCustomShader(IRe extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildTargetShader( IReplayRenderer *rend, const char *entry, const char *source, const uint32_t compileFlags, - ShaderStageType type, ResourceId *shaderID, rdctype::str *errors) + ShaderStage type, ResourceId *shaderID, rdctype::str *errors) { if(shaderID == NULL) return; @@ -1790,18 +1791,18 @@ ReplayRenderer_GetDrawcalls(IReplayRenderer *rend, rdctype::array return rend->GetDrawcalls(draws); } extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_FetchCounters(IReplayRenderer *rend, uint32_t *counters, uint32_t numCounters, +ReplayRenderer_FetchCounters(IReplayRenderer *rend, GPUCounter *counters, uint32_t numCounters, rdctype::array *results) { return rend->FetchCounters(counters, numCounters, results); } extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_EnumerateCounters(IReplayRenderer *rend, rdctype::array *counters) +ReplayRenderer_EnumerateCounters(IReplayRenderer *rend, rdctype::array *counters) { return rend->EnumerateCounters(counters); } extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_DescribeCounter(IReplayRenderer *rend, - uint32_t counterID, + GPUCounter counterID, CounterDescription *desc) { return rend->DescribeCounter(counterID, desc); @@ -1830,7 +1831,7 @@ ReplayRenderer_GetDebugMessages(IReplayRenderer *rend, rdctype::array *history) + uint32_t sampleIdx, CompType typeHint, rdctype::array *history) { return rend->PixelHistory(target, x, y, slice, mip, sampleIdx, typeHint, history); } diff --git a/renderdoc/replay/replay_renderer.h b/renderdoc/replay/replay_renderer.h index 16b438a7b..3d70c03e7 100644 --- a/renderdoc/replay/replay_renderer.h +++ b/renderdoc/replay/replay_renderer.h @@ -38,17 +38,15 @@ struct ReplayRenderer; struct ReplayOutput : public IReplayOutput { public: - bool SetOutputConfig(const OutputConfig &o); bool SetTextureDisplay(const TextureDisplay &o); bool SetMeshDisplay(const MeshDisplay &o); bool ClearThumbnails(); - bool AddThumbnail(WindowingSystem system, void *data, ResourceId texID, - FormatComponentType typeHint); + bool AddThumbnail(WindowingSystem system, void *data, ResourceId texID, CompType typeHint); bool Display(); - OutputType GetType() { return m_Config.m_Type; } + ReplayOutputType GetType() { return m_Type; } bool SetPixelContext(WindowingSystem system, void *data); bool SetPixelContextLocation(uint32_t x, uint32_t y); void DisablePixelContext(); @@ -63,7 +61,7 @@ public: uint32_t PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint32_t *pickedInstance); private: - ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void *data, OutputType type); + ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void *data, ReplayOutputType type); virtual ~ReplayOutput(); void SetFrameEvent(int eventID); @@ -87,7 +85,7 @@ private: ResourceId texture; bool depthMode; uint64_t wndHandle; - FormatComponentType typeHint; + CompType typeHint; uint64_t outputID; bool dirty; @@ -103,7 +101,7 @@ private: OutputPair m_PixelContext; uint32_t m_EventID; - OutputConfig m_Config; + ReplayOutputType m_Type; vector passEvents; @@ -127,8 +125,8 @@ public: APIProperties GetAPIProperties(); - ReplayCreateStatus CreateDevice(const char *logfile); - ReplayCreateStatus SetDevice(IReplayDriver *device); + ReplayStatus CreateDevice(const char *logfile); + ReplayStatus SetDevice(IReplayDriver *device); void FileChanged(); @@ -145,28 +143,28 @@ public: bool GetVulkanPipelineState(VulkanPipelineState *state); ResourceId BuildCustomShader(const char *entry, const char *source, const uint32_t compileFlags, - ShaderStageType type, rdctype::str *errors); + ShaderStage type, rdctype::str *errors); bool FreeCustomShader(ResourceId id); ResourceId BuildTargetShader(const char *entry, const char *source, const uint32_t compileFlags, - ShaderStageType type, rdctype::str *errors); + ShaderStage type, rdctype::str *errors); bool ReplaceResource(ResourceId from, ResourceId to); bool RemoveReplacement(ResourceId id); bool FreeTargetResource(ResourceId id); bool GetFrameInfo(FetchFrameInfo *frame); bool GetDrawcalls(rdctype::array *draws); - bool FetchCounters(uint32_t *counters, uint32_t numCounters, + bool FetchCounters(GPUCounter *counters, uint32_t numCounters, rdctype::array *results); - bool EnumerateCounters(rdctype::array *counters); - bool DescribeCounter(uint32_t counterID, CounterDescription *desc); + bool EnumerateCounters(rdctype::array *counters); + bool DescribeCounter(GPUCounter counterID, CounterDescription *desc); bool GetTextures(rdctype::array *texs); bool GetBuffers(rdctype::array *bufs); bool GetResolve(uint64_t *callstack, uint32_t callstackLen, rdctype::array *trace); bool GetDebugMessages(rdctype::array *msgs); bool PixelHistory(ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, FormatComponentType typeHint, + uint32_t sampleIdx, CompType typeHint, rdctype::array *history); bool DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace); @@ -189,13 +187,13 @@ public: void GetSupportedWindowSystems(rdctype::array *systems); - ReplayOutput *CreateOutput(WindowingSystem, void *data, OutputType type); + ReplayOutput *CreateOutput(WindowingSystem, void *data, ReplayOutputType type); void ShutdownOutput(IReplayOutput *output); void Shutdown(); private: - ReplayCreateStatus PostCreateInit(IReplayDriver *device); + ReplayStatus PostCreateInit(IReplayDriver *device); FetchDrawcall *GetDrawcallByEID(uint32_t eventID); diff --git a/renderdoc/serialise/serialiser.h b/renderdoc/serialise/serialiser.h index 151c0015a..872522ab8 100644 --- a/renderdoc/serialise/serialiser.h +++ b/renderdoc/serialise/serialiser.h @@ -851,3 +851,7 @@ struct ToStrHelper // stringize the parameter #define TOSTR_CASE_STRINGIZE(a) \ case a: return #a; + +// stringize the parameter (class enum version) +#define TOSTR_CASE_STRINGIZE_SCOPED(a, b) \ + case a::b: return #b; diff --git a/renderdoccmd/renderdoccmd.cpp b/renderdoccmd/renderdoccmd.cpp index ccaa5afa6..1dac443ef 100644 --- a/renderdoccmd/renderdoccmd.cpp +++ b/renderdoccmd/renderdoccmd.cpp @@ -56,8 +56,8 @@ void DisplayRendererPreview(IReplayRenderer *renderer, uint32_t width, uint32_t TextureDisplay d; d.mip = 0; d.sampleIdx = ~0U; - d.overlay = eTexOverlay_None; - d.typeHint = eCompType_None; + d.overlay = DebugOverlay::NoOverlay; + d.typeHint = CompType::Typeless; d.CustomShader = ResourceId(); d.HDRMul = -1.0f; d.linearDisplayAsGamma = true; @@ -76,7 +76,7 @@ void DisplayRendererPreview(IReplayRenderer *renderer, uint32_t width, uint32_t for(int32_t i = 0; i < texs.count; i++) { - if(texs[i].creationFlags & eTextureCreate_SwapBuffer) + if(texs[i].creationFlags & TextureCategory::SwapBuffer) { d.texid = texs[i].ID; break; @@ -86,7 +86,7 @@ void DisplayRendererPreview(IReplayRenderer *renderer, uint32_t width, uint32_t rdctype::array draws; renderer->GetDrawcalls(&draws); - if(draws.count > 0 && draws[draws.count - 1].flags & eDraw_Present) + if(draws.count > 0 && draws[draws.count - 1].flags & DrawFlags::Present) { ResourceId id = draws[draws.count - 1].copyDestination; if(id != ResourceId()) @@ -224,30 +224,30 @@ struct ThumbCommand : public Command string format = parser.get("format"); - FileType type = eFileType_JPG; + FileType type = FileType::JPG; if(format == "png") { - type = eFileType_PNG; + type = FileType::PNG; } else if(format == "tga") { - type = eFileType_TGA; + type = FileType::TGA; } else if(format == "bmp") { - type = eFileType_BMP; + type = FileType::BMP; } else { const char *dot = strrchr(outfile.c_str(), '.'); if(dot != NULL && strstr(dot, "png")) - type = eFileType_PNG; + type = FileType::PNG; else if(dot != NULL && strstr(dot, "tga")) - type = eFileType_TGA; + type = FileType::TGA; else if(dot != NULL && strstr(dot, "bmp")) - type = eFileType_BMP; + type = FileType::BMP; else std::cerr << "Couldn't guess format from '" << outfile << "', defaulting to jpg." << std::endl; @@ -483,10 +483,10 @@ struct ReplayCommand : public Command << parser.get("remote-port") << "." << std::endl; IRemoteServer *remote = NULL; - ReplayCreateStatus status = RENDERDOC_CreateRemoteServerConnection( + ReplayStatus status = RENDERDOC_CreateRemoteServerConnection( parser.get("remote-host").c_str(), parser.get("remote-port"), &remote); - if(remote == NULL || status != eReplayCreate_Success) + if(remote == NULL || status != ReplayStatus::Succeeded) { std::cerr << "Error: Couldn't connect to " << parser.get("remote-host") << ":" << parser.get("remote-port") << "." << std::endl; @@ -503,7 +503,7 @@ struct ReplayCommand : public Command IReplayRenderer *renderer = NULL; status = remote->OpenCapture(~0U, remotePath.elems, &progress, &renderer); - if(status == eReplayCreate_Success) + if(status == ReplayStatus::Succeeded) { DisplayRendererPreview(renderer, parser.get("width"), parser.get("height")); @@ -523,10 +523,9 @@ struct ReplayCommand : public Command float progress = 0.0f; IReplayRenderer *renderer = NULL; - ReplayCreateStatus status = - RENDERDOC_CreateReplayRenderer(filename.c_str(), &progress, &renderer); + ReplayStatus status = RENDERDOC_CreateReplayRenderer(filename.c_str(), &progress, &renderer); - if(status == eReplayCreate_Success) + if(status == ReplayStatus::Succeeded) { DisplayRendererPreview(renderer, parser.get("width"), parser.get("height")); @@ -576,53 +575,53 @@ struct CapAltBitCommand : public Command { string typeString = rest[i * 3 + 0]; - EnvironmentModificationType type = eEnvMod_Set; - EnvironmentSeparator sep = eEnvSep_None; + EnvMod type = EnvMod::Set; + EnvSep sep = EnvSep::NoSep; if(typeString == "+env-replace") { - type = eEnvMod_Set; - sep = eEnvSep_None; + type = EnvMod::Set; + sep = EnvSep::NoSep; } else if(typeString == "+env-append-platform") { - type = eEnvMod_Append; - sep = eEnvSep_Platform; + type = EnvMod::Append; + sep = EnvSep::Platform; } else if(typeString == "+env-append-semicolon") { - type = eEnvMod_Append; - sep = eEnvSep_SemiColon; + type = EnvMod::Append; + sep = EnvSep::SemiColon; } else if(typeString == "+env-append-colon") { - type = eEnvMod_Append; - sep = eEnvSep_Colon; + type = EnvMod::Append; + sep = EnvSep::Colon; } else if(typeString == "+env-append") { - type = eEnvMod_Append; - sep = eEnvSep_None; + type = EnvMod::Append; + sep = EnvSep::NoSep; } else if(typeString == "+env-prepend-platform") { - type = eEnvMod_Prepend; - sep = eEnvSep_Platform; + type = EnvMod::Prepend; + sep = EnvSep::Platform; } else if(typeString == "+env-prepend-semicolon") { - type = eEnvMod_Prepend; - sep = eEnvSep_SemiColon; + type = EnvMod::Prepend; + sep = EnvSep::SemiColon; } else if(typeString == "+env-prepend-colon") { - type = eEnvMod_Prepend; - sep = eEnvSep_Colon; + type = EnvMod::Prepend; + sep = EnvSep::Colon; } else if(typeString == "+env-prepend") { - type = eEnvMod_Prepend; - sep = eEnvSep_None; + type = EnvMod::Prepend; + sep = EnvSep::NoSep; } else { diff --git a/renderdoccmd/renderdoccmd_android.cpp b/renderdoccmd/renderdoccmd_android.cpp index e1741fcec..21e4f8cf0 100644 --- a/renderdoccmd/renderdoccmd_android.cpp +++ b/renderdoccmd/renderdoccmd_android.cpp @@ -53,12 +53,9 @@ void DisplayRendererPreview(IReplayRenderer *renderer, TextureDisplay &displayCf { ANativeWindow *connectionScreenWindow = android_state->window; - IReplayOutput *out = ReplayRenderer_CreateOutput(renderer, eWindowingSystem_Android, - connectionScreenWindow, eOutputType_TexDisplay); + IReplayOutput *out = ReplayRenderer_CreateOutput( + renderer, WindowingSystem::Android, connectionScreenWindow, ReplayOutputType::Texture); - OutputConfig c = {eOutputType_TexDisplay}; - - ReplayOutput_SetOutputConfig(out, c); ReplayOutput_SetTextureDisplay(out, displayCfg); for(int i = 0; i < 100; i++) diff --git a/renderdoccmd/renderdoccmd_linux.cpp b/renderdoccmd/renderdoccmd_linux.cpp index 04d622b5a..5ee5e14d4 100644 --- a/renderdoccmd/renderdoccmd_linux.cpp +++ b/renderdoccmd/renderdoccmd_linux.cpp @@ -107,7 +107,7 @@ struct VulkanRegisterCommand : public Command void VerifyVulkanLayer(int argc, char *argv[]) { - uint32_t flags = 0; + VulkanLayerFlags flags = VulkanLayerFlags::NoFlags; rdctype::array myJSONs; rdctype::array otherJSONs; @@ -115,7 +115,7 @@ void VerifyVulkanLayer(int argc, char *argv[]) if(!needUpdate) { - if(!(flags & eVulkan_Unfixable)) + if(!(flags & VulkanLayerFlags::Unfixable)) add_command("vulkanregister", new VulkanRegisterCommand()); return; } @@ -126,22 +126,22 @@ void VerifyVulkanLayer(int argc, char *argv[]) << std::endl; std::cerr << std::endl; - if(flags & eVulkan_OtherInstallsRegistered) + if(flags & VulkanLayerFlags::OtherInstallsRegistered) std::cerr << "Multiple RenderDoc layers are registered, possibly from different builds." << std::endl; - if(!(flags & eVulkan_ThisInstallRegistered)) + if(!(flags & VulkanLayerFlags::ThisInstallRegistered)) std::cerr << "This build's RenderDoc layer is not registered." << std::endl; std::cerr << "To fix this, the following actions must take place: " << std::endl << std::endl; - const bool registerAll = (flags & eVulkan_RegisterAll); - const bool updateAllowed = (flags & eVulkan_UpdateAllowed); + const bool registerAll = bool(flags & VulkanLayerFlags::RegisterAll); + const bool updateAllowed = bool(flags & VulkanLayerFlags::UpdateAllowed); for(const rdctype::str &j : otherJSONs) std::cerr << (updateAllowed ? "Unregister/update: " : "Unregister: ") << j.c_str() << std::endl; - if(!(flags & eVulkan_ThisInstallRegistered)) + if(!(flags & VulkanLayerFlags::ThisInstallRegistered)) { if(registerAll) { @@ -158,7 +158,7 @@ void VerifyVulkanLayer(int argc, char *argv[]) std::cerr << std::endl; - if(flags & eVulkan_Unfixable) + if(flags & VulkanLayerFlags::Unfixable) { std::cerr << "NOTE: The renderdoc layer registered in /usr is reserved for distribution" << std::endl; @@ -273,9 +273,9 @@ void DisplayRendererPreview(IReplayRenderer *renderer, TextureDisplay &displayCf for(int32_t i = 0; i < systems.count; i++) { - if(systems[i] == eWindowingSystem_Xlib) + if(systems[i] == WindowingSystem::Xlib) xlib = true; - if(systems[i] == eWindowingSystem_XCB) + if(systems[i] == WindowingSystem::XCB) xcb = true; } @@ -288,8 +288,8 @@ void DisplayRendererPreview(IReplayRenderer *renderer, TextureDisplay &displayCf windowData.connection = connection; windowData.window = window; - out = ReplayRenderer_CreateOutput(renderer, eWindowingSystem_XCB, &windowData, - eOutputType_TexDisplay); + out = ReplayRenderer_CreateOutput(renderer, WindowingSystem::XCB, &windowData, + ReplayOutputType::Texture); } else if(xlib) { @@ -297,22 +297,19 @@ void DisplayRendererPreview(IReplayRenderer *renderer, TextureDisplay &displayCf windowData.display = display; windowData.window = (Drawable)window; // safe to cast types - out = ReplayRenderer_CreateOutput(renderer, eWindowingSystem_Xlib, &windowData, - eOutputType_TexDisplay); + out = ReplayRenderer_CreateOutput(renderer, WindowingSystem::Xlib, &windowData, + ReplayOutputType::Texture); } else { std::cerr << "Neither XCB nor XLib are supported, can't create window." << std::endl; std::cerr << "Supported systems: "; for(int32_t i = 0; i < systems.count; i++) - std::cerr << systems[i] << std::endl; + std::cerr << (uint32_t)systems[i] << std::endl; std::cerr << std::endl; return; } - OutputConfig c = {eOutputType_TexDisplay}; - - ReplayOutput_SetOutputConfig(out, c); ReplayOutput_SetTextureDisplay(out, displayCfg); xcb_flush(connection); diff --git a/renderdoccmd/renderdoccmd_win32.cpp b/renderdoccmd/renderdoccmd_win32.cpp index 463033351..b172875ce 100644 --- a/renderdoccmd/renderdoccmd_win32.cpp +++ b/renderdoccmd/renderdoccmd_win32.cpp @@ -250,11 +250,8 @@ void DisplayRendererPreview(IReplayRenderer *renderer, TextureDisplay &displayCf UpdateWindow(wnd); IReplayOutput *out = - ReplayRenderer_CreateOutput(renderer, eWindowingSystem_Win32, wnd, eOutputType_TexDisplay); + ReplayRenderer_CreateOutput(renderer, WindowingSystem::Win32, wnd, ReplayOutputType::Texture); - OutputConfig c = {eOutputType_TexDisplay}; - - ReplayOutput_SetOutputConfig(out, c); ReplayOutput_SetTextureDisplay(out, displayCfg); MSG msg; diff --git a/renderdocui/Interop/FetchInfo.cs b/renderdocui/Interop/FetchInfo.cs index cf9f42b03..583f62e88 100644 --- a/renderdocui/Interop/FetchInfo.cs +++ b/renderdocui/Interop/FetchInfo.cs @@ -314,12 +314,6 @@ namespace renderdoc public UInt64 byteSize; }; - [StructLayout(LayoutKind.Sequential)] - public class OutputConfig - { - public OutputType m_Type = OutputType.None; - }; - [StructLayout(LayoutKind.Sequential)] public class FetchFrameConstantBindStats { diff --git a/renderdocui/Interop/ReplayRenderer.cs b/renderdocui/Interop/ReplayRenderer.cs index 611c5fed1..10149448a 100644 --- a/renderdocui/Interop/ReplayRenderer.cs +++ b/renderdocui/Interop/ReplayRenderer.cs @@ -118,8 +118,6 @@ namespace renderdoc public class ReplayOutput { - [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_SetOutputConfig(IntPtr real, OutputConfig o); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern bool ReplayOutput_SetTextureDisplay(IntPtr real, TextureDisplay o); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] @@ -158,10 +156,6 @@ namespace renderdoc public ReplayOutput(IntPtr real) { m_Real = real; } - public bool SetOutputConfig(OutputConfig o) - { - return ReplayOutput_SetOutputConfig(m_Real, o); - } public bool SetTextureDisplay(TextureDisplay o) { return ReplayOutput_SetTextureDisplay(m_Real, o); diff --git a/renderdocui/Windows/BufferViewer.cs b/renderdocui/Windows/BufferViewer.cs index f090b9b5f..bf7d9638d 100644 --- a/renderdocui/Windows/BufferViewer.cs +++ b/renderdocui/Windows/BufferViewer.cs @@ -203,7 +203,6 @@ namespace renderdocui.Windows private byte[] m_Zeroes = null; - private OutputConfig m_OutConfig = new OutputConfig(); private MeshDisplay m_MeshDisplay = new MeshDisplay(); private IntPtr RenderHandle = IntPtr.Zero; @@ -301,8 +300,6 @@ namespace renderdocui.Windows private void ResetConfig() { - m_OutConfig.m_Type = OutputType.MeshDisplay; - m_MeshDisplay = new MeshDisplay(); m_MeshDisplay.type = MeshDataStage.VSIn; m_MeshDisplay.fov = 90.0f; @@ -558,7 +555,6 @@ namespace renderdocui.Windows return; m_Output = r.CreateOutput(RenderHandle, OutputType.MeshDisplay); - m_Output.SetOutputConfig(m_OutConfig); RT_UpdateRenderOutput(r); m_Output.Display(); // pump the display once, this will fetch postvs data diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index 219bd4117..205f78c92 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -1090,9 +1090,6 @@ namespace renderdocui.Windows public void OnLogfileLoaded() { - var outConfig = new OutputConfig(); - outConfig.m_Type = OutputType.TexDisplay; - saveTex.Enabled = gotoLocationButton.Enabled = viewTexBuffer.Enabled = true; m_Following = Following.Default; @@ -1111,7 +1108,6 @@ namespace renderdocui.Windows { m_Output = r.CreateOutput(renderHandle, OutputType.TexDisplay); m_Output.SetPixelContext(contextHandle); - m_Output.SetOutputConfig(outConfig); this.BeginInvoke(new Action(UI_CreateThumbnails)); });