@@ -39,7 +39,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
3939 if (input.bit_width == 8 * sizeof (float ) / 2 ) {
4040 switch (input.vec_size ) {
4141 case 1 :
42- return MTLVertexFormatHalf ;
42+ if (@available (macOS 10.13 , *)) {
43+ return MTLVertexFormatHalf ;
44+ } else {
45+ return MTLVertexFormatInvalid ;
46+ }
4347 case 2 :
4448 return MTLVertexFormatHalf2 ;
4549 case 3 :
@@ -56,15 +60,23 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
5660 }
5761 case ShaderType::kBoolean : {
5862 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+ }
6068 }
6169 return MTLVertexFormatInvalid ;
6270 }
6371 case ShaderType::kSignedByte : {
6472 if (input.bit_width == 8 * sizeof (char )) {
6573 switch (input.vec_size ) {
6674 case 1 :
67- return MTLVertexFormatChar ;
75+ if (@available (macOS 10.13 , *)) {
76+ return MTLVertexFormatChar ;
77+ } else {
78+ return MTLVertexFormatInvalid ;
79+ }
6880 case 2 :
6981 return MTLVertexFormatChar2 ;
7082 case 3 :
@@ -79,7 +91,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
7991 if (input.bit_width == 8 * sizeof (char )) {
8092 switch (input.vec_size ) {
8193 case 1 :
82- return MTLVertexFormatUChar ;
94+ if (@available (macOS 10.13 , *)) {
95+ return MTLVertexFormatUChar ;
96+ } else {
97+ return MTLVertexFormatInvalid ;
98+ }
8399 case 2 :
84100 return MTLVertexFormatUChar2 ;
85101 case 3 :
@@ -94,7 +110,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
94110 if (input.bit_width == 8 * sizeof (short )) {
95111 switch (input.vec_size ) {
96112 case 1 :
97- return MTLVertexFormatShort ;
113+ if (@available (macOS 10.13 , *)) {
114+ return MTLVertexFormatShort ;
115+ } else {
116+ return MTLVertexFormatInvalid ;
117+ }
98118 case 2 :
99119 return MTLVertexFormatShort2 ;
100120 case 3 :
@@ -109,7 +129,11 @@ static MTLVertexFormat ReadStageInputFormat(const ShaderStageIOSlot& input) {
109129 if (input.bit_width == 8 * sizeof (ushort)) {
110130 switch (input.vec_size ) {
111131 case 1 :
112- return MTLVertexFormatUShort ;
132+ if (@available (macOS 10.13 , *)) {
133+ return MTLVertexFormatUShort ;
134+ } else {
135+ return MTLVertexFormatInvalid ;
136+ }
113137 case 2 :
114138 return MTLVertexFormatUShort2 ;
115139 case 3 :
0 commit comments