Path: blob/master/thirdparty/metal-cpp/QuartzCore/CAPrivate.hpp
21059 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// QuartzCore/CAPrivate.hpp3//4// Copyright 2020-2024 Apple Inc.5//6// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.17//18//-------------------------------------------------------------------------------------------------------------------------------------------------------------1920#pragma once2122//-------------------------------------------------------------------------------------------------------------------------------------------------------------2324#include "CADefines.hpp"2526#include <objc/runtime.h>2728//-------------------------------------------------------------------------------------------------------------------------------------------------------------2930#define _CA_PRIVATE_CLS(symbol) (Private::Class::s_k##symbol)31#define _CA_PRIVATE_SEL(accessor) (Private::Selector::s_k##accessor)3233//-------------------------------------------------------------------------------------------------------------------------------------------------------------3435#if defined(CA_PRIVATE_IMPLEMENTATION)3637#ifdef METALCPP_SYMBOL_VISIBILITY_HIDDEN38#define _CA_PRIVATE_VISIBILITY __attribute__((visibility("hidden")))39#else40#define _CA_PRIVATE_VISIBILITY __attribute__((visibility("default")))41#endif // METALCPP_SYMBOL_VISIBILITY_HIDDEN4243#define _CA_PRIVATE_IMPORT __attribute__((weak_import))4445#ifdef __OBJC__46#define _CA_PRIVATE_OBJC_LOOKUP_CLASS(symbol) ((__bridge void*)objc_lookUpClass(#symbol))47#define _CA_PRIVATE_OBJC_GET_PROTOCOL(symbol) ((__bridge void*)objc_getProtocol(#symbol))48#else49#define _CA_PRIVATE_OBJC_LOOKUP_CLASS(symbol) objc_lookUpClass(#symbol)50#define _CA_PRIVATE_OBJC_GET_PROTOCOL(symbol) objc_getProtocol(#symbol)51#endif // __OBJC__5253#define _CA_PRIVATE_DEF_CLS(symbol) void* s_k##symbol _CA_PRIVATE_VISIBILITY = _CA_PRIVATE_OBJC_LOOKUP_CLASS(symbol)54#define _CA_PRIVATE_DEF_PRO(symbol) void* s_k##symbol _CA_PRIVATE_VISIBILITY = _CA_PRIVATE_OBJC_GET_PROTOCOL(symbol)55#define _CA_PRIVATE_DEF_SEL(accessor, symbol) SEL s_k##accessor _CA_PRIVATE_VISIBILITY = sel_registerName(symbol)56#define _CA_PRIVATE_DEF_STR(type, symbol) \57_CA_EXTERN type const CA##symbol _CA_PRIVATE_IMPORT; \58type const CA::symbol = (nullptr != &CA##symbol) ? CA##symbol : nullptr5960#else6162#define _CA_PRIVATE_DEF_CLS(symbol) extern void* s_k##symbol63#define _CA_PRIVATE_DEF_PRO(symbol) extern void* s_k##symbol64#define _CA_PRIVATE_DEF_SEL(accessor, symbol) extern SEL s_k##accessor65#define _CA_PRIVATE_DEF_STR(type, symbol) extern type const CA::symbol6667#endif // CA_PRIVATE_IMPLEMENTATION6869//-------------------------------------------------------------------------------------------------------------------------------------------------------------7071namespace CA72{73namespace Private74{75namespace Class76{77_CA_PRIVATE_DEF_CLS(CAMetalLayer);78} // Class79} // Private80} // CA8182//-------------------------------------------------------------------------------------------------------------------------------------------------------------8384namespace CA85{86namespace Private87{88namespace Protocol89{9091_CA_PRIVATE_DEF_PRO(CAMetalDrawable);9293} // Protocol94} // Private95} // CA9697//-------------------------------------------------------------------------------------------------------------------------------------------------------------9899namespace CA100{101namespace Private102{103namespace Selector104{105_CA_PRIVATE_DEF_SEL(allowsNextDrawableTimeout,106"allowsNextDrawableTimeout");107_CA_PRIVATE_DEF_SEL(colorspace,108"colorspace");109_CA_PRIVATE_DEF_SEL(device,110"device");111_CA_PRIVATE_DEF_SEL(displaySyncEnabled,112"displaySyncEnabled");113_CA_PRIVATE_DEF_SEL(drawableSize,114"drawableSize");115_CA_PRIVATE_DEF_SEL(framebufferOnly,116"framebufferOnly");117_CA_PRIVATE_DEF_SEL(layer,118"layer");119_CA_PRIVATE_DEF_SEL(maximumDrawableCount,120"maximumDrawableCount");121_CA_PRIVATE_DEF_SEL(nextDrawable,122"nextDrawable");123_CA_PRIVATE_DEF_SEL(pixelFormat,124"pixelFormat");125_CA_PRIVATE_DEF_SEL(residencySet,126"residencySet");127_CA_PRIVATE_DEF_SEL(setAllowsNextDrawableTimeout_,128"setAllowsNextDrawableTimeout:");129_CA_PRIVATE_DEF_SEL(setColorspace_,130"setColorspace:");131_CA_PRIVATE_DEF_SEL(setDevice_,132"setDevice:");133_CA_PRIVATE_DEF_SEL(setDisplaySyncEnabled_,134"setDisplaySyncEnabled:");135_CA_PRIVATE_DEF_SEL(setDrawableSize_,136"setDrawableSize:");137_CA_PRIVATE_DEF_SEL(setFramebufferOnly_,138"setFramebufferOnly:");139_CA_PRIVATE_DEF_SEL(setMaximumDrawableCount_,140"setMaximumDrawableCount:");141_CA_PRIVATE_DEF_SEL(setPixelFormat_,142"setPixelFormat:");143_CA_PRIVATE_DEF_SEL(texture,144"texture");145} // Class146} // Private147} // CA148149//-------------------------------------------------------------------------------------------------------------------------------------------------------------150151152