Cocoa Port: Do some minor code cleanup.
This commit is contained in:
parent
cd2f75e43a
commit
1ea95cdde4
|
@ -4818,6 +4818,8 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
|
||||||
return OGLERROR_BEGINGL_FAILED;
|
return OGLERROR_BEGINGL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glFinish();
|
||||||
|
|
||||||
const size_t newFramebufferColorSizeBytes = w * h * sizeof(FragmentColor);
|
const size_t newFramebufferColorSizeBytes = w * h * sizeof(FragmentColor);
|
||||||
|
|
||||||
if (this->isPBOSupported)
|
if (this->isPBOSupported)
|
||||||
|
@ -4825,10 +4827,16 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
|
||||||
if (this->_mappedFramebuffer != NULL)
|
if (this->_mappedFramebuffer != NULL)
|
||||||
{
|
{
|
||||||
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
|
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
|
||||||
|
glFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, newFramebufferColorSizeBytes, NULL, GL_STREAM_READ_ARB);
|
glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, newFramebufferColorSizeBytes, NULL, GL_STREAM_READ_ARB);
|
||||||
this->_mappedFramebuffer = (FragmentColor *__restrict)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
|
||||||
|
if (this->_mappedFramebuffer != NULL)
|
||||||
|
{
|
||||||
|
this->_mappedFramebuffer = (FragmentColor *__restrict)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
||||||
|
glFinish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->isShaderSupported && this->isFBOSupported && this->isVBOSupported)
|
if (this->isShaderSupported && this->isFBOSupported && this->isVBOSupported)
|
||||||
|
@ -4902,6 +4910,7 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
|
||||||
oglrender_framebufferDidResizeCallback(w, h);
|
oglrender_framebufferDidResizeCallback(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glFinish();
|
||||||
ENDGL();
|
ENDGL();
|
||||||
|
|
||||||
return OGLERROR_NOERR;
|
return OGLERROR_NOERR;
|
||||||
|
|
|
@ -1994,15 +1994,22 @@ Render3DError OpenGLRenderer_3_2::SetFramebufferSize(size_t w, size_t h)
|
||||||
return OGLERROR_BEGINGL_FAILED;
|
return OGLERROR_BEGINGL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t newFramebufferColorSizeBytes = w * h * sizeof(FragmentColor);
|
glFinish();
|
||||||
|
|
||||||
if (this->_mappedFramebuffer != NULL)
|
if (this->_mappedFramebuffer != NULL)
|
||||||
{
|
{
|
||||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||||
|
glFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t newFramebufferColorSizeBytes = w * h * sizeof(FragmentColor);
|
||||||
glBufferData(GL_PIXEL_PACK_BUFFER, newFramebufferColorSizeBytes, NULL, GL_STREAM_READ);
|
glBufferData(GL_PIXEL_PACK_BUFFER, newFramebufferColorSizeBytes, NULL, GL_STREAM_READ);
|
||||||
this->_mappedFramebuffer = (FragmentColor *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
|
||||||
|
if (this->_mappedFramebuffer != NULL)
|
||||||
|
{
|
||||||
|
this->_mappedFramebuffer = (FragmentColor *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||||
|
glFinish();
|
||||||
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FinalColor);
|
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FinalColor);
|
||||||
glBindTexture(GL_TEXTURE_2D, OGLRef.texFinalColorID);
|
glBindTexture(GL_TEXTURE_2D, OGLRef.texFinalColorID);
|
||||||
|
@ -2065,6 +2072,7 @@ Render3DError OpenGLRenderer_3_2::SetFramebufferSize(size_t w, size_t h)
|
||||||
oglrender_framebufferDidResizeCallback(w, h);
|
oglrender_framebufferDidResizeCallback(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glFinish();
|
||||||
ENDGL();
|
ENDGL();
|
||||||
|
|
||||||
return OGLERROR_NOERR;
|
return OGLERROR_NOERR;
|
||||||
|
|
|
@ -104,7 +104,6 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
|
||||||
UInt32 gpuStateFlags;
|
UInt32 gpuStateFlags;
|
||||||
uint8_t _gpuScale;
|
uint8_t _gpuScale;
|
||||||
BOOL isCPUCoreCountAuto;
|
BOOL isCPUCoreCountAuto;
|
||||||
BOOL _needRestoreFrameLock;
|
|
||||||
BOOL _needRestoreRender3DLock;
|
BOOL _needRestoreRender3DLock;
|
||||||
|
|
||||||
OSSpinLock spinlockGpuState;
|
OSSpinLock spinlockGpuState;
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
#include "userinterface/MacOGLDisplayView.h"
|
#import "userinterface/MacOGLDisplayView.h"
|
||||||
|
|
||||||
#ifdef ENABLE_APPLE_METAL
|
#ifdef ENABLE_APPLE_METAL
|
||||||
#include "userinterface/MacMetalDisplayView.h"
|
#import "userinterface/MacMetalDisplayView.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOOL
|
#ifdef BOOL
|
||||||
|
@ -149,7 +149,6 @@ public:
|
||||||
GPUSTATE_SUB_OBJ_MASK;
|
GPUSTATE_SUB_OBJ_MASK;
|
||||||
|
|
||||||
isCPUCoreCountAuto = NO;
|
isCPUCoreCountAuto = NO;
|
||||||
_needRestoreFrameLock = NO;
|
|
||||||
_needRestoreRender3DLock = NO;
|
_needRestoreRender3DLock = NO;
|
||||||
|
|
||||||
SetOpenGLRendererFunctions(&OSXOpenGLRendererInit,
|
SetOpenGLRendererFunctions(&OSXOpenGLRendererInit,
|
||||||
|
@ -865,18 +864,21 @@ public:
|
||||||
gpuEvent->FramebufferLock();
|
gpuEvent->FramebufferLock();
|
||||||
|
|
||||||
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
||||||
const u8 bufferIndex = GPU->GetDisplayInfo().bufferIndex;
|
semaphore_wait([[self sharedData] semaphoreFramebufferAtIndex:0]);
|
||||||
semaphore_wait([[self sharedData] semaphoreFramebufferAtIndex:bufferIndex]);
|
semaphore_wait([[self sharedData] semaphoreFramebufferAtIndex:1]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GPU->ClearWithColor(colorBGRA5551);
|
GPU->ClearWithColor(colorBGRA5551);
|
||||||
|
|
||||||
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
||||||
semaphore_signal([[self sharedData] semaphoreFramebufferAtIndex:bufferIndex]);
|
semaphore_signal([[self sharedData] semaphoreFramebufferAtIndex:1]);
|
||||||
|
semaphore_signal([[self sharedData] semaphoreFramebufferAtIndex:0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gpuEvent->FramebufferUnlock();
|
gpuEvent->FramebufferUnlock();
|
||||||
|
|
||||||
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
||||||
|
const u8 bufferIndex = GPU->GetDisplayInfo().bufferIndex;
|
||||||
[[self sharedData] signalFetchAtIndex:bufferIndex message:MESSAGE_FETCH_AND_PUSH_VIDEO];
|
[[self sharedData] signalFetchAtIndex:bufferIndex message:MESSAGE_FETCH_AND_PUSH_VIDEO];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1121,8 +1121,8 @@ static void* RunCoreThread(void *arg)
|
||||||
NSMutableArray *cdsOutputList = [cdsCore cdsOutputList];
|
NSMutableArray *cdsOutputList = [cdsCore cdsOutputList];
|
||||||
const NDSFrameInfo &ndsFrameInfo = execControl->GetNDSFrameInfo();
|
const NDSFrameInfo &ndsFrameInfo = execControl->GetNDSFrameInfo();
|
||||||
|
|
||||||
double startTime = 0;
|
double startTime = 0.0;
|
||||||
double frameTime = 0; // The amount of time that is expected for the frame to run.
|
double frameTime = 0.0; // The amount of time that is expected for the frame to run.
|
||||||
|
|
||||||
const double standardNDSFrameTime = execControl->CalculateFrameAbsoluteTime(1.0);
|
const double standardNDSFrameTime = execControl->CalculateFrameAbsoluteTime(1.0);
|
||||||
double executionSpeedAverage = 0.0;
|
double executionSpeedAverage = 0.0;
|
||||||
|
@ -1302,7 +1302,8 @@ static void* RunCoreThread(void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const double currentExecutionSpeed = standardNDSFrameTime / (execControl->GetCurrentAbsoluteTime() - startTime);
|
const double endTime = execControl->GetCurrentAbsoluteTime();
|
||||||
|
const double currentExecutionSpeed = standardNDSFrameTime / (endTime - startTime);
|
||||||
executionSpeedAverage += currentExecutionSpeed;
|
executionSpeedAverage += currentExecutionSpeed;
|
||||||
executionSpeedAverageFramesCollected += 1.0;
|
executionSpeedAverageFramesCollected += 1.0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue