3 #extension GL_EXT_shader_explicit_arithmetic_types: enable
4 #extension GL_EXT_shader_explicit_arithmetic_types_int8: require
5 #extension GL_EXT_shader_explicit_arithmetic_types_int16: require
6 #extension GL_EXT_shader_explicit_arithmetic_types_int32: require
7 #extension GL_EXT_shader_explicit_arithmetic_types_int64: require
8 #extension GL_EXT_shader_explicit_arithmetic_types_float16: require
9 #extension GL_EXT_shader_explicit_arithmetic_types_float32: require
10 #extension GL_EXT_shader_explicit_arithmetic_types_float64: require
12 layout(binding = 0) uniform Uniforms
17 layout(std140, binding = 1) uniform Block
35 const int16_t i16Const[3] =
37 int16_t(-0x1111), // Hex
39 int16_t(040000), // Oct
42 int16_t i16 = i16Const[index];
44 const uint16_t u16Const[] =
46 uint16_t(0xFFFF), // Hex
47 uint16_t(65535), // Dec
48 uint16_t(077777), // Oct
51 uint16_t u16 = u16Const[index];
69 i32v = i16v; // int16_t -> int32_t
70 i32v = u16v; // uint16_t -> int32_t
71 u16v = i16v; // int16_t -> uint16_t
72 u32v = i16v; // int16_t -> uint32_t
73 i64v = i16v; // int16_t -> int64_t
74 u64v = i16v; // int16_t -> uint64_t
75 u32v = u16v; // uint16_t -> uint32_t
76 i64v = u16v; // uint16_t -> int64_t
77 u64v = u16v; // uint16_t -> uint64_t
78 f16v = i16v; // int16_t -> float16_t
79 f32v = i16v; // int16_t -> float32_t
80 f64v = i16v; // int16_t -> float64_t
81 f16v = u16v; // uint16_t -> float16_t
82 f32v = u16v; // uint16_t -> float32_t
83 f64v = u16v; // uint16_t -> float64_t
85 i32v = i32vec2(i16v); // int16_t -> int32_t
86 i32v = i32vec2(u16v); // uint16_t -> int32_t
87 u16v = u16vec2(i16v); // int16_t -> uint16_t
88 u32v = u32vec2(i16v); // int16_t -> uint32_t
89 i64v = i64vec2(i16v); // int16_t -> int64_t
90 u64v = i64vec2(i16v); // int16_t -> uint64_t
91 u32v = u32vec2(u16v); // uint16_t -> uint32_t
92 i64v = i64vec2(u16v); // uint16_t -> int64_t
93 u64v = i64vec2(u16v); // uint16_t -> uint64_t
94 f16v = f16vec2(i16v); // int16_t -> float16_t
95 f32v = f32vec2(i16v); // int16_t -> float32_t
96 f64v = f64vec2(i16v); // int16_t -> float64_t
97 f16v = f16vec2(u16v); // uint16_t -> float16_t
98 f32v = f32vec2(u16v); // uint16_t -> float32_t
99 f64v = f64vec2(u16v); // uint16_t -> float64_t
101 i8v = i8vec2(i16v); // int16_t -> int8_t
102 i8v = i8vec2(u16v); // uint16_t -> int8_t
103 u8v = u8vec2(i16v); // int16_t -> uint8_t
104 u8v = u8vec2(u16v); // uint16_t -> uint8_t
105 i16v = u8vec2(u16v); // uint16_t -> int16_t
106 i16v = i16vec2(bv); // bool -> int16
107 u16v = u16vec2(bv); // bool -> uint16
108 bv = bvec2(i16v); // int16 -> bool
109 bv = bvec2(u16v); // uint16 -> bool
156 b = (u16v.y >= uv.x);
190 i16v = min(i16v, i16);
191 i16v = min(i16v, i16vec2(-1));
192 u16v = min(u16v, u16);
193 u16v = min(u16v, u16vec3(0));
196 i16v = max(i16v, i16);
197 i16v = max(i16v, i16vec2(-1));
198 u16v = max(u16v, u16);
199 u16v = max(u16v, u16vec3(0));
202 i16v = clamp(i16v, -i16, i16);
203 i16v = clamp(i16v, -i16v, i16v);
204 u16v = clamp(u16v, -u16, u16);
205 u16v = clamp(u16v, -u16v, u16v);
208 i16 = mix(i16v.x, i16v.y, true);
209 i16v = mix(i16vec2(i16), i16vec2(-i16), bvec2(false));
210 u16 = mix(u16v.x, u16v.y, true);
211 u16v = mix(u16vec3(u16), u16vec3(-u16), bvec3(false));
219 i16v = unpack16(i32);
220 i16v4 = unpack16(i64);
221 u16v2 = unpack16(u32);
222 u16v4 = unpack16(u64);
225 bv = lessThan(u16v, u16vec3(u16));
226 bv.xy = lessThan(i16v, i16vec2(i16));
229 bv = lessThanEqual(u16v, u16vec3(u16));
230 bv.xy = lessThanEqual(i16v, i16vec2(i16));
233 bv = greaterThan(u16v, u16vec3(u16));
234 bv.xy = greaterThan(i16v, i16vec2(i16));
236 // greaterThanEqual()
237 bv = greaterThanEqual(u16v, u16vec3(u16));
238 bv.xy = greaterThanEqual(i16v, i16vec2(i16));
241 bv = equal(u16v, u16vec3(u16));
242 bv.xy = equal(i16v, i16vec2(i16));
245 bv = notEqual(u16v, u16vec3(u16));
246 bv.xy = notEqual(i16v, i16vec2(i16));
249 // Type conversion for specialization constant
250 layout(constant_id = 100) const int16_t si16 = int16_t(-10);
251 layout(constant_id = 101) const uint16_t su16 = uint16_t(20);