Cocoa Port: Ensure that display windows avoid drawing with uninitialized display info and possibly non-existent buffers on startup.

This commit is contained in:
rogerman 2017-07-18 01:26:42 -07:00
parent 7791f60495
commit ddac7122d3
2 changed files with 167 additions and 155 deletions

View File

@ -6929,6 +6929,8 @@ void OGLDisplayLayer::ProcessOGL()
GLsizei width[2] = { emuDisplayInfo.renderedWidth[NDSDisplayID_Main], emuDisplayInfo.renderedWidth[NDSDisplayID_Touch] }; GLsizei width[2] = { emuDisplayInfo.renderedWidth[NDSDisplayID_Main], emuDisplayInfo.renderedWidth[NDSDisplayID_Touch] };
GLsizei height[2] = { emuDisplayInfo.renderedHeight[NDSDisplayID_Main], emuDisplayInfo.renderedHeight[NDSDisplayID_Touch] }; GLsizei height[2] = { emuDisplayInfo.renderedHeight[NDSDisplayID_Main], emuDisplayInfo.renderedHeight[NDSDisplayID_Touch] };
if (emuDisplayInfo.pixelBytes != 0)
{
// Run the video source filters and the pixel scalers // Run the video source filters and the pixel scalers
const bool willFilterOnGPU = this->_output->WillFilterOnGPU(); const bool willFilterOnGPU = this->_output->WillFilterOnGPU();
const bool useDeposterize = this->_output->GetSourceDeposterize(); const bool useDeposterize = this->_output->GetSourceDeposterize();
@ -6955,6 +6957,7 @@ void OGLDisplayLayer::ProcessOGL()
{ {
this->_output->UnlockDisplayTextures(); this->_output->UnlockDisplayTextures();
} }
}
// Set the final output texture IDs // Set the final output texture IDs
this->_texVideoOutputID[NDSDisplayID_Main] = texVideoSourceID[NDSDisplayID_Main]; this->_texVideoOutputID[NDSDisplayID_Main] = texVideoSourceID[NDSDisplayID_Main];
@ -7007,6 +7010,8 @@ void OGLDisplayLayer::RenderOGL()
this->_UpdateRotationScaleOGL(); this->_UpdateRotationScaleOGL();
} }
if (emuDisplayInfo.pixelBytes != 0)
{
if (this->_needUpdateVertices) if (this->_needUpdateVertices)
{ {
this->_UpdateVerticesOGL(); this->_UpdateVerticesOGL();
@ -7089,6 +7094,7 @@ void OGLDisplayLayer::RenderOGL()
glBindVertexArrayDESMUME(0); glBindVertexArrayDESMUME(0);
this->_output->UnlockDisplayTextures(); this->_output->UnlockDisplayTextures();
}
} }
void OGLDisplayLayer::FinishOGL(const u8 bufferIndex) void OGLDisplayLayer::FinishOGL(const u8 bufferIndex)

View File

@ -619,9 +619,10 @@
} }
[cce endEncoding]; [cce endEncoding];
[cb commit];
} }
[cb commit];
[self setTexDisplaySrcTargetMain:texDisplaySrcTarget[NDSDisplayID_Main]]; [self setTexDisplaySrcTargetMain:texDisplaySrcTarget[NDSDisplayID_Main]];
[self setTexDisplaySrcTargetTouch:texDisplaySrcTarget[NDSDisplayID_Touch]]; [self setTexDisplaySrcTargetTouch:texDisplaySrcTarget[NDSDisplayID_Touch]];
} }
@ -823,6 +824,8 @@
[self setSharedData:nil]; [self setSharedData:nil];
delete _cdv; delete _cdv;
dispatch_release(availableResources);
[super dealloc]; [super dealloc];
} }
@ -1244,7 +1247,7 @@
_texDisplayOutput[NDSDisplayID_Main] = [sharedData texDisplaySrcTargetMain]; _texDisplayOutput[NDSDisplayID_Main] = [sharedData texDisplaySrcTargetMain];
_texDisplayOutput[NDSDisplayID_Touch] = [sharedData texDisplaySrcTargetTouch]; _texDisplayOutput[NDSDisplayID_Touch] = [sharedData texDisplaySrcTargetTouch];
if (useDeposterize || (_cdv->GetPixelScaler() != VideoFilterTypeID_None)) if ( (fetchDisplayInfo.pixelBytes != 0) && (useDeposterize || (_cdv->GetPixelScaler() != VideoFilterTypeID_None)) )
{ {
const bool willFilterOnGPU = _cdv->WillFilterOnGPU(); const bool willFilterOnGPU = _cdv->WillFilterOnGPU();
const bool shouldProcessDisplay[2] = { (!fetchDisplayInfo.didPerformCustomRender[NDSDisplayID_Main] || !fetchDisplayInfo.isCustomSizeRequested) && fetchDisplayInfo.isDisplayEnabled[NDSDisplayID_Main] && (mode == ClientDisplayMode_Main || mode == ClientDisplayMode_Dual), const bool shouldProcessDisplay[2] = { (!fetchDisplayInfo.didPerformCustomRender[NDSDisplayID_Main] || !fetchDisplayInfo.isCustomSizeRequested) && fetchDisplayInfo.isDisplayEnabled[NDSDisplayID_Main] && (mode == ClientDisplayMode_Main || mode == ClientDisplayMode_Dual),
@ -1480,6 +1483,8 @@
} }
// Draw the NDS displays. // Draw the NDS displays.
if (displayInfo.pixelBytes != 0)
{
if ([self needsScreenVerticesUpdate]) if ([self needsScreenVerticesUpdate])
{ {
_cdv->SetScreenVertices((float *)[_displayVtxPositionBuffer contents]); _cdv->SetScreenVertices((float *)[_displayVtxPositionBuffer contents]);
@ -1554,6 +1559,7 @@
default: default:
break; break;
} }
}
// Draw the HUD. // Draw the HUD.
const size_t hudLength = _cdv->GetHUDString().length(); const size_t hudLength = _cdv->GetHUDString().length();