2017-10-17 23:38:23 +02:00
|
|
|
#version 420
|
|
|
|
#extension GL_ARB_texture_gather : enable
|
Update BotW packs for Vulkan (#411)
But now done properly! Basically, a bunch of improvements were made to the script. The previous attempt at this conversion was quickly followed by a rollback since I realized that the script was overlooking certain things that made most of the packs hit or miss whether they would work. A few things missing were:
- It only tested the values from 1 preset. Now, each shader gets compiled per each preset, like what Cemu would do. It also merges the changes done for each preset into one. This should solve cases where one shader would define things separately or repeatedly from preset to preset.
- All* of the shaders are tested to see if they use the converter used the right values for the locations for Vulkan.
Both of these *should* mean that they should both compile and be linkable in Vulkan, which means that I don't have to test each individual shader to see if they work. I will release the two scripts (one used for converting, one used for checking the right values for the locations) tomorrow so that other people might be able to help, if they want. It's fairly straightforward now at least.
* Organize workaround graphic packs
Pretty hard to organize these correctly, but according to our discord discussion, this was the best layout from a bunch I proposed, together with some suggestions.
* Add V4 converter script and instructions on how to use it
Now everyone BotW is done and all of the bugs have been kinked out using it (hopefully...), here's the release of the converter script in all of it's very badly coded glory. I hope I didn't leave too much debug glory in there...
Also, I hope that I didn't make too many grammatical mistakes in the instructions, but hopefully it's easy enough to follow.
2019-12-28 05:55:52 +01:00
|
|
|
#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
|
2020-01-05 04:16:42 +01:00
|
|
|
// This shader was automatically converted to be cross-compatible with Vulkan and OpenGL.
|
Update BotW packs for Vulkan (#411)
But now done properly! Basically, a bunch of improvements were made to the script. The previous attempt at this conversion was quickly followed by a rollback since I realized that the script was overlooking certain things that made most of the packs hit or miss whether they would work. A few things missing were:
- It only tested the values from 1 preset. Now, each shader gets compiled per each preset, like what Cemu would do. It also merges the changes done for each preset into one. This should solve cases where one shader would define things separately or repeatedly from preset to preset.
- All* of the shaders are tested to see if they use the converter used the right values for the locations for Vulkan.
Both of these *should* mean that they should both compile and be linkable in Vulkan, which means that I don't have to test each individual shader to see if they work. I will release the two scripts (one used for converting, one used for checking the right values for the locations) tomorrow so that other people might be able to help, if they want. It's fairly straightforward now at least.
* Organize workaround graphic packs
Pretty hard to organize these correctly, but according to our discord discussion, this was the best layout from a bunch I proposed, together with some suggestions.
* Add V4 converter script and instructions on how to use it
Now everyone BotW is done and all of the bugs have been kinked out using it (hopefully...), here's the release of the converter script in all of it's very badly coded glory. I hope I didn't leave too much debug glory in there...
Also, I hope that I didn't make too many grammatical mistakes in the instructions, but hopefully it's easy enough to follow.
2019-12-28 05:55:52 +01:00
|
|
|
|
2017-10-17 23:38:23 +02:00
|
|
|
// shader bb50d2ee4fa87bc2
|
2018-10-31 11:03:04 +01:00
|
|
|
// Used for: Horizontal+Vertical Combat Targeting Blur
|
2019-10-08 05:10:02 +02:00
|
|
|
const float resXScale = float($width)/float($gameWidth);
|
|
|
|
const float resYScale = float($height)/float($gameHeight);
|
2017-10-17 23:38:23 +02:00
|
|
|
|
Update BotW packs for Vulkan (#411)
But now done properly! Basically, a bunch of improvements were made to the script. The previous attempt at this conversion was quickly followed by a rollback since I realized that the script was overlooking certain things that made most of the packs hit or miss whether they would work. A few things missing were:
- It only tested the values from 1 preset. Now, each shader gets compiled per each preset, like what Cemu would do. It also merges the changes done for each preset into one. This should solve cases where one shader would define things separately or repeatedly from preset to preset.
- All* of the shaders are tested to see if they use the converter used the right values for the locations for Vulkan.
Both of these *should* mean that they should both compile and be linkable in Vulkan, which means that I don't have to test each individual shader to see if they work. I will release the two scripts (one used for converting, one used for checking the right values for the locations) tomorrow so that other people might be able to help, if they want. It's fairly straightforward now at least.
* Organize workaround graphic packs
Pretty hard to organize these correctly, but according to our discord discussion, this was the best layout from a bunch I proposed, together with some suggestions.
* Add V4 converter script and instructions on how to use it
Now everyone BotW is done and all of the bugs have been kinked out using it (hopefully...), here's the release of the converter script in all of it's very badly coded glory. I hope I didn't leave too much debug glory in there...
Also, I hope that I didn't make too many grammatical mistakes in the instructions, but hopefully it's easy enough to follow.
2019-12-28 05:55:52 +01:00
|
|
|
#ifdef VULKAN
|
|
|
|
layout(set = 0, binding = 1) uniform ufBlock
|
|
|
|
{
|
|
|
|
uniform ivec4 uf_remappedVS[5];
|
|
|
|
// uniform vec2 uf_windowSpaceToClipSpaceTransform; // Cemu optimized this uf_variable away in Cemu 1.15.7
|
|
|
|
};
|
|
|
|
#else
|
2017-10-17 23:38:23 +02:00
|
|
|
uniform ivec4 uf_remappedVS[5];
|
Update BotW packs for Vulkan (#411)
But now done properly! Basically, a bunch of improvements were made to the script. The previous attempt at this conversion was quickly followed by a rollback since I realized that the script was overlooking certain things that made most of the packs hit or miss whether they would work. A few things missing were:
- It only tested the values from 1 preset. Now, each shader gets compiled per each preset, like what Cemu would do. It also merges the changes done for each preset into one. This should solve cases where one shader would define things separately or repeatedly from preset to preset.
- All* of the shaders are tested to see if they use the converter used the right values for the locations for Vulkan.
Both of these *should* mean that they should both compile and be linkable in Vulkan, which means that I don't have to test each individual shader to see if they work. I will release the two scripts (one used for converting, one used for checking the right values for the locations) tomorrow so that other people might be able to help, if they want. It's fairly straightforward now at least.
* Organize workaround graphic packs
Pretty hard to organize these correctly, but according to our discord discussion, this was the best layout from a bunch I proposed, together with some suggestions.
* Add V4 converter script and instructions on how to use it
Now everyone BotW is done and all of the bugs have been kinked out using it (hopefully...), here's the release of the converter script in all of it's very badly coded glory. I hope I didn't leave too much debug glory in there...
Also, I hope that I didn't make too many grammatical mistakes in the instructions, but hopefully it's easy enough to follow.
2019-12-28 05:55:52 +01:00
|
|
|
// uniform vec2 uf_windowSpaceToClipSpaceTransform; // Cemu optimized this uf_variable away in Cemu 1.15.7
|
|
|
|
#endif
|
|
|
|
// uf_windowSpaceToClipSpaceTransform was moved to the ufBlock
|
|
|
|
TEXTURE_LAYOUT(32, 0, 0) uniform sampler2D textureUnitVS0;
|
|
|
|
ATTR_LAYOUT(0, 0) in uvec4 attrDataSem0;
|
|
|
|
ATTR_LAYOUT(0, 1) in uvec4 attrDataSem1;
|
2017-10-17 23:38:23 +02:00
|
|
|
out gl_PerVertex
|
|
|
|
{
|
|
|
|
vec4 gl_Position;
|
|
|
|
float gl_PointSize;
|
|
|
|
};
|
|
|
|
layout(location = 1) out vec4 passParameterSem2;
|
|
|
|
layout(location = 0) out vec4 passParameterSem0;
|
|
|
|
layout(location = 2) out vec4 passParameterSem6;
|
|
|
|
int clampFI32(int v)
|
|
|
|
{
|
|
|
|
if( v == 0x7FFFFFFF )
|
|
|
|
return floatBitsToInt(1.0);
|
|
|
|
else if( v == 0xFFFFFFFF )
|
|
|
|
return floatBitsToInt(0.0);
|
|
|
|
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
|
|
|
|
}
|
|
|
|
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
ivec4 R0i = ivec4(0);
|
|
|
|
ivec4 R1i = ivec4(0);
|
|
|
|
ivec4 R2i = ivec4(0);
|
|
|
|
ivec4 R3i = ivec4(0);
|
|
|
|
ivec4 R4i = ivec4(0);
|
|
|
|
ivec4 R123i = ivec4(0);
|
|
|
|
ivec4 R125i = ivec4(0);
|
|
|
|
ivec4 R126i = ivec4(0);
|
|
|
|
ivec4 R127i = ivec4(0);
|
|
|
|
uvec4 attrDecoder;
|
|
|
|
int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i;
|
|
|
|
ivec4 PV0i = ivec4(0), PV1i = ivec4(0);
|
|
|
|
int PS0i = 0, PS1i = 0;
|
|
|
|
ivec4 tempi = ivec4(0);
|
|
|
|
float tempResultf;
|
|
|
|
int tempResulti;
|
|
|
|
ivec4 ARi = ivec4(0);
|
|
|
|
bool predResult = true;
|
|
|
|
vec3 cubeMapSTM;
|
|
|
|
int cubeMapFaceId;
|
|
|
|
R0i = ivec4(gl_VertexID, 0, 0, gl_InstanceID);
|
|
|
|
attrDecoder.xyzw = attrDataSem0.xyzw;
|
|
|
|
attrDecoder = ((attrDecoder>>8)&0xFF)|((attrDecoder<<8)&0xFF00);
|
|
|
|
attrDecoder.xyzw = floatBitsToInt(vec4(unpackHalf2x16(attrDecoder.x|(attrDecoder.y<<16)),unpackHalf2x16(attrDecoder.z|(attrDecoder.w<<16))));
|
|
|
|
R1i = ivec4(int(attrDecoder.x), int(attrDecoder.y), int(attrDecoder.z), int(attrDecoder.w));
|
|
|
|
attrDecoder.x = attrDataSem1.x;
|
|
|
|
attrDecoder.x = (attrDecoder.x>>24)|((attrDecoder.x>>8)&0xFF00)|((attrDecoder.x<<8)&0xFF0000)|((attrDecoder.x<<24));
|
|
|
|
attrDecoder.y = 0;
|
|
|
|
attrDecoder.z = 0;
|
|
|
|
attrDecoder.w = 0;
|
|
|
|
attrDecoder.xyzw = uvec4((attrDecoder.x>>0)&0x3FF,(attrDecoder.x>>10)&0x3FF,(attrDecoder.x>>20)&0x3FF,(attrDecoder.x>>30)&0x3);
|
|
|
|
if( (attrDecoder.x&0x200) != 0 ) attrDecoder.x |= 0xFFFFFC00;
|
|
|
|
if( (attrDecoder.y&0x200) != 0 ) attrDecoder.y |= 0xFFFFFC00;
|
|
|
|
if( (attrDecoder.z&0x200) != 0 ) attrDecoder.z |= 0xFFFFFC00;
|
|
|
|
attrDecoder.x = floatBitsToUint(max(float(int(attrDecoder.x))/511.0,-1.0));
|
|
|
|
attrDecoder.y = floatBitsToUint(max(float(int(attrDecoder.y))/511.0,-1.0));
|
|
|
|
attrDecoder.z = floatBitsToUint(max(float(int(attrDecoder.z))/511.0,-1.0));
|
|
|
|
attrDecoder.w = floatBitsToUint(float(attrDecoder.w));
|
|
|
|
R2i = ivec4(int(attrDecoder.x), int(attrDecoder.y), int(attrDecoder.z), int(attrDecoder.w));
|
|
|
|
// 0
|
|
|
|
backupReg0i = R0i.x;
|
|
|
|
PV0i.x = 0x3f800000;
|
|
|
|
PV0i.y = 0x40400000;
|
|
|
|
PV0i.z = (backupReg0i == int(1))?int(0xFFFFFFFF):int(0x0);
|
|
|
|
R127i.w = 0x3f800000;
|
|
|
|
R127i.x = 0xbf800000;
|
|
|
|
PS0i = R127i.x;
|
|
|
|
// 1
|
|
|
|
PV1i.x = floatBitsToInt(intBitsToFloat(uf_remappedVS[0].z) * intBitsToFloat(0x3b808081));
|
|
|
|
R0i.y = 0;
|
|
|
|
R123i.z = ((PV0i.z == 0)?(PV0i.x):(0xc0400000));
|
|
|
|
PV1i.z = R123i.z;
|
|
|
|
R123i.w = ((PV0i.z == 0)?(PV0i.y):(0xbf800000));
|
|
|
|
PV1i.w = R123i.w;
|
|
|
|
R2i.w = 0x3f800000;
|
|
|
|
PS1i = R2i.w;
|
|
|
|
// 2
|
|
|
|
R2i.x = ((R0i.x == 0)?(R127i.x):(PV1i.w));
|
|
|
|
PV0i.x = R2i.x;
|
|
|
|
R2i.y = ((R0i.x == 0)?(R127i.w):(PV1i.z));
|
|
|
|
PV0i.y = R2i.y;
|
|
|
|
R2i.z = floatBitsToInt(intBitsToFloat(PV1i.x) + -(0.5));
|
|
|
|
R2i.z = floatBitsToInt(intBitsToFloat(R2i.z) * 2.0);
|
|
|
|
R0i.w = 0x3d2aaaab;
|
|
|
|
R1i.x = 0x3e000000;
|
|
|
|
PS0i = R1i.x;
|
|
|
|
// 3
|
|
|
|
R3i.x = uf_remappedVS[1].z;
|
|
|
|
R3i.x = floatBitsToInt(intBitsToFloat(R3i.x) / 2.0);
|
|
|
|
R1i.y = 0;
|
|
|
|
R1i.z = floatBitsToInt(-(intBitsToFloat(PV0i.y)));
|
|
|
|
R1i.w = floatBitsToInt(-(intBitsToFloat(uf_remappedVS[2].z)));
|
|
|
|
R1i.w = floatBitsToInt(intBitsToFloat(R1i.w) / 2.0);
|
|
|
|
R4i.x = floatBitsToInt((intBitsToFloat(PV0i.x) * 0.5 + 0.5));
|
|
|
|
PS1i = R4i.x;
|
|
|
|
R0i.w = floatBitsToInt(texture(textureUnitVS0, intBitsToFloat(R0i.wy)).x);
|
|
|
|
R0i.xyz = floatBitsToInt(texture(textureUnitVS0, intBitsToFloat(R1i.xy)).xyz);
|
|
|
|
// export
|
Update BotW packs for Vulkan (#411)
But now done properly! Basically, a bunch of improvements were made to the script. The previous attempt at this conversion was quickly followed by a rollback since I realized that the script was overlooking certain things that made most of the packs hit or miss whether they would work. A few things missing were:
- It only tested the values from 1 preset. Now, each shader gets compiled per each preset, like what Cemu would do. It also merges the changes done for each preset into one. This should solve cases where one shader would define things separately or repeatedly from preset to preset.
- All* of the shaders are tested to see if they use the converter used the right values for the locations for Vulkan.
Both of these *should* mean that they should both compile and be linkable in Vulkan, which means that I don't have to test each individual shader to see if they work. I will release the two scripts (one used for converting, one used for checking the right values for the locations) tomorrow so that other people might be able to help, if they want. It's fairly straightforward now at least.
* Organize workaround graphic packs
Pretty hard to organize these correctly, but according to our discord discussion, this was the best layout from a bunch I proposed, together with some suggestions.
* Add V4 converter script and instructions on how to use it
Now everyone BotW is done and all of the bugs have been kinked out using it (hopefully...), here's the release of the converter script in all of it's very badly coded glory. I hope I didn't leave too much debug glory in there...
Also, I hope that I didn't make too many grammatical mistakes in the instructions, but hopefully it's easy enough to follow.
2019-12-28 05:55:52 +01:00
|
|
|
SET_POSITION(vec4(intBitsToFloat(R2i.x), intBitsToFloat(R2i.y), intBitsToFloat(R2i.z), intBitsToFloat(R2i.w)));
|
2017-10-17 23:38:23 +02:00
|
|
|
// export
|
|
|
|
passParameterSem2 = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.w));
|
|
|
|
// 0
|
|
|
|
R127i.x = floatBitsToInt(intBitsToFloat(R3i.x) + -(0.5));
|
|
|
|
R4i.y = floatBitsToInt((intBitsToFloat(R1i.z) * 0.5 + 0.5));
|
|
|
|
PV0i.y = R4i.y;
|
|
|
|
PV0i.z = floatBitsToInt(-(intBitsToFloat(R2i.y)));
|
|
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(PV0i.z) / 2.0);
|
|
|
|
PV0i.w = R2i.x;
|
|
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(PV0i.w) / 2.0);
|
|
|
|
R126i.x = floatBitsToInt(intBitsToFloat(R1i.w) + -(0.5));
|
|
|
|
PS0i = R126i.x;
|
|
|
|
// 1
|
|
|
|
R125i.x = uf_remappedVS[3].y;
|
|
|
|
R125i.x = floatBitsToInt(intBitsToFloat(R125i.x) * 2.0);
|
|
|
|
R126i.y = floatBitsToInt(-(intBitsToFloat(uf_remappedVS[3].x)));
|
|
|
|
R126i.y = floatBitsToInt(intBitsToFloat(R126i.y) * 2.0);
|
|
|
|
PV1i.y = R126i.y;
|
|
|
|
R123i.z = floatBitsToInt((intBitsToFloat(uf_remappedVS[4].w) / resYScale * 2.0 + intBitsToFloat(PV0i.y)));
|
|
|
|
PV1i.z = R123i.z;
|
|
|
|
PV1i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + intBitsToFloat(R3i.x));
|
|
|
|
R127i.z = floatBitsToInt(intBitsToFloat(PV0i.z) + intBitsToFloat(R1i.w));
|
|
|
|
PS1i = R127i.z;
|
|
|
|
// 2
|
|
|
|
PV0i.x = floatBitsToInt(intBitsToFloat(PV1i.z) + intBitsToFloat(R126i.x));
|
|
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(R4i.x) + intBitsToFloat(R127i.x));
|
|
|
|
R126i.z = floatBitsToInt((-(intBitsToFloat(uf_remappedVS[4].w) / resYScale) * intBitsToFloat(0x3c23d70a) + intBitsToFloat(R4i.y)));
|
|
|
|
R123i.w = floatBitsToInt((intBitsToFloat(uf_remappedVS[4].z) / resXScale * 2.0 + intBitsToFloat(R4i.x)));
|
|
|
|
PV0i.w = R123i.w;
|
|
|
|
R127i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.y), intBitsToFloat(PV1i.w)));
|
|
|
|
PS0i = R127i.y;
|
|
|
|
// 3
|
|
|
|
backupReg0i = R127i.x;
|
|
|
|
R127i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R125i.x), intBitsToFloat(R127i.z)));
|
|
|
|
R123i.y = floatBitsToInt((-(intBitsToFloat(uf_remappedVS[4].z) / resXScale) * intBitsToFloat(0x3c23d70a) + intBitsToFloat(R4i.x)));
|
|
|
|
PV1i.y = R123i.y;
|
|
|
|
R127i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R126i.y), intBitsToFloat(PV0i.y)));
|
|
|
|
R127i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + intBitsToFloat(backupReg0i));
|
|
|
|
R125i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R125i.x), intBitsToFloat(PV0i.x)));
|
|
|
|
PS1i = R125i.z;
|
|
|
|
// 4
|
|
|
|
R3i.x = PV1i.y;
|
|
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(R4i.y) + intBitsToFloat(R126i.x));
|
|
|
|
R3i.w = R126i.z;
|
|
|
|
R4i.z = R127i.y;
|
|
|
|
PS0i = R4i.z;
|
|
|
|
// 5
|
|
|
|
R1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R126i.y), intBitsToFloat(R127i.w)));
|
|
|
|
R1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R125i.x), intBitsToFloat(PV0i.z)));
|
|
|
|
R1i.z = R127i.z;
|
|
|
|
R4i.w = R127i.x;
|
|
|
|
R1i.w = R125i.z;
|
|
|
|
PS1i = R1i.w;
|
|
|
|
// export
|
|
|
|
passParameterSem0 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w));
|
|
|
|
// export
|
|
|
|
// skipped export to semanticId 255
|
|
|
|
// export
|
|
|
|
passParameterSem6 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.x), intBitsToFloat(R3i.x), intBitsToFloat(R3i.w));
|
|
|
|
}
|