d3d12: Fix mipmap data

This commit is contained in:
vlj 2015-06-16 21:41:27 +02:00 committed by Vincent Lejeune
commit eda3c9084e

View file

@ -334,8 +334,6 @@ ID3D12Resource *uploadSingleTexture(
size_t currentHeight = heightInBlocks, currentWidth = widthInBlocks; size_t currentHeight = heightInBlocks, currentWidth = widthInBlocks;
unsigned tmp = texture.GetMipmap(); unsigned tmp = texture.GetMipmap();
if (tmp > 1)
printf("here");
for (unsigned mipLevel = 0; mipLevel < texture.GetMipmap(); mipLevel++) for (unsigned mipLevel = 0; mipLevel < texture.GetMipmap(); mipLevel++)
{ {
MipmapLevelInfo currentMipmapLevelInfo = {}; MipmapLevelInfo currentMipmapLevelInfo = {};
@ -366,7 +364,7 @@ ID3D12Resource *uploadSingleTexture(
dst[(row * currentMipmapLevelInfo.rowPitch / 4) + j] = src[LinearToSwizzleAddress(j, row, 0, log2width, log2height, 0)]; dst[(row * currentMipmapLevelInfo.rowPitch / 4) + j] = src[LinearToSwizzleAddress(j, row, 0, log2width, log2height, 0)];
} }
else else
memcpy((char*)textureData + offsetInDst + row * currentMipmapLevelInfo.rowPitch, (char*)pixels + offsetInSrc + row * currentWidth * blockSizeInByte, currentWidth * blockSizeInByte); memcpy((char*)textureData + offsetInDst + row * currentMipmapLevelInfo.rowPitch, (char*)pixels + offsetInSrc + row * widthInBlocks * blockSizeInByte, currentWidth * blockSizeInByte);
break; break;
} }
case CELL_GCM_TEXTURE_A4R4G4B4: case CELL_GCM_TEXTURE_A4R4G4B4:
@ -404,7 +402,7 @@ ID3D12Resource *uploadSingleTexture(
} }
offsetInDst += currentHeight * currentMipmapLevelInfo.rowPitch; offsetInDst += currentHeight * currentMipmapLevelInfo.rowPitch;
offsetInDst = powerOf2Align(offsetInDst, 256); offsetInDst = powerOf2Align(offsetInDst, 256);
offsetInSrc += currentHeight * currentWidth * blockSizeInByte; offsetInSrc += currentHeight * widthInBlocks * blockSizeInByte;
mipinfos.push_back(currentMipmapLevelInfo); mipinfos.push_back(currentMipmapLevelInfo);
currentHeight /= 2; currentHeight /= 2;
currentWidth /= 2; currentWidth /= 2;