Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit ed44767

Browse files
avx
1 parent f05c415 commit ed44767

File tree

8 files changed

+28
-15
lines changed

8 files changed

+28
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
88

99
if(WIN32)
1010
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
11+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX")
1112
endif()
1213

1314
# =============
1415
# == OPTIONS ==
1516
# =============
16-
option(OFS_BENCHMARKS OFF)
1717
option(OFS_PROFILE OFF)
1818

1919
# ====================

OFS-lib/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,10 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC
103103
"IMGUI_IMPL_OPENGL_LOADER_GLAD2"
104104
)
105105

106-
if(OFS_BENCHMARKS)
107-
target_compile_definitions(${PROJECT_NAME} PUBLIC OFS_BENCHMARK_ENABLED=1)
108-
else()
109-
target_compile_definitions(${PROJECT_NAME} PUBLIC OFS_BENCHMARK_ENABLED=0)
110-
endif()
111-
112106
if(OFS_PROFILE)
113107
target_compile_definitions(${PROJECT_NAME} PUBLIC OFS_PROFILE_ENABLED=1)
114108
target_link_libraries(${PROJECT_NAME} PUBLIC tracy)
109+
message("== ${PROJECT_NAME} - Profiling enabled.")
115110
else()
116111
target_compile_definitions(${PROJECT_NAME} PUBLIC OFS_PROFILE_ENABLED=0)
117112
endif()

OFS-lib/OFS_FileLogging.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void OFS_FileLogger::Shutdown() noexcept
8484

8585
inline static void LogToConsole(OFS_LogLevel level, const char* msg) noexcept
8686
{
87+
OFS_PROFILE(__FUNCTION__);
8788
switch(level) {
8889
case OFS_LogLevel::OFS_LOG_INFO: SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, msg); break;
8990
case OFS_LogLevel::OFS_LOG_WARN: SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, msg); break;
@@ -93,13 +94,15 @@ inline static void LogToConsole(OFS_LogLevel level, const char* msg) noexcept
9394
}
9495

9596
inline static void AppendToBuf(std::vector<char>& buffer, const char* msg, uint32_t size) noexcept {
97+
OFS_PROFILE(__FUNCTION__);
9698
auto initialSize = buffer.size();
9799
buffer.resize(initialSize + size);
98100
memcpy(buffer.data() + initialSize, msg, size);
99101
};
100102

101103
inline static void AddNewLine() noexcept
102104
{
105+
OFS_PROFILE(__FUNCTION__);
103106
// insert a newline if needed
104107
auto& buffer = Thread.LogMsgBuffer;
105108
if(!buffer.empty() && buffer.back() != '\n') {
@@ -110,6 +113,7 @@ inline static void AddNewLine() noexcept
110113

111114
void OFS_FileLogger::LogToFileR(const char* prefix, const char* msg, bool newLine) noexcept
112115
{
116+
OFS_PROFILE(__FUNCTION__);
113117
SDL_Log("%s %s", prefix, msg);
114118
SDL_AtomicLock(&Thread.lock);
115119

@@ -126,6 +130,7 @@ void OFS_FileLogger::LogToFileR(const char* prefix, const char* msg, bool newLin
126130

127131
void OFS_FileLogger::LogToFileR(OFS_LogLevel level, const char* msg, uint32_t size, bool newLine) noexcept
128132
{
133+
OFS_PROFILE(__FUNCTION__);
129134
LogToConsole(level, msg);
130135
SDL_AtomicLock(&Thread.lock);
131136

@@ -172,6 +177,7 @@ void OFS_FileLogger::Flush() noexcept
172177

173178
void OFS_FileLogger::LogToFileF(OFS_LogLevel level, const char* fmt, ...) noexcept
174179
{
180+
OFS_PROFILE(__FUNCTION__);
175181
char FormatBuffer[1024];
176182
va_list args;
177183
va_start(args, fmt);

OFS-lib/UI/OFS_Videoplayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void VideoplayerWindow::renderToTexture() noexcept
206206
{
207207
OFS_PROFILE(__FUNCTION__);
208208
redrawVideo = false;
209-
mpv_opengl_fbo fbo{ 0 };
209+
mpv_opengl_fbo fbo = {0};
210210
fbo.fbo = framebufferObj;
211211
fbo.w = MpvData.videoWidth;
212212
fbo.h = MpvData.videoHeight;
@@ -314,7 +314,7 @@ bool VideoplayerWindow::setup(bool force_hw_decoding)
314314
mpv_request_log_messages(mpv, "info");
315315
#endif
316316

317-
mpv_opengl_init_params init_params{ 0 };
317+
mpv_opengl_init_params init_params = {0};
318318
init_params.get_proc_address = getProcAddressMpv;
319319

320320
uint32_t enable = 1;

lib/tracy

Submodule tracy updated 115 files

src/OpenFunscripter.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,10 +1815,11 @@ void OpenFunscripter::step() noexcept {
18151815
ImGui::End();
18161816
}
18171817

1818+
#ifndef NDEBUG
18181819
if (DebugDemo) {
18191820
ImGui::ShowDemoWindow(&DebugDemo);
18201821
}
1821-
1822+
#endif
18221823
if (DebugMetrics) {
18231824
ImGui::ShowMetricsWindow(&DebugMetrics);
18241825
}
@@ -2073,7 +2074,7 @@ void OpenFunscripter::saveHeatmap(const char* path, int width, int height)
20732074
const bool mustLock = SDL_MUSTLOCK(surface);
20742075
if (mustLock) { SDL_LockSurface(surface); }
20752076

2076-
SDL_Rect rect{ 0 };
2077+
SDL_Rect rect = {0};
20772078
rect.h = height;
20782079

20792080
const float relStep = 1.f / width;
@@ -2769,8 +2770,10 @@ void OpenFunscripter::ShowMainMenuBar() noexcept
27692770
"\0");
27702771
ImGui::Separator();
27712772
if (ImGui::BeginMenu("DEBUG ONLY")) {
2772-
if (ImGui::MenuItem("ImGui", NULL, &DebugMetrics)) {}
2773+
if (ImGui::MenuItem("Metrics", NULL, &DebugMetrics)) {}
2774+
#ifndef NDEBUG
27732775
if (ImGui::MenuItem("ImGui Demo", NULL, &DebugDemo)) {}
2776+
#endif
27742777
ImGui::EndMenu();
27752778
}
27762779
ImGui::EndMenu();
@@ -2995,7 +2998,7 @@ bool OpenFunscripter::ShowMetadataEditorWindow(bool* open) noexcept
29952998
}
29962999

29973000
void OpenFunscripter::SetFullscreen(bool fullscreen) {
2998-
static SDL_Rect restoreRect{ 0,0, 1280,720 };
3001+
static SDL_Rect restoreRect = {0, 0, 1280, 720};
29993002
if (fullscreen) {
30003003
SDL_GetWindowPosition(window, &restoreRect.x, &restoreRect.y);
30013004
SDL_GetWindowSize(window, &restoreRect.w, &restoreRect.h);

src/OpenFunscripter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ class OpenFunscripter {
4343

4444
bool ShowMetadataEditor = false;
4545
bool ShowProjectEditor = false;
46-
bool DebugMetrics = false;
46+
#ifndef NDEBUG
4747
bool DebugDemo = false;
48+
#endif
49+
bool DebugMetrics = false;
4850
bool ShowAbout = false;
4951

5052
std::vector<FunscriptAction> CopiedSelection;

src/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
int main(int argc, char* argv[])
44
{
5+
#ifdef WIN32
6+
if(!SDL_HasAVX()) {
7+
Util::MessageBoxAlert("Missing AVX support", "CPU doesn't support AVX.");
8+
SDL_Delay(3000);
9+
return -1;
10+
}
11+
#endif
512
OpenFunscripter app;
613
app.setup(argc, argv);
714
int code = app.run();

0 commit comments

Comments
 (0)