Skip to content

Commit 5492f08

Browse files
committed
Address Nick note, and re-enable CMake build of imaging after bad rebase earlier today
1 parent cbcaaeb commit 5492f08

4 files changed

Lines changed: 16 additions & 11 deletions

File tree

cmake/defaults/Options.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ if(APPLE)
5252
MESSAGE(STATUS "Setting PXR_BUILD_USD_TOOLS=OFF because they are not supported on Apple embedded platforms")
5353
set(PXR_BUILD_USD_TOOLS OFF)
5454
endif()
55-
if (${PXR_BUILD_IMAGING})
56-
MESSAGE(STATUS "Setting PXR_BUILD_USD_IMAGING=OFF because it is not supported on Apple embedded platforms")
57-
set(PXR_BUILD_IMAGING OFF)
58-
endif ()
55+
set(PXR_ENABLE_GL_SUPPORT OFF)
5956
endif ()
6057
endif()
6158

pxr/imaging/hgiGL/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set(PXR_PREFIX pxr/imaging)
22
set(PXR_PACKAGE hgiGL)
33

4-
if (NOT ${PXR_ENABLE_GL_SUPPORT} AND NOT PXR_APPLE_EMBEDDED)
4+
if (NOT ${PXR_ENABLE_GL_SUPPORT} AND NOT ${PXR_APPLE_EMBEDDED})
55
message(STATUS
66
"Skipping ${PXR_PACKAGE} because PXR_ENABLE_GL_SUPPORT is OFF")
77
return()

pxr/imaging/hgiInterop/metal.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99

1010
#include "pxr/imaging/garch/glApi.h"
1111

12+
1213
#include <Metal/Metal.h>
14+
#if defined(ARCH_OS_OSX)
1315
#include <AppKit/AppKit.h>
14-
16+
#else
17+
#include <UIKit/UIKit.h>
18+
#endif
1519
#include "pxr/pxr.h"
1620
#include "pxr/base/gf/vec4i.h"
1721
#include "pxr/imaging/hgi/texture.h"

pxr/imaging/hgiMetal/texture.mm

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
MTLTextureUsage usage = MTLTextureUsageShaderRead;
2525

2626
if (desc.initialData && desc.pixelsByteSize > 0) {
27-
#if defined(ARCH_OS_OSX)
28-
resourceOptions = MTLResourceStorageModeManaged;
29-
#else
30-
resourceOptions = MTLResourceStorageModeShared;
31-
#endif
27+
#if defined(ARCH_OS_OSX)
28+
id<MTLDevice> device = hgi->GetPrimaryDevice();
29+
if (![device hasUnifiedMemory]) {
30+
resourceOptions = MTLResourceStorageModeManaged;
31+
} else
32+
#endif
33+
{
34+
resourceOptions = MTLResourceStorageModeShared;
35+
}
3236
}
3337

3438
MTLPixelFormat mtlFormat = HgiMetalConversions::GetPixelFormat(

0 commit comments

Comments
 (0)