Skip to content

Instantly share code, notes, and snippets.

@Groovounet
Groovounet / gist:01aa31a61ea81f9f3009a9e5ec7cddb1
Created February 14, 2018 17:04
Independent texture fetches with ASM
#version 430 core
#define FETCH_COUNT 16
#define FRAG_COLOR 0
#define NORMALIZE_COORD float(1.0 / 2048.0)
layout(binding = 0) uniform sampler2D Texture[FETCH_COUNT];
@Groovounet
Groovounet / gist:eee06640917a027cb7e8a041ce919cd2
Last active February 14, 2018 17:05
Dependent texture fetches with Polaris 10 ASM
#version 430 core
#define FETCH_COUNT 16
uniform sampler2D TextureDiffuse[FETCH_COUNT];
in vec4 gl_FragCoord;
layout(location = 0, index = 0) out vec4 Color;
#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)));
}
#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)));
}
#version 430 core
vec4 gammaSrgbToRgb(in vec4 ColorSRGB)
{
return vec4(pow(ColorSRGB.rgb, vec3(2.2)), ColorSRGB.a);
}
layout(binding = 0) uniform bufferFetch
{
vec4 Color;
#version 430 core
vec4 gammaSrgbToRgb(in vec4 ColorSRGB)
{
return vec4(pow(ColorSRGB.rgb, vec3(2.2)), ColorSRGB.a);
}
layout(binding = 0) uniform bufferFetch
{
uint Color;
#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)
#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)
#version 430 core
layout(binding = 0) uniform bufferFetch
{
uint Color;
} Buffer;
layout(location = 0, index = 0) out vec4 Color;
void main()
#version 430 core
layout(binding = 0) uniform bufferFetch
{
vec4 Color;
} Buffer;
layout(location = 0, index = 0) out vec4 Color;
void main()