Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
{
if (surface_rect)
D3DSURFACE_DESC desc;
IDirect3DSurface9_GetDesc(surface, &desc);
IDirect3DSurface9_GetDevice(surface, &device);
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE) {
surface_point.x = surface_rect->left;
surface_point.y = surface_rect->top;
IDirect3DSurface9 *temp_surface2;
D3DSURFACE_DESC temp_desc;
IDirect3DSurface9_GetDesc(temp_surface, &temp_desc);
hr = IDirect3DDevice9_CreateRenderTarget(device, temp_desc.Width, temp_desc.Height, temp_desc.Format,
D3DMULTISAMPLE_NONE, 0, FALSE, &temp_surface2, NULL);
I think this intermediate rendertarget can be avoided when D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES is advertised? I might be overlooking some other reason for it though.