mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-14 01:35:36 +00:00
Do not access "view" in getMetalLayerSize
Fixes Main thread checker assert in getMetalLayerSize Use the layer.contentsScale to adjust for high DPI instead of "view convertSizeToBacking"
This commit is contained in:
committed by
Baldur Karlsson
parent
57b6190c85
commit
1700249a79
@@ -29,7 +29,7 @@
|
||||
#include <dlfcn.h>
|
||||
|
||||
// helpers defined in vk_apple.mm
|
||||
void getMetalLayerSize(void *viewHandle, void *layerHandle, int &width, int &height);
|
||||
void getMetalLayerSize(void *layerHandle, int &width, int &height);
|
||||
|
||||
#if defined(VK_USE_PLATFORM_MACOS_MVK)
|
||||
|
||||
@@ -147,7 +147,7 @@ void VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h
|
||||
return;
|
||||
}
|
||||
|
||||
getMetalLayerSize(outw.cocoa.view, outw.cocoa.layer, w, h);
|
||||
getMetalLayerSize(outw.cocoa.layer, w, h);
|
||||
}
|
||||
|
||||
static const rdcstr VulkanLibraryName = "libvulkan.1.dylib"_lit;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
void getMetalLayerSize(void *viewHandle, void* layerHandle, int& width, int& height)
|
||||
void getMetalLayerSize(void* layerHandle, int& width, int& height)
|
||||
{
|
||||
NSView *view = (NSView *)viewHandle;
|
||||
assert([view isKindOfClass:[NSView class]]);
|
||||
CALayer *layer = (CALayer *)layerHandle;
|
||||
assert([layer isKindOfClass:[CALayer class]]);
|
||||
|
||||
CGSize viewScale = [view convertSizeToBacking:layer.bounds.size];
|
||||
width = viewScale.width;
|
||||
height = viewScale.height;
|
||||
const CGFloat scaleFactor = layer.contentsScale;
|
||||
width = layer.bounds.size.width * scaleFactor;
|
||||
height = layer.bounds.size.height * scaleFactor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user