From 55e45e728eea3fabacef96255f23031ce04d6ecf Mon Sep 17 00:00:00 2001 From: jackchentwkh Date: Thu, 10 Jun 2021 11:33:54 +0800 Subject: [PATCH] using correct 3D mip map dimention sizes in all 3 dimensions, and calculate correct source size. this fix Halo, get in game. --- src/core/hle/D3D8/Direct3D9/Direct3D9.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp index 65b524a0a..746852967 100644 --- a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp +++ b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp @@ -6123,9 +6123,9 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex if (!skipDueToNoPalette) { if (!ConvertD3DTextureToARGBBuffer( X_Format, - pSrc, pxMipWidth, pxMipHeight, dwMipRowPitch, dwSrcSlicePitch, + pSrc, pxMipWidth, pxMipHeight, dwMipRowPitch, dwMipSize,//use dwMipSize instaed of dwSrcSlicePitch here, because the mipSize changed in 3D mip map. pDst, dwDstRowPitch, dwDstSlicePitch, - dwDepth, + pxMipDepth,//usd pxMipDepth here because in 3D mip map the 3rd dimension also shrinked to 1/2 at each mip level. iTextureStage)) { CxbxKrnlCleanup("Unhandled conversion!"); } @@ -6196,11 +6196,11 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex } if (face == D3DCUBEMAP_FACE_POSITIVE_X) { - dwCubeFaceSize += dwDepth * dwMipSize; + dwCubeFaceSize += pxMipDepth * dwMipSize; } // Calculate the next mipmap level dimensions - dwMipOffset += dwMipSize; + dwMipOffset += pxMipDepth * dwMipSize;//for 3D volumeTexture, the dwDepth >1 in mip_level 0, pxMipDepth must be multiplied. if (pxMipWidth > 1) { pxMipWidth /= 2; @@ -6218,7 +6218,7 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex } if (pxMipDepth > 1) { - pxMipDepth /= 2; + pxMipDepth /= 2;//this is for 3D volumeTexture mip-map, it shrinked down to 1/2 in 3 diemesions. this variable should be used. } } // for mipmap levels