[registrar] Don't use a @protocol reference for CAMetalDrawable in the simulator (there's no header for this protocol).

This commit is contained in:
Rolf Bjarne Kvinge 2018-02-14 01:12:55 +01:00
Родитель 564e433bbd
Коммит 84b6e8a405
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -2968,8 +2968,21 @@ namespace Registrar {
map.AppendLine ("0x{0:X}, /* {1} */", p.TokenReference, p.Protocol.Type.FullName);
map.AppendLine ("};");
map.AppendLine ("static const Protocol* __xamarin_protocols [] = {");
foreach (var p in ordered)
map.AppendLine ("@protocol ({0}), /* {1} */", p.Protocol.ProtocolName, p.Protocol.Type.FullName);
foreach (var p in ordered) {
bool use_dynamic = false;
#if MTOUCH
switch (p.Protocol.ProtocolName) {
case "CAMetalDrawable": // The header isn't available for the simulator.
use_dynamic = IsSimulator;
break;
}
#endif
if (use_dynamic) {
map.AppendLine ("objc_getProtocol (\"{0}\"), /* {1} */", p.Protocol.ProtocolName, p.Protocol.Type.FullName);
} else {
map.AppendLine ("@protocol ({0}), /* {1} */", p.Protocol.ProtocolName, p.Protocol.Type.FullName);
}
}
map.AppendLine ("};");
}
map.AppendLine ("static struct MTRegistrationMap __xamarin_registration_map = {");