Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/texture.c:
TRACE("Texture created correctly. Now loading the texture data into it.\n");
- hr = load_cube_texture_from_dds(tex, src_data, palette, filter, color_key, &img_info);
- dst_fmt_desc = get_format_info(format);
- src_fmt_desc = get_format_info(img_info.Format);
- loaded_miplevels = min(img_info.MipLevels, IDirect3DCubeTexture9_GetLevelCount(tex));
- for (i = 0; i < loaded_miplevels; ++i)
- {
struct d3dx_pixels src_pixels, dst_pixels;
D3DSURFACE_DESC dst_surface_desc;
D3DLOCKED_RECT dst_locked_rect;
RECT dst_rect;
uint32_t face;
IDirect3DCubeTexture9_GetLevelDesc(tex, i, &dst_surface_desc);
SetRect(&dst_rect, 0, 0, dst_surface_desc.Width, dst_surface_desc.Height);
for (face = D3DCUBEMAP_FACE_POSITIVE_X; face <= D3DCUBEMAP_FACE_NEGATIVE_Z; ++face)
I'm a bit torn by this swapping of the layer and level loops. With this we "fight" how the data is actually stored in DDS files, instead of just copying data out sequentially. We do get to avoid a bunch of otherwise redundant `GetLevelDesc()` + `SetRect()` calls though.
How would this look for d3dx10/11?