Last active
March 24, 2020 19:00
-
-
Save bjin/869d54b9745d872275632929b1cfc46c to your computer and use it in GitHub Desktop.
ravu-hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.spv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for gl in *.glsl; do | |
name="$(basename "$gl" .glsl)" | |
glslc -fshader-stage=fragment "$gl" -o "${name}.spv" | |
spirv-cross "${name}.spv" --output "${name}.hlsl" --hlsl | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
#define tex1D texture | |
#define tex3D texture | |
#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x)) | |
layout(location=0) out vec4 out_color; | |
layout(location=1) in vec2 texcoord0; | |
layout(std140, binding=2) uniform UBO { | |
layout(offset=0) mat2 texture_rot0; | |
}; | |
layout(std430, push_constant) uniform PushC { | |
/*offset=0*/ float random; | |
/*offset=4*/ int frame; | |
/*offset=8*/ vec2 input_size; | |
/*offset=16*/ vec2 target_size; | |
/*offset=24*/ vec2 tex_offset; | |
/*offset=32*/ vec2 texture_size0; | |
/*offset=40*/ vec2 texture_off0; | |
/*offset=48*/ vec2 pixel_size0; | |
}; | |
layout(binding=0) uniform sampler2D ravu_lite_lut3; | |
layout(binding=1) uniform sampler2D texture0; | |
#define HOOKED_raw texture0 | |
#define HOOKED_pos texcoord0 | |
#define HOOKED_size texture_size0 | |
#define HOOKED_rot texture_rot0 | |
#define HOOKED_pt pixel_size0 | |
#define HOOKED_map texmap0 | |
#define HOOKED_mul 1.000000 | |
#define HOOKED_tex(pos) (HOOKED_mul * vec4(texture(HOOKED_raw, pos)).rgba) | |
#define HOOKED_texOff(off) HOOKED_tex(HOOKED_pos + HOOKED_pt * vec2(off)) | |
#define LUMA_raw texture0 | |
#define LUMA_pos texcoord0 | |
#define LUMA_size texture_size0 | |
#define LUMA_rot texture_rot0 | |
#define LUMA_pt pixel_size0 | |
#define LUMA_map texmap0 | |
#define LUMA_mul 1.000000 | |
#define LUMA_tex(pos) (LUMA_mul * vec4(texture(LUMA_raw, pos)).rgba) | |
#define LUMA_texOff(off) LUMA_tex(LUMA_pos + LUMA_pt * vec2(off)) | |
vec4 hook() { | |
float luma0 = HOOKED_texOff(vec2(-2.0, -2.0)).x; | |
float luma1 = HOOKED_texOff(vec2(-2.0, -1.0)).x; | |
float luma2 = HOOKED_texOff(vec2(-2.0, 0.0)).x; | |
float luma3 = HOOKED_texOff(vec2(-2.0, 1.0)).x; | |
float luma4 = HOOKED_texOff(vec2(-2.0, 2.0)).x; | |
float luma5 = HOOKED_texOff(vec2(-1.0, -2.0)).x; | |
float luma6 = HOOKED_texOff(vec2(-1.0, -1.0)).x; | |
float luma7 = HOOKED_texOff(vec2(-1.0, 0.0)).x; | |
float luma8 = HOOKED_texOff(vec2(-1.0, 1.0)).x; | |
float luma9 = HOOKED_texOff(vec2(-1.0, 2.0)).x; | |
float luma10 = HOOKED_texOff(vec2(0.0, -2.0)).x; | |
float luma11 = HOOKED_texOff(vec2(0.0, -1.0)).x; | |
float luma12 = HOOKED_texOff(vec2(0.0, 0.0)).x; | |
float luma13 = HOOKED_texOff(vec2(0.0, 1.0)).x; | |
float luma14 = HOOKED_texOff(vec2(0.0, 2.0)).x; | |
float luma15 = HOOKED_texOff(vec2(1.0, -2.0)).x; | |
float luma16 = HOOKED_texOff(vec2(1.0, -1.0)).x; | |
float luma17 = HOOKED_texOff(vec2(1.0, 0.0)).x; | |
float luma18 = HOOKED_texOff(vec2(1.0, 1.0)).x; | |
float luma19 = HOOKED_texOff(vec2(1.0, 2.0)).x; | |
float luma20 = HOOKED_texOff(vec2(2.0, -2.0)).x; | |
float luma21 = HOOKED_texOff(vec2(2.0, -1.0)).x; | |
float luma22 = HOOKED_texOff(vec2(2.0, 0.0)).x; | |
float luma23 = HOOKED_texOff(vec2(2.0, 1.0)).x; | |
float luma24 = HOOKED_texOff(vec2(2.0, 2.0)).x; | |
vec3 abd = vec3(0.0); | |
float gx, gy; | |
gx = (luma11-luma1)/2.0; | |
gy = (luma7-luma5)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163; | |
gx = (luma12-luma2)/2.0; | |
gy = (luma8-luma6)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666; | |
gx = (luma13-luma3)/2.0; | |
gy = (luma9-luma7)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163; | |
gx = (luma16-luma6)/2.0; | |
gy = (luma12-luma10)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666; | |
gx = (luma17-luma7)/2.0; | |
gy = (luma13-luma11)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.13080118386382833; | |
gx = (luma18-luma8)/2.0; | |
gy = (luma14-luma12)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666; | |
gx = (luma21-luma11)/2.0; | |
gy = (luma17-luma15)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163; | |
gx = (luma22-luma12)/2.0; | |
gy = (luma18-luma16)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666; | |
gx = (luma23-luma13)/2.0; | |
gy = (luma19-luma17)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163; | |
float a = abd.x, b = abd.y, d = abd.z; | |
float T = a + d, D = a * d - b * b; | |
float delta = sqrt(max(T * T / 4.0 - D, 0.0)); | |
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta; | |
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2); | |
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7); | |
float lambda = sqrtL1; | |
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7); | |
float angle = floor(theta * 24.0 / 3.141592653589793); | |
float strength = mix(mix(0.0, 1.0, lambda >= 0.005), 2.0, lambda >= 0.02); | |
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5); | |
float coord_y = ((angle * 3.0 + strength) * 3.0 + coherence + 0.5) / 216.0; | |
vec4 res = vec4(0.0), w; | |
w = texture(ravu_lite_lut3, vec2(0.038461538461538464, coord_y)); | |
res += luma0 * w + luma24 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.11538461538461539, coord_y)); | |
res += luma1 * w + luma23 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.19230769230769232, coord_y)); | |
res += luma2 * w + luma22 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.2692307692307692, coord_y)); | |
res += luma3 * w + luma21 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.34615384615384615, coord_y)); | |
res += luma4 * w + luma20 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.4230769230769231, coord_y)); | |
res += luma5 * w + luma19 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.5, coord_y)); | |
res += luma6 * w + luma18 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.5769230769230769, coord_y)); | |
res += luma7 * w + luma17 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.6538461538461539, coord_y)); | |
res += luma8 * w + luma16 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.7307692307692307, coord_y)); | |
res += luma9 * w + luma15 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.8076923076923077, coord_y)); | |
res += luma10 * w + luma14 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.8846153846153846, coord_y)); | |
res += luma11 * w + luma13 * w.wzyx; | |
w = texture(ravu_lite_lut3, vec2(0.9615384615384616, coord_y)); | |
res += luma12 * w; | |
res = clamp(res, 0.0, 1.0); | |
return res; | |
} | |
void main() { | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
color = hook(); | |
out_color = color; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct _UBO | |
{ | |
float2x2 texture_rot0; | |
}; | |
cbuffer UBO : register(c2) | |
{ | |
_UBO _955; | |
}; | |
struct _PushC | |
{ | |
float random; | |
int frame; | |
float2 input_size; | |
float2 target_size; | |
float2 tex_offset; | |
float2 texture_size0; | |
float2 texture_off0; | |
float2 pixel_size0; | |
}; | |
cbuffer PushC | |
{ | |
_PushC _26; | |
}; | |
uniform sampler2D texture0; | |
uniform sampler2D ravu_lite_lut3; | |
static float2 texcoord0; | |
static float4 out_color; | |
struct SPIRV_Cross_Input | |
{ | |
float2 texcoord0 : TEXCOORD1; | |
}; | |
struct SPIRV_Cross_Output | |
{ | |
float4 out_color : COLOR0; | |
}; | |
float mod(float x, float y) | |
{ | |
return x - y * floor(x / y); | |
} | |
float4 hook() | |
{ | |
float luma0 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, -2.0f)))) * 1.0f).x; | |
float luma1 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, -1.0f)))) * 1.0f).x; | |
float luma2 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 0.0f)))) * 1.0f).x; | |
float luma3 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 1.0f)))) * 1.0f).x; | |
float luma4 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 2.0f)))) * 1.0f).x; | |
float luma5 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, -2.0f)))) * 1.0f).x; | |
float luma6 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, -1.0f)))) * 1.0f).x; | |
float luma7 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 0.0f)))) * 1.0f).x; | |
float luma8 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 1.0f)))) * 1.0f).x; | |
float luma9 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 2.0f)))) * 1.0f).x; | |
float luma10 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -2.0f)))) * 1.0f).x; | |
float luma11 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -1.0f)))) * 1.0f).x; | |
float luma12 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 0.0f)))) * 1.0f).x; | |
float luma13 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 1.0f)))) * 1.0f).x; | |
float luma14 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 2.0f)))) * 1.0f).x; | |
float luma15 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, -2.0f)))) * 1.0f).x; | |
float luma16 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, -1.0f)))) * 1.0f).x; | |
float luma17 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 0.0f)))) * 1.0f).x; | |
float luma18 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 1.0f)))) * 1.0f).x; | |
float luma19 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 2.0f)))) * 1.0f).x; | |
float luma20 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, -2.0f)))) * 1.0f).x; | |
float luma21 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, -1.0f)))) * 1.0f).x; | |
float luma22 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 0.0f)))) * 1.0f).x; | |
float luma23 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 1.0f)))) * 1.0f).x; | |
float luma24 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 2.0f)))) * 1.0f).x; | |
float3 abd = float3(0.0f, 0.0f, 0.0f); | |
float gx = (luma11 - luma1) / 2.0f; | |
float gy = (luma7 - luma5) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1018680632114410400390625f); | |
gx = (luma12 - luma2) / 2.0f; | |
gy = (luma8 - luma6) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1154316365718841552734375f); | |
gx = (luma13 - luma3) / 2.0f; | |
gy = (luma9 - luma7) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1018680632114410400390625f); | |
gx = (luma16 - luma6) / 2.0f; | |
gy = (luma12 - luma10) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1154316365718841552734375f); | |
gx = (luma17 - luma7) / 2.0f; | |
gy = (luma13 - luma11) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.13080118596553802490234375f); | |
gx = (luma18 - luma8) / 2.0f; | |
gy = (luma14 - luma12) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1154316365718841552734375f); | |
gx = (luma21 - luma11) / 2.0f; | |
gy = (luma17 - luma15) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1018680632114410400390625f); | |
gx = (luma22 - luma12) / 2.0f; | |
gy = (luma18 - luma16) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1154316365718841552734375f); | |
gx = (luma23 - luma13) / 2.0f; | |
gy = (luma19 - luma17) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.1018680632114410400390625f); | |
float a = abd.x; | |
float b = abd.y; | |
float d = abd.z; | |
float T = a + d; | |
float D = (a * d) - (b * b); | |
float delta = sqrt(max(((T * T) / 4.0f) - D, 0.0f)); | |
float L1 = (T / 2.0f) + delta; | |
float L2 = (T / 2.0f) - delta; | |
float sqrtL1 = sqrt(L1); | |
float sqrtL2 = sqrt(L2); | |
float theta = (abs(b) < 1.1920928955078125e-07f) ? 0.0f : mod(atan2(L1 - a, b) + 3.1415927410125732421875f, 3.1415927410125732421875f); | |
float lambda = sqrtL1; | |
float mu = ((sqrtL1 + sqrtL2) < 1.1920928955078125e-07f) ? 0.0f : ((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2)); | |
float angle = floor((theta * 24.0f) / 3.1415927410125732421875f); | |
float strength = (lambda >= 0.0199999995529651641845703125f) ? 2.0f : float(lambda >= 0.004999999888241291046142578125f); | |
float coherence = (mu >= 0.5f) ? 2.0f : float(mu >= 0.25f); | |
float coord_y = (((((angle * 3.0f) + strength) * 3.0f) + coherence) + 0.5f) / 216.0f; | |
float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); | |
float4 w = tex2D(ravu_lite_lut3, float2(0.0384615398943424224853515625f, coord_y)); | |
res += ((w * luma0) + (w.wzyx * luma24)); | |
w = tex2D(ravu_lite_lut3, float2(0.115384615957736968994140625f, coord_y)); | |
res += ((w * luma1) + (w.wzyx * luma23)); | |
w = tex2D(ravu_lite_lut3, float2(0.19230769574642181396484375f, coord_y)); | |
res += ((w * luma2) + (w.wzyx * luma22)); | |
w = tex2D(ravu_lite_lut3, float2(0.269230782985687255859375f, coord_y)); | |
res += ((w * luma3) + (w.wzyx * luma21)); | |
w = tex2D(ravu_lite_lut3, float2(0.34615385532379150390625f, coord_y)); | |
res += ((w * luma4) + (w.wzyx * luma20)); | |
w = tex2D(ravu_lite_lut3, float2(0.423076927661895751953125f, coord_y)); | |
res += ((w * luma5) + (w.wzyx * luma19)); | |
w = tex2D(ravu_lite_lut3, float2(0.5f, coord_y)); | |
res += ((w * luma6) + (w.wzyx * luma18)); | |
w = tex2D(ravu_lite_lut3, float2(0.576923072338104248046875f, coord_y)); | |
res += ((w * luma7) + (w.wzyx * luma17)); | |
w = tex2D(ravu_lite_lut3, float2(0.65384614467620849609375f, coord_y)); | |
res += ((w * luma8) + (w.wzyx * luma16)); | |
w = tex2D(ravu_lite_lut3, float2(0.730769217014312744140625f, coord_y)); | |
res += ((w * luma9) + (w.wzyx * luma15)); | |
w = tex2D(ravu_lite_lut3, float2(0.8076922893524169921875f, coord_y)); | |
res += ((w * luma10) + (w.wzyx * luma14)); | |
w = tex2D(ravu_lite_lut3, float2(0.884615361690521240234375f, coord_y)); | |
res += ((w * luma11) + (w.wzyx * luma13)); | |
w = tex2D(ravu_lite_lut3, float2(0.96153843402862548828125f, coord_y)); | |
res += (w * luma12); | |
res = clamp(res, float4(0.0f, 0.0f, 0.0f, 0.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)); | |
return res; | |
} | |
void frag_main() | |
{ | |
float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f); | |
color = hook(); | |
out_color = color; | |
} | |
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | |
{ | |
texcoord0 = stage_input.texcoord0; | |
frag_main(); | |
SPIRV_Cross_Output stage_output; | |
stage_output.out_color = out_color; | |
return stage_output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
#define tex1D texture | |
#define tex3D texture | |
#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x)) | |
layout(location=0) out vec4 out_color; | |
layout(location=1) in vec2 texcoord0; | |
layout(location=2) in vec2 texcoord1; | |
layout(std140, binding=2) uniform UBO { | |
layout(offset=0) mat2 texture_rot0; | |
layout(offset=32) mat2 texture_rot1; | |
}; | |
layout(std430, push_constant) uniform PushC { | |
/*offset=0*/ float random; | |
/*offset=4*/ int frame; | |
/*offset=8*/ vec2 input_size; | |
/*offset=16*/ vec2 target_size; | |
/*offset=24*/ vec2 tex_offset; | |
/*offset=32*/ vec2 texture_size0; | |
/*offset=40*/ vec2 texture_off0; | |
/*offset=48*/ vec2 pixel_size0; | |
/*offset=56*/ vec2 texture_size1; | |
/*offset=64*/ vec2 texture_off1; | |
/*offset=72*/ vec2 pixel_size1; | |
}; | |
layout(binding=0) uniform sampler2D texture0; | |
layout(binding=1) uniform sampler2D texture1; | |
#define HOOKED_raw texture0 | |
#define HOOKED_pos texcoord0 | |
#define HOOKED_size texture_size0 | |
#define HOOKED_rot texture_rot0 | |
#define HOOKED_pt pixel_size0 | |
#define HOOKED_map texmap0 | |
#define HOOKED_mul 1.000000 | |
#define HOOKED_tex(pos) (HOOKED_mul * vec4(texture(HOOKED_raw, pos)).rgba) | |
#define HOOKED_texOff(off) HOOKED_tex(HOOKED_pos + HOOKED_pt * vec2(off)) | |
#define LUMA_raw texture0 | |
#define LUMA_pos texcoord0 | |
#define LUMA_size texture_size0 | |
#define LUMA_rot texture_rot0 | |
#define LUMA_pt pixel_size0 | |
#define LUMA_map texmap0 | |
#define LUMA_mul 1.000000 | |
#define LUMA_tex(pos) (LUMA_mul * vec4(texture(LUMA_raw, pos)).rgba) | |
#define LUMA_texOff(off) LUMA_tex(LUMA_pos + LUMA_pt * vec2(off)) | |
#define ravu_lite_int_raw texture1 | |
#define ravu_lite_int_pos texcoord1 | |
#define ravu_lite_int_size texture_size1 | |
#define ravu_lite_int_rot texture_rot1 | |
#define ravu_lite_int_pt pixel_size1 | |
#define ravu_lite_int_map texmap1 | |
#define ravu_lite_int_mul 1.000000 | |
#define ravu_lite_int_tex(pos) (ravu_lite_int_mul * vec4(texture(ravu_lite_int_raw, pos)).rgba) | |
#define ravu_lite_int_texOff(off) ravu_lite_int_tex(ravu_lite_int_pos + ravu_lite_int_pt * vec2(off)) | |
vec4 hook() { | |
vec2 dir = fract(HOOKED_pos * HOOKED_size) - 0.5; | |
int idx = int(dir.x > 0.0) * 2 + int(dir.y > 0.0); | |
return vec4(ravu_lite_int_texOff(-dir)[idx], 0.0, 0.0, 0.0); | |
} | |
void main() { | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
color = hook(); | |
color.g = 0.000000; | |
color.b = 0.000000; | |
color.a = 1.000000; | |
out_color = color; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct _UBO | |
{ | |
float2x2 texture_rot0; | |
float2x2 texture_rot1; | |
}; | |
cbuffer UBO : register(c2) | |
{ | |
_UBO _96; | |
}; | |
struct _PushC | |
{ | |
float random; | |
int frame; | |
float2 input_size; | |
float2 target_size; | |
float2 tex_offset; | |
float2 texture_size0; | |
float2 texture_off0; | |
float2 pixel_size0; | |
float2 texture_size1; | |
float2 texture_off1; | |
float2 pixel_size1; | |
}; | |
cbuffer PushC | |
{ | |
_PushC _20; | |
}; | |
uniform sampler2D texture1; | |
uniform sampler2D texture0; | |
static float2 texcoord0; | |
static float2 texcoord1; | |
static float4 out_color; | |
struct SPIRV_Cross_Input | |
{ | |
float2 texcoord0 : TEXCOORD1; | |
float2 texcoord1 : TEXCOORD2; | |
}; | |
struct SPIRV_Cross_Output | |
{ | |
float4 out_color : COLOR0; | |
}; | |
float4 hook() | |
{ | |
float2 dir = frac(texcoord0 * _20.texture_size0) - float2(0.5f, 0.5f); | |
int idx = (int(dir.x > 0.0f) * 2) + int(dir.y > 0.0f); | |
return float4((float4(tex2D(texture1, texcoord1 + (_20.pixel_size1 * float2(-dir)))) * 1.0f)[idx], 0.0f, 0.0f, 0.0f); | |
} | |
void frag_main() | |
{ | |
float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f); | |
color = hook(); | |
color.y = 0.0f; | |
color.z = 0.0f; | |
color.w = 1.0f; | |
out_color = color; | |
} | |
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | |
{ | |
texcoord0 = stage_input.texcoord0; | |
texcoord1 = stage_input.texcoord1; | |
frag_main(); | |
SPIRV_Cross_Output stage_output; | |
stage_output.out_color = out_color; | |
return stage_output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
#define tex1D texture | |
#define tex3D texture | |
#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x)) | |
layout(location=0) out vec4 out_color; | |
layout(location=1) in vec2 texcoord0; | |
layout(std140, binding=2) uniform UBO { | |
layout(offset=0) mat2 texture_rot0; | |
}; | |
layout(std430, push_constant) uniform PushC { | |
/*offset=0*/ float random; | |
/*offset=4*/ int frame; | |
/*offset=8*/ vec2 input_size; | |
/*offset=16*/ vec2 target_size; | |
/*offset=24*/ vec2 tex_offset; | |
/*offset=32*/ vec2 texture_size0; | |
/*offset=40*/ vec2 texture_off0; | |
/*offset=48*/ vec2 pixel_size0; | |
}; | |
layout(binding=0) uniform sampler2D ravu_lut3; | |
layout(binding=1) uniform sampler2D texture0; | |
#define HOOKED_raw texture0 | |
#define HOOKED_pos texcoord0 | |
#define HOOKED_size texture_size0 | |
#define HOOKED_rot texture_rot0 | |
#define HOOKED_pt pixel_size0 | |
#define HOOKED_map texmap0 | |
#define HOOKED_mul 1.000000 | |
#define HOOKED_tex(pos) (HOOKED_mul * vec4(texture(HOOKED_raw, pos)).rgba) | |
#define HOOKED_texOff(off) HOOKED_tex(HOOKED_pos + HOOKED_pt * vec2(off)) | |
#define LUMA_raw texture0 | |
#define LUMA_pos texcoord0 | |
#define LUMA_size texture_size0 | |
#define LUMA_rot texture_rot0 | |
#define LUMA_pt pixel_size0 | |
#define LUMA_map texmap0 | |
#define LUMA_mul 1.000000 | |
#define LUMA_tex(pos) (LUMA_mul * vec4(texture(LUMA_raw, pos)).rgba) | |
#define LUMA_texOff(off) LUMA_tex(LUMA_pos + LUMA_pt * vec2(off)) | |
vec4 hook() { | |
float sample0 = HOOKED_texOff(vec2(-2.0, -2.0)).x; | |
float sample1 = HOOKED_texOff(vec2(-2.0, -1.0)).x; | |
float sample2 = HOOKED_texOff(vec2(-2.0, 0.0)).x; | |
float sample3 = HOOKED_texOff(vec2(-2.0, 1.0)).x; | |
float sample4 = HOOKED_texOff(vec2(-2.0, 2.0)).x; | |
float sample5 = HOOKED_texOff(vec2(-2.0, 3.0)).x; | |
float sample6 = HOOKED_texOff(vec2(-1.0, -2.0)).x; | |
float sample7 = HOOKED_texOff(vec2(-1.0, -1.0)).x; | |
float sample8 = HOOKED_texOff(vec2(-1.0, 0.0)).x; | |
float sample9 = HOOKED_texOff(vec2(-1.0, 1.0)).x; | |
float sample10 = HOOKED_texOff(vec2(-1.0, 2.0)).x; | |
float sample11 = HOOKED_texOff(vec2(-1.0, 3.0)).x; | |
float sample12 = HOOKED_texOff(vec2(0.0, -2.0)).x; | |
float sample13 = HOOKED_texOff(vec2(0.0, -1.0)).x; | |
float sample14 = HOOKED_texOff(vec2(0.0, 0.0)).x; | |
float sample15 = HOOKED_texOff(vec2(0.0, 1.0)).x; | |
float sample16 = HOOKED_texOff(vec2(0.0, 2.0)).x; | |
float sample17 = HOOKED_texOff(vec2(0.0, 3.0)).x; | |
float sample18 = HOOKED_texOff(vec2(1.0, -2.0)).x; | |
float sample19 = HOOKED_texOff(vec2(1.0, -1.0)).x; | |
float sample20 = HOOKED_texOff(vec2(1.0, 0.0)).x; | |
float sample21 = HOOKED_texOff(vec2(1.0, 1.0)).x; | |
float sample22 = HOOKED_texOff(vec2(1.0, 2.0)).x; | |
float sample23 = HOOKED_texOff(vec2(1.0, 3.0)).x; | |
float sample24 = HOOKED_texOff(vec2(2.0, -2.0)).x; | |
float sample25 = HOOKED_texOff(vec2(2.0, -1.0)).x; | |
float sample26 = HOOKED_texOff(vec2(2.0, 0.0)).x; | |
float sample27 = HOOKED_texOff(vec2(2.0, 1.0)).x; | |
float sample28 = HOOKED_texOff(vec2(2.0, 2.0)).x; | |
float sample29 = HOOKED_texOff(vec2(2.0, 3.0)).x; | |
float sample30 = HOOKED_texOff(vec2(3.0, -2.0)).x; | |
float sample31 = HOOKED_texOff(vec2(3.0, -1.0)).x; | |
float sample32 = HOOKED_texOff(vec2(3.0, 0.0)).x; | |
float sample33 = HOOKED_texOff(vec2(3.0, 1.0)).x; | |
float sample34 = HOOKED_texOff(vec2(3.0, 2.0)).x; | |
float sample35 = HOOKED_texOff(vec2(3.0, 3.0)).x; | |
vec3 abd = vec3(0.0); | |
float gx, gy; | |
gx = (sample13-sample1)/2.0; | |
gy = (sample8-sample6)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (sample14-sample2)/2.0; | |
gy = (-sample10+8.0*sample9-8.0*sample7+sample6)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample15-sample3)/2.0; | |
gy = (-sample11+8.0*sample10-8.0*sample8+sample7)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample16-sample4)/2.0; | |
gy = (sample11-sample9)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (-sample25+8.0*sample19-8.0*sample7+sample1)/12.0; | |
gy = (sample14-sample12)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample26+8.0*sample20-8.0*sample8+sample2)/12.0; | |
gy = (-sample16+8.0*sample15-8.0*sample13+sample12)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample27+8.0*sample21-8.0*sample9+sample3)/12.0; | |
gy = (-sample17+8.0*sample16-8.0*sample14+sample13)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample28+8.0*sample22-8.0*sample10+sample4)/12.0; | |
gy = (sample17-sample15)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample31+8.0*sample25-8.0*sample13+sample7)/12.0; | |
gy = (sample20-sample18)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample32+8.0*sample26-8.0*sample14+sample8)/12.0; | |
gy = (-sample22+8.0*sample21-8.0*sample19+sample18)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample33+8.0*sample27-8.0*sample15+sample9)/12.0; | |
gy = (-sample23+8.0*sample22-8.0*sample20+sample19)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample34+8.0*sample28-8.0*sample16+sample10)/12.0; | |
gy = (sample23-sample21)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample31-sample19)/2.0; | |
gy = (sample26-sample24)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (sample32-sample20)/2.0; | |
gy = (-sample28+8.0*sample27-8.0*sample25+sample24)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample33-sample21)/2.0; | |
gy = (-sample29+8.0*sample28-8.0*sample26+sample25)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample34-sample22)/2.0; | |
gy = (sample29-sample27)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
float a = abd.x, b = abd.y, d = abd.z; | |
float T = a + d, D = a * d - b * b; | |
float delta = sqrt(max(T * T / 4.0 - D, 0.0)); | |
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta; | |
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2); | |
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7); | |
float lambda = sqrtL1; | |
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7); | |
float angle = floor(theta * 24.0 / 3.141592653589793); | |
float strength = clamp(floor(log2(lambda * 2000.0 + 1.192092896e-7)), 0.0, 8.0); | |
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5); | |
float coord_y = ((angle * 9.0 + strength) * 3.0 + coherence + 0.5) / 648.0; | |
float res = 0.0; | |
vec4 w; | |
w = texture(ravu_lut3, vec2(0.1, coord_y)); | |
res += (sample0 + sample35) * w[0]; | |
res += (sample1 + sample34) * w[1]; | |
res += (sample2 + sample33) * w[2]; | |
res += (sample3 + sample32) * w[3]; | |
w = texture(ravu_lut3, vec2(0.3, coord_y)); | |
res += (sample4 + sample31) * w[0]; | |
res += (sample5 + sample30) * w[1]; | |
res += (sample6 + sample29) * w[2]; | |
res += (sample7 + sample28) * w[3]; | |
w = texture(ravu_lut3, vec2(0.5, coord_y)); | |
res += (sample8 + sample27) * w[0]; | |
res += (sample9 + sample26) * w[1]; | |
res += (sample10 + sample25) * w[2]; | |
res += (sample11 + sample24) * w[3]; | |
w = texture(ravu_lut3, vec2(0.7, coord_y)); | |
res += (sample12 + sample23) * w[0]; | |
res += (sample13 + sample22) * w[1]; | |
res += (sample14 + sample21) * w[2]; | |
res += (sample15 + sample20) * w[3]; | |
w = texture(ravu_lut3, vec2(0.9, coord_y)); | |
res += (sample16 + sample19) * w[0]; | |
res += (sample17 + sample18) * w[1]; | |
res = clamp(res, 0.0, 1.0); | |
return vec4(res, 0.0, 0.0, 0.0); | |
} | |
void main() { | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
color = hook(); | |
color.g = 0.000000; | |
color.b = 0.000000; | |
color.a = 1.000000; | |
out_color = color; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct _UBO | |
{ | |
float2x2 texture_rot0; | |
}; | |
cbuffer UBO : register(c2) | |
{ | |
_UBO _1373; | |
}; | |
struct _PushC | |
{ | |
float random; | |
int frame; | |
float2 input_size; | |
float2 target_size; | |
float2 tex_offset; | |
float2 texture_size0; | |
float2 texture_off0; | |
float2 pixel_size0; | |
}; | |
cbuffer PushC | |
{ | |
_PushC _26; | |
}; | |
uniform sampler2D texture0; | |
uniform sampler2D ravu_lut3; | |
static float2 texcoord0; | |
static float4 out_color; | |
struct SPIRV_Cross_Input | |
{ | |
float2 texcoord0 : TEXCOORD1; | |
}; | |
struct SPIRV_Cross_Output | |
{ | |
float4 out_color : COLOR0; | |
}; | |
float mod(float x, float y) | |
{ | |
return x - y * floor(x / y); | |
} | |
float4 hook() | |
{ | |
float sample0 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, -2.0f)))) * 1.0f).x; | |
float sample1 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, -1.0f)))) * 1.0f).x; | |
float sample2 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 0.0f)))) * 1.0f).x; | |
float sample3 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 1.0f)))) * 1.0f).x; | |
float sample4 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 2.0f)))) * 1.0f).x; | |
float sample5 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 3.0f)))) * 1.0f).x; | |
float sample6 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, -2.0f)))) * 1.0f).x; | |
float sample7 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, -1.0f)))) * 1.0f).x; | |
float sample8 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 0.0f)))) * 1.0f).x; | |
float sample9 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 1.0f)))) * 1.0f).x; | |
float sample10 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 2.0f)))) * 1.0f).x; | |
float sample11 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 3.0f)))) * 1.0f).x; | |
float sample12 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -2.0f)))) * 1.0f).x; | |
float sample13 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -1.0f)))) * 1.0f).x; | |
float sample14 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 0.0f)))) * 1.0f).x; | |
float sample15 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 1.0f)))) * 1.0f).x; | |
float sample16 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 2.0f)))) * 1.0f).x; | |
float sample17 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 3.0f)))) * 1.0f).x; | |
float sample18 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, -2.0f)))) * 1.0f).x; | |
float sample19 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, -1.0f)))) * 1.0f).x; | |
float sample20 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 0.0f)))) * 1.0f).x; | |
float sample21 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 1.0f)))) * 1.0f).x; | |
float sample22 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 2.0f)))) * 1.0f).x; | |
float sample23 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 3.0f)))) * 1.0f).x; | |
float sample24 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, -2.0f)))) * 1.0f).x; | |
float sample25 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, -1.0f)))) * 1.0f).x; | |
float sample26 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 0.0f)))) * 1.0f).x; | |
float sample27 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 1.0f)))) * 1.0f).x; | |
float sample28 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 2.0f)))) * 1.0f).x; | |
float sample29 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 3.0f)))) * 1.0f).x; | |
float sample30 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(3.0f, -2.0f)))) * 1.0f).x; | |
float sample31 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(3.0f, -1.0f)))) * 1.0f).x; | |
float sample32 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(3.0f, 0.0f)))) * 1.0f).x; | |
float sample33 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(3.0f, 1.0f)))) * 1.0f).x; | |
float sample34 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(3.0f, 2.0f)))) * 1.0f).x; | |
float sample35 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(3.0f, 3.0f)))) * 1.0f).x; | |
float3 abd = float3(0.0f, 0.0f, 0.0f); | |
float gx = (sample13 - sample1) / 2.0f; | |
float gy = (sample8 - sample6) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = (sample14 - sample2) / 2.0f; | |
gy = ((((-sample10) + (8.0f * sample9)) - (8.0f * sample7)) + sample6) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample15 - sample3) / 2.0f; | |
gy = ((((-sample11) + (8.0f * sample10)) - (8.0f * sample8)) + sample7) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample16 - sample4) / 2.0f; | |
gy = (sample11 - sample9) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = ((((-sample25) + (8.0f * sample19)) - (8.0f * sample7)) + sample1) / 12.0f; | |
gy = (sample14 - sample12) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample26) + (8.0f * sample20)) - (8.0f * sample8)) + sample2) / 12.0f; | |
gy = ((((-sample16) + (8.0f * sample15)) - (8.0f * sample13)) + sample12) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample27) + (8.0f * sample21)) - (8.0f * sample9)) + sample3) / 12.0f; | |
gy = ((((-sample17) + (8.0f * sample16)) - (8.0f * sample14)) + sample13) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample28) + (8.0f * sample22)) - (8.0f * sample10)) + sample4) / 12.0f; | |
gy = (sample17 - sample15) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample31) + (8.0f * sample25)) - (8.0f * sample13)) + sample7) / 12.0f; | |
gy = (sample20 - sample18) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample32) + (8.0f * sample26)) - (8.0f * sample14)) + sample8) / 12.0f; | |
gy = ((((-sample22) + (8.0f * sample21)) - (8.0f * sample19)) + sample18) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample33) + (8.0f * sample27)) - (8.0f * sample15)) + sample9) / 12.0f; | |
gy = ((((-sample23) + (8.0f * sample22)) - (8.0f * sample20)) + sample19) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample34) + (8.0f * sample28)) - (8.0f * sample16)) + sample10) / 12.0f; | |
gy = (sample23 - sample21) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample31 - sample19) / 2.0f; | |
gy = (sample26 - sample24) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = (sample32 - sample20) / 2.0f; | |
gy = ((((-sample28) + (8.0f * sample27)) - (8.0f * sample25)) + sample24) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample33 - sample21) / 2.0f; | |
gy = ((((-sample29) + (8.0f * sample28)) - (8.0f * sample26)) + sample25) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample34 - sample22) / 2.0f; | |
gy = (sample29 - sample27) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
float a = abd.x; | |
float b = abd.y; | |
float d = abd.z; | |
float T = a + d; | |
float D = (a * d) - (b * b); | |
float delta = sqrt(max(((T * T) / 4.0f) - D, 0.0f)); | |
float L1 = (T / 2.0f) + delta; | |
float L2 = (T / 2.0f) - delta; | |
float sqrtL1 = sqrt(L1); | |
float sqrtL2 = sqrt(L2); | |
float theta = (abs(b) < 1.1920928955078125e-07f) ? 0.0f : mod(atan2(L1 - a, b) + 3.1415927410125732421875f, 3.1415927410125732421875f); | |
float lambda = sqrtL1; | |
float mu = ((sqrtL1 + sqrtL2) < 1.1920928955078125e-07f) ? 0.0f : ((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2)); | |
float angle = floor((theta * 24.0f) / 3.1415927410125732421875f); | |
float strength = clamp(floor(log2((lambda * 2000.0f) + 1.1920928955078125e-07f)), 0.0f, 8.0f); | |
float coherence = (mu >= 0.5f) ? 2.0f : float(mu >= 0.25f); | |
float coord_y = (((((angle * 9.0f) + strength) * 3.0f) + coherence) + 0.5f) / 648.0f; | |
float res = 0.0f; | |
float4 w = tex2D(ravu_lut3, float2(0.100000001490116119384765625f, coord_y)); | |
res += ((sample0 + sample35) * w.x); | |
res += ((sample1 + sample34) * w.y); | |
res += ((sample2 + sample33) * w.z); | |
res += ((sample3 + sample32) * w.w); | |
w = tex2D(ravu_lut3, float2(0.300000011920928955078125f, coord_y)); | |
res += ((sample4 + sample31) * w.x); | |
res += ((sample5 + sample30) * w.y); | |
res += ((sample6 + sample29) * w.z); | |
res += ((sample7 + sample28) * w.w); | |
w = tex2D(ravu_lut3, float2(0.5f, coord_y)); | |
res += ((sample8 + sample27) * w.x); | |
res += ((sample9 + sample26) * w.y); | |
res += ((sample10 + sample25) * w.z); | |
res += ((sample11 + sample24) * w.w); | |
w = tex2D(ravu_lut3, float2(0.699999988079071044921875f, coord_y)); | |
res += ((sample12 + sample23) * w.x); | |
res += ((sample13 + sample22) * w.y); | |
res += ((sample14 + sample21) * w.z); | |
res += ((sample15 + sample20) * w.w); | |
w = tex2D(ravu_lut3, float2(0.89999997615814208984375f, coord_y)); | |
res += ((sample16 + sample19) * w.x); | |
res += ((sample17 + sample18) * w.y); | |
res = clamp(res, 0.0f, 1.0f); | |
return float4(res, 0.0f, 0.0f, 0.0f); | |
} | |
void frag_main() | |
{ | |
float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f); | |
color = hook(); | |
color.y = 0.0f; | |
color.z = 0.0f; | |
color.w = 1.0f; | |
out_color = color; | |
} | |
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | |
{ | |
texcoord0 = stage_input.texcoord0; | |
frag_main(); | |
SPIRV_Cross_Output stage_output; | |
stage_output.out_color = out_color; | |
return stage_output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
#define tex1D texture | |
#define tex3D texture | |
#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x)) | |
layout(location=0) out vec4 out_color; | |
layout(location=1) in vec2 texcoord0; | |
layout(location=2) in vec2 texcoord1; | |
layout(std140, binding=3) uniform UBO { | |
layout(offset=0) mat2 texture_rot0; | |
layout(offset=32) mat2 texture_rot1; | |
}; | |
layout(std430, push_constant) uniform PushC { | |
/*offset=0*/ float random; | |
/*offset=4*/ int frame; | |
/*offset=8*/ vec2 input_size; | |
/*offset=16*/ vec2 target_size; | |
/*offset=24*/ vec2 tex_offset; | |
/*offset=32*/ vec2 texture_size0; | |
/*offset=40*/ vec2 texture_off0; | |
/*offset=48*/ vec2 pixel_size0; | |
/*offset=56*/ vec2 texture_size1; | |
/*offset=64*/ vec2 texture_off1; | |
/*offset=72*/ vec2 pixel_size1; | |
}; | |
layout(binding=0) uniform sampler2D ravu_lut3; | |
layout(binding=1) uniform sampler2D texture0; | |
layout(binding=2) uniform sampler2D texture1; | |
#define HOOKED_raw texture0 | |
#define HOOKED_pos texcoord0 | |
#define HOOKED_size texture_size0 | |
#define HOOKED_rot texture_rot0 | |
#define HOOKED_pt pixel_size0 | |
#define HOOKED_map texmap0 | |
#define HOOKED_mul 1.000000 | |
#define HOOKED_tex(pos) (HOOKED_mul * vec4(texture(HOOKED_raw, pos)).rgba) | |
#define HOOKED_texOff(off) HOOKED_tex(HOOKED_pos + HOOKED_pt * vec2(off)) | |
#define LUMA_raw texture0 | |
#define LUMA_pos texcoord0 | |
#define LUMA_size texture_size0 | |
#define LUMA_rot texture_rot0 | |
#define LUMA_pt pixel_size0 | |
#define LUMA_map texmap0 | |
#define LUMA_mul 1.000000 | |
#define LUMA_tex(pos) (LUMA_mul * vec4(texture(LUMA_raw, pos)).rgba) | |
#define LUMA_texOff(off) LUMA_tex(LUMA_pos + LUMA_pt * vec2(off)) | |
#define ravu_int11_raw texture1 | |
#define ravu_int11_pos texcoord1 | |
#define ravu_int11_size texture_size1 | |
#define ravu_int11_rot texture_rot1 | |
#define ravu_int11_pt pixel_size1 | |
#define ravu_int11_map texmap1 | |
#define ravu_int11_mul 1.000000 | |
#define ravu_int11_tex(pos) (ravu_int11_mul * vec4(texture(ravu_int11_raw, pos)).rgba) | |
#define ravu_int11_texOff(off) ravu_int11_tex(ravu_int11_pos + ravu_int11_pt * vec2(off)) | |
vec4 hook() { | |
float sample0 = HOOKED_texOff(vec2(-2.0, 0.0)).x; | |
float sample12 = HOOKED_texOff(vec2(-1.0, -1.0)).x; | |
float sample7 = HOOKED_texOff(vec2(-1.0, 0.0)).x; | |
float sample2 = HOOKED_texOff(vec2(-1.0, 1.0)).x; | |
float sample24 = HOOKED_texOff(vec2(0.0, -2.0)).x; | |
float sample19 = HOOKED_texOff(vec2(0.0, -1.0)).x; | |
float sample14 = HOOKED_texOff(vec2(0.0, 0.0)).x; | |
float sample9 = HOOKED_texOff(vec2(0.0, 1.0)).x; | |
float sample4 = HOOKED_texOff(vec2(0.0, 2.0)).x; | |
float sample31 = HOOKED_texOff(vec2(1.0, -2.0)).x; | |
float sample26 = HOOKED_texOff(vec2(1.0, -1.0)).x; | |
float sample21 = HOOKED_texOff(vec2(1.0, 0.0)).x; | |
float sample16 = HOOKED_texOff(vec2(1.0, 1.0)).x; | |
float sample11 = HOOKED_texOff(vec2(1.0, 2.0)).x; | |
float sample33 = HOOKED_texOff(vec2(2.0, -1.0)).x; | |
float sample28 = HOOKED_texOff(vec2(2.0, 0.0)).x; | |
float sample23 = HOOKED_texOff(vec2(2.0, 1.0)).x; | |
float sample35 = HOOKED_texOff(vec2(3.0, 0.0)).x; | |
float sample6 = ravu_int11_texOff(vec2(-2.0, -1.0)).x; | |
float sample1 = ravu_int11_texOff(vec2(-2.0, 0.0)).x; | |
float sample18 = ravu_int11_texOff(vec2(-1.0, -2.0)).x; | |
float sample13 = ravu_int11_texOff(vec2(-1.0, -1.0)).x; | |
float sample8 = ravu_int11_texOff(vec2(-1.0, 0.0)).x; | |
float sample3 = ravu_int11_texOff(vec2(-1.0, 1.0)).x; | |
float sample30 = ravu_int11_texOff(vec2(0.0, -3.0)).x; | |
float sample25 = ravu_int11_texOff(vec2(0.0, -2.0)).x; | |
float sample20 = ravu_int11_texOff(vec2(0.0, -1.0)).x; | |
float sample15 = ravu_int11_texOff(vec2(0.0, 0.0)).x; | |
float sample10 = ravu_int11_texOff(vec2(0.0, 1.0)).x; | |
float sample5 = ravu_int11_texOff(vec2(0.0, 2.0)).x; | |
float sample32 = ravu_int11_texOff(vec2(1.0, -2.0)).x; | |
float sample27 = ravu_int11_texOff(vec2(1.0, -1.0)).x; | |
float sample22 = ravu_int11_texOff(vec2(1.0, 0.0)).x; | |
float sample17 = ravu_int11_texOff(vec2(1.0, 1.0)).x; | |
float sample34 = ravu_int11_texOff(vec2(2.0, -1.0)).x; | |
float sample29 = ravu_int11_texOff(vec2(2.0, 0.0)).x; | |
vec3 abd = vec3(0.0); | |
float gx, gy; | |
gx = (sample13-sample1)/2.0; | |
gy = (sample8-sample6)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (sample14-sample2)/2.0; | |
gy = (-sample10+8.0*sample9-8.0*sample7+sample6)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample15-sample3)/2.0; | |
gy = (-sample11+8.0*sample10-8.0*sample8+sample7)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample16-sample4)/2.0; | |
gy = (sample11-sample9)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (-sample25+8.0*sample19-8.0*sample7+sample1)/12.0; | |
gy = (sample14-sample12)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample26+8.0*sample20-8.0*sample8+sample2)/12.0; | |
gy = (-sample16+8.0*sample15-8.0*sample13+sample12)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample27+8.0*sample21-8.0*sample9+sample3)/12.0; | |
gy = (-sample17+8.0*sample16-8.0*sample14+sample13)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample28+8.0*sample22-8.0*sample10+sample4)/12.0; | |
gy = (sample17-sample15)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample31+8.0*sample25-8.0*sample13+sample7)/12.0; | |
gy = (sample20-sample18)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample32+8.0*sample26-8.0*sample14+sample8)/12.0; | |
gy = (-sample22+8.0*sample21-8.0*sample19+sample18)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample33+8.0*sample27-8.0*sample15+sample9)/12.0; | |
gy = (-sample23+8.0*sample22-8.0*sample20+sample19)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample34+8.0*sample28-8.0*sample16+sample10)/12.0; | |
gy = (sample23-sample21)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample31-sample19)/2.0; | |
gy = (sample26-sample24)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (sample32-sample20)/2.0; | |
gy = (-sample28+8.0*sample27-8.0*sample25+sample24)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample33-sample21)/2.0; | |
gy = (-sample29+8.0*sample28-8.0*sample26+sample25)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample34-sample22)/2.0; | |
gy = (sample29-sample27)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
float a = abd.x, b = abd.y, d = abd.z; | |
float T = a + d, D = a * d - b * b; | |
float delta = sqrt(max(T * T / 4.0 - D, 0.0)); | |
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta; | |
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2); | |
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7); | |
float lambda = sqrtL1; | |
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7); | |
float angle = floor(theta * 24.0 / 3.141592653589793); | |
float strength = clamp(floor(log2(lambda * 2000.0 + 1.192092896e-7)), 0.0, 8.0); | |
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5); | |
float coord_y = ((angle * 9.0 + strength) * 3.0 + coherence + 0.5) / 648.0; | |
float res = 0.0; | |
vec4 w; | |
w = texture(ravu_lut3, vec2(0.1, coord_y)); | |
res += (sample0 + sample35) * w[0]; | |
res += (sample1 + sample34) * w[1]; | |
res += (sample2 + sample33) * w[2]; | |
res += (sample3 + sample32) * w[3]; | |
w = texture(ravu_lut3, vec2(0.3, coord_y)); | |
res += (sample4 + sample31) * w[0]; | |
res += (sample5 + sample30) * w[1]; | |
res += (sample6 + sample29) * w[2]; | |
res += (sample7 + sample28) * w[3]; | |
w = texture(ravu_lut3, vec2(0.5, coord_y)); | |
res += (sample8 + sample27) * w[0]; | |
res += (sample9 + sample26) * w[1]; | |
res += (sample10 + sample25) * w[2]; | |
res += (sample11 + sample24) * w[3]; | |
w = texture(ravu_lut3, vec2(0.7, coord_y)); | |
res += (sample12 + sample23) * w[0]; | |
res += (sample13 + sample22) * w[1]; | |
res += (sample14 + sample21) * w[2]; | |
res += (sample15 + sample20) * w[3]; | |
w = texture(ravu_lut3, vec2(0.9, coord_y)); | |
res += (sample16 + sample19) * w[0]; | |
res += (sample17 + sample18) * w[1]; | |
res = clamp(res, 0.0, 1.0); | |
return vec4(res, 0.0, 0.0, 0.0); | |
} | |
void main() { | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
color = hook(); | |
color.g = 0.000000; | |
color.b = 0.000000; | |
color.a = 1.000000; | |
out_color = color; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct _UBO | |
{ | |
float2x2 texture_rot0; | |
float2x2 texture_rot1; | |
}; | |
cbuffer UBO : register(c3) | |
{ | |
_UBO _1362; | |
}; | |
struct _PushC | |
{ | |
float random; | |
int frame; | |
float2 input_size; | |
float2 target_size; | |
float2 tex_offset; | |
float2 texture_size0; | |
float2 texture_off0; | |
float2 pixel_size0; | |
float2 texture_size1; | |
float2 texture_off1; | |
float2 pixel_size1; | |
}; | |
cbuffer PushC | |
{ | |
_PushC _26; | |
}; | |
uniform sampler2D texture0; | |
uniform sampler2D texture1; | |
uniform sampler2D ravu_lut3; | |
static float2 texcoord0; | |
static float2 texcoord1; | |
static float4 out_color; | |
struct SPIRV_Cross_Input | |
{ | |
float2 texcoord0 : TEXCOORD1; | |
float2 texcoord1 : TEXCOORD2; | |
}; | |
struct SPIRV_Cross_Output | |
{ | |
float4 out_color : COLOR0; | |
}; | |
float mod(float x, float y) | |
{ | |
return x - y * floor(x / y); | |
} | |
float4 hook() | |
{ | |
float sample0 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 0.0f)))) * 1.0f).x; | |
float sample12 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, -1.0f)))) * 1.0f).x; | |
float sample7 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 0.0f)))) * 1.0f).x; | |
float sample2 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 1.0f)))) * 1.0f).x; | |
float sample24 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -2.0f)))) * 1.0f).x; | |
float sample19 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -1.0f)))) * 1.0f).x; | |
float sample14 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 0.0f)))) * 1.0f).x; | |
float sample9 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 1.0f)))) * 1.0f).x; | |
float sample4 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 2.0f)))) * 1.0f).x; | |
float sample31 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, -2.0f)))) * 1.0f).x; | |
float sample26 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, -1.0f)))) * 1.0f).x; | |
float sample21 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 0.0f)))) * 1.0f).x; | |
float sample16 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 1.0f)))) * 1.0f).x; | |
float sample11 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 2.0f)))) * 1.0f).x; | |
float sample33 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, -1.0f)))) * 1.0f).x; | |
float sample28 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 0.0f)))) * 1.0f).x; | |
float sample23 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 1.0f)))) * 1.0f).x; | |
float sample35 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(3.0f, 0.0f)))) * 1.0f).x; | |
float sample6 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-2.0f, -1.0f)))) * 1.0f).x; | |
float sample1 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-2.0f, 0.0f)))) * 1.0f).x; | |
float sample18 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, -2.0f)))) * 1.0f).x; | |
float sample13 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, -1.0f)))) * 1.0f).x; | |
float sample8 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, 0.0f)))) * 1.0f).x; | |
float sample3 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, 1.0f)))) * 1.0f).x; | |
float sample30 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, -3.0f)))) * 1.0f).x; | |
float sample25 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, -2.0f)))) * 1.0f).x; | |
float sample20 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, -1.0f)))) * 1.0f).x; | |
float sample15 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, 0.0f)))) * 1.0f).x; | |
float sample10 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, 1.0f)))) * 1.0f).x; | |
float sample5 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, 2.0f)))) * 1.0f).x; | |
float sample32 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(1.0f, -2.0f)))) * 1.0f).x; | |
float sample27 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(1.0f, -1.0f)))) * 1.0f).x; | |
float sample22 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(1.0f, 0.0f)))) * 1.0f).x; | |
float sample17 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(1.0f, 1.0f)))) * 1.0f).x; | |
float sample34 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(2.0f, -1.0f)))) * 1.0f).x; | |
float sample29 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(2.0f, 0.0f)))) * 1.0f).x; | |
float3 abd = float3(0.0f, 0.0f, 0.0f); | |
float gx = (sample13 - sample1) / 2.0f; | |
float gy = (sample8 - sample6) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = (sample14 - sample2) / 2.0f; | |
gy = ((((-sample10) + (8.0f * sample9)) - (8.0f * sample7)) + sample6) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample15 - sample3) / 2.0f; | |
gy = ((((-sample11) + (8.0f * sample10)) - (8.0f * sample8)) + sample7) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample16 - sample4) / 2.0f; | |
gy = (sample11 - sample9) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = ((((-sample25) + (8.0f * sample19)) - (8.0f * sample7)) + sample1) / 12.0f; | |
gy = (sample14 - sample12) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample26) + (8.0f * sample20)) - (8.0f * sample8)) + sample2) / 12.0f; | |
gy = ((((-sample16) + (8.0f * sample15)) - (8.0f * sample13)) + sample12) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample27) + (8.0f * sample21)) - (8.0f * sample9)) + sample3) / 12.0f; | |
gy = ((((-sample17) + (8.0f * sample16)) - (8.0f * sample14)) + sample13) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample28) + (8.0f * sample22)) - (8.0f * sample10)) + sample4) / 12.0f; | |
gy = (sample17 - sample15) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample31) + (8.0f * sample25)) - (8.0f * sample13)) + sample7) / 12.0f; | |
gy = (sample20 - sample18) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample32) + (8.0f * sample26)) - (8.0f * sample14)) + sample8) / 12.0f; | |
gy = ((((-sample22) + (8.0f * sample21)) - (8.0f * sample19)) + sample18) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample33) + (8.0f * sample27)) - (8.0f * sample15)) + sample9) / 12.0f; | |
gy = ((((-sample23) + (8.0f * sample22)) - (8.0f * sample20)) + sample19) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample34) + (8.0f * sample28)) - (8.0f * sample16)) + sample10) / 12.0f; | |
gy = (sample23 - sample21) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample31 - sample19) / 2.0f; | |
gy = (sample26 - sample24) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = (sample32 - sample20) / 2.0f; | |
gy = ((((-sample28) + (8.0f * sample27)) - (8.0f * sample25)) + sample24) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample33 - sample21) / 2.0f; | |
gy = ((((-sample29) + (8.0f * sample28)) - (8.0f * sample26)) + sample25) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample34 - sample22) / 2.0f; | |
gy = (sample29 - sample27) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
float a = abd.x; | |
float b = abd.y; | |
float d = abd.z; | |
float T = a + d; | |
float D = (a * d) - (b * b); | |
float delta = sqrt(max(((T * T) / 4.0f) - D, 0.0f)); | |
float L1 = (T / 2.0f) + delta; | |
float L2 = (T / 2.0f) - delta; | |
float sqrtL1 = sqrt(L1); | |
float sqrtL2 = sqrt(L2); | |
float theta = (abs(b) < 1.1920928955078125e-07f) ? 0.0f : mod(atan2(L1 - a, b) + 3.1415927410125732421875f, 3.1415927410125732421875f); | |
float lambda = sqrtL1; | |
float mu = ((sqrtL1 + sqrtL2) < 1.1920928955078125e-07f) ? 0.0f : ((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2)); | |
float angle = floor((theta * 24.0f) / 3.1415927410125732421875f); | |
float strength = clamp(floor(log2((lambda * 2000.0f) + 1.1920928955078125e-07f)), 0.0f, 8.0f); | |
float coherence = (mu >= 0.5f) ? 2.0f : float(mu >= 0.25f); | |
float coord_y = (((((angle * 9.0f) + strength) * 3.0f) + coherence) + 0.5f) / 648.0f; | |
float res = 0.0f; | |
float4 w = tex2D(ravu_lut3, float2(0.100000001490116119384765625f, coord_y)); | |
res += ((sample0 + sample35) * w.x); | |
res += ((sample1 + sample34) * w.y); | |
res += ((sample2 + sample33) * w.z); | |
res += ((sample3 + sample32) * w.w); | |
w = tex2D(ravu_lut3, float2(0.300000011920928955078125f, coord_y)); | |
res += ((sample4 + sample31) * w.x); | |
res += ((sample5 + sample30) * w.y); | |
res += ((sample6 + sample29) * w.z); | |
res += ((sample7 + sample28) * w.w); | |
w = tex2D(ravu_lut3, float2(0.5f, coord_y)); | |
res += ((sample8 + sample27) * w.x); | |
res += ((sample9 + sample26) * w.y); | |
res += ((sample10 + sample25) * w.z); | |
res += ((sample11 + sample24) * w.w); | |
w = tex2D(ravu_lut3, float2(0.699999988079071044921875f, coord_y)); | |
res += ((sample12 + sample23) * w.x); | |
res += ((sample13 + sample22) * w.y); | |
res += ((sample14 + sample21) * w.z); | |
res += ((sample15 + sample20) * w.w); | |
w = tex2D(ravu_lut3, float2(0.89999997615814208984375f, coord_y)); | |
res += ((sample16 + sample19) * w.x); | |
res += ((sample17 + sample18) * w.y); | |
res = clamp(res, 0.0f, 1.0f); | |
return float4(res, 0.0f, 0.0f, 0.0f); | |
} | |
void frag_main() | |
{ | |
float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f); | |
color = hook(); | |
color.y = 0.0f; | |
color.z = 0.0f; | |
color.w = 1.0f; | |
out_color = color; | |
} | |
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | |
{ | |
texcoord0 = stage_input.texcoord0; | |
texcoord1 = stage_input.texcoord1; | |
frag_main(); | |
SPIRV_Cross_Output stage_output; | |
stage_output.out_color = out_color; | |
return stage_output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
#define tex1D texture | |
#define tex3D texture | |
#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x)) | |
layout(location=0) out vec4 out_color; | |
layout(location=1) in vec2 texcoord0; | |
layout(location=2) in vec2 texcoord1; | |
layout(std140, binding=3) uniform UBO { | |
layout(offset=0) mat2 texture_rot0; | |
layout(offset=32) mat2 texture_rot1; | |
}; | |
layout(std430, push_constant) uniform PushC { | |
/*offset=0*/ float random; | |
/*offset=4*/ int frame; | |
/*offset=8*/ vec2 input_size; | |
/*offset=16*/ vec2 target_size; | |
/*offset=24*/ vec2 tex_offset; | |
/*offset=32*/ vec2 texture_size0; | |
/*offset=40*/ vec2 texture_off0; | |
/*offset=48*/ vec2 pixel_size0; | |
/*offset=56*/ vec2 texture_size1; | |
/*offset=64*/ vec2 texture_off1; | |
/*offset=72*/ vec2 pixel_size1; | |
}; | |
layout(binding=0) uniform sampler2D ravu_lut3; | |
layout(binding=1) uniform sampler2D texture0; | |
layout(binding=2) uniform sampler2D texture1; | |
#define HOOKED_raw texture0 | |
#define HOOKED_pos texcoord0 | |
#define HOOKED_size texture_size0 | |
#define HOOKED_rot texture_rot0 | |
#define HOOKED_pt pixel_size0 | |
#define HOOKED_map texmap0 | |
#define HOOKED_mul 1.000000 | |
#define HOOKED_tex(pos) (HOOKED_mul * vec4(texture(HOOKED_raw, pos)).rgba) | |
#define HOOKED_texOff(off) HOOKED_tex(HOOKED_pos + HOOKED_pt * vec2(off)) | |
#define LUMA_raw texture0 | |
#define LUMA_pos texcoord0 | |
#define LUMA_size texture_size0 | |
#define LUMA_rot texture_rot0 | |
#define LUMA_pt pixel_size0 | |
#define LUMA_map texmap0 | |
#define LUMA_mul 1.000000 | |
#define LUMA_tex(pos) (LUMA_mul * vec4(texture(LUMA_raw, pos)).rgba) | |
#define LUMA_texOff(off) LUMA_tex(LUMA_pos + LUMA_pt * vec2(off)) | |
#define ravu_int11_raw texture1 | |
#define ravu_int11_pos texcoord1 | |
#define ravu_int11_size texture_size1 | |
#define ravu_int11_rot texture_rot1 | |
#define ravu_int11_pt pixel_size1 | |
#define ravu_int11_map texmap1 | |
#define ravu_int11_mul 1.000000 | |
#define ravu_int11_tex(pos) (ravu_int11_mul * vec4(texture(ravu_int11_raw, pos)).rgba) | |
#define ravu_int11_texOff(off) ravu_int11_tex(ravu_int11_pos + ravu_int11_pt * vec2(off)) | |
vec4 hook() { | |
float sample6 = HOOKED_texOff(vec2(-2.0, 0.0)).x; | |
float sample1 = HOOKED_texOff(vec2(-2.0, 1.0)).x; | |
float sample18 = HOOKED_texOff(vec2(-1.0, -1.0)).x; | |
float sample13 = HOOKED_texOff(vec2(-1.0, 0.0)).x; | |
float sample8 = HOOKED_texOff(vec2(-1.0, 1.0)).x; | |
float sample3 = HOOKED_texOff(vec2(-1.0, 2.0)).x; | |
float sample30 = HOOKED_texOff(vec2(0.0, -2.0)).x; | |
float sample25 = HOOKED_texOff(vec2(0.0, -1.0)).x; | |
float sample20 = HOOKED_texOff(vec2(0.0, 0.0)).x; | |
float sample15 = HOOKED_texOff(vec2(0.0, 1.0)).x; | |
float sample10 = HOOKED_texOff(vec2(0.0, 2.0)).x; | |
float sample5 = HOOKED_texOff(vec2(0.0, 3.0)).x; | |
float sample32 = HOOKED_texOff(vec2(1.0, -1.0)).x; | |
float sample27 = HOOKED_texOff(vec2(1.0, 0.0)).x; | |
float sample22 = HOOKED_texOff(vec2(1.0, 1.0)).x; | |
float sample17 = HOOKED_texOff(vec2(1.0, 2.0)).x; | |
float sample34 = HOOKED_texOff(vec2(2.0, 0.0)).x; | |
float sample29 = HOOKED_texOff(vec2(2.0, 1.0)).x; | |
float sample0 = ravu_int11_texOff(vec2(-3.0, 0.0)).x; | |
float sample12 = ravu_int11_texOff(vec2(-2.0, -1.0)).x; | |
float sample7 = ravu_int11_texOff(vec2(-2.0, 0.0)).x; | |
float sample2 = ravu_int11_texOff(vec2(-2.0, 1.0)).x; | |
float sample24 = ravu_int11_texOff(vec2(-1.0, -2.0)).x; | |
float sample19 = ravu_int11_texOff(vec2(-1.0, -1.0)).x; | |
float sample14 = ravu_int11_texOff(vec2(-1.0, 0.0)).x; | |
float sample9 = ravu_int11_texOff(vec2(-1.0, 1.0)).x; | |
float sample4 = ravu_int11_texOff(vec2(-1.0, 2.0)).x; | |
float sample31 = ravu_int11_texOff(vec2(0.0, -2.0)).x; | |
float sample26 = ravu_int11_texOff(vec2(0.0, -1.0)).x; | |
float sample21 = ravu_int11_texOff(vec2(0.0, 0.0)).x; | |
float sample16 = ravu_int11_texOff(vec2(0.0, 1.0)).x; | |
float sample11 = ravu_int11_texOff(vec2(0.0, 2.0)).x; | |
float sample33 = ravu_int11_texOff(vec2(1.0, -1.0)).x; | |
float sample28 = ravu_int11_texOff(vec2(1.0, 0.0)).x; | |
float sample23 = ravu_int11_texOff(vec2(1.0, 1.0)).x; | |
float sample35 = ravu_int11_texOff(vec2(2.0, 0.0)).x; | |
vec3 abd = vec3(0.0); | |
float gx, gy; | |
gx = (sample13-sample1)/2.0; | |
gy = (sample8-sample6)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (sample14-sample2)/2.0; | |
gy = (-sample10+8.0*sample9-8.0*sample7+sample6)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample15-sample3)/2.0; | |
gy = (-sample11+8.0*sample10-8.0*sample8+sample7)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample16-sample4)/2.0; | |
gy = (sample11-sample9)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (-sample25+8.0*sample19-8.0*sample7+sample1)/12.0; | |
gy = (sample14-sample12)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample26+8.0*sample20-8.0*sample8+sample2)/12.0; | |
gy = (-sample16+8.0*sample15-8.0*sample13+sample12)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample27+8.0*sample21-8.0*sample9+sample3)/12.0; | |
gy = (-sample17+8.0*sample16-8.0*sample14+sample13)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample28+8.0*sample22-8.0*sample10+sample4)/12.0; | |
gy = (sample17-sample15)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample31+8.0*sample25-8.0*sample13+sample7)/12.0; | |
gy = (sample20-sample18)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (-sample32+8.0*sample26-8.0*sample14+sample8)/12.0; | |
gy = (-sample22+8.0*sample21-8.0*sample19+sample18)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample33+8.0*sample27-8.0*sample15+sample9)/12.0; | |
gy = (-sample23+8.0*sample22-8.0*sample20+sample19)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.07901060453704994; | |
gx = (-sample34+8.0*sample28-8.0*sample16+sample10)/12.0; | |
gy = (sample23-sample21)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample31-sample19)/2.0; | |
gy = (sample26-sample24)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
gx = (sample32-sample20)/2.0; | |
gy = (-sample28+8.0*sample27-8.0*sample25+sample24)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample33-sample21)/2.0; | |
gy = (-sample29+8.0*sample28-8.0*sample26+sample25)/12.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.06153352068439959; | |
gx = (sample34-sample22)/2.0; | |
gy = (sample29-sample27)/2.0; | |
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04792235409415088; | |
float a = abd.x, b = abd.y, d = abd.z; | |
float T = a + d, D = a * d - b * b; | |
float delta = sqrt(max(T * T / 4.0 - D, 0.0)); | |
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta; | |
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2); | |
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7); | |
float lambda = sqrtL1; | |
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7); | |
float angle = floor(theta * 24.0 / 3.141592653589793); | |
float strength = clamp(floor(log2(lambda * 2000.0 + 1.192092896e-7)), 0.0, 8.0); | |
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5); | |
float coord_y = ((angle * 9.0 + strength) * 3.0 + coherence + 0.5) / 648.0; | |
float res = 0.0; | |
vec4 w; | |
w = texture(ravu_lut3, vec2(0.1, coord_y)); | |
res += (sample0 + sample35) * w[0]; | |
res += (sample1 + sample34) * w[1]; | |
res += (sample2 + sample33) * w[2]; | |
res += (sample3 + sample32) * w[3]; | |
w = texture(ravu_lut3, vec2(0.3, coord_y)); | |
res += (sample4 + sample31) * w[0]; | |
res += (sample5 + sample30) * w[1]; | |
res += (sample6 + sample29) * w[2]; | |
res += (sample7 + sample28) * w[3]; | |
w = texture(ravu_lut3, vec2(0.5, coord_y)); | |
res += (sample8 + sample27) * w[0]; | |
res += (sample9 + sample26) * w[1]; | |
res += (sample10 + sample25) * w[2]; | |
res += (sample11 + sample24) * w[3]; | |
w = texture(ravu_lut3, vec2(0.7, coord_y)); | |
res += (sample12 + sample23) * w[0]; | |
res += (sample13 + sample22) * w[1]; | |
res += (sample14 + sample21) * w[2]; | |
res += (sample15 + sample20) * w[3]; | |
w = texture(ravu_lut3, vec2(0.9, coord_y)); | |
res += (sample16 + sample19) * w[0]; | |
res += (sample17 + sample18) * w[1]; | |
res = clamp(res, 0.0, 1.0); | |
return vec4(res, 0.0, 0.0, 0.0); | |
} | |
void main() { | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
color = hook(); | |
color.g = 0.000000; | |
color.b = 0.000000; | |
color.a = 1.000000; | |
out_color = color; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct _UBO | |
{ | |
float2x2 texture_rot0; | |
float2x2 texture_rot1; | |
}; | |
cbuffer UBO : register(c3) | |
{ | |
_UBO _1362; | |
}; | |
struct _PushC | |
{ | |
float random; | |
int frame; | |
float2 input_size; | |
float2 target_size; | |
float2 tex_offset; | |
float2 texture_size0; | |
float2 texture_off0; | |
float2 pixel_size0; | |
float2 texture_size1; | |
float2 texture_off1; | |
float2 pixel_size1; | |
}; | |
cbuffer PushC | |
{ | |
_PushC _26; | |
}; | |
uniform sampler2D texture0; | |
uniform sampler2D texture1; | |
uniform sampler2D ravu_lut3; | |
static float2 texcoord0; | |
static float2 texcoord1; | |
static float4 out_color; | |
struct SPIRV_Cross_Input | |
{ | |
float2 texcoord0 : TEXCOORD1; | |
float2 texcoord1 : TEXCOORD2; | |
}; | |
struct SPIRV_Cross_Output | |
{ | |
float4 out_color : COLOR0; | |
}; | |
float mod(float x, float y) | |
{ | |
return x - y * floor(x / y); | |
} | |
float4 hook() | |
{ | |
float sample6 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 0.0f)))) * 1.0f).x; | |
float sample1 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-2.0f, 1.0f)))) * 1.0f).x; | |
float sample18 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, -1.0f)))) * 1.0f).x; | |
float sample13 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 0.0f)))) * 1.0f).x; | |
float sample8 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 1.0f)))) * 1.0f).x; | |
float sample3 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(-1.0f, 2.0f)))) * 1.0f).x; | |
float sample30 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -2.0f)))) * 1.0f).x; | |
float sample25 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, -1.0f)))) * 1.0f).x; | |
float sample20 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 0.0f)))) * 1.0f).x; | |
float sample15 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 1.0f)))) * 1.0f).x; | |
float sample10 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 2.0f)))) * 1.0f).x; | |
float sample5 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(0.0f, 3.0f)))) * 1.0f).x; | |
float sample32 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, -1.0f)))) * 1.0f).x; | |
float sample27 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 0.0f)))) * 1.0f).x; | |
float sample22 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 1.0f)))) * 1.0f).x; | |
float sample17 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(1.0f, 2.0f)))) * 1.0f).x; | |
float sample34 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 0.0f)))) * 1.0f).x; | |
float sample29 = (float4(tex2D(texture0, texcoord0 + (_26.pixel_size0 * float2(2.0f, 1.0f)))) * 1.0f).x; | |
float sample0 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-3.0f, 0.0f)))) * 1.0f).x; | |
float sample12 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-2.0f, -1.0f)))) * 1.0f).x; | |
float sample7 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-2.0f, 0.0f)))) * 1.0f).x; | |
float sample2 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-2.0f, 1.0f)))) * 1.0f).x; | |
float sample24 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, -2.0f)))) * 1.0f).x; | |
float sample19 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, -1.0f)))) * 1.0f).x; | |
float sample14 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, 0.0f)))) * 1.0f).x; | |
float sample9 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, 1.0f)))) * 1.0f).x; | |
float sample4 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(-1.0f, 2.0f)))) * 1.0f).x; | |
float sample31 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, -2.0f)))) * 1.0f).x; | |
float sample26 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, -1.0f)))) * 1.0f).x; | |
float sample21 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, 0.0f)))) * 1.0f).x; | |
float sample16 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, 1.0f)))) * 1.0f).x; | |
float sample11 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(0.0f, 2.0f)))) * 1.0f).x; | |
float sample33 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(1.0f, -1.0f)))) * 1.0f).x; | |
float sample28 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(1.0f, 0.0f)))) * 1.0f).x; | |
float sample23 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(1.0f, 1.0f)))) * 1.0f).x; | |
float sample35 = (float4(tex2D(texture1, texcoord1 + (_26.pixel_size1 * float2(2.0f, 0.0f)))) * 1.0f).x; | |
float3 abd = float3(0.0f, 0.0f, 0.0f); | |
float gx = (sample13 - sample1) / 2.0f; | |
float gy = (sample8 - sample6) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = (sample14 - sample2) / 2.0f; | |
gy = ((((-sample10) + (8.0f * sample9)) - (8.0f * sample7)) + sample6) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample15 - sample3) / 2.0f; | |
gy = ((((-sample11) + (8.0f * sample10)) - (8.0f * sample8)) + sample7) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample16 - sample4) / 2.0f; | |
gy = (sample11 - sample9) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = ((((-sample25) + (8.0f * sample19)) - (8.0f * sample7)) + sample1) / 12.0f; | |
gy = (sample14 - sample12) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample26) + (8.0f * sample20)) - (8.0f * sample8)) + sample2) / 12.0f; | |
gy = ((((-sample16) + (8.0f * sample15)) - (8.0f * sample13)) + sample12) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample27) + (8.0f * sample21)) - (8.0f * sample9)) + sample3) / 12.0f; | |
gy = ((((-sample17) + (8.0f * sample16)) - (8.0f * sample14)) + sample13) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample28) + (8.0f * sample22)) - (8.0f * sample10)) + sample4) / 12.0f; | |
gy = (sample17 - sample15) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample31) + (8.0f * sample25)) - (8.0f * sample13)) + sample7) / 12.0f; | |
gy = (sample20 - sample18) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = ((((-sample32) + (8.0f * sample26)) - (8.0f * sample14)) + sample8) / 12.0f; | |
gy = ((((-sample22) + (8.0f * sample21)) - (8.0f * sample19)) + sample18) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample33) + (8.0f * sample27)) - (8.0f * sample15)) + sample9) / 12.0f; | |
gy = ((((-sample23) + (8.0f * sample22)) - (8.0f * sample20)) + sample19) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.07901060581207275390625f); | |
gx = ((((-sample34) + (8.0f * sample28)) - (8.0f * sample16)) + sample10) / 12.0f; | |
gy = (sample23 - sample21) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample31 - sample19) / 2.0f; | |
gy = (sample26 - sample24) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
gx = (sample32 - sample20) / 2.0f; | |
gy = ((((-sample28) + (8.0f * sample27)) - (8.0f * sample25)) + sample24) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample33 - sample21) / 2.0f; | |
gy = ((((-sample29) + (8.0f * sample28)) - (8.0f * sample26)) + sample25) / 12.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0615335218608379364013671875f); | |
gx = (sample34 - sample22) / 2.0f; | |
gy = (sample29 - sample27) / 2.0f; | |
abd += (float3(gx * gx, gx * gy, gy * gy) * 0.0479223541915416717529296875f); | |
float a = abd.x; | |
float b = abd.y; | |
float d = abd.z; | |
float T = a + d; | |
float D = (a * d) - (b * b); | |
float delta = sqrt(max(((T * T) / 4.0f) - D, 0.0f)); | |
float L1 = (T / 2.0f) + delta; | |
float L2 = (T / 2.0f) - delta; | |
float sqrtL1 = sqrt(L1); | |
float sqrtL2 = sqrt(L2); | |
float theta = (abs(b) < 1.1920928955078125e-07f) ? 0.0f : mod(atan2(L1 - a, b) + 3.1415927410125732421875f, 3.1415927410125732421875f); | |
float lambda = sqrtL1; | |
float mu = ((sqrtL1 + sqrtL2) < 1.1920928955078125e-07f) ? 0.0f : ((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2)); | |
float angle = floor((theta * 24.0f) / 3.1415927410125732421875f); | |
float strength = clamp(floor(log2((lambda * 2000.0f) + 1.1920928955078125e-07f)), 0.0f, 8.0f); | |
float coherence = (mu >= 0.5f) ? 2.0f : float(mu >= 0.25f); | |
float coord_y = (((((angle * 9.0f) + strength) * 3.0f) + coherence) + 0.5f) / 648.0f; | |
float res = 0.0f; | |
float4 w = tex2D(ravu_lut3, float2(0.100000001490116119384765625f, coord_y)); | |
res += ((sample0 + sample35) * w.x); | |
res += ((sample1 + sample34) * w.y); | |
res += ((sample2 + sample33) * w.z); | |
res += ((sample3 + sample32) * w.w); | |
w = tex2D(ravu_lut3, float2(0.300000011920928955078125f, coord_y)); | |
res += ((sample4 + sample31) * w.x); | |
res += ((sample5 + sample30) * w.y); | |
res += ((sample6 + sample29) * w.z); | |
res += ((sample7 + sample28) * w.w); | |
w = tex2D(ravu_lut3, float2(0.5f, coord_y)); | |
res += ((sample8 + sample27) * w.x); | |
res += ((sample9 + sample26) * w.y); | |
res += ((sample10 + sample25) * w.z); | |
res += ((sample11 + sample24) * w.w); | |
w = tex2D(ravu_lut3, float2(0.699999988079071044921875f, coord_y)); | |
res += ((sample12 + sample23) * w.x); | |
res += ((sample13 + sample22) * w.y); | |
res += ((sample14 + sample21) * w.z); | |
res += ((sample15 + sample20) * w.w); | |
w = tex2D(ravu_lut3, float2(0.89999997615814208984375f, coord_y)); | |
res += ((sample16 + sample19) * w.x); | |
res += ((sample17 + sample18) * w.y); | |
res = clamp(res, 0.0f, 1.0f); | |
return float4(res, 0.0f, 0.0f, 0.0f); | |
} | |
void frag_main() | |
{ | |
float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f); | |
color = hook(); | |
color.y = 0.0f; | |
color.z = 0.0f; | |
color.w = 1.0f; | |
out_color = color; | |
} | |
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | |
{ | |
texcoord0 = stage_input.texcoord0; | |
texcoord1 = stage_input.texcoord1; | |
frag_main(); | |
SPIRV_Cross_Output stage_output; | |
stage_output.out_color = out_color; | |
return stage_output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
#define tex1D texture | |
#define tex3D texture | |
#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x)) | |
layout(location=0) out vec4 out_color; | |
layout(location=1) in vec2 texcoord0; | |
layout(location=2) in vec2 texcoord1; | |
layout(location=3) in vec2 texcoord2; | |
layout(location=4) in vec2 texcoord3; | |
layout(std140, binding=4) uniform UBO { | |
layout(offset=0) mat2 texture_rot0; | |
layout(offset=32) mat2 texture_rot1; | |
layout(offset=64) mat2 texture_rot2; | |
layout(offset=96) mat2 texture_rot3; | |
}; | |
layout(std430, push_constant) uniform PushC { | |
/*offset=0*/ float random; | |
/*offset=4*/ int frame; | |
/*offset=8*/ vec2 input_size; | |
/*offset=16*/ vec2 target_size; | |
/*offset=24*/ vec2 tex_offset; | |
/*offset=32*/ vec2 texture_size0; | |
/*offset=40*/ vec2 texture_off0; | |
/*offset=48*/ vec2 pixel_size0; | |
/*offset=56*/ vec2 texture_size1; | |
/*offset=64*/ vec2 texture_off1; | |
/*offset=72*/ vec2 pixel_size1; | |
/*offset=80*/ vec2 texture_size2; | |
/*offset=88*/ vec2 texture_off2; | |
/*offset=96*/ vec2 pixel_size2; | |
/*offset=104*/ vec2 texture_size3; | |
/*offset=112*/ vec2 texture_off3; | |
/*offset=120*/ vec2 pixel_size3; | |
}; | |
layout(binding=0) uniform sampler2D texture0; | |
layout(binding=1) uniform sampler2D texture1; | |
layout(binding=2) uniform sampler2D texture2; | |
layout(binding=3) uniform sampler2D texture3; | |
#define HOOKED_raw texture0 | |
#define HOOKED_pos texcoord0 | |
#define HOOKED_size texture_size0 | |
#define HOOKED_rot texture_rot0 | |
#define HOOKED_pt pixel_size0 | |
#define HOOKED_map texmap0 | |
#define HOOKED_mul 1.000000 | |
#define HOOKED_tex(pos) (HOOKED_mul * vec4(texture(HOOKED_raw, pos)).rgba) | |
#define HOOKED_texOff(off) HOOKED_tex(HOOKED_pos + HOOKED_pt * vec2(off)) | |
#define LUMA_raw texture0 | |
#define LUMA_pos texcoord0 | |
#define LUMA_size texture_size0 | |
#define LUMA_rot texture_rot0 | |
#define LUMA_pt pixel_size0 | |
#define LUMA_map texmap0 | |
#define LUMA_mul 1.000000 | |
#define LUMA_tex(pos) (LUMA_mul * vec4(texture(LUMA_raw, pos)).rgba) | |
#define LUMA_texOff(off) LUMA_tex(LUMA_pos + LUMA_pt * vec2(off)) | |
#define ravu_int01_raw texture1 | |
#define ravu_int01_pos texcoord1 | |
#define ravu_int01_size texture_size1 | |
#define ravu_int01_rot texture_rot1 | |
#define ravu_int01_pt pixel_size1 | |
#define ravu_int01_map texmap1 | |
#define ravu_int01_mul 1.000000 | |
#define ravu_int01_tex(pos) (ravu_int01_mul * vec4(texture(ravu_int01_raw, pos)).rgba) | |
#define ravu_int01_texOff(off) ravu_int01_tex(ravu_int01_pos + ravu_int01_pt * vec2(off)) | |
#define ravu_int10_raw texture2 | |
#define ravu_int10_pos texcoord2 | |
#define ravu_int10_size texture_size2 | |
#define ravu_int10_rot texture_rot2 | |
#define ravu_int10_pt pixel_size2 | |
#define ravu_int10_map texmap2 | |
#define ravu_int10_mul 1.000000 | |
#define ravu_int10_tex(pos) (ravu_int10_mul * vec4(texture(ravu_int10_raw, pos)).rgba) | |
#define ravu_int10_texOff(off) ravu_int10_tex(ravu_int10_pos + ravu_int10_pt * vec2(off)) | |
#define ravu_int11_raw texture3 | |
#define ravu_int11_pos texcoord3 | |
#define ravu_int11_size texture_size3 | |
#define ravu_int11_rot texture_rot3 | |
#define ravu_int11_pt pixel_size3 | |
#define ravu_int11_map texmap3 | |
#define ravu_int11_mul 1.000000 | |
#define ravu_int11_tex(pos) (ravu_int11_mul * vec4(texture(ravu_int11_raw, pos)).rgba) | |
#define ravu_int11_texOff(off) ravu_int11_tex(ravu_int11_pos + ravu_int11_pt * vec2(off)) | |
vec4 hook() { | |
vec2 dir = fract(HOOKED_pos * HOOKED_size) - 0.5; | |
if (dir.x < 0.0) { | |
if (dir.y < 0.0) | |
return HOOKED_texOff(-dir); | |
return ravu_int01_texOff(-dir); | |
} else { | |
if (dir.y < 0.0) | |
return ravu_int10_texOff(-dir); | |
return ravu_int11_texOff(-dir); | |
} | |
} | |
void main() { | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
color = hook(); | |
color.g = 0.000000; | |
color.b = 0.000000; | |
color.a = 1.000000; | |
out_color = color; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct _UBO | |
{ | |
float2x2 texture_rot0; | |
float2x2 texture_rot1; | |
float2x2 texture_rot2; | |
float2x2 texture_rot3; | |
}; | |
cbuffer UBO : register(c4) | |
{ | |
_UBO _159; | |
}; | |
struct _PushC | |
{ | |
float random; | |
int frame; | |
float2 input_size; | |
float2 target_size; | |
float2 tex_offset; | |
float2 texture_size0; | |
float2 texture_off0; | |
float2 pixel_size0; | |
float2 texture_size1; | |
float2 texture_off1; | |
float2 pixel_size1; | |
float2 texture_size2; | |
float2 texture_off2; | |
float2 pixel_size2; | |
float2 texture_size3; | |
float2 texture_off3; | |
float2 pixel_size3; | |
}; | |
cbuffer PushC | |
{ | |
_PushC _20; | |
}; | |
uniform sampler2D texture0; | |
uniform sampler2D texture1; | |
uniform sampler2D texture2; | |
uniform sampler2D texture3; | |
static float2 texcoord0; | |
static float2 texcoord1; | |
static float2 texcoord2; | |
static float2 texcoord3; | |
static float4 out_color; | |
struct SPIRV_Cross_Input | |
{ | |
float2 texcoord0 : TEXCOORD1; | |
float2 texcoord1 : TEXCOORD2; | |
float2 texcoord2 : TEXCOORD3; | |
float2 texcoord3 : TEXCOORD4; | |
}; | |
struct SPIRV_Cross_Output | |
{ | |
float4 out_color : COLOR0; | |
}; | |
float4 _143; | |
float4 hook() | |
{ | |
float2 dir = frac(texcoord0 * _20.texture_size0) - float2(0.5f, 0.5f); | |
if (dir.x < 0.0f) | |
{ | |
if (dir.y < 0.0f) | |
{ | |
return float4(tex2D(texture0, texcoord0 + (_20.pixel_size0 * float2(-dir)))) * 1.0f; | |
} | |
return float4(tex2D(texture1, texcoord1 + (_20.pixel_size1 * float2(-dir)))) * 1.0f; | |
} | |
else | |
{ | |
if (dir.y < 0.0f) | |
{ | |
return float4(tex2D(texture2, texcoord2 + (_20.pixel_size2 * float2(-dir)))) * 1.0f; | |
} | |
return float4(tex2D(texture3, texcoord3 + (_20.pixel_size3 * float2(-dir)))) * 1.0f; | |
} | |
} | |
void frag_main() | |
{ | |
float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f); | |
color = hook(); | |
color.y = 0.0f; | |
color.z = 0.0f; | |
color.w = 1.0f; | |
out_color = color; | |
} | |
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | |
{ | |
texcoord0 = stage_input.texcoord0; | |
texcoord1 = stage_input.texcoord1; | |
texcoord2 = stage_input.texcoord2; | |
texcoord3 = stage_input.texcoord3; | |
frag_main(); | |
SPIRV_Cross_Output stage_output; | |
stage_output.out_color = out_color; | |
return stage_output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment