General changes.

This commit is contained in:
2026-03-14 21:45:18 -07:00
parent dd0e4bd14f
commit ace09a223f
+6 -8
View File
@@ -12,7 +12,7 @@
#include <unistd.h> // close, read
// NOTE: This is so it compiles on ARM.
#if __x86_64__ || __i386__
#if __x86_64__ || __i386__
#include <x86intrin.h>
#endif
@@ -342,7 +342,6 @@ S32 main(int argc, char *argv[])
SDLResizeTexture(&GlobalBackbuffer, Renderer, Dimension.Width, Dimension.Height);
sdl_sound_output SoundOutput = {0};
SoundOutput.SamplesPerSecond = 48000;
SoundOutput.BytesPerSample = sizeof(S16) * 2;
SoundOutput.SecondaryBufferSize = SoundOutput.SamplesPerSecond * SoundOutput.BytesPerSample;
@@ -368,8 +367,7 @@ S32 main(int argc, char *argv[])
GameMemory.TransientStorageSize = GB(4);
U64 TotalStorageSize = GameMemory.PermanentStorageSize + GameMemory.TransientStorageSize;
// NOTE: On MacOS and Linux, mmap seems to zero-fill anonymous
// memory as a side-effect of security.
// NOTE: On MacOS and Linux, mmap seems to zero-fill anonymous memory as a side-effect of security.
GameMemory.PermanentStorage = mmap(BaseAddress, TotalStorageSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
GameMemory.TransientStorage = (U8 *)(GameMemory.PermanentStorage) + GameMemory.PermanentStorageSize;
@@ -382,14 +380,14 @@ S32 main(int argc, char *argv[])
GlobalPerfCountFrequency = SDL_GetPerformanceFrequency();
U64 LastCounter;
#if __x86_64__ || __i386__
#if __x86_64__ || __i386__
U64 LastCycleCount;
#endif
while(GlobalRunning) {
LastCounter = SDLGetWallClock();
#if __x86_64__ || __i386__
#if __x86_64__ || __i386__
LastCycleCount = __rdtsc(); // NOTE: rdtsc reports clock cylces, however it is not meant for really precise profiler work as the value returned is varied.
#endif // Also, __rdtsc is not available on MacOS ARM; I have not checked MacOS x64.
@@ -463,7 +461,7 @@ S32 main(int argc, char *argv[])
SDLProcessInputDigitalButton(ControllerHandles[ControllerIndex], &OldController->Start, SDL_CONTROLLER_BUTTON_START, &NewController->Start);
SDLProcessInputDigitalButton(ControllerHandles[ControllerIndex], &OldController->Back, SDL_CONTROLLER_BUTTON_BACK, &NewController->Back);
} else {
// NOTE: This controller is note plugged in.
// NOTE: This controller is not plugged in.
NewController->IsConnected = false;
}
}
@@ -506,7 +504,7 @@ S32 main(int argc, char *argv[])
LastCounter = EndCounter;
#if __x86_64__ || __i386__
#if __x86_64__ || __i386__
U64 EndCycleCount = __rdtsc();
U64 CyclesElapsed = EndCycleCount - LastCycleCount;
F64 MCPF = ((F64)CyclesElapsed / (1000.0f * 1000.0f));