@@ -39,7 +39,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
39
39
if (input.bit_width == 8 * sizeof (float ) / 2 ) {
40
40
switch (input.vec_size ) {
41
41
case 1 :
42
- return MTLVertexFormatHalf ;
42
+ if (@available (macOS 10.13 , *)) {
43
+ return MTLVertexFormatHalf ;
44
+ } else {
45
+ return MTLVertexFormatInvalid ;
46
+ }
43
47
case 2 :
44
48
return MTLVertexFormatHalf2 ;
45
49
case 3 :
@@ -56,15 +60,23 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
56
60
}
57
61
case ShaderType::kBoolean : {
58
62
if (input.bit_width == 8 * sizeof (bool ) && input.vec_size == 1 ) {
59
- return MTLVertexFormatChar ;
63
+ if (@available (macOS 10.13 , *)) {
64
+ return MTLVertexFormatChar ;
65
+ } else {
66
+ return MTLVertexFormatInvalid ;
67
+ }
60
68
}
61
69
return MTLVertexFormatInvalid ;
62
70
}
63
71
case ShaderType::kSignedByte : {
64
72
if (input.bit_width == 8 * sizeof (char )) {
65
73
switch (input.vec_size ) {
66
74
case 1 :
67
- return MTLVertexFormatChar ;
75
+ if (@available (macOS 10.13 , *)) {
76
+ return MTLVertexFormatChar ;
77
+ } else {
78
+ return MTLVertexFormatInvalid ;
79
+ }
68
80
case 2 :
69
81
return MTLVertexFormatChar2 ;
70
82
case 3 :
@@ -79,7 +91,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
79
91
if (input.bit_width == 8 * sizeof (char )) {
80
92
switch (input.vec_size ) {
81
93
case 1 :
82
- return MTLVertexFormatUChar ;
94
+ if (@available (macOS 10.13 , *)) {
95
+ return MTLVertexFormatUChar ;
96
+ } else {
97
+ return MTLVertexFormatInvalid ;
98
+ }
83
99
case 2 :
84
100
return MTLVertexFormatUChar2 ;
85
101
case 3 :
@@ -94,7 +110,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
94
110
if (input.bit_width == 8 * sizeof (short )) {
95
111
switch (input.vec_size ) {
96
112
case 1 :
97
- return MTLVertexFormatShort ;
113
+ if (@available (macOS 10.13 , *)) {
114
+ return MTLVertexFormatShort ;
115
+ } else {
116
+ return MTLVertexFormatInvalid ;
117
+ }
98
118
case 2 :
99
119
return MTLVertexFormatShort2 ;
100
120
case 3 :
@@ -109,7 +129,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
109
129
if (input.bit_width == 8 * sizeof (ushort)) {
110
130
switch (input.vec_size ) {
111
131
case 1 :
112
- return MTLVertexFormatUShort ;
132
+ if (@available (macOS 10.13 , *)) {
133
+ return MTLVertexFormatUShort ;
134
+ } else {
135
+ return MTLVertexFormatInvalid ;
136
+ }
113
137
case 2 :
114
138
return MTLVertexFormatUShort2 ;
115
139
case 3 :
0 commit comments