Skip to content

Commit 095fe0f

Browse files
committed
Metal: exclude tvOS from HDR compile gate
CAMetalLayer.wantsExtendedDynamicRangeContent and edrMetadata are not exposed on the public tvOS SDK (they exist privately but are not part of the tvOS public interface regardless of SDK version). Griffin / unified builds for tvOS therefore fail at compile time when the HDR code paths reference the property, even though the existing gate accepted any __IPHONE_16_0 || __TVOS_16_0 SDK. Narrow the compile gate: - macOS 11+ SDK: HDR available (unchanged). - iOS 16+ SDK: HDR available (unchanged). - tvOS (any SDK): HDR unavailable, driver stays in SDR. Also reword the surrounding comment to match: tvOS is explicitly excluded because the EDR surface area is not public there, not because of a missing SDK version.
1 parent 172d7bc commit 095fe0f

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

gfx/drivers/metal.m

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,30 +82,36 @@
8282

8383
/* HDR availability gate.
8484
*
85-
* Compile-time: the SDK must expose CAMetalLayer's wantsExtendedDynamicRangeContent
86-
* property and the PQ colour space name. The PQ colour space name
87-
* (kCGColorSpaceITUR_2100_PQ) is the binding constraint on macOS — it was
88-
* introduced in 10.15.4 but the symbol is gated to macOS 11.0 in the public
89-
* headers. On iOS / tvOS the whole EDR surface area on CAMetalLayer was
90-
* only exposed in the 16.x SDKs.
85+
* Compile-time: the SDK must expose CAMetalLayer's
86+
* wantsExtendedDynamicRangeContent property and the PQ colour space name.
87+
* The PQ colour space name (kCGColorSpaceITUR_2100_PQ) is the binding
88+
* constraint on macOS — introduced in 10.15.4 but gated to macOS 11.0 in
89+
* the public headers. On iOS the EDR surface area on CAMetalLayer was
90+
* only exposed in the 16.x SDKs. tvOS never got a public EDR path:
91+
* wantsExtendedDynamicRangeContent / edrMetadata are not part of the
92+
* public tvOS interface regardless of SDK version, so HDR is unsupported
93+
* there and the driver stays in SDR.
9194
*
92-
* We key the compile gate off the Availability.h __MAC_..., __IPHONE_...,
93-
* __TVOS_... version tokens rather than AvailabilityMacros.h
94-
* MAC_OS_X_VERSION_* constants: the former are defined consistently across
95-
* all recent SDKs, while the latter were phased out for newer point releases
96-
* and checking them fails silently even when the APIs are in fact present.
95+
* We key the compile gate off the Availability.h __MAC_... / __IPHONE_...
96+
* version tokens rather than AvailabilityMacros.h MAC_OS_X_VERSION_*
97+
* constants: the former are defined consistently across all recent SDKs,
98+
* while the latter were phased out for newer point releases and checking
99+
* them fails silently even when the APIs are in fact present.
97100
*
98101
* Runtime: the HDR paths are still guarded with @available(...) checks
99-
* because RetroArch's Apple deployment targets (macOS 10.13, iOS 11,
100-
* tvOS 12.1) are lower than the first HDR-capable OS release on each
101-
* platform. When the runtime gate is false the driver stays in SDR mode.
102+
* because RetroArch's Apple deployment targets (macOS 10.13, iOS 11) are
103+
* lower than the first HDR-capable OS release on each platform. When
104+
* the runtime gate is false the driver stays in SDR mode.
102105
*
103106
* METAL_HDR_AVAILABLE guards compile-time only. Whenever we touch an HDR-specific
104107
* API inside those blocks, an @available check guards runtime dispatch. */
105108
#include <Availability.h>
106-
#if defined(OSX) && defined(__MAC_11_0)
109+
#include <TargetConditionals.h>
110+
#if defined(TARGET_OS_TV) && TARGET_OS_TV
111+
# define METAL_HDR_AVAILABLE 0
112+
#elif defined(OSX) && defined(__MAC_11_0)
107113
# define METAL_HDR_AVAILABLE 1
108-
#elif defined(HAVE_COCOATOUCH) && (defined(__IPHONE_16_0) || defined(__TVOS_16_0))
114+
#elif defined(HAVE_COCOATOUCH) && defined(__IPHONE_16_0)
109115
# define METAL_HDR_AVAILABLE 1
110116
#else
111117
# define METAL_HDR_AVAILABLE 0

0 commit comments

Comments
 (0)