Permalink
Browse files

Cocoa Port: Fix a bug where Metal display view backing textures weren…

…'t updating their custom framebuffer sizes. (Regression from commit 4c01e66.)
  • Loading branch information...
rogerman committed Dec 19, 2017
1 parent 4c01e66 commit f2f3680a7ce40141e0736a7f7b479d4c7c55d0be
Showing with 23 additions and 21 deletions.
  1. +23 −21 desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.mm
@@ -391,31 +391,32 @@ - (void) setFetchBuffersWithDisplayInfo:(const NDSDisplayInfo &)dispInfo
_texDisplayPostprocessNative[NDSDisplayID_Main][i] = [device newTextureWithDescriptor:newTexPostprocessNativeDesc];
_texDisplayPostprocessNative[NDSDisplayID_Touch][i] = [device newTextureWithDescriptor:newTexPostprocessNativeDesc];
}
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];
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];
#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
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];
{
_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 @@ - (void) fetchNativeDisplayByID:(const NDSDisplayID)displayID bufferIndex:(const
}
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)

0 comments on commit f2f3680

Please sign in to comment.