fix(render): FB erased eroneously

In the render thread, we cleared the FB to fix the beeper test, but that broke several other tests that drew to the screen before the fb was properly set, this pr fixes that issue, and the render thread works properly for all tests.
This commit is contained in:
Zoe
2025-02-07 16:04:37 +00:00
parent b005ee2556
commit b717570cb2

View File

@@ -185,7 +185,7 @@ class Chip8 {
return this->fb[y][x]; return this->fb[y][x];
} }
bool fb[SCREEN_HEIGHT][SCREEN_WIDTH]; bool fb[SCREEN_HEIGHT][SCREEN_WIDTH] = {};
std::atomic_uint8_t delay; std::atomic_uint8_t delay;
std::atomic_uint8_t sound_timer; std::atomic_uint8_t sound_timer;
std::mutex key_mutex; std::mutex key_mutex;
@@ -252,8 +252,6 @@ void render_thread(Chip8 *chip8) {
SDL_TEXTUREACCESS_STREAMING, SDL_TEXTUREACCESS_STREAMING,
SCREEN_WIDTH, SCREEN_HEIGHT); SCREEN_WIDTH, SCREEN_HEIGHT);
memset(chip8->fb, 0, SCREEN_WIDTH * SCREEN_HEIGHT);
while (true) { while (true) {
printf("Rendering...\n"); printf("Rendering...\n");
draw(renderer, texture, chip8); draw(renderer, texture, chip8);