From 0ab933a267b563c6917b79c2f47736eed7092ee9 Mon Sep 17 00:00:00 2001 From: Crementif <26669564+Crementif@users.noreply.github.com> Date: Fri, 29 Nov 2019 01:14:13 +0100 Subject: [PATCH] Port SMM's Border Fix and XCX's Anti-Aliasing pack to v4 Both had some weird stuff going on which the Vulkan converter couldn't successfully compile. Also, the presets in the anti-aliasing might be nice, but they are not even used in the shader :thinking:. --- .../59df1c7e1806366c_00000000000003c9_ps.txt | 41 +++++++++++++++---- .../XenobladeX_AntiAliasing/rules.txt | 2 +- .../62ef961567454ba5_0000000000000000_vs.txt | 31 +++++++++++++- .../SuperMarioMaker_BorderFix/rules.txt | 2 +- 4 files changed, 64 insertions(+), 12 deletions(-) diff --git a/Enhancements/XenobladeX_AntiAliasing/59df1c7e1806366c_00000000000003c9_ps.txt b/Enhancements/XenobladeX_AntiAliasing/59df1c7e1806366c_00000000000003c9_ps.txt index 2ee21c7b..c8df86b3 100644 --- a/Enhancements/XenobladeX_AntiAliasing/59df1c7e1806366c_00000000000003c9_ps.txt +++ b/Enhancements/XenobladeX_AntiAliasing/59df1c7e1806366c_00000000000003c9_ps.txt @@ -1,5 +1,21 @@ #version 420 #extension GL_ARB_texture_gather : enable +#ifdef VULKAN +#define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation) +#define SET_POSITION(_v) gl_Position = _v; gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0 +#define gl_VertexID gl_VertexIndex +#define gl_InstanceID gl_InstanceIndex +#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw) +#else +#define ATTR_LAYOUT(__vkSet, __location) layout(location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation) +#define SET_POSITION(_v) gl_Position = _v +#endif +// This shaders was auto-converted from OpenGL to Cemu so expect weird code and possible errors. + // shader 59df1c7e1806366c - Anti-aliasing Shader - Dumped 1.14 @@ -9,8 +25,8 @@ #if (preset == 0) // Native AA Disabled -layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 0 +TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1 +TEXTURE_LAYOUT(1, 1, 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1 layout(location = 0) in vec4 passParameterSem0; layout(location = 1) in vec4 passParameterSem1; layout(location = 0) out vec4 passPixelColor0; @@ -32,13 +48,21 @@ passPixelColor0 = texture(textureUnitPS1, passParameterSem1.xy); // textureunitp #if (preset == 1) // Native AA Enabled +#ifdef VULKAN +layout(set = 1, binding = 6) uniform ufBlock +{ uniform ivec4 uf_remappedPS[2]; -layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 0 +uniform vec4 uf_fragCoordScale; +}; +#else +uniform ivec4 uf_remappedPS[2]; +uniform vec2 uf_fragCoordScale; +#endif +TEXTURE_LAYOUT(0, 1, 2) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1 +TEXTURE_LAYOUT(1, 1, 3) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1 layout(location = 0) in vec4 passParameterSem0; layout(location = 1) in vec4 passParameterSem1; layout(location = 0) out vec4 passPixelColor0; -uniform vec2 uf_fragCoordScale; ivec2 resDim = textureSize(textureUnitPS0,0); // Retrieve texture dimensions float resRatio = ( (float(resDim.x)/1280.0) + moreaa ) - lessaa; // retrieve resolution ratio, and calculate the total @@ -1131,12 +1155,13 @@ FxaaFloat4 FxaaPixelShader( //---------------------------------------------------------------------------------- //#version 100 -layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 0 +TEXTURE_LAYOUT(0, 1, 4) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1 +TEXTURE_LAYOUT(1, 1, 5) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1 layout(location = 0) in vec4 passParameterSem0; layout(location = 1) in vec4 passParameterSem1; layout(location = 0) out vec4 passPixelColor0; -uniform vec2 uf_fragCoordScale; + + ivec2 resolution = textureSize(textureUnitPS0,0); // Retrieve Texture Dimensions diff --git a/Enhancements/XenobladeX_AntiAliasing/rules.txt b/Enhancements/XenobladeX_AntiAliasing/rules.txt index a27ecb81..6185ccbb 100644 --- a/Enhancements/XenobladeX_AntiAliasing/rules.txt +++ b/Enhancements/XenobladeX_AntiAliasing/rules.txt @@ -3,7 +3,7 @@ titleIds = 0005000010116100,00050000101C4C00,00050000101C4D00 name = Anti-Aliasing Pack path = "Xenoblade Chronicles X/Enhancements/Anti-Aliasing" description = Enables or Disables Native Anti-Aliasing. Also includes an alternative FXAA implementation. Check the "Anti-Aliasing/rules.txt" file in your Botw AA graphicPack folder for info about the individual settings. -version = 3 +version = 4 [Preset] name = Nvidias FXAA diff --git a/Workarounds/SuperMarioMaker_BorderFix/62ef961567454ba5_0000000000000000_vs.txt b/Workarounds/SuperMarioMaker_BorderFix/62ef961567454ba5_0000000000000000_vs.txt index 775918fa..3511a741 100644 --- a/Workarounds/SuperMarioMaker_BorderFix/62ef961567454ba5_0000000000000000_vs.txt +++ b/Workarounds/SuperMarioMaker_BorderFix/62ef961567454ba5_0000000000000000_vs.txt @@ -1,12 +1,36 @@ #version 420 #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_packing : enable +#ifdef VULKAN +#define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation) +#define SET_POSITION(_v) gl_Position = _v; gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0 +#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw) +#define gl_VertexID gl_VertexIndex +#define gl_InstanceID gl_InstanceIndex +#else +#define ATTR_LAYOUT(__vkSet, __location) layout(location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation) +#define SET_POSITION(_v) gl_Position = _v +#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw) +#endif +// This shaders was auto-converted from OpenGL to Cemu so expect weird code and possible errors. + // shader 62ef961567454ba5 // Used for: Removes the border at the top. +#ifdef VULKAN +layout(set = 0, binding = 0) uniform ufBlock +{ uniform ivec4 uf_uniformRegisterVS[256]; uniform vec2 uf_windowSpaceToClipSpaceTransform; +}; +#else +uniform ivec4 uf_uniformRegisterVS[256]; +uniform vec2 uf_windowSpaceToClipSpaceTransform; +#endif out gl_PerVertex { vec4 gl_Position; @@ -51,6 +75,9 @@ R0i.xyz = ivec3(uf_uniformRegisterVS[ARi.x+0].x,uf_uniformRegisterVS[ARi.x+0].y, R0i.w = uf_uniformRegisterVS[ARi.x+0].w; // export vec4 finalPos = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.w)); -finalPos.xy = finalPos.xy /* * uf_windowSpaceToClipSpaceTransform */- vec2(1.0,1.0);gl_Position = finalPos;// export +finalPos.xy = finalPos.xy /* * uf_windowSpaceToClipSpaceTransform */- vec2(1.0,1.0); + +gl_Position = SET_POSITION(finalPos); + // skipped export to semanticId 255 } diff --git a/Workarounds/SuperMarioMaker_BorderFix/rules.txt b/Workarounds/SuperMarioMaker_BorderFix/rules.txt index bcae0a20..1493d065 100644 --- a/Workarounds/SuperMarioMaker_BorderFix/rules.txt +++ b/Workarounds/SuperMarioMaker_BorderFix/rules.txt @@ -3,4 +3,4 @@ titleIds = 000500001018DB00,000500001018DC00,000500001018DD00 name = Border Fix path = "Super Mario Maker/Workarounds/Border Fix" description = Removes the border from the top of the screen. -version = 3 \ No newline at end of file +version = 4 \ No newline at end of file