Re: [3/7] d3d9/tests: Add a test for locking partial blocks (try 2)
On 18 October 2011 17:37, Henri Verbeet hverb...@gmail.com wrote: patch 3/7. The point is that test_lockrect_offset() is about the offset calculation, not so much about what valid rectangles for block based formats are.
Re: [3/7] d3d9/tests: Add a test for locking partial blocks (try 2)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 19.10.2011 um 11:49 schrieb Henri Verbeet: On 18 October 2011 17:37, Henri Verbeet hverb...@gmail.com wrote: patch 3/7. The point is that test_lockrect_offset() is about the offset calculation, not so much about what valid rectangles for block based formats are. Tbh I don't see the point in separating those two since both are determined by the block size, but OK. -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) iQIcBAEBAgAGBQJOnsGzAAoJEN0/YqbEcdMw3TkP/Rbg9Of3+rt2VGa+5WfEMQm+ 9RMhEEKczrRESh2vqDTpgufsIvGOwrbAmeDG7s89KpUwIBKawyoJhg2lR84/hwH5 DCyUxqKqYDbZzQt84AxHhEUfSvqCa7K4myLIT4BK1IFksI81NSVDTuYL/DtOWuFN KCx2J+z/BlZsURpJM2bGOmDbdy3iLuTYtSNuZFmjNbYVKYKSF3vGXQ1gUEmAdOFn i4BT+WhpFaVBN/YxXIlmwQ7lWuwiJwWDZZAiIAyTZAp+n9H0VE6P49y4kpH8otab AC3p5VV2QlmQyG2iir6WkYX4N/9z8cq6Mv/FRC87IZsIWPAS05XlJdAdWUlaAvO6 Gm81Gxd3WILnKtYvp9g2xhqesd4ZSVQyXNonglcLmKLIbR7hEGm7MWW+V7gyZrCF pjLDMlsg9h8ket7Dcpi9hA/q/8ChYh/dw7LKR8fbAcujgiCQaS3aork/O3CnVenu GO6rZtqFOj19gDcClbD07h8bDnPvKLMeCXNt7S4QIUhrQ8LAzLG1YDHogDxmNAau EDdq4dkfuabbJkMSiDeRAGsMHY99fSk+7fB8pOsEx2AgP2GnfynePboshsDVp3ri 0pKMklL4/2EsYZjca4x6ejqh2+iTdwlWiddIQa60vV9XolEHp4/TM4tIKCUdzfzJ fT3zosKQ6ZakgJ3KopoS =XwMm -END PGP SIGNATURE-
Re: [3/7] d3d9/tests: Add a test for locking partial blocks (try 2)
On 18 October 2011 12:43, Stefan Dösinger ste...@codeweavers.com wrote: Changes: Check for dynamic texture support, moved the format-specific tests to this patch. That's not really what I meant with make this part of the test in patch 3/7. The point is that test_lockrect_offset() is about the offset calculation, not so much about what valid rectangles for block based formats are. And it probably wouldn't hurt to run test_partial_block_lock() on the other formats like e.g. ATI2N anyway.
Re: [3/7] d3d9/tests: Add a test for locking partial blocks (try 2)
On Tuesday 18 October 2011 17:37:09 Henri Verbeet wrote: That's not really what I meant with make this part of the test in patch 3/7. The point is that test_lockrect_offset() is about the offset calculation, not so much about what valid rectangles for block based formats are. And it probably wouldn't hurt to run test_partial_block_lock() on the other formats like e.g. ATI2N anyway. I felt that merging the tests to test all format and pool combinations would cause needlessly complicated code because some format-pool combinations require surfaces, some require dynamic textures, some require normal textures and some are unsupported. That's why I introduced the new test that loops only over the pools. On the other hand we may at some point care about the offset returned by a allowed partial block lock, which is why putting the per-format test in test_partial_block_lock correct imo. Strictly speaking the test now verifies the block sizes directly instead of just verifying them indirectly as a side product of testing the stride, so we might as well rename it. ATI2N is a good point though. The locking behavior matches the 1x1 block definition in the d3d9 test. I'll change the test to verify that we can indeed lock single pixels in formats that are supposedly block-free(and that we can lock single lines in YUY2/UYVY) signature.asc Description: This is a digitally signed message part.
Re: [3/7] d3d9/tests: Add a test for locking partial blocks (try 2)
On Tuesday 18 October 2011 19:36:33 Stefan Dösinger wrote: I felt that merging the tests to test all format and pool combinations would cause needlessly complicated With a few simplifications like skipping all tests without dynamic textures it turns out okish. It's not too pretty. There are still a bunch of checks for caps and pools, but it should be readable. signature.asc Description: This is a digitally signed message part.
Re: [3/7] d3d9/tests: Add a test for locking partial blocks (try 2)
On Tuesday 18 October 2011 20:12:35 Stefan Dösinger wrote: On Tuesday 18 October 2011 19:36:33 Stefan Dösinger wrote: I felt that merging the tests to test all format and pool combinations would cause needlessly complicated With a few simplifications like skipping all tests without dynamic textures it turns out okish. It's not too pretty. There are still a bunch of checks for caps and pools, but it should be readable. This is a version of the patch with both tests merged into one that tests all format-pool combinations. I'll resend the patches tomorrow unless you have further suggestions. I changed the d3d8 patch in a similar way. From d49c0377ec20a5832e3eb0a76d64ac7690158b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= ste...@codeweavers.com Date: Fri, 14 Oct 2011 12:54:37 +0200 Subject: [PATCH 03/13] d3d9/tests: Test more properties of block-based surfaces --- dlls/d3d9/tests/surface.c | 194 ++--- 1 files changed, 164 insertions(+), 30 deletions(-) diff --git a/dlls/d3d9/tests/surface.c b/dlls/d3d9/tests/surface.c index 572478e..b2e0fd4 100644 --- a/dlls/d3d9/tests/surface.c +++ b/dlls/d3d9/tests/surface.c @@ -187,26 +187,32 @@ static void test_surface_alignment(IDirect3DDevice9 *device_ptr) /* Since the DXT formats are based on 4x4 blocks, locking works slightly * different than with regular formats. This patch verifies we return the * correct memory offsets */ -static void test_lockrect_offset(IDirect3DDevice9 *device) +static void test_format_blocks(IDirect3DDevice9 *device) { -IDirect3DSurface9 *surface = 0; +IDirect3DTexture9 *texture; +IDirect3DSurface9 *surface; IDirect3D9 *d3d; const RECT rect = {60, 60, 68, 68}; D3DLOCKED_RECT locked_rect; int expected_pitch; unsigned int expected_offset; unsigned int offset; -unsigned int i; +unsigned int i, j; BYTE *base; HRESULT hr; +RECT partial_rect; +BOOL surface_only; -const struct { +const struct +{ D3DFORMAT fmt; const char *name; unsigned int block_width; unsigned int block_height; unsigned int block_size; -} dxt_formats[] = { +} +formats[] = +{ {D3DFMT_DXT1, D3DFMT_DXT1, 4, 4, 8}, {D3DFMT_DXT2, D3DFMT_DXT2, 4, 4, 16}, {D3DFMT_DXT3, D3DFMT_DXT3, 4, 4, 16}, @@ -214,43 +220,171 @@ static void test_lockrect_offset(IDirect3DDevice9 *device) {D3DFMT_DXT5, D3DFMT_DXT5, 4, 4, 16}, {MAKEFOURCC('A','T','I','2'), ATI2N, 1, 1, 1}, }; +static const struct +{ +D3DPOOL pool; +const char *name; +HRESULT hr; +} +pools[] = +{ +{D3DPOOL_DEFAULT, D3DPOOL_DEFAULT, D3DERR_INVALIDCALL}, +{D3DPOOL_SCRATCH, D3DPOOL_SCRATCH, D3D_OK}, +{D3DPOOL_SYSTEMMEM, D3DPOOL_SYSTEMMEM,D3D_OK}, +{D3DPOOL_MANAGED, D3DPOOL_MANAGED, D3D_OK}, +}; + hr = IDirect3DDevice9_GetDirect3D(device, d3d); ok(SUCCEEDED(hr), IDirect3DDevice9_GetDirect3D failed (%08x)\n, hr); -for (i = 0; i (sizeof(dxt_formats) / sizeof(*dxt_formats)); ++i) { -hr = IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, dxt_formats[i].fmt); -if(FAILED(hr)) +for (i = 0; i (sizeof(formats) / sizeof(*formats)); ++i) { +surface_only = FALSE; +hr = IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DYNAMIC, +D3DRTYPE_TEXTURE, formats[i].fmt); +if (FAILED(hr)) { -skip(Format %s not supported, skipping lockrect offset test\n, dxt_formats[i].name); -continue; +hr = IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_SURFACE, formats[i].fmt); +if (FAILED(hr)) +{ +skip(Format %s not supported, skipping lockrect offset test\n, formats[i].name); +continue; +} +surface_only = TRUE; } -hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 128, 128, dxt_formats[i].fmt, D3DPOOL_SCRATCH, surface, 0); -ok(SUCCEEDED(hr), CreateOffscreenPlainSurface failed (%08x)\n, hr); +for (j = 0; j (sizeof(pools) / sizeof(*pools)); j++) +{ +switch (pools[j].pool) +{ +case D3DPOOL_MANAGED: +if (surface_only) continue; +/* Fall through */ +case D3DPOOL_DEFAULT: +if (surface_only) +{ +hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 128, 128, formats[i].fmt, +pools[j].pool, surface, 0); +ok(SUCCEEDED(hr), IDirect3DDevice9_CreateOffscreenPlainSurface