From 05472b1c3a9b1a9878e9d88e0f2dce9dcd2a97d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Thu, 23 Nov 2017 23:31:24 +0100 Subject: [PATCH] UI - Refactoring progress (see previous log message) --- Makefile | 28 ++++++++++----------- c-filewatcher.cc | 1 - opast.cc => c-opast.cc | 2 +- opast.hh => c-opast.hh | 3 +-- opcomp.cc => c-opcomp.cc | 4 +-- opcomp.hh => c-opcomp.hh | 2 +- opmgr.cc => c-opmgr.cc | 4 +-- opparser.cc => c-opparser.cc | 6 ++--- ops.cc => c-ops.cc | 2 +- ops.hh => c-ops.hh | 2 +- c-renderdefs.hh | 35 +++++++++++++++++++++++++++ utilities.cc => c-utilities.cc | 2 +- utilities.hh => c-utilities.hh | 0 camera.cc | 2 +- common.cc | 9 ++----- common.hh | 2 -- demo.cc | 6 ++--- demo.hh | 2 +- main.cc | 22 ++++++++--------- parsercheck.cc | 6 ++--- sync.hh | 1 - odbg.cc => ui-odbg.cc | 2 +- odbg.hh => ui-odbg.hh | 13 ++-------- opemu.cc => ui-opemu.cc | 13 +++++----- opemu.hh => ui-opemu.hh | 4 ++- profiling.cc => ui-profiling.cc | 2 +- profiling.hh => ui-profiling.hh | 4 ++- rendertarget.cc => ui-rendertarget.cc | 3 ++- rendertarget.hh => ui-rendertarget.hh | 2 +- shaders.cc => ui-shaders.cc | 2 +- shaders.hh => ui-shaders.hh | 1 - texture.cc => ui-texture.cc | 4 +-- texture.hh => ui-texture.hh | 25 +------------------ ui.cc | 11 ++++++--- ui.hh | 8 +++--- 35 files changed, 120 insertions(+), 115 deletions(-) rename opast.cc => c-opast.cc (99%) rename opast.hh => c-opast.hh (99%) rename opcomp.cc => c-opcomp.cc (99%) rename opcomp.hh => c-opcomp.hh (98%) rename opmgr.cc => c-opmgr.cc (98%) rename opparser.cc => c-opparser.cc (99%) rename ops.cc => c-ops.cc (99%) rename ops.hh => c-ops.hh (99%) create mode 100644 c-renderdefs.hh rename utilities.cc => c-utilities.cc (97%) rename utilities.hh => c-utilities.hh (100%) rename odbg.cc => ui-odbg.cc (99%) rename odbg.hh => ui-odbg.hh (92%) rename opemu.cc => ui-opemu.cc (98%) rename opemu.hh => ui-opemu.hh (96%) rename profiling.cc => ui-profiling.cc (99%) rename profiling.hh => ui-profiling.hh (96%) rename rendertarget.cc => ui-rendertarget.cc (98%) rename rendertarget.hh => ui-rendertarget.hh (98%) rename shaders.cc => ui-shaders.cc (99%) rename shaders.hh => ui-shaders.hh (99%) rename texture.cc => ui-texture.cc (99%) rename texture.hh => ui-texture.hh (91%) diff --git a/Makefile b/Makefile index 1b9fe5b..b262cd3 100644 --- a/Makefile +++ b/Makefile @@ -17,43 +17,43 @@ IMGUI = imgui.cpp imgui_draw.cpp COMMON = \ common.cc \ c-filewatcher.cc \ + c-utilities.cc \ + \ + c-ops.cc \ + c-opast.cc \ + c-opparser.cc \ + c-opcomp.cc \ + c-opmgr.cc \ \ - utilities.cc \ - texture.cc \ - rendertarget.cc \ camera.cc \ \ - profiling.cc \ - shaders.cc \ - odbg.cc \ undo.cc \ \ sync.cc \ syncedit.cc \ syncoverrides.cc \ \ - ops.cc \ - opast.cc \ - opparser.cc \ - opcomp.cc \ - opmgr.cc \ - \ ui.cc \ ui-actions.cc \ + ui-app.cc \ ui-colorgrading.cc \ ui-dialogs.cc \ ui-imgui-sdl.cc \ + ui-odbg.cc \ ui-overrides.cc \ + ui-profiling.cc \ + ui-rendertarget.cc \ ui-sequencer.cc \ + ui-shaders.cc \ ui-sync.cc \ + ui-texture.cc \ ui-utilities.cc \ - ui-app.cc \ # END COMMON DEMO = \ demo.cc \ main.cc \ - opemu.cc \ + ui-opemu.cc \ # END DEMO PARSERCHECK = \ diff --git a/c-filewatcher.cc b/c-filewatcher.cc index 7d6c533..e28b5e6 100644 --- a/c-filewatcher.cc +++ b/c-filewatcher.cc @@ -1,6 +1,5 @@ #include "externals.hh" #include "c-filewatcher.hh" -#include "utilities.hh" /*= T_FilesWatcher ===========================================================*/ diff --git a/opast.cc b/c-opast.cc similarity index 99% rename from opast.cc rename to c-opast.cc index 105d2f5..6b85b1f 100644 --- a/opast.cc +++ b/c-opast.cc @@ -1,5 +1,5 @@ #include "externals.hh" -#include "opast.hh" +#include "c-opast.hh" #include "sync.hh" #include diff --git a/opast.hh b/c-opast.hh similarity index 99% rename from opast.hh rename to c-opast.hh index 52381ba..1cb9417 100644 --- a/opast.hh +++ b/c-opast.hh @@ -1,7 +1,6 @@ #pragma once -#include "odbg.hh" +#include "c-renderdefs.hh" #include -#include struct T_SyncOverrideSection; diff --git a/opcomp.cc b/c-opcomp.cc similarity index 99% rename from opcomp.cc rename to c-opcomp.cc index 5167d1f..2c3f53b 100644 --- a/opcomp.cc +++ b/c-opcomp.cc @@ -1,6 +1,6 @@ #include "externals.hh" -#include "ops.hh" -#include "opcomp.hh" +#include "c-ops.hh" +#include "c-opcomp.hh" #include #define INVASIVE_TRACES diff --git a/opcomp.hh b/c-opcomp.hh similarity index 98% rename from opcomp.hh rename to c-opcomp.hh index e6c9fe1..423ab03 100644 --- a/opcomp.hh +++ b/c-opcomp.hh @@ -1,6 +1,6 @@ #pragma once #include "c-filewatcher.hh" -#include "opast.hh" +#include "c-opast.hh" #include diff --git a/opmgr.cc b/c-opmgr.cc similarity index 98% rename from opmgr.cc rename to c-opmgr.cc index beba09b..33c5318 100644 --- a/opmgr.cc +++ b/c-opmgr.cc @@ -1,7 +1,7 @@ #include "externals.hh" #include "common.hh" -#include "opcomp.hh" -#include "ops.hh" +#include "c-opcomp.hh" +#include "c-ops.hh" #include #include diff --git a/opparser.cc b/c-opparser.cc similarity index 99% rename from opparser.cc rename to c-opparser.cc index 07ae11e..26a16ce 100644 --- a/opparser.cc +++ b/c-opparser.cc @@ -1,7 +1,7 @@ #include "externals.hh" -#include "opast.hh" -#include "ops.hh" -#include "opcomp.hh" +#include "c-opast.hh" +#include "c-ops.hh" +#include "c-opcomp.hh" #include "syncoverrides.hh" #include #include diff --git a/ops.cc b/c-ops.cc similarity index 99% rename from ops.cc rename to c-ops.cc index 52bc69e..dd2ba32 100644 --- a/ops.cc +++ b/c-ops.cc @@ -1,5 +1,5 @@ #include "externals.hh" -#include "ops.hh" +#include "c-ops.hh" using namespace ops; using namespace ebcl; diff --git a/ops.hh b/c-ops.hh similarity index 99% rename from ops.hh rename to c-ops.hh index 2da222f..c4c6cce 100644 --- a/ops.hh +++ b/c-ops.hh @@ -1,6 +1,6 @@ #pragma once #include "sync.hh" -#include "opast.hh" +#include "c-opast.hh" struct T_Rendertarget; diff --git a/c-renderdefs.hh b/c-renderdefs.hh new file mode 100644 index 0000000..ea20b2e --- /dev/null +++ b/c-renderdefs.hh @@ -0,0 +1,35 @@ +#pragma once +#ifndef REAL_BUILD +# include "externals.hh" +#endif + + +enum class E_TexType { + RGBA8 , + RGBA16F , + RGB8 , + RGB16F , + R8 , + R16F , +}; + +enum class E_TexSampling { + NEAREST , + LINEAR , +}; + +enum class E_TexWrap { + REPEAT , + CLAMP_EDGE , + CLAMP_BORDER +}; + +/*----------------------------------------------------------------------------*/ + +enum class E_ODbgMode { + LDR , + LDR_ALPHA , + HDR , + DEPTH , + __COUNT__ +}; diff --git a/utilities.cc b/c-utilities.cc similarity index 97% rename from utilities.cc rename to c-utilities.cc index 70220ca..9979bf0 100644 --- a/utilities.cc +++ b/c-utilities.cc @@ -1,5 +1,5 @@ #include "externals.hh" -#include "utilities.hh" +#include "c-utilities.hh" void updateAngle( diff --git a/utilities.hh b/c-utilities.hh similarity index 100% rename from utilities.hh rename to c-utilities.hh diff --git a/camera.cc b/camera.cc index 5580734..995c967 100644 --- a/camera.cc +++ b/camera.cc @@ -1,6 +1,6 @@ #include "externals.hh" #include "camera.hh" -#include "utilities.hh" +#include "c-utilities.hh" #include diff --git a/common.cc b/common.cc index 0c15dc2..4cca881 100644 --- a/common.cc +++ b/common.cc @@ -2,9 +2,8 @@ #include "common.hh" #include "c-filewatcher.hh" -#include "opcomp.hh" -#include "ops.hh" -#include "profiling.hh" +#include "c-opcomp.hh" +#include "c-ops.hh" #include "sync.hh" #include "undo.hh" @@ -14,7 +13,6 @@ namespace { struct CommonData_ { T_FilesWatcher watcher; - T_Profiler profiler; T_SyncManager sync; T_ScriptManager ops; T_UndoManager undo; @@ -43,9 +41,6 @@ void Common::Shutdown( ) noexcept T_FilesWatcher& Common::Watcher( ) noexcept { return M_GET_( watcher ); } -T_Profiler& Common::Profiler( ) noexcept - { return M_GET_( profiler ); } - T_SyncManager& Common::Sync( ) noexcept { return M_GET_( sync ); } diff --git a/common.hh b/common.hh index ebed83b..bc9b109 100644 --- a/common.hh +++ b/common.hh @@ -5,7 +5,6 @@ struct T_FilesWatcher; -struct T_Profiler; struct T_SyncManager; struct T_ScriptManager; class T_UndoManager; @@ -17,7 +16,6 @@ struct Common static void Shutdown( ) noexcept; static T_FilesWatcher& Watcher( ) noexcept; - static T_Profiler& Profiler( ) noexcept; static T_SyncManager& Sync( ) noexcept; static T_ScriptManager& Ops( ) noexcept; static T_UndoManager& Undo( ) noexcept; diff --git a/demo.cc b/demo.cc index cbb66b5..f06f6d4 100644 --- a/demo.cc +++ b/demo.cc @@ -1,10 +1,10 @@ #include "externals.hh" #include "demo.hh" #include "sync.hh" -#include "rendertarget.hh" #include "common.hh" -#include "opemu.hh" -#include "opcomp.hh" +#include "c-opcomp.hh" +#include "ui-opemu.hh" +#include "ui-rendertarget.hh" #include #include diff --git a/demo.hh b/demo.hh index e193d3f..e3ced13 100644 --- a/demo.hh +++ b/demo.hh @@ -1,6 +1,6 @@ #pragma once -#include "opcomp.hh" +#include "c-opcomp.hh" namespace ops { class T_OpContext; } diff --git a/main.cc b/main.cc index 482cd45..d476655 100644 --- a/main.cc +++ b/main.cc @@ -2,15 +2,15 @@ #include "ui-imgui-sdl.hh" #include "demo.hh" #include "common.hh" -#include "profiling.hh" -#include "shaders.hh" -#include "odbg.hh" -#include "opemu.hh" -#include "rendertarget.hh" #include "sync.hh" #include "ui.hh" #include "ui-app.hh" +#include "ui-odbg.hh" +#include "ui-opemu.hh" +#include "ui-profiling.hh" +#include "ui-rendertarget.hh" #include "ui-sequencer.hh" +#include "ui-shaders.hh" #include "ui-sync.hh" #include "ui-utilities.hh" #include "undo.hh" @@ -58,7 +58,7 @@ T_Main::T_Main( ) void T_Main::mainLoop( ) { - auto& p( Common::Profiler( ) ); + auto& p( UI::Profiler( ) ); while ( !done ) { auto const& dspSize( ImGui::GetIO( ).DisplaySize ); if ( prevSize.x != dspSize.x || prevSize.y != dspSize.y ) { @@ -124,7 +124,7 @@ void T_Main::initDemo( ) printf( "init w/ dspsize %dx%d\n" , int( dspSize.x ) , int( dspSize.y ) ); if ( demo->initialise( (uint32_t) dspSize.x , (uint32_t) dspSize.y ) ) { - Common::Profiler( ).clear( ); + UI::Profiler( ).clear( ); } } @@ -233,7 +233,7 @@ void T_Main::makeUI( ) MenuItemCheckbox( "Output debugger" , &UI::ODbg( ).uiEnabled( ) ); MenuItemCheckbox( "Profiler" , - &Common::Profiler( ).uiEnabled( ) ); + &UI::Profiler( ).uiEnabled( ) ); MenuItemCheckbox( "Sequencer" , &eSequencer ); MenuItemCheckbox( "Shaders" , &UI::Shaders( ).uiEnabled( ) ); @@ -248,7 +248,7 @@ void T_Main::makeUI( ) sequencer.clear( ); } - Common::Profiler( ).makeUI( ); + UI::Profiler( ).makeUI( ); UI::ODbg( ).makeUI( ); UI::Shaders( ).makeUI( ); UI::Sync( ).makeOverridesWindow( ); @@ -262,12 +262,12 @@ void T_Main::render( ) if ( demo ) { demo->render( ); - Common::Profiler( ).start( "Debug" ); + UI::Profiler( ).start( "Debug" ); T_Rendertarget::MainOutput( ); if ( UI::ODbg( ).isActive( ) ) { UI::ODbg( ).debugOutput( ); } - glFinish( ); Common::Profiler( ).end( "Debug" ); + glFinish( ); UI::Profiler( ).end( "Debug" ); } else { T_Rendertarget::MainOutput( ); diff --git a/parsercheck.cc b/parsercheck.cc index 3da315a..444eb74 100644 --- a/parsercheck.cc +++ b/parsercheck.cc @@ -1,7 +1,7 @@ #include "externals.hh" -#include "opast.hh" -#include "ops.hh" -#include "opcomp.hh" +#include "c-opast.hh" +#include "c-ops.hh" +#include "c-opcomp.hh" #include #include #include diff --git a/sync.hh b/sync.hh index 68d4e9d..f34d0ee 100644 --- a/sync.hh +++ b/sync.hh @@ -1,6 +1,5 @@ #pragma once #include "c-filewatcher.hh" -#include "utilities.hh" #include #include diff --git a/odbg.cc b/ui-odbg.cc similarity index 99% rename from odbg.cc rename to ui-odbg.cc index a8e2517..0546ac9 100644 --- a/odbg.cc +++ b/ui-odbg.cc @@ -1,6 +1,6 @@ #include "externals.hh" -#include "odbg.hh" #include "ui.hh" +#include "ui-odbg.hh" namespace { diff --git a/odbg.hh b/ui-odbg.hh similarity index 92% rename from odbg.hh rename to ui-odbg.hh index b95374e..2b9aa52 100644 --- a/odbg.hh +++ b/ui-odbg.hh @@ -1,15 +1,6 @@ #pragma once -#include "texture.hh" -#include "shaders.hh" - - -enum class E_ODbgMode { - LDR , - LDR_ALPHA , - HDR , - DEPTH , - __COUNT__ -}; +#include "ui-texture.hh" +#include "ui-shaders.hh" struct T_OutputDebugger diff --git a/opemu.cc b/ui-opemu.cc similarity index 98% rename from opemu.cc rename to ui-opemu.cc index 3681528..5b434a9 100644 --- a/opemu.cc +++ b/ui-opemu.cc @@ -1,9 +1,10 @@ #include "externals.hh" -#include "opemu.hh" #include "common.hh" #include "ui.hh" -#include "profiling.hh" -#include "rendertarget.hh" +#include "ui-odbg.hh" +#include "ui-opemu.hh" +#include "ui-profiling.hh" +#include "ui-rendertarget.hh" #include "sync.hh" using namespace ops; @@ -64,7 +65,7 @@ struct T_RunGuard ~T_RunGuard( ) { while ( !context.profiling.empty( ) ) { - Common::Profiler( ).end( context.profiling.last( ) ); + UI::Profiler( ).end( context.profiling.last( ) ); context.profiling.removeLast( ); } glUseProgram( 0 ); @@ -681,14 +682,14 @@ void T_OpContext::run( case OP_UI_PENTER: { T_String const& section( program.uiStrings[ instr.args[ 0 ] ] ); - Common::Profiler( ).start( section ); + UI::Profiler( ).start( section ); profiling.add( section ); break; } case OP_UI_PEXIT: glFinish( ); - Common::Profiler( ).end( profiling.last( ) ); + UI::Profiler( ).end( profiling.last( ) ); profiling.removeLast( ); break; diff --git a/opemu.hh b/ui-opemu.hh similarity index 96% rename from opemu.hh rename to ui-opemu.hh index 037d027..570a74a 100644 --- a/opemu.hh +++ b/ui-opemu.hh @@ -1,5 +1,7 @@ #pragma once -#include "ops.hh" +#include "c-ops.hh" +#include "ui-shaders.hh" +#include "ui-texture.hh" namespace ops { diff --git a/profiling.cc b/ui-profiling.cc similarity index 99% rename from profiling.cc rename to ui-profiling.cc index 8103acf..8e22091 100644 --- a/profiling.cc +++ b/ui-profiling.cc @@ -1,5 +1,5 @@ #include "externals.hh" -#include "profiling.hh" +#include "ui-profiling.hh" #include #include diff --git a/profiling.hh b/ui-profiling.hh similarity index 96% rename from profiling.hh rename to ui-profiling.hh index c4ff1df..f47849b 100644 --- a/profiling.hh +++ b/ui-profiling.hh @@ -1,5 +1,7 @@ #pragma once -#include "utilities.hh" +#ifndef REAL_BUILD +# include "externals.hh" +#endif struct T_ProfilerSamples diff --git a/rendertarget.cc b/ui-rendertarget.cc similarity index 98% rename from rendertarget.cc rename to ui-rendertarget.cc index 2ef5d32..91e6789 100644 --- a/rendertarget.cc +++ b/ui-rendertarget.cc @@ -1,5 +1,6 @@ #include "externals.hh" -#include "rendertarget.hh" +#include "ui-rendertarget.hh" +#include "ui-texture.hh" T_RendertargetSetup::T_RendertargetSetup( ) diff --git a/rendertarget.hh b/ui-rendertarget.hh similarity index 98% rename from rendertarget.hh rename to ui-rendertarget.hh index f719ac7..dfd04ae 100644 --- a/rendertarget.hh +++ b/ui-rendertarget.hh @@ -4,9 +4,9 @@ #endif #include -#include "texture.hh" +struct T_Texture; struct T_Rendertarget; diff --git a/shaders.cc b/ui-shaders.cc similarity index 99% rename from shaders.cc rename to ui-shaders.cc index 87159bf..641763f 100644 --- a/shaders.cc +++ b/ui-shaders.cc @@ -1,7 +1,7 @@ #include "externals.hh" -#include "shaders.hh" #include "common.hh" #include "ui.hh" +#include "ui-shaders.hh" #include "ui-utilities.hh" #include diff --git a/shaders.hh b/ui-shaders.hh similarity index 99% rename from shaders.hh rename to ui-shaders.hh index b916685..4f5e5d1 100644 --- a/shaders.hh +++ b/ui-shaders.hh @@ -1,6 +1,5 @@ #pragma once #include "c-filewatcher.hh" -#include "utilities.hh" /*= INPUT FILES ==============================================================*/ diff --git a/texture.cc b/ui-texture.cc similarity index 99% rename from texture.cc rename to ui-texture.cc index 33aa792..a000b44 100644 --- a/texture.cc +++ b/ui-texture.cc @@ -1,7 +1,7 @@ #include "externals.hh" -#include "texture.hh" #include "ui.hh" -#include "odbg.hh" +#include "ui-odbg.hh" +#include "ui-texture.hh" #include "ui-utilities.hh" diff --git a/texture.hh b/ui-texture.hh similarity index 91% rename from texture.hh rename to ui-texture.hh index 5a78873..09f9022 100644 --- a/texture.hh +++ b/ui-texture.hh @@ -1,32 +1,9 @@ #pragma once -#ifndef REAL_BUILD -# include "externals.hh" -#endif +#include "c-renderdefs.hh" struct T_OutputDebugger; - -enum class E_TexType { - RGBA8 , - RGBA16F , - RGB8 , - RGB16F , - R8 , - R16F , -}; - -enum class E_TexSampling { - NEAREST , - LINEAR , -}; - -enum class E_TexWrap { - REPEAT , - CLAMP_EDGE , - CLAMP_BORDER -}; - /*----------------------------------------------------------------------------*/ struct T_Texture diff --git a/ui.cc b/ui.cc index 253e355..75d6ff4 100644 --- a/ui.cc +++ b/ui.cc @@ -1,10 +1,11 @@ #include "externals.hh" -#include "odbg.hh" -#include "shaders.hh" -#include "texture.hh" #include "ui.hh" #include "ui-app.hh" +#include "ui-odbg.hh" +#include "ui-profiling.hh" +#include "ui-shaders.hh" #include "ui-sync.hh" +#include "ui-texture.hh" namespace { @@ -12,6 +13,7 @@ namespace { struct UIData_ { T_UIApp window; + T_Profiler profiler; T_TextureManager textures; T_ShaderManager shaders; T_OutputDebugger odbg; @@ -41,6 +43,9 @@ void UI::Shutdown( ) noexcept T_UIApp& UI::Main( ) noexcept { return M_GET_( window ); } +T_Profiler& UI::Profiler( ) noexcept + { return M_GET_( profiler ); } + T_TextureManager& UI::Textures( ) noexcept { return M_GET_( textures ); } diff --git a/ui.hh b/ui.hh index 93534a5..a649ac4 100644 --- a/ui.hh +++ b/ui.hh @@ -3,10 +3,11 @@ # include "externals.hh" #endif -struct T_UIApp; -struct T_TextureManager; -struct T_ShaderManager; struct T_OutputDebugger; +struct T_Profiler; +struct T_ShaderManager; +struct T_TextureManager; +struct T_UIApp; struct T_UISync; @@ -17,6 +18,7 @@ struct UI static void Shutdown( ) noexcept; static T_UIApp& Main( ) noexcept; + static T_Profiler& Profiler( ) noexcept; static T_TextureManager& Textures( ) noexcept; static T_ShaderManager& Shaders( ) noexcept; static T_OutputDebugger& ODbg( ) noexcept;