GPU/HW: Fix UB with reverse subtract and texture filtering on
This commit is contained in:
parent
b929afc33f
commit
9254fc9e63
|
@ -594,7 +594,7 @@ std::string GPU_HW_ShaderGen::GenerateBatchFragmentShader(GPU_HW::BatchRenderMod
|
||||||
WriteHeader(ss);
|
WriteHeader(ss);
|
||||||
DefineMacro(ss, "TRANSPARENCY", transparency != GPU_HW::BatchRenderMode::TransparencyDisabled);
|
DefineMacro(ss, "TRANSPARENCY", transparency != GPU_HW::BatchRenderMode::TransparencyDisabled);
|
||||||
DefineMacro(ss, "TRANSPARENCY_ONLY_OPAQUE", transparency == GPU_HW::BatchRenderMode::OnlyOpaque);
|
DefineMacro(ss, "TRANSPARENCY_ONLY_OPAQUE", transparency == GPU_HW::BatchRenderMode::OnlyOpaque);
|
||||||
DefineMacro(ss, "TRANSPARENCY_ONLY_TRANSPARENCY", transparency == GPU_HW::BatchRenderMode::OnlyTransparent);
|
DefineMacro(ss, "TRANSPARENCY_ONLY_TRANSPARENT", transparency == GPU_HW::BatchRenderMode::OnlyTransparent);
|
||||||
DefineMacro(ss, "TEXTURED", textured);
|
DefineMacro(ss, "TEXTURED", textured);
|
||||||
DefineMacro(ss, "PALETTE",
|
DefineMacro(ss, "PALETTE",
|
||||||
actual_texture_mode == GPU::TextureMode::Palette4Bit ||
|
actual_texture_mode == GPU::TextureMode::Palette4Bit ||
|
||||||
|
@ -889,19 +889,24 @@ void BilinearSampleFromVRAM(uint4 texpage, float2 coords, float4 uv_limits,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if TRANSPARENCY_ONLY_TRANSPARENCY
|
#if TRANSPARENCY_ONLY_TRANSPARENT
|
||||||
discard;
|
discard;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TRANSPARENCY_ONLY_OPAQUE
|
#if TRANSPARENCY_ONLY_OPAQUE
|
||||||
// We don't output the second color here because it's not used.
|
// We don't output the second color here because it's not used (except for filtering).
|
||||||
o_col0 = float4(color, oalpha);
|
o_col0 = float4(color, oalpha);
|
||||||
#elif USE_DUAL_SOURCE
|
#if USE_DUAL_SOURCE
|
||||||
|
o_col1 = float4(0.0, 0.0, 0.0, 1.0 - ialpha);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if USE_DUAL_SOURCE
|
||||||
o_col0 = float4(color, oalpha);
|
o_col0 = float4(color, oalpha);
|
||||||
o_col1 = float4(0.0, 0.0, 0.0, 1.0 - ialpha);
|
o_col1 = float4(0.0, 0.0, 0.0, 1.0 - ialpha);
|
||||||
#else
|
#else
|
||||||
o_col0 = float4(color, 1.0 - ialpha);
|
o_col0 = float4(color, 1.0 - ialpha);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
o_depth = oalpha * v_pos.z;
|
o_depth = oalpha * v_pos.z;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue