GS/HW: Cleanup gl and vk shaders.
Some checks are pending
🐧 Linux Builds / AppImage (push) Waiting to run
🐧 Linux Builds / Flatpak (push) Waiting to run
🍎 MacOS Builds / Defaults (push) Waiting to run
🏭 Create Release / Create Tag and Release (push) Waiting to run
🏭 Create Release / Linux (push) Blocked by required conditions
🏭 Create Release / Windows (push) Blocked by required conditions
🏭 Create Release / MacOS (push) Blocked by required conditions
🏭 Create Release / Upload Artifacts (push) Blocked by required conditions
🖥️ Windows Builds / Lint VS Project Files (push) Waiting to run
🖥️ Windows Builds / SSE4 (push) Blocked by required conditions
🖥️ Windows Builds / AVX2 (push) Blocked by required conditions
🖥️ Windows Builds / CMake (push) Waiting to run

gl: Rename fetch_rt to sample_from_rt to match vk shaders, remove old atst call.

vk: Make sure shuffle values have correct unsigned type.
This commit is contained in:
lightningterror 2025-02-16 22:07:33 +01:00
parent 4a44d2668c
commit d3e288447f
3 changed files with 13 additions and 15 deletions

View File

@ -111,7 +111,7 @@ layout(binding = 3) uniform sampler2D img_prim_min;
//layout(pixel_center_integer) in vec4 gl_FragCoord;
#endif
vec4 fetch_rt()
vec4 sample_from_rt()
{
#if !NEEDS_RT
return vec4(0.0);
@ -127,7 +127,7 @@ vec4 fetch_rt()
vec4 sample_c(vec2 uv)
{
#if PS_TEX_IS_FB == 1
return fetch_rt();
return sample_from_rt();
#elif PS_REGION_RECT
return texelFetch(TextureSampler, ivec2(uv), 0);
#else
@ -312,7 +312,7 @@ int fetch_raw_depth()
float multiplier = exp2(32.0f);
#if PS_TEX_IS_FB == 1
return int(fetch_rt().r * multiplier);
return int(sample_from_rt().r * multiplier);
#else
return int(texelFetch(TextureSampler, ivec2(gl_FragCoord.xy), 0).r * multiplier);
#endif
@ -321,7 +321,7 @@ int fetch_raw_depth()
vec4 fetch_raw_color()
{
#if PS_TEX_IS_FB == 1
return fetch_rt();
return sample_from_rt();
#else
return texelFetch(TextureSampler, ivec2(gl_FragCoord.xy), 0);
#endif
@ -697,8 +697,6 @@ vec4 ps_color()
vec4 C = tfx(T, PSin.c);
atst(C);
fog(C, PSin.t_float.z);
return C;
@ -709,9 +707,9 @@ void ps_fbmask(inout vec4 C)
// FIXME do I need special case for 16 bits
#if PS_FBMASK
#if PS_HDR == 1
vec4 RT = trunc(fetch_rt() * 65535.0f);
vec4 RT = trunc(sample_from_rt() * 65535.0f);
#else
vec4 RT = trunc(fetch_rt() * 255.0f + 0.1f);
vec4 RT = trunc(sample_from_rt() * 255.0f + 0.1f);
#endif
C = vec4((uvec4(C) & ~FbMask) | (uvec4(RT) & FbMask));
#endif
@ -799,7 +797,7 @@ float As = As_rgba.a;
#endif
#if SW_BLEND_NEEDS_RT
vec4 RT = fetch_rt();
vec4 RT = sample_from_rt();
#else
// Not used, but we define it to make the selection below simpler.
vec4 RT = vec4(0.0f);
@ -974,9 +972,9 @@ void ps_main()
#if PS_WRITE_RG == 1
// Pseudo 16 bits access.
float rt_a = fetch_rt().g;
float rt_a = sample_from_rt().g;
#else
float rt_a = fetch_rt().a;
float rt_a = sample_from_rt().a;
#endif
#if (PS_DATE & 3) == 1
@ -1028,9 +1026,9 @@ void ps_main()
#if SW_AD_TO_HW
#if PS_RTA_CORRECTION
vec4 RT = trunc(fetch_rt() * 128.0f + 0.1f);
vec4 RT = trunc(sample_from_rt() * 128.0f + 0.1f);
#else
vec4 RT = trunc(fetch_rt() * 255.0f + 0.1f);
vec4 RT = trunc(sample_from_rt() * 255.0f + 0.1f);
#endif
vec4 alpha_blend = vec4(RT.a / 128.0f);

View File

@ -954,7 +954,7 @@ vec4 ps_color()
T.a = float(denorm_c_before.a & 0x80u);
#else
T.r = float((denorm_c_before.r << 3) & 0xF8u);
T.g = float(((denorm_c_before.r >> 2) & 0x38) | ((denorm_c_before.g << 6) & 0xC0u));
T.g = float(((denorm_c_before.r >> 2) & 0x38u) | ((denorm_c_before.g << 6) & 0xC0u));
T.b = float((denorm_c_before.g << 1) & 0xF8u);
T.a = float(denorm_c_before.g & 0x80u);
#endif

View File

@ -3,4 +3,4 @@
/// Version number for GS and other shaders. Increment whenever any of the contents of the
/// shaders change, to invalidate the cache.
static constexpr u32 SHADER_CACHE_VERSION = 58;
static constexpr u32 SHADER_CACHE_VERSION = 59;