Changelog
DXTn format has odd mipmap levels in that the space allocated for small levels needs a lot of padding
Jason
diff -u3 dlls/d3d8/dx78/device.c dlls/d3d8/device.c --- dlls/d3d8/dx78/device.c 2003-09-18 22:52:51.000000000 +0100 +++ dlls/d3d8/device.c 2003-09-19 00:28:48.000000000 +0100 @@ -853,8 +853,14 @@ object->myDesc.Usage = 0; object->myDesc.Pool = D3DPOOL_SYSTEMMEM; object->bytesPerPixel = D3DFmtGetBpp(This, Format); + /* DXTn mipmaps use the same number of 'levels' down to eg. 8x1, but since + it is based around 4x4 pixel blocks it requires padding, so allocate enough + space! */ if (Format == D3DFMT_DXT1) { - object->myDesc.Size = ((Width * object->bytesPerPixel) * Height) / 2; /* DXT1 is half byte per pixel */ + object->myDesc.Size = ((max(Width,4) * object->bytesPerPixel) * max(Height,4)) / 2; /* DXT1 is half byte per pixel */ + } else if (Format == D3DFMT_DXT2 || Format == D3DFMT_DXT3 || + Format == D3DFMT_DXT4 || Format == D3DFMT_DXT5) { + object->myDesc.Size = ((max(Width,4) * object->bytesPerPixel) * max(Height,4)); } else { object->myDesc.Size = (Width * object->bytesPerPixel) * Height; }