eden/.patch/sgsr/0001-fix-glsl.patch

147 lines
5.7 KiB
Diff

diff --git a/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag b/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag
index 7074999..c23aae4 100644
--- a/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag
+++ b/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag
@@ -1,4 +1,4 @@
-#version 300 es
+#version 460 core
//============================================================================================================
//
@@ -34,17 +34,17 @@ precision highp int;
////////////////////////
#if defined(UseUniformBlock)
-layout (set=0, binding = 0) uniform UniformBlock
-{
- highp vec4 ViewportInfo[1];
+layout( push_constant ) uniform constants {
+ highp vec4 ViewportInfo[1];
+ highp vec2 ResizeFactor;
};
-layout(set = 0, binding = 1) uniform mediump sampler2D ps0;
+layout(set = 0, binding = 0) uniform mediump sampler2D ps0;
#else
uniform highp vec4 ViewportInfo[1];
uniform mediump sampler2D ps0;
#endif
-layout(location=0) in highp vec4 in_TEXCOORD0;
+layout(location=0) in highp vec2 in_TEXCOORD0;
layout(location=0) out vec4 out_Target0;
float fastLanczos2(float x)
@@ -63,15 +63,15 @@ vec2 weightY(float dx, float dy,float c, float std)
void main()
{
- int mode = OperationMode;
- float edgeThreshold = EdgeThreshold;
- float edgeSharpness = EdgeSharpness;
+ const int mode = OperationMode;
+ const float edgeThreshold = EdgeThreshold;
+ const float edgeSharpness = EdgeSharpness;
vec4 color;
if(mode == 1)
- color.xyz = textureLod(ps0,in_TEXCOORD0.xy,0.0).xyz;
+ color.xyz = textureLod(ps0, in_TEXCOORD0.xy, 0.0).xyz;
else
- color.xyzw = textureLod(ps0,in_TEXCOORD0.xy,0.0).xyzw;
+ color.xyzw = textureLod(ps0, in_TEXCOORD0.xy, 0.0).xyzw;
highp float xCenter;
xCenter = abs(in_TEXCOORD0.x+-0.5);
@@ -82,21 +82,24 @@ void main()
//if ( mode!=4 && xCenter*xCenter+yCenter*yCenter<=0.4 * 0.4)
if ( mode!=4)
{
- highp vec2 imgCoord = ((in_TEXCOORD0.xy*ViewportInfo[0].zw)+vec2(-0.5,0.5));
+ highp vec2 imgCoord = ((in_TEXCOORD0.xy * ViewportInfo[0].zw) + vec2(-0.5,0.5));
highp vec2 imgCoordPixel = floor(imgCoord);
- highp vec2 coord = (imgCoordPixel*ViewportInfo[0].xy);
- vec2 pl = (imgCoord+(-imgCoordPixel));
- vec4 left = textureGather(ps0,coord, mode);
+ highp vec2 coord = imgCoordPixel * ViewportInfo[0].xy;
+ vec2 pl = imgCoord - imgCoordPixel;
+ vec4 left = textureGather(ps0, coord, mode);
float edgeVote = abs(left.z - left.y) + abs(color[mode] - left.y) + abs(color[mode] - left.z) ;
if(edgeVote > edgeThreshold)
{
coord.x += ViewportInfo[0].x;
- vec4 right = textureGather(ps0,coord + highp vec2(ViewportInfo[0].x, 0.0), mode);
+ highp vec2 IR_highp_vec2_0 = coord + vec2(ViewportInfo[0].x, 0.0);
+ vec4 right = textureGather(ps0, IR_highp_vec2_0, mode);
vec4 upDown;
- upDown.xy = textureGather(ps0,coord + highp vec2(0.0, -ViewportInfo[0].y),mode).wz;
- upDown.zw = textureGather(ps0,coord+ highp vec2(0.0, ViewportInfo[0].y), mode).yx;
+ highp vec2 IR_highp_vec2_1 = coord + vec2(0.0, -ViewportInfo[0].y);
+ upDown.xy = textureGather(ps0, IR_highp_vec2_1, mode).wz;
+ highp vec2 IR_highp_vec2_2 = coord + vec2(0.0, ViewportInfo[0].y);
+ upDown.zw = textureGather(ps0, IR_highp_vec2_2, mode).yx;
float mean = (left.y+left.z+right.x+right.w)*0.25;
left = left - vec4(mean);
diff --git a/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag b/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag
index d2df646..8b64497 100644
--- a/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag
+++ b/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag
@@ -1,4 +1,4 @@
-#version 300 es
+#version 460 core
//============================================================================================================
//
@@ -40,17 +40,17 @@ precision highp int;
////////////////////////
#if defined(UseUniformBlock)
-layout (set=0, binding = 0) uniform UniformBlock
-{
- highp vec4 ViewportInfo[1];
+layout( push_constant ) uniform constants {
+ highp vec4 ViewportInfo[1];
+ highp vec2 ResizeFactor;
};
-layout(set = 0, binding = 1) uniform mediump sampler2D ps0;
+layout(set = 0, binding = 0) uniform mediump sampler2D ps0;
#else
uniform highp vec4 ViewportInfo[1];
uniform mediump sampler2D ps0;
#endif
-layout(location=0) in highp vec4 in_TEXCOORD0;
+layout(location=0) in highp vec2 in_TEXCOORD0;
layout(location=0) out vec4 out_Target0;
float fastLanczos2(float x)
@@ -116,18 +116,21 @@ void main()
highp vec2 imgCoord = ((in_TEXCOORD0.xy*ViewportInfo[0].zw)+vec2(-0.5,0.5));
highp vec2 imgCoordPixel = floor(imgCoord);
highp vec2 coord = (imgCoordPixel*ViewportInfo[0].xy);
- vec2 pl = (imgCoord+(-imgCoordPixel));
- vec4 left = textureGather(ps0,coord, OperationMode);
+ vec2 pl = imgCoord - imgCoordPixel;
+ vec4 left = textureGather(ps0, coord, OperationMode);
float edgeVote = abs(left.z - left.y) + abs(color[OperationMode] - left.y) + abs(color[OperationMode] - left.z) ;
if(edgeVote > EdgeThreshold)
{
coord.x += ViewportInfo[0].x;
- vec4 right = textureGather(ps0,coord + highp vec2(ViewportInfo[0].x, 0.0), OperationMode);
+ highp vec2 IR_highp_vec2_0 = coord + vec2(ViewportInfo[0].x, 0.0);
+ vec4 right = textureGather(ps0, IR_highp_vec2_0, OperationMode);
vec4 upDown;
- upDown.xy = textureGather(ps0,coord + highp vec2(0.0, -ViewportInfo[0].y),OperationMode).wz;
- upDown.zw = textureGather(ps0,coord+ highp vec2(0.0, ViewportInfo[0].y), OperationMode).yx;
+ highp vec2 IR_highp_vec2_1 = coord + vec2(0.0, -ViewportInfo[0].y);
+ upDown.xy = textureGather(ps0, IR_highp_vec2_1, OperationMode).wz;
+ highp vec2 IR_highp_vec2_2 = coord + vec2(0.0, ViewportInfo[0].y);
+ upDown.zw = textureGather(ps0, IR_highp_vec2_2, OperationMode).yx;
float mean = (left.y+left.z+right.x+right.w)*0.25;
left = left - vec4(mean);