diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-02-25 16:17:03 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-02-25 16:17:03 +0100 |
commit | f7da5b7dde8b9c342c805edd65e66febf705ed48 (patch) | |
tree | 51e23994d8c3b686d70ac1d9d99f539bd0c26ef2 /src/ppusim/sim.c | |
parent | 0d7bd92672acb449761def9e234934c4a9a05129 (diff) |
limit thread count to core count
Diffstat (limited to 'src/ppusim/sim.c')
-rw-r--r-- | src/ppusim/sim.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c index 4226a9b..2816b31 100644 --- a/src/ppusim/sim.c +++ b/src/ppusim/sim.c @@ -1,6 +1,5 @@ #include <stdlib.h> #include <stdbool.h> -#include <math.h> #include <SDL2/SDL.h> #include "main.h" @@ -17,11 +16,15 @@ void hh_ppu_init() { g_hh_window = SDL_CreateWindow("ppusim", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, HH_PPU_SCREEN_WIDTH * HH_PPUSIM_UPSCALE_FACTOR, HH_PPU_SCREEN_HEIGHT * HH_PPUSIM_UPSCALE_FACTOR, SDL_WINDOW_SHOWN); g_hh_renderer = SDL_CreateRenderer(g_hh_window, -1, SDL_RENDERER_ACCELERATED); + g_hh_ppusim_core_count = SDL_GetCPUCount(); + g_hh_ppusim_threads = malloc(sizeof(pthread_t) * g_hh_ppusim_core_count); + g_hh_ppusim_vram = malloc(sizeof(hh_ppu_data_t) * 0xffff); memset(g_hh_ppusim_vram, 0x0000, 0xffff); } void hh_ppu_deinit() { + free(g_hh_ppusim_threads); free(g_hh_ppusim_vram); SDL_DestroyRenderer(g_hh_renderer); |