<commit_before>#pragma parameter globalSupportsSRGB
#pragma require SphereMap
#pragma require Pack16

struct GBufferContents
{
	vec3 albedo;
	vec3 normal;
	vec2 velocity;
	float roughness;
	float metallic;
	float specular;

	vec3 preshaded;
	float aoRatio;
};

void decodeGBuffer(out GBufferContents g, vec4 g0, vec4 g1, vec4 g2, vec4 g3)
{
	g.albedo = g0.xyz;
#if !c_globalSupportsSRGB
	g.albedo *= g.albedo;
#endif

	g.normal = decodeSpheremap(vec2(unpack16(g2.xy), unpack16(g2.zw)));

	g.velocity = vec2(g0.w, g1.w);

	g.roughness = g1.x;
	g.metallic = g1.y;
	g.specular = g1.z;

	g.preshaded = g3.xyz;
	g.aoRatio = g3.w;
}

void encodeGBuffer(out vec4 g0, out vec4 g1, out vec4 g2, out vec4 g3, GBufferContents g)
{
	vec2 sphereMap = encodeSpheremap(g.normal);

	g0 = vec4(g.albedo, g.velocity.x);
	g1 = vec4(g.roughness, g.metallic, g.specular, g.velocity.y);
	g2 = vec4(pack16(sphereMap.x), pack16(sphereMap.y));
	g3 = vec4(g.preshaded, g.aoRatio);
}<commit_msg>Improved roughnes precision<commit_after>#pragma parameter globalSupportsSRGB
#pragma require SphereMap
#pragma require Pack16

struct GBufferContents
{
	vec3 albedo;
	vec3 normal;
	vec2 velocity;
	float roughness;
	float metallic;
	float specular;

	vec3 preshaded;
	float aoRatio;
};

void decodeGBuffer(out GBufferContents g, vec4 g0, vec4 g1, vec4 g2, vec4 g3)
{
	g.albedo = g0.xyz;
#if !c_globalSupportsSRGB
	g.albedo *= g.albedo;
#endif

	g.normal = decodeSpheremap(vec2(unpack16(g2.xy), unpack16(g2.zw)));

	g.velocity = vec2(g0.w, g1.w);

	g.roughness = g1.x * g1.x;
	g.metallic = g1.y;
	g.specular = g1.z;

	g.preshaded = g3.xyz;
	g.aoRatio = g3.w;
}

void encodeGBuffer(out vec4 g0, out vec4 g1, out vec4 g2, out vec4 g3, GBufferContents g)
{
	vec2 sphereMap = encodeSpheremap(g.normal);

	g0 = vec4(g.albedo, g.velocity.x);
	g1 = vec4(sqrt(g.roughness), g.metallic, g.specular, g.velocity.y);
	g2 = vec4(pack16(sphereMap.x), pack16(sphereMap.y));
	g3 = vec4(g.preshaded, g.aoRatio);
}
{'fraction_non_alphanumeric': 0.13448802852776362, 'fraction_numerical': 0.05247070809984717, 'mean_word_length': 4.455555555555556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2965889', 'n_tokens_mistral': 915, 'n_tokens_neox': 862, 'n_words': 191}