From 02a17313ec51788d92f0196ae4e58583f57158b9 Mon Sep 17 00:00:00 2001 From: dinkc64 <12570148+dinkc64@users.noreply.github.com> Date: Sat, 14 Jun 2014 18:33:59 +0000 Subject: [PATCH] Fix for 32bpp emulation in the Enhanced (D3D7) blitter --- src/intf/video/win32/vid_d3d.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/intf/video/win32/vid_d3d.cpp b/src/intf/video/win32/vid_d3d.cpp index 86032e53e..9998715eb 100644 --- a/src/intf/video/win32/vid_d3d.cpp +++ b/src/intf/video/win32/vid_d3d.cpp @@ -569,18 +569,39 @@ static int vidCreateGameSurfaces() // Determine if we should use a texture format different from the screen format bForceTextureFormat = false; if (VidSoftFXCheckDepth(nPreScaleEffect, 16) != 32 && nVidScrnDepth > 16 && - ((bDrvOkay || VidSoftFXCheckDepth(nPreScaleEffect, 32) != 32) || - (bDrvOkay && (bVidForce16bit || !bDoGamma || (nVidFullscreen && bVidUseHardwareGamma) || (!nVidFullscreen && bHardwareGammaOnly))))) + ((bDrvOkay && VidSoftFXCheckDepth(nPreScaleEffect, 32) != 32) || + (bDrvOkay && (bVidForce16bit || + (bDoGamma && nVidFullscreen && bVidUseHardwareGamma) || + (bDoGamma && !nVidFullscreen && bHardwareGammaOnly)))) + ) { memset(&ddpf, 0, sizeof(DDPIXELFORMAT)); pD3DDevice->EnumTextureFormats(&myEnumTexturesCallback, (void*)&ddpf); if (ddpf.dwSize) { - bForceTextureFormat = true; + bForceTextureFormat = true; // NOTE: this makes emulation=16bpp } } + /* { // debug code for the above if-statement :) + int ii; + ii = VidSoftFXCheckDepth(nPreScaleEffect, 16) != 32 && nVidScrnDepth > 16; + bprintf(0, _T("Part1 %d "), ii); + ii = (bDrvOkay || VidSoftFXCheckDepth(nPreScaleEffect, 32) != 32); + bprintf(0, _T("Part2 %d \n"), ii); + ii = (bDoGamma && nVidFullscreen && bVidUseHardwareGamma); + bprintf(0, _T("(bDoGamma && nVidFullscreen && bVidUseHardwareGamma) == [%d]\n"), ii); + ii = (bDoGamma && !nVidFullscreen && bHardwareGammaOnly); + bprintf(0, _T("(bDoGamma && !nVidFullscreen && bHardwareGammaOnly) == [%d]\n"), ii); + bprintf(0, _T("nPreScaleEffect [%X]\n"), nPreScaleEffect); + bprintf(0, _T("VidSoftFXCheckDepth(nPreScaleEffect, 16) [%d]\n"), VidSoftFXCheckDepth(nPreScaleEffect, 16)); + bprintf(0, _T("VidSoftFXCheckDepth(nPreScaleEffect, 32) [%d]\n"), VidSoftFXCheckDepth(nPreScaleEffect, 32)); + bprintf(0, _T("nVidScrnDepth [%X] bDrvOkay [%X]\n"), nVidScrnDepth, bDrvOkay); + bprintf(0, _T("bVidForce16bit[%X] forcetexture[%X]\n"), bVidForce16bit, bForceTextureFormat); + bprintf(0, _T("bDoGamma [%X] nVidFullscreen [%X] bVidUseHardwareGamma [%X] bHardwareGammaOnly [%X]\n"), bDoGamma, nVidFullscreen, bVidUseHardwareGamma, bHardwareGammaOnly); + } +*/ // Create a secondary surface to render the game image onto for the feedback effect memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd);