From: Ziqing Hui zhui@codeweavers.com
A block-compressed texture is encoded in 4x4 blocks. Therefore, pitch is the number of bytes in a block of 4x4 texels. --- dlls/d3dx10_43/tests/d3dx10.c | 3 +-- dlls/d3dx10_43/texture.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index 94002b4d60d..ca604e02a1d 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -1301,8 +1301,7 @@ static void check_resource_data(ID3D10Resource *resource, const struct test_imag line_match = !memcmp(image->expected_data + stride * i, (BYTE *)map.pData + map.RowPitch * i, stride); todo_wine_if(is_block_compressed(image->expected_info.Format) - && ((image->expected_info.Width % 4 != 0 || image->expected_info.Height % 4 != 0) - || (image->expected_info.Height > 4 && i > 0))) + && (image->expected_info.Width % 4 != 0 || image->expected_info.Height % 4 != 0)) ok_(__FILE__, line)(line_match, "Data mismatch for line %u.\n", i); }
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c index 88efdf585b4..9752f3e1560 100644 --- a/dlls/d3dx10_43/texture.c +++ b/dlls/d3dx10_43/texture.c @@ -857,9 +857,10 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO
if (is_block_compressed(img_info.Format)) { + stride *= 4; if (FAILED(hr = IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICDdsFrameDecode, (void **)&dds_frame))) goto end; - if (FAILED(hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, stride * 4, frame_size, buffer))) + if (FAILED(hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, stride, frame_size, buffer))) goto end; } else