Skip to content

Instantly share code, notes, and snippets.

@Groovounet
Last active January 27, 2018 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Groovounet/f1abd6bb631ee552e944e9159fef170d to your computer and use it in GitHub Desktop.
Save Groovounet/f1abd6bb631ee552e944e9159fef170d to your computer and use it in GitHub Desktop.
#version 430 core
vec3 correctSrgbToRgb(in vec3 ColorSRGB, in float Gamma)
{
return mix(
pow((ColorSRGB + 0.055) * 0.94786729857819905213270142180095, vec3(Gamma)),
ColorSRGB * 0.07739938080495356037151702786378,
lessThanEqual(ColorSRGB, vec3(0.04045)));
}
vec4 correctSrgbToRgb(in vec4 ColorSRGB)
{
return vec4(correctSrgbToRgb(ColorSRGB.rgb, 2.4), ColorSRGB.a);
}
layout(binding = 0) uniform bufferFetch
{
uint Color;
} Buffer;
layout(location = 0, index = 0) out vec4 Color;
void main()
{
Color = correctSrgbToRgb(unpackUnorm4x8(Buffer.Color));
}
1 | 0 | | label_basic_block_1: s_mov_b32 s0, s1
2 | 0 | | s_movk_i32 s1, 0x0000
3 | 1 | ^ | v_mov_b32 v0, 0x3b808081
4 | 1 | : | s_mov_b32 s2, 0x3d25aee6
5 | 1 | : | s_load_dwordx4 s[4:7], s[0:1], 0x140
6 | 1 | : | s_waitcnt lgkmcnt(0)
7 | 1 | : | s_andn2_b32 s5, s5, 0x3fff0000
8 | 1 | : | s_buffer_load_dword s3, s[4:7], 0x00
9 | 1 | : | s_waitcnt lgkmcnt(0)
10 | 1 | : | s_lshl_b32 s3, s3, 4
11 | 1 | : | s_load_dwordx4 s[4:7], s[0:1], s3
12 | 1 | : | s_waitcnt lgkmcnt(0)
13 | 1 | : | s_andn2_b32 s5, s5, 0x3fff0000
14 | 1 | : | s_buffer_load_dword s0, s[4:7], 0x00
15 | 1 | : | s_waitcnt lgkmcnt(0)
16 | 2 | :^ | v_cvt_f32_ubyte0 v1, s0
17 | 3 | ::^ | v_cvt_f32_ubyte1 v2, s0
18 | 4 | :::^ | v_cvt_f32_ubyte2 v3, s0
19 | 5 | ::::^ | v_cvt_f32_ubyte3 v4, s0
20 | 6 | vv:::^ | v_mul_f32 v5, v0, v1
21 | 7 | v:v:::^ | v_mul_f32 v6, v2, v0
22 | 8 | v::v:::^ | v_mul_f32 v7, v3, v0
23 | 8 | v:::x::: | v_mul_f32 v4, v4, v0
24 | 9 | vv::::::^ | v_madak_f32 v8, v1, v0, 0x3d6147ae
25 | 10 | v:v::::::^ | v_madak_f32 v9, v2, v0, 0x3d6147ae
26 | 10 | x::v:::::: | v_madak_f32 v0, v3, v0, 0x3d6147ae
27 | 10 | ::::::::x: | v_mul_f32 v8, 0x3f72a76e, v8
28 | 10 | :::::::::x | v_mul_f32 v9, 0x3f72a76e, v9
29 | 10 | x::::::::: | v_mul_f32 v0, 0x3f72a76e, v0
30 | 10 | ::::::::x: | v_log_f32 v8, abs(v8)
31 | 10 | ::::::::x: | v_mul_legacy_f32 v8, 0x4019999a, v8
32 | 10 | ::::::::x: | v_exp_f32 v8, v8
33 | 10 | :::::::::x | v_log_f32 v9, abs(v9)
34 | 10 | :::::::::x | v_mul_legacy_f32 v9, 0x4019999a, v9
35 | 10 | :::::::::x | v_exp_f32 v9, v9
36 | 10 | x::::::::: | v_log_f32 v0, abs(v0)
37 | 10 | x::::::::: | v_mul_legacy_f32 v0, 0x4019999a, v0
38 | 10 | x::::::::: | v_exp_f32 v0, v0
39 | 10 | :x:::::::: | v_mul_f32 v1, 0x399f22b4, v1
40 | 10 | ::x::::::: | v_mul_f32 v2, 0x399f22b4, v2
41 | 10 | :::x:::::: | v_mul_f32 v3, 0x399f22b4, v3
42 | 10 | :::::v:::: | v_cmp_le_f32 s[0:1], v5, s2
43 | 9 | ::::: v::: | v_cmp_le_f32 s[4:5], v6, s2
44 | 8 | ::::: v:: | v_cmp_ge_f32 vcc, s2, v7
45 | 7 | :x::: v: | v_cndmask_b32 v1, v8, v1, s[0:1]
46 | 6 | ::x:: v | v_cndmask_b32 v2, v9, v2, s[4:5]
47 | 5 | x::v: | v_cndmask_b32 v0, v0, v3, vcc
48 | 4 | :xv : | v_cvt_pkrtz_f16_f32 v1, v1, v2
49 | 3 | x: v | v_cvt_pkrtz_f16_f32 v0, v0, v4
50 | 2 | vv | exp mrt0, v1, v1, v0, v0
51 | 0 | | s_endpgm
Maximum # VGPR used 10, # VGPR allocated: 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment