GPU/HW: Fix black dots with some texture filters

JINC2 specifically ended up with NaNs propagating through.
This commit is contained in:
Stenzek 2025-04-21 13:06:01 +10:00
parent f4df18b7cf
commit b4019f325c
No known key found for this signature in database
3 changed files with 12 additions and 5 deletions

View File

@ -309,9 +309,10 @@ float4 resampler(float4 x)
// res = (x==float4(0.0, 0.0, 0.0, 0.0)) ? float4(wa*wb) : sin(x*wa)*sin(x*wb)/(x*x);
// Need to use mix(.., equal(..)) since we want zero check to be component wise
res = lerp(sin(x*wa)*sin(x*wb)/(x*x), float4(wa*wb, wa*wb, wa*wb, wa*wb), VECTOR_COMP_EQ(x,float4(0.0, 0.0, 0.0, 0.0)));
return res;
float4 a = sin(x * wa) * sin(x * wb) / (x * x);
float4 b = float4(wa*wb, wa*wb, wa*wb, wa*wb);
bool4 s = VECTOR_COMP_EQ(x, float4(0.0, 0.0, 0.0, 0.0));
return float4(s.x ? b.x : a.x, s.y ? b.y : a.y, s.z ? b.z : a.z, s.w ? b.w : a.w);
}
void FilteredSampleFromVRAM(TEXPAGE_VALUE texpage, float2 coords, float4 uv_limits,

View File

@ -5,4 +5,4 @@
#include "common/types.h"
static constexpr u32 SHADER_CACHE_VERSION = 31;
static constexpr u32 SHADER_CACHE_VERSION = 32;

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "shadergen.h"
@ -272,6 +272,9 @@ void ShaderGen::WriteHeader(std::stringstream& ss, bool enable_rov /* = false */
ss << "#define uint2 uvec2\n";
ss << "#define uint3 uvec3\n";
ss << "#define uint4 uvec4\n";
ss << "#define bool2 bvec2\n";
ss << "#define bool3 bvec3\n";
ss << "#define bool4 bvec4\n";
ss << "#define float2x2 mat2\n";
ss << "#define float3x3 mat3\n";
ss << "#define float4x4 mat4\n";
@ -324,6 +327,9 @@ void ShaderGen::WriteHeader(std::stringstream& ss, bool enable_rov /* = false */
ss << "#define uivec2 uint2\n";
ss << "#define uivec3 uint3\n";
ss << "#define uivec4 uint4\n";
ss << "#define bvec2 bool2\n";
ss << "#define bvec3 bool3\n";
ss << "#define bvec4 bool4\n";
ss << "#define mat2 float2x2\n";
ss << "#define mat3 float3x3\n";
ss << "#define mat4 float4x4\n";