Browse Source

Move LumaAwareBlur to the new format

Panagiotis Christopoulos Charitos 5 years ago
parent
commit
4f098d7608
1 changed files with 5 additions and 5 deletions
  1. 5 5
      shaders/LumaAwareBlur.ankiprog

+ 5 - 5
shaders/LumaAwareBlur.glslp → shaders/LumaAwareBlur.ankiprog

@@ -7,7 +7,7 @@
 #pragma anki mutator KERNEL_SIZE 3 5 7 9 11 13 15
 #pragma anki mutator KERNEL_SIZE 3 5 7 9 11 13 15
 #pragma anki mutator COLOR_COMPONENTS 4 3 1
 #pragma anki mutator COLOR_COMPONENTS 4 3 1
 
 
-#pragma anki input const UVec2 TEXTURE_SIZE
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(TEXTURE_SIZE, 0, UVec2(1));
 
 
 #pragma anki start vert
 #pragma anki start vert
 #include <shaders/QuadVert.glsl>
 #include <shaders/QuadVert.glsl>
@@ -38,7 +38,7 @@ layout(location = 0) in Vec2 in_uv;
 
 
 F32 computeLumaWeight(F32 refLuma, COL_TYPE col)
 F32 computeLumaWeight(F32 refLuma, COL_TYPE col)
 {
 {
-	const F32 l = computeLuminance(col);
+	const F32 l = computeLuminance(Vec3(col));
 	const F32 diff = abs(refLuma - l);
 	const F32 diff = abs(refLuma - l);
 	const F32 weight = 1.0 / (EPSILON + diff);
 	const F32 weight = 1.0 / (EPSILON + diff);
 	return weight;
 	return weight;
@@ -55,13 +55,13 @@ void main()
 	const Vec2 TEXEL_SIZE = Vec2(0.0, 1.0 / F32(TEXTURE_SIZE.y));
 	const Vec2 TEXEL_SIZE = Vec2(0.0, 1.0 / F32(TEXTURE_SIZE.y));
 #endif
 #endif
 
 
-	COL_TYPE col = textureLod(u_tex, u_linearAnyClampSampler in_uv, 0.0).TEX_FETCH;
+	COL_TYPE col = textureLod(u_tex, u_linearAnyClampSampler, in_uv, 0.0).TEX_FETCH;
 	out_color = col;
 	out_color = col;
-	const F32 refLuma = computeLuminance(col);
+	const F32 refLuma = computeLuminance(Vec3(col));
 	F32 weight = 1.0;
 	F32 weight = 1.0;
 	Vec2 texCoordOffset = 1.5 * TEXEL_SIZE;
 	Vec2 texCoordOffset = 1.5 * TEXEL_SIZE;
 
 
-	for(U32 i = 0u; i < STEP_COUNT; ++i)
+	for(U32 i = 0u; i < KERNEL_SIZE; ++i)
 	{
 	{
 		COL_TYPE col = textureLod(u_tex, u_linearAnyClampSampler, in_uv + texCoordOffset, 0.0).TEX_FETCH;
 		COL_TYPE col = textureLod(u_tex, u_linearAnyClampSampler, in_uv + texCoordOffset, 0.0).TEX_FETCH;
 		F32 w = computeLumaWeight(refLuma, col);
 		F32 w = computeLumaWeight(refLuma, col);