From c7702913db03cf353e04131b04f7ffd95e9500c1 Mon Sep 17 00:00:00 2001 From: narzoul Date: Sun, 14 May 2023 12:44:14 +0200 Subject: [PATCH] Updated gamma conversion formula for Intel GPUs See issue #216. --- DDrawCompat/D3dDdi/ShaderBlitter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DDrawCompat/D3dDdi/ShaderBlitter.cpp b/DDrawCompat/D3dDdi/ShaderBlitter.cpp index a1db838..6c7c662 100644 --- a/DDrawCompat/D3dDdi/ShaderBlitter.cpp +++ b/DDrawCompat/D3dDdi/ShaderBlitter.cpp @@ -62,7 +62,7 @@ namespace { for (UINT i = 0; i < 256; ++i) { - ptr[i] = static_cast(ramp[i] * 0xFF / 0xFFFF); + ptr[i] = static_cast(ramp[i] / 256); } } } @@ -693,8 +693,7 @@ namespace D3dDdi g_isGammaRampDefault = true; for (WORD i = 0; i < 256 && g_isGammaRampDefault; ++i) { - const WORD defaultRamp = i * 0xFFFF / 0xFF; - g_isGammaRampDefault = defaultRamp == ramp.Red[i] && defaultRamp == ramp.Green[i] && defaultRamp == ramp.Blue[i]; + g_isGammaRampDefault = i == ramp.Red[i] / 256 && i == ramp.Green[i] / 256 && i == ramp.Blue[i] / 256; } g_isGammaRampInvalidated = !g_isGammaRampDefault; }