[commit] r2268 - iOS open/GL work, use double buffering, change flush rules. Improves dragon drawing by 3x, but still slow

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] r2268 - iOS open/GL work, use double buffering, change flush rules. Improves dragon drawing by 3x, but still slow

commits-3
 
Author: johnmci
Date: 2010-08-30 21:00:50 -0700 (Mon, 30 Aug 2010)
New Revision: 2268

Modified:
   trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m
   trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m
   trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist
Log:
iOS open/GL work, use double buffering, change flush rules. Improves dragon drawing by 3x, but still slow

Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m
===================================================================
--- trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m 2010-08-29 05:20:46 UTC (rev 2267)
+++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m 2010-08-31 04:00:50 UTC (rev 2268)
@@ -41,11 +41,18 @@
 @implementation sqSqueakMainApplication  (events)
 
 - (void) pumpRunLoop {
+ static NSTimeInterval old = 0.0;
 
+ NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
+ if ((now - old) < 1.0/30.0)
+ return;
+
+ old = now;
+
  /* This the carbon logic model
  described by http://developer.apple.com/qa/qa2001/qa1061.html
  but fails on device, bug tracking number  5971848 */
-
+
  NSRunLoop *theRL = [NSRunLoop mainRunLoop];
  BOOL result = [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
 

Modified: trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m 2010-08-29 05:20:46 UTC (rev 2267)
+++ trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m 2010-08-31 04:00:50 UTC (rev 2268)
@@ -115,11 +115,12 @@
  resetFrame.size.width = width;
  resetFrame.size.height = height;
  [gDelegateApp.window setAcceptsMouseMovedEvents: YES];
- [gDelegateApp.window useOptimizedDrawing: NO];
+ [gDelegateApp.window useOptimizedDrawing: YES];
  [gDelegateApp.window setTitle: [[self.squeakApplication.imageNameURL path] lastPathComponent]];
  [gDelegateApp.window setRepresentedURL: self.squeakApplication.imageNameURL];
  [gDelegateApp.window setInitialFirstResponder: gDelegateApp.mainView];
  [gDelegateApp.window setShowsResizeIndicator: NO];
+
  extern sqInt getFullScreenFlag(void);
 #if (SQ_VI_BYTES_PER_WORD == 4)
  NSPanel *panel;

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m 2010-08-29 05:20:46 UTC (rev 2267)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m 2010-08-31 04:00:50 UTC (rev 2268)
@@ -82,7 +82,8 @@
 #if (SQ_VI_BYTES_PER_WORD == 4)
 
 #if STACKVM
- return "Mac Cocoa Cog 5.8b4 27-Aug-10 >5954D562-FB39-4195-9D19-EBB49FAECCF7<";
+ return "Mac Cocoa Cog 5.8b5 30-Aug-10 >0A92B82A-9AC1-4B0E-9DEE-440C3FFAE568<";
+// return "Mac Cocoa Cog 5.8b4 27-Aug-10 >5954D562-FB39-4195-9D19-EBB49FAECCF7<";
 // return "Mac Cocoa Cog 5.8b3 21-Aug-10 >5954D562-FB39-4195-9D19-EBB49FAECCF7<";
 // return "Mac Cocoa Cog 5.8b2 08-Jul-10 >7BCAB029-A835-4D12-946D-4AB7083D2955<";
 // return "Mac Cocoa Cog 5.8b1 07-Jul-10 >529F6B5A-DC81-4C1F-81B6-3D99741B954A<";

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m 2010-08-29 05:20:46 UTC (rev 2267)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m 2010-08-31 04:00:50 UTC (rev 2268)
@@ -62,6 +62,7 @@
     {
  NSOpenGLPFAAccelerated,
  NSOpenGLPFANoRecovery,
+ NSOpenGLPFABackingStore,
  0
     };
     return[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
@@ -129,11 +130,11 @@
  [self setNeedsDisplayInRect: what];
 }
 
-- (void) drawThelayers {
- if([[self window] viewsNeedDisplay]) {
- [self displayIfNeeded];
-// NSLog(@"drawTheLayers flushHappened");
+- (void) drawThelayers {
+ if (syncNeeded) {
+ [[self openGLContext] makeCurrentContext];
  glFlush();
+ [[NSOpenGLContext currentContext] flushBuffer];
  syncNeeded = NO;
  }
  if (!firstDrawCompleted) {
@@ -144,11 +145,12 @@
 }
 
 -(void)setupOpenGL {
- CGLContextObj ctx = CGLGetCurrentContext();
-
+ CGLContextObj ctx = [[self openGLContext] CGLContextObj];
  // Enable the multithreading
  CGLEnable( ctx, kCGLCEMPEngine);
-
+ GLenum err = glGetError();
+// GLint newSwapInterval = 1;
+// CGLSetParameter(ctx, kCGLCPSwapInterval, &newSwapInterval);
  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  glClearColor(1.0, 1.0, 1.0, 1.0);
@@ -180,7 +182,13 @@
 }
 
 - (void)loadTexturesFrom: (void*) lastBitsIndex subRectangle: (NSRect) subRect {
+ static void *previousLastBitsIndex=null;
  NSRect r=[self frame];
+ if (!(previousLastBitsIndex == lastBitsIndex)) {
+ previousLastBitsIndex = lastBitsIndex;
+ glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_ARB, r.size.width*r.size.height*4,lastBitsIndex);
+ }
+
  glViewport( subRect.origin.x,subRect.origin.y, subRect.size.width,subRect.size.height );
  char *subimg = ((char*)lastBitsIndex) + (unsigned int)(subRect.origin.x + (r.size.height-subRect.origin.y-subRect.size.height)*r.size.width)*4;
  glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, subRect.size.width, subRect.size.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, subimg );
@@ -255,8 +263,6 @@
  [self setupOpenGL];
  inited=YES;
  }
- if (syncNeeded)
- glFlush();
  [self loadTexturesFrom:dispBitsIndex subRectangle: rect];
  [self defineQuad:rect];
  syncNeeded = YES;

Modified: trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist
===================================================================
--- trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist 2010-08-29 05:20:46 UTC (rev 2267)
+++ trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist 2010-08-31 04:00:50 UTC (rev 2268)
@@ -350,7 +350,7 @@
  <key>CFBundleExecutable</key>
  <string>${EXECUTABLE_NAME}</string>
  <key>CFBundleGetInfoString</key>
- <string>Squeak VM 5.8b4 http://www.squeak.org</string>
+ <string>Squeak VM 5.8b5 http://www.squeak.org</string>
  <key>CFBundleIconFile</key>
  <string>Squeak.icns</string>
  <key>CFBundleIdentifier</key>
@@ -362,11 +362,11 @@
  <key>CFBundlePackageType</key>
  <string>APPL</string>
  <key>CFBundleShortVersionString</key>
- <string>5.8b4</string>
+ <string>5.8b5</string>
  <key>CFBundleSignature</key>
  <string>FAST</string>
  <key>CFBundleVersion</key>
- <string>22.0</string>
+ <string>23.0</string>
  <key>LSBackgroundOnly</key>
  <false/>
  <key>LSMinimumSystemVersion</key>