Skip to content

Commit a6e6b49

Browse files
davidgyupixar-oss
authored andcommitted
[base,imaging] Updated base/arch/defines.h for Apple
Swaps ARCH_OS_IOS for ARCH_OS_IPHONE to align with compiler directives. TARGET_OS_IPHONE refers to all derivative platforms whereas iOS refers only to iPhone/iPad (Confusing but the case for historical reasons as documented in TargetConditionals.h within any Apple SDK). Contribution: Dhruv Govil See #2949 (Internal change: 2321624)
1 parent 7cadce6 commit a6e6b49

8 files changed

Lines changed: 18 additions & 11 deletions

File tree

pxr/base/arch/align.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
#include "pxr/base/arch/defines.h"
2727
#include "pxr/base/arch/error.h"
2828

29-
#if defined(ARCH_OS_DARWIN)
29+
#if defined(ARCH_OS_IPHONE)
30+
#elif defined(ARCH_OS_DARWIN)
3031
# include <sys/malloc.h>
3132
#else
3233
# include <malloc.h>
33-
#endif /* defined(ARCH_OS_DARWIN) */
34+
#endif /* defined(ARCH_OS_IPHONE) */
3435

3536
#include <cstdlib>
3637

pxr/base/arch/debugger.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN)
3535
#include "pxr/base/arch/inttypes.h"
3636
#include <sys/types.h>
37+
#if !defined(ARCH_OS_IPHONE)
3738
#include <sys/ptrace.h>
39+
#endif
3840
#include <sys/stat.h>
3941
#include <sys/wait.h>
4042
#include <cstdio>

pxr/base/arch/defines.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
#include "TargetConditionals.h"
3535
#define ARCH_OS_DARWIN
3636
#if TARGET_OS_IPHONE
37-
#define ARCH_OS_IOS
37+
// TARGET_OS_IPHONE refers to all iOS derivative platforms
38+
// TARGET_OS_IOS refers to iPhone/iPad
39+
// For now, we specialize for the umbrella TARGET_OS_IPHONE group
40+
#define ARCH_OS_IPHONE
3841
#else
3942
#define ARCH_OS_OSX
4043
#endif

pxr/base/arch/mallocHook.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
#endif
3434
#include <cstring>
3535

36-
#if defined(ARCH_OS_DARWIN)
36+
#if defined(ARCH_OS_IPHONE)
37+
#elif defined(ARCH_OS_DARWIN)
3738
# include <sys/malloc.h>
3839
#else
3940
# include <malloc.h>
40-
#endif /* defined(ARCH_OS_DARWIN) */
41+
#endif /* defined(ARCH_OS_IPHONE) */
4142

4243
PXR_NAMESPACE_OPEN_SCOPE
4344

pxr/imaging/garch/glPlatformContextDarwin.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "pxr/pxr.h"
2828
#include "glPlatformContextDarwin.h"
2929

30-
#ifdef ARCH_OS_IOS
30+
#ifdef ARCH_OS_IPHONE
3131
typedef EAGLContext NSGLContext;
3232
#else
3333
typedef NSOpenGLContext NSGLContext;
@@ -90,7 +90,7 @@
9090
void
9191
GarchNSGLContextState::MakeCurrent()
9292
{
93-
#if ARCH_OS_IOS
93+
#if ARCH_OS_IPHONE
9494
[EAGLContext setCurrentContext:_detail->context];
9595
#else
9696
[_detail->context makeCurrentContext];

pxr/imaging/hgiMetal/capabilities.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
if (@available(macOS 100.100, ios 12.0, *)) {
5151
unifiedMemory = true;
5252
} else if (@available(macOS 10.15, ios 13.0, *)) {
53-
#if defined(ARCH_OS_IOS) || (defined(__MAC_10_15) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_15)
53+
#if defined(ARCH_OS_IPHONE) || (defined(__MAC_10_15) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_15)
5454
unifiedMemory = [device hasUnifiedMemory];
5555
#else
5656
unifiedMemory = [device isLowPower];

pxr/imaging/hgiMetal/shaderGenerator.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ void _Init(
402402
}
403403

404404
if (@available(macos 100.100, ios 12.0, *)) {
405-
header << "#define ARCH_OS_IOS\n";
405+
header << "#define ARCH_OS_IPHONE\n";
406406
// Define all iOS 12 feature set enums onwards
407407
if ([device supportsFeatureSet:MTLFeatureSet(12)])
408408
header << "#define METAL_FEATURESET_IOS_GPUFAMILY1_v5\n";
@@ -1614,4 +1614,4 @@ void _Init(
16141614
}
16151615

16161616

1617-
PXR_NAMESPACE_CLOSE_SCOPE
1617+
PXR_NAMESPACE_CLOSE_SCOPE

pxr/imaging/hio/stbImage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Hio_StbImage::ReadCropped(int const cropTop,
439439
// thus we explicitly call stbi__vertical_flip below - assuming
440440
// that no other client called stbi_set_flip_vertically_on_load(true).
441441

442-
#if defined(ARCH_OS_IOS)
442+
#if defined(ARCH_OS_IPHONE)
443443
stbi_convert_iphone_png_to_rgb(true);
444444
#endif
445445

0 commit comments

Comments
 (0)