diff options
author | Fox Caminiti <fox@foxcam.net> | 2022-07-24 17:25:07 -0400 |
---|---|---|
committer | Fox Caminiti <fox@foxcam.net> | 2022-07-24 17:25:07 -0400 |
commit | c6bd84c356b6aaa029b9708d7b99a4aba1673b6b (patch) | |
tree | 453e34e4f532d3f7c100023f499188ff70f178f3 /main.cpp | |
parent | 3e399d7f2f37feb10e120d7c5950615ffb350a84 (diff) |
MSVC build support, some feature regression
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
@@ -1,4 +1,3 @@ -#include <pthread.h> #include <unistd.h> #include <stdio.h> #if WINDOWS @@ -6,6 +5,15 @@ #include <sys/mman.h> #endif +// TODO(fox): Switch all thread code to SDL! +#if WINDOWS +#else +#if THREADED +#include <pthread.h> +#else +#endif +#endif + #if ARM #include <arm_neon.h> #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 <SDL.h> +#else #include <SDL2/SDL.h> +#endif #if defined(IMGUI_IMPL_OPENGL_ES2) #include <SDL_opengles2.h> #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); |