Cocoa Port: Fix a bug where Metal display view backing textures weren't updating their custom framebuffer sizes. (Regression from commit 4c01e66.)

This commit is contained in:
rogerman 2017-12-19 15:35:20 -08:00
parent 4c01e66a8a
commit f2f3680a7c
1 changed files with 24 additions and 22 deletions

View File

@ -391,31 +391,32 @@
_texDisplayPostprocessNative[NDSDisplayID_Main][i] = [device newTextureWithDescriptor:newTexPostprocessNativeDesc];
_texDisplayPostprocessNative[NDSDisplayID_Touch][i] = [device newTextureWithDescriptor:newTexPostprocessNativeDesc];
}
if ( ([_texDisplayFetchCustom[NDSDisplayID_Main][i] width] != w) ||
([_texDisplayFetchCustom[NDSDisplayID_Main][i] height] != h) )
{
[_texDisplayFetchCustom[NDSDisplayID_Main][i] release];
[_texDisplayFetchCustom[NDSDisplayID_Touch][i] release];
[_texDisplayPostprocessCustom[NDSDisplayID_Main][i] release];
[_texDisplayPostprocessCustom[NDSDisplayID_Touch][i] release];
if ( (_fetchPixelBytes != dispInfo.pixelBytes) ||
([_texDisplayFetchCustom[NDSDisplayID_Main][i] width] != w) ||
([_texDisplayFetchCustom[NDSDisplayID_Main][i] height] != h) )
{
[_texDisplayFetchCustom[NDSDisplayID_Main][i] release];
[_texDisplayFetchCustom[NDSDisplayID_Touch][i] release];
[_texDisplayPostprocessCustom[NDSDisplayID_Main][i] release];
[_texDisplayPostprocessCustom[NDSDisplayID_Touch][i] release];
#ifdef MAC_OS_X_VERSION_10_13
if (_isSharedBufferTextureSupported)
{
_texDisplayFetchCustom[NDSDisplayID_Main][i] = [_bufDisplayFetchCustom[NDSDisplayID_Main][i] newTextureWithDescriptor:newTexDisplayCustomDesc offset:0 bytesPerRow:_customLineSize];
_texDisplayFetchCustom[NDSDisplayID_Touch][i] = [_bufDisplayFetchCustom[NDSDisplayID_Touch][i] newTextureWithDescriptor:newTexDisplayCustomDesc offset:0 bytesPerRow:_customLineSize];
}
else
#endif
{
_texDisplayFetchCustom[NDSDisplayID_Main][i] = [device newTextureWithDescriptor:newTexDisplayCustomDesc];
_texDisplayFetchCustom[NDSDisplayID_Touch][i] = [device newTextureWithDescriptor:newTexDisplayCustomDesc];
}
_texDisplayPostprocessCustom[NDSDisplayID_Main][i] = [device newTextureWithDescriptor:newTexPostprocessCustomDesc];
_texDisplayPostprocessCustom[NDSDisplayID_Touch][i] = [device newTextureWithDescriptor:newTexPostprocessCustomDesc];
if (_isSharedBufferTextureSupported)
{
_texDisplayFetchCustom[NDSDisplayID_Main][i] = [_bufDisplayFetchCustom[NDSDisplayID_Main][i] newTextureWithDescriptor:newTexDisplayCustomDesc offset:0 bytesPerRow:_customLineSize];
_texDisplayFetchCustom[NDSDisplayID_Touch][i] = [_bufDisplayFetchCustom[NDSDisplayID_Touch][i] newTextureWithDescriptor:newTexDisplayCustomDesc offset:0 bytesPerRow:_customLineSize];
}
else
#endif
{
_texDisplayFetchCustom[NDSDisplayID_Main][i] = [device newTextureWithDescriptor:newTexDisplayCustomDesc];
_texDisplayFetchCustom[NDSDisplayID_Touch][i] = [device newTextureWithDescriptor:newTexDisplayCustomDesc];
}
_texDisplayPostprocessCustom[NDSDisplayID_Main][i] = [device newTextureWithDescriptor:newTexPostprocessCustomDesc];
_texDisplayPostprocessCustom[NDSDisplayID_Touch][i] = [device newTextureWithDescriptor:newTexPostprocessCustomDesc];
}
}
@ -675,6 +676,7 @@
}
id<MTLTexture> targetDestination = _texDisplayFetchNative[displayID][bufferIndex];
const NDSDisplayInfo &currentDisplayInfo = GPUFetchObject->GetFetchDisplayInfoForBufferIndex(bufferIndex);
[targetDestination replaceRegion:MTLRegionMake2D(0, 0, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT)