Merge pull request #2237 from jackchentwkh/3D_mip_map_fix

fixing 3D mip-map conversion with volume texture, fix Halo
This commit is contained in:
PatrickvL 2021-06-12 10:21:46 +02:00 committed by GitHub
commit 23c1dcf1c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -6123,9 +6123,9 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex
if (!skipDueToNoPalette) { if (!skipDueToNoPalette) {
if (!ConvertD3DTextureToARGBBuffer( if (!ConvertD3DTextureToARGBBuffer(
X_Format, X_Format,
pSrc, pxMipWidth, pxMipHeight, dwMipRowPitch, dwSrcSlicePitch, pSrc, pxMipWidth, pxMipHeight, dwMipRowPitch, dwMipSize,//use dwMipSize instead of dwSrcSlicePitch here, because the mipSize changed in 3D mip map.
pDst, dwDstRowPitch, dwDstSlicePitch, pDst, dwDstRowPitch, dwDstSlicePitch,
dwDepth, pxMipDepth,//used pxMipDepth here because in 3D mip map the 3rd dimension also shrinked to 1/2 at each mip level.
iTextureStage)) { iTextureStage)) {
CxbxKrnlCleanup("Unhandled conversion!"); CxbxKrnlCleanup("Unhandled conversion!");
} }
@ -6196,11 +6196,11 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex
} }
if (face == D3DCUBEMAP_FACE_POSITIVE_X) { if (face == D3DCUBEMAP_FACE_POSITIVE_X) {
dwCubeFaceSize += dwDepth * dwMipSize; dwCubeFaceSize += pxMipDepth * dwMipSize;
} }
// Calculate the next mipmap level dimensions // 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) { if (pxMipWidth > 1) {
pxMipWidth /= 2; pxMipWidth /= 2;
@ -6218,7 +6218,7 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex
} }
if (pxMipDepth > 1) { if (pxMipDepth > 1) {
pxMipDepth /= 2; pxMipDepth /= 2;//this is for 3D volumeTexture mip-map, it shrinked down to 1/2 in 3 dimensions. this variable should be used.
} }
} // for mipmap levels } // for mipmap levels