Cocoa Port: Major code refactor to the video display system with the purpose of breaking up multipurpose classes of homogenous data into more focused classes.
- Also removes unnecessary Objective-C code and converts it into C++. Objective-C has its place, but not at this level of function.
This commit is contained in:
parent
908a53e85a
commit
ebc39eae64
|
@ -5908,10 +5908,7 @@ void GPUEventHandlerDefault::DidFrameBegin(const size_t line, const bool isFrame
|
||||||
|
|
||||||
GPUClientFetchObject::GPUClientFetchObject()
|
GPUClientFetchObject::GPUClientFetchObject()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < MAX_FRAMEBUFFER_PAGES; i++)
|
_id = 0;
|
||||||
{
|
|
||||||
memset(&_fetchDisplayInfo[i], 0, sizeof(NDSDisplayInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(_name, 0, sizeof(_name));
|
memset(_name, 0, sizeof(_name));
|
||||||
strncpy(_name, "Generic Video", sizeof(_name) - 1);
|
strncpy(_name, "Generic Video", sizeof(_name) - 1);
|
||||||
|
@ -5921,6 +5918,11 @@ GPUClientFetchObject::GPUClientFetchObject()
|
||||||
|
|
||||||
_clientData = NULL;
|
_clientData = NULL;
|
||||||
_lastFetchIndex = 0;
|
_lastFetchIndex = 0;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < MAX_FRAMEBUFFER_PAGES; i++)
|
||||||
|
{
|
||||||
|
memset(&_fetchDisplayInfo[i], 0, sizeof(NDSDisplayInfo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUClientFetchObject::Init()
|
void GPUClientFetchObject::Init()
|
||||||
|
@ -6003,6 +6005,11 @@ void GPUClientFetchObject::SetFetchDisplayInfo(const NDSDisplayInfo &displayInfo
|
||||||
this->_fetchDisplayInfo[displayInfo.bufferIndex] = displayInfo;
|
this->_fetchDisplayInfo[displayInfo.bufferIndex] = displayInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const s32 GPUClientFetchObject::GetID() const
|
||||||
|
{
|
||||||
|
return this->_id;
|
||||||
|
}
|
||||||
|
|
||||||
const char* GPUClientFetchObject::GetName() const
|
const char* GPUClientFetchObject::GetName() const
|
||||||
{
|
{
|
||||||
return this->_name;
|
return this->_name;
|
||||||
|
|
|
@ -1991,6 +1991,7 @@ public:
|
||||||
class GPUClientFetchObject
|
class GPUClientFetchObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
s32 _id;
|
||||||
char _name[256];
|
char _name[256];
|
||||||
char _description[256];
|
char _description[256];
|
||||||
|
|
||||||
|
@ -2009,6 +2010,7 @@ public:
|
||||||
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
||||||
virtual void FetchFromBufferIndex(const u8 index);
|
virtual void FetchFromBufferIndex(const u8 index);
|
||||||
|
|
||||||
|
const s32 GetID() const;
|
||||||
const char* GetName() const;
|
const char* GetName() const;
|
||||||
const char* GetDescription() const;
|
const char* GetDescription() const;
|
||||||
|
|
||||||
|
|
|
@ -4570,7 +4570,7 @@ bool OGLShaderProgram::LinkOGL()
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
OGLClientFetchObject::OGLClientFetchObject()
|
OGLClientSharedData::OGLClientSharedData()
|
||||||
{
|
{
|
||||||
_contextInfo = NULL;
|
_contextInfo = NULL;
|
||||||
_useDirectToCPUFilterPipeline = true;
|
_useDirectToCPUFilterPipeline = true;
|
||||||
|
@ -4595,9 +4595,9 @@ OGLClientFetchObject::OGLClientFetchObject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OGLClientFetchObject::~OGLClientFetchObject()
|
OGLClientSharedData::~OGLClientSharedData()
|
||||||
{
|
{
|
||||||
if (this->_contextInfo->IsShaderSupported())
|
if ( (this->_contextInfo != NULL) && this->_contextInfo->IsShaderSupported() )
|
||||||
{
|
{
|
||||||
DeleteHQnxLUTs_OGL(GL_TEXTURE0 + 1, this->_texLQ2xLUT, this->_texHQ2xLUT, this->_texHQ3xLUT, this->_texHQ4xLUT);
|
DeleteHQnxLUTs_OGL(GL_TEXTURE0 + 1, this->_texLQ2xLUT, this->_texHQ2xLUT, this->_texHQ3xLUT, this->_texHQ4xLUT);
|
||||||
}
|
}
|
||||||
|
@ -4628,54 +4628,79 @@ OGLClientFetchObject::~OGLClientFetchObject()
|
||||||
pthread_rwlock_destroy(&this->_texFetchRWLock[NDSDisplayID_Touch]);
|
pthread_rwlock_destroy(&this->_texFetchRWLock[NDSDisplayID_Touch]);
|
||||||
}
|
}
|
||||||
|
|
||||||
OGLContextInfo* OGLClientFetchObject::GetContextInfo() const
|
void OGLClientSharedData::SetContextInfo(OGLContextInfo *contextInfo)
|
||||||
|
{
|
||||||
|
this->_contextInfo = contextInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
OGLContextInfo* OGLClientSharedData::GetContextInfo() const
|
||||||
{
|
{
|
||||||
return this->_contextInfo;
|
return this->_contextInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t* OGLClientFetchObject::GetSrcClone(const NDSDisplayID displayID, const u8 bufferIndex) const
|
void OGLClientSharedData::SetUseDirectToCPUFilterPipeline(bool willUseDirectCPU)
|
||||||
|
{
|
||||||
|
this->_useDirectToCPUFilterPipeline = willUseDirectCPU;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OGLClientSharedData::UseDirectToCPUFilterPipeline() const
|
||||||
|
{
|
||||||
|
return this->_useDirectToCPUFilterPipeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLuint OGLClientSharedData::GetFetchTexture(const NDSDisplayID displayID)
|
||||||
|
{
|
||||||
|
return this->_texFetch[displayID];
|
||||||
|
}
|
||||||
|
|
||||||
|
void OGLClientSharedData::SetFetchTexture(const NDSDisplayID displayID, GLuint texID)
|
||||||
|
{
|
||||||
|
this->_texFetch[displayID] = texID;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t* OGLClientSharedData::GetSrcClone(const NDSDisplayID displayID, const u8 bufferIndex) const
|
||||||
{
|
{
|
||||||
return this->_srcNativeClone[displayID][bufferIndex];
|
return this->_srcNativeClone[displayID][bufferIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OGLClientFetchObject::GetTexNative(const NDSDisplayID displayID, const u8 bufferIndex) const
|
GLuint OGLClientSharedData::GetTexNative(const NDSDisplayID displayID, const u8 bufferIndex) const
|
||||||
{
|
{
|
||||||
return this->_texDisplayFetchNative[displayID][bufferIndex];
|
return this->_texDisplayFetchNative[displayID][bufferIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OGLClientFetchObject::GetTexCustom(const NDSDisplayID displayID, const u8 bufferIndex) const
|
GLuint OGLClientSharedData::GetTexCustom(const NDSDisplayID displayID, const u8 bufferIndex) const
|
||||||
{
|
{
|
||||||
return this->_texDisplayFetchCustom[displayID][bufferIndex];
|
return this->_texDisplayFetchCustom[displayID][bufferIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OGLClientFetchObject::GetTexLQ2xLUT() const
|
GLuint OGLClientSharedData::GetTexLQ2xLUT() const
|
||||||
{
|
{
|
||||||
return this->_texLQ2xLUT;
|
return this->_texLQ2xLUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OGLClientFetchObject::GetTexHQ2xLUT() const
|
GLuint OGLClientSharedData::GetTexHQ2xLUT() const
|
||||||
{
|
{
|
||||||
return this->_texHQ2xLUT;
|
return this->_texHQ2xLUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OGLClientFetchObject::GetTexHQ3xLUT() const
|
GLuint OGLClientSharedData::GetTexHQ3xLUT() const
|
||||||
{
|
{
|
||||||
return this->_texHQ3xLUT;
|
return this->_texHQ3xLUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OGLClientFetchObject::GetTexHQ4xLUT() const
|
GLuint OGLClientSharedData::GetTexHQ4xLUT() const
|
||||||
{
|
{
|
||||||
return this->_texHQ4xLUT;
|
return this->_texHQ4xLUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex)
|
void OGLClientSharedData::CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex)
|
||||||
{
|
{
|
||||||
pthread_rwlock_rdlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
pthread_rwlock_rdlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||||
memcpy(dstBufferPtr, this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(uint32_t));
|
memcpy(dstBufferPtr, this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(uint32_t));
|
||||||
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::FetchNativeDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock)
|
void OGLClientSharedData::FetchNativeDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock)
|
||||||
{
|
{
|
||||||
if (needsLock)
|
if (needsLock)
|
||||||
{
|
{
|
||||||
|
@ -4691,7 +4716,7 @@ void OGLClientFetchObject::FetchNativeDisplayToSrcClone(const NDSDisplayID displ
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapNone>(this->_fetchDisplayInfo[bufferIndex].nativeBuffer16[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapNone>(displayInfoList[bufferIndex].nativeBuffer16[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||||
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = false;
|
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = false;
|
||||||
|
|
||||||
if (needsLock)
|
if (needsLock)
|
||||||
|
@ -4700,7 +4725,7 @@ void OGLClientFetchObject::FetchNativeDisplayToSrcClone(const NDSDisplayID displ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::FetchCustomDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock)
|
void OGLClientSharedData::FetchCustomDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock)
|
||||||
{
|
{
|
||||||
if (needsLock)
|
if (needsLock)
|
||||||
{
|
{
|
||||||
|
@ -4716,7 +4741,7 @@ void OGLClientFetchObject::FetchCustomDisplayToSrcClone(const NDSDisplayID displ
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorspaceConvertBuffer888XTo8888Opaque<false, false>((u32 *)this->_fetchDisplayInfo[bufferIndex].customBuffer[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
ColorspaceConvertBuffer888XTo8888Opaque<false, false>((u32 *)displayInfoList[bufferIndex].customBuffer[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||||
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = false;
|
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = false;
|
||||||
|
|
||||||
if (needsLock)
|
if (needsLock)
|
||||||
|
@ -4725,22 +4750,22 @@ void OGLClientFetchObject::FetchCustomDisplayToSrcClone(const NDSDisplayID displ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::FetchTextureWriteLock(const NDSDisplayID displayID)
|
void OGLClientSharedData::FetchTextureWriteLock(const NDSDisplayID displayID)
|
||||||
{
|
{
|
||||||
pthread_rwlock_wrlock(&this->_texFetchRWLock[displayID]);
|
pthread_rwlock_wrlock(&this->_texFetchRWLock[displayID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::FetchTextureReadLock(const NDSDisplayID displayID)
|
void OGLClientSharedData::FetchTextureReadLock(const NDSDisplayID displayID)
|
||||||
{
|
{
|
||||||
pthread_rwlock_rdlock(&this->_texFetchRWLock[displayID]);
|
pthread_rwlock_rdlock(&this->_texFetchRWLock[displayID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::FetchTextureUnlock(const NDSDisplayID displayID)
|
void OGLClientSharedData::FetchTextureUnlock(const NDSDisplayID displayID)
|
||||||
{
|
{
|
||||||
pthread_rwlock_unlock(&this->_texFetchRWLock[displayID]);
|
pthread_rwlock_unlock(&this->_texFetchRWLock[displayID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::Init()
|
void OGLClientSharedData::InitOGL()
|
||||||
{
|
{
|
||||||
glGenTextures(2 * OPENGL_FETCH_BUFFER_COUNT, &this->_texDisplayFetchNative[0][0]);
|
glGenTextures(2 * OPENGL_FETCH_BUFFER_COUNT, &this->_texDisplayFetchNative[0][0]);
|
||||||
glGenTextures(2 * OPENGL_FETCH_BUFFER_COUNT, &this->_texDisplayFetchCustom[0][0]);
|
glGenTextures(2 * OPENGL_FETCH_BUFFER_COUNT, &this->_texDisplayFetchCustom[0][0]);
|
||||||
|
@ -4784,16 +4809,14 @@ void OGLClientFetchObject::Init()
|
||||||
this->_texFetch[NDSDisplayID_Main] = this->_texDisplayFetchNative[NDSDisplayID_Main][0];
|
this->_texFetch[NDSDisplayID_Main] = this->_texDisplayFetchNative[NDSDisplayID_Main][0];
|
||||||
this->_texFetch[NDSDisplayID_Touch] = this->_texDisplayFetchNative[NDSDisplayID_Touch][0];
|
this->_texFetch[NDSDisplayID_Touch] = this->_texDisplayFetchNative[NDSDisplayID_Touch][0];
|
||||||
|
|
||||||
if (this->_contextInfo->IsShaderSupported())
|
if ( (this->_contextInfo != NULL) && this->_contextInfo->IsShaderSupported() )
|
||||||
{
|
{
|
||||||
SetupHQnxLUTs_OGL(GL_TEXTURE0 + 1, this->_texLQ2xLUT, this->_texHQ2xLUT, this->_texHQ3xLUT, this->_texHQ4xLUT);
|
SetupHQnxLUTs_OGL(GL_TEXTURE0 + 1, this->_texLQ2xLUT, this->_texHQ2xLUT, this->_texHQ3xLUT, this->_texHQ4xLUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo)
|
void OGLClientSharedData::SetFetchBuffersOGL(const NDSDisplayInfo *displayInfoList, const NDSDisplayInfo ¤tDisplayInfo)
|
||||||
{
|
{
|
||||||
this->GPUClientFetchObject::SetFetchBuffers(currentDisplayInfo);
|
|
||||||
|
|
||||||
#ifdef MSB_FIRST
|
#ifdef MSB_FIRST
|
||||||
this->_fetchColorFormatOGL = (currentDisplayInfo.pixelBytes == 2) ? GL_UNSIGNED_SHORT_1_5_5_5_REV : GL_UNSIGNED_INT_8_8_8_8;
|
this->_fetchColorFormatOGL = (currentDisplayInfo.pixelBytes == 2) ? GL_UNSIGNED_SHORT_1_5_5_5_REV : GL_UNSIGNED_INT_8_8_8_8;
|
||||||
#else
|
#else
|
||||||
|
@ -4809,19 +4832,19 @@ void OGLClientFetchObject::SetFetchBuffers(const NDSDisplayInfo ¤tDisplayI
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchNative[NDSDisplayID_Main][i]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchNative[NDSDisplayID_Main][i]);
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
||||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, this->_fetchDisplayInfo[i].nativeBuffer16[NDSDisplayID_Main]);
|
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, displayInfoList[i].nativeBuffer16[NDSDisplayID_Main]);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchNative[NDSDisplayID_Touch][i]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchNative[NDSDisplayID_Touch][i]);
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
||||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, this->_fetchDisplayInfo[i].nativeBuffer16[NDSDisplayID_Touch]);
|
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, displayInfoList[i].nativeBuffer16[NDSDisplayID_Touch]);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchCustom[NDSDisplayID_Main][i]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchCustom[NDSDisplayID_Main][i]);
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
||||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, currentDisplayInfo.customWidth, currentDisplayInfo.customHeight, 0, GL_RGBA, this->_fetchColorFormatOGL, this->_fetchDisplayInfo[i].customBuffer[NDSDisplayID_Main]);
|
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, currentDisplayInfo.customWidth, currentDisplayInfo.customHeight, 0, GL_RGBA, this->_fetchColorFormatOGL, displayInfoList[i].customBuffer[NDSDisplayID_Main]);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchCustom[NDSDisplayID_Touch][i]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchCustom[NDSDisplayID_Touch][i]);
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
||||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, currentDisplayInfo.customWidth, currentDisplayInfo.customHeight, 0, GL_RGBA, this->_fetchColorFormatOGL, this->_fetchDisplayInfo[i].customBuffer[NDSDisplayID_Touch]);
|
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, currentDisplayInfo.customWidth, currentDisplayInfo.customHeight, 0, GL_RGBA, this->_fetchColorFormatOGL, displayInfoList[i].customBuffer[NDSDisplayID_Touch]);
|
||||||
|
|
||||||
pthread_rwlock_wrlock(&this->_srcCloneRWLock[NDSDisplayID_Main][i]);
|
pthread_rwlock_wrlock(&this->_srcCloneRWLock[NDSDisplayID_Main][i]);
|
||||||
this->_srcCloneNeedsUpdate[NDSDisplayID_Main][i] = true;
|
this->_srcCloneNeedsUpdate[NDSDisplayID_Main][i] = true;
|
||||||
|
@ -4837,14 +4860,12 @@ void OGLClientFetchObject::SetFetchBuffers(const NDSDisplayInfo ¤tDisplayI
|
||||||
glFinish();
|
glFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::FetchFromBufferIndex(const u8 index)
|
void OGLClientSharedData::FetchFromBufferIndexOGL(const u8 index, const NDSDisplayInfo ¤tDisplayInfo)
|
||||||
{
|
{
|
||||||
GPUClientFetchObject::FetchFromBufferIndex(index);
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
GLuint texFetchMain = 0;
|
GLuint texFetchMain = 0;
|
||||||
GLuint texFetchTouch = 0;
|
GLuint texFetchTouch = 0;
|
||||||
const NDSDisplayInfo ¤tDisplayInfo = this->GetFetchDisplayInfoForBufferIndex(index);
|
|
||||||
const bool isMainEnabled = currentDisplayInfo.isDisplayEnabled[NDSDisplayID_Main];
|
const bool isMainEnabled = currentDisplayInfo.isDisplayEnabled[NDSDisplayID_Main];
|
||||||
const bool isTouchEnabled = currentDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch];
|
const bool isTouchEnabled = currentDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch];
|
||||||
|
|
||||||
|
@ -4876,42 +4897,32 @@ void OGLClientFetchObject::FetchFromBufferIndex(const u8 index)
|
||||||
this->SetFetchTexture(NDSDisplayID_Touch, texFetchTouch);
|
this->SetFetchTexture(NDSDisplayID_Touch, texFetchTouch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::_FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
|
void OGLClientSharedData::FetchNativeDisplayByID_OGL(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex)
|
||||||
{
|
{
|
||||||
if (this->_useDirectToCPUFilterPipeline)
|
if (this->_useDirectToCPUFilterPipeline)
|
||||||
{
|
{
|
||||||
pthread_rwlock_wrlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
pthread_rwlock_wrlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||||
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = true;
|
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = true;
|
||||||
this->FetchNativeDisplayToSrcClone(displayID, bufferIndex, false);
|
this->FetchNativeDisplayToSrcClone(displayInfoList, displayID, bufferIndex, false);
|
||||||
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchNative[displayID][bufferIndex]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchNative[displayID][bufferIndex]);
|
||||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, this->_fetchDisplayInfo[bufferIndex].nativeBuffer16[displayID]);
|
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, displayInfoList[bufferIndex].nativeBuffer16[displayID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLClientFetchObject::_FetchCustomDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
|
void OGLClientSharedData::FetchCustomDisplayByID_OGL(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex)
|
||||||
{
|
{
|
||||||
if (this->_useDirectToCPUFilterPipeline && (this->_fetchDisplayInfo[bufferIndex].renderedWidth[displayID] == GPU_FRAMEBUFFER_NATIVE_WIDTH) && (this->_fetchDisplayInfo[bufferIndex].renderedHeight[displayID] == GPU_FRAMEBUFFER_NATIVE_HEIGHT))
|
if (this->_useDirectToCPUFilterPipeline && (displayInfoList[bufferIndex].renderedWidth[displayID] == GPU_FRAMEBUFFER_NATIVE_WIDTH) && (displayInfoList[bufferIndex].renderedHeight[displayID] == GPU_FRAMEBUFFER_NATIVE_HEIGHT))
|
||||||
{
|
{
|
||||||
pthread_rwlock_wrlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
pthread_rwlock_wrlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||||
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = true;
|
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = true;
|
||||||
this->FetchCustomDisplayToSrcClone(displayID, bufferIndex, false);
|
this->FetchCustomDisplayToSrcClone(displayInfoList, displayID, bufferIndex, false);
|
||||||
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchCustom[displayID][bufferIndex]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDisplayFetchCustom[displayID][bufferIndex]);
|
||||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, this->_fetchDisplayInfo[bufferIndex].customWidth, this->_fetchDisplayInfo[bufferIndex].customHeight, GL_RGBA, this->_fetchColorFormatOGL, this->_fetchDisplayInfo[bufferIndex].customBuffer[displayID]);
|
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, displayInfoList[bufferIndex].customWidth, displayInfoList[bufferIndex].customHeight, GL_RGBA, this->_fetchColorFormatOGL, displayInfoList[bufferIndex].customBuffer[displayID]);
|
||||||
}
|
|
||||||
|
|
||||||
GLuint OGLClientFetchObject::GetFetchTexture(const NDSDisplayID displayID)
|
|
||||||
{
|
|
||||||
return this->_texFetch[displayID];
|
|
||||||
}
|
|
||||||
|
|
||||||
void OGLClientFetchObject::SetFetchTexture(const NDSDisplayID displayID, GLuint texID)
|
|
||||||
{
|
|
||||||
this->_texFetch[displayID] = texID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -6873,10 +6884,12 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
return willUseShaderBasedPixelScaler;
|
return willUseShaderBasedPixelScaler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OGLClientSharedData *sharedData = (OGLClientSharedData *)this->_output->GetFetchObject().GetClientData();
|
||||||
|
|
||||||
for (size_t i = 0; i < 2; i++)
|
for (size_t i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
OGLShaderProgram *shaderFilterProgram = _shaderFilter[i]->GetProgram();
|
OGLShaderProgram *shaderFilterProgram = _shaderFilter[i]->GetProgram();
|
||||||
const bool useShader150 = _output->GetContextInfo()->IsUsingShader150();
|
const bool useShader150 = this->_output->GetContextInfo()->IsUsingShader150();
|
||||||
const ShaderSupportTier shaderSupport = _output->GetContextInfo()->GetShaderSupport();
|
const ShaderSupportTier shaderSupport = _output->GetContextInfo()->GetShaderSupport();
|
||||||
|
|
||||||
switch (filterID)
|
switch (filterID)
|
||||||
|
@ -6942,22 +6955,22 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
|
|
||||||
case VideoFilterTypeID_LQ2X:
|
case VideoFilterTypeID_LQ2X:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexLQ2xLUT();
|
currentHQnxLUT = sharedData->GetTexLQ2xLUT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_LQ2XS:
|
case VideoFilterTypeID_LQ2XS:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xSFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xSFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexLQ2xLUT();
|
currentHQnxLUT = sharedData->GetTexLQ2xLUT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ2X:
|
case VideoFilterTypeID_HQ2X:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ2xLUT();
|
currentHQnxLUT = sharedData->GetTexHQ2xLUT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ2XS:
|
case VideoFilterTypeID_HQ2XS:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xSFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xSFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ2xLUT();
|
currentHQnxLUT = sharedData->GetTexHQ2xLUT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ3X:
|
case VideoFilterTypeID_HQ3X:
|
||||||
|
@ -6965,7 +6978,7 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
if (shaderSupport >= ShaderSupport_LowTier)
|
if (shaderSupport >= ShaderSupport_LowTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ3xLUT();
|
currentHQnxLUT = sharedData->GetTexHQ3xLUT();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6979,7 +6992,7 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
if (shaderSupport >= ShaderSupport_LowTier)
|
if (shaderSupport >= ShaderSupport_LowTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xSFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xSFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ3xLUT();
|
currentHQnxLUT = sharedData->GetTexHQ3xLUT();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6993,7 +7006,7 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
if (shaderSupport >= ShaderSupport_LowTier)
|
if (shaderSupport >= ShaderSupport_LowTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ4xLUT();
|
currentHQnxLUT = sharedData->GetTexHQ4xLUT();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7007,7 +7020,7 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
if (shaderSupport >= ShaderSupport_LowTier)
|
if (shaderSupport >= ShaderSupport_LowTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xSFragShader_110, false, useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xSFragShader_110, false, useShader150);
|
||||||
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ4xLUT();
|
currentHQnxLUT = sharedData->GetTexHQ4xLUT();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7119,13 +7132,14 @@ void OGLDisplayLayer::LoadNativeDisplayByID_OGL(const NDSDisplayID displayID)
|
||||||
{
|
{
|
||||||
if ((this->_output->GetPixelScaler() != VideoFilterTypeID_None) && !this->_output->WillFilterOnGPU() && !this->_output->GetSourceDeposterize())
|
if ((this->_output->GetPixelScaler() != VideoFilterTypeID_None) && !this->_output->WillFilterOnGPU() && !this->_output->GetSourceDeposterize())
|
||||||
{
|
{
|
||||||
OGLClientFetchObject &fetchObjMutable = (OGLClientFetchObject &)this->_output->GetFetchObject();
|
const GPUClientFetchObject &fetchObj = this->_output->GetFetchObject();
|
||||||
|
OGLClientSharedData *sharedData = (OGLClientSharedData *)fetchObj.GetClientData();
|
||||||
VideoFilter *vf = this->_output->GetPixelScalerObject(displayID);
|
VideoFilter *vf = this->_output->GetPixelScalerObject(displayID);
|
||||||
|
|
||||||
const uint8_t bufferIndex = fetchObjMutable.GetLastFetchIndex();
|
const uint8_t bufferIndex = fetchObj.GetLastFetchIndex();
|
||||||
|
|
||||||
pthread_rwlock_wrlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
pthread_rwlock_wrlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
||||||
fetchObjMutable.CopyFromSrcClone(vf->GetSrcBufferPtr(), displayID, bufferIndex);
|
sharedData->CopyFromSrcClone(vf->GetSrcBufferPtr(), displayID, bufferIndex);
|
||||||
pthread_rwlock_unlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
pthread_rwlock_unlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7134,20 +7148,23 @@ void OGLDisplayLayer::LoadCustomDisplayByID_OGL(const NDSDisplayID displayID)
|
||||||
{
|
{
|
||||||
if ((this->_output->GetPixelScaler() != VideoFilterTypeID_None) && !this->_output->WillFilterOnGPU() && !this->_output->GetSourceDeposterize() && (this->_output->GetEmuDisplayInfo().customWidth == GPU_FRAMEBUFFER_NATIVE_WIDTH) && (this->_output->GetEmuDisplayInfo().customHeight == GPU_FRAMEBUFFER_NATIVE_HEIGHT) )
|
if ((this->_output->GetPixelScaler() != VideoFilterTypeID_None) && !this->_output->WillFilterOnGPU() && !this->_output->GetSourceDeposterize() && (this->_output->GetEmuDisplayInfo().customWidth == GPU_FRAMEBUFFER_NATIVE_WIDTH) && (this->_output->GetEmuDisplayInfo().customHeight == GPU_FRAMEBUFFER_NATIVE_HEIGHT) )
|
||||||
{
|
{
|
||||||
OGLClientFetchObject &fetchObjMutable = (OGLClientFetchObject &)this->_output->GetFetchObject();
|
const GPUClientFetchObject &fetchObj = this->_output->GetFetchObject();
|
||||||
|
OGLClientSharedData *sharedData = (OGLClientSharedData *)fetchObj.GetClientData();
|
||||||
VideoFilter *vf = this->_output->GetPixelScalerObject(displayID);
|
VideoFilter *vf = this->_output->GetPixelScalerObject(displayID);
|
||||||
|
|
||||||
const uint8_t bufferIndex = fetchObjMutable.GetLastFetchIndex();
|
const uint8_t bufferIndex = fetchObj.GetLastFetchIndex();
|
||||||
|
|
||||||
pthread_rwlock_wrlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
pthread_rwlock_wrlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
||||||
fetchObjMutable.CopyFromSrcClone(vf->GetSrcBufferPtr(), displayID, bufferIndex);
|
sharedData->CopyFromSrcClone(vf->GetSrcBufferPtr(), displayID, bufferIndex);
|
||||||
pthread_rwlock_unlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
pthread_rwlock_unlock(&this->_cpuFilterRWLock[displayID][bufferIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLDisplayLayer::ProcessOGL()
|
void OGLDisplayLayer::ProcessOGL()
|
||||||
{
|
{
|
||||||
OGLClientFetchObject &fetchObj = (OGLClientFetchObject &)this->_output->GetFetchObject();
|
const GPUClientFetchObject &fetchObj = this->_output->GetFetchObject();
|
||||||
|
OGLClientSharedData *sharedData = (OGLClientSharedData *)fetchObj.GetClientData();
|
||||||
|
|
||||||
const uint8_t bufferIndex = fetchObj.GetLastFetchIndex();
|
const uint8_t bufferIndex = fetchObj.GetLastFetchIndex();
|
||||||
const NDSDisplayInfo &emuDisplayInfo = this->_output->GetEmuDisplayInfo();
|
const NDSDisplayInfo &emuDisplayInfo = this->_output->GetEmuDisplayInfo();
|
||||||
const ClientDisplayMode mode = this->_output->GetPresenterProperties().mode;
|
const ClientDisplayMode mode = this->_output->GetPresenterProperties().mode;
|
||||||
|
@ -7156,8 +7173,8 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
|
|
||||||
const bool didRenderNative[2] = { !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Main]], !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Touch]] };
|
const bool didRenderNative[2] = { !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Main]], !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Touch]] };
|
||||||
|
|
||||||
GLuint texMain = (selectedDisplaySource[NDSDisplayID_Main] == NDSDisplayID_Main) ? fetchObj.GetFetchTexture(NDSDisplayID_Main) : fetchObj.GetFetchTexture(NDSDisplayID_Touch);
|
GLuint texMain = (selectedDisplaySource[NDSDisplayID_Main] == NDSDisplayID_Main) ? sharedData->GetFetchTexture(NDSDisplayID_Main) : sharedData->GetFetchTexture(NDSDisplayID_Touch);
|
||||||
GLuint texTouch = (selectedDisplaySource[NDSDisplayID_Touch] == NDSDisplayID_Touch) ? fetchObj.GetFetchTexture(NDSDisplayID_Touch) : fetchObj.GetFetchTexture(NDSDisplayID_Main);
|
GLuint texTouch = (selectedDisplaySource[NDSDisplayID_Touch] == NDSDisplayID_Touch) ? sharedData->GetFetchTexture(NDSDisplayID_Touch) : sharedData->GetFetchTexture(NDSDisplayID_Main);
|
||||||
|
|
||||||
GLsizei width[2] = { (GLsizei)emuDisplayInfo.renderedWidth[selectedDisplaySource[NDSDisplayID_Main]], (GLsizei)emuDisplayInfo.renderedWidth[selectedDisplaySource[NDSDisplayID_Touch]] };
|
GLsizei width[2] = { (GLsizei)emuDisplayInfo.renderedWidth[selectedDisplaySource[NDSDisplayID_Main]], (GLsizei)emuDisplayInfo.renderedWidth[selectedDisplaySource[NDSDisplayID_Touch]] };
|
||||||
GLsizei height[2] = { (GLsizei)emuDisplayInfo.renderedHeight[selectedDisplaySource[NDSDisplayID_Main]], (GLsizei)emuDisplayInfo.renderedHeight[selectedDisplaySource[NDSDisplayID_Touch]] };
|
GLsizei height[2] = { (GLsizei)emuDisplayInfo.renderedHeight[selectedDisplaySource[NDSDisplayID_Main]], (GLsizei)emuDisplayInfo.renderedHeight[selectedDisplaySource[NDSDisplayID_Touch]] };
|
||||||
|
@ -7190,7 +7207,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
{
|
{
|
||||||
if (texFetchMainNeedsLock)
|
if (texFetchMainNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureReadLock(NDSDisplayID_Main);
|
sharedData->FetchTextureReadLock(NDSDisplayID_Main);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For all shader-based filters, we need to temporarily disable GL_UNPACK_CLIENT_STORAGE_APPLE.
|
// For all shader-based filters, we need to temporarily disable GL_UNPACK_CLIENT_STORAGE_APPLE.
|
||||||
|
@ -7202,7 +7219,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
|
|
||||||
if (texFetchMainNeedsLock)
|
if (texFetchMainNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Main);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Main);
|
||||||
}
|
}
|
||||||
|
|
||||||
isDisplayProcessedMain = true;
|
isDisplayProcessedMain = true;
|
||||||
|
@ -7219,7 +7236,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
{
|
{
|
||||||
if (texFetchTouchNeedsLock)
|
if (texFetchTouchNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureReadLock(NDSDisplayID_Touch);
|
sharedData->FetchTextureReadLock(NDSDisplayID_Touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
||||||
|
@ -7228,7 +7245,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
|
|
||||||
if (texFetchTouchNeedsLock)
|
if (texFetchTouchNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Touch);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
isDisplayProcessedTouch = true;
|
isDisplayProcessedTouch = true;
|
||||||
|
@ -7250,7 +7267,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
{
|
{
|
||||||
if (texFetchMainNeedsLock)
|
if (texFetchMainNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureReadLock(NDSDisplayID_Main);
|
sharedData->FetchTextureReadLock(NDSDisplayID_Main);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
||||||
|
@ -7259,7 +7276,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
|
|
||||||
if (texFetchMainNeedsLock)
|
if (texFetchMainNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Main);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Main);
|
||||||
}
|
}
|
||||||
|
|
||||||
width[NDSDisplayID_Main] = (GLsizei)vfMain->GetDstWidth();
|
width[NDSDisplayID_Main] = (GLsizei)vfMain->GetDstWidth();
|
||||||
|
@ -7278,7 +7295,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
{
|
{
|
||||||
if (texFetchTouchNeedsLock)
|
if (texFetchTouchNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureReadLock(NDSDisplayID_Touch);
|
sharedData->FetchTextureReadLock(NDSDisplayID_Touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
||||||
|
@ -7287,7 +7304,7 @@ void OGLDisplayLayer::ProcessOGL()
|
||||||
|
|
||||||
if (texFetchTouchNeedsLock)
|
if (texFetchTouchNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Touch);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
width[NDSDisplayID_Touch] = (GLsizei)vfTouch->GetDstWidth();
|
width[NDSDisplayID_Touch] = (GLsizei)vfTouch->GetDstWidth();
|
||||||
|
@ -7444,7 +7461,8 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
this->_UpdateVerticesOGL();
|
this->_UpdateVerticesOGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
OGLClientFetchObject &fetchObj = (OGLClientFetchObject &)this->_output->GetFetchObject();
|
const GPUClientFetchObject &fetchObj = this->_output->GetFetchObject();
|
||||||
|
OGLClientSharedData *sharedData = (OGLClientSharedData *)fetchObj.GetClientData();
|
||||||
const NDSDisplayInfo &emuDisplayInfo = this->_output->GetEmuDisplayInfo();
|
const NDSDisplayInfo &emuDisplayInfo = this->_output->GetEmuDisplayInfo();
|
||||||
const float backlightIntensity[2] = { emuDisplayInfo.backlightIntensity[NDSDisplayID_Main], emuDisplayInfo.backlightIntensity[NDSDisplayID_Touch] };
|
const float backlightIntensity[2] = { emuDisplayInfo.backlightIntensity[NDSDisplayID_Main], emuDisplayInfo.backlightIntensity[NDSDisplayID_Touch] };
|
||||||
|
|
||||||
|
@ -7473,7 +7491,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchMainNeedsLock)
|
if (texFetchMainNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureWriteLock(NDSDisplayID_Main);
|
sharedData->FetchTextureWriteLock(NDSDisplayID_Main);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Main]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Main]);
|
||||||
|
@ -7483,7 +7501,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchMainNeedsLock)
|
if (texFetchMainNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Main);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Main);
|
||||||
texFetchMainNeedsLock = false;
|
texFetchMainNeedsLock = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7501,7 +7519,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchTouchNeedsLock)
|
if (texFetchTouchNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureWriteLock(NDSDisplayID_Touch);
|
sharedData->FetchTextureWriteLock(NDSDisplayID_Touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Touch]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Touch]);
|
||||||
|
@ -7511,7 +7529,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchTouchNeedsLock)
|
if (texFetchTouchNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Touch);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Touch);
|
||||||
texFetchTouchNeedsLock = false;
|
texFetchTouchNeedsLock = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7543,7 +7561,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchMajorNeedsLock)
|
if (texFetchMajorNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureWriteLock(majorDisplayID);
|
sharedData->FetchTextureWriteLock(majorDisplayID);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[majorDisplayID]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[majorDisplayID]);
|
||||||
|
@ -7579,7 +7597,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchMainNeedsLock && !texFetchMainAlreadyLocked)
|
if (texFetchMainNeedsLock && !texFetchMainAlreadyLocked)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureWriteLock(NDSDisplayID_Main);
|
sharedData->FetchTextureWriteLock(NDSDisplayID_Main);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Main]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Main]);
|
||||||
|
@ -7589,7 +7607,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchMainNeedsLock)
|
if (texFetchMainNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Main);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Main);
|
||||||
texFetchMainNeedsLock = false;
|
texFetchMainNeedsLock = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7603,7 +7621,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchTouchNeedsLock && !texFetchTouchAlreadyLocked)
|
if (texFetchTouchNeedsLock && !texFetchTouchAlreadyLocked)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureWriteLock(NDSDisplayID_Touch);
|
sharedData->FetchTextureWriteLock(NDSDisplayID_Touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Touch]);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[NDSDisplayID_Touch]);
|
||||||
|
@ -7613,7 +7631,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
||||||
|
|
||||||
if (texFetchTouchNeedsLock)
|
if (texFetchTouchNeedsLock)
|
||||||
{
|
{
|
||||||
fetchObj.FetchTextureUnlock(NDSDisplayID_Touch);
|
sharedData->FetchTextureUnlock(NDSDisplayID_Touch);
|
||||||
texFetchTouchNeedsLock = false;
|
texFetchTouchNeedsLock = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ public:
|
||||||
virtual void RenderOGL(bool isRenderingFlipped);
|
virtual void RenderOGL(bool isRenderingFlipped);
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLClientFetchObject : public GPUClientFetchObject
|
class OGLClientSharedData
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
OGLContextInfo *_contextInfo;
|
OGLContextInfo *_contextInfo;
|
||||||
|
@ -360,14 +360,19 @@ protected:
|
||||||
pthread_rwlock_t _texFetchRWLock[2];
|
pthread_rwlock_t _texFetchRWLock[2];
|
||||||
bool _srcCloneNeedsUpdate[2][OPENGL_FETCH_BUFFER_COUNT];
|
bool _srcCloneNeedsUpdate[2][OPENGL_FETCH_BUFFER_COUNT];
|
||||||
|
|
||||||
virtual void _FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex);
|
|
||||||
virtual void _FetchCustomDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OGLClientFetchObject();
|
OGLClientSharedData();
|
||||||
virtual ~OGLClientFetchObject();
|
virtual ~OGLClientSharedData();
|
||||||
|
|
||||||
|
void SetContextInfo(OGLContextInfo *contextInfo);
|
||||||
OGLContextInfo* GetContextInfo() const;
|
OGLContextInfo* GetContextInfo() const;
|
||||||
|
|
||||||
|
void SetUseDirectToCPUFilterPipeline(bool willUseDirectCPU);
|
||||||
|
bool UseDirectToCPUFilterPipeline() const;
|
||||||
|
|
||||||
|
virtual GLuint GetFetchTexture(const NDSDisplayID displayID);
|
||||||
|
virtual void SetFetchTexture(const NDSDisplayID displayID, GLuint texID);
|
||||||
|
|
||||||
uint32_t* GetSrcClone(const NDSDisplayID displayID, const u8 bufferIndex) const;
|
uint32_t* GetSrcClone(const NDSDisplayID displayID, const u8 bufferIndex) const;
|
||||||
GLuint GetTexNative(const NDSDisplayID displayID, const u8 bufferIndex) const;
|
GLuint GetTexNative(const NDSDisplayID displayID, const u8 bufferIndex) const;
|
||||||
GLuint GetTexCustom(const NDSDisplayID displayID, const u8 bufferIndex) const;
|
GLuint GetTexCustom(const NDSDisplayID displayID, const u8 bufferIndex) const;
|
||||||
|
@ -380,18 +385,19 @@ public:
|
||||||
GLuint GetTexHQ4xLUT() const;
|
GLuint GetTexHQ4xLUT() const;
|
||||||
|
|
||||||
void CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex);
|
void CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex);
|
||||||
void FetchNativeDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
|
void FetchNativeDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
|
||||||
void FetchCustomDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
|
void FetchCustomDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
|
||||||
void FetchTextureWriteLock(const NDSDisplayID displayID);
|
void FetchTextureWriteLock(const NDSDisplayID displayID);
|
||||||
void FetchTextureReadLock(const NDSDisplayID displayID);
|
void FetchTextureReadLock(const NDSDisplayID displayID);
|
||||||
void FetchTextureUnlock(const NDSDisplayID displayID);
|
void FetchTextureUnlock(const NDSDisplayID displayID);
|
||||||
|
|
||||||
virtual void Init();
|
// OpenGL-specific functions that must be called in response to their
|
||||||
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
// corresponding GPUClientFetchObject methods.
|
||||||
virtual void FetchFromBufferIndex(const u8 index);
|
void InitOGL();
|
||||||
|
void SetFetchBuffersOGL(const NDSDisplayInfo *displayInfoList, const NDSDisplayInfo ¤tDisplayInfo);
|
||||||
virtual GLuint GetFetchTexture(const NDSDisplayID displayID);
|
void FetchFromBufferIndexOGL(const u8 index, const NDSDisplayInfo ¤tDisplayInfo);
|
||||||
virtual void SetFetchTexture(const NDSDisplayID displayID, GLuint texID);
|
void FetchNativeDisplayByID_OGL(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex);
|
||||||
|
void FetchCustomDisplayByID_OGL(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLVideoOutput : public ClientDisplay3DPresenter
|
class OGLVideoOutput : public ClientDisplay3DPresenter
|
||||||
|
|
|
@ -15,12 +15,30 @@
|
||||||
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#if defined(PORT_VERSION_OS_X_APP)
|
||||||
#import <CoreVideo/CoreVideo.h>
|
#define ENABLE_ASYNC_FETCH
|
||||||
|
#define ENABLE_DISPLAYLINK_FETCH
|
||||||
|
#define ENABLE_SHARED_FETCH_OBJECT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_ASYNC_FETCH
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <mach/task.h>
|
#include <mach/task.h>
|
||||||
#include <mach/semaphore.h>
|
#include <mach/semaphore.h>
|
||||||
#include <mach/sync_policy.h>
|
#include <mach/sync_policy.h>
|
||||||
|
|
||||||
|
// This symbol only exists in the kernel headers, but not in the user headers.
|
||||||
|
// Manually define the symbol here, since we will be Mach semaphores in the user-space.
|
||||||
|
#ifndef SYNC_POLICY_PREPOST
|
||||||
|
#define SYNC_POLICY_PREPOST 0x4
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_DISPLAYLINK_FETCH
|
||||||
|
#import <CoreVideo/CoreVideo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
@ -28,21 +46,11 @@
|
||||||
#import "cocoa_util.h"
|
#import "cocoa_util.h"
|
||||||
#include "../../GPU.h"
|
#include "../../GPU.h"
|
||||||
|
|
||||||
// This symbol only exists in the kernel headers, but not in the user headers.
|
|
||||||
// Manually define the symbol here, since we will be Mach semaphores in the user-space.
|
|
||||||
#ifndef SYNC_POLICY_PREPOST
|
|
||||||
#define SYNC_POLICY_PREPOST 0x4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BOOL
|
#ifdef BOOL
|
||||||
#undef BOOL
|
#undef BOOL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PORT_VERSION_OS_X_APP)
|
#if defined(ENABLE_ASYNC_FETCH) && defined(ENABLE_DISPLAYLINK_FETCH) && !defined(METAL_DISABLE_FOR_BUILD_TARGET) && defined(MAC_OS_X_VERSION_10_11) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11)
|
||||||
#define ENABLE_SHARED_FETCH_OBJECT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ENABLE_SHARED_FETCH_OBJECT) && !defined(METAL_DISABLE_FOR_BUILD_TARGET) && defined(MAC_OS_X_VERSION_10_11) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11)
|
|
||||||
#define ENABLE_APPLE_METAL
|
#define ENABLE_APPLE_METAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -60,64 +68,133 @@ enum ClientDisplayBufferState
|
||||||
class GPUEventHandlerOSX;
|
class GPUEventHandlerOSX;
|
||||||
class ClientDisplay3DView;
|
class ClientDisplay3DView;
|
||||||
|
|
||||||
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
#ifdef ENABLE_ASYNC_FETCH
|
||||||
|
|
||||||
typedef std::map<CGDirectDisplayID, CVDisplayLinkRef> DisplayLinksActiveMap;
|
class MacGPUFetchObjectAsync : public GPUClientFetchObject
|
||||||
typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
|
|
||||||
|
|
||||||
@interface MacClientSharedObject : NSObject
|
|
||||||
{
|
{
|
||||||
GPUClientFetchObject *GPUFetchObject;
|
protected:
|
||||||
task_t _taskEmulationLoop;
|
task_t _taskEmulationLoop;
|
||||||
|
|
||||||
apple_unfairlock_t _unfairlockFramebufferStates[MAX_FRAMEBUFFER_PAGES];
|
apple_unfairlock_t _unfairlockFramebufferStates[MAX_FRAMEBUFFER_PAGES];
|
||||||
semaphore_t _semFramebuffer[MAX_FRAMEBUFFER_PAGES];
|
semaphore_t _semFramebuffer[MAX_FRAMEBUFFER_PAGES];
|
||||||
volatile ClientDisplayBufferState _framebufferState[MAX_FRAMEBUFFER_PAGES];
|
volatile ClientDisplayBufferState _framebufferState[MAX_FRAMEBUFFER_PAGES];
|
||||||
|
|
||||||
pthread_rwlock_t *_rwlockOutputList;
|
|
||||||
pthread_mutex_t _mutexDisplayLinkLists;
|
|
||||||
NSMutableArray *_cdsOutputList;
|
|
||||||
volatile int32_t numberViewsUsingDirectToCPUFiltering;
|
|
||||||
|
|
||||||
DisplayLinksActiveMap _displayLinksActiveList;
|
|
||||||
DisplayLinkFlushTimeLimitMap _displayLinkFlushTimeList;
|
|
||||||
|
|
||||||
uint32_t _threadMessageID;
|
uint32_t _threadMessageID;
|
||||||
uint8_t _fetchIndex;
|
uint8_t _fetchIndex;
|
||||||
pthread_t _threadFetch;
|
pthread_t _threadFetch;
|
||||||
pthread_cond_t _condSignalFetch;
|
pthread_cond_t _condSignalFetch;
|
||||||
pthread_mutex_t _mutexFetchExecute;
|
pthread_mutex_t _mutexFetchExecute;
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacGPUFetchObjectAsync();
|
||||||
|
~MacGPUFetchObjectAsync();
|
||||||
|
|
||||||
|
virtual void Init();
|
||||||
|
|
||||||
|
void SemaphoreFramebufferCreate();
|
||||||
|
void SemaphoreFramebufferDestroy();
|
||||||
|
uint8_t SelectBufferIndex(const uint8_t currentIndex, size_t pageCount);
|
||||||
|
semaphore_t SemaphoreFramebufferPageAtIndex(const u8 bufferIndex);
|
||||||
|
ClientDisplayBufferState FramebufferStateAtIndex(uint8_t index);
|
||||||
|
void SetFramebufferState(ClientDisplayBufferState bufferState, uint8_t index);
|
||||||
|
|
||||||
|
void FetchSynchronousAtIndex(uint8_t index);
|
||||||
|
void SignalFetchAtIndex(uint8_t index, int32_t messageID);
|
||||||
|
void RunFetchLoop();
|
||||||
|
virtual void DoPostFetchActions();
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef ENABLE_DISPLAYLINK_FETCH
|
||||||
|
|
||||||
|
typedef std::map<CGDirectDisplayID, CVDisplayLinkRef> DisplayLinksActiveMap;
|
||||||
|
typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
|
||||||
|
|
||||||
|
class MacGPUFetchObjectDisplayLink : public MacGPUFetchObjectAsync
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
pthread_rwlock_t *_rwlockOutputList;
|
||||||
|
pthread_mutex_t _mutexDisplayLinkLists;
|
||||||
|
NSMutableArray *_cdsOutputList;
|
||||||
|
volatile int32_t _numberViewsUsingDirectToCPUFiltering;
|
||||||
|
|
||||||
|
DisplayLinksActiveMap _displayLinksActiveList;
|
||||||
|
DisplayLinkFlushTimeLimitMap _displayLinkFlushTimeList;
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacGPUFetchObjectDisplayLink();
|
||||||
|
~MacGPUFetchObjectDisplayLink();
|
||||||
|
|
||||||
|
volatile int32_t GetNumberViewsUsingDirectToCPUFiltering() const;
|
||||||
|
|
||||||
|
void SetOutputList(NSMutableArray *theOutputList, pthread_rwlock_t *theRWLock);
|
||||||
|
void IncrementViewsUsingDirectToCPUFiltering();
|
||||||
|
void DecrementViewsUsingDirectToCPUFiltering();
|
||||||
|
void PushVideoDataToAllDisplayViews();
|
||||||
|
|
||||||
|
void DisplayLinkStartUsingID(CGDirectDisplayID displayID);
|
||||||
|
void DisplayLinkListUpdate();
|
||||||
|
|
||||||
|
virtual void FlushAllDisplaysOnDisplayLink(CVDisplayLinkRef displayLink, const CVTimeStamp *timeStampNow, const CVTimeStamp *timeStampOutput);
|
||||||
|
virtual void FlushMultipleViews(const std::vector<ClientDisplay3DView *> &cdvFlushList, const CVTimeStamp *timeStampNow, const CVTimeStamp *timeStampOutput);
|
||||||
|
|
||||||
|
virtual void DoPostFetchActions();
|
||||||
|
};
|
||||||
|
|
||||||
|
@interface MacClientSharedObject : NSObject
|
||||||
|
{
|
||||||
|
MacGPUFetchObjectDisplayLink *GPUFetchObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (assign, nonatomic) GPUClientFetchObject *GPUFetchObject;
|
@property (assign, nonatomic) MacGPUFetchObjectDisplayLink *GPUFetchObject;
|
||||||
@property (readonly, nonatomic) volatile int32_t numberViewsUsingDirectToCPUFiltering;
|
|
||||||
|
|
||||||
- (void) semaphoreFramebufferCreate;
|
|
||||||
- (void) semaphoreFramebufferDestroy;
|
|
||||||
- (u8) selectBufferIndex:(const u8)currentIndex pageCount:(size_t)pageCount;
|
|
||||||
- (semaphore_t) semaphoreFramebufferPageAtIndex:(const u8)bufferIndex;
|
|
||||||
- (ClientDisplayBufferState) framebufferStateAtIndex:(uint8_t)index;
|
|
||||||
- (void) setFramebufferState:(ClientDisplayBufferState)bufferState index:(uint8_t)index;
|
|
||||||
|
|
||||||
- (void) setOutputList:(NSMutableArray *)theOutputList rwlock:(pthread_rwlock_t *)theRWLock;
|
|
||||||
- (void) incrementViewsUsingDirectToCPUFiltering;
|
|
||||||
- (void) decrementViewsUsingDirectToCPUFiltering;
|
|
||||||
- (void) pushVideoDataToAllDisplayViews;
|
|
||||||
|
|
||||||
- (void) flushAllDisplaysOnDisplayLink:(CVDisplayLinkRef)displayLink timeStampNow:(const CVTimeStamp *)timeStampNow timeStampOutput:(const CVTimeStamp *)timeStampOutput;
|
|
||||||
- (void) flushMultipleViews:(const std::vector<ClientDisplay3DView *> &)cdvFlushList timeStampNow:(const CVTimeStamp *)timeStampNow timeStampOutput:(const CVTimeStamp *)timeStampOutput;
|
|
||||||
|
|
||||||
- (void) displayLinkStartUsingID:(CGDirectDisplayID)displayID;
|
|
||||||
- (void) displayLinkListUpdate;
|
|
||||||
|
|
||||||
- (void) fetchSynchronousAtIndex:(uint8_t)index;
|
|
||||||
- (void) signalFetchAtIndex:(uint8_t)index message:(int32_t)messageID;
|
|
||||||
- (void) runFetchLoop;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#endif // ENABLE_DISPLAYLINK_FETCH
|
||||||
|
|
||||||
|
#endif // ENABLE_ASYNC_FETCH
|
||||||
|
|
||||||
|
class GPUEventHandlerOSX : public GPUEventHandlerDefault
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
GPUClientFetchObject *_fetchObject;
|
||||||
|
|
||||||
|
pthread_mutex_t _mutexFrame;
|
||||||
|
pthread_mutex_t _mutex3DRender;
|
||||||
|
pthread_mutex_t _mutexApplyGPUSettings;
|
||||||
|
pthread_mutex_t _mutexApplyRender3DSettings;
|
||||||
|
bool _render3DNeedsFinish;
|
||||||
|
|
||||||
|
public:
|
||||||
|
GPUEventHandlerOSX();
|
||||||
|
~GPUEventHandlerOSX();
|
||||||
|
|
||||||
|
GPUClientFetchObject* GetFetchObject() const;
|
||||||
|
void SetFetchObject(GPUClientFetchObject *fetchObject);
|
||||||
|
|
||||||
|
void FramebufferLock();
|
||||||
|
void FramebufferUnlock();
|
||||||
|
void Render3DLock();
|
||||||
|
void Render3DUnlock();
|
||||||
|
void ApplyGPUSettingsLock();
|
||||||
|
void ApplyGPUSettingsUnlock();
|
||||||
|
void ApplyRender3DSettingsLock();
|
||||||
|
void ApplyRender3DSettingsUnlock();
|
||||||
|
|
||||||
|
bool GetRender3DNeedsFinish();
|
||||||
|
|
||||||
|
#ifdef ENABLE_ASYNC_FETCH
|
||||||
|
virtual void DidFrameBegin(const size_t line, const bool isFrameSkipRequested, const size_t pageCount, u8 &selectedBufferIndexInOut);
|
||||||
|
virtual void DidFrameEnd(bool isFrameSkipped, const NDSDisplayInfo &latestDisplayInfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual void DidRender3DBegin();
|
||||||
|
virtual void DidRender3DEnd();
|
||||||
|
virtual void DidApplyGPUSettingsBegin();
|
||||||
|
virtual void DidApplyGPUSettingsEnd();
|
||||||
|
virtual void DidApplyRender3DSettingsBegin();
|
||||||
|
virtual void DidApplyRender3DSettingsEnd();
|
||||||
|
};
|
||||||
|
|
||||||
@interface CocoaDSGPU : NSObject
|
@interface CocoaDSGPU : NSObject
|
||||||
{
|
{
|
||||||
UInt32 gpuStateFlags;
|
UInt32 gpuStateFlags;
|
||||||
|
@ -170,11 +247,9 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
|
||||||
@property (assign) BOOL openGLEmulateSpecialZeroAlphaBlending;
|
@property (assign) BOOL openGLEmulateSpecialZeroAlphaBlending;
|
||||||
@property (assign) BOOL openGLEmulateNDSDepthCalculation;
|
@property (assign) BOOL openGLEmulateNDSDepthCalculation;
|
||||||
@property (assign) BOOL openGLEmulateDepthLEqualPolygonFacing;
|
@property (assign) BOOL openGLEmulateDepthLEqualPolygonFacing;
|
||||||
|
|
||||||
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
|
||||||
@property (readonly, nonatomic) GPUClientFetchObject *fetchObject;
|
@property (readonly, nonatomic) GPUClientFetchObject *fetchObject;
|
||||||
@property (readonly, nonatomic) MacClientSharedObject *sharedData;
|
|
||||||
|
|
||||||
|
#ifdef ENABLE_DISPLAYLINK_FETCH
|
||||||
- (void) setOutputList:(NSMutableArray *)theOutputList rwlock:(pthread_rwlock_t *)theRWLock;
|
- (void) setOutputList:(NSMutableArray *)theOutputList rwlock:(pthread_rwlock_t *)theRWLock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -190,18 +265,6 @@ extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_SHARED_FETCH_OBJECT
|
|
||||||
|
|
||||||
static void* RunFetchThread(void *arg);
|
|
||||||
|
|
||||||
CVReturn MacDisplayLinkCallback(CVDisplayLinkRef displayLink,
|
|
||||||
const CVTimeStamp *inNow,
|
|
||||||
const CVTimeStamp *inOutputTime,
|
|
||||||
CVOptionFlags flagsIn,
|
|
||||||
CVOptionFlags *flagsOut,
|
|
||||||
void *displayLinkContext);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool OSXOpenGLRendererInit();
|
bool OSXOpenGLRendererInit();
|
||||||
bool OSXOpenGLRendererBegin();
|
bool OSXOpenGLRendererBegin();
|
||||||
void OSXOpenGLRendererEnd();
|
void OSXOpenGLRendererEnd();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -188,7 +188,7 @@ volatile bool execute = true;
|
||||||
|
|
||||||
[self removeAllOutputs];
|
[self removeAllOutputs];
|
||||||
|
|
||||||
[[cdsGPU sharedData] semaphoreFramebufferDestroy];
|
((MacGPUFetchObjectAsync *)[cdsGPU fetchObject])->SemaphoreFramebufferDestroy();
|
||||||
|
|
||||||
[self setCdsFirmware:nil];
|
[self setCdsFirmware:nil];
|
||||||
|
|
||||||
|
@ -1179,7 +1179,7 @@ static void* RunCoreThread(void *arg)
|
||||||
ExecutionBehavior lastBehavior = ExecutionBehavior_Pause;
|
ExecutionBehavior lastBehavior = ExecutionBehavior_Pause;
|
||||||
uint64_t frameJumpTarget = 0;
|
uint64_t frameJumpTarget = 0;
|
||||||
|
|
||||||
[[cdsGPU sharedData] semaphoreFramebufferCreate];
|
((MacGPUFetchObjectAsync *)[cdsGPU fetchObject])->SemaphoreFramebufferCreate();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
|
@ -395,3 +395,24 @@ enum
|
||||||
PADDLE_CONTROL_RELATIVE = 0,
|
PADDLE_CONTROL_RELATIVE = 0,
|
||||||
PADDLE_CONTROL_DIRECT
|
PADDLE_CONTROL_DIRECT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
GPUClientFetchObjectIDMask_Async = (1 << 0),
|
||||||
|
GPUClientFetchObjectIDMask_DisplayLink = (1 << 1),
|
||||||
|
GPUClientFetchObjectIDMask_OpenGL = (1 << 2),
|
||||||
|
GPUClientFetchObjectIDMask_Metal = (1 << 3),
|
||||||
|
GPUClientFetchObjectIDMask_macOS = (1 << 4),
|
||||||
|
GPUClientFetchObjectIDMask_OpenEmu = (1 << 5)
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
GPUClientFetchObjectID_Default = 0,
|
||||||
|
GPUClientFetchObjectID_GenericAsync = GPUClientFetchObjectIDMask_Async,
|
||||||
|
GPUClientFetchObjectID_GenericDisplayLink = GPUClientFetchObjectIDMask_Async | GPUClientFetchObjectIDMask_DisplayLink,
|
||||||
|
GPUClientFetchObjectID_GenericOpenGL = GPUClientFetchObjectIDMask_Async | GPUClientFetchObjectIDMask_DisplayLink | GPUClientFetchObjectIDMask_OpenGL,
|
||||||
|
GPUClientFetchObjectID_MacOpenGL = GPUClientFetchObjectIDMask_Async | GPUClientFetchObjectIDMask_DisplayLink | GPUClientFetchObjectIDMask_OpenGL | GPUClientFetchObjectIDMask_macOS,
|
||||||
|
GPUClientFetchObjectID_MacMetal = GPUClientFetchObjectIDMask_Async | GPUClientFetchObjectIDMask_DisplayLink | GPUClientFetchObjectIDMask_Metal | GPUClientFetchObjectIDMask_macOS,
|
||||||
|
GPUClientFetchObjectID_OpenEmu = GPUClientFetchObjectIDMask_Async | GPUClientFetchObjectIDMask_DisplayLink | GPUClientFetchObjectIDMask_OpenGL | GPUClientFetchObjectIDMask_OpenEmu
|
||||||
|
};
|
||||||
|
|
|
@ -1978,16 +1978,15 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
||||||
{
|
{
|
||||||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
||||||
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
|
MacGPUFetchObjectDisplayLink *dlFetchObj = (MacGPUFetchObjectDisplayLink *)[[cdsCore cdsGPU] fetchObject];
|
||||||
MacClientSharedObject *macSharedData = [cdsGPU sharedData];
|
|
||||||
|
|
||||||
if (newState)
|
if (newState)
|
||||||
{
|
{
|
||||||
[macSharedData incrementViewsUsingDirectToCPUFiltering];
|
dlFetchObj->IncrementViewsUsingDirectToCPUFiltering();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[macSharedData decrementViewsUsingDirectToCPUFiltering];
|
dlFetchObj->DecrementViewsUsingDirectToCPUFiltering();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[self cdsVideoOutput] signalMessage:MESSAGE_RELOAD_REPROCESS_REDRAW];
|
[[self cdsVideoOutput] signalMessage:MESSAGE_RELOAD_REPROCESS_REDRAW];
|
||||||
|
@ -2009,16 +2008,15 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
||||||
{
|
{
|
||||||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
||||||
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
|
MacGPUFetchObjectDisplayLink *dlFetchObj = (MacGPUFetchObjectDisplayLink *)[[cdsCore cdsGPU] fetchObject];
|
||||||
MacClientSharedObject *macSharedData = [cdsGPU sharedData];
|
|
||||||
|
|
||||||
if (newState)
|
if (newState)
|
||||||
{
|
{
|
||||||
[macSharedData incrementViewsUsingDirectToCPUFiltering];
|
dlFetchObj->IncrementViewsUsingDirectToCPUFiltering();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[macSharedData decrementViewsUsingDirectToCPUFiltering];
|
dlFetchObj->DecrementViewsUsingDirectToCPUFiltering();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2051,16 +2049,15 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
||||||
{
|
{
|
||||||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
||||||
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
|
MacGPUFetchObjectDisplayLink *dlFetchObj = (MacGPUFetchObjectDisplayLink *)[[cdsCore cdsGPU] fetchObject];
|
||||||
MacClientSharedObject *macSharedData = [cdsGPU sharedData];
|
|
||||||
|
|
||||||
if (newState)
|
if (newState)
|
||||||
{
|
{
|
||||||
[macSharedData incrementViewsUsingDirectToCPUFiltering];
|
dlFetchObj->IncrementViewsUsingDirectToCPUFiltering();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[macSharedData decrementViewsUsingDirectToCPUFiltering];
|
dlFetchObj->DecrementViewsUsingDirectToCPUFiltering();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2076,17 +2073,18 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
||||||
{
|
{
|
||||||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
CocoaDSCore *cdsCore = (CocoaDSCore *)[[[windowController emuControl] cdsCoreController] content];
|
||||||
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
|
MacGPUFetchObjectDisplayLink *dlFetchObj = (MacGPUFetchObjectDisplayLink *)[[cdsCore cdsGPU] fetchObject];
|
||||||
MacClientSharedObject *macSharedData = [cdsGPU sharedData];
|
|
||||||
|
|
||||||
#ifdef ENABLE_APPLE_METAL
|
#ifdef ENABLE_APPLE_METAL
|
||||||
BOOL isMetalLayer = NO;
|
BOOL isMetalLayer = NO;
|
||||||
|
|
||||||
if ((macSharedData != nil) && [macSharedData isKindOfClass:[MetalDisplayViewSharedData class]])
|
if ( (dlFetchObj->GetClientData() != nil) && (dlFetchObj->GetID() == GPUClientFetchObjectID_MacMetal) )
|
||||||
{
|
{
|
||||||
if ([(MetalDisplayViewSharedData *)macSharedData device] != nil)
|
MetalDisplayViewSharedData *metalSharedData = (MetalDisplayViewSharedData *)dlFetchObj->GetClientData();
|
||||||
|
|
||||||
|
if ([metalSharedData device] != nil)
|
||||||
{
|
{
|
||||||
MacMetalDisplayView *macMTLCDV = new MacMetalDisplayView(macSharedData);
|
MacMetalDisplayView *macMTLCDV = new MacMetalDisplayView(metalSharedData);
|
||||||
macMTLCDV->Init();
|
macMTLCDV->Init();
|
||||||
|
|
||||||
localLayer = macMTLCDV->GetCALayer();
|
localLayer = macMTLCDV->GetCALayer();
|
||||||
|
@ -2096,7 +2094,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
MacOGLDisplayView *macOGLCDV = new MacOGLDisplayView(macSharedData);
|
MacOGLDisplayView *macOGLCDV = new MacOGLDisplayView((MacOGLClientFetchObject *)dlFetchObj);
|
||||||
macOGLCDV->Init();
|
macOGLCDV->Init();
|
||||||
|
|
||||||
localLayer = macOGLCDV->GetCALayer();
|
localLayer = macOGLCDV->GetCALayer();
|
||||||
|
|
|
@ -2504,8 +2504,8 @@
|
||||||
|
|
||||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||||
[cdsCore updateCurrentSessionMACAddressString:NO];
|
[cdsCore updateCurrentSessionMACAddressString:NO];
|
||||||
[screenshotCaptureToolDelegate setSharedData:[[cdsCore cdsGPU] sharedData]];
|
[screenshotCaptureToolDelegate setFetchObject:[[cdsCore cdsGPU] fetchObject]];
|
||||||
[avCaptureToolDelegate setSharedData:[[cdsCore cdsGPU] sharedData]];
|
[avCaptureToolDelegate setFetchObject:[[cdsCore cdsGPU] fetchObject]];
|
||||||
[self fillOpenGLMSAAMenu];
|
[self fillOpenGLMSAAMenu];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2645,7 +2645,7 @@
|
||||||
[[cdsCore cdsGPU] setOpenGLEmulateNDSDepthCalculation:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_OpenGL_EmulateNDSDepthCalculation"]];
|
[[cdsCore cdsGPU] setOpenGLEmulateNDSDepthCalculation:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_OpenGL_EmulateNDSDepthCalculation"]];
|
||||||
[[cdsCore cdsGPU] setOpenGLEmulateDepthLEqualPolygonFacing:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_OpenGL_EmulateDepthLEqualPolygonFacing"]];
|
[[cdsCore cdsGPU] setOpenGLEmulateDepthLEqualPolygonFacing:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_OpenGL_EmulateDepthLEqualPolygonFacing"]];
|
||||||
|
|
||||||
[[[cdsCore cdsGPU] sharedData] fetchSynchronousAtIndex:0];
|
((MacGPUFetchObjectAsync *)[[cdsCore cdsGPU] fetchObject])->FetchSynchronousAtIndex(0);
|
||||||
|
|
||||||
// Set the stylus options per user preferences.
|
// Set the stylus options per user preferences.
|
||||||
[[cdsCore cdsController] setStylusPressure:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_StylusPressure"]];
|
[[cdsCore cdsController] setStylusPressure:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_StylusPressure"]];
|
||||||
|
|
|
@ -1242,20 +1242,16 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
||||||
|
|
||||||
- (void) setVideoSizeUsingEmulatorSettings
|
- (void) setVideoSizeUsingEmulatorSettings
|
||||||
{
|
{
|
||||||
|
GPUClientFetchObject *currentFetchObj = [self fetchObject];
|
||||||
|
|
||||||
// Do a few sanity checks before proceeding.
|
// Do a few sanity checks before proceeding.
|
||||||
if ([self sharedData] == nil)
|
if (currentFetchObj == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUClientFetchObject *fetchObject = [[self sharedData] GPUFetchObject];
|
const u8 lastBufferIndex = currentFetchObj->GetLastFetchIndex();
|
||||||
if (fetchObject == NULL)
|
const NDSDisplayInfo &displayInfo = currentFetchObj->GetFetchDisplayInfoForBufferIndex(lastBufferIndex);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const u8 lastBufferIndex = fetchObject->GetLastFetchIndex();
|
|
||||||
const NDSDisplayInfo &displayInfo = fetchObject->GetFetchDisplayInfoForBufferIndex(lastBufferIndex);
|
|
||||||
|
|
||||||
double normalWidth = 0.0;
|
double normalWidth = 0.0;
|
||||||
double normalHeight = 0.0;
|
double normalHeight = 0.0;
|
||||||
|
@ -1308,6 +1304,8 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
||||||
|
|
||||||
- (void) openFileStream
|
- (void) openFileStream
|
||||||
{
|
{
|
||||||
|
GPUClientFetchObject *currentFetchObj = [self fetchObject];
|
||||||
|
|
||||||
// One final check for the video size if we're using the emulator settings.
|
// One final check for the video size if we're using the emulator settings.
|
||||||
if (videoSizeOption == VideoSizeOption_UseEmulatorSettings)
|
if (videoSizeOption == VideoSizeOption_UseEmulatorSettings)
|
||||||
{
|
{
|
||||||
|
@ -1315,13 +1313,7 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do a few sanity checks before proceeding.
|
// Do a few sanity checks before proceeding.
|
||||||
if ([self sharedData] == nil)
|
if (currentFetchObj == NULL)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GPUClientFetchObject *fetchObject = [[self sharedData] GPUFetchObject];
|
|
||||||
if (fetchObject == NULL)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1356,7 +1348,7 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
||||||
// Set up the rendering properties.
|
// Set up the rendering properties.
|
||||||
MacCaptureToolParams param;
|
MacCaptureToolParams param;
|
||||||
param.refObject = newCaptureObject;
|
param.refObject = newCaptureObject;
|
||||||
param.sharedData = [self sharedData];
|
param.fetchObject = currentFetchObj;
|
||||||
param.formatID = [self formatID];
|
param.formatID = [self formatID];
|
||||||
param.savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
param.savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||||
param.romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
param.romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||||
|
@ -1372,8 +1364,8 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
||||||
param.cdpProperty.clientWidth = [self videoWidth];
|
param.cdpProperty.clientWidth = [self videoWidth];
|
||||||
param.cdpProperty.clientHeight = [self videoHeight];
|
param.cdpProperty.clientHeight = [self videoHeight];
|
||||||
|
|
||||||
const u8 lastBufferIndex = fetchObject->GetLastFetchIndex();
|
const u8 lastBufferIndex = currentFetchObj->GetLastFetchIndex();
|
||||||
const NDSDisplayInfo &displayInfo = fetchObject->GetFetchDisplayInfoForBufferIndex(lastBufferIndex);
|
const NDSDisplayInfo &displayInfo = currentFetchObj->GetFetchDisplayInfoForBufferIndex(lastBufferIndex);
|
||||||
|
|
||||||
if ( (displayInfo.renderedWidth[NDSDisplayID_Main] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Main] == 0) ||
|
if ( (displayInfo.renderedWidth[NDSDisplayID_Main] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Main] == 0) ||
|
||||||
(displayInfo.renderedWidth[NDSDisplayID_Touch] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Touch] == 0) )
|
(displayInfo.renderedWidth[NDSDisplayID_Touch] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Touch] == 0) )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2018-2021 DeSmuME team
|
Copyright (C) 2018-2022 DeSmuME team
|
||||||
|
|
||||||
This file is free software: you can redistribute it and/or modify
|
This file is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
#undef BOOL
|
#undef BOOL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@class MacClientSharedObject;
|
class GPUClientFetchObject;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
|
||||||
@interface MacBaseCaptureToolDelegate : NSObject <NSWindowDelegate, DirectoryURLDragDestTextFieldProtocol>
|
@interface MacBaseCaptureToolDelegate : NSObject <NSWindowDelegate, DirectoryURLDragDestTextFieldProtocol>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
DirectoryURLDragDestTextField *saveDirectoryPathTextField;
|
DirectoryURLDragDestTextField *saveDirectoryPathTextField;
|
||||||
|
|
||||||
MacClientSharedObject *sharedData;
|
GPUClientFetchObject *fetchObject;
|
||||||
|
|
||||||
NSString *saveDirectoryPath;
|
NSString *saveDirectoryPath;
|
||||||
NSString *romName;
|
NSString *romName;
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
@property (readonly) IBOutlet NSWindow *window;
|
@property (readonly) IBOutlet NSWindow *window;
|
||||||
@property (readonly) IBOutlet DirectoryURLDragDestTextField *saveDirectoryPathTextField;
|
@property (readonly) IBOutlet DirectoryURLDragDestTextField *saveDirectoryPathTextField;
|
||||||
|
|
||||||
@property (retain) MacClientSharedObject *sharedData;
|
@property (assign) GPUClientFetchObject *fetchObject;
|
||||||
|
|
||||||
@property (copy) NSString *saveDirectoryPath;
|
@property (copy) NSString *saveDirectoryPath;
|
||||||
@property (copy) NSString *romName;
|
@property (copy) NSString *romName;
|
||||||
|
@ -84,7 +84,7 @@ class MacCaptureToolParams
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void *refObject;
|
void *refObject;
|
||||||
MacClientSharedObject *sharedData;
|
GPUClientFetchObject *fetchObject;
|
||||||
|
|
||||||
NSUInteger formatID;
|
NSUInteger formatID;
|
||||||
std::string savePath;
|
std::string savePath;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
@synthesize dummyObject;
|
@synthesize dummyObject;
|
||||||
@synthesize window;
|
@synthesize window;
|
||||||
@synthesize saveDirectoryPathTextField;
|
@synthesize saveDirectoryPathTextField;
|
||||||
@synthesize sharedData;
|
@synthesize fetchObject;
|
||||||
@synthesize saveDirectoryPath;
|
@synthesize saveDirectoryPath;
|
||||||
@synthesize romName;
|
@synthesize romName;
|
||||||
@synthesize formatID;
|
@synthesize formatID;
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedData = nil;
|
fetchObject = nil;
|
||||||
saveDirectoryPath = nil;
|
saveDirectoryPath = nil;
|
||||||
romName = @"No_ROM_loaded";
|
romName = @"No_ROM_loaded";
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[self setSharedData:nil];
|
|
||||||
[self setSaveDirectoryPath:nil];
|
[self setSaveDirectoryPath:nil];
|
||||||
[self setRomName:nil];
|
[self setRomName:nil];
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties;
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
class MacMetalFetchObject : public GPUClientFetchObject
|
class MacMetalFetchObject : public MacGPUFetchObjectDisplayLink
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
bool _useDirectToCPUFilterPipeline;
|
bool _useDirectToCPUFilterPipeline;
|
||||||
|
@ -313,6 +313,8 @@ public:
|
||||||
virtual void CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex);
|
virtual void CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex);
|
||||||
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
||||||
virtual void FetchFromBufferIndex(const u8 index);
|
virtual void FetchFromBufferIndex(const u8 index);
|
||||||
|
|
||||||
|
virtual void FlushMultipleViews(const std::vector<ClientDisplay3DView *> &cdvFlushList, const CVTimeStamp *timeStampNow, const CVTimeStamp *timeStampOutput);
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
|
@ -707,8 +707,8 @@
|
||||||
{
|
{
|
||||||
id<MTLCommandBuffer> cb = [_fetchCommandQueue commandBufferWithUnretainedReferences];
|
id<MTLCommandBuffer> cb = [_fetchCommandQueue commandBufferWithUnretainedReferences];
|
||||||
|
|
||||||
semaphore_wait([self semaphoreFramebufferPageAtIndex:index]);
|
semaphore_wait( GPUFetchObject->SemaphoreFramebufferPageAtIndex(index) );
|
||||||
[self setFramebufferState:ClientDisplayBufferState_Reading index:index];
|
GPUFetchObject->SetFramebufferState(ClientDisplayBufferState_Reading, index);
|
||||||
|
|
||||||
id<MTLBlitCommandEncoder> bce = [cb blitCommandEncoder];
|
id<MTLBlitCommandEncoder> bce = [cb blitCommandEncoder];
|
||||||
[self setBceFetch:bce];
|
[self setBceFetch:bce];
|
||||||
|
@ -726,8 +726,8 @@
|
||||||
[oldTexPair.main release];
|
[oldTexPair.main release];
|
||||||
[oldTexPair.touch release];
|
[oldTexPair.touch release];
|
||||||
|
|
||||||
[self setFramebufferState:ClientDisplayBufferState_Idle index:index];
|
GPUFetchObject->SetFramebufferState(ClientDisplayBufferState_Idle, index);
|
||||||
semaphore_signal([self semaphoreFramebufferPageAtIndex:index]);
|
semaphore_signal( GPUFetchObject->SemaphoreFramebufferPageAtIndex(index) );
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[cb commit];
|
[cb commit];
|
||||||
|
@ -2473,6 +2473,7 @@ MacMetalFetchObject::MacMetalFetchObject()
|
||||||
|
|
||||||
if (_clientData != nil)
|
if (_clientData != nil)
|
||||||
{
|
{
|
||||||
|
_id = GPUClientFetchObjectID_MacMetal;
|
||||||
strlcpy(_name, [[(MetalDisplayViewSharedData *)_clientData name] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_name) - 1);
|
strlcpy(_name, [[(MetalDisplayViewSharedData *)_clientData name] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_name) - 1);
|
||||||
strlcpy(_description, [[(MetalDisplayViewSharedData *)_clientData description] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_description) - 1);
|
strlcpy(_description, [[(MetalDisplayViewSharedData *)_clientData description] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_description) - 1);
|
||||||
}
|
}
|
||||||
|
@ -2505,6 +2506,7 @@ MacMetalFetchObject::~MacMetalFetchObject()
|
||||||
void MacMetalFetchObject::Init()
|
void MacMetalFetchObject::Init()
|
||||||
{
|
{
|
||||||
[(MacClientSharedObject *)this->_clientData setGPUFetchObject:this];
|
[(MacClientSharedObject *)this->_clientData setGPUFetchObject:this];
|
||||||
|
this->MacGPUFetchObjectAsync::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMetalFetchObject::CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex)
|
void MacMetalFetchObject::CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex)
|
||||||
|
@ -2522,8 +2524,7 @@ void MacMetalFetchObject::SetFetchBuffers(const NDSDisplayInfo ¤tDisplayIn
|
||||||
|
|
||||||
void MacMetalFetchObject::FetchFromBufferIndex(const u8 index)
|
void MacMetalFetchObject::FetchFromBufferIndex(const u8 index)
|
||||||
{
|
{
|
||||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)this->_clientData;
|
this->_useDirectToCPUFilterPipeline = (this->GetNumberViewsUsingDirectToCPUFiltering() > 0);
|
||||||
this->_useDirectToCPUFilterPipeline = ([sharedViewObject numberViewsUsingDirectToCPUFiltering] > 0);
|
|
||||||
|
|
||||||
[(MetalDisplayViewSharedData *)this->_clientData fetchFromBufferIndex:index];
|
[(MetalDisplayViewSharedData *)this->_clientData fetchFromBufferIndex:index];
|
||||||
}
|
}
|
||||||
|
@ -2556,6 +2557,11 @@ void MacMetalFetchObject::_FetchCustomDisplayByID(const NDSDisplayID displayID,
|
||||||
[(MetalDisplayViewSharedData *)this->_clientData fetchCustomDisplayByID:displayID bufferIndex:bufferIndex blitCommandEncoder:[(MetalDisplayViewSharedData *)this->_clientData bceFetch]];
|
[(MetalDisplayViewSharedData *)this->_clientData fetchCustomDisplayByID:displayID bufferIndex:bufferIndex blitCommandEncoder:[(MetalDisplayViewSharedData *)this->_clientData bceFetch]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacMetalFetchObject::FlushMultipleViews(const std::vector<ClientDisplay3DView *> &cdvFlushList, const CVTimeStamp *timeStampNow, const CVTimeStamp *timeStampOutput)
|
||||||
|
{
|
||||||
|
[(MetalDisplayViewSharedData *)this->_clientData flushMultipleViews:cdvFlushList timeStampNow:timeStampNow timeStampOutput:timeStampOutput];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
MacMetalDisplayPresenter::MacMetalDisplayPresenter()
|
MacMetalDisplayPresenter::MacMetalDisplayPresenter()
|
||||||
|
@ -2818,8 +2824,8 @@ void MacMetalDisplayView::SetViewNeedsFlush()
|
||||||
void MacMetalDisplayView::SetAllowViewFlushes(bool allowFlushes)
|
void MacMetalDisplayView::SetAllowViewFlushes(bool allowFlushes)
|
||||||
{
|
{
|
||||||
CGDirectDisplayID displayID = (CGDirectDisplayID)this->GetDisplayViewID();
|
CGDirectDisplayID displayID = (CGDirectDisplayID)this->GetDisplayViewID();
|
||||||
MacClientSharedObject *sharedData = ((MacMetalDisplayPresenter *)this->_presenter)->GetSharedData();
|
MacGPUFetchObjectDisplayLink &fetchObj = (MacGPUFetchObjectDisplayLink &)this->_presenter->GetFetchObject();
|
||||||
[sharedData displayLinkStartUsingID:displayID];
|
fetchObj.DisplayLinkStartUsingID(displayID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMetalDisplayView::FlushView(void *userData)
|
void MacMetalDisplayView::FlushView(void *userData)
|
||||||
|
|
|
@ -44,13 +44,28 @@ class MacOGLDisplayView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
class MacOGLClientFetchObject : public OGLClientFetchObject
|
class MacOGLClientSharedData : public OGLClientSharedData
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
apple_unfairlock_t _unfairlockTexFetch[2];
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacOGLClientSharedData();
|
||||||
|
~MacOGLClientSharedData();
|
||||||
|
|
||||||
|
virtual GLuint GetFetchTexture(const NDSDisplayID displayID);
|
||||||
|
virtual void SetFetchTexture(const NDSDisplayID displayID, GLuint texID);
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacOGLClientFetchObject : public MacGPUFetchObjectDisplayLink
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
NSOpenGLContext *_nsContext;
|
NSOpenGLContext *_nsContext;
|
||||||
CGLContextObj _context;
|
CGLContextObj _context;
|
||||||
|
|
||||||
apple_unfairlock_t _unfairlockTexFetch[2];
|
// GPUClientFetchObject methods
|
||||||
|
virtual void _FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex);
|
||||||
|
virtual void _FetchCustomDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void operator delete(void *ptr);
|
void operator delete(void *ptr);
|
||||||
|
@ -60,18 +75,19 @@ public:
|
||||||
NSOpenGLContext* GetNSContext() const;
|
NSOpenGLContext* GetNSContext() const;
|
||||||
CGLContextObj GetContext() const;
|
CGLContextObj GetContext() const;
|
||||||
|
|
||||||
|
void FetchNativeDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
|
||||||
|
void FetchCustomDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
|
||||||
|
|
||||||
|
// GPUClientFetchObject methods
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
virtual void SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo);
|
||||||
virtual void FetchFromBufferIndex(const u8 index);
|
virtual void FetchFromBufferIndex(const u8 index);
|
||||||
|
|
||||||
virtual GLuint GetFetchTexture(const NDSDisplayID displayID);
|
|
||||||
virtual void SetFetchTexture(const NDSDisplayID displayID, GLuint texID);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacOGLDisplayPresenter : public OGLVideoOutput, public MacDisplayPresenterInterface
|
class MacOGLDisplayPresenter : public OGLVideoOutput
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void __InstanceInit(MacClientSharedObject *sharedObject);
|
void __InstanceInit(MacOGLClientFetchObject *fetchObject);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NSOpenGLContext *_nsContext;
|
NSOpenGLContext *_nsContext;
|
||||||
|
@ -83,7 +99,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
void operator delete(void *ptr);
|
void operator delete(void *ptr);
|
||||||
MacOGLDisplayPresenter();
|
MacOGLDisplayPresenter();
|
||||||
MacOGLDisplayPresenter(MacClientSharedObject *sharedObject);
|
MacOGLDisplayPresenter(MacOGLClientFetchObject *fetchObject);
|
||||||
~MacOGLDisplayPresenter();
|
~MacOGLDisplayPresenter();
|
||||||
|
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
|
@ -117,14 +133,14 @@ public:
|
||||||
class MacOGLDisplayView : public MacDisplayLayeredView
|
class MacOGLDisplayView : public MacDisplayLayeredView
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void __InstanceInit(MacClientSharedObject *sharedObject);
|
void __InstanceInit(MacOGLClientFetchObject *fetchObject);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
apple_unfairlock_t _unfairlockViewNeedsFlush;
|
apple_unfairlock_t _unfairlockViewNeedsFlush;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MacOGLDisplayView();
|
MacOGLDisplayView();
|
||||||
MacOGLDisplayView(MacClientSharedObject *sharedObject);
|
MacOGLDisplayView(MacOGLClientFetchObject *fetchObject);
|
||||||
virtual ~MacOGLDisplayView();
|
virtual ~MacOGLDisplayView();
|
||||||
|
|
||||||
virtual bool GetViewNeedsFlush();
|
virtual bool GetViewNeedsFlush();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "MacOGLDisplayView.h"
|
#include "MacOGLDisplayView.h"
|
||||||
#include <mach/semaphore.h>
|
#include <mach/semaphore.h>
|
||||||
#include "../utilities.h"
|
#include "../utilities.h"
|
||||||
|
#import "../cocoa_globals.h"
|
||||||
|
|
||||||
|
|
||||||
@implementation DisplayViewOpenGLLayer
|
@implementation DisplayViewOpenGLLayer
|
||||||
|
@ -74,21 +75,49 @@
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
|
MacOGLClientSharedData::MacOGLClientSharedData()
|
||||||
|
{
|
||||||
|
_unfairlockTexFetch[NDSDisplayID_Main] = apple_unfairlock_create();
|
||||||
|
_unfairlockTexFetch[NDSDisplayID_Touch] = apple_unfairlock_create();
|
||||||
|
}
|
||||||
|
|
||||||
|
MacOGLClientSharedData::~MacOGLClientSharedData()
|
||||||
|
{
|
||||||
|
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Main]);
|
||||||
|
this->_unfairlockTexFetch[NDSDisplayID_Main] = NULL;
|
||||||
|
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Touch]);
|
||||||
|
this->_unfairlockTexFetch[NDSDisplayID_Touch] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLuint MacOGLClientSharedData::GetFetchTexture(const NDSDisplayID displayID)
|
||||||
|
{
|
||||||
|
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
|
||||||
|
const GLuint texFetchID = this->OGLClientSharedData::GetFetchTexture(displayID);
|
||||||
|
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
|
||||||
|
|
||||||
|
return texFetchID;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacOGLClientSharedData::SetFetchTexture(const NDSDisplayID displayID, GLuint texID)
|
||||||
|
{
|
||||||
|
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
|
||||||
|
this->OGLClientSharedData::SetFetchTexture(displayID, texID);
|
||||||
|
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
void MacOGLClientFetchObject::operator delete(void *ptr)
|
void MacOGLClientFetchObject::operator delete(void *ptr)
|
||||||
{
|
{
|
||||||
MacOGLClientFetchObject *fetchObjectPtr = (MacOGLClientFetchObject *)ptr;
|
MacOGLClientFetchObject *fetchObjectPtr = (MacOGLClientFetchObject *)ptr;
|
||||||
[(MacClientSharedObject *)(fetchObjectPtr->GetClientData()) release];
|
|
||||||
|
|
||||||
CGLContextObj context = fetchObjectPtr->GetContext();
|
CGLContextObj context = fetchObjectPtr->GetContext();
|
||||||
|
|
||||||
if (context != NULL)
|
if (context != NULL)
|
||||||
{
|
{
|
||||||
OGLContextInfo *contextInfo = fetchObjectPtr->GetContextInfo();
|
|
||||||
CGLContextObj prevContext = CGLGetCurrentContext();
|
CGLContextObj prevContext = CGLGetCurrentContext();
|
||||||
CGLSetCurrentContext(context);
|
CGLSetCurrentContext(context);
|
||||||
|
|
||||||
[fetchObjectPtr->GetNSContext() release];
|
[fetchObjectPtr->GetNSContext() release];
|
||||||
delete contextInfo;
|
|
||||||
::operator delete(ptr);
|
::operator delete(ptr);
|
||||||
|
|
||||||
CGLSetCurrentContext(prevContext);
|
CGLSetCurrentContext(prevContext);
|
||||||
|
@ -143,34 +172,32 @@ MacOGLClientFetchObject::MacOGLClientFetchObject()
|
||||||
CGLContextObj prevContext = CGLGetCurrentContext();
|
CGLContextObj prevContext = CGLGetCurrentContext();
|
||||||
CGLSetCurrentContext(_context);
|
CGLSetCurrentContext(_context);
|
||||||
|
|
||||||
|
OGLContextInfo *newContextInfo = NULL;
|
||||||
|
|
||||||
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
||||||
if (useContext_3_2)
|
if (useContext_3_2)
|
||||||
{
|
{
|
||||||
_contextInfo = new OGLContextInfo_3_2;
|
newContextInfo = new OGLContextInfo_3_2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
_contextInfo = new OGLContextInfo_Legacy;
|
newContextInfo = new OGLContextInfo_Legacy;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLSetCurrentContext(prevContext);
|
CGLSetCurrentContext(prevContext);
|
||||||
|
|
||||||
snprintf(_name, sizeof(_name) - 1, "macOS OpenGL v%i.%i", _contextInfo->GetVersionMajor(), _contextInfo->GetVersionMinor());
|
_id = GPUClientFetchObjectID_MacOpenGL;
|
||||||
strlcpy(_description, _contextInfo->GetRendererString(), sizeof(_description) - 1);
|
snprintf(_name, sizeof(_name) - 1, "macOS OpenGL v%i.%i", newContextInfo->GetVersionMajor(), newContextInfo->GetVersionMinor());
|
||||||
|
strlcpy(_description, newContextInfo->GetRendererString(), sizeof(_description) - 1);
|
||||||
|
|
||||||
_clientData = [[MacClientSharedObject alloc] init];
|
_clientData = new MacOGLClientSharedData;
|
||||||
|
((MacOGLClientSharedData *)_clientData)->SetContextInfo(newContextInfo);
|
||||||
_unfairlockTexFetch[NDSDisplayID_Main] = apple_unfairlock_create();
|
|
||||||
_unfairlockTexFetch[NDSDisplayID_Touch] = apple_unfairlock_create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MacOGLClientFetchObject::~MacOGLClientFetchObject()
|
MacOGLClientFetchObject::~MacOGLClientFetchObject()
|
||||||
{
|
{
|
||||||
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Main]);
|
delete (MacOGLClientSharedData *)this->_clientData;
|
||||||
this->_unfairlockTexFetch[NDSDisplayID_Main] = NULL;
|
|
||||||
apple_unfairlock_destroy(this->_unfairlockTexFetch[NDSDisplayID_Touch]);
|
|
||||||
this->_unfairlockTexFetch[NDSDisplayID_Touch] = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSOpenGLContext* MacOGLClientFetchObject::GetNSContext() const
|
NSOpenGLContext* MacOGLClientFetchObject::GetNSContext() const
|
||||||
|
@ -183,55 +210,80 @@ CGLContextObj MacOGLClientFetchObject::GetContext() const
|
||||||
return this->_context;
|
return this->_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacOGLClientFetchObject::FetchNativeDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock)
|
||||||
|
{
|
||||||
|
MacOGLClientSharedData *sharedData = (MacOGLClientSharedData *)this->_clientData;
|
||||||
|
sharedData->FetchNativeDisplayToSrcClone(this->_fetchDisplayInfo, displayID, bufferIndex, needsLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacOGLClientFetchObject::FetchCustomDisplayToSrcClone(const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock)
|
||||||
|
{
|
||||||
|
MacOGLClientSharedData *sharedData = (MacOGLClientSharedData *)this->_clientData;
|
||||||
|
sharedData->FetchCustomDisplayToSrcClone(this->_fetchDisplayInfo, displayID, bufferIndex, needsLock);
|
||||||
|
}
|
||||||
|
|
||||||
void MacOGLClientFetchObject::Init()
|
void MacOGLClientFetchObject::Init()
|
||||||
{
|
{
|
||||||
[(MacClientSharedObject *)this->_clientData setGPUFetchObject:this];
|
MacOGLClientSharedData *sharedData = (MacOGLClientSharedData *)this->_clientData;
|
||||||
|
|
||||||
CGLContextObj prevContext = CGLGetCurrentContext();
|
CGLContextObj prevContext = CGLGetCurrentContext();
|
||||||
CGLSetCurrentContext(_context);
|
CGLSetCurrentContext(this->_context);
|
||||||
this->OGLClientFetchObject::Init();
|
sharedData->InitOGL();
|
||||||
CGLSetCurrentContext(prevContext);
|
CGLSetCurrentContext(prevContext);
|
||||||
|
|
||||||
|
this->MacGPUFetchObjectDisplayLink::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLClientFetchObject::SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo)
|
void MacOGLClientFetchObject::SetFetchBuffers(const NDSDisplayInfo ¤tDisplayInfo)
|
||||||
{
|
{
|
||||||
|
MacOGLClientSharedData *sharedData = (MacOGLClientSharedData *)this->_clientData;
|
||||||
|
|
||||||
CGLLockContext(this->_context);
|
CGLLockContext(this->_context);
|
||||||
CGLSetCurrentContext(this->_context);
|
CGLSetCurrentContext(this->_context);
|
||||||
this->OGLClientFetchObject::SetFetchBuffers(currentDisplayInfo);
|
this->GPUClientFetchObject::SetFetchBuffers(currentDisplayInfo);
|
||||||
|
sharedData->SetFetchBuffersOGL(this->_fetchDisplayInfo, currentDisplayInfo);
|
||||||
CGLUnlockContext(this->_context);
|
CGLUnlockContext(this->_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLClientFetchObject::FetchFromBufferIndex(const u8 index)
|
void MacOGLClientFetchObject::FetchFromBufferIndex(const u8 index)
|
||||||
{
|
{
|
||||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)this->_clientData;
|
MacOGLClientSharedData *sharedData = (MacOGLClientSharedData *)this->_clientData;
|
||||||
this->_useDirectToCPUFilterPipeline = ([sharedViewObject numberViewsUsingDirectToCPUFiltering] > 0);
|
|
||||||
|
|
||||||
semaphore_wait([sharedViewObject semaphoreFramebufferPageAtIndex:index]);
|
const bool willUseDirectCPU = (this->GetNumberViewsUsingDirectToCPUFiltering() > 0);
|
||||||
[sharedViewObject setFramebufferState:ClientDisplayBufferState_Reading index:index];
|
sharedData->SetUseDirectToCPUFilterPipeline(willUseDirectCPU);
|
||||||
|
|
||||||
|
semaphore_wait( this->SemaphoreFramebufferPageAtIndex(index) );
|
||||||
|
this->SetFramebufferState(ClientDisplayBufferState_Reading, index);
|
||||||
|
|
||||||
CGLLockContext(this->_context);
|
CGLLockContext(this->_context);
|
||||||
CGLSetCurrentContext(this->_context);
|
CGLSetCurrentContext(this->_context);
|
||||||
this->OGLClientFetchObject::FetchFromBufferIndex(index);
|
|
||||||
|
this->GPUClientFetchObject::FetchFromBufferIndex(index);
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
const NDSDisplayInfo ¤tDisplayInfo = this->GetFetchDisplayInfoForBufferIndex(index);
|
||||||
|
sharedData->FetchFromBufferIndexOGL(index, currentDisplayInfo);
|
||||||
|
|
||||||
CGLUnlockContext(this->_context);
|
CGLUnlockContext(this->_context);
|
||||||
|
|
||||||
[sharedViewObject setFramebufferState:ClientDisplayBufferState_Idle index:index];
|
this->SetFramebufferState(ClientDisplayBufferState_Idle, index);
|
||||||
semaphore_signal([sharedViewObject semaphoreFramebufferPageAtIndex:index]);
|
semaphore_signal( this->SemaphoreFramebufferPageAtIndex(index) );
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint MacOGLClientFetchObject::GetFetchTexture(const NDSDisplayID displayID)
|
void MacOGLClientFetchObject::_FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
|
||||||
{
|
{
|
||||||
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
|
// This method is called from MacOGLClientFetchObject::FetchFromBufferIndex(), and so
|
||||||
const GLuint texFetchID = this->OGLClientFetchObject::GetFetchTexture(displayID);
|
// we should have already been assigned the current context.
|
||||||
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
|
MacOGLClientSharedData *sharedData = (MacOGLClientSharedData *)this->_clientData;
|
||||||
|
sharedData->FetchNativeDisplayByID_OGL(this->_fetchDisplayInfo, displayID, bufferIndex);
|
||||||
return texFetchID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLClientFetchObject::SetFetchTexture(const NDSDisplayID displayID, GLuint texID)
|
void MacOGLClientFetchObject::_FetchCustomDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
|
||||||
{
|
{
|
||||||
apple_unfairlock_lock(this->_unfairlockTexFetch[displayID]);
|
// This method is called from MacOGLClientFetchObject::FetchFromBufferIndex(), and so
|
||||||
this->OGLClientFetchObject::SetFetchTexture(displayID, texID);
|
// we should have already been assigned the current context.
|
||||||
apple_unfairlock_unlock(this->_unfairlockTexFetch[displayID]);
|
MacOGLClientSharedData *sharedData = (MacOGLClientSharedData *)this->_clientData;
|
||||||
|
sharedData->FetchCustomDisplayByID_OGL(this->_fetchDisplayInfo, displayID, bufferIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -260,12 +312,12 @@ MacOGLDisplayPresenter::MacOGLDisplayPresenter()
|
||||||
__InstanceInit(nil);
|
__InstanceInit(nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacOGLDisplayPresenter::MacOGLDisplayPresenter(MacClientSharedObject *sharedObject) : MacDisplayPresenterInterface(sharedObject)
|
MacOGLDisplayPresenter::MacOGLDisplayPresenter(MacOGLClientFetchObject *fetchObject)
|
||||||
{
|
{
|
||||||
__InstanceInit(sharedObject);
|
__InstanceInit(fetchObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLDisplayPresenter::__InstanceInit(MacClientSharedObject *sharedObject)
|
void MacOGLDisplayPresenter::__InstanceInit(MacOGLClientFetchObject *fetchObject)
|
||||||
{
|
{
|
||||||
// Initialize the OpenGL context.
|
// Initialize the OpenGL context.
|
||||||
//
|
//
|
||||||
|
@ -310,10 +362,7 @@ void MacOGLDisplayPresenter::__InstanceInit(MacClientSharedObject *sharedObject)
|
||||||
_context = nil;
|
_context = nil;
|
||||||
_unfairlockProcessedInfo = apple_unfairlock_create();
|
_unfairlockProcessedInfo = apple_unfairlock_create();
|
||||||
|
|
||||||
if (sharedObject != nil)
|
SetFetchObject(fetchObject);
|
||||||
{
|
|
||||||
SetFetchObject([sharedObject GPUFetchObject]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MacOGLDisplayPresenter::~MacOGLDisplayPresenter()
|
MacOGLDisplayPresenter::~MacOGLDisplayPresenter()
|
||||||
|
@ -452,26 +501,20 @@ void MacOGLDisplayPresenter::SetProcessedFrameInfo(const OGLProcessedFrameInfo &
|
||||||
|
|
||||||
void MacOGLDisplayPresenter::WriteLockEmuFramebuffer(const uint8_t bufferIndex)
|
void MacOGLDisplayPresenter::WriteLockEmuFramebuffer(const uint8_t bufferIndex)
|
||||||
{
|
{
|
||||||
const GPUClientFetchObject &fetchObj = this->GetFetchObject();
|
MacOGLClientFetchObject &fetchObj = (MacOGLClientFetchObject &)this->GetFetchObject();
|
||||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)fetchObj.GetClientData();
|
semaphore_wait( fetchObj.SemaphoreFramebufferPageAtIndex(bufferIndex) );
|
||||||
|
|
||||||
semaphore_wait([sharedViewObject semaphoreFramebufferPageAtIndex:bufferIndex]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLDisplayPresenter::ReadLockEmuFramebuffer(const uint8_t bufferIndex)
|
void MacOGLDisplayPresenter::ReadLockEmuFramebuffer(const uint8_t bufferIndex)
|
||||||
{
|
{
|
||||||
const GPUClientFetchObject &fetchObj = this->GetFetchObject();
|
MacOGLClientFetchObject &fetchObj = (MacOGLClientFetchObject &)this->GetFetchObject();
|
||||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)fetchObj.GetClientData();
|
semaphore_wait( fetchObj.SemaphoreFramebufferPageAtIndex(bufferIndex) );
|
||||||
|
|
||||||
semaphore_wait([sharedViewObject semaphoreFramebufferPageAtIndex:bufferIndex]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLDisplayPresenter::UnlockEmuFramebuffer(const uint8_t bufferIndex)
|
void MacOGLDisplayPresenter::UnlockEmuFramebuffer(const uint8_t bufferIndex)
|
||||||
{
|
{
|
||||||
const GPUClientFetchObject &fetchObj = this->GetFetchObject();
|
MacOGLClientFetchObject &fetchObj = (MacOGLClientFetchObject &)this->GetFetchObject();
|
||||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)fetchObj.GetClientData();
|
semaphore_signal( fetchObj.SemaphoreFramebufferPageAtIndex(bufferIndex) );
|
||||||
|
|
||||||
semaphore_signal([sharedViewObject semaphoreFramebufferPageAtIndex:bufferIndex]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -481,9 +524,9 @@ MacOGLDisplayView::MacOGLDisplayView()
|
||||||
__InstanceInit(nil);
|
__InstanceInit(nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacOGLDisplayView::MacOGLDisplayView(MacClientSharedObject *sharedObject)
|
MacOGLDisplayView::MacOGLDisplayView(MacOGLClientFetchObject *fetchObject)
|
||||||
{
|
{
|
||||||
__InstanceInit(sharedObject);
|
__InstanceInit(fetchObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacOGLDisplayView::~MacOGLDisplayView()
|
MacOGLDisplayView::~MacOGLDisplayView()
|
||||||
|
@ -494,12 +537,12 @@ MacOGLDisplayView::~MacOGLDisplayView()
|
||||||
this->_unfairlockViewNeedsFlush = NULL;
|
this->_unfairlockViewNeedsFlush = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLDisplayView::__InstanceInit(MacClientSharedObject *sharedObject)
|
void MacOGLDisplayView::__InstanceInit(MacOGLClientFetchObject *fetchObject)
|
||||||
{
|
{
|
||||||
_allowViewUpdates = false;
|
_allowViewUpdates = false;
|
||||||
_unfairlockViewNeedsFlush = apple_unfairlock_create();
|
_unfairlockViewNeedsFlush = apple_unfairlock_create();
|
||||||
|
|
||||||
MacOGLDisplayPresenter *newOpenGLPresenter = new MacOGLDisplayPresenter(sharedObject);
|
MacOGLDisplayPresenter *newOpenGLPresenter = new MacOGLDisplayPresenter(fetchObject);
|
||||||
_presenter = newOpenGLPresenter;
|
_presenter = newOpenGLPresenter;
|
||||||
|
|
||||||
_caLayer = [[DisplayViewOpenGLLayer alloc] init];
|
_caLayer = [[DisplayViewOpenGLLayer alloc] init];
|
||||||
|
@ -542,8 +585,8 @@ void MacOGLDisplayView::SetViewNeedsFlush()
|
||||||
void MacOGLDisplayView::SetAllowViewFlushes(bool allowFlushes)
|
void MacOGLDisplayView::SetAllowViewFlushes(bool allowFlushes)
|
||||||
{
|
{
|
||||||
CGDirectDisplayID displayID = (CGDirectDisplayID)this->GetDisplayViewID();
|
CGDirectDisplayID displayID = (CGDirectDisplayID)this->GetDisplayViewID();
|
||||||
MacClientSharedObject *sharedData = ((MacOGLDisplayPresenter *)this->_presenter)->GetSharedData();
|
MacOGLClientFetchObject &fetchObj = (MacOGLClientFetchObject &)this->_presenter->GetFetchObject();
|
||||||
[sharedData displayLinkStartUsingID:displayID];
|
fetchObj.DisplayLinkStartUsingID(displayID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacOGLDisplayView::SetUseVerticalSync(const bool useVerticalSync)
|
void MacOGLDisplayView::SetUseVerticalSync(const bool useVerticalSync)
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
// Note: We're allocating the parameter's memory block here, but we will be freeing it once we copy it in the detached thread.
|
// Note: We're allocating the parameter's memory block here, but we will be freeing it once we copy it in the detached thread.
|
||||||
MacCaptureToolParams *param = new MacCaptureToolParams;
|
MacCaptureToolParams *param = new MacCaptureToolParams;
|
||||||
param->refObject = NULL;
|
param->refObject = NULL;
|
||||||
param->sharedData = [self sharedData];
|
param->fetchObject = [self fetchObject];
|
||||||
param->formatID = [self formatID];
|
param->formatID = [self formatID];
|
||||||
param->savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
param->savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||||
param->romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
param->romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||||
|
@ -143,7 +143,7 @@ static void* RunFileWriteThread(void *arg)
|
||||||
MacCaptureToolParams param;
|
MacCaptureToolParams param;
|
||||||
|
|
||||||
param.refObject = inParams->refObject;
|
param.refObject = inParams->refObject;
|
||||||
param.sharedData = inParams->sharedData;
|
param.fetchObject = inParams->fetchObject;
|
||||||
param.formatID = inParams->formatID;
|
param.formatID = inParams->formatID;
|
||||||
param.savePath = inParams->savePath;
|
param.savePath = inParams->savePath;
|
||||||
param.romName = inParams->romName;
|
param.romName = inParams->romName;
|
||||||
|
@ -162,19 +162,13 @@ static void* RunFileWriteThread(void *arg)
|
||||||
inParams = NULL;
|
inParams = NULL;
|
||||||
|
|
||||||
// Do a few sanity checks before proceeding.
|
// Do a few sanity checks before proceeding.
|
||||||
if (param.sharedData == nil)
|
if (param.fetchObject == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUClientFetchObject *fetchObject = [param.sharedData GPUFetchObject];
|
const u8 lastBufferIndex = param.fetchObject->GetLastFetchIndex();
|
||||||
if (fetchObject == NULL)
|
const NDSDisplayInfo &displayInfo = param.fetchObject->GetFetchDisplayInfoForBufferIndex(lastBufferIndex);
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const u8 lastBufferIndex = fetchObject->GetLastFetchIndex();
|
|
||||||
const NDSDisplayInfo &displayInfo = fetchObject->GetFetchDisplayInfoForBufferIndex(lastBufferIndex);
|
|
||||||
|
|
||||||
if ( (displayInfo.renderedWidth[NDSDisplayID_Main] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Main] == 0) ||
|
if ( (displayInfo.renderedWidth[NDSDisplayID_Main] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Main] == 0) ||
|
||||||
(displayInfo.renderedWidth[NDSDisplayID_Touch] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Touch] == 0) )
|
(displayInfo.renderedWidth[NDSDisplayID_Touch] == 0) || (displayInfo.renderedHeight[NDSDisplayID_Touch] == 0) )
|
||||||
|
@ -227,22 +221,22 @@ static void* RunFileWriteThread(void *arg)
|
||||||
bool isUsingMetal = false;
|
bool isUsingMetal = false;
|
||||||
|
|
||||||
#ifdef ENABLE_APPLE_METAL
|
#ifdef ENABLE_APPLE_METAL
|
||||||
if ([param.sharedData isKindOfClass:[MetalDisplayViewSharedData class]])
|
if (param.fetchObject->GetID() == GPUClientFetchObjectID_MacMetal)
|
||||||
{
|
{
|
||||||
if ([(MetalDisplayViewSharedData *)param.sharedData device] == nil)
|
if ([(MetalDisplayViewSharedData *)param.fetchObject->GetClientData() device] == nil)
|
||||||
{
|
{
|
||||||
[newImageRep release];
|
[newImageRep release];
|
||||||
[autoreleasePool release];
|
[autoreleasePool release];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cdp = new MacMetalDisplayPresenter(param.sharedData);
|
cdp = new MacMetalDisplayPresenter((MetalDisplayViewSharedData *)param.fetchObject->GetClientData());
|
||||||
isUsingMetal = true;
|
isUsingMetal = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
cdp = new MacOGLDisplayPresenter(param.sharedData);
|
cdp = new MacOGLDisplayPresenter((MacOGLClientFetchObject *)param.fetchObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
cdp->Init();
|
cdp->Init();
|
||||||
|
@ -276,12 +270,12 @@ static void* RunFileWriteThread(void *arg)
|
||||||
{
|
{
|
||||||
if ( (param.cdpProperty.mode == ClientDisplayMode_Main) || (param.cdpProperty.mode == ClientDisplayMode_Dual) )
|
if ( (param.cdpProperty.mode == ClientDisplayMode_Main) || (param.cdpProperty.mode == ClientDisplayMode_Dual) )
|
||||||
{
|
{
|
||||||
((OGLClientFetchObject *)fetchObject)->FetchNativeDisplayToSrcClone(NDSDisplayID_Main, lastBufferIndex, true);
|
((MacOGLClientFetchObject *)param.fetchObject)->FetchNativeDisplayToSrcClone(NDSDisplayID_Main, lastBufferIndex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (param.cdpProperty.mode == ClientDisplayMode_Touch) || (param.cdpProperty.mode == ClientDisplayMode_Dual) )
|
if ( (param.cdpProperty.mode == ClientDisplayMode_Touch) || (param.cdpProperty.mode == ClientDisplayMode_Dual) )
|
||||||
{
|
{
|
||||||
((OGLClientFetchObject *)fetchObject)->FetchNativeDisplayToSrcClone(NDSDisplayID_Touch, lastBufferIndex, true);
|
((MacOGLClientFetchObject *)param.fetchObject)->FetchNativeDisplayToSrcClone(NDSDisplayID_Touch, lastBufferIndex, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue