Fix shader errors and shader cleanup

Since I wanted to make sure that I didn't broke the shaders after converting the shaders to Vulkan, we need to check if all the shaders weren't broken. Since we're talking about like 400 shaders checking all of them is pretty much impossible and even then, 

So, the obvious solution was to automate the checking. Not as simple as you'd think, because in 300 of our shaders we use preset variables which without replacing the value like Cemu does, will make the shader error regardless. So I also implemented some functionality that would read the preset values and types out of the rules.txt file and replace them in the shaders using that information. And then we use Khronos' glslang to compile the shaders, using both OpenGL and Vulkan.

The result was that glslang found quite a few errors in some of the shaders, which I fixed in this commit. I'm considering adding this rules.txt parsing and automated shader compilation testing to the build process.

Also, I fixed Clarity's name and description since Monochromia isn't available anymore and Xenoblade's resolution pack had a lot of weird blank lines before their #version declaration, which my converter didn't like.
This commit is contained in:
Crementif 2019-11-29 00:51:00 +01:00
parent f48cb6aa76
commit 077f4f8f27
No known key found for this signature in database
GPG Key ID: 11A98E7DE0412B33
46 changed files with 10 additions and 56 deletions

View File

@ -3,7 +3,7 @@
#extension GL_ARB_separate_shader_objects : enable
// shader 93bde02ae446a30f//lens dirt
const float lensDirt = $lensDirt;
const float lensDirt = 1.0;
uniform ivec4 uf_remappedPS[1];
uniform float uf_alphaTestRef;

View File

@ -1,8 +1,8 @@
[Definition]
titleIds = 00050000101C9300,00050000101C9400,00050000101C9500
name = "Clarity (NOT COMPATIBLE WITH MONOCHROMIA)"
name = "Clarity"
path = "The Legend of Zelda: Breath of the Wild/Enhancements/Clarity"
description = NOT COMPATIBLE WITH MONOCHROMIA! Select the visual look of the game that you'll like with these hand-made presets that adjusts saturation, vibrance, colors and more. You can select a preset. Selecting "User-Defined" requires making your own preset. check the "BreathOfTheWild_Clarity/37040a485a29d54e_00000000000003c9_ps.txt" file in your graphicPacks folder to create one.
description = Select the visual look of the game that you'll like with these hand-made presets that adjusts saturation, vibrance, colors and more. You can select a preset. Selecting "User-Defined" requires making your own preset. check the "BreathOfTheWild_Clarity/37040a485a29d54e_00000000000003c9_ps.txt" file in your graphicPacks folder to create one.
version = 4
[Preset]

View File

@ -1,7 +1,6 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
#extension GL_EXT_gpu_shader4 : enable
// shader 9e9abde99f9510dc
uniform float uf_alphaTestRef;
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf489e000 res 1280x720x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 0 border: 0
@ -48,7 +47,7 @@ R1i = floatBitsToInt(passParameterSem128);
R5i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.zw)).xyz);
R6i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).xyz);
ivec2 resolution = textureSize2D(textureUnitPS0,0);
ivec2 resolution = textureSize(textureUnitPS0,0);
float iresX = float(resolution.x)/float(1280);
float iresY = float(resolution.y)/float(720);

View File

@ -5,8 +5,8 @@
//float dither = $dither ;
//float scaleShader = $scaleShader;
float scaleBlur = ($scaleBlur); //0.25 4k
int sampleScale = 2;
float scaleBlur = $scaleBlur; //0.25 4k
const int sampleScale = 2;
//float lightBloom = 0.95;

View File

@ -1,7 +1,6 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_packing : enable
// shader dda6656146476243
//Video aspect
const float UI = $UIAspectX;

View File

@ -2,12 +2,11 @@
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
// shader 284b1bf9010d4e57
//const float scaleFactor = ($gameHeight/$height);
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf489f800 res 1280x720x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0
layout(location = 0) in vec4 passParameterSem133;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
const float scaleFactor = uf_fragCoordScale.x;
float scaleFactor = uf_fragCoordScale.x;
int clampFI32(int v)
{
if( v == 0x7FFFFFFF )

View File

@ -7,7 +7,7 @@ layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4c24000 res
layout(location = 0) in vec4 passParameterSem133;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
const float scaleFactor = uf_fragCoordScale.x;
float scaleFactor = uf_fragCoordScale.x;
int clampFI32(int v)
{
if( v == 0x7FFFFFFF )

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,5 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,5 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,5 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,4 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable

View File

@ -1,5 +1,3 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable

View File

@ -1,7 +1,6 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_packing : enable
// shader 2a8afa64e98f2977
layout(binding = 1, std140) uniform uniformBlockVS1
{
@ -36,7 +35,7 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
}
//float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
void main()
{
ivec4 R0i = ivec4(0);

View File

@ -1,7 +1,6 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_packing : enable
// shader 5c0d907ed99903ab
uniform ivec4 uf_remappedVS[9];
uniform vec2 uf_windowSpaceToClipSpaceTransform;
@ -20,7 +19,7 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
}
//float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
void main()
{
ivec4 R0i = ivec4(0);