itfrombit / osx_handmade_minimal

Mirror repository of https://github.com/itfrombit/osx_handmade
27 stars 6 forks source link

Doesn't compile on 10.7.5 #3

Closed nsenica closed 9 years ago

nsenica commented 9 years ago

Hi Jeff

It works perfectly in 10.10.X, however I've tried compiling on 10.7.5 and I get the following output:

clang -O3 -Wall -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -DHANDMADE_MIN_OSX -Wno-null-dereference -std=c++11 -stdlib=libc++ -Wno-c++11-compat-deprecated-writable-strings -Wno-tautological-compare -Wno-missing-braces -Wno-unused-variable -Wno-unused-function -c handmade.cpp
handmade.cpp:545:71: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
            DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_background.bmp");
                                                                      ^
handmade.cpp:547:71: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
            DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_shadow.bmp");
                                                                      ^
handmade.cpp:549:71: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
            DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test2/tree00.bmp");
                                                                      ^
handmade.cpp:551:71: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
            DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test2/rock03.bmp");
                                                                      ^
handmade.cpp:556:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Head = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_right_head.bmp");
                                                                                 ^
handmade.cpp:557:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Cape = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_right_cape.bmp");
                                                                                 ^
handmade.cpp:558:83: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Torso = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_right_torso.bmp");
                                                                                  ^
handmade.cpp:562:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Head = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_back_head.bmp");
                                                                                 ^
handmade.cpp:563:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Cape = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_back_cape.bmp");
                                                                                 ^
handmade.cpp:564:83: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Torso = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_back_torso.bmp");
                                                                                  ^
handmade.cpp:568:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Head = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_left_head.bmp");
                                                                                 ^
handmade.cpp:569:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Cape = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_left_cape.bmp");
                                                                                 ^
handmade.cpp:570:83: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Torso = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_left_torso.bmp");
                                                                                  ^
handmade.cpp:574:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Head = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_front_head.bmp");
                                                                                 ^
handmade.cpp:575:82: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Cape = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_front_cape.bmp");
                                                                                 ^
handmade.cpp:576:83: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        Bitmap->Torso = DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_hero_front_torso.bmp");
                                                                                  ^
16 warnings generated.
clang -O3 -Wall -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -DHANDMADE_MIN_OSX -Wno-null-dereference -dynamiclib -o libhandmade.dylib handmade.o
clang -O3 -Wall -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -DHANDMADE_MIN_OSX -Wno-null-dereference -c osx_main.mm
clang -O3 -Wall -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -DHANDMADE_MIN_OSX -Wno-null-dereference -c osx_handmade.cpp
clang -O3 -Wall -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -DHANDMADE_MIN_OSX -Wno-null-dereference -c HandmadeView.mm
HandmadeView.mm:239:24: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
        HandmadeView* view = (__bridge HandmadeView*)context;
                              ^~~~~~~~
HandmadeView.mm:246:41: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
        NSLog(@"Gamepad was detected: %@ %@", (__bridge NSString*)manufacturerCFSR, (__bridge NSString*)productCFSR);
                                               ^~~~~~~~
HandmadeView.mm:246:79: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
        NSLog(@"Gamepad was detected: %@ %@", (__bridge NSString*)manufacturerCFSR, (__bridge NSString*)productCFSR);
                                                                                     ^~~~~~~~
HandmadeView.mm:249:23: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
        NSArray *elements = (__bridge NSArray *)IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
                             ^~~~~~~~
HandmadeView.mm:253:39: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
                IOHIDElementRef tIOHIDElementRef = (__bridge IOHIDElementRef)element;
                                                    ^~~~~~~~
HandmadeView.mm:372:24: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
        HandmadeView* view = (__bridge HandmadeView*)context;
                              ^~~~~~~~
HandmadeView.mm:765:25: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
    CVReturn result = [(__bridge HandmadeView*)displayLinkContext getFrameForTime:outputTime];
                        ^~~~~~~~
HandmadeView.mm:716:55: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
                IOHIDManagerSetDeviceMatchingMultiple(_hidManager, (__bridge CFArrayRef)criteria);
                                                                    ^~~~~~~~
HandmadeView.mm:717:73: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
                IOHIDManagerRegisterDeviceMatchingCallback(_hidManager, OSXHIDAdded, (__bridge void*)self);
                                                                                      ^~~~~~~~
HandmadeView.mm:718:74: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
                IOHIDManagerRegisterDeviceRemovalCallback(_hidManager, OSXHIDRemoved, (__bridge void*)self);
                                                                                       ^~~~~~~~
HandmadeView.mm:723:71: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
                        IOHIDManagerRegisterInputValueCallback(_hidManager, OSXHIDAction, (__bridge void*)self);
                                                                                           ^~~~~~~~
HandmadeView.mm:1038:77: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
        CVDisplayLinkSetOutputCallback(_displayLink, &GLXViewDisplayLinkCallback, (__bridge void *)(self));
                                                                                   ^~~~~~~~
HandmadeView.mm:1040:16: error: cannot initialize a variable of type 'CGLContextObj' (aka '_CGLContextObject *') with an rvalue of type 'void *'
        CGLContextObj cglContext = [[self openGLContext] CGLContextObj];
                      ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HandmadeView.mm:1041:20: error: cannot initialize a variable of type 'CGLPixelFormatObj' (aka '_CGLPixelFormatObject *') with an rvalue of type 'void *'
        CGLPixelFormatObj cglPixelFormat = [[self pixelFormat] CGLPixelFormatObj];
                          ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HandmadeView.mm:1071:2: error: no matching function for call to 'CGLLockContext'
        CGLLockContext([[self openGLContext] CGLContextObj]);
        ^~~~~~~~~~~~~~
/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:132:17: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'CGLContextObj' (aka '_CGLContextObject *')
extern CGLError CGLLockContext(CGLContextObj ctx) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
                ^
HandmadeView.mm:1264:5: error: no matching function for call to 'CGLFlushDrawable'
    CGLFlushDrawable([[self openGLContext] CGLContextObj]);
    ^~~~~~~~~~~~~~~~
/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:101:17: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'CGLContextObj' (aka '_CGLContextObject *')
extern CGLError CGLFlushDrawable(CGLContextObj ctx);
                ^
HandmadeView.mm:1265:5: error: no matching function for call to 'CGLUnlockContext'
    CGLUnlockContext([[self openGLContext] CGLContextObj]);
    ^~~~~~~~~~~~~~~~
/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:134:17: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'CGLContextObj' (aka '_CGLContextObject *')
extern CGLError CGLUnlockContext(CGLContextObj ctx) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
                ^
12 warnings and 5 errors generated.
make: *** [HandmadeView.o] Error 1

I did a couple of changes to cast the objects, but after that it runs but it only shows a white background and nothing else.

diff --git a/HandmadeView.mm b/HandmadeView.mm
index badffeb..52eb9e5 100644
--- a/HandmadeView.mm
+++ b/HandmadeView.mm
@@ -1037,8 +1037,8 @@ static CVReturn GLXViewDisplayLinkCallback(CVDisplayLinkRef displayLink,
        CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
        CVDisplayLinkSetOutputCallback(_displayLink, &GLXViewDisplayLinkCallback, (__bridge void *)(self));

- CGLContextObj cglContext = [[self openGLContext] CGLContextObj];
- CGLPixelFormatObj cglPixelFormat = [[self pixelFormat] CGLPixelFormatObj];
+       CGLContextObj cglContext = (CGLContextObj) [[self openGLContext] CGLContextObj];
+       CGLPixelFormatObj cglPixelFormat = (CGLPixelFormatObj) [[self pixelFormat] CGLPixelFormatObj];
        CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(_displayLink, cglContext, cglPixelFormat);

        CVTime cvtime = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(_displayLink);
@@ -1064,7 +1064,7 @@ static CVReturn GLXViewDisplayLinkCallback(CVDisplayLinkRef displayLink,
        // main thread, so lock the context from simultaneous access during a resize.

        // TODO(jeff): Tighten up this GLContext lock
- CGLLockContext([[self openGLContext] CGLContextObj]);
+       CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);

        //uint64 LastCycleCount = rdtsc();
@@ -1258,8 +1258,8 @@ static CVReturn GLXViewDisplayLinkCallback(CVDisplayLinkRef displayLink,
     glDisableClientState(GL_VERTEX_ARRAY);
     glDisableClientState(GL_TEXTURE_COORD_ARRAY);

-    CGLFlushDrawable([[self openGLContext] CGLContextObj]);
-    CGLUnlockContext([[self openGLContext] CGLContextObj]);
+    CGLFlushDrawable((CGLContextObj) [[self openGLContext] CGLContextObj]);
+    CGLUnlockContext((CGLContextObj) [[self openGLContext] CGLContextObj]);

Do you know what's causing this ? Is there any easy fix ?

Thanks Nuno

itfrombit commented 9 years ago

Hi Nuno,

Thanks for the detailed report! I installed the 10.7 SDK and reproduced your compiler errors. The casts are okay. I think compiling in Obj-C++ mode might have caused those warnings under 10.7.

The 10.7 SDK-compiled app runs okay for me, although I'm running it on 10.10.

Question: Do you see an error message "No OpenGL pixel format" on the command line (or in the console) when you start the app? That might be why you're seeing a white screen. I'm thinking that if you're running 10.7, you might be on older hardware and your GPU might not support the pixel format I'm trying to use. Karl Kirch pointed this out, but I hadn't run across it yet. See details here: https://github.com/itfrombit/osx_handmade/issues/4. Try commenting out the DoubleBuffer and Accelerated attributes to see if that fixes it. If not, I'll put in some more diagnostics for you and dig a little deeper.

Thanks, Jeff

nsenica commented 9 years ago

Hi Jeff

Thanks for replying back :) I didn't even thank you for the work you're putting into this, and that's what I'd like to do in the first place.. A BIG thank you, it allows people like myself who don't use windows to be able to follow this amazing "show" and test some bits and pieces meanwhile.

I'm not entirely sure what's happening, but I do have more information.

I'm quite new to Obj-C++ so most of the syntax is new to me, and this is also the first time I'm actually looking at video/audio code so please bear with me :) I've researched a bit and found out that the proper way to cast it would be to use static_cast(), if that's harmless to 10.10 I can easily make a pull request with those changes.

Regarding the error message you mention I don't see anything related to that. I'm running a Early 2007 MacBook Pro 15", which has a ATI Radeon X1600 128 MB and I believe there is no problem with the GPU capabilities.

Another thing that came to my attention was these errors: fcntl error on ReplayBuffer[0]: 28: No space left on device fcntl error on ReplayBuffer[1]: 28: No space left on device fcntl error on ReplayBuffer[2]: 28: No space left on device fcntl error on ReplayBuffer[3]: 28: No space left on device

And I think this is why I'm getting a white background. I'll try to go deeper on this, but if you have any idea, I'd love to hear :)

Thank you very much Nuno

nsenica commented 9 years ago

Those No space left on device come from the part where the fcntl pre allocates the memory for the ReplyBuffers, I saw in the code that there was an alternative path, which I use and now I don't get any errors but I still get the white background.

I also tried commenting out the attributes and I saw no difference in the end result.

I'm not sure exactly what to debug next :)

itfrombit commented 9 years ago

Hi Nuno,

Thanks for the additional information and for testing out the attributes changes. And yeah, static_cast is a better way to go, although it probably wouldn't make a difference in this particular case.

I dug out an old MacBook Air that I had sitting around with Snow Leopard on it. I'm putting Lion and Xcode 4.3.3 with the 10.7 SDK on it, so hopefully I'll be able to reproduce the issue that you're seeing and track down an answer for you. I'll keep you posted.

Thanks, -Jeff

nsenica commented 9 years ago

Hi Jeff..

I really appreciate that extra effort, I'm hoping you can debug it :)

I was trying to compile it all with ARC but it didn't work either, it segfaults right at the start :)

Let's hope you get more insights on the problem.

Thanks a lot Nuno

itfrombit commented 9 years ago

Hi Nuno,

I tried compiling and running under 10.7.4 and 10.7.5 and (unfortunately, I guess) both worked okay for me using Casey's day_076 code, so there must be something else going on. I used the xcode462_cltools_10_7_76938260a.dmg disk image from Apple's developer downloads for the clang command line tools and the SDK. That was the latest 10.7 SDK that I found on Apple's developer site.

Is there any chance that you are very low on disk space on that machine? The fcntl errors you reported are suspicious. Weird things happen when the disk fills. :)

The only other easy thing I can think of off the top of my head is if Casey's artwork directories are missing from your development directory (test and test2). The command line makefile will report an error, but will still build the application bundle. In that case though, I think you would be seeing a blank black screen.

I'm still guessing that some part of OpenGL or CVDisplayLink initialization is failing for you. I can put some additional diagnostics in the code to log errors.

-Jeff

nsenica commented 9 years ago

Hi Jeff

Low disk space was my first assumption but that is not the case, I have more than 7 GB of disk space available. I also thought it could be something related with the amount of free memory but I made sure to have around 2GB of Free Memory and the problem persisted.

Artwork directories are there and also copied to the Handmake.app/Contents/Resources dir when creating the bundle, I added some debug to check if that could be the case and I can see that the ContentsSize report the correct size, so I suspect that it not the problem :) I also suspect that this is something related with either OpenGL or CVDisplayLink, because the whole game seems to work properly as it is responsive to keyboard input, toggling full screen works fine, the window is created properly, all working as it should except that I can only see a white screen :)

I'm going to try and download that disk image today and I'll test with it, maybe there's something weird with the version I'm running, I don't know.

At this precise moment I'm at work and I only have a 10.10 :D but as soon as I get home later on I'll do these tests and report back to you.

Thanks a lot once again for the effort on trying to help me out.

Regards, Nuno

itfrombit commented 9 years ago

The normal code path of using fcntl for the ReplayBuffers asks for contiguous disk space, so with only 7GB available, it's possible that it couldn't allocate four 128MB contiguous chunks of disk. The lseek code path doesn't ask for contiguous chunks, so that's probably why that worked.

I'm adding some more diagnostics to the graphics initialization. Maybe that will help track down the problem.

Jeff

nsenica commented 9 years ago

I'll free up some space and I'll try again :) It might be it actually.

nsenica commented 9 years ago

Hi Jeff

Update:

Once you're done adding diagnostics to it, I'll be more than happy to try it out :)

Thanks a lot for all the support.

Nuno

itfrombit commented 9 years ago

Hi Nuno,

I added some diagnostics to the OpenGL and CVDisplayLink initialization code. The easiest way to see the debug output in your command line terminal is to run the application like this (instead of opening Handmade.app): ./handmade

I also added an OpenGL fallback mode in case the accelerated version doesn't work with your GPU.

Hopefully, this will give us some insight. Jeff

nsenica commented 9 years ago

Hi Jeff

First of all, thank you very much once again :)

It really helped, but I was puzzled that when I ran it the first time it ran perfectly, then I dug into the code to understand what changed, and the attribute NSOpenGLPFANoRecovery was the culprit :) If I add it again, I get a white background, if I remove it it works ... From the documentation:

A Boolean attribute. If present, this attribute indicates that OpenGL’s failure recovery 
mechanisms are disabled. Normally, if an accelerated renderer fails due to lack of 
resources, OpenGL automatically switches to another renderer. This attribute disables
these features so that rendering is always performed by the chosen renderer. This attribute
is not generally useful.

I think you can remove all the diagnostics, or, just keep them as they can be useful for someone else.

Thank you very very much.

nsenica commented 9 years ago

Hi Jeff,

Another question, I'm not sure if it is slowness because of this mac being old or the actual renderer is making it a bit slow, is there any way to know which renderer is in use ? and which are the ones that failed ? :)

Thanks Nuno

P.S. - If this is too offtopic, I can contacto directly on twitter, by email or so, if you don't mind.

nsenica commented 9 years ago

Hi Jeff,

I've been reading a bit about this and I came across this page, which provides a couple of tips about what we should do to run OpenGL on 10.7.

I'll give it a go later on, but I thought it would be interesting sharing.

https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_pixelformats/opengl_pixelformats.html

Regards, Nuno

itfrombit commented 9 years ago

Hi Nuno,

Thanks for all of your help and persistence tracking this one down. That NSOpenGLPFANoRecovery flag had no business being in there. That was left over from an older project I did where I was temporarily (well, it was supposed to be temporary) trying to force a particular renderer to be used. Bad copy and pasting. When I was cleaning up the code, I came across that same documentation that said "this attribute is not generally useful". I guess that's all the hint I needed. :)

I'll leave the diagnostics in there. It might help someone else out, and I have most of it set up to get compiled out when we build in release mode.

I'll take a closer look at the developer docs you linked to. We're not making much use of OpenGL at the moment except as a glorified bit blitter, so the main thing we should check for performance is to make sure OpenGL does not have to rearrange our pixel format before compositing them to the framebuffer. There are some OpenGL profiling tools in Xcode's Instruments that can report these sorts of performance issues. I took a look at that when I first started the project, but I'll revisit to see if there are any other obvious improvements.

For what it's worth, Handmade Hero runs very slow on my old MacBook Air also. It's an old Core2Duo that was slow even when it was new. If you look at Casey's rendering code, you can see that he's not currently putting much emphasis or concern on performance. And he mentions this frequently, which is certainly fine while prototyping. He can get away with it (and most of us can too on newer hardware) just because the hardware is fast enough to allow a lot of slop before dropping frames. I imagine he'll tighten that code quite a bit when he does the real renderer.

Another thing we could consider doing in the meantime is slowing down our refresh rate. The OS X platform is refreshing at the native display rate, which is probably 60Hz in most cases. That is twice as fast as what Casey is currently doing in win32. He divides the monitor refresh rate in half to compute his TargetSecondsPerFrame. That would help out considerably on older hardware. I'll look into adding a simple switchable option in the OS X platform layer.

Thanks again for the help!

Best, Jeff

itfrombit commented 9 years ago

Nuno,

I followed you on twitter, so you can DM me with an email if you want to take any of this conversation offline. Or leaving it here is okay too. Cool either way.

Jeff

nsenica commented 9 years ago

Hi Jeff

Thank you very much for your extensive answer, very informative and clarifying.

I've done some further research and it seems that my video card only supports OpenGL 2.1 (https://developer.apple.com/opengl/capabilities/GLInfo_1075.html)

I don't think there is much we can do now, let's see how the game evolves and we'll see if there is any way to optimize it in the future. At least, having the code to compile and run is already a good thing, and let's be honest, this Mac has 8 years old, it's not suppose to run current things with good performance.

I'll also try to dig a little in your code to get more knowledge of it and try to check how to set a specific seconds per frame on osx side.

Thank you very much and we'll keep in touch.

Regards, Nuno

itfrombit commented 9 years ago

Hi Nuno,

My old MacBook Air is slow and has the old Intel 3100 integrated graphics which also only supports OpenGL 2.1, so it's a good machine to test with. Pretty sluggish.

I just pushed a change to HandmadeView.mm that will probably help. I added an option to render at half of the display refresh rate. Normally, this is 60fps, so setting this option will cut it down to 30fps and require us to only do about half of the work we were doing before. Casey's win32 platform layer of Handmade Hero is currently rendering at 30fps so it shouldn't make the game play any worse than what everyone else is using.

That improved performance on my old MacBook Air. All you have to do is go to line 857 of HandmadeView.mm, set the _renderAtHalfSpeed flag to true, and recompile. Hopefully that will make things a little better for you.

Best, Jeff

nsenica commented 9 years ago

Hi Jeff

Thank you for looking into this.

Yes, there is a significant improvement by skipping one frame out of two, the hero is much more fluid :)

Best regards, Nuno