On 19 August 2016 at 14:51, Patrick Rudolph <siro(a)das-labor.org> wrote:
> diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
> index fbafa14..a163ed9 100644
> --- a/dlls/d3d9/tests/device.c
> +++ b/dlls/d3d9/tests/device.c
> @@ -7141,6 +7141,12 @@ static void test_lockrect_offset(void)
> ok(locked_rect.Pitch == expected_pitch, "Got unexpected pitch %d for format %s, expected %d.\n",
> locked_rect.Pitch, dxt_formats[i].name, expected_pitch);
>
> + /* Make sure that for "unknown" formats like ATIx the buffer has a
> + * size of pitch * height bytes */
> + if ((dxt_formats[i].format == MAKEFOURCC('A','T','I','1')) ||
> + (dxt_formats[i].format == MAKEFOURCC('A','T','I','2')))
> + memset(base, 0, expected_pitch * 128);
> +
> hr = IDirect3DSurface9_UnlockRect(surface);
> ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr);
>
Well, this passes here on its own, albeit with minor memory
corruption, so doesn't make for a very convincing test. Would adding
these to test_miptree_layout() work?
> + /* For "unknown" formats like ATIx the pitch equals width. */
> + if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_BROKEN_PITCH)
> + {
> + *row_pitch = width;
> + *slice_pitch = *row_pitch * height;
> + }
The comment needs some work. If the test ends up working out, and this
turns out to be the right place to do this, there are a couple of
other places that explicitly handle WINED3DFMT_FLAG_BROKEN_PITCH now
that may no longer need to if we handle it here.