fixes for various compiler nits

This commit is contained in:
hunterk 2019-01-29 16:32:54 -06:00
parent e179039cbc
commit 52db21c079
22 changed files with 67 additions and 53 deletions

View File

@ -77,7 +77,7 @@ float sinc(float x){
float lanczosFilter(float r2){ float lanczosFilter(float r2){
if (r2==0) if (r2==0)
return 1; return 1.;
float r= sqrt(r2); float r= sqrt(r2);
return sinc(r)*sinc(r/1.3); return sinc(r)*sinc(r/1.3);
} }

View File

@ -9,4 +9,4 @@
#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01
#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01
#include "imgborder.inc" #include "imgborder.inc"

View File

@ -9,4 +9,4 @@
#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01
#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01
#include "imgborder.inc" #include "imgborder.inc"

View File

@ -9,4 +9,4 @@
#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01
#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01
#include "imgborder.inc" #include "imgborder.inc"

View File

@ -9,4 +9,4 @@
#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01
#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 #pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01
#include "imgborder.inc" #include "imgborder.inc"

View File

@ -1,3 +1,3 @@
#version 450 #version 450
#define INTEGRATED_GRAPHICS_COMPATIBILITY_MODE #define INTEGRATED_GRAPHICS_COMPATIBILITY_MODE
#include "crt-royale-bloom-approx.h" #include "crt-royale-bloom-approx.h"

View File

@ -1,2 +1,2 @@
#version 450 #version 450
#include "crt-royale-bloom-approx.h" #include "crt-royale-bloom-approx.h"

View File

@ -1,4 +1,4 @@
#version 450 #version 450
#define INTEGRATED_GRAPHICS_COMPATIBILITY_MODE #define INTEGRATED_GRAPHICS_COMPATIBILITY_MODE
#include "crt-royale-geometry-aa-last-pass.h" #include "crt-royale-geometry-aa-last-pass.h"

View File

@ -115,7 +115,8 @@ float2x2 mul_scale(float2 scale, float2x2 matrix)
{ {
//float2x2 scale_matrix = float2x2(scale.x, 0.0, 0.0, scale.y); //float2x2 scale_matrix = float2x2(scale.x, 0.0, 0.0, scale.y);
//return mul(scale_matrix, matrix); //return mul(scale_matrix, matrix);
return float2x2(float4(matrix[0][0],matrix[0][1],matrix[1][0],matrix[1][1]) * scale.xxyy); vec4 temp_matrix = (vec4(matrix[0][0], matrix[0][1], matrix[1][0], matrix[1][1])* scale . xxyy);
return mat2x2(temp_matrix.x, temp_matrix.y, temp_matrix.z, temp_matrix.w);
} }
#pragma stage vertex #pragma stage vertex

View File

@ -1,3 +1,3 @@
#version 450 #version 450
#include "crt-royale-geometry-aa-last-pass.h" #include "crt-royale-geometry-aa-last-pass.h"

View File

@ -1,2 +1,2 @@
#version 450 #version 450
#include "crt-royale-scanlines-horizontal-apply-mask.h" #include "crt-royale-scanlines-horizontal-apply-mask.h"

View File

@ -565,7 +565,7 @@ float3 tex2Daa4x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0,1.0,1.0)/(w_sum); const float3 w_sum_inv = float3(1.0,1.0,1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -612,7 +612,7 @@ float3 tex2Daa5x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w0 + w1 + w2 + w3 + w4); const float3 w_sum_inv = float3(1.0)/(w0 + w1 + w2 + w3 + w4);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -665,7 +665,7 @@ float3 tex2Daa6x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w_sum); const float3 w_sum_inv = float3(1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -721,7 +721,7 @@ float3 tex2Daa7x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w_sum); const float3 w_sum_inv = float3(1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -781,7 +781,7 @@ float3 tex2Daa8x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w_sum); const float3 w_sum_inv = float3(1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, and mirror on odd frames if directed: // Get uv sample offsets, and mirror on odd frames if directed:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
const float2 uv_offset0 = mul(true_pixel_to_tex_uv, xy_offset0 * frame_sign); const float2 uv_offset0 = mul(true_pixel_to_tex_uv, xy_offset0 * frame_sign);
@ -853,7 +853,7 @@ float3 tex2Daa12x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/w_sum; const float3 w_sum_inv = float3(1.0)/w_sum;
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -943,7 +943,7 @@ float3 tex2Daa16x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w_sum); const float3 w_sum_inv = float3(1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -1050,7 +1050,7 @@ float3 tex2Daa20x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w_sum); const float3 w_sum_inv = float3(1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -1175,7 +1175,7 @@ float3 tex2Daa24x(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w_sum); const float3 w_sum_inv = float3(1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, mirror on odd frames if directed, and exploit // Get uv sample offsets, mirror on odd frames if directed, and exploit
// diagonal symmetry: // diagonal symmetry:
const float2 frame_sign = get_frame_sign(frame); const float2 frame_sign = get_frame_sign(frame);
@ -1272,7 +1272,7 @@ float3 tex2Daa_debug_16x_regular(const sampler2D tex, const float2 tex_uv,
const float3 w_sum_inv = float3(1.0)/(w_sum); const float3 w_sum_inv = float3(1.0)/(w_sum);
// Scale the pixel-space to texture offset matrix by the pixel diameter. // Scale the pixel-space to texture offset matrix by the pixel diameter.
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
// Get uv sample offsets, taking advantage of row alignment: // Get uv sample offsets, taking advantage of row alignment:
const float2 uv_step_x = mul(true_pixel_to_tex_uv, float2(xy_step.x, 0.0)); const float2 uv_step_x = mul(true_pixel_to_tex_uv, float2(xy_step.x, 0.0));
const float2 uv_step_y = mul(true_pixel_to_tex_uv, float2(0.0, xy_step.y)); const float2 uv_step_y = mul(true_pixel_to_tex_uv, float2(0.0, xy_step.y));
@ -1321,7 +1321,7 @@ float3 tex2Daa_debug_dynamic(const sampler2D tex, const float2 tex_uv,
const float2 sample0_filter_space_offset = const float2 sample0_filter_space_offset =
-grid_radius_in_samples * filter_space_offset_step; -grid_radius_in_samples * filter_space_offset_step;
// Compute xy sample offsets and subpixel weights: // Compute xy sample offsets and subpixel weights:
float3 weights[grid_size * grid_size]; float3 weights[64]; // grid_size * grid_size
float3 weight_sum = float3(0.0, 0.0, 0.0); float3 weight_sum = float3(0.0, 0.0, 0.0);
for(int i = 0; i < grid_size; ++i) for(int i = 0; i < grid_size; ++i)
{ {
@ -1337,7 +1337,7 @@ float3 tex2Daa_debug_dynamic(const sampler2D tex, const float2 tex_uv,
} }
// Get uv offset vectors along x and y directions: // Get uv offset vectors along x and y directions:
const float2x2 true_pixel_to_tex_uv = const float2x2 true_pixel_to_tex_uv =
float2x2(float4(pixel_to_tex_uv * aa_pixel_diameter)); float2x2((pixel_to_tex_uv * aa_pixel_diameter));
const float2 uv_offset_step_x = mul(true_pixel_to_tex_uv, const float2 uv_offset_step_x = mul(true_pixel_to_tex_uv,
float2(filter_space_offset_step.x, 0.0)); float2(filter_space_offset_step.x, 0.0));
const float2 uv_offset_step_y = mul(true_pixel_to_tex_uv, const float2 uv_offset_step_y = mul(true_pixel_to_tex_uv,

View File

@ -35,7 +35,7 @@ layout(set = 0, binding = 2) uniform sampler2D Source;
precision lowp float; precision lowp float;
const mat3 GBCMatrix = mat3( 0.924, 0.021, 0.013, 0.048, 0.787, 0.249, 0.104, 0.09, 0.733 ) const mat3 GBCMatrix = mat3( 0.924, 0.021, 0.013, 0.048, 0.787, 0.249, 0.104, 0.09, 0.733 );
void main() void main()
{ {

View File

@ -133,14 +133,18 @@ float2 tex = vTexCoord + float2(0.0, 0.25*params.SourceSize.w);
*/ */
//Define window and directions - original //Define window and directions - original
float2 dir[4] = {{-1,-1},{1,1},{-1,1},{1,-1}}; vec2 dir[4] = vec2[4](vec2(-1,-1),vec2(1,1),vec2(-1,1),vec2(1,-1));
float4x2 wind[4] = {{{-1,-1},{1,1},{-1,1},{1,-1}},{{-3,-1},{3,1},{-1,3},{1,-3}},{{-3,1},{3,-1},{1,3},{-1,-3}},{{-3,-3},{ 3,3},{-3, 3},{3,-3}}}; mat4x2 wind1 = mat4x2(vec2(-1,-1),vec2(1,1),vec2(-1,1),vec2(1,-1));
mat4x2 wind2 = mat4x2(vec2(-3,-1),vec2(3,1),vec2(-1,3),vec2(1,-3));
mat4x2 wind3 = mat4x2(vec2(-3,1),vec2(3,-1),vec2(1,3),vec2(-1,-3));
mat4x2 wind4 = mat4x2(vec2(-3,-3),vec2( 3,3),vec2(-3, 3),vec2(3,-3));
mat4x2 wind[4] = mat4x2[4](wind1, wind2, wind3, wind4);
//Initialization //Initialization
float2x2 R = float2x2(0.0); float2x2 R = float2x2(0.,0.,0.,0.);
float2 r = float2(0.0); float2 r = float2(0.,0.);
float m[4] = {NEDI_WEIGHT, 1.0, 1.0, 1.0}; float m[4] = float[4](NEDI_WEIGHT, 1.0, 1.0, 1.0);
//Calculate (local) autocorrelation coefficients //Calculate (local) autocorrelation coefficients
for (int k = 0; k<ITERATIONS; k+= 1){ for (int k = 0; k<ITERATIONS; k+= 1){

View File

@ -114,10 +114,15 @@ float2 tex = vTexCoord;
float4 c0 = tex2D(s0,tex); float4 c0 = tex2D(s0,tex);
//Define window and directions //Define window and directions
float2 dir[4] = {{-1,0},{1,0},{0,1},{0,-1}}; vec2 dir[4] = vec2[4](vec2(-1,0),vec2(1,0),vec2(0,1),vec2(0,-1));
float4x2 wind[7] = {{{-1,0},{1,0},{0,1},{0,-1}},{{-2,-1},{2,1},{-1,2},{1,-2}},{{-3,-2},{3,2},{-2,3},{2,-3}}, mat4x2 wind1 = mat4x2(vec2(-1,0),vec2(1,0),vec2(0,1),vec2(0,-1));
{{-2,1},{2,-1},{1,2},{-1,-2}},{{-3,2},{3,-2},{2,3},{-2,-3}}, mat4x2 wind2 = mat4x2(vec2(-2,-1),vec2(2,1),vec2(-1,2),vec2(1,-2));
{{-4,-1},{4,1},{-1,4},{1,-4}},{{-4,1},{4,-1},{1,4},{-1,-4}}}; mat4x2 wind3 = mat4x2(vec2(-3,-2),vec2(3,2),vec2(-2,3),vec2(2,-3));
mat4x2 wind4 = mat4x2(vec2(-2,1),vec2(2,-1),vec2(1,2),vec2(-1,-2));
mat4x2 wind5 = mat4x2(vec2(-3,2),vec2(3,-2),vec2(2,3),vec2(-2,-3));
mat4x2 wind6 = mat4x2(vec2(-4,-1),vec2(4,1),vec2(-1,4),vec2(1,-4));
mat4x2 wind7 = mat4x2(vec2(-4,1),vec2(4,-1),vec2(1,4),vec2(-1,-4));
mat4x2 wind[7] = mat4x2[7](wind1, wind2, wind3, wind4, wind5, wind6, wind7);
/* /*
wind[1] wind[2] wind[1] wind[2]
@ -142,10 +147,10 @@ float2 tex = vTexCoord;
*/ */
//Initialization //Initialization
float2x2 R = float2x2(0.0); float2x2 R = float2x2(0.,0.,0.,0.);
float2 r = float2(0.0); float2 r = float2(0.,0.);
float m[7] = {NEDI_WEIGHT2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; float m[7] = float[7](NEDI_WEIGHT2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
//Calculate (local) autocorrelation coefficients //Calculate (local) autocorrelation coefficients
for (int k = 0; k<ITERATIONS; k+= 1){ for (int k = 0; k<ITERATIONS; k+= 1){

View File

@ -131,12 +131,16 @@ void main()
*/ */
//Define window and directions //Define window and directions
float2 dir[4] = {{-1,-1},{1,1},{-1,1},{1,-1}}; vec2 dir[4] = vec2[4](vec2(-1,-1),vec2(1,1),vec2(-1,1),vec2(1,-1));
float4x2 wind[4] = {{{-1,-1},{1,1},{-1,1},{1,-1}},{{-3,-1},{3,1},{-1,3},{1,-3}},{{-3,1},{3,-1},{1,3},{-1,-3}},{{-3,-3},{ 3,3},{-3, 3},{3,-3}}}; mat4x2 wind1 = mat4x2(vec2(-1,-1),vec2(1,1),vec2(-1,1),vec2(1,-1));
mat4x2 wind2 = mat4x2(vec2(-3,-1),vec2(3,1),vec2(-1,3),vec2(1,-3));
mat4x2 wind3 = mat4x2(vec2(-3,1),vec2(3,-1),vec2(1,3),vec2(-1,-3));
mat4x2 wind4 = mat4x2(vec2(-3,-3),vec2( 3,3),vec2(-3, 3),vec2(3,-3));
mat4x2 wind[4] = mat4x2[4](wind1, wind2, wind3, wind4);
//Initialization //Initialization
float2x2 R = float2x2(0.0); float2x2 R = float2x2(vec2(0.,0.),vec2(0.,0.));
float2 r = float2(0.0); float2 r = float2(0.,0.);
//Calculate (local) autocorrelation coefficients //Calculate (local) autocorrelation coefficients
for (int k = 0; k<ITERATIONS; k+= 1){ for (int k = 0; k<ITERATIONS; k+= 1){

View File

@ -103,7 +103,7 @@ void main()
// determine subpixel // determine subpixel
vec2 fp = floor(3.0 * fract(vTexCoord*SourceSize.xy)); vec2 fp = floor(3.0 * fract(vTexCoord*SourceSize.xy));
float sp = fp.y == 0 ? (fp.x == 0 ? crn.x : fp.x == 1 ? mid.x : crn.y) : (fp.y == 1 ? (fp.x == 0 ? mid.w : fp.x == 1 ? 0 : mid.y) : (fp.x == 0 ? crn.w : fp.x == 1 ? mid.z : crn.z)); float sp = fp.y == 0. ? (fp.x == 0. ? crn.x : fp.x == 1. ? mid.x : crn.y) : (fp.y == 1. ? (fp.x == 0. ? mid.w : fp.x == 1. ? 0. : mid.y) : (fp.x == 0. ? crn.w : fp.x == 1. ? mid.z : crn.z));
// output coordinate - 0 = E, 1 = D, 2 = D0, 3 = F, 4 = F0, 5 = B, 6 = B0, 7 = H, 8 = H0 // output coordinate - 0 = E, 1 = D, 2 = D0, 3 = F, 4 = F0, 5 = B, 6 = B0, 7 = H, 8 = H0
vec2 res = sp == 0 ? vec2(0,0) : sp == 1 ? vec2(-1,0) : sp == 2 ? vec2(-2,0) : sp == 3 ? vec2(1,0) : sp == 4 ? vec2(2,0) : sp == 5 ? vec2(0,-1) : sp == 6 ? vec2(0,-2) : sp == 7 ? vec2(0,1) : vec2(0,2); vec2 res = sp == 0 ? vec2(0,0) : sp == 1 ? vec2(-1,0) : sp == 2 ? vec2(-2,0) : sp == 3 ? vec2(1,0) : sp == 4 ? vec2(2,0) : sp == 5 ? vec2(0,-1) : sp == 6 ? vec2(0,-2) : sp == 7 ? vec2(0,1) : vec2(0,2);

View File

@ -103,7 +103,7 @@ void main()
// determine subpixel // determine subpixel
vec2 fp = floor(3.0 * fract(vTexCoord*SourceSize.xy)); vec2 fp = floor(3.0 * fract(vTexCoord*SourceSize.xy));
float sp = fp.y == 0 ? (fp.x == 0 ? crn.x : fp.x == 1 ? mid.x : crn.y) : (fp.y == 1 ? (fp.x == 0 ? mid.w : fp.x == 1 ? 0 : mid.y) : (fp.x == 0 ? crn.w : fp.x == 1 ? mid.z : crn.z)); float sp = fp.y == 0. ? (fp.x == 0. ? crn.x : fp.x == 1. ? mid.x : crn.y) : (fp.y == 1. ? (fp.x == 0. ? mid.w : fp.x == 1. ? 0. : mid.y) : (fp.x == 0. ? crn.w : fp.x == 1. ? mid.z : crn.z));
// output coordinate - 0 = E, 1 = D, 2 = D0, 3 = F, 4 = F0, 5 = B, 6 = B0, 7 = H, 8 = H0 // output coordinate - 0 = E, 1 = D, 2 = D0, 3 = F, 4 = F0, 5 = B, 6 = B0, 7 = H, 8 = H0
vec2 res = sp == 0 ? vec2(0,0) : sp == 1 ? vec2(-1,0) : sp == 2 ? vec2(-2,0) : sp == 3 ? vec2(1,0) : sp == 4 ? vec2(2,0) : sp == 5 ? vec2(0,-1) : sp == 6 ? vec2(0,-2) : sp == 7 ? vec2(0,1) : vec2(0,2); vec2 res = sp == 0 ? vec2(0,0) : sp == 1 ? vec2(-1,0) : sp == 2 ? vec2(-2,0) : sp == 3 ? vec2(1,0) : sp == 4 ? vec2(2,0) : sp == 5 ? vec2(0,-1) : sp == 6 ? vec2(0,-2) : sp == 7 ? vec2(0,1) : vec2(0,2);

View File

@ -81,8 +81,8 @@ layout(binding = 1) uniform sampler2D Source;
float str(float d, vec2 a, vec2 b){ float str(float d, vec2 a, vec2 b){
float diff = a.x - a.y; float diff = a.x - a.y;
float wght1 = max(params.SFX_CLR - d, 0) / params.SFX_CLR; float wght1 = max(params.SFX_CLR - d, 0) / params.SFX_CLR;
float wght2 = clamp((1-d) + (min(a.x, b.x) + a.x > min(a.y, b.y) + a.y ? diff : -diff), 0, 1); float wght2 = clamp((1-d) + (min(a.x, b.x) + a.x > min(a.y, b.y) + a.y ? diff : -diff), 0., 1.);
return (params.SFX_SAA == 1 || 2*d < a.x + a.y) ? (wght1 * wght2) * (a.x * a.y) : 0; return (params.SFX_SAA == 1. || 2.*d < a.x + a.y) ? (wght1 * wght2) * (a.x * a.y) : 0.;
} }

View File

@ -60,7 +60,7 @@ layout(location = 0) out vec2 vTexCoord;
void main() void main()
{ {
gl_Position = global.MVP * Position; gl_Position = global.MVP * Position;
vTexCoord = TexCoord*1.0001;; vTexCoord = TexCoord*1.0001;
} }
@ -84,7 +84,7 @@ vec4 dom(vec3 x, vec3 y, vec3 z, vec3 w){
// necessary but not sufficient junction condition for orthogonal edges // necessary but not sufficient junction condition for orthogonal edges
float clear(vec2 crn, vec2 a, vec2 b){ float clear(vec2 crn, vec2 a, vec2 b){
return (crn.x >= max(min(a.x, a.y), min(b.x, b.y))) && (crn.y >= max(min(a.x, b.y), min(b.x, a.y))) ? 1 : 0; return (crn.x >= max(min(a.x, a.y), min(b.x, b.y))) && (crn.y >= max(min(a.x, b.y), min(b.x, a.y))) ? 1. : 0.;
} }

View File

@ -139,12 +139,12 @@ void main()
vec3 D0 = TEX(-1, 0), D1 = TEX(-2, 0), F0 = TEX( 1, 0), F1 = TEX( 2, 0); vec3 D0 = TEX(-1, 0), D1 = TEX(-2, 0), F0 = TEX( 1, 0), F1 = TEX( 2, 0);
// output coordinate - 0 = E0, 1 = D0, 2 = D1, 3 = F0, 4 = F1, 5 = B0, 6 = B1, 7 = H0, 8 = H1 // output coordinate - 0 = E0, 1 = D0, 2 = D1, 3 = F0, 4 = F1, 5 = B0, 6 = B1, 7 = H0, 8 = H1
vec3 sfx = res.x == 1 ? D0 : res.x == 2 ? D1 : res.x == 3 ? F0 : res.x == 4 ? F1 : res.x == 5 ? B0 : res.x == 6 ? B1 : res.x == 7 ? H0 : H1; vec3 sfx = res.x == 1. ? D0 : res.x == 2. ? D1 : res.x == 3. ? F0 : res.x == 4. ? F1 : res.x == 5. ? B0 : res.x == 6. ? B1 : res.x == 7. ? H0 : H1;
// rAA weight // rAA weight
vec2 w = 2 * fc - 1; vec2 w = 2. * fc - 1.;
w.x = res.y == 0 ? w.x : 0; w.x = res.y == 0. ? w.x : 0.;
w.y = res.z == 0 ? w.y : 0; w.y = res.z == 0. ? w.y : 0.;
// rAA filter // rAA filter
vec3 t1 = res2x(D1, D0, E0, F0, F1); vec3 t1 = res2x(D1, D0, E0, F0, F1);
@ -155,5 +155,5 @@ void main()
vec3 raa = clamp(E0 + w.x*t1 + w.y*t2, a, b); vec3 raa = clamp(E0 + w.x*t1 + w.y*t2, a, b);
// hybrid output // hybrid output
FragColor = vec4((res.x != 0) ? sfx : raa, 0); FragColor = vec4((res.x != 0.) ? sfx : raa, 0.);
} }

View File

@ -104,10 +104,10 @@ void main()
// determine subpixel // determine subpixel
vec2 fp = floor(3.0 * fract(vTexCoord * params.SourceSize.xy)); vec2 fp = floor(3.0 * fract(vTexCoord * params.SourceSize.xy));
float sp = fp.y == 0 ? (fp.x == 0 ? crn.x : fp.x == 1 ? mid.x : crn.y) : (fp.y == 1 ? (fp.x == 0 ? mid.w : fp.x == 1 ? 0 : mid.y) : (fp.x == 0 ? crn.w : fp.x == 1 ? mid.z : crn.z)); float sp = fp.y == 0. ? (fp.x == 0. ? crn.x : fp.x == 1. ? mid.x : crn.y) : (fp.y == 1. ? (fp.x == 0. ? mid.w : fp.x == 1. ? 0. : mid.y) : (fp.x == 0. ? crn.w : fp.x == 1. ? mid.z : crn.z));
// output coordinate - 0 = E, 1 = D, 2 = D0, 3 = F, 4 = F0, 5 = B, 6 = B0, 7 = H, 8 = H0 // output coordinate - 0 = E, 1 = D, 2 = D0, 3 = F, 4 = F0, 5 = B, 6 = B0, 7 = H, 8 = H0
vec2 res = sp == 0 ? vec2(0,0) : sp == 1 ? vec2(-1,0) : sp == 2 ? vec2(-2,0) : sp == 3 ? vec2(1,0) : sp == 4 ? vec2(2,0) : sp == 5 ? vec2(0,-1) : sp == 6 ? vec2(0,-2) : sp == 7 ? vec2(0,1) : vec2(0,2); vec2 res = sp == 0. ? vec2(0,0) : sp == 1. ? vec2(-1,0) : sp == 2. ? vec2(-2,0) : sp == 3. ? vec2(1,0) : sp == 4. ? vec2(2,0) : sp == 5. ? vec2(0,-1) : sp == 6. ? vec2(0,-2) : sp == 7. ? vec2(0,1) : vec2(0,2);
// ouput // ouput
FragColor = texture(refpass, vTexCoord + res / params.SourceSize.xy); FragColor = texture(refpass, vTexCoord + res / params.SourceSize.xy);