General changes.
This commit is contained in:
+6
-8
@@ -12,7 +12,7 @@
|
|||||||
#include <unistd.h> // close, read
|
#include <unistd.h> // close, read
|
||||||
|
|
||||||
// NOTE: This is so it compiles on ARM.
|
// NOTE: This is so it compiles on ARM.
|
||||||
#if __x86_64__ || __i386__
|
#if __x86_64__ || __i386__
|
||||||
#include <x86intrin.h>
|
#include <x86intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -342,7 +342,6 @@ S32 main(int argc, char *argv[])
|
|||||||
SDLResizeTexture(&GlobalBackbuffer, Renderer, Dimension.Width, Dimension.Height);
|
SDLResizeTexture(&GlobalBackbuffer, Renderer, Dimension.Width, Dimension.Height);
|
||||||
|
|
||||||
sdl_sound_output SoundOutput = {0};
|
sdl_sound_output SoundOutput = {0};
|
||||||
|
|
||||||
SoundOutput.SamplesPerSecond = 48000;
|
SoundOutput.SamplesPerSecond = 48000;
|
||||||
SoundOutput.BytesPerSample = sizeof(S16) * 2;
|
SoundOutput.BytesPerSample = sizeof(S16) * 2;
|
||||||
SoundOutput.SecondaryBufferSize = SoundOutput.SamplesPerSecond * SoundOutput.BytesPerSample;
|
SoundOutput.SecondaryBufferSize = SoundOutput.SamplesPerSecond * SoundOutput.BytesPerSample;
|
||||||
@@ -368,8 +367,7 @@ S32 main(int argc, char *argv[])
|
|||||||
GameMemory.TransientStorageSize = GB(4);
|
GameMemory.TransientStorageSize = GB(4);
|
||||||
U64 TotalStorageSize = GameMemory.PermanentStorageSize + GameMemory.TransientStorageSize;
|
U64 TotalStorageSize = GameMemory.PermanentStorageSize + GameMemory.TransientStorageSize;
|
||||||
|
|
||||||
// NOTE: On MacOS and Linux, mmap seems to zero-fill anonymous
|
// NOTE: On MacOS and Linux, mmap seems to zero-fill anonymous memory as a side-effect of security.
|
||||||
// memory as a side-effect of security.
|
|
||||||
GameMemory.PermanentStorage = mmap(BaseAddress, TotalStorageSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
|
GameMemory.PermanentStorage = mmap(BaseAddress, TotalStorageSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||||
GameMemory.TransientStorage = (U8 *)(GameMemory.PermanentStorage) + GameMemory.PermanentStorageSize;
|
GameMemory.TransientStorage = (U8 *)(GameMemory.PermanentStorage) + GameMemory.PermanentStorageSize;
|
||||||
|
|
||||||
@@ -382,14 +380,14 @@ S32 main(int argc, char *argv[])
|
|||||||
GlobalPerfCountFrequency = SDL_GetPerformanceFrequency();
|
GlobalPerfCountFrequency = SDL_GetPerformanceFrequency();
|
||||||
|
|
||||||
U64 LastCounter;
|
U64 LastCounter;
|
||||||
#if __x86_64__ || __i386__
|
#if __x86_64__ || __i386__
|
||||||
U64 LastCycleCount;
|
U64 LastCycleCount;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(GlobalRunning) {
|
while(GlobalRunning) {
|
||||||
LastCounter = SDLGetWallClock();
|
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.
|
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.
|
#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->Start, SDL_CONTROLLER_BUTTON_START, &NewController->Start);
|
||||||
SDLProcessInputDigitalButton(ControllerHandles[ControllerIndex], &OldController->Back, SDL_CONTROLLER_BUTTON_BACK, &NewController->Back);
|
SDLProcessInputDigitalButton(ControllerHandles[ControllerIndex], &OldController->Back, SDL_CONTROLLER_BUTTON_BACK, &NewController->Back);
|
||||||
} else {
|
} else {
|
||||||
// NOTE: This controller is note plugged in.
|
// NOTE: This controller is not plugged in.
|
||||||
NewController->IsConnected = false;
|
NewController->IsConnected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -506,7 +504,7 @@ S32 main(int argc, char *argv[])
|
|||||||
|
|
||||||
LastCounter = EndCounter;
|
LastCounter = EndCounter;
|
||||||
|
|
||||||
#if __x86_64__ || __i386__
|
#if __x86_64__ || __i386__
|
||||||
U64 EndCycleCount = __rdtsc();
|
U64 EndCycleCount = __rdtsc();
|
||||||
U64 CyclesElapsed = EndCycleCount - LastCycleCount;
|
U64 CyclesElapsed = EndCycleCount - LastCycleCount;
|
||||||
F64 MCPF = ((F64)CyclesElapsed / (1000.0f * 1000.0f));
|
F64 MCPF = ((F64)CyclesElapsed / (1000.0f * 1000.0f));
|
||||||
|
|||||||
Reference in New Issue
Block a user