|
2 | 2 |
|
3 | 3 | #include <TargetConditionals.h> |
4 | 4 |
|
5 | | -#import <QuartzCore/CAMetalLayer.h> |
6 | 5 | #import <React/RCTBlobManager.h> |
7 | 6 | #import <React/RCTBridge+Private.h> |
8 | 7 | #import <ReactCommon/RCTTurboModule.h> |
@@ -40,70 +39,6 @@ void checkIfUsingSimulatorWithAPIValidation() { |
40 | 39 | return instance.CreateSurface(&surfaceDescriptor); |
41 | 40 | } |
42 | 41 |
|
43 | | -void ApplePlatformContext::configureSurfaceColor( |
44 | | - void *nativeSurface, const SurfaceColorConfig &config) { |
45 | | - if (!nativeSurface) { |
46 | | - NSLog(@"[RNWebGPU] configureSurfaceColor: nativeSurface is null"); |
47 | | - return; |
48 | | - } |
49 | | - CAMetalLayer *layer = (__bridge CAMetalLayer *)nativeSurface; |
50 | | - |
51 | | - // CAMetalLayer property setters are documented as thread-safe, and we need |
52 | | - // these changes to land before the caller renders / presents the next |
53 | | - // frame, so apply synchronously here instead of bouncing to the main queue. |
54 | | - [CATransaction begin]; |
55 | | - [CATransaction setDisableActions:YES]; |
56 | | - |
57 | | - CGColorSpaceRef colorSpace = nullptr; |
58 | | - if (config.extendedDynamicRange) { |
59 | | -#if !TARGET_OS_OSX |
60 | | - if (@available(iOS 16.0, *)) { |
61 | | - layer.wantsExtendedDynamicRangeContent = YES; |
62 | | - } |
63 | | -#else |
64 | | - layer.wantsExtendedDynamicRangeContent = YES; |
65 | | -#endif |
66 | | - // Extended linear sRGB allows shader values >1 to map into the display's |
67 | | - // EDR headroom on supporting hardware. |
68 | | - colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB); |
69 | | - } else { |
70 | | -#if !TARGET_OS_OSX |
71 | | - if (@available(iOS 16.0, *)) { |
72 | | - layer.wantsExtendedDynamicRangeContent = NO; |
73 | | - } |
74 | | -#else |
75 | | - layer.wantsExtendedDynamicRangeContent = NO; |
76 | | -#endif |
77 | | - // Non-extended sRGB clamps float values >1 to SDR. Linear variants |
78 | | - // ("kCGColorSpaceLinearSRGB") still pass values >1 through on iOS, so we |
79 | | - // use gamma-encoded sRGB for the standard tone-mapping mode. |
80 | | - colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); |
81 | | - } |
82 | | - if (colorSpace) { |
83 | | - layer.colorspace = colorSpace; |
84 | | - CGColorSpaceRelease(colorSpace); |
85 | | - } |
86 | | - |
87 | | - [CATransaction commit]; |
88 | | - |
89 | | -#if !TARGET_OS_OSX |
90 | | - CGFloat headroom = 1.0; |
91 | | - if (@available(iOS 16.0, *)) { |
92 | | - headroom = UIScreen.mainScreen.currentEDRHeadroom; |
93 | | - } |
94 | | - NSLog(@"[RNWebGPU] HDR configure: extended=%d format=%u " |
95 | | - @"layer.wantsEDR=%d layer.colorspace=%@ EDRHeadroom=%.2f", |
96 | | - (int)config.extendedDynamicRange, (unsigned)config.format, |
97 | | - (int)layer.wantsExtendedDynamicRangeContent, layer.colorspace, |
98 | | - (double)headroom); |
99 | | -#else |
100 | | - NSLog(@"[RNWebGPU] HDR configure: extended=%d format=%u " |
101 | | - @"layer.wantsEDR=%d layer.colorspace=%@", |
102 | | - (int)config.extendedDynamicRange, (unsigned)config.format, |
103 | | - (int)layer.wantsExtendedDynamicRangeContent, layer.colorspace); |
104 | | -#endif |
105 | | -} |
106 | | - |
107 | 42 | static std::span<const uint8_t> nsDataToSpan(NSData *data) { |
108 | 43 | return {static_cast<const uint8_t *>(data.bytes), data.length}; |
109 | 44 | } |
|
0 commit comments