From c6bd84c356b6aaa029b9708d7b99a4aba1673b6b Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Sun, 24 Jul 2022 17:25:07 -0400 Subject: MSVC build support, some feature regression --- main.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 844a6f7..59d0e3a 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,3 @@ -#include #include #include #if WINDOWS @@ -6,6 +5,15 @@ #include #endif +// TODO(fox): Switch all thread code to SDL! +#if WINDOWS +#else +#if THREADED +#include +#else +#endif +#endif + #if ARM #include #else @@ -15,7 +23,11 @@ #include "imgui/imgui.h" #include "imgui/backends/imgui_impl_sdl.h" #include "imgui/backends/imgui_impl_opengl3.h" +#if WINDOWS +#include +#else #include +#endif #if defined(IMGUI_IMPL_OPENGL_ES2) #include #else @@ -104,7 +116,10 @@ SDL_sem *Semaphore; #include "effects.cpp" #include "keyframes.cpp" #include "layer.cpp" +#if THREADED #include "threading.cpp" +#else +#endif #include "prenderer.cpp" #include "video.cpp" #include "createcalls.cpp" @@ -416,7 +431,7 @@ int main(int argc, char *argv[]) { RenderInfo.File = &File; RenderInfo.State = &State; RenderInfo.CompBuffer = &CompBuffer; - +#if THREADED thread_info ThreadInfo[7]; for (int i = 0; i < 7; i++) { @@ -425,7 +440,7 @@ int main(int argc, char *argv[]) { ThreadInfo[i].RenderInfo = &RenderInfo; thread[i] = SDL_CreateThread(TestThread, str, &ThreadInfo[i]); } - +#endif sdl_input Input; sdl_input OldInput; @@ -564,6 +579,7 @@ int main(int argc, char *argv[]) { State.UpdateFrame = 0; } +#if THREADED if (IsRendering) { while (CompletedJobs != 16) { CheckQueue(RenderInfo, 8); @@ -586,6 +602,18 @@ int main(int argc, char *argv[]) { } } +#else +#if PACKEDRGB + Unpack4x4Chunk(&CompBuffer); + // SSE_CopyToBuffer(CompBuffer); +#else + PackBitmapRGB(&CompBuffer); +#endif + EndRenderState(&State); + glBindTexture(GL_TEXTURE_2D, textureID); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, CompBuffer.Width, CompBuffer.Height, GL_RGBA, GL_UNSIGNED_BYTE, + CompBuffer.EffectBuffer); +#endif ImGui::Render(); glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); -- cgit v1.2.3