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 int8_t i8Const[3] =
42 int8_t i8 = i8Const[index];
44 const uint8_t u8Const[] =
51 uint8_t u8 = u8Const[index];
69 u8v = i8v; // int8_t -> uint8_t
70 i16v = i8v; // int8_t -> int16_t
71 i16v = u8v; // uint8_t -> int16_t
72 i32v = i8v; // int8_t -> int32_t
73 i32v = u8v; // uint8_t -> int32_t
74 u32v = i8v; // int8_t -> uint32_t
75 i64v = i8v; // int8_t -> int64_t
76 u64v = i8v; // int8_t -> uint64_t
77 u32v = u8v; // uint8_t -> uint32_t
78 i64v = u8v; // uint8_t -> int64_t
79 u64v = u8v; // uint8_t -> uint64_t
80 f16v = i8v; // int8_t -> float16_t
81 f32v = i8v; // int8_t -> float32_t
82 f64v = i8v; // int8_t -> float64_t
83 f16v = u8v; // uint8_t -> float16_t
84 f32v = u8v; // uint8_t -> float32_t
85 f64v = u8v; // uint8_t -> float64_t
87 i8v = i8vec2(u8v); // uint8_t -> int8_t
88 i16v = i16vec2(i8v); // int8_t -> int16_t
89 i16v = i16vec2(u8v); // uint8_t -> int16_t
90 i32v = i32vec2(i8v); // int8_t -> int32_t
91 i32v = i32vec2(u8v); // uint8_t -> int32_t
92 i64v = i64vec2(i8v); // int8_t -> int64_t
93 u64v = i64vec2(i8v); // int8_t -> uint64_t
94 u16v = u16vec2(i8v); // int8_t -> uint16_t
95 u16v = u16vec2(u8v); // uint8_t -> uint16_t
96 u32v = u32vec2(u8v); // uint8_t -> uint32_t
97 i64v = i64vec2(u8v); // uint8_t -> int64_t
98 u64v = i64vec2(u8v); // uint8_t -> uint64_t
99 f16v = f16vec2(i8v); // int8_t -> float16_t
100 f32v = f32vec2(i8v); // int8_t -> float32_t
101 f64v = f64vec2(i8v); // int8_t -> float64_t
102 f16v = f16vec2(u8v); // uint8_t -> float16_t
103 f32v = f32vec2(u8v); // uint8_t -> float32_t
104 f64v = f64vec2(u8v); // uint8_t -> float64_t
106 i8v = i8vec2(bv); // bool -> int8
107 u8v = u8vec2(bv); // bool -> uint8
108 bv = bvec2(i8v); // int8 -> bool
109 bv = bvec2(u8v); // uint8 -> bool
120 float arr[4] = {1.0, 2.0, 3.0, 4.0};
198 i8v = min(i8v, i8vec2(-1));
200 u8v = min(u8v, u8vec3(0));
204 i8v = max(i8v, i8vec2(-1));
206 u8v = max(u8v, u8vec3(0));
209 i8v = clamp(i8v, -i8, i8);
210 i8v = clamp(i8v, -i8v, i8v);
211 u8v = clamp(u8v, -u8, u8);
212 u8v = clamp(u8v, -u8v, u8v);
215 i8 = mix(i8v.x, i8v.y, true);
216 i8v = mix(i8vec2(i8), i8vec2(-i8), bvec2(false));
217 u8 = mix(u8v.x, u8v.y, true);
218 u8v = mix(u8vec3(u8), u8vec3(-u8), bvec3(false));
232 bv = lessThan(u8v, u8vec3(u8));
233 bv.xy = lessThan(i8v, i8vec2(i8));
236 bv = lessThanEqual(u8v, u8vec3(u8));
237 bv.xy = lessThanEqual(i8v, i8vec2(i8));
240 bv = greaterThan(u8v, u8vec3(u8));
241 bv.xy = greaterThan(i8v, i8vec2(i8));
243 // greaterThanEqual()
244 bv = greaterThanEqual(u8v, u8vec3(u8));
245 bv.xy = greaterThanEqual(i8v, i8vec2(i8));
248 bv = equal(u8v, u8vec3(u8));
249 bv.xy = equal(i8v, i8vec2(i8));
252 bv = notEqual(u8v, u8vec3(u8));
253 bv.xy = notEqual(i8v, i8vec2(i8));
256 // Type conversion for specialization constant
257 layout(constant_id = 100) const int8_t si8 = int8_t(-10);
258 layout(constant_id = 101) const uint8_t su8 = uint8_t(20);