File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
Graphics/GraphicsEngineWebGPU/src Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2023-2025 Diligent Graphics LLC
2+ * Copyright 2023-2026 Diligent Graphics LLC
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -262,6 +262,8 @@ void SwapChainWebGPUImpl::ConfigureSurface()
262262
263263 m_SwapChainDesc.Width = WindowRect.right - WindowRect.left ;
264264 m_SwapChainDesc.Height = WindowRect.bottom - WindowRect.top ;
265+ #elif PLATFORM_MACOS
266+ m_NativeWindow.GetBackingSize (m_SwapChainDesc.Width , m_SwapChainDesc.Height );
265267#elif PLATFORM_WEB
266268 int32_t CanvasWidth = 0 ;
267269 int32_t CanvasHeight = 0 ;
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2019-2024 Diligent Graphics LLC
2+ * Copyright 2019-2026 Diligent Graphics LLC
33 * Copyright 2015-2019 Egor Yusov
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
2828#pragma once
2929
3030#include "../../../Primitives/interface/CommonDefinitions.h"
31+ #include "../../../Primitives/interface/BasicTypes.h"
3132
3233DILIGENT_BEGIN_NAMESPACE (Diligent )
3334
@@ -44,6 +45,8 @@ struct MacOSNativeWindow
4445 {}
4546
4647 void * GetLayer () const ;
48+
49+ void GetBackingSize (Uint32 & Width , Uint32 & Height ) const ;
4750#endif
4851};
4952
Original file line number Diff line number Diff line change 2323 */
2424
2525#include " MacOSNativeWindow.h"
26+ #include " BasicTypes.h"
2627
2728#import < AppKit/AppKit.h>
2829
3435 return pNSView ? (__bridge void *)((__bridge NSView *)pNSView).layer : nullptr ;
3536}
3637
38+ void MacOSNativeWindow::GetBackingSize (Uint32& Width, Uint32& Height) const
39+ {
40+ if (pNSView)
41+ {
42+ NSView * nsView = (__bridge NSView *)pNSView;
43+ NSRect viewRectPixels = [nsView convertRectToBacking: [nsView bounds ]];
44+ Width = static_cast <Uint32>(viewRectPixels.size .width );
45+ Height = static_cast <Uint32>(viewRectPixels.size .height );
46+ }
47+ else
48+ {
49+ Width = 0 ;
50+ Height = 0 ;
51+ }
52+ }
53+
3754} // namespace Diligent
You can’t perform that action at this time.
0 commit comments