From 7b5ff4115d5dad208ead39516b05e13044d4a989 Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 14 Jan 2026 04:10:47 +0000 Subject: [PATCH] fix everything --- .patch/snapdragon_gsr/0001-fix-glsl.patch | 99 +++++++++++++++++++ .patch/snapdragon_gsr/0001-glslang-fix.patch | 61 ------------ .../0002-push-constants-retrofit.patch | 97 ------------------ cpmfile.json | 3 +- src/video_core/host_shaders/CMakeLists.txt | 3 +- 5 files changed, 101 insertions(+), 162 deletions(-) create mode 100644 .patch/snapdragon_gsr/0001-fix-glsl.patch delete mode 100644 .patch/snapdragon_gsr/0001-glslang-fix.patch delete mode 100644 .patch/snapdragon_gsr/0002-push-constants-retrofit.patch diff --git a/.patch/snapdragon_gsr/0001-fix-glsl.patch b/.patch/snapdragon_gsr/0001-fix-glsl.patch new file mode 100644 index 0000000000..794eed8a21 --- /dev/null +++ b/.patch/snapdragon_gsr/0001-fix-glsl.patch @@ -0,0 +1,99 @@ +diff --git a/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag b/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag +index 7074999..2d322fb 100644 +--- a/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag ++++ b/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag +@@ -1,4 +1,5 @@ +-#version 300 es ++#version 310 es ++#extension GL_EXT_spec_constant_composites:require + + //============================================================================================================ + // +@@ -34,11 +35,10 @@ 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]; + }; +-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; +@@ -63,9 +63,9 @@ 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) +@@ -93,10 +93,13 @@ void main() + { + coord.x += ViewportInfo[0].x; + +- vec4 right = textureGather(ps0,coord + highp vec2(ViewportInfo[0].x, 0.0), mode); ++ highp vec2 IR_highp_vec2_0 = vec2(ViewportInfo[0].x, 0.0); ++ vec4 right = textureGather(ps0,coord + 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 = vec2(0.0, -ViewportInfo[0].y); ++ upDown.xy = textureGather(ps0,coord + IR_highp_vec2_1,mode).wz; ++ highp vec2 IR_highp_vec2_2 = vec2(0.0, ViewportInfo[0].y); ++ upDown.zw = textureGather(ps0,coord+ 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..875cdbf 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,5 @@ +-#version 300 es ++#version 310 es ++#extension GL_EXT_spec_constant_composites:require + + //============================================================================================================ + // +@@ -40,11 +41,10 @@ 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]; + }; +-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; +@@ -124,10 +124,13 @@ void main() + { + coord.x += ViewportInfo[0].x; + +- vec4 right = textureGather(ps0,coord + highp vec2(ViewportInfo[0].x, 0.0), OperationMode); ++ highp vec2 IR_highp_vec2_0 = vec2(ViewportInfo[0].x, 0.0); ++ vec4 right = textureGather(ps0,coord + 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 = vec2(0.0, -ViewportInfo[0].y); ++ upDown.xy = textureGather(ps0,coord + IR_highp_vec2_1,OperationMode).wz; ++ highp vec2 IR_highp_vec2_2 = vec2(0.0, ViewportInfo[0].y); ++ upDown.zw = textureGather(ps0,coord+ IR_highp_vec2_2, OperationMode).yx; + + float mean = (left.y+left.z+right.x+right.w)*0.25; + left = left - vec4(mean); diff --git a/.patch/snapdragon_gsr/0001-glslang-fix.patch b/.patch/snapdragon_gsr/0001-glslang-fix.patch deleted file mode 100644 index 2eb0099d64..0000000000 --- a/.patch/snapdragon_gsr/0001-glslang-fix.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff --git a/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag b/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag -index 7074999..69927af 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 320 es - - //============================================================================================================ - // -@@ -63,9 +63,9 @@ 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) -@@ -93,10 +93,10 @@ void main() - { - coord.x += ViewportInfo[0].x; - -- vec4 right = textureGather(ps0,coord + highp vec2(ViewportInfo[0].x, 0.0), mode); -+ vec4 right = textureGather(ps0,coord + vec2(ViewportInfo[0].x, 0.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; -+ upDown.xy = textureGather(ps0,coord + vec2(0.0, -ViewportInfo[0].y),mode).wz; -+ upDown.zw = textureGather(ps0,coord+ vec2(0.0, ViewportInfo[0].y), 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..1f1daa6 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 320 es - - //============================================================================================================ - // -@@ -124,10 +124,10 @@ void main() - { - coord.x += ViewportInfo[0].x; - -- vec4 right = textureGather(ps0,coord + highp vec2(ViewportInfo[0].x, 0.0), OperationMode); -+ vec4 right = textureGather(ps0,coord + vec2(ViewportInfo[0].x, 0.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; -+ upDown.xy = textureGather(ps0,coord + vec2(0.0, -ViewportInfo[0].y),OperationMode).wz; -+ upDown.zw = textureGather(ps0,coord+ vec2(0.0, ViewportInfo[0].y), OperationMode).yx; - - float mean = (left.y+left.z+right.x+right.w)*0.25; - left = left - vec4(mean); diff --git a/.patch/snapdragon_gsr/0002-push-constants-retrofit.patch b/.patch/snapdragon_gsr/0002-push-constants-retrofit.patch deleted file mode 100644 index 7faf70bcc1..0000000000 --- a/.patch/snapdragon_gsr/0002-push-constants-retrofit.patch +++ /dev/null @@ -1,97 +0,0 @@ -diff --git a/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag b/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag -index 69927af..c942bbc 100644 ---- a/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag -+++ b/sgsr/v1/include/glsl/sgsr1_shader_mobile.frag -@@ -34,11 +34,10 @@ 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; - }; --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; -@@ -82,21 +81,21 @@ 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.zw)+vec2(-0.5,0.5)); - highp vec2 imgCoordPixel = floor(imgCoord); -- highp vec2 coord = (imgCoordPixel*ViewportInfo[0].xy); -+ highp vec2 coord = (imgCoordPixel*ViewportInfo.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; -+ coord.x += ViewportInfo.x; - -- vec4 right = textureGather(ps0,coord + vec2(ViewportInfo[0].x, 0.0), mode); -+ vec4 right = textureGather(ps0,coord + vec2(ViewportInfo.x, 0.0), mode); - vec4 upDown; -- upDown.xy = textureGather(ps0,coord + vec2(0.0, -ViewportInfo[0].y),mode).wz; -- upDown.zw = textureGather(ps0,coord+ vec2(0.0, ViewportInfo[0].y), mode).yx; -+ upDown.xy = textureGather(ps0,coord + vec2(0.0, -ViewportInfo.y),mode).wz; -+ upDown.zw = textureGather(ps0,coord+ vec2(0.0, ViewportInfo.y), 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 1f1daa6..128a348 100644 ---- a/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag -+++ b/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag -@@ -40,13 +40,12 @@ 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; - }; --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 highp vec4 ViewportInfo; - uniform mediump sampler2D ps0; - #endif - -@@ -113,21 +112,21 @@ void main() - //if ( OperationMode!=4 && xCenter*xCenter+yCenter*yCenter<=0.4 * 0.4) - if ( OperationMode!=4) - { -- highp vec2 imgCoord = ((in_TEXCOORD0.xy*ViewportInfo[0].zw)+vec2(-0.5,0.5)); -+ highp vec2 imgCoord = ((in_TEXCOORD0.xy*ViewportInfo.zw)+vec2(-0.5,0.5)); - highp vec2 imgCoordPixel = floor(imgCoord); -- highp vec2 coord = (imgCoordPixel*ViewportInfo[0].xy); -+ highp vec2 coord = (imgCoordPixel*ViewportInfo.xy); - 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; -+ coord.x += ViewportInfo.x; - -- vec4 right = textureGather(ps0,coord + vec2(ViewportInfo[0].x, 0.0), OperationMode); -+ vec4 right = textureGather(ps0,coord + vec2(ViewportInfo.x, 0.0), OperationMode); - vec4 upDown; -- upDown.xy = textureGather(ps0,coord + vec2(0.0, -ViewportInfo[0].y),OperationMode).wz; -- upDown.zw = textureGather(ps0,coord+ vec2(0.0, ViewportInfo[0].y), OperationMode).yx; -+ upDown.xy = textureGather(ps0,coord + vec2(0.0, -ViewportInfo.y),OperationMode).wz; -+ upDown.zw = textureGather(ps0,coord+ vec2(0.0, ViewportInfo.y), OperationMode).yx; - - float mean = (left.y+left.z+right.x+right.w)*0.25; - left = left - vec4(mean); diff --git a/cpmfile.json b/cpmfile.json index c3799a7f57..a2cd84d036 100644 --- a/cpmfile.json +++ b/cpmfile.json @@ -126,8 +126,7 @@ "hash": "3940df715189813ffeffa540f48673e999754d53a1dcadc16aab846ef03d57e395e2c8d8e89772bc162835e1686ff6bdb8cae108c1f84404e9e66d993107b76e", "sha": "d926f074bcb9d714e179f1ce0fcb9ee2eeb5074e", "patches": [ - "0001-glslang-fix.patch", - "0002-push-constants-retrofit.patch" + "0001-fix-glsl.patch" ] } } diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index 612f2cfa18..d6b65f03b8 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt @@ -133,7 +133,7 @@ foreach(SOURCE_FILE IN ITEMS ${SHADER_FILES}) OUTPUT ${SPIRV_HEADER_FILE} COMMAND - ${GLSLANGVALIDATOR} -V ${QUIET_FLAG} -DUseUniformBlock=1 ${GLSL_FLAGS} --variable-name ${SPIRV_VARIABLE_NAME} -o ${SPIRV_HEADER_FILE} ${SOURCE_FILE} --target-env ${SPIR_V_VERSION} + ${GLSLANGVALIDATOR} -V ${QUIET_FLAG} -DUseUniformBlock=1 ${GLSL_FLAGS} --variable-name ${SPIRV_VARIABLE_NAME} -o ${SPIRV_HEADER_FILE} ${SOURCE_FILE} --target-env ${SPIR_V_VERSION} --relaxed-errors MAIN_DEPENDENCY ${SOURCE_FILE} ) @@ -197,7 +197,6 @@ list(APPEND SHADER_SOURCES ${GLSL_INCLUDES}) add_custom_target(host_shaders DEPENDS ${SHADER_HEADERS} - snapdragon_gsr SOURCES ${SHADER_SOURCES} )