UnleashedRecomp/UnleashedRecomp/gpu/shader/csd_vs.hlsl
Skyth (Asilkan) d56b823b00
Aspect ratio adjustments. (Part 1) (#90)
* Map CSD structures by full path.

* Initial work for unstretching & aligning to edges.

* Add extend flag, fix cast lookups.

* Add right extend flag.

* Fill the flags map with a bunch of casts.

* Implement unstretching.

* Set more title casts to unscretch.

* Add some more flags.

* Move CSD patches to its own file.

* Replace CSD vertex shaders to get rid of pixel snapping.

* Snap to pixel on the CPU.

* Current work trying to get 3D screen position casts working correctly.

* Fix and properly align font, handle most 3D screen positions.

* Add stretch flags for background casts.

* Use 4:3 as the base aspect ratio instead of 16:9.

* Replicate the game's 4:3 downscaling behavior.

* World map now identical to original 4:3.

* Replace camera aspect ratio/field of view logic.

* Make original 4:3 scaling a separate option, use custom behavior for auto.

* Keep UI scale same only above Steam Deck aspect ratio.

* Release paths when the YNCP file gets freed.

* Add more path flags.

* Interpolate to original 4:3 scale.

* Scaling animation offset to prevent offscreen casts from showing up in ultrawide.

* Queue draw calls without actually executing anything to extract the corner.

* Clean unnecessary hooks.

* Add result screen modifiers.

* Stretch loading primitive 2D.

* Scale DoF correctly at different aspect ratios.

* Remove stretch option.

* Make aspect ratio a global variable.

* Ultrawide patch for HUD 3D items.

* Fix world map 3D to 2D projection.

* Right align world map info box.

* Set medal positions.

* Respect center option in more places.

* Implement the aspect ratio option.

* Use viewport dimensions for snapping CSD pixels.

* Fix DoF fix not using viewport height.

* Implement aspect ratio patches for 2D drop ring emitter.

* Implement inspire letterbox.

* Add cutscene aspect ratio option.

* Shift subtitles by aspect ratio.

* Fix crash in earth restoration cutscenes.

* Offset scale patches for Tornado Defense.

* Scale new record arrow casts.

* Expose aspect ratio variables globally.

* Properly center the achievements menu.

* 4:3 scaling for options menu.

* Fix procedural filtering logic in ImGui pixel shader.

* Fix button guide offset.

* UI scaling for installer.

* Remove grid snaps in the installer.

* Handle center UI scale option for rings going to HUD.

* Remove unnecessary diff.

* Revert temporary changes.

* Fix typo.
2025-01-18 01:51:45 +03:00

69 lines
1.9 KiB
HLSL

#include "../../../tools/ShaderRecomp/ShaderRecomp/shader_common.h"
#ifdef __spirv__
#define g_ViewportSize vk::RawBufferLoad<float4>(g_PushConstants.VertexShaderConstants + 2880, 0x10)
#define g_Z vk::RawBufferLoad<float4>(g_PushConstants.VertexShaderConstants + 3936, 0x10)
#else
cbuffer VertexShaderConstants : register(b0, space4)
{
float4 g_ViewportSize : packoffset(c180);
float4 g_Z : packoffset(c246);
};
cbuffer SharedConstants : register(b2, space4)
{
DEFINE_SHARED_CONSTANTS();
};
#endif
void main(
[[vk::location(0)]] in float4 iPosition0 : POSITION0,
[[vk::location(8)]] in float4 iColor0 : COLOR0,
[[vk::location(4)]] in float4 iTexCoord0 : TEXCOORD0,
out float4 oPos : SV_Position,
out float4 oTexCoord0 : TEXCOORD0,
out float4 oTexCoord1 : TEXCOORD1,
out float4 oTexCoord2 : TEXCOORD2,
out float4 oTexCoord3 : TEXCOORD3,
out float4 oTexCoord4 : TEXCOORD4,
out float4 oTexCoord5 : TEXCOORD5,
out float4 oTexCoord6 : TEXCOORD6,
out float4 oTexCoord7 : TEXCOORD7,
out float4 oTexCoord8 : TEXCOORD8,
out float4 oTexCoord9 : TEXCOORD9,
out float4 oTexCoord10 : TEXCOORD10,
out float4 oTexCoord11 : TEXCOORD11,
out float4 oTexCoord12 : TEXCOORD12,
out float4 oTexCoord13 : TEXCOORD13,
out float4 oTexCoord14 : TEXCOORD14,
out float4 oTexCoord15 : TEXCOORD15,
out float4 oColor0 : COLOR0,
out float4 oColor1 : COLOR1)
{
oPos.xy = (iPosition0.xy - 0.5) * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0);
oPos.z = g_Z.x;
oPos.w = 1.0;
oTexCoord0 = iColor0.wxyz;
oTexCoord1.xy = iTexCoord0.xy;
oTexCoord1.zw = 0.0;
oTexCoord2 = 0.0;
oTexCoord3 = 0.0;
oTexCoord4 = 0.0;
oTexCoord5 = 0.0;
oTexCoord6 = 0.0;
oTexCoord7 = 0.0;
oTexCoord8 = 0.0;
oTexCoord9 = 0.0;
oTexCoord10 = 0.0;
oTexCoord11 = 0.0;
oTexCoord12 = 0.0;
oTexCoord13 = 0.0;
oTexCoord14 = 0.0;
oTexCoord15 = 0.0;
oColor0 = 0.0;
oColor1 = 0.0;
}