[Vm-dev] [commit] r2269 - iOS open/GL work. make window multiple of 8 points, don't use Apples self view setNeedsUpdate: Rect. Read Apple's guide to performance one more time. Now FPS is good, dragon drawing excellent (1/3) of previous trials with Core Animation

commits at squeakvm.org commits at squeakvm.org
Wed Sep 1 06:37:00 UTC 2010


Author: johnmci
Date: 2010-08-31 23:37:00 -0700 (Tue, 31 Aug 2010)
New Revision: 2269

Modified:
   trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.h
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m
   trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist
Log:
iOS open/GL work. make window multiple of 8 points, don't use Apples self view setNeedsUpdate: Rect. Read Apple's guide to performance one more time.  Now FPS is good, dragon drawing excellent (1/3) of previous trials with Core Animation

Modified: trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	2010-08-31 04:00:50 UTC (rev 2268)
+++ trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	2010-09-01 06:37:00 UTC (rev 2269)
@@ -89,7 +89,7 @@
 	windowHandler.windowIndex = 1;
 	[windowHandler.mainViewOnWindow initializeVariables];
 	self.window.delegate =  windowHandler;
-
+	self.window.contentResizeIncrements = NSMakeSize(8.0f,8.0f);
 	[self.squeakApplication setupEventQueue];
 	
 	[self singleThreadStart];
@@ -104,6 +104,7 @@
 	extern sqInt getSavedWindowSize(void); //This is VM Callback
 	width  = ((unsigned) getSavedWindowSize()) >> 16;
 	height = getSavedWindowSize() & 0xFFFF;
+	width = (sqInt) ((width*4)/32.0f+0.5)*8.0;  //JMM OPEN/GL THOUGHTS FOR PERFORMANCE
 	NSSize sizeOfWindowContent;
 	sizeOfWindowContent.width = width;
 	sizeOfWindowContent.height = height;

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m	2010-08-31 04:00:50 UTC (rev 2268)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m	2010-09-01 06:37:00 UTC (rev 2269)
@@ -82,7 +82,8 @@
 #if (SQ_VI_BYTES_PER_WORD == 4)
 			
 #if STACKVM
-			return "Mac Cocoa Cog 5.8b5 30-Aug-10 >0A92B82A-9AC1-4B0E-9DEE-440C3FFAE568<";
+			return "Mac Cocoa Cog 5.8b6 31-Aug-10 >DFB49E57-40FB-44B9-97D3-B7CA51608429<";
+//			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<";

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.h
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.h	2010-08-31 04:00:50 UTC (rev 2268)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.h	2010-09-01 06:37:00 UTC (rev 2269)
@@ -59,6 +59,8 @@
 	NSRect	savedScreenBoundsAtTimeOfFullScreen;
 	CGColorSpaceRef colorspace;	
 	unsigned int*      colorMap32;
+	BOOL clippyIsEmpty;
+	CGRect clippy;
 }
 @property (nonatomic,assign) NSTrackingRectTag squeakTrackingRectForCursor;
 @property (nonatomic,retain) keyBoardStrokeDetails* lastSeenKeyBoardStrokeDetails;

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m	2010-08-31 04:00:50 UTC (rev 2268)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m	2010-09-01 06:37:00 UTC (rev 2269)
@@ -46,6 +46,8 @@
 #import "sq.h"
 #import "sqVirtualMachine.h"
 
+#import <OpenGL/CGLMacro.h>
+
 extern SqueakOSXAppDelegate *gDelegateApp;
 extern struct	VirtualMachine* interpreterProxy;
 
@@ -77,6 +79,7 @@
 	dragInProgress = NO;
 	dragCount = 0;
 	dragItems = NULL;
+	clippyIsEmpty = YES;
 	colorspace = CGColorSpaceCreateDeviceRGB();
 	[self initializeSqueakColorMap];
 }
@@ -126,16 +129,24 @@
 }
 
 - (void) drawImageUsingClip: (CGRect) clip {
-	NSRect what = *(NSRect *) &clip;
-	[self setNeedsDisplayInRect: what];
+	
+	if (clippyIsEmpty){
+		clippy = clip;
+		clippyIsEmpty = NO;
+	} else {
+		clippy = CGRectUnion(clippy, clip);
+	}
+	syncNeeded = YES;
 }
 
 - (void) drawThelayers {
 	if (syncNeeded) { 
-		[[self openGLContext] makeCurrentContext];
+		[self drawRect: NSRectFromCGRect(clippy)];
+		syncNeeded = NO;
+		clippyIsEmpty = YES;
+		CGL_MACRO_DECLARE_VARIABLES();
 		glFlush();
-		[[NSOpenGLContext currentContext] flushBuffer];
-		syncNeeded = NO;
+		[[self openGLContext] flushBuffer];  //Not sure if double buffering works, need more testing.
 	}
 	if (!firstDrawCompleted) {
 		firstDrawCompleted = YES;
@@ -145,12 +156,11 @@
 }
 
 -(void)setupOpenGL {	
-	CGLContextObj ctx = [[self openGLContext] CGLContextObj];
+	CGL_MACRO_DECLARE_VARIABLES();
 	// Enable the multithreading
-	CGLEnable( ctx, kCGLCEMPEngine);
-	GLenum err = glGetError();
+	CGLEnable( cgl_ctx, kCGLCEMPEngine);
 //	GLint newSwapInterval = 1;
-//	CGLSetParameter(ctx, kCGLCPSwapInterval, &newSwapInterval);
+//	CGLSetParameter(cgl_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);
@@ -182,6 +192,7 @@
 }
 
 - (void)loadTexturesFrom: (void*) lastBitsIndex subRectangle: (NSRect) subRect { 
+	CGL_MACRO_DECLARE_VARIABLES();
 	static void *previousLastBitsIndex=null;
 	NSRect r=[self frame];
 	if (!(previousLastBitsIndex == lastBitsIndex)) {
@@ -197,6 +208,8 @@
 
 -(void)defineQuad:(NSRect)r
 {
+
+	CGL_MACRO_DECLARE_VARIABLES();
 	 glBegin(GL_QUADS);
 	 glTexCoord2f(0.0f, 0.0f);					glVertex2f(-1.0f, 1.0f);
 	 glTexCoord2f(0.0f, r.size.height);			glVertex2f(-1.0f, -1.0f);
@@ -212,6 +225,7 @@
 	[super update];
 	
 	[[self openGLContext] makeCurrentContext];
+	CGL_MACRO_DECLARE_VARIABLES();
 	[[self openGLContext] update];
 	
 	rect = [self bounds];
@@ -235,6 +249,7 @@
 	[super reshape];
 	
 	[[self openGLContext] makeCurrentContext];
+	CGL_MACRO_DECLARE_VARIABLES();
 	[[self openGLContext] update];
 	
 	rect = [self bounds];
@@ -265,7 +280,6 @@
 		}
 		[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-31 04:00:50 UTC (rev 2268)
+++ trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist	2010-09-01 06:37:00 UTC (rev 2269)
@@ -350,7 +350,7 @@
 	<key>CFBundleExecutable</key>
 	<string>${EXECUTABLE_NAME}</string>
 	<key>CFBundleGetInfoString</key>
-	<string>Squeak VM 5.8b5 http://www.squeak.org</string>
+	<string>Squeak VM 5.8b6 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.8b5</string>
+	<string>5.8b6</string>
 	<key>CFBundleSignature</key>
 	<string>FAST</string>
 	<key>CFBundleVersion</key>
-	<string>23.0</string>
+	<string>24.0</string>
 	<key>LSBackgroundOnly</key>
 	<false/>
 	<key>LSMinimumSystemVersion</key>



More information about the Vm-dev mailing list