Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions src/games/wutheringwaves/3_2/effect/letterbox_0xE684565E.ps_6_0.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
Texture2D<float4> t0 : register(t0);

cbuffer cb0 : register(b0) {
float2 $Globals_000 : packoffset(c000.x);
float2 $Globals_008 : packoffset(c000.z);
float2 $Globals_016 : packoffset(c001.x);
float2 $Globals_024 : packoffset(c001.z);
int2 $Globals_032 : packoffset(c002.x);
int2 $Globals_040 : packoffset(c002.z);
float2 $Globals_048 : packoffset(c003.x);
float2 $Globals_056 : packoffset(c003.z);
float2 $Globals_064 : packoffset(c004.x);
float2 $Globals_072 : packoffset(c004.z);
float2 $Globals_080 : packoffset(c005.x);
float2 $Globals_088 : packoffset(c005.z);
float2 $Globals_096 : packoffset(c006.x);
float2 $Globals_104 : packoffset(c006.z);
float2 $Globals_112 : packoffset(c007.x);
float2 $Globals_120 : packoffset(c007.z);
float2 $Globals_128 : packoffset(c008.x);
float2 $Globals_136 : packoffset(c008.z);
int2 $Globals_144 : packoffset(c009.x);
int2 $Globals_152 : packoffset(c009.z);
float2 $Globals_160 : packoffset(c010.x);
float2 $Globals_168 : packoffset(c010.z);
float2 $Globals_176 : packoffset(c011.x);
float2 $Globals_184 : packoffset(c011.z);
float2 $Globals_192 : packoffset(c012.x);
float2 $Globals_200 : packoffset(c012.z);
float2 $Globals_208 : packoffset(c013.x);
float2 $Globals_216 : packoffset(c013.z);
float2 $Globals_224 : packoffset(c014.x);
float2 $Globals_232 : packoffset(c014.z);
float2 $Globals_240 : packoffset(c015.x);
float2 $Globals_248 : packoffset(c015.z);
int2 $Globals_256 : packoffset(c016.x);
int2 $Globals_264 : packoffset(c016.z);
float2 $Globals_272 : packoffset(c017.x);
float2 $Globals_280 : packoffset(c017.z);
float2 $Globals_288 : packoffset(c018.x);
float2 $Globals_296 : packoffset(c018.z);
float2 $Globals_304 : packoffset(c019.x);
float2 $Globals_312 : packoffset(c019.z);
float2 $Globals_320 : packoffset(c020.x);
float2 $Globals_328 : packoffset(c020.z);
float2 $Globals_336 : packoffset(c021.x);
float2 $Globals_344 : packoffset(c021.z);
float2 $Globals_352 : packoffset(c022.x);
float2 $Globals_360 : packoffset(c022.z);
int2 $Globals_368 : packoffset(c023.x);
int2 $Globals_376 : packoffset(c023.z);
float2 $Globals_384 : packoffset(c024.x);
float2 $Globals_392 : packoffset(c024.z);
float2 $Globals_400 : packoffset(c025.x);
float2 $Globals_408 : packoffset(c025.z);
float2 $Globals_416 : packoffset(c026.x);
float2 $Globals_424 : packoffset(c026.z);
float2 $Globals_432 : packoffset(c027.x);
float2 $Globals_440 : packoffset(c027.z);
float2 $Globals_448 : packoffset(c028.x);
float2 $Globals_456 : packoffset(c028.z);
float2 $Globals_464 : packoffset(c029.x);
float2 $Globals_472 : packoffset(c029.z);
int2 $Globals_480 : packoffset(c030.x);
int2 $Globals_488 : packoffset(c030.z);
float2 $Globals_496 : packoffset(c031.x);
float2 $Globals_504 : packoffset(c031.z);
float2 $Globals_512 : packoffset(c032.x);
float2 $Globals_520 : packoffset(c032.z);
float2 $Globals_528 : packoffset(c033.x);
float2 $Globals_536 : packoffset(c033.z);
float2 $Globals_544 : packoffset(c034.x);
float2 $Globals_552 : packoffset(c034.z);
float2 $Globals_560 : packoffset(c035.x);
float2 $Globals_568 : packoffset(c035.z);
float2 $Globals_576 : packoffset(c036.x);
float2 $Globals_584 : packoffset(c036.z);
int2 $Globals_592 : packoffset(c037.x);
int2 $Globals_600 : packoffset(c037.z);
float2 $Globals_608 : packoffset(c038.x);
float2 $Globals_616 : packoffset(c038.z);
float2 $Globals_624 : packoffset(c039.x);
float2 $Globals_632 : packoffset(c039.z);
float2 $Globals_640 : packoffset(c040.x);
float2 $Globals_648 : packoffset(c040.z);
float2 $Globals_656 : packoffset(c041.x);
float2 $Globals_664 : packoffset(c041.z);
float4 $Globals_672 : packoffset(c042.x);
};

cbuffer cb1 : register(b1) {
float4 Material_000[2] : packoffset(c000.x);
float4 Material_032[1] : packoffset(c002.x);
};

SamplerState s0 : register(s0);

float4 main(
noperspective float4 SV_Position : SV_Position
) : SV_Target {
float4 SV_Target;
float4 _29 = t0.Sample(s0, float2(((((SV_Position.x - float((uint)((int)($Globals_592.x)))) * ($Globals_616.x)) * ($Globals_080.x)) + ($Globals_064.x)), ((((SV_Position.y - float((uint)((int)($Globals_592.y)))) * ($Globals_616.y)) * ($Globals_080.y)) + ($Globals_064.y))));
float _34 = select((_29.y < _29.z), 0.0f, 1.0f);
float _39 = (_34 * (_29.y - _29.z)) + _29.z;
float _40 = (_34 * (_29.z - _29.y)) + _29.y;
float _42 = 0.6666666865348816f - _34;
float _44 = select((_29.x < _39), 0.0f, 1.0f);
float _51 = (_44 * (_29.x - _39)) + _39;
float _52 = (_44 * (_39 - _29.x)) + _29.x;
float _54 = _51 - min(_52, _40);
float _66 = (Material_032[0].x) + abs((_42 + ((_52 - _40) / ((_54 * 6.0f) + 0.0010000000474974513f))) + (_44 * ((_34 + -1.0f) - _42)));
// Original Code
// float _69 = min(max((_54 / (_51 + 0.0010000000474974513f)), 0.0f), 1.0f);
// float _70 = min(max(_51, 0.0f), 1.0f);
float _69 = min(max((_54 / (_51 + 0.0010000000474974513f)), 0.0f), 1.0f);
float _70 = max(_51, 0.0f);
Comment on lines +115 to +116
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shader removed the non-negative clamp on SV_Target.xyz (previously max(..., 0.0f)). As written, if Material_032[0].y is outside [0, 1] (or if intermediate math overshoots), the lerp-like expression can produce negative output values, which commonly leads to downstream artifacts (NaNs in later ops, invalid blending, or unexpected tonemap behavior). If the goal is to avoid clamping highlights (upper bound), consider restoring only the lower-bound clamp (max(result, 0.0f)) while still allowing values > 1.0 for HDR.

Copilot uses AI. Check for mistakes.
float _104 = (((min(max((abs((frac(_66 + 1.0f) * 6.0f) + -3.0f) + -1.0f), 0.0f), 1.0f) + -1.0f) * _69) + 1.0f) * _70;
float _105 = (((min(max((abs((frac(_66 + 0.6666666865348816f) * 6.0f) + -3.0f) + -1.0f), 0.0f), 1.0f) + -1.0f) * _69) + 1.0f) * _70;
float _106 = (((min(max((abs((frac(_66 + 0.3333333432674408f) * 6.0f) + -3.0f) + -1.0f), 0.0f), 1.0f) + -1.0f) * _69) + 1.0f) * _70;
// Original Code
// SV_Target.x = max(((((Material_000[1].x) - _104) * (Material_032[0].y)) + _104), 0.0f);
// SV_Target.y = max(((((Material_000[1].y) - _105) * (Material_032[0].y)) + _105), 0.0f);
// SV_Target.z = max(((((Material_000[1].z) - _106) * (Material_032[0].y)) + _106), 0.0f);
SV_Target.x = ((((Material_000[1].x) - _104) * (Material_032[0].y)) + _104);
SV_Target.y = ((((Material_000[1].y) - _105) * (Material_032[0].y)) + _105);
SV_Target.z = ((((Material_000[1].z) - _106) * (Material_032[0].y)) + _106);
Comment on lines +124 to +126
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shader removed the non-negative clamp on SV_Target.xyz (previously max(..., 0.0f)). As written, if Material_032[0].y is outside [0, 1] (or if intermediate math overshoots), the lerp-like expression can produce negative output values, which commonly leads to downstream artifacts (NaNs in later ops, invalid blending, or unexpected tonemap behavior). If the goal is to avoid clamping highlights (upper bound), consider restoring only the lower-bound clamp (max(result, 0.0f)) while still allowing values > 1.0 for HDR.

Suggested change
SV_Target.x = ((((Material_000[1].x) - _104) * (Material_032[0].y)) + _104);
SV_Target.y = ((((Material_000[1].y) - _105) * (Material_032[0].y)) + _105);
SV_Target.z = ((((Material_000[1].z) - _106) * (Material_032[0].y)) + _106);
SV_Target.x = max(((((Material_000[1].x) - _104) * (Material_032[0].y)) + _104), 0.0f);
SV_Target.y = max(((((Material_000[1].y) - _105) * (Material_032[0].y)) + _105), 0.0f);
SV_Target.z = max(((((Material_000[1].z) - _106) * (Material_032[0].y)) + _106), 0.0f);

Copilot uses AI. Check for mistakes.
SV_Target.w = 1.0f;
return SV_Target;
}
Loading
Loading