Welcome to mirror list, hosted at ThFree Co, Russian Federation.

implicit-integer-promotion.comp « comp « shaders-msl-no-opt - github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a0ee95b3a1aef3eeca3c94442a3bcc188cb7a46e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require

layout(set = 0, binding = 0) buffer BUF0
{
	f16vec2 f16s;
	u16vec2 u16;
	i16vec2 i16;
	u16vec4 u16s;
	i16vec4 i16s;
	float16_t f16;
};

void test_i16()
{
	f16 += int16BitsToFloat16(i16.x + i16.y);
	f16 += int16BitsToFloat16(i16.x - i16.y);
	f16 += int16BitsToFloat16(i16.x * i16.y);
	f16 += int16BitsToFloat16(i16.x / i16.y);
	f16 += int16BitsToFloat16(i16.x % i16.y);
	f16 += int16BitsToFloat16(i16.x << i16.y);
	f16 += int16BitsToFloat16(i16.x >> i16.y);
	f16 += int16BitsToFloat16(~i16.x);
	f16 += int16BitsToFloat16(-i16.x);
	f16 += int16BitsToFloat16(i16.x ^ i16.y);
	f16 += int16BitsToFloat16(i16.x & i16.y);
	f16 += int16BitsToFloat16(i16.x | i16.y);
}

void test_u16()
{
	f16 += uint16BitsToFloat16(u16.x + u16.y);
	f16 += uint16BitsToFloat16(u16.x - u16.y);
	f16 += uint16BitsToFloat16(u16.x * u16.y);
	f16 += uint16BitsToFloat16(u16.x / u16.y);
	f16 += uint16BitsToFloat16(u16.x % u16.y);
	f16 += uint16BitsToFloat16(u16.x << u16.y);
	f16 += uint16BitsToFloat16(u16.x >> u16.y);
	f16 += uint16BitsToFloat16(~u16.x);
	f16 += uint16BitsToFloat16(-u16.x);
	f16 += uint16BitsToFloat16(u16.x ^ u16.y);
	f16 += uint16BitsToFloat16(u16.x & u16.y);
	f16 += uint16BitsToFloat16(u16.x | u16.y);
}

void test_u16s()
{
	f16s += uint16BitsToFloat16(u16s.xy + u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy - u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy * u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy / u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy % u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy << u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy >> u16s.zw);
	f16s += uint16BitsToFloat16(~u16s.xy);
	f16s += uint16BitsToFloat16(-u16s.xy);
	f16s += uint16BitsToFloat16(u16s.xy ^ u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy & u16s.zw);
	f16s += uint16BitsToFloat16(u16s.xy | u16s.zw);
}

void test_i16s()
{
	f16s += int16BitsToFloat16(i16s.xy + i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy - i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy * i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy / i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy % i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy << i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy >> i16s.zw);
	f16s += int16BitsToFloat16(~i16s.xy);
	f16s += int16BitsToFloat16(-i16s.xy);
	f16s += int16BitsToFloat16(i16s.xy ^ i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy & i16s.zw);
	f16s += int16BitsToFloat16(i16s.xy | i16s.zw);
}

void main()
{
	test_u16();
	test_i16();
	test_u16s();
	test_i16s();
}