Skip to content

Instantly share code, notes, and snippets.

@Groovounet
Created January 27, 2018 02:25
Show Gist options
  • Save Groovounet/923371a78e4e28fcef7aca25be8e8901 to your computer and use it in GitHub Desktop.
Save Groovounet/923371a78e4e28fcef7aca25be8e8901 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
{
vec4 Color;
} Buffer;
layout(location = 0, index = 0) out vec4 Color;
void main()
{
Color = correctSrgbToRgb(Buffer.Color);
}
1 | 0 | | label_basic_block_1: s_mov_b32 s0, s1
2 | 0 | | s_movk_i32 s1, 0x0000
3 | 0 | | s_load_dwordx4 s[4:7], s[0:1], 0x140
4 | 0 | | s_waitcnt lgkmcnt(0)
5 | 0 | | s_andn2_b32 s5, s5, 0x3fff0000
6 | 0 | | s_buffer_load_dword s2, s[4:7], 0x00
7 | 0 | | s_waitcnt lgkmcnt(0)
8 | 0 | | s_lshl_b32 s2, s2, 4
9 | 0 | | s_load_dwordx4 s[0:3], s[0:1], s2
10 | 0 | | s_waitcnt lgkmcnt(0)
11 | 0 | | s_andn2_b32 s1, s1, 0x3fff0000
12 | 0 | | s_buffer_load_dwordx4 s[0:3], s[0:3], 0x00
13 | 1 | ^ | v_mov_b32 v0, 0x3d6147ae
14 | 1 | : | s_waitcnt lgkmcnt(0)
15 | 2 | v^ | v_add_f32 v1, s0, v0
16 | 3 | v:^ | v_add_f32 v2, s1, v0
17 | 3 | x:: | v_add_f32 v0, s2, v0
18 | 3 | :x: | v_mul_f32 v1, 0x3f72a76e, v1
19 | 3 | ::x | v_mul_f32 v2, 0x3f72a76e, v2
20 | 3 | x:: | v_mul_f32 v0, 0x3f72a76e, v0
21 | 3 | :x: | v_log_f32 v1, abs(v1)
22 | 3 | ::x | v_log_f32 v2, abs(v2)
23 | 3 | x:: | v_log_f32 v0, abs(v0)
24 | 3 | :x: | v_mul_legacy_f32 v1, 0x4019999a, v1
25 | 3 | ::x | v_mul_legacy_f32 v2, 0x4019999a, v2
26 | 3 | x:: | v_mul_legacy_f32 v0, 0x4019999a, v0
27 | 3 | :x: | v_exp_f32 v1, v1
28 | 3 | ::x | v_exp_f32 v2, v2
29 | 3 | x:: | v_exp_f32 v0, v0
30 | 4 | :::^ | v_mov_b32 v3, 0x3d9e8391
31 | 5 | ::::^ | v_mov_b32 v4, 0x3d25aee6
32 | 6 | :::v:^ | v_mul_f32 v5, s0, v3
33 | 7 | :::v::^ | v_mul_f32 v6, s1, v3
34 | 7 | :::x::: | v_mul_f32 v3, s2, v3
35 | 7 | ::::v:: | v_cmp_le_f32 s[4:5], s0, v4
36 | 7 | ::::v:: | v_cmp_le_f32 s[0:1], s1, v4
37 | 7 | ::::v:: | v_cmp_le_f32 vcc, s2, v4
38 | 6 | :x:: v: | v_cndmask_b32 v1, v1, v5, s[4:5]
39 | 5 | ::x: v | v_cndmask_b32 v2, v2, v6, s[0:1]
40 | 4 | x::v | v_cndmask_b32 v0, v0, v3, vcc
41 | 4 | :::^ | v_mov_b32 v3, s3
42 | 4 | :xv: | v_cvt_pkrtz_f16_f32 v1, v1, v2
43 | 3 | x: v | v_cvt_pkrtz_f16_f32 v0, v0, v3
44 | 2 | vv | exp mrt0, v1, v1, v0, v0
45 | 0 | | s_endpgm
Maximum # VGPR used 7, # VGPR allocated: 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment