Cocoa Port:
- Allow the OpenGL 3D renderer to render in HW (allow for SW fallback). - Remove the depth buffer from the display output context (doesn't need it and never will need it).
This commit is contained in:
parent
68fd51ac1f
commit
e841a8aa1a
|
@ -5112,7 +5112,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
<string key="NSWindowContentMinSize">{256, 408}</string>
|
||||
<object class="NSView" key="NSWindowView" id="439893737">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -5122,10 +5122,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
<object class="NSPSMatrix" key="NSDrawMatrix"/>
|
||||
<string key="NSFrame">{{0, 24}, {256, 384}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSViewCanDrawConcurrently">YES</bool>
|
||||
<object class="NSOpenGLPixelFormat" key="NSPixelFormat">
|
||||
<object class="NSMutableData" key="NSPixelAttributes">
|
||||
<bytes key="NS.bytes">AAAABQAAAAgAAAAPAAAACwAAAAEAAAAMAAAAEAAAAAA</bytes>
|
||||
<bytes key="NS.bytes">AAAABQAAAAgAAAAYAAAACwAAAAgAAAAAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -5135,6 +5136,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
<object class="NSPSMatrix" key="NSDrawMatrix"/>
|
||||
<string key="NSFrame">{{2, 3}, {16, 16}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<reference key="NSWindow"/>
|
||||
<int key="NSpiFlags">28938</int>
|
||||
<double key="NSMaxValue">100</double>
|
||||
</object>
|
||||
|
@ -5143,6 +5145,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{180, 3}, {56, 15}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSliderCell" key="NSCell" id="918619685">
|
||||
<int key="NSCellFlags">-2079981824</int>
|
||||
|
@ -5176,6 +5179,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
</object>
|
||||
<string key="NSFrame">{{160, 1}, {20, 20}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSImageCell" key="NSCell" id="58250235">
|
||||
<int key="NSCellFlags">130560</int>
|
||||
|
@ -5196,6 +5200,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
<int key="NSvFlags">294</int>
|
||||
<string key="NSFrame">{{17, 5}, {137, 14}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="60380140">
|
||||
<int key="NSCellFlags">68288064</int>
|
||||
|
@ -5214,6 +5219,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{256, 408}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
|
||||
<string key="NSMinSize">{256, 476}</string>
|
||||
|
@ -16821,7 +16828,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
|
|||
<object class="NSButton" id="59471532">
|
||||
<reference key="NSNextResponder" ref="887816052"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{16, 32}, {113, 18}}</string>
|
||||
<string key="NSFrame">{{15, 32}, {113, 18}}</string>
|
||||
<reference key="NSSuperview" ref="887816052"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
|
|
|
@ -78,6 +78,7 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
spinlockDisplayOrder = OS_SPINLOCK_INIT;
|
||||
|
||||
normalSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2.0);
|
||||
comboScreenGap = (normalSize.height/2.0) * DS_DISPLAY_VERTICAL_GAP_TO_HEIGHT_RATIO;
|
||||
sendPortDisplay = nil;
|
||||
cdsController = nil;
|
||||
isHudEnabled = NO;
|
||||
|
@ -135,6 +136,28 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
return theSize;
|
||||
}
|
||||
|
||||
- (NSSize) normalSizeWithGap
|
||||
{
|
||||
OSSpinLockLock(&spinlockNormalSize);
|
||||
NSSize theSize = normalSize;
|
||||
OSSpinLockUnlock(&spinlockNormalSize);
|
||||
|
||||
NSInteger theType = [self displayType];
|
||||
if (theType == DS_DISPLAY_TYPE_COMBO)
|
||||
{
|
||||
if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||
{
|
||||
theSize.height += (theSize.height/2.0) * DS_DISPLAY_VERTICAL_GAP_TO_HEIGHT_RATIO;
|
||||
}
|
||||
else
|
||||
{
|
||||
theSize.width += (theSize.width/2.0) * DS_DISPLAY_VERTICAL_GAP_TO_HEIGHT_RATIO;
|
||||
}
|
||||
}
|
||||
|
||||
return theSize;
|
||||
}
|
||||
|
||||
- (void) setGpuStateFlags:(UInt32)flags
|
||||
{
|
||||
OSSpinLockLock(&spinlockGpuStateFlags);
|
||||
|
@ -413,9 +436,9 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
viewAngle = CLOCKWISE_DEGREES(viewAngle);
|
||||
}
|
||||
|
||||
NSPoint touchLoc = GetNormalPointFromTransformedPoint(clickLoc, self.normalSize, [[self view] bounds].size, [self scale], viewAngle);
|
||||
NSPoint touchLoc = GetNormalPointFromTransformedPoint(clickLoc, [self normalSizeWithGap], [[self view] bounds].size, [self scale], viewAngle);
|
||||
|
||||
// Normalize the y-coordinate to the DS.
|
||||
// Normalize the touch location to the DS.
|
||||
if ([self displayType] == DS_DISPLAY_TYPE_COMBO)
|
||||
{
|
||||
NSInteger theOrientation = [self displayOrientation];
|
||||
|
@ -423,11 +446,11 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
|
||||
if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL && theOrder == DS_DISPLAY_ORDER_TOUCH_FIRST)
|
||||
{
|
||||
touchLoc.y -= GPU_DISPLAY_HEIGHT;
|
||||
touchLoc.y -= GPU_DISPLAY_HEIGHT /* + transformedGap */;
|
||||
}
|
||||
else if (theOrientation == DS_DISPLAY_ORIENTATION_HORIZONTAL && theOrder == DS_DISPLAY_ORDER_MAIN_FIRST)
|
||||
{
|
||||
touchLoc.x -= GPU_DISPLAY_WIDTH;
|
||||
touchLoc.x -= GPU_DISPLAY_WIDTH /* + transformedGap */;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -924,11 +947,19 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)8,
|
||||
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,
|
||||
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)8,
|
||||
NSOpenGLPFAOffScreen,
|
||||
NSOpenGLPFAAccelerated,
|
||||
(NSOpenGLPixelFormatAttribute)0
|
||||
};
|
||||
|
||||
NSOpenGLPixelFormat *tempPixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||
if (tempPixelFormat == nil)
|
||||
{
|
||||
// Remove the HW rendering requirement and try again. Note that this will
|
||||
// result in SW rendering, which will cause a substantial speed hit.
|
||||
attrs[8] = (NSOpenGLPixelFormatAttribute)0;
|
||||
tempPixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||
}
|
||||
|
||||
NSOpenGLPixelBuffer *tempPixelBuffer = [[NSOpenGLPixelBuffer alloc]
|
||||
initWithTextureTarget:GL_TEXTURE_2D
|
||||
textureInternalFormat:GL_RGBA
|
||||
|
@ -987,7 +1018,7 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
CGLSetCurrentContext(cglDisplayContext);
|
||||
|
||||
glViewport(0, 0, rect.size.width, rect.size.height);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
@ -1019,7 +1050,7 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClearDepth(1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// Set up initial display vertices and store in VBO
|
||||
static const GLint vertices[8*2] = {-GPU_DISPLAY_WIDTH/2, GPU_DISPLAY_HEIGHT, // Top display, top left
|
||||
|
@ -1123,7 +1154,7 @@ CGLContextObj OSXOpenGLRendererContext = NULL;
|
|||
GLfloat angleDegrees = (GLfloat)CLOCKWISE_DEGREES([dispViewDelegate rotation]);
|
||||
GLfloat s = (GLfloat)[dispViewDelegate scale];
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vboTexCoordID);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue