Skip to content

Instantly share code, notes, and snippets.

@Groovounet
Last active January 27, 2018 02:14
Show Gist options
  • Save Groovounet/decb252eb694289bb8c7afc881b7e99b to your computer and use it in GitHub Desktop.
Save Groovounet/decb252eb694289bb8c7afc881b7e99b to your computer and use it in GitHub Desktop.
#version 430 core
vec3 taylorSrgbToRgb(in vec3 ColorSRGB)
{
vec3 A = (ColorSRGB * 0.305306011 + 0.682171111);
vec3 B = (ColorSRGB * A + 0.012522878);
return ColorSRGB * B;
}
vec4 taylorSrgbToRgb(in vec4 ColorSRGB)
{
return vec4(taylorSrgbToRgb(ColorSRGB.rgb), ColorSRGB.a);
}
layout(binding = 0) uniform bufferFetch
{
uint Color;
} Buffer;
layout(location = 0, index = 0) out vec4 Color;
void main()
{
Color = taylorSrgbToRgb(unpackUnorm4x8(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_dword s0, s[0:3], 0x00
13 | 0 | | s_waitcnt lgkmcnt(0)
14 | 1 | ^ | v_cvt_f32_ubyte0 v0, s0
15 | 2 | :^ | v_cvt_f32_ubyte1 v1, s0
16 | 3 | ::^ | v_cvt_f32_ubyte2 v2, s0
17 | 4 | :::^ | v_cvt_f32_ubyte3 v3, s0
18 | 5 | ::::^ | v_mov_b32 v4, 0x3b808081
19 | 6 | v:::v^ | v_mul_f32 v5, v4, v0
20 | 7 | :v::v:^ | v_mul_f32 v6, v1, v4
21 | 8 | ::v:v::^ | v_mul_f32 v7, v2, v4
22 | 8 | :::xv::: | v_mul_f32 v3, v3, v4
23 | 8 | ::::^::: | v_mov_b32 v4, 0x3f2ea2c4
24 | 8 | :::::::: | s_mov_b32 s0, 0x3a9cee01
25 | 8 | x:::v::: | v_mad_f32 v0, v0, s0, v4
26 | 8 | :x::v::: | v_mad_f32 v1, v1, s0, v4
27 | 8 | ::v:x::: | v_mac_f32 v4, s0, v2
28 | 7 | x: ::v:: | v_madak_f32 v0, v5, v0, 0x3c4d2cc2
29 | 7 | :x :::v: | v_madak_f32 v1, v6, v1, 0x3c4d2cc2
30 | 8 | ::^:v::v | v_madak_f32 v2, v7, v4, 0x3c4d2cc2
31 | 7 | x::: v:: | v_mul_f32 v0, v5, v0
32 | 6 | :x:: v: | v_mul_f32 v1, v6, v1
33 | 5 | ::x: v | v_mul_f32 v2, v7, v2
34 | 4 | xv:: | v_cvt_pkrtz_f16_f32 v0, v0, v1
35 | 4 | :^vv | v_cvt_pkrtz_f16_f32 v1, v2, v3
36 | 2 | vv | exp mrt0, v0, v0, v1, v1
37 | 0 | | s_endpgm
Maximum # VGPR used 8, # VGPR allocated: 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment