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
120 float arr[4] = {1.0, 2.0, 3.0, 4.0};
158 b = (u16v.y >= uv.x);
195 i16v = min(i16v, i16);
196 i16v = min(i16v, i16vec2(-1));
197 u16v = min(u16v, u16);
198 u16v = min(u16v, u16vec3(0));
201 i16v = max(i16v, i16);
202 i16v = max(i16v, i16vec2(-1));
203 u16v = max(u16v, u16);
204 u16v = max(u16v, u16vec3(0));
207 i16v = clamp(i16v, -i16, i16);
208 i16v = clamp(i16v, -i16v, i16v);
209 u16v = clamp(u16v, -u16, u16);
210 u16v = clamp(u16v, -u16v, u16v);
213 i16 = mix(i16v.x, i16v.y, true);
214 i16v = mix(i16vec2(i16), i16vec2(-i16), bvec2(false));
215 u16 = mix(u16v.x, u16v.y, true);
216 u16v = mix(u16vec3(u16), u16vec3(-u16), bvec3(false));
224 i16v = unpack16(i32);
225 i16v4 = unpack16(i64);
226 u16v2 = unpack16(u32);
227 u16v4 = unpack16(u64);
230 bv = lessThan(u16v, u16vec3(u16));
231 bv.xy = lessThan(i16v, i16vec2(i16));
234 bv = lessThanEqual(u16v, u16vec3(u16));
235 bv.xy = lessThanEqual(i16v, i16vec2(i16));
238 bv = greaterThan(u16v, u16vec3(u16));
239 bv.xy = greaterThan(i16v, i16vec2(i16));
241 // greaterThanEqual()
242 bv = greaterThanEqual(u16v, u16vec3(u16));
243 bv.xy = greaterThanEqual(i16v, i16vec2(i16));
246 bv = equal(u16v, u16vec3(u16));
247 bv.xy = equal(i16v, i16vec2(i16));
250 bv = notEqual(u16v, u16vec3(u16));
251 bv.xy = notEqual(i16v, i16vec2(i16));
254 // Type conversion for specialization constant
255 layout(constant_id = 100) const int16_t si16 = int16_t(-10);
256 layout(constant_id = 101) const uint16_t su16 = uint16_t(20);